Function at 0x509040
Capabilities:
Check if file exists
Get file attributes

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5a5e58
mov eax, dword fs:[0]
push eax
sub esp, 0x2c
mov eax, dword [0x634384]
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 esi, ecx
mov eax, dword [ebp + 0xc]
mov ebx, dword [ebp + 8]
mov dword [ebp - 0x30], eax
mov eax, dword [ebp + 0x14]
mov dword [ebp - 0x2c], eax
mov eax, dword [esi + 0x18]
mov dword [esi + 0x2c], 3
mov dword [esi + 0x24], 1
mov dword [esi + 0x20], 0
mov dword [esi + 0x16c], 0
mov dword [esi + 8], 0
mov dword [esi + 0xc], 0
mov dword [esi + 0x10], 0
mov dword [esi + 0x14], 0
mov dword [esi + 0x158], 0
mov dword [esi + 0x15c], 0
mov dword [esi + 0x160], 0
mov dword [esi + 0x164], 0
test eax, eax
je 0x5090f6
push eax
call fcn.00539650
add esp, 4
mov dword [esi + 0x18], 0
mov ecx, ebx
lea edx, [ecx + 1]
jmp 0x509100
mov al, byte [ecx]
inc ecx
test al, al
jne 0x509100
sub ecx, edx
push 0x64f17e
lea edi, [ecx + 1]
push edi
call fcn.00539950
add esp, 8
mov dword [esi + 0x18], eax
test eax, eax
je 0x50912c
push ebx
push edi
push eax
call fcn.0055c7a7
add esp, 0xc
mov edi, dword [ebp + 0x10]
test edi, edi
je 0x509268
mov ecx, dword [esi + 0x1a4]
mov eax, ebx
nop
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x509160
test dl, dl
je 0x50915c
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x509160
add eax, 2
add ecx, 2
test dl, dl
jne 0x509140
xor eax, eax
jmp 0x509165
sbb eax, eax
or eax, 1
test eax, eax
jne 0x50918d
cmp dword [esi + 0x1c4], eax
je 0x509179
or ebx, 0xffffffff
jmp 0x50926a
cmp dword [esi + 0x1ac], 0
je 0x50918d
mov ebx, dword [esi + 0x1c8]
jmp 0x50926a
push ebx
mov ecx, esi
call fcn.00508740
mov edi, eax
test edi, edi
je 0x5091dd
push edi
call fcn.0043c4c0
add esp, 4
push edi
test al, al
je 0x5091c4
call fcn.004455f0
mov edi, dword [ebp + 0x10]
mov ebx, eax
or eax, 0xffffffff
add esp, 4
cmp ebx, 0xffffffff
cmove ebx, eax
jmp 0x50926a
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
mov edi, dword [ebp + 0x10]
mov ebx, eax
or eax, 0xffffffff
cmp ebx, 0xffffffff
cmove ebx, eax
jmp 0x50926a
xor eax, eax
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x14], 7
mov word [ebp - 0x28], ax
mov dword [ebp - 4], eax
lea eax, [ebp - 0x28]
push eax
push ebx
call fcn.00432e80
cmp dword [ebp - 0x14], 8
lea eax, [ebp - 0x28]
cmovae eax, dword [ebp - 0x28]
push eax
call fcn.0043c4c0
add esp, 0xc
test al, al
lea eax, [ebp - 0x28]
je 0x50923a
cmp dword [ebp - 0x14], 8
cmovae eax, dword [ebp - 0x28]
push eax
call fcn.004455f0
add esp, 4
jmp 0x509249
cmp dword [ebp - 0x14], 8
cmovae eax, dword [ebp - 0x28]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
mov ebx, eax
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x28]
call fcn.0041ba60
mov edi, dword [ebp + 0x10]
or eax, 0xffffffff
cmp ebx, 0xffffffff
cmove ebx, eax
jmp 0x50926a
xor ebx, ebx
cmp ebx, 0xffffffff
jne 0x509288
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 2
je 0x50927f
cmp eax, 3
jne 0x509294
mov dword [esi + 0x20], 0x800020
jmp 0x509294
test bl, 0x10
je 0x509294
mov dword [esi + 0x20], 0x800000
test edi, edi
je 0x5092d8
cmp dword [esi + 0x20], 0
jne 0x5092d8
mov eax, dword [esi]
mov ecx, esi
push 0
push dword [esi + 0x18]
call dword [eax + 0x50]
mov edi, eax
lea ebx, [esi + 8]
test edi, edi
je 0x5092c4
cmp edi, 0xffffffff
je 0x5092c4
push ebx
mov ecx, edi
call fcn.0050f250
test eax, eax
jne 0x5092cb
mov dword [esi + 0x20], 0x20
mov eax, dword [esi]
mov ecx, esi
push edi
call dword [eax + 0x54]
mov edi, dword [ebp + 0x10]
jmp 0x5092db
lea ebx, [esi + 8]
mov eax, dword [esi]
mov ecx, esi
call dword [eax + 0x70]
test eax, eax
je 0x50936b
cmp dword [esi + 0x20], 0
jne 0x50936b
mov edx, dword [ebx]
mov eax, edx
mov ecx, dword [ebx + 4]
or eax, ecx
mov dword [ebp - 0x34], ecx
je 0x50936b
test edi, edi
je 0x509330
lea eax, [esi + 0xa8]
push eax
push dword [ebp - 0x2c]
mov eax, dword [esi + 0x30]
push ecx
push edx
push dword [esi + 0x18]
push dword [eax]
mov eax, dword [esi + 0xa0]
push 1
push 4
push dword [esi + 0x90]
call eax
add esp, 0x24
mov dword [esi + 0x20], eax
jmp 0x509339
mov dword [esi + 0x20], 0
xor eax, eax
test al, 7
jne 0x50936b
cmp eax, 0xffffffff
je 0x50936b
test eax, 0x7e1e0
jne 0x50936b
test eax, 0x181000
je 0x50936b
mov eax, dword [ebx]
mov ecx, esi
mov dword [esi + 0x158], eax
mov eax, dword [ebx + 4]
mov dword [esi + 0x15c], eax
call fcn.0050a270
mov dword [esi + 0x20], eax
cmp dword [esi + 0x16c], 0
je 0x509386
mov eax, dword [esi + 0x20]
test al, 7
jne 0x509380
or eax, 0x11
jmp 0x509383
or eax, 0x10
mov dword [esi + 0x20], eax
mov eax, dword [esi + 0x20]
test al, 8
je 0x5093de
cmp eax, 0xffffffff
je 0x5093de
mov ecx, dword [ebp - 0x30]
mov eax, dword [ecx]
test eax, eax
je 0x5093a2
dec eax
mov dword [ecx], eax
test eax, eax
jne 0x5093de
call fcn.004917e0
lea edi, [eax + 0x45c]
lea ecx, [edi + 4]
lock bts dword [ecx], 0
jb 0x5093cd
push edi
lea ecx, [edi + 0xc]
push ecx
mov ecx, dword [edi + 8]
call fcn.004ed240
mov ecx, eax
call fcn.00432290
mov byte [edi], al
cmp byte [edi], 0
jne 0x5093de
mov eax, dword [esi + 0x20]
and eax, 0xfffffff7
or eax, 0x10
mov dword [esi + 0x20], eax
mov eax, dword [esi]
mov ecx, esi
call dword [eax + 0x74]
mov eax, dword [esi + 0x20]
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.005395e6
mov esp, ebp
pop ebp
ret 0x10