Function at 0x51f8d0
Capabilities:
Check if file exists
Get common file path

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5f1018
mov eax, dword fs:[0]
push eax
sub esp, 0x638
mov eax, dword [0x6670f4]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov ebx, dword [ebp + 8]
xor edi, edi
mov dword [ebp - 0x644], ebx
mov eax, dword [ebx]
cmp dword [eax - 0xc], edi
je 0x51ff0a
call fcn.004bfba0
mov ecx, eax
test ecx, ecx
je 0x51ff28
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x638], eax
mov dword [ebp - 4], edi
call fcn.004bfba0
mov ecx, eax
test ecx, ecx
je 0x51ff32
mov eax, dword [ecx]
call dword [eax + 0xc]
lea esi, [eax + 0x10]
mov dword [ebp - 0x63c], esi
mov byte [ebp - 4], 1
cmp dword [esi - 0xc], edi
jne 0x51f9aa
mov eax, dword [ebx]
cmp dword [eax - 0xc], edi
jl 0x51f9aa
push 0x604a70
push eax
call fcn.0058d0d6
add esp, 8
test eax, eax
je 0x51f9aa
sub eax, dword [ebx]
sar eax, 1
cmp eax, 1
jne 0x51f9aa
push ebx
lea ecx, [ebp - 0x63c]
call fcn.004bfcd0
mov esi, dword [ebp - 0x63c]
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x51f9aa
lea ecx, [ebp - 0x63c]
call fcn.004bd3a0
mov esi, dword [ebp - 0x63c]
or ebx, 0xffffffff
cmp dword [esi - 0xc], 0
jne 0x51fb93
cmp dword [ebp + 0xc], 0
jne 0x51fb8f
push 0x20c
lea eax, [ebp - 0x21c]
push 0
push eax
call fcn.0058c8f0
add esp, 0xc
lea eax, [ebp - 0x21c]
push 0x104
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea ecx, [ebp - 0x21c]
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x51f9f4
sub ecx, edx
lea eax, [ebp - 0x21c]
sar ecx, 1
push ecx
push eax
lea ecx, [ebp - 0x638]
call fcn.004c0470
mov edi, dword [ebp - 0x638]
push 0x5c
push edi
call fcn.0058cb87
add esp, 8
test eax, eax
je 0x51fb08
sub eax, edi
sar eax, 1
cmp eax, 0xffffffff
je 0x51fb08
xor ebx, ebx
add eax, 1
cmovns ebx, eax
cmp ebx, dword [edi - 0xc]
jl 0x51fa60
add edi, 0xfffffff0
push edi
call fcn.004bfdc0
add esp, 4
lea edi, [eax + 0x10]
mov dword [ebp - 0x640], edi
jmp 0x51fad4
mov eax, dword [ebp - 0x638]
mov ecx, dword [eax - 0x10]
test ecx, ecx
je 0x51fa78
mov eax, dword [ecx]
call dword [eax + 0x10]
mov ecx, eax
test ecx, ecx
jne 0x51fa8e
call fcn.004bfba0
mov ecx, eax
mov edx, dword [eax]
call dword [edx + 0x10]
mov ecx, eax
test ecx, ecx
je 0x51ff3c
mov eax, dword [ecx]
push 2
push ebx
call dword [eax]
test eax, eax
je 0x51ff46
lea edi, [eax + 0x10]
mov dword [ebp - 0x640], edi
test ebx, ebx
js 0x51ff55
cmp ebx, dword [edi - 8]
jg 0x51ff55
lea eax, [ebx + ebx]
mov dword [edi - 0xc], ebx
push eax
push dword [ebp - 0x638]
xor ecx, ecx
push eax
push edi
mov word [eax + edi], cx
call fcn.005200d0
add esp, 0x10
lea eax, [ebp - 0x640]
mov byte [ebp - 4], 2
push eax
lea ecx, [ebp - 0x638]
call fcn.004bfcd0
or ebx, 0xffffffff
mov byte [ebp - 4], 1
add edi, 0xfffffff0
mov eax, ebx
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x51fb08
mov ecx, dword [edi]
push edi
mov eax, dword [ecx]
call dword [eax + 4]
mov eax, dword [ebp - 0x638]
cmp dword [eax - 0xc], 0
je 0x51fb8f
lea eax, [ebp - 0x638]
push eax
call fcn.0051ef80
push dword [ebp - 0x644]
lea eax, [ebp - 0x638]
push eax
lea eax, [ebp - 0x640]
push eax
call fcn.004bc8d0
add esp, 0x10
push eax
lea ecx, [ebp - 0x63c]
mov byte [ebp - 4], 3
call fcn.004bfcd0
mov edx, dword [ebp - 0x640]
mov eax, ebx
mov byte [ebp - 4], 1
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x51fb6d
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov esi, dword [ebp - 0x63c]
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x51fb8f
lea ecx, [ebp - 0x63c]
call fcn.004bd3a0
mov esi, dword [ebp - 0x63c]
cmp dword [esi - 0xc], 0
mov edi, dword [sym.imp.SHELL32.dll_SHGetSpecialFolderPathW]
jne 0x51fd19
lea ecx, [ebp - 0x638]
call fcn.004bd3a0
mov eax, dword [0x66c1ac]
test al, 1
jne 0x51fbe4
or eax, 1
mov dword [0x66c1ac], eax
call fcn.004bfba0
mov ecx, eax
test ecx, ecx
je 0x51ff4b
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
push 0x5f8420
mov dword [0x66c1a8], eax
call fcn.0050f1be
add esp, 4
mov eax, dword [0x66c1a8]
cmp dword [eax - 0xc], 0
jne 0x51fc46
push 0x20c
lea eax, [ebp - 0x428]
push 0
push eax
call fcn.0058c8f0
add esp, 0xc
lea eax, [ebp - 0x428]
push 1
push 0x25
push eax
push 0
call edi
lea ecx, [ebp - 0x428]
lea edx, [ecx + 2]
nop dword [eax]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x51fc20
sub ecx, edx
lea eax, [ebp - 0x428]
sar ecx, 1
push ecx
push eax
mov ecx, 0x66c1a8
call fcn.004c0470
mov eax, dword [0x66c1a8]
add eax, 0xfffffff0
push eax
call fcn.004bfdc0
add esp, 4
lea edi, [eax + 0x10]
mov dword [ebp - 0x640], edi
lea eax, [ebp - 0x640]
mov byte [ebp - 4], 4
push eax
lea ecx, [ebp - 0x638]
call fcn.004bfcd0
mov byte [ebp - 4], 1
add edi, 0xfffffff0
mov eax, ebx
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x51fc8c
mov ecx, dword [edi]
push edi
mov eax, dword [ecx]
call dword [eax + 4]
mov eax, dword [ebp - 0x638]
cmp dword [eax - 0xc], 0
je 0x51fd13
lea eax, [ebp - 0x638]
push eax
call fcn.0051ef80
push dword [ebp - 0x644]
lea eax, [ebp - 0x638]
push eax
lea eax, [ebp - 0x640]
push eax
call fcn.004bc8d0
add esp, 0x10
push eax
lea ecx, [ebp - 0x63c]
mov byte [ebp - 4], 5
call fcn.004bfcd0
mov edx, dword [ebp - 0x640]
mov eax, ebx
mov byte [ebp - 4], 1
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x51fcf1
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov esi, dword [ebp - 0x63c]
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x51fd13
lea ecx, [ebp - 0x63c]
call fcn.004bd3a0
mov esi, dword [ebp - 0x63c]
mov edi, dword [sym.imp.SHELL32.dll_SHGetSpecialFolderPathW]
cmp dword [esi - 0xc], 0
jne 0x51fe9c
lea ecx, [ebp - 0x638]
call fcn.004bd3a0
mov eax, dword [0x66c1b4]
test al, 1
jne 0x51fd68
or eax, 1
mov dword [0x66c1b4], eax
call fcn.004bfba0
mov ecx, eax
test ecx, ecx
je 0x51ff5f
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
push 0x5f8440
mov dword [0x66c1b0], eax
call fcn.0050f1be
add esp, 4
mov eax, dword [0x66c1b0]
cmp dword [eax - 0xc], 0
jne 0x51fdc7
push 0x20c
lea eax, [ebp - 0x634]
push 0
push eax
call fcn.0058c8f0
add esp, 0xc
lea eax, [ebp - 0x634]
push 1
push 0x25
push eax
push 0
call edi
lea ecx, [ebp - 0x634]
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x51fda1
sub ecx, edx
lea eax, [ebp - 0x634]
sar ecx, 1
push ecx
push eax
mov ecx, 0x66c1b0
call fcn.004c0470
mov eax, dword [0x66c1b0]
add eax, 0xfffffff0
push eax
call fcn.004bfdc0
add esp, 4
lea edi, [eax + 0x10]
mov dword [ebp - 0x640], edi
lea eax, [ebp - 0x640]
mov byte [ebp - 4], 6
push eax
lea ecx, [ebp - 0x638]
call fcn.004bfcd0
mov byte [ebp - 4], 1
add edi, 0xfffffff0
mov eax, ebx
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x51fe0d
mov ecx, dword [edi]
push edi
mov eax, dword [ecx]
call dword [eax + 4]
mov eax, dword [ebp - 0x638]
cmp dword [eax - 0xc], 0
je 0x51fe9c
lea eax, [ebp - 0x638]
push eax
call fcn.0051ef80
push dword [ebp - 0x644]
lea eax, [ebp - 0x638]
push eax
lea eax, [ebp - 0x640]
push eax
call fcn.004bc8d0
add esp, 0x10
push eax
lea ecx, [ebp - 0x63c]
mov byte [ebp - 4], 7
call fcn.004bfcd0
mov edx, dword [ebp - 0x640]
mov eax, ebx
mov byte [ebp - 4], 1
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x51fe76
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov esi, dword [ebp - 0x63c]
mov edi, dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
push esi
call edi
test eax, eax
jne 0x51fea2
lea ecx, [ebp - 0x63c]
call fcn.004bd3a0
mov esi, dword [ebp - 0x63c]
jmp 0x51fea2
mov edi, dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
cmp dword [esi - 0xc], 0
mov ebx, dword [sym.imp.KERNEL32.dll_LoadLibraryW]
je 0x51febe
push esi
call edi
test eax, eax
je 0x51febe
push esi
call ebx
mov edi, eax
test edi, edi
jne 0x51feca
mov eax, dword [ebp - 0x644]
push dword [eax]
call ebx
mov edi, eax
or ebx, 0xffffffff
mov byte [ebp - 4], 0
add esi, 0xfffffff0
mov eax, ebx
lock xadd dword [esi + 0xc], eax
dec eax
test eax, eax
jg 0x51fee8
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
mov edx, dword [ebp - 0x638]
mov dword [ebp - 4], 0xffffffff
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], ebx
dec ebx
test ebx, ebx
jg 0x51ff0a
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov eax, edi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0050ed5c
mov esp, ebp
pop ebp
ret
push 0x80004005
call fcn.004b3510
push 0x80004005
call fcn.004b3510
push 0x80004005
call fcn.004b3510
call fcn.004b5400
push 0x80004005
call fcn.004b3510
push 0x80070057
call fcn.004b3510
push 0x80004005
call fcn.004b3510
int3