Function at 0x10008c70
Capabilities:
Check if file exists
Delete file
Get common file path
Get file attributes
Query environment variable
Write file on windows

Disassembly:
mov eax, dword [esp + 0x10]
sub esp, 0x224
push ebx
push ebp
push esi
mov esi, dword [esp + 0x23c]
mov ebp, edx
push edi
push eax
xor edi, edi
lea edx, [esp + 0x14]
mov dword [eax], edi
lea eax, [esp + 0x20]
push esi
push eax
lea eax, [esp + 0x2c]
push eax
lea eax, [esp + 0x28]
push eax
call fcn.10007cf0
add esp, 0x14
test eax, eax
je 0x10008f10
cmp dword [0x10016c89], 0x2000
mov ebx, dword [esp + 0x10]
jae 0x10008d7f
lea eax, [esp + 0x28]
push eax
push edi
push 0x1000f2d8
push 0x10017280
call dword [sym.imp.KERNEL32.dll_GetTempFileNameW]
test eax, eax
je 0x10008d6a
lea eax, [esp + 0x28]
mov dword [esp + 0x14], edi
push eax
mov eax, dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
call eax
cmp eax, 0xffffffff
je 0x10008d02
lea eax, [esp + 0x28]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
push 0
push 0
push 2
push 0
push 3
push 0x40000000
lea eax, [esp + 0x40]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [esp + 0x10], eax
cmp eax, 0xffffffff
je 0x10008d6a
push 0
lea ecx, [esp + 0x28]
push ecx
push 4
lea ecx, [esp + 0x20]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
push dword [esp + 0x10]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test esi, esi
je 0x10008d6a
lea eax, [esp + 0x28]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
push dword [esp + 0x238]
push 0x10017280
push ebp
call dword [sym.imp.KERNEL32.dll_lstrcpynW]
jmp 0x10008d9b
push dword [esp + 0x238]
push 0x10017490
push ebp
call dword [sym.imp.KERNEL32.dll_lstrcpynW]
jmp 0x10008d9b
push dword [esp + 0x238]
push ebp
push dword [0x10016744]
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
test eax, eax
je 0x10008ed4
cmp dword [esp + 0x23c], edi
je 0x10008df4
push ebp
call dword [sym.imp.KERNEL32.dll_lstrlenW]
lea esi, [eax*2]
add esi, ebp
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov edx, esi
mov ecx, eax
call fcn.10001290
test ebx, ebx
je 0x10008dfc
push ebx
call dword [sym.imp.KERNEL32.dll_lstrlenW]
test eax, eax
je 0x10008dfc
dec eax
test eax, eax
jle 0x10008dea
movzx ecx, word [ebx + eax*2]
test cx, cx
je 0x10008dea
cmp ecx, 0x2e
je 0x10008dea
dec eax
test eax, eax
jg 0x10008dd7
lea eax, [ebx + eax*2]
test eax, eax
je 0x10008dfc
push eax
jmp 0x10008df5
push ebx
push ebp
call dword [sym.imp.KERNEL32.dll_lstrcatW]
mov esi, dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
push ebp
call esi
cmp eax, 0xffffffff
je 0x10008e2f
test al, 0x10
jne 0x10008e2f
mov eax, dword [esp + 0x240]
xor edi, edi
mov dword [eax], 0xde
mov eax, dword [esp + 0x244]
mov dword [eax], 0xb7
jmp 0x10008eda
push ebp
call esi
cmp eax, 0xffffffff
je 0x10008e3e
push ebp
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
push 0
push 0
push 2
push 0
push 3
push 0x40000000
push ebp
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
mov dword [esp + 0x10], esi
cmp esi, 0xffffffff
je 0x10008ec3
mov ecx, dword [esp + 0x18]
test ecx, ecx
je 0x10008e96
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x10008e96
push 0
lea edx, [esp + 0x28]
push edx
push eax
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov esi, eax
test esi, esi
jne 0x10008e9b
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0x244]
mov dword [ecx], eax
jmp 0x10008e9b
mov esi, 1
push dword [esp + 0x10]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test esi, esi
je 0x10008eda
mov eax, dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
push ebp
call eax
cmp eax, 0xffffffff
je 0x10008ec1
test al, 0x10
jne 0x10008ec1
mov edi, 1
jmp 0x10008eda
xor edi, edi
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0x244]
mov dword [ecx], eax
jmp 0x10008eda
mov dword [esi], 0x6f
test ebx, ebx
je 0x10008f10
mov ecx, dword [esp + 0x20]
test ecx, ecx
je 0x10008f10
cmp ecx, 0x1000
jbe 0x10008f09
push 0x8000
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualFree]
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x224
ret
push ebx
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x224
ret