Function at 0x402830
Capabilities:
Check if file exists
Get common file path
Get file size
Read .ini file
Read file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x54f0fc
mov eax, dword fs:[0]
push eax
sub esp, 0xc70
mov eax, dword [0x5a7110]
xor eax, esp
mov dword [esp + 0xc68], eax
push ebx
push esi
push edi
mov eax, dword [0x5a7110]
xor eax, esp
push eax
lea eax, [esp + 0xc80]
mov dword fs:[0], eax
mov ebx, ecx
xor eax, eax
push 0x206
push eax
mov word [esp + 0x26c], ax
lea eax, [esp + 0x26e]
push eax
call fcn.00529960
add esp, 0xc
lea eax, [esp + 0x264]
push 0x104
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 0x100
lea eax, [esp + 0x878]
push eax
push 0x100
lea eax, [esp + 0xa80]
push eax
push 0x100
lea eax, [esp + 0x688]
push eax
push 3
lea eax, [esp + 0x70]
push eax
lea eax, [esp + 0x284]
push eax
call fcn.00528b0e
add esp, 0x24
lea eax, [esp + 0x674]
push eax
lea eax, [esp + 0x58]
push eax
lea esi, [ebx + 0x130]
push str._s_s
push esi
call fcn.004049d0
add esp, 0x10
call fcn.0041bf47
xor ecx, ecx
mov edx, eax
test edx, edx
setne cl
test ecx, ecx
jne 0x402922
push 0x80004005
call fcn.00404b60
mov eax, dword [edx]
mov ecx, edx
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x18], eax
mov dword [esp + 0xc88], 0
mov ecx, dword [esi]
lea esi, [eax - 0x10]
lea edx, [ecx - 0x10]
cmp edx, esi
je 0x402991
cmp dword [esi + 0xc], 0
lea edi, [esi + 0xc]
jl 0x402984
mov eax, dword [edx]
cmp eax, dword [esi]
jne 0x402984
push edx
call fcn.00404220
add esp, 4
mov dword [esp + 0x14], eax
or ecx, 0xffffffff
lock xadd dword [edi], ecx
dec ecx
test ecx, ecx
jg 0x40297b
mov ecx, dword [esi]
push esi
mov edx, dword [ecx]
call dword [edx + 4]
mov eax, dword [esp + 0x14]
add eax, 0x10
mov dword [esp + 0x18], eax
jmp 0x402991
push dword [ecx - 0xc]
push ecx
lea ecx, [esp + 0x20]
call fcn.00404620
push 0xb
push str.cnwidcn.ini
lea ecx, [esp + 0x20]
call fcn.004040a0
mov esi, dword [esp + 0x18]
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x402ab4
xor eax, eax
push 0x206
push eax
mov word [esp + 0x64], ax
lea eax, [esp + 0x66]
push eax
call fcn.00529960
add esp, 0xc
lea eax, [esp + 0x5c]
push esi
push 0x104
push eax
push 0x58460c
push str.path
push 0x5845bc
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringW]
test eax, eax
je 0x402c40
lea eax, [esp + 0x5c]
push eax
lea ecx, [esp + 0x40]
call fcn.004034d0
lea edx, [esp + 0x3c]
lea ecx, [esp + 0x20]
mov byte [esp + 0xc88], 1
call fcn.00403270
lea ecx, [esp + 0x3c]
mov byte [esp + 0xc88], 2
cmp ecx, eax
je 0x402a33
push 0xffffffffffffffff
push 0
push eax
call fcn.00403580
mov byte [esp + 0xc88], 1
cmp dword [esp + 0x34], 8
jb 0x402a4e
push dword [esp + 0x20]
call fcn.00404c96
add esp, 4
cmp dword [esp + 0x50], 8
lea edx, [esp + 0x3c]
cmovae edx, dword [esp + 0x3c]
lea edi, [ebx + 0x134]
test edx, edx
jne 0x402a6a
xor ecx, ecx
jmp 0x402a84
mov ecx, edx
lea eax, [ecx + 2]
mov dword [esp + 0x14], eax
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x402a73
sub ecx, dword [esp + 0x14]
sar ecx, 1
push ecx
push edx
mov ecx, edi
call fcn.00404620
mov byte [esp + 0xc88], 0
cmp dword [esp + 0x50], 8
mov dword [ebx + 0x138], 1
jb 0x402b18
push dword [esp + 0x3c]
call fcn.00404c96
add esp, 4
jmp 0x402b18
lea eax, [esp + 0x46c]
push eax
push 0
push 0
push 0x8023
push 0
call dword [sym.imp.SHELL32.dll_SHGetFolderPathW]
lea ecx, [esp + 0x46c]
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x402ad7
sub ecx, edx
sar ecx, 1
push ecx
lea eax, [esp + 0x470]
lea edi, [ebx + 0x134]
push eax
mov ecx, edi
call fcn.00404620
push 0xe
push str.Canoncnwidcn_
mov ecx, edi
call fcn.004040a0
push 7
push 0x5845bc
mov ecx, edi
call fcn.004040a0
push 0
push 2
push 3
push 0
push 0
push SysReAllocStringLen
push dword [edi]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
jne 0x402b42
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x402c40
push 0
push edi
mov dword [esp + 0x40], 0
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov dword [esp + 0x14], eax
test eax, eax
jne 0x402b67
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x402c40
inc eax
push eax
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [esp + 0x1c], eax
test eax, eax
jne 0x402b8c
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x402c40
push 0
lea ecx, [esp + 0x3c]
push ecx
push dword [esp + 0x1c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x402bbb
push dword [esp + 0x1c]
push eax
mov eax, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
call eax
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
jmp 0x402c40
cmp dword [esp + 0x38], 0
jbe 0x402c16
push ecx
push dword [esp + 0x20]
lea eax, [esp + 0x68]
lea ecx, [esp + 0x64]
mov dword [esp + 0x1c], 1
mov dword [esp + 0x64], eax
call fcn.00403970
mov byte [esp + 0xc88], 3
push dword [esp + 0x5c]
lea ecx, [ebx + 0xbc]
call fcn.0041b722
mov byte [esp + 0xc88], 0
mov eax, dword [esp + 0x5c]
lea ecx, [esp + 0x60]
cmp eax, ecx
je 0x402c1e
push eax
call fcn.0052876e
add esp, 4
jmp 0x402c1e
mov dword [esp + 0x14], 0
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [esp + 0x1c]
mov eax, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push 0
call eax
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
cmp dword [esp + 0x14], 0
jne 0x402c54
mov dword [ebx + 0x140], 0
push 0
lea ecx, [ebx + 0xbc]
jmp 0x402c85
push 1
lea ecx, [ebx + 0xbc]
mov dword [ebx + 0x140], 1
call fcn.0041ad3c
lea ecx, [ebx + 0xbc]
call fcn.0041b20b
lea ecx, [ebx + 0x158]
test eax, eax
jne 0x402c83
push eax
jmp 0x402c85
push 1
call fcn.0041ad3c
add esi, 0xfffffff0
mov dword [esp + 0xc88], 0xffffffff
lea eax, [esi + 0xc]
or ecx, 0xffffffff
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x402caf
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
mov ecx, dword [esp + 0xc80]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0xc68]
xor ecx, esp
call fcn.00527e41
mov esp, ebp
pop ebp
ret