Function at 0x402135
Capabilities:
Get common file path
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x854
mov eax, dword [0x40aa8c]
xor eax, dword [ebp + 4]
push ebx
push esi
push edi
push 0x40
mov dword [ebp - 4], eax
lea eax, [ebp - 0xfc]
push eax
push 0x222
push dword [0x40a050]
mov esi, ecx
xor ebx, ebx
mov dword [ebp - 0x1c], esi
mov word [ebp - 0x444], bx
mov word [ebp - 0xfc], bx
call dword [sym.imp.USER32.dll_LoadStringW]
cmp eax, ebx
je 0x4021ad
cmp word [ebp - 0xfc], bx
mov dx, word [ebp + eax*2 - 0xfe]
je 0x4021ad
lea ecx, [ebp - 0xfc]
lea eax, [ebp - 0xfc]
cmp word [ecx], dx
jne 0x4021a4
mov word [ecx], bx
inc eax
inc eax
cmp word [eax], bx
mov ecx, eax
jne 0x40219c
mov eax, dword [esi + 0x10]
mov dword [ebp - 0x78], eax
lea eax, [ebp - 0xfc]
mov dword [ebp - 0x70], eax
lea eax, [esi + 0x35c]
mov edi, 0x104
push 0x401304
mov dword [ebp - 0x7c], 0x58
mov dword [ebp - 0x6c], ebx
mov dword [ebp - 0x68], ebx
mov dword [ebp - 0x64], 1
mov dword [ebp - 0x60], eax
mov dword [ebp - 0x5c], edi
mov dword [ebp - 0x58], ebx
mov dword [ebp - 0x54], ebx
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
cmp eax, ebx
mov dword [ebp - 0x10], eax
je 0x402215
push 0x4012e8
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
cmp eax, ebx
je 0x402215
push edi
lea ecx, [ebp - 0x444]
push ecx
call eax
jmp 0x402223
push edi
lea eax, [ebp - 0x444]
push eax
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryW]
cmp dword [ebp - 0x10], ebx
je 0x402231
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
lea eax, [ebp - 0x444]
mov dword [ebp - 0x50], eax
lea eax, [ebp - 0x7c]
push eax
mov dword [ebp - 0x4c], 0x40a0dc
mov dword [ebp - 0x48], 0x2806
mov dword [ebp - 0x40], 0x4012e0
call dword [sym.imp.comdlg32.dll_GetSaveFileNameW]
test eax, eax
je 0x40249d
push ebx
mov edi, 0x80
push edi
push 2
push ebx
push ebx
push 0x40000000
lea eax, [esi + 0x35c]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
mov dword [ebp - 8], eax
jne 0x4022f2
mov ebx, dword [sym.imp.USER32.dll_LoadStringW]
push 0x20
lea eax, [ebp - 0x13c]
push eax
push 0x214
push dword [esi]
call ebx
push edi
lea eax, [ebp - 0x23c]
push eax
push 0x218
push dword [esi]
call ebx
lea eax, [esi + 0x35c]
push eax
lea eax, [ebp - 0x23c]
push eax
lea eax, [ebp - 0x854]
push 0x208
push eax
call fcn.004020cf
add esp, 0x10
push 0x2000
lea eax, [ebp - 0x13c]
push eax
lea eax, [ebp - 0x854]
push eax
push dword [esi + 0x10]
call dword [sym.imp.USER32.dll_MessageBoxW]
jmp 0x40249d
push 0x100
push ebx
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
cmp eax, ebx
mov dword [ebp - 0x14], eax
jne 0x402321
push ebx
push ebx
push 0x804
push dword [esi + 0x10]
call dword [sym.imp.USER32.dll_SendMessageW]
jmp 0x402494
push 2
push ebx
push ebx
push dword [ebp - 8]
mov dword [ebp - 0x20], 0xfeff
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edi, eax
push ebx
lea eax, [edi + 2]
push eax
push ebx
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_LockFile]
push ebx
lea eax, [ebp - 0x24]
push eax
push 2
lea eax, [ebp - 0x20]
push eax
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push ebx
lea eax, [edi + 2]
push eax
push ebx
push edi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_UnlockFile]
cmp dword [esi + 0x64], ebx
mov dword [ebp - 0xc], ebx
jbe 0x402471
push dword [ebp - 0xc]
mov ecx, esi
call fcn.00402e53
test eax, 0x20000
jne 0x402462
push dword [ebp - 0xc]
mov ecx, esi
call fcn.00402e3d
push dword [ebp - 0xc]
mov ecx, esi
mov dword [ebp - 0x10], eax
call fcn.00402e97
mov edi, dword [ebp - 0x14]
push dword [ebp - 0xc]
mov esi, eax
mov eax, dword [ebp - 0x10]
add eax, eax
mov ecx, eax
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp - 0x14]
lea esi, [eax + ecx]
mov ecx, dword [ebp - 0x1c]
call fcn.00402e6a
xor edi, edi
cmp dword [ebp - 0x10], ebx
mov dword [ebp - 0x18], eax
jbe 0x402409
mov eax, dword [ebp - 0x18]
mov word [esi], 0x20
inc esi
inc esi
mov word [esi], 0x20
xor ecx, ecx
mov cx, word [eax + edi*2]
mov eax, dword [0x40aa48]
inc esi
inc esi
cmp eax, ebx
je 0x4023fe
push esi
push ecx
call eax
jmp 0x402400
xor eax, eax
inc edi
cmp edi, dword [ebp - 0x10]
lea esi, [esi + eax*2]
jb 0x4023d8
mov word [esi], 0xd
inc esi
inc esi
mov word [esi], 0xa
sub esi, dword [ebp - 0x14]
push 2
push ebx
push ebx
push dword [ebp - 8]
inc esi
inc esi
mov edi, esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, eax
push ebx
lea eax, [edi + esi]
push eax
push ebx
push esi
push dword [ebp - 8]
mov dword [ebp - 0x18], eax
call dword [sym.imp.KERNEL32.dll_LockFile]
push ebx
lea eax, [ebp - 0x24]
push eax
push edi
push dword [ebp - 0x14]
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push ebx
push dword [ebp - 0x18]
push ebx
push esi
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_UnlockFile]
mov esi, dword [ebp - 0x1c]
inc dword [ebp - 0xc]
mov eax, dword [ebp - 0xc]
cmp eax, dword [esi + 0x64]
jb 0x402377
mov edi, dword [sym.imp.USER32.dll_ShowWindow]
push ebx
push dword [esi + 0x40]
call edi
push ebx
push dword [esi + 0x44]
call edi
push dword [ebp - 0x14]
push ebx
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 4]
xor ecx, dword [ebp + 4]
pop edi
pop esi
pop ebx
call fcn.00407e22
leave
ret