Function at 0x1004f5d
Capabilities:
Check if file exists
Get file attributes
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x2c
push ebx
xor ebx, ebx
mov dword [ebp - 0x10], 4
mov dword [ebp - 4], ebx
mov dword [ebp - 0xc], ebx
cmp byte [ebp + 8], bl
jne 0x1004f92
lea eax, [ebp - 0xc]
push eax
call fcn.01004dab
test eax, eax
jne 0x1004f92
call dword [sym.imp.KERNEL32.dll_GetLastError]
jmp 0x1005281
push ebx
push 0x1000
push ebx
push ebx
push 2
call dword [sym.imp.CRYPT32.dll_CertOpenStore]
mov dword [ebp - 8], eax
mov eax, dword [ebp + 0x14]
lea ecx, [eax + 2]
mov dx, word [eax]
inc eax
inc eax
cmp dx, bx
jne 0x1004fab
sub eax, ecx
push esi
sar eax, 1
lea esi, [eax + 5]
push edi
lea eax, [esi + esi]
push eax
mov dword [ebp - 0x20], esi
call fcn.01001b24
mov edi, eax
mov dword [ebp - 0x14], edi
cmp dword [ebp - 8], ebx
je 0x1005258
cmp edi, ebx
je 0x1005258
cmp byte [ebp + 8], bl
jne 0x100503c
push dword [ebp + 0x14]
push 0x100162c
push esi
push edi
call fcn.01001bd9
add esp, 0x10
test eax, eax
jge 0x1005015
push 0x6f
pop esi
push edi
call fcn.01001b44
push ebx
push dword [ebp - 8]
call dword [sym.imp.CRYPT32.dll_CertCloseStore]
mov eax, esi
jmp 0x100527f
push edi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x100503c
lea eax, [ebp - 0x1c]
push eax
push edi
call fcn.01002b33
mov dword [ebp - 4], eax
cmp eax, ebx
jne 0x1005037
cmp dword [ebp - 0x1c], ebx
je 0x100503c
mov esi, dword [ebp - 4]
jmp 0x1004ffe
push dword [ebp + 0x14]
push 0x100161c
push esi
push edi
call fcn.01001bd9
add esp, 0x10
test eax, eax
jl 0x1004ffb
push edi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x1005074
lea eax, [ebp - 0x1c]
push eax
push edi
call fcn.01002b33
mov dword [ebp - 4], eax
cmp eax, ebx
jne 0x1005037
cmp dword [ebp - 0x1c], ebx
jne 0x1005037
cmp byte [ebp + 8], bl
je 0x1005080
mov dword [ebp - 0x10], 5
cmp byte [ebp + 0xc], bl
je 0x1005089
or dword [ebp - 0x10], 2
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x18]
push eax
lea eax, [ebp + 0x10]
push eax
push dword [ebp + 0x10]
push dword [ebp - 0x10]
call fcn.01004af8
test al, al
je 0x100523d
mov esi, dword [sym.imp.KERNEL32.dll_CreateFileW]
push ebx
push 0x80
push 2
push ebx
push ebx
push 0x40000000
push edi
mov dword [ebp - 0x24], ebx
mov dword [ebp - 0x10], ebx
call esi
mov edi, eax
cmp edi, 0xffffffff
je 0x1005102
push ebx
lea eax, [ebp - 0x10]
push eax
mov eax, dword [ebp + 0x10]
push dword [eax + 8]
push dword [eax + 4]
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x10050f1
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
jmp 0x10050f9
push 0x28
call fcn.01001cd8
pop ecx
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x100510b
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
cmp byte [ebp + 8], bl
jne 0x1005201
push ebx
push 4
push dword [ebp + 0x10]
push dword [ebp - 8]
call dword [sym.imp.CRYPT32.dll_CertAddCertificateContextToStore]
test eax, eax
je 0x1005201
xor eax, eax
push 7
lea edi, [ebp - 0x2c]
stosd dword es:[edi], eax
push ebx
push dword [ebp - 0xc]
stosd dword es:[edi], eax
mov edi, dword [sym.imp.CRYPT32.dll_PFXExportCertStoreEx]
lea eax, [ebp - 0x2c]
push eax
push dword [ebp - 8]
call edi
test eax, eax
je 0x10051f8
push dword [ebp - 0x2c]
call fcn.01001b24
mov dword [ebp - 0x28], eax
cmp eax, ebx
je 0x10051ef
push 7
push ebx
push dword [ebp - 0xc]
lea eax, [ebp - 0x2c]
push eax
push dword [ebp - 8]
call edi
test eax, eax
je 0x10051dc
push dword [ebp + 0x14]
push 0x100162c
push dword [ebp - 0x20]
push dword [ebp - 0x14]
call fcn.01001bd9
add esp, 0x10
test eax, eax
jl 0x10051dc
push ebx
push 0x80
push 2
push ebx
push ebx
push 0x40000000
push dword [ebp - 0x14]
call esi
mov esi, eax
cmp esi, 0xffffffff
je 0x10051dc
push ebx
lea eax, [ebp - 0x10]
push eax
push dword [ebp - 0x2c]
push dword [ebp - 0x28]
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x10051cb
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
jmp 0x10051d3
push 0x29
call fcn.01001cd8
pop ecx
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x10051e5
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
push dword [ebp - 0x28]
call fcn.01001b44
jmp 0x1005201
mov dword [ebp - 4], 8
jmp 0x1005201
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
push dword [ebp + 0x10]
call dword [sym.imp.CRYPT32.dll_CertFreeCertificateContext]
cmp byte [ebp + 8], bl
jne 0x1005228
cmp byte [ebp + 0xc], bl
jne 0x1005228
push 0x50
push 1
push dword [ebp - 0x1c]
lea eax, [ebp - 0x24]
push dword [ebp - 0x18]
push eax
call dword [sym.imp.ADVAPI32.dll_CryptAcquireContextW]
push dword [ebp - 0x18]
call fcn.01001b44
push dword [ebp - 0x1c]
call fcn.01001b44
mov edi, dword [ebp - 0x14]
jmp 0x1005246
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
push edi
call fcn.01001b44
push ebx
push dword [ebp - 8]
call dword [sym.imp.CRYPT32.dll_CertCloseStore]
jmp 0x100525f
mov dword [ebp - 4], 8
cmp dword [ebp - 0xc], ebx
je 0x100526c
push dword [ebp - 0xc]
call fcn.01001b44
cmp dword [ebp - 4], ebx
je 0x100527c
push dword [ebp - 4]
push ebx
call fcn.01001d2d
pop ecx
pop ecx
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
leave
ret 0x10