Function at 0x40d370
Capabilities:
Check if file exists
Copy file
Delete file
Get common file path
Move file

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov eax, 0x2e30
call fcn.00441e20
mov eax, dword [0x4fb2a0]
xor eax, esp
mov dword [esp + 0x2e2c], eax
mov eax, dword [ebp + 8]
push esi
push edi
mov edi, ecx
mov dword [esp + 0x14], eax
mov dword [esp + 0xc], edi
test edi, edi
je 0x40d7cd
test ebx, ebx
je 0x40d7cd
push 0x800
lea ecx, [esp + 0x181c]
push 0
push ecx
call fcn.00438200
push 0x400
lea edx, [esp + 0x1828]
push ebx
push edx
call fcn.00430c93
add esp, 0x18
lea eax, [esp + 0x1818]
push eax
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
lea ecx, [esp + 0x1818]
push ecx
push 0
call dword [sym.imp.SHELL32.dll_SHCreateDirectory]
push 0x800
lea edx, [esp + 0x81c]
push 0
push edx
call fcn.00438200
add esp, 0xc
lea eax, [esp + 0x818]
push eax
push 0x400
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
push 0
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_CopyFileW]
test eax, eax
jne 0x40d43d
mov esi, dword [sym.imp.KERNEL32.dll_MoveFileExW]
push 3
push ebx
push edi
call esi
test eax, eax
je 0x40d458
mov eax, 1
pop edi
pop esi
mov ecx, dword [esp + 0x2e2c]
xor ecx, esp
call fcn.0042e217
mov esp, ebp
pop ebp
ret 4
push 0x800
lea ecx, [esp + 0x101c]
push 0
push ecx
call fcn.00438200
add esp, 0xc
lea edx, [esp + 0x1018]
push edx
push 0
push str.gamebuff
lea eax, [esp + 0x824]
push eax
call dword [sym.imp.KERNEL32.dll_GetTempFileNameW]
test eax, eax
je 0x40d766
xor ecx, ecx
push 0x206
push ecx
lea edx, [esp + 0x2a2a]
push edx
mov word [esp + 0x2a2c], cx
call fcn.00438200
lea edx, [esp + 0x2a2c]
add esp, 0xc
mov eax, ebx
sub edx, ebx
nop
movzx ecx, word [eax]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x40d4c0
lea eax, [esp + 0x2a20]
push eax
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
lea edi, [esp + 0x2a20]
add edi, 0xfffffffe
jmp 0x40d4f0
mov ax, word [edi + 2]
add edi, 2
test ax, ax
jne 0x40d4f0
mov ecx, dword [0x4d5c5c]
push 0x800
lea edx, [esp + 0x201c]
push 0
push edx
mov dword [edi], ecx
call fcn.00438200
xor eax, eax
push 0x206
push eax
lea ecx, [esp + 0x2c3e]
push ecx
mov word [esp + 0x2c40], ax
call fcn.00438200
add esp, 0x18
lea edx, [esp + 0x2c28]
push edx
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
lea eax, [esp + 0x2018]
push eax
push 0
push str.gamebuff
lea ecx, [esp + 0x2c34]
push ecx
call dword [sym.imp.KERNEL32.dll_GetTempFileNameW]
lea eax, [esp + 0x2018]
lea esi, [esp + 8]
call fcn.00403290
lea edx, [esp + 0x2a20]
push edx
lea eax, [esp + 0x2c2c]
push eax
mov ecx, esi
push ecx
call fcn.0040a240
mov edi, dword [esp + 8]
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_MoveFileW]
xor edx, edx
push 0x206
push edx
lea eax, [esp + 0x2822]
push eax
mov word [esp + 0x2824], dx
call fcn.00438200
lea ecx, [esp + 0x2824]
add esp, 0xc
mov eax, ebx
sub ecx, ebx
jmp 0x40d5d0
movzx edx, word [eax]
mov word [ecx + eax], dx
add eax, 2
test dx, dx
jne 0x40d5d0
lea ecx, [esp + 0x2818]
push ecx
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
lea eax, [esp + 0x2818]
add eax, 0xfffffffe
jmp 0x40d600
mov cx, word [eax + 2]
add eax, 2
test cx, cx
jne 0x40d600
mov edx, dword [str.Temp_]
mov ecx, dword [0x4d6a0c]
mov dword [eax], edx
mov edx, dword [0x4d6a10]
mov dword [eax + 4], ecx
mov cx, word [0x4d6a14]
mov dword [eax + 8], edx
mov word [eax + 0xc], cx
lea eax, [esp + 0x1018]
lea esi, [esp + 0x10]
call fcn.00403290
lea edx, [esp + 0x2818]
push edx
lea eax, [esp + 0x81c]
push eax
mov ecx, esi
push ecx
call fcn.0040a240
push 0x800
lea edx, [esp + 0x1c]
push 0
push edx
call fcn.00438200
mov esi, dword [esp + 0x1c]
push 0x400
lea eax, [esp + 0x28]
push esi
push eax
call fcn.00430c93
add esp, 0x18
lea ecx, [esp + 0x18]
push ecx
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
lea edx, [esp + 0x18]
push edx
push 0
call dword [sym.imp.SHELL32.dll_SHCreateDirectory]
push 3
push esi
push edi
mov edi, dword [sym.imp.KERNEL32.dll_MoveFileExW]
call edi
test eax, eax
je 0x40d6d6
push esi
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
test eax, eax
jne 0x40d6c5
call fcn.0040d340
test eax, eax
jne 0x40d6c5
push 4
push eax
mov eax, esi
push eax
call edi
mov esi, dword [esp + 8]
push esi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x40d6f8
jmp 0x40d6da
mov esi, dword [esp + 8]
push esi
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
test eax, eax
jne 0x40d6f8
call fcn.0040d340
test eax, eax
jne 0x40d6f8
mov ecx, dword [esp + 8]
push 4
push eax
push ecx
call edi
mov edx, dword [esp + 0xc]
push 0
push ebx
push edx
call dword [sym.imp.KERNEL32.dll_CopyFileW]
mov esi, eax
test esi, esi
jne 0x40d718
mov eax, dword [esp + 0xc]
push 3
push ebx
push eax
call edi
mov esi, eax
mov eax, dword [esp + 0x10]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40d738
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, dword [esp + 8]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40d758
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
test esi, esi
jne 0x40d7b5
mov esi, dword [sym.imp.KERNEL32.dll_MoveFileExW]
mov edi, dword [esp + 0xc]
push 0x800
lea ecx, [esp + 0x1c]
push 0
push ecx
call fcn.00438200
add esp, 0xc
lea edx, [esp + 0x18]
push edx
push 0
push str.gamebuff
lea eax, [esp + 0x824]
push eax
call dword [sym.imp.KERNEL32.dll_GetTempFileNameW]
push 3
lea ecx, [esp + 0x1c]
push ecx
push edi
call esi
push 5
push ebx
lea edx, [esp + 0x20]
push edx
call esi
mov esi, eax
mov eax, dword [esp + 0x14]
mov byte [eax + 0x2084], 0
mov eax, esi
pop edi
pop esi
mov ecx, dword [esp + 0x2e2c]
xor ecx, esp
call fcn.0042e217
mov esp, ebp
pop ebp
ret 4
mov ecx, dword [esp + 0x2e34]
pop edi
pop esi
xor ecx, esp
xor eax, eax
call fcn.0042e217
mov esp, ebp
pop ebp
ret 4