Function at 0x406160
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x410638
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x1b8
push esi
push edi
cmp dword [ebp + 8], 0
jne 0x406195
push 6
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x4067f0
mov eax, dword [ebp + 8]
mov dword [ebp - 0x20], eax
cmp dword [ebp + 0xc], 0
je 0x4061b7
mov ecx, dword [ebp - 0x20]
push ecx
call fcn.00409f50
add esp, 4
mov eax, 1
jmp 0x4067f0
mov edx, dword [ebp - 0x20]
mov eax, dword [edx + 0x4c]
mov dword [ebp - 0x14c], eax
mov ecx, dword [ebp - 0x20]
mov edx, dword [ecx + 0x48]
mov dword [ebp - 0x150], edx
mov eax, dword [ebp - 0x150]
mov dword [ebp - 0x170], eax
mov eax, dword [ebp - 0x14c]
sub eax, dword [ebp - 0x170]
cdq
mov ecx, 0x1c
idiv ecx
cmp eax, 0x10
jg 0x406211
push 0
mov edx, dword [ebp - 0x14c]
push edx
mov eax, dword [ebp - 0x170]
push eax
call fcn.00410490
add esp, 0xc
jmp 0x4062ad
push 0
mov ecx, dword [ebp - 0x14c]
push ecx
mov edx, dword [ebp - 0x170]
push edx
call fcn.00410100
add esp, 0xc
push 0
mov eax, dword [ebp - 0x170]
add eax, 0x1c0
push eax
mov ecx, dword [ebp - 0x170]
push ecx
call fcn.00410490
add esp, 0xc
mov edx, dword [ebp - 0x170]
add edx, 0x1c0
mov dword [ebp - 0x170], edx
jmp 0x406269
mov eax, dword [ebp - 0x170]
add eax, 0x1c
mov dword [ebp - 0x170], eax
mov ecx, dword [ebp - 0x170]
cmp ecx, dword [ebp - 0x14c]
je 0x4062ad
mov esi, dword [ebp - 0x170]
mov ecx, 7
lea edi, [ebp - 0x16c]
rep movsd dword es:[edi], dword [esi]
sub esp, 0x1c
mov ecx, 7
lea esi, [ebp - 0x16c]
mov edi, esp
rep movsd dword es:[edi], dword [esi]
mov edx, dword [ebp - 0x170]
push edx
call fcn.00410430
add esp, 0x20
jmp 0x40625a
mov eax, dword [ebp - 0x20]
push eax
call fcn.00406030
add esp, 4
mov cl, byte [ebp - 0x130]
mov byte [ebp - 0x118], cl
mov dword [ebp - 0x114], 0
mov dword [ebp - 0x110], 0
mov dword [ebp - 0x10c], 0
mov dword [ebp - 4], 0
lea edx, [ebp - 0x118]
push edx
mov eax, dword [ebp - 0x20]
add eax, 0x44
sub esp, 0x10
mov ecx, esp
mov dword [ebp - 0x134], esp
push eax
call fcn.0040a490
mov dword [ebp - 0x1c0], eax
call fcn.00406800
add esp, 0x14
push 0
mov ecx, dword [ebp - 0x20]
mov edx, dword [ecx + 4]
add edx, 0x14
push edx
mov eax, dword [ebp - 0x20]
mov ecx, dword [eax]
push ecx
call dword [sym.imp.MSVCRT.dll_fseek]
add esp, 0xc
mov edx, dword [ebp - 0x20]
mov eax, dword [edx]
push eax
push 1
push pe_nt_image_headers32
lea ecx, [ebp - 0x108]
push ecx
call dword [sym.imp.MSVCRT.dll_fread]
add esp, 0x10
lea edx, [ebp - 0x118]
push edx
call fcn.004073d0
add esp, 4
mov dword [ebp - 0x28], eax
mov eax, dword [ebp - 0x20]
push eax
call fcn.00407560
add esp, 4
mov dword [ebp - 0x18], eax
lea ecx, [ebp - 0x118]
push ecx
call fcn.004075c0
add esp, 4
mov dword [ebp - 0x10], eax
mov edx, dword [ebp - 0x28]
add edx, 3
and edx, 0xfffffffc
mov dword [ebp - 0x28], edx
mov eax, dword [ebp - 0x18]
add eax, 3
and al, 0xfc
mov dword [ebp - 0x18], eax
mov ecx, dword [ebp - 0x28]
add ecx, dword [ebp - 0x18]
add ecx, dword [ebp - 0x10]
mov dword [ebp - 0x12c], ecx
mov edx, dword [ebp - 0xe4]
mov eax, dword [ebp - 0x12c]
lea ecx, [eax + edx - 1]
mov edx, dword [ebp - 0xe4]
sub edx, 1
not edx
and ecx, edx
mov dword [ebp - 0x24], ecx
mov eax, dword [ebp - 0xe8]
push eax
mov ecx, dword [ebp - 0xe4]
push ecx
mov edx, dword [ebp - 0xd0]
push edx
mov eax, dword [ebp - 0x12c]
push eax
mov ecx, dword [ebp - 0x20]
push ecx
call fcn.0040a1a0
add esp, 0x14
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0
je 0x4064d8
mov edx, dword [ebp - 0x14]
push edx
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov eax, dword [ebp - 0x20]
push eax
call fcn.00409f50
add esp, 4
mov dword [ebp - 0x138], 0
mov dword [ebp - 4], 0xffffffff
mov ecx, dword [ebp - 0x110]
mov dword [ebp - 0x178], ecx
mov edx, dword [ebp - 0x114]
mov dword [ebp - 0x174], edx
jmp 0x40644c
mov eax, dword [ebp - 0x174]
add eax, 0x10
mov dword [ebp - 0x174], eax
mov ecx, dword [ebp - 0x174]
cmp ecx, dword [ebp - 0x178]
je 0x40647f
mov ecx, dword [ebp - 0x174]
call fcn.0040a750
xor edx, edx
and edx, 1
test edx, edx
je 0x40647d
mov eax, dword [ebp - 0x174]
push eax
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
jmp 0x40643d
mov ecx, dword [ebp - 0x10c]
sub ecx, dword [ebp - 0x114]
sar ecx, 4
mov dword [ebp - 0x180], ecx
mov edx, dword [ebp - 0x114]
mov dword [ebp - 0x17c], edx
mov eax, dword [ebp - 0x17c]
push eax
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
mov dword [ebp - 0x114], 0
mov dword [ebp - 0x110], 0
mov dword [ebp - 0x10c], 0
mov eax, dword [ebp - 0x138]
jmp 0x4067f0
mov ecx, dword [ebp - 0x24]
push ecx
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
add esp, 4
mov dword [ebp - 0x13c], eax
mov edx, dword [ebp - 0x13c]
mov dword [ebp - 0x1c], edx
mov ecx, dword [ebp - 0x24]
xor eax, eax
mov edi, dword [ebp - 0x1c]
mov edx, ecx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [ebp - 0x1c]
add eax, dword [ebp - 0x28]
push eax
mov ecx, dword [ebp - 0x20]
push ecx
lea edx, [ebp - 0x128]
push edx
call fcn.00407730
add esp, 0xc
mov byte [ebp - 4], 1
mov eax, dword [ebp - 0x28]
add eax, dword [ebp - 0x18]
push eax
mov ecx, dword [ebp - 0x28]
push ecx
sub esp, 0x10
mov ecx, esp
mov dword [ebp - 0x140], esp
lea edx, [ebp - 0x128]
push edx
call fcn.00407d10
mov dword [ebp - 0x1c4], eax
mov eax, dword [ebp - 0x1c]
push eax
lea ecx, [ebp - 0x118]
push ecx
mov edx, dword [ebp - 0x20]
push edx
call fcn.00407fc0
add esp, 0x24
push 0
mov eax, dword [ebp - 0x20]
mov ecx, dword [eax + 0x1c]
push ecx
mov edx, dword [ebp - 0x20]
mov eax, dword [edx]
push eax
call dword [sym.imp.MSVCRT.dll_fseek]
add esp, 0xc
mov ecx, dword [ebp - 0x20]
mov edx, dword [ecx]
push edx
mov eax, dword [ebp - 0x24]
push eax
push 1
mov ecx, dword [ebp - 0x1c]
push ecx
call dword [sym.imp.MSVCRT.dll_fwrite]
add esp, 0x10
mov edx, dword [ebp - 0x1c]
mov dword [ebp - 0x144], edx
mov eax, dword [ebp - 0x144]
push eax
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
mov ecx, dword [ebp - 0x20]
push ecx
call fcn.00409f50
add esp, 4
mov dword [ebp - 0x148], 1
mov byte [ebp - 4], 0
mov edx, dword [ebp - 0x124]
mov dword [ebp - 0x198], edx
mov eax, dword [ebp - 0x198]
mov dword [ebp - 0x18c], eax
mov ecx, dword [ebp - 0x124]
mov dword [ebp - 0x19c], ecx
mov edx, dword [ebp - 0x19c]
mov eax, dword [edx]
mov dword [ebp - 0x1a0], eax
mov ecx, dword [ebp - 0x1a0]
mov dword [ebp - 0x190], ecx
mov edx, dword [ebp - 0x18c]
push edx
mov eax, dword [ebp - 0x190]
push eax
lea ecx, [ebp - 0x194]
push ecx
lea ecx, [ebp - 0x128]
call fcn.0040bab0
mov edx, dword [ebp - 0x124]
mov dword [ebp - 0x1a4], edx
mov eax, dword [ebp - 0x1a4]
push eax
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
mov dword [ebp - 0x124], 0
mov dword [ebp - 0x11c], 0
mov dword [ebp - 0x184], 0
lea ecx, [ebp - 0x188]
call dword [sym.imp.MSVCP60.dll_public:_void___thiscall_std::_Lockit::constructor_void_]
mov ecx, dword [0x410a18]
sub ecx, 1
mov dword [0x410a18], ecx
cmp dword [0x410a18], 0
jne 0x40669a
mov edx, dword [0x410a14]
mov dword [ebp - 0x184], edx
mov dword [0x410a14], 0
lea ecx, [ebp - 0x188]
call dword [sym.imp.MSVCP60.dll_public:_void___thiscall_std::_Lockit::destructor_void_]
cmp dword [ebp - 0x184], 0
je 0x4066be
mov eax, dword [ebp - 0x184]
push eax
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
mov dword [ebp - 4], 0xffffffff
mov ecx, dword [ebp - 0x110]
mov dword [ebp - 0x1b4], ecx
mov edx, dword [ebp - 0x114]
mov dword [ebp - 0x1b0], edx
jmp 0x4066ee
mov eax, dword [ebp - 0x1b0]
add eax, 0x10
mov dword [ebp - 0x1b0], eax
mov ecx, dword [ebp - 0x1b0]
cmp ecx, dword [ebp - 0x1b4]
je 0x40679c
mov edx, dword [ebp - 0x1b0]
mov eax, dword [edx + 8]
push eax
mov ecx, dword [ebp - 0x1b0]
mov edx, dword [ecx + 4]
push edx
mov ecx, dword [ebp - 0x1b0]
call fcn.0040b220
mov eax, dword [ebp - 0x1b0]
mov ecx, dword [ebp - 0x1b0]
mov edx, dword [eax + 0xc]
sub edx, dword [ecx + 4]
sar edx, 4
mov dword [ebp - 0x1ac], edx
mov eax, dword [ebp - 0x1b0]
mov ecx, dword [eax + 4]
mov dword [ebp - 0x1a8], ecx
mov edx, dword [ebp - 0x1a8]
push edx
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
mov eax, dword [ebp - 0x1b0]
mov dword [eax + 4], 0
mov ecx, dword [ebp - 0x1b0]
mov dword [ecx + 8], 0
mov edx, dword [ebp - 0x1b0]
mov dword [edx + 0xc], 0
xor eax, eax
and eax, 1
test eax, eax
je 0x406797
mov ecx, dword [ebp - 0x1b0]
push ecx
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
jmp 0x4066df
mov edx, dword [ebp - 0x10c]
sub edx, dword [ebp - 0x114]
sar edx, 4
mov dword [ebp - 0x1bc], edx
mov eax, dword [ebp - 0x114]
mov dword [ebp - 0x1b8], eax
mov ecx, dword [ebp - 0x1b8]
push ecx
call sub.MSVCRT.dll_void___cdecl_operator_delete_void__
add esp, 4
mov dword [ebp - 0x114], 0
mov dword [ebp - 0x110], 0
mov dword [ebp - 0x10c], 0
mov eax, dword [ebp - 0x148]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop edi
pop esi
mov esp, ebp
pop ebp
ret