Function at 0x4e8a70
Capabilities:
Check if file exists
Generate random numbers via winapi
Get common file path
Get file attributes

Disassembly:
sub esp, 0x20
push ebx
mov ebx, dword [esp + 0x2c]
push ebp
push esi
mov esi, dword [sym.imp.KERNEL32.DLL_GetLastError]
xor ebp, ebp
mov dword [esp + 0xc], 0
push edi
test ebx, ebx
jne 0x4e8c39
mov edx, dword [esp + 0x34]
mov dword [esp + 0x24], ebp
mov dword [esp + 0x28], ebp
mov dword [esp + 0x2c], ebp
test edx, edx
jne 0x4e8b24
push edx
push edx
call dword [sym.imp.KERNEL32.DLL_GetTempPathW]
mov edi, eax
test edi, edi
jne 0x4e8ac2
call esi
push eax
call fcn.004f0390
jmp 0x4e8d99
lea eax, [edi + edi]
push eax
call dword [sym.imp.MSVCRT.dll_malloc]
mov esi, eax
add esp, 4
test esi, esi
jne 0x4e8ae6
call dword [sym.imp.MSVCRT.dll__errno]
mov dword [eax], 0xc
jmp 0x4e8d9c
push esi
push edi
call dword [sym.imp.KERNEL32.DLL_GetTempPathW]
mov ecx, esi
mov dword [esp + 0x28], ebp
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4e8af7
sub ecx, edx
lea eax, [esp + 0x24]
sar ecx, 1
push ecx
push esi
push eax
call fcn.004ec2e0
push esi
call dword [sym.imp.MSVCRT.dll_free]
mov esi, dword [sym.imp.KERNEL32.DLL_GetLastError]
add esp, 0x10
jmp 0x4e8b6f
mov ecx, edx
lea edi, [ecx + 1]
lea esp, [esp]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x4e8b30
sub ecx, edi
lea eax, [esp + 0x24]
push ecx
push edx
push eax
call fcn.004ec000
add esp, 0xc
test eax, eax
js 0x4e8d9c
mov ecx, dword [esp + 0x28]
mov eax, dword [esp + 0x24]
cmp word [eax + ecx*2 - 2], 0x2f
je 0x4e8b6f
lea eax, [esp + 0x24]
push 0x2f
push eax
call fcn.004ebf20
add esp, 8
push dword [esp + 0x24]
mov edi, dword [sym.imp.KERNEL32.DLL_GetFileAttributesW]
call edi
cmp eax, 0xffffffff
jne 0x4e8bcc
call esi
cmp eax, 2
je 0x4e8b94
call esi
push eax
call fcn.004f0390
jmp 0x4e8d99
push dword [esp + 0x24]
call fcn.004f0760
mov ebp, eax
add esp, 4
test ebp, ebp
jne 0x4e8bb7
call dword [sym.imp.MSVCRT.dll__errno]
mov dword [eax], 0x16
jmp 0x4e8d9c
push ebp
call edi
cmp eax, 0xffffffff
jne 0x4e8bcc
call esi
push eax
call fcn.004f0390
jmp 0x4e8d99
test al, 0x10
jne 0x4e8be1
call dword [sym.imp.MSVCRT.dll__errno]
mov dword [eax], 0x14
jmp 0x4e8d9c
lea eax, [esp + 0x24]
push str.libarchive_
push eax
call fcn.004ebf80
lea eax, [esp + 0x2c]
push str.XXXXXXXXXX
push eax
call fcn.004ebf80
mov ecx, dword [esp + 0x34]
add esp, 0x10
mov eax, dword [esp + 0x28]
mov dword [esp + 0x38], ecx
lea edi, [ecx + eax*2]
lea ebx, [edi - 0x14]
mov dword [esp + 0x14], ebx
push 0xf0000000
push 1
push 0
push 0
lea eax, [esp + 0x20]
push eax
call dword [sym.imp.ADVAPI32.dll_CryptAcquireContextW]
test eax, eax
jne 0x4e8c74
call esi
jmp 0x4e8d8f
push 0x58
push ebx
call dword [sym.imp.MSVCRT.dll_wcschr]
mov ebx, eax
add esp, 8
mov dword [esp + 0x14], ebx
test ebx, ebx
jne 0x4e8c55
call dword [sym.imp.MSVCRT.dll_abort]
cmp word [ebx], 0x58
mov edi, ebx
jne 0x4e8c69
lea ecx, [ecx]
add edi, 2
cmp word [edi], 0x58
je 0x4e8c60
cmp word [edi], bp
je 0x4e8c18
call dword [sym.imp.MSVCRT.dll_abort]
mov eax, edi
mov dword [esp + 0x1c], 0x3e
sub eax, ebx
mov dword [esp + 0x18], eax
and eax, 0xfffffffe
mov dword [esp + 0x20], eax
jmp 0x4e8c90
push ebx
push eax
push dword [esp + 0x18]
mov esi, ebx
call dword [sym.imp.ADVAPI32.dll_CryptGenRandom]
test eax, eax
je 0x4e8d87
mov eax, dword [esp + 0x18]
xor ecx, ecx
inc eax
shr eax, 1
cmp edi, ebx
sbb ebx, ebx
not ebx
and ebx, eax
jbe 0x4e8cdd
lea esp, [esp]
movzx eax, word [esi]
lea esi, [esi + 2]
xor edx, edx
inc ecx
div dword [esp + 0x1c]
mov ax, word [edx*2 + str.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]
mov word [esi - 2], ax
cmp ecx, ebx
jb 0x4e8cc0
mov esi, dword [sym.imp.MSVCRT.dll_free]
push ebp
call esi
mov ebx, dword [esp + 0x3c]
push ebx
call fcn.004f0760
mov ebp, eax
add esp, 8
test ebp, ebp
je 0x4e8d76
mov eax, ebx
sub eax, dword [esp + 0x24]
neg eax
push 0
sbb eax, eax
and eax, 0xfbffff80
add eax, 0x4000100
push eax
push 1
push 0
push 0
push 0xc0010000
push ebp
call dword [sym.imp.KERNEL32.DLL_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
jne 0x4e8d46
mov esi, dword [sym.imp.KERNEL32.DLL_GetLastError]
call esi
mov ebx, dword [esp + 0x14]
cmp eax, 0x50
mov eax, dword [esp + 0x20]
je 0x4e8c90
call esi
jmp 0x4e8d8f
push 0x8002
push esi
call dword [sym.imp.MSVCRT.dll__open_osfhandle]
mov edi, eax
add esp, 8
cmp edi, 0xffffffff
jne 0x4e8d9f
mov ecx, dword [sym.imp.KERNEL32.DLL_GetLastError]
call ecx
push eax
call fcn.004f0390
add esp, 4
push esi
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
jmp 0x4e8d9f
call dword [sym.imp.MSVCRT.dll__errno]
or edi, 0xffffffff
mov dword [eax], 0x16
jmp 0x4e8da5
mov ecx, dword [sym.imp.KERNEL32.DLL_GetLastError]
call ecx
push eax
call fcn.004f0390
mov ebx, dword [esp + 0x3c]
add esp, 4
or edi, 0xffffffff
mov esi, dword [sym.imp.MSVCRT.dll_free]
mov eax, dword [esp + 0x10]
test eax, eax
je 0x4e8db6
push 0
push eax
call dword [sym.imp.ADVAPI32.dll_CryptReleaseContext]
push ebp
call esi
add esp, 4
cmp ebx, dword [esp + 0x24]
jne 0x4e8dcf
lea eax, [esp + 0x24]
push eax
call fcn.004ec2b0
add esp, 4
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x20
ret