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

Disassembly:
sub esp, 0x10c
mov ecx, dword [esp + 0x110]
push ebp
push esi
push edi
lea eax, [esp + 0x14]
push 0x100
push eax
push ecx
mov dword [esp + 0x1c], 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea edx, [esp + 0x14]
push 0x2e
push edx
call fcn.00407df0
mov byte [eax + 1], 0
mov edi, 0x40b028
or ecx, 0xffffffff
xor eax, eax
add esp, 8
lea edx, [esp + 0x14]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
push eax
mov esi, edi
mov ebp, ecx
mov edi, edx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebp
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
push pe_nt_image_headers32
push 3
mov ecx, ebp
push eax
push eax
and ecx, 3
lea eax, [esp + 0x28]
push 0xc0000000
rep movsb byte es:[edi], byte [esi]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
je 0x401378
mov edi, dword [sym.imp.KERNEL32.dll_ReadFile]
lea ecx, [esp + 0xc]
push 0
push ecx
push 0x200
push 0x410700
push esi
call edi
test eax, eax
jne 0x4010bb
mov word [0x410705], 0x90
jmp 0x401257
cmp byte [0x410704], 0x63
jne 0x401193
push 0x410900
push 0x410904
push 0x410908
push 0x41090c
call fcn.00401390
push 0
push 0
push 0
push esi
mov dword [esp + 0x20], eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
lea edx, [esp + 0xc]
push 0
push edx
push 4
push 0x41090c
push esi
call edi
lea eax, [esp + 0xc]
push 0
push eax
push 4
push 0x410908
push esi
call edi
lea ecx, [esp + 0xc]
push 0
push ecx
push 4
push 0x410904
push esi
call edi
lea edx, [esp + 0xc]
push 0
push edx
push 4
push 0x410900
push esi
call edi
lea eax, [esp + 0xc]
push 0
push eax
push 4
push 0x4106d8
push esi
call edi
lea ecx, [esp + 0xc]
push 0
push ecx
push 4
push 0x4106d4
push esi
call edi
lea edx, [esp + 0xc]
push 0
push edx
push 4
push 0x4106e0
push esi
call edi
lea eax, [esp + 0xc]
push 0
push eax
push 4
push 0x4106dc
push esi
call edi
lea ecx, [esp + 0xc]
push 0
push ecx
lea edx, [esp + 0x18]
push 4
push edx
jmp 0x40136e
lea eax, [esp + 0xc]
push 0
push eax
push 1
push 0x410910
push esi
call edi
lea ecx, [esp + 0xc]
push 0
push ecx
push 4
push 0x4106d8
push esi
call edi
lea edx, [esp + 0xc]
push 0
push edx
push 4
push 0x4106d4
push esi
call edi
lea eax, [esp + 0xc]
push 0
push eax
push 4
push 0x4106e0
push esi
call edi
lea ecx, [esp + 0xc]
push 0
push ecx
push 4
push 0x4106dc
push esi
call edi
lea edx, [esp + 0xc]
push 0
push edx
push 0x101
push 0x410920
push esi
call edi
mov eax, dword [0x410849]
test eax, eax
je 0x40126c
mov cx, word [0x410847]
test cx, cx
je 0x40126c
mov edx, dword [str.DDAT]
mov dword [0x4106e4], eax
mov al, byte [0x410704]
mov dword [0x410500], edx
cmp al, 1
mov dword [0x410849], 0x410500
jne 0x40126c
xor edx, edx
lea eax, [esp + 0xc]
push 0
mov dx, cx
push eax
push edx
push 0x410504
push esi
call edi
test eax, eax
jne 0x40126c
mov word [0x410705], 0x91
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp + 0x10], eax
mov ebp, dword [esp + 0x10]
mov dword [0x410707], eax
jmp 0x4012da
push 0x410700
call fcn.004014fa
cmp eax, 0x7c
mov dword [esp + 0x10], eax
jne 0x401285
mov word [0x410705], ax
mov eax, dword [0x410849]
test eax, eax
je 0x4012a2
cmp word [0x410847], 0
je 0x4012a2
mov eax, dword [0x4106e4]
mov dword [0x410849], eax
mov eax, dword [0x40b2c2]
xor ebp, ebp
test eax, eax
je 0x4012bf
mov edi, 0x40b156
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov ebp, ecx
inc ebp
mov eax, dword [0x40be8d]
mov dword [0x410841], ebp
test eax, eax
mov byte [0x410853], 0
je 0x4012da
mov byte [0x410853], al
push 0
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
lea ecx, [esp + 0xc]
push 0
push ecx
push 0x200
push 0x410700
push esi
call edi
mov eax, dword [0x410849]
test eax, eax
je 0x40133a
mov ax, word [0x410847]
test ax, ax
je 0x40133a
mov cl, byte [0x410704]
cmp cl, 1
je 0x40133a
cmp cl, 6
je 0x40133a
xor ecx, ecx
lea edx, [esp + 0xc]
push 0
mov cx, ax
push edx
push ecx
push 0x410504
push esi
call edi
mov eax, dword [0x40b2c2]
test eax, eax
je 0x401353
lea edx, [esp + 0xc]
push 0
push edx
push ebp
push 0x40b156
push esi
call edi
mov eax, dword [0x40be8d]
test eax, eax
je 0x401371
lea ecx, [esp + 0xc]
push 0
add eax, 0x100
push ecx
push eax
push 0x40be91
push esi
call edi
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
xor eax, eax
pop ebp
add esp, 0x10c
ret 0x10