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

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffffeb4
xor eax, eax
push ebx
push esi
push edi
mov dword [ebp - 0x10], eax
mov byte [ebp - 0x15], 0
cmp dword [ebp + 0x14], 0
je 0x40ceae
mov edx, dword [ebp + 0x14]
xor ecx, ecx
mov dword [edx], ecx
mov eax, dword [ebp + 8]
cmp byte [eax], 0
jne 0x40cee1
mov edx, dword [ebp + 0xc]
test byte [edx + 3], 0x80
setne cl
and ecx, 1
test cl, cl
jne 0x40cee1
mov eax, dword [ebp + 0xc]
push eax
mov edx, dword [ebp + 8]
mov ecx, dword [edx + 1]
push ecx
call fcn.0040ce14
add esp, 8
xor eax, eax
jmp 0x40d3ac
push 0
push 0x22
push 3
push 0
push 1
push 0xc0000000
mov edx, dword [ebp + 0xc]
add edx, 0x3b
push edx
call sub.KERNEL32.DLL_CreateFileA
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0xffffffff
jne 0x40cf33
mov ecx, dword [ebp + 8]
cmp byte [ecx], 0
jne 0x40cf29
mov eax, dword [ebp + 0xc]
and dword [eax], 0x7fffffff
mov edx, dword [ebp + 0xc]
push edx
mov ecx, dword [ebp + 8]
mov eax, dword [ecx + 1]
push eax
call fcn.0040ce14
add esp, 8
mov eax, 7
jmp 0x40d3ac
push 0x64200
call fcn.004e0050
pop ecx
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0
jne 0x40cf53
mov dword [ebp - 0x10], 0xa
jmp 0x40d363
push 0
lea edx, [ebp - 0xc]
push edx
push 0x64200
mov ecx, dword [ebp - 8]
push ecx
mov eax, dword [ebp - 4]
push eax
call sub.KERNEL32.DLL_ReadFile
test eax, eax
je 0x40cf86
push 0x10
push 0x510d80
mov edx, dword [ebp - 8]
push edx
call fcn.004e1044
add esp, 0xc
test eax, eax
je 0x40cfb6
mov ecx, dword [ebp + 8]
cmp byte [ecx], 0
jne 0x40cfaa
mov eax, dword [ebp + 0xc]
and dword [eax], 0x7fffffff
mov edx, dword [ebp + 0xc]
push edx
mov ecx, dword [ebp + 8]
mov eax, dword [ecx + 1]
push eax
call fcn.0040ce14
add esp, 8
mov dword [ebp - 0x10], 7
jmp 0x40d363
mov edx, dword [ebp + 8]
cmp byte [edx], 0
je 0x40d013
mov ecx, dword [ebp - 8]
mov edx, dword [ebp + 0xc]
mov eax, dword [ecx + 0x10]
mov dword [edx + 8], eax
xor edx, edx
mov ecx, dword [ebp + 0xc]
mov dword [ecx + 0xc], pe_nt_image_headers32
mov eax, dword [ebp - 8]
mov ecx, 0x3ec1
mov eax, dword [eax + 0x10]
div ecx
mov edx, dword [ebp + 0xc]
mov word [edx + 0x10], ax
mov eax, dword [ebp + 0xc]
mov word [eax + 0x12], 0xff
mov ecx, dword [ebp + 0xc]
mov word [ecx + 0x14], 0x3f
mov eax, dword [ebp + 0xc]
mov word [eax + 0x16], 0x3ec1
mov edx, dword [ebp + 0xc]
mov byte [edx + 0x18], 0
mov ecx, dword [ebp + 0xc]
mov byte [ecx + 0x19], 0
xor eax, eax
mov dword [ebp - 0x14], eax
mov esi, dword [ebp - 0x14]
shl esi, 2
lea esi, [esi + esi*4]
lea esi, [esi + esi*4]
add esi, dword [ebp - 8]
add esi, 0x1ff
test byte [esi + 3], 0x80
setne al
and eax, 1
test al, al
je 0x40d215
movzx edx, word [esi + 0x10]
cmp edx, 0xffff
je 0x40d215
movzx ecx, word [esi + 0xe]
lea edi, [ecx + ecx*4]
lea edi, [edi + edi*4]
mov eax, dword [ebp - 8]
test byte [eax + edi*4 + 0x202], 0x40
je 0x40d215
mov edx, dword [ebp + 8]
mov ecx, dword [edx + 1]
push ecx
lea edi, [esi + 0x12]
push edi
call fcn.0040caf0
add esp, 8
mov ebx, eax
movzx eax, bx
cmp eax, 0xffff
jne 0x40d207
mov edx, dword [ebp + 8]
cmp byte [edx], 0
jne 0x40d158
mov ecx, dword [ebp + 8]
mov eax, dword [ecx + 1]
push eax
call fcn.0040cb84
pop ecx
mov edi, eax
test edi, edi
jne 0x40d0bb
mov word [esi + 0x10], 0xfffe
mov byte [ebp - 0x15], 1
jmp 0x40d215
mov bx, word [edi + 0x58]
push 0x126
push 0
push edi
call fcn.004e0d77
lea eax, [esi + 0x12]
add esp, 0xc
mov dword [ebp - 0x1c], eax
lea edx, [edi + 6]
mov dword [ebp - 0x20], edx
mov ecx, dword [ebp - 0x20]
mov eax, dword [ebp - 0x1c]
push esi
push edi
mov edi, eax
xor eax, eax
mov esi, ecx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov edx, ecx
xchg edi, esi
shr ecx, 2
mov eax, edi
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
pop edi
pop esi
mov word [edi + 0x58], bx
mov dword [edi], accept
mov word [edi + 0x5a], 0xffff
mov word [edi + 0x5c], 0xffff
xor edx, edx
lea eax, [edi + 0xa6]
mov word [eax], 0xffff
mov word [eax + 2], 0xffff
inc edx
add eax, 4
cmp edx, 3
jl 0x40d124
mov word [esi + 0x10], bx
mov byte [ebp - 0x15], 1
cmp dword [ebp + 0x14], 0
je 0x40d215
mov ecx, dword [ebp + 0x14]
mov dword [ecx], 1
jmp 0x40d215
push 0x126
push 0
lea edi, [ebp - 0x14c]
push edi
call fcn.004e0d77
add esp, 0xc
lea ebx, [esi + 0x12]
xor eax, eax
mov edi, ebx
push esi
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
lea esi, [ebp - 0x146]
xchg edi, esi
mov edx, ecx
mov eax, edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
pop esi
mov word [ebp - 0xf2], 0xffff
mov word [ebp - 0xf0], 0xffff
xor edx, edx
lea eax, [ebp - 0xa6]
mov word [eax], 0xffff
mov word [eax + 2], 0xffff
inc edx
add eax, 4
cmp edx, 3
jl 0x40d1b2
cmp dword [ebp + 0x10], 0
je 0x40d1fb
lea ecx, [ebp - 0x14c]
push ecx
call dword [ebp + 0x10]
pop ecx
test eax, eax
jne 0x40d1fb
mov di, word [ebp - 0xf4]
mov word [esi + 0x10], di
mov byte [ebp - 0x15], 1
cmp dword [ebp + 0x14], 0
je 0x40d215
mov eax, dword [ebp + 0x14]
mov dword [eax], 1
jmp 0x40d215
mov word [esi + 0x10], 0xfffe
mov byte [ebp - 0x15], 1
jmp 0x40d215
cmp bx, word [esi + 0x10]
je 0x40d215
mov word [esi + 0x10], bx
mov byte [ebp - 0x15], 1
inc dword [ebp - 0x14]
cmp dword [ebp - 0x14], 0x1000
jl 0x40d018
mov edx, dword [ebp + 8]
cmp byte [edx], 0
jne 0x40d363
xor ecx, ecx
mov dword [ebp - 0x14], ecx
jmp 0x40d350
mov edi, eax
mov eax, dword [ebp - 0x14]
mov edx, eax
lea eax, [edx + eax*8]
lea eax, [edx + eax*8]
lea eax, [edx + eax*2]
add eax, eax
add edi, eax
add edi, 8
test byte [edi + 3], 0x80
setne cl
and ecx, 1
test cl, cl
je 0x40d34d
movzx esi, word [edi + 0x5a]
mov eax, dword [ebp + 0xc]
cmp esi, dword [eax + 4]
jne 0x40d2ce
movzx edx, word [edi + 0x5c]
cmp edx, 0x1000
jge 0x40d2ce
movzx ecx, word [edi + 0x5c]
mov esi, ecx
shl esi, 2
lea esi, [esi + esi*4]
lea esi, [esi + esi*4]
add esi, dword [ebp - 8]
add esi, 0x1ff
test byte [esi + 3], 0x80
setne al
and eax, 1
test al, al
je 0x40d2c2
mov dx, word [edi + 0x58]
cmp dx, word [esi + 0x10]
jne 0x40d2c2
lea ecx, [edi + 6]
push ecx
add esi, 0x12
push esi
call fcn.004e116c
add esp, 8
test eax, eax
jne 0x40d2c2
jmp 0x40d2ce
mov word [edi + 0x5a], 0xffff
mov word [edi + 0x5c], 0xffff
xor eax, eax
lea ebx, [edi + 0xa6]
mov dword [ebp - 0x24], eax
movzx eax, word [ebx]
mov edx, dword [ebp + 0xc]
cmp eax, dword [edx + 4]
jne 0x40d341
movzx ecx, word [ebx + 2]
cmp ecx, 0x1000
jge 0x40d341
movzx ecx, word [ebx + 2]
mov esi, ecx
shl esi, 2
lea esi, [esi + esi*4]
lea esi, [esi + esi*4]
add esi, dword [ebp - 8]
add esi, 0x1ff
test byte [esi + 3], 0x80
setne al
and eax, 1
test al, al
je 0x40d336
mov dx, word [edi + 0x58]
cmp dx, word [esi + 0x10]
jne 0x40d336
lea ecx, [edi + 6]
push ecx
add esi, 0x12
push esi
call fcn.004e116c
add esp, 8
test eax, eax
jne 0x40d336
jmp 0x40d341
mov word [ebx], 0xffff
mov word [ebx + 2], 0xffff
inc dword [ebp - 0x24]
add ebx, 4
cmp dword [ebp - 0x24], 3
jl 0x40d2d9
inc dword [ebp - 0x14]
mov eax, dword [ebp + 8]
mov eax, dword [eax + 1]
movzx edx, word [eax + 4]
cmp edx, dword [ebp - 0x14]
jg 0x40d23b
cmp byte [ebp - 0x15], 0
je 0x40d390
push 0
push 0
push 0
mov ecx, dword [ebp - 4]
push ecx
call sub.KERNEL32.DLL_SetFilePointer
push 0
lea eax, [ebp - 0xc]
push eax
push 0x64200
mov edx, dword [ebp - 8]
push edx
mov ecx, dword [ebp - 4]
push ecx
call sub.KERNEL32.DLL_WriteFile
cmp dword [ebp - 8], 0
je 0x40d3a0
mov eax, dword [ebp - 8]
push eax
call fcn.004e0060
pop ecx
mov edx, dword [ebp - 4]
push edx
call sub.KERNEL32.DLL_CloseHandle
mov eax, dword [ebp - 0x10]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret