Function at 0x401d56
Capabilities:
Get common file path
Get file size
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x348
push ebx
push esi
xor ebx, ebx
push edi
mov dword [ebp - 0x18], ecx
push ebx
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
mov esi, 0x104
mov dword [ebp - 4], eax
push esi
lea eax, [ebp - 0x244]
push ebx
push eax
call fcn.0040a880
push esi
lea eax, [ebp - 0x348]
push ebx
push eax
call fcn.0040a880
mov edi, dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
add esp, 0x18
lea eax, [ebp - 0x348]
push esi
push eax
push dword [ebp - 4]
call edi
lea eax, [ebp - 0x244]
push esi
push eax
push dword [ebp - 4]
call edi
lea eax, [ebp - 0x244]
push eax
call fcn.0040a9d0
cmp eax, 1
pop ecx
jl 0x40215b
lea ecx, [eax - 1]
cmp ecx, ebx
jle 0x401de1
cmp byte [ebp + ecx - 0x244], 0x5c
je 0x401ddf
dec ecx
jmp 0x401dce
mov eax, ecx
cmp eax, 1
jl 0x40215b
mov eax, esi
sub eax, ecx
push eax
lea eax, [ebp + ecx - 0x244]
push ebx
push eax
call fcn.0040a880
lea eax, [ebp - 0x244]
push str.patch.wnp
push eax
call fcn.0040a8f0
add esp, 0x14
lea eax, [ebp - 0x348]
push ebx
push 0x80
push 3
push ebx
push 1
push 0x80000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, ebx
mov dword [ebp - 4], eax
je 0x402126
cmp eax, 0xffffffff
je 0x402126
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
push edi
call fcn.0040aec3
pop ecx
mov dword [ebp - 0x10], eax
lea ecx, [ebp - 0x30]
push ebx
push ecx
push edi
push eax
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_ReadFile]
push dword [ebp - 4]
mov dword [ebp - 0x1c], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x1c], ebx
je 0x40215b
mov ecx, dword [ebp - 0x10]
mov dword [ebp - 8], ebx
mov dword [ebp - 0xc], ecx
mov dword [ebp - 0x14], ebx
mov dword [ebp - 4], ebx
lea eax, [ecx + edi]
cmp ecx, eax
jae 0x401edf
inc ecx
inc dword [ebp - 8]
mov dword [ebp - 0xc], ecx
cmp byte [ecx], 0x40
jne 0x401ec4
lea edx, [ecx + 0xa]
cmp edx, eax
jae 0x401ec4
push 0x12
push 0x4170e8
push ecx
call fcn.0040af50
add esp, 0xc
test eax, eax
jne 0x401ec4
cmp dword [ebp - 4], ebx
jne 0x401ece
mov dword [ebp - 4], 1
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0xc]
add eax, edi
jmp 0x401e8d
mov eax, dword [ebp - 0xc]
add dword [ebp - 0xc], 0x1a
add dword [ebp - 8], 0x19
mov eax, dword [eax + 0x12]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x10]
add eax, edi
cmp dword [ebp - 0xc], eax
jae 0x4020c1
lea eax, [ebp - 0x244]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
mov esi, dword [sym.imp.KERNEL32.dll_lstrcatA]
lea eax, [ebp - 0x244]
push 0x4170dc
push eax
call esi
push ebx
push 0x80
push 2
push ebx
push ebx
lea eax, [ebp - 0x244]
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, ebx
mov dword [ebp - 4], eax
je 0x4020dd
cmp eax, 0xffffffff
je 0x4020dd
sub edi, dword [ebp - 8]
lea ecx, [ebp - 0x2c]
push ebx
push ecx
dec edi
push edi
push dword [ebp - 0xc]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov dword [ebp - 0x1c], eax
mov eax, dword [ebp - 0x14]
cmp eax, ebx
jbe 0x402099
dec eax
mov dword [ebp - 0xc], ebx
cmp eax, ebx
mov dword [ebp - 0x28], eax
jbe 0x402099
lea edi, [ebp - 0x13c]
mov dword [ebp - 8], 1
sub edi, 4
mov dword [ebp - 0x20], edi
jmp 0x401f8e
mov edi, dword [ebp - 0x20]
mov esi, dword [sym.imp.KERNEL32.dll_lstrcatA]
lea eax, [ebp - 0x348]
push eax
lea eax, [ebp - 0x13c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
lea eax, [ebp - 0x13c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
cmp dword [ebp - 8], 0xa
mov byte [eax + edi], bl
jae 0x401fbf
push str..wp00
jmp 0x401fd1
cmp dword [ebp - 8], 0x64
jae 0x401fcc
push str..wp0
jmp 0x401fd1
push 0x4170c8
lea eax, [ebp - 0x13c]
push eax
call esi
lea eax, [ebp - 0x3c]
push 0xa
push eax
push dword [ebp - 8]
call fcn.00414264
add esp, 0xc
lea eax, [ebp - 0x3c]
push eax
lea eax, [ebp - 0x13c]
push eax
call esi
push ebx
push 0x80
push 3
push ebx
push 1
mov edi, 0x80000000
lea eax, [ebp - 0x13c]
push edi
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
jne 0x402043
mov esi, dword [ebp - 0x18]
lea eax, [ebp - 0x13c]
push eax
mov ecx, esi
call fcn.00402162
test eax, eax
je 0x4020d1
push ebx
push 0x80
push 3
push ebx
push 1
jmp 0x402008
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
push edi
call fcn.0040aec3
pop ecx
mov dword [ebp - 0x14], eax
lea ecx, [ebp - 0x24]
push ebx
push ecx
push edi
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea eax, [ebp - 0x24]
push ebx
push eax
push edi
push dword [ebp - 0x14]
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push dword [ebp - 0x14]
call fcn.0040ae7b
inc dword [ebp - 0xc]
inc dword [ebp - 8]
mov eax, dword [ebp - 0xc]
pop ecx
cmp eax, dword [ebp - 0x28]
jb 0x401f85
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x1c], ebx
je 0x4020c1
lea eax, [ebp - 0x244]
push eax
mov eax, dword [ebp - 0x18]
add eax, 0x32c
push eax
call fcn.0040a8e0
pop ecx
pop ecx
push 1
pop ebx
push dword [ebp - 0x10]
call fcn.0040ae7b
pop ecx
mov eax, ebx
jmp 0x40215d
mov dword [esi + 0x63c], 1
jmp 0x40215b
lea eax, [ebp - 0x244]
push eax
lea eax, [ebp - 0x140]
push 0x4170ac
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [ebp - 0x140]
push ebx
push 0x41709c
push eax
mov eax, dword [ebp - 0x18]
push dword [eax + 4]
call dword [sym.imp.USER32.dll_MessageBoxA]
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 0x10]
call fcn.0040ae7b
pop ecx
jmp 0x40215b
lea eax, [ebp - 0x348]
push eax
lea eax, [ebp - 0x140]
push 0x417084
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea eax, [ebp - 0x140]
push ebx
push 0x41709c
push eax
mov eax, dword [ebp - 0x18]
push dword [eax + 4]
call dword [sym.imp.USER32.dll_MessageBoxA]
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret