Function at 0x402050
Capabilities:
Get file size
Read file on windows
Set file attributes
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c
push ebx
push esi
push edi
mov edi, ecx
push 0x80
push edi
call dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
mov ecx, edi
call fcn.00401f20
push 0x14
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov esi, eax
test esi, esi
je 0x4020ad
push 1
push esi
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x4020a6
push 0
push 0
push 1
push esi
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
push esi
test eax, eax
je 0x4020a7
push 4
push edi
call dword [sym.imp.ADVAPI32.dll_SetFileSecurityW]
push esi
call dword [sym.imp.KERNEL32.dll_LocalFree]
push 0
push 0x80
push 3
push 0
push 0
push 0xc0000000
push edi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
je 0x402267
lea eax, [ebp - 0x18]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
push 0
push 0
push esi
call edi
lea eax, [ebp - 0xc]
mov dword [ebp - 0xc], 0
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push 0x7d00000
push 0
mov dword [ebp - 8], eax
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
cmp dword [ebp - 8], 0x3e80000
mov ebx, eax
jb 0x4021fc
xor edi, edi
push 0
push 0
push edi
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 4]
push eax
push 0x3e80000
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x4021ee
sub esp, 8
mov ecx, ebx
push 0
push 0x3e80000
call fcn.00401580
add esp, 0x10
push 0
push 0
push edi
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp - 4]
push eax
push 0x3e80000
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x4021ee
add edi, 0x1f400000
cmp edi, dword [ebp - 8]
jbe 0x402125
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 2
push 0
push 0xfc180000
push esi
call edi
push 0
lea eax, [ebp - 4]
push eax
push 0x3e80000
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x4021ee
sub esp, 8
mov ecx, ebx
push 0
push 0x3e80000
call fcn.00401580
add esp, 0x10
push 2
push 0
push 0xfc180000
push esi
call edi
push 0
lea eax, [ebp - 4]
push eax
push 0x3e80000
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40225e
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push 0
push 0
push 0
push esi
call edi
push 0
lea eax, [ebp - 4]
push eax
push dword [ebp - 8]
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x4021ee
mov eax, dword [ebp - 8]
sub esp, 8
cdq
mov ecx, ebx
push edx
push eax
call fcn.00401580
add esp, 0x10
push 0
push 0
push 0
push esi
call edi
push 0
lea eax, [ebp - 4]
push eax
push dword [ebp - 8]
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push esi
test eax, eax
je 0x4021ef
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call edi
push esi
call edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push esi
call edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret