Function at 0x10031320
Capabilities:
Check if file exists
Delete file
Get file size
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x54
push ebx
push esi
push edi
push ecx
mov esi, edx
mov eax, esp
push esi
mov ebx, ecx
mov dword [ebp - 0x18], esi
push str.LoadTreeFromDisk__s_
push eax
mov dword [ebp - 0x14], ebx
call fcn.1003a800
add esp, 0xc
call fcn.1002fdf0
add esp, 4
mov dword [ebx + 8], 0
cmp word [esi], 0
jne 0x10031366
mov eax, 3
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push 0x200
mov dword [ebp - 0x30], 0x200
mov dword [ebp - 0x2c], 0x200
call fcn.1006bba0
add esp, 4
mov ebx, eax
push 0x200
call fcn.1006bba0
add esp, 4
mov edi, eax
mov dword [ebp - 0xc], edi
push 0
push 0
push 3
push 0
push 1
push SysReAllocStringLen
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x28], eax
cmp eax, 0xffffffff
je 0x1003175b
push 0
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push ecx
mov ecx, esp
mov esi, eax
push esi
push dword [ebp - 0x18]
mov dword [ebp - 0x1c], esi
push str.PATHTREE_LoadTreeFromDisk__s_:_FileSize_ul
push ecx
call fcn.1003a800
add esp, 0x10
call fcn.1002fdf0
add esp, 4
push 0
push 0
push 0
push 2
push 0
push dword [ebp - 0x28]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov dword [ebp - 0x44], eax
test eax, eax
je 0x10031719
push 0
push 0
push 0
push 4
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov dword [ebp - 0x20], eax
test eax, eax
je 0x100316a8
cmp esi, 4
jb 0x100316bd
mov ecx, dword [eax]
mov esi, 4
mov eax, dword [ebp - 0x14]
mov dword [eax + 0xc], ecx
cmp ecx, 2
jne 0x100316bd
lea ecx, [ebp - 8]
call fcn.10022b60
mov ecx, dword [ebp - 0x1c]
mov dword [ebp - 0x10], 0
cmp ecx, 0x10
jb 0x10031697
lea eax, [esi + 0xc]
mov dword [ebp - 0x34], eax
cmp eax, ecx
ja 0x100316b5
mov ecx, dword [ebp - 0x20]
movq xmm0, qword [esi + ecx]
mov edi, dword [esi + ecx + 8]
movq qword [ebp - 0x54], xmm0
cmp dword [ebp - 0x54], 0x410509e8
jne 0x100316b5
test edi, edi
je 0x100316b5
mov esi, dword [ebp - 0x50]
cmp dword [ebp - 0x2c], esi
jae 0x100314b1
push dword [ebp - 0xc]
call fcn.1006ac0c
add esp, 4
mov dword [ebp - 0x2c], esi
push esi
call fcn.1006bba0
mov edx, eax
add esp, 4
mov eax, dword [ebp - 0x34]
mov dword [ebp - 0xc], edx
jmp 0x100314b4
mov edx, dword [ebp - 0xc]
lea ecx, [esi + eax]
mov dword [ebp - 0x34], ecx
cmp ecx, dword [ebp - 0x1c]
ja 0x100316b5
add eax, dword [ebp - 0x20]
push esi
push eax
push edx
call fcn.1006f6d0
lea eax, [edi + 2]
add esp, 0xc
cmp dword [ebp - 0x30], eax
jae 0x100314f3
push ebx
call fcn.1006ac0c
add esp, 4
lea eax, [edi + 2]
mov dword [ebp - 0x30], eax
push eax
call fcn.1006bba0
add esp, 4
mov ebx, eax
mov eax, dword [ebp - 0x34]
lea ecx, [edi + eax]
mov dword [ebp - 0x34], ecx
cmp ecx, dword [ebp - 0x1c]
ja 0x100316b5
add eax, dword [ebp - 0x20]
push edi
push eax
push ebx
call fcn.1006f6d0
add esp, 8
shr edi, 1
xor eax, eax
mov ecx, esp
push ebx
mov word [ebx + edi*2], ax
call fcn.10022bb0
mov edi, 0x5c
lea ecx, [ebp - 0x24]
mov edx, edi
call fcn.1003a970
add esp, 4
lea edx, [ebp - 0x24]
lea ecx, [ebp - 8]
call fcn.10031810
push ecx
test al, al
je 0x10031598
mov ecx, esp
push ebx
call fcn.10022bb0
mov edx, edi
lea ecx, [ebp - 0x38]
call fcn.1003a890
mov edi, dword [ebp - 0xc]
add esp, 4
mov edx, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x14]
push esi
push edi
push 1
push dword [eax]
push ebx
call fcn.10030350
mov edx, dword [ebp - 0x38]
or ecx, 0xffffffff
add edx, 0xfffffff0
mov dword [ebp - 0x10], eax
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x1003163f
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
jmp 0x1003163f
mov ecx, dword [ebp - 8]
mov esi, esp
lea ecx, [ecx - 0x10]
call fcn.100236e0
add eax, 0x10
lea ecx, [ebp - 0x3c]
mov edx, edi
mov dword [esi], eax
call fcn.1003a970
add esp, 4
lea edx, [ebp - 0x24]
mov ecx, eax
call fcn.10031810
mov esi, dword [ebp - 0x3c]
or edx, 0xffffffff
add esi, 0xfffffff0
mov byte [ebp - 1], al
lea ecx, [esi + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x100315e4
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
mov al, byte [ebp - 1]
test al, al
je 0x10031625
push ecx
mov ecx, esp
push ebx
call fcn.10022bb0
mov edx, edi
lea ecx, [ebp - 0x40]
call fcn.1003a890
mov edi, dword [ebp - 0xc]
add esp, 4
mov edx, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x14]
push dword [ebp - 0x50]
mov edx, dword [edx + 0x10]
push edi
push 1
push dword [eax]
push ebx
call fcn.10030350
lea ecx, [ebp - 0x40]
mov dword [ebp - 0x10], eax
call fcn.10022680
jmp 0x1003163f
mov edi, dword [ebp - 0xc]
lea eax, [ebp - 0x10]
push eax
push 1
push 0
push ecx
push dword [ebp - 0x50]
mov ecx, dword [ebp - 0x14]
mov edx, ebx
push edi
call fcn.100305d0
test ebx, ebx
jne 0x10031647
xor eax, eax
jmp 0x1003165f
mov eax, ebx
lea edx, [eax + 2]
lea esp, [esp]
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x10031650
sub eax, edx
sar eax, 1
push eax
push ebx
lea ecx, [ebp - 8]
call fcn.10023530
mov edx, dword [ebp - 0x24]
or ecx, 0xffffffff
add edx, 0xfffffff0
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x10031686
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov esi, dword [ebp - 0x34]
mov ecx, dword [ebp - 0x1c]
lea eax, [esi + 0xc]
cmp eax, ecx
jbe 0x10031454
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
lea ecx, [ebp - 8]
call fcn.10022680
push dword [ebp - 0x44]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
jmp 0x1003171f
lea ecx, [ebp - 8]
call fcn.10022680
call dword [sym.imp.KERNEL32.dll_GetLastError]
push ecx
mov ecx, esp
push eax
push str._PATHTREE_LoadTreeFromDisk:_ERROR__tree_is_malformed__LE_d
push ecx
call fcn.1003a800
add esp, 0xc
call fcn.1002fdf0
add esp, 4
push dword [ebp - 0x28]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
call fcn.1006ac0c
add esp, 4
push dword [ebp - 0xc]
call fcn.1006ac0c
add esp, 4
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
mov eax, dword [ebp - 0x14]
mov dword [eax + 8], 0
mov eax, 2
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push ecx
mov eax, esp
push dword [ebp - 0x18]
push str.LoadTreeFromDisk__s_:_done
push eax
call fcn.1003a800
add esp, 0xc
call fcn.1002fdf0
add esp, 4
push dword [ebp - 0x28]
call esi
push ebx
call fcn.1006ac0c
add esp, 4
push edi
call fcn.1006ac0c
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
cmp eax, 2
jne 0x1003177e
push ecx
mov eax, esp
push dword [ebp - 0x18]
push str.PATHTREE_LoadTreeFromDisk:_file__s_doesnt_exist.
push eax
call fcn.1003a800
add esp, 0xc
jmp 0x10031795
call esi
push ecx
mov ecx, esp
push eax
push dword [ebp - 0x18]
push str._PATHTREE_LoadTreeFromDisk:_FAILED_to_open_file__s__LE_d
push ecx
call fcn.1003a800
add esp, 0x10
call fcn.1002fdf0
add esp, 4
push ebx
call fcn.1006ac0c
add esp, 4
push edi
call fcn.1006ac0c
add esp, 4
mov eax, 1
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret