Function at 0x406850
Capabilities:
Accept command line arguments
Check if file exists

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x298
mov eax, dword [0x452064]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, dword [ebp + 0xc]
push esi
push edi
mov edi, dword [ebp + 8]
mov esi, dword [edi]
cmp dword [esi - 0xc], 0
je 0x406a9a
mov eax, dword [ebx]
cmp dword [eax - 0xc], 0
je 0x406a9a
push 0x208
lea eax, [ebp - 0x20c]
push 0
push eax
call fcn.0040a440
add esp, 0xc
push esi
call dword [sym.imp.SHLWAPI.dll_PathIsRelativeW]
test eax, eax
lea eax, [ebp - 0x20c]
je 0x4068e2
push 0x104
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
mov esi, dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
lea eax, [ebp - 0x20c]
push eax
call esi
lea eax, [ebp - 0x20c]
push eax
call esi
push dword [edi]
lea eax, [ebp - 0x20c]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
jmp 0x40691c
mov esi, dword [edi]
lea ecx, [ebp - 0x20c]
mov edx, 0x104
sub esi, eax
lea eax, [edx + 0x7ffffefa]
test eax, eax
je 0x40690f
movzx eax, word [esi + ecx]
test ax, ax
je 0x40690f
mov word [ecx], ax
add ecx, 2
sub edx, 1
jne 0x4068f1
test edx, edx
lea eax, [ecx - 2]
cmovne eax, ecx
xor ecx, ecx
mov word [eax], cx
lea eax, [ebp - 0x20c]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x406a9a
lea eax, [ebp - 0x20c]
push eax
call fcn.00407490
add esp, 4
test eax, eax
je 0x406a9a
lea eax, [ebp - 0x20c]
push eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
mov dword [ebp - 0x298], eax
test eax, eax
je 0x406a9a
mov edi, dword [ebx]
lea eax, [ebp - 0x28c]
mov dword [ebp - 0x290], eax
test edi, edi
jne 0x406982
xor eax, eax
mov dword [ebp - 0x290], eax
jmp 0x406a4d
mov ecx, edi
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x406987
sub ecx, edx
lea eax, [ebp - 0x28c]
sar ecx, 1
push 0x80
push eax
lea eax, [ebp - 0x290]
lea ebx, [ecx + 1]
lea esi, [ebx*4]
mov dword [ebp - 0x294], ebx
push esi
push eax
call fcn.00406770
add esp, 0x10
push 0
push 0
push esi
push dword [ebp - 0x290]
mov esi, dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
push ebx
push edi
push 0
push 3
call esi
xor ebx, ebx
test eax, eax
sete bl
test eax, eax
jne 0x406a43
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x7a
jne 0x406a43
mov ebx, dword [ebp - 0x294]
push 0
push 0
push 0
push 0
push ebx
push edi
push 0
push 3
call esi
mov esi, eax
lea eax, [ebp - 0x28c]
push 0x80
push eax
lea eax, [ebp - 0x290]
push esi
push eax
call fcn.00406770
add esp, 0x10
push 0
push 0
push esi
push dword [ebp - 0x290]
push ebx
push edi
push 0
push 3
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov ebx, eax
neg ebx
sbb ebx, ebx
inc ebx
test ebx, ebx
jne 0x406aaf
mov eax, dword [ebp - 0x290]
push eax
push dword [ebp - 0x298]
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov esi, eax
lea ecx, [ebp - 0x28c]
mov eax, dword [ebp - 0x290]
cmp eax, ecx
je 0x406a75
push eax
call fcn.00412fd3
add esp, 4
test esi, esi
je 0x406a9a
call dword [sym.imp.KERNEL32.dll_GetCommandLineW]
push eax
call esi
pop edi
pop esi
mov eax, 1
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004083c3
mov esp, ebp
pop ebp
ret 8
mov ecx, dword [ebp - 4]
xor eax, eax
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.004083c3
mov esp, ebp
pop ebp
ret 8
push 0x80
lea eax, [ebp - 0x28c]
push eax
push dword [ebp - 0x290]
call fcn.004067f0
add esp, 0xc
call fcn.00406830
int3