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

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x40
or dword [ebp - 8], 0xffffffff
push ebx
push esi
push edi
xor edx, edx
mov dword [ebp - 0x2c], edx
xor eax, eax
lea edi, [ebp - 0x28]
stosd dword es:[edi], eax
lea ebx, [ecx + 0x10]
push ebx
mov dword [ebp - 0x1c], ecx
stosd dword es:[edi], eax
mov dword [ebp - 0x10], edx
mov dword [ebp - 0xc], edx
call dword [sym.imp.KERNEL32.dll_lstrlenW]
mov esi, eax
test esi, esi
jne 0x10135e7
test byte [0x102407c], 0x10
je 0x10136d4
push 0x10021bc
push 0x1a
push dword [0x1024074]
push dword [0x1024070]
call fcn.0100335b
jmp 0x10136d4
mov dword [ebp - 0x20], esi
add esi, 0xd
lea eax, [esi + esi]
push eax
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov edi, eax
test edi, edi
mov dword [ebp - 0xc], edi
jne 0x101362f
test byte [0x102407c], 0x10
je 0x1013623
push 0x10021bc
push 0x1b
push dword [0x1024074]
push dword [0x1024070]
call fcn.0100335b
mov dword [ebp - 4], 0xe
jmp 0x10139f6
push ebx
push esi
push edi
call fcn.01013190
xor ebx, ebx
cmp eax, ebx
mov dword [ebp - 4], eax
jge 0x101366b
test byte [0x102407c], 0x10
je 0x10139dc
push eax
push 0x10021bc
push 0x1c
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003493
jmp 0x10139dc
push 0x10022c4
push esi
push edi
call fcn.01013567
cmp eax, ebx
mov dword [ebp - 4], eax
jge 0x1013695
test byte [0x102407c], 0x10
je 0x10139dc
push eax
push 0x10021bc
push 0x1d
jmp 0x1013655
push 0xf0000000
push 1
push ebx
push ebx
lea eax, [ebp - 0x10]
push eax
call dword [sym.imp.ADVAPI32.dll_CryptAcquireContextW]
test eax, eax
jne 0x10136e0
test byte [0x102407c], 0x10
je 0x10136d4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x10021bc
push 0x1e
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003493
mov dword [ebp - 4], 0x8004020e
jmp 0x10139f6
mov dword [ebp - 0x24], ebx
mov dword [ebp - 0x28], ebx
mov dword [ebp - 0x14], ebx
mov dword [ebp - 0x2c], 0xc
mov ebx, 0x10021bc
cmp dword [ebp - 0x14], 0x100
jae 0x10137fe
push 0x1002278
call dword [sym.imp.KERNEL32.dll_lstrlenW]
mov ecx, dword [ebp - 0x20]
mov dword [ebp - 8], eax
mov eax, dword [ebp - 0xc]
push 8
lea esi, [eax + ecx*2]
pop edi
lea eax, [ebp - 0x18]
push eax
push 4
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_CryptGenRandom]
mov eax, dword [ebp - 0x18]
xor edx, edx
div dword [ebp - 8]
mov dword [ebp - 0x18], edx
mov ax, word [edx*2 + 0x1002278]
mov word [esi], ax
inc esi
inc esi
dec edi
jne 0x101371c
test byte [0x102407c], 0x10
je 0x1013766
push dword [ebp - 0xc]
push ebx
push 0x1f
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003381
push 0
push 0xc002006
push 1
lea eax, [ebp - 0x2c]
push eax
push 4
push 0xc0010000
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
mov dword [ebp - 8], edi
jne 0x10137d4
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
cmp eax, 5
je 0x10137c4
cmp eax, 0x50
jne 0x1013834
test byte [0x102407c], 0x10
je 0x10137f2
push 8
push ebx
push 0x21
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003493
jmp 0x10137f2
test byte [0x102407c], 0x10
je 0x10137f2
push 8
push ebx
push 0x20
jmp 0x10137b1
test byte [0x102407c], 0x10
je 0x10137f2
push edi
push ebx
push 0x23
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003493
inc dword [ebp - 0x14]
cmp edi, 0xffffffff
je 0x10136f5
cmp dword [ebp - 8], 0xffffffff
jne 0x1013845
test byte [0x102407c], 0x10
je 0x1013828
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push ebx
push 0x24
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003493
mov dword [ebp - 4], 0x80040218
jmp 0x10139f6
test byte [0x102407c], 0x10
je 0x1013828
call esi
push eax
push ebx
push 0x22
jmp 0x1013817
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
jne 0x101387f
test byte [0x102407c], 0x10
je 0x1013873
push dword [ebp - 4]
push ebx
push 0x25
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003493
mov dword [ebp - 4], 0x8004021e
jmp 0x10139e1
test ah, 0x40
je 0x10138ad
test byte [0x102407c], 0x10
je 0x10138a1
push ebx
push 0x26
push dword [0x1024074]
push dword [0x1024070]
call fcn.0100335b
mov dword [ebp - 4], 0x80040229
jmp 0x10139e1
xor esi, esi
test ah, 8
je 0x10139af
xor eax, eax
test byte [0x102407c], 0x10
mov dword [ebp - 0x40], esi
lea edi, [ebp - 0x3c]
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
mov dword [ebp - 0x20], esi
stosd dword es:[edi], eax
je 0x10138e4
push ebx
push 0x27
push dword [0x1024074]
push dword [0x1024070]
call fcn.0100335b
push esi
push esi
push 1
push esi
mov dword [ebp - 4], 0x80040228
call dword [sym.imp.KERNEL32.dll_CreateEventW]
cmp eax, esi
mov dword [ebp - 0x30], eax
jne 0x101392a
test byte [0x102407c], 0x10
je 0x10139e1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push ebx
push 0x28
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003493
jmp 0x10139e1
lea eax, [ebp - 0x40]
push eax
lea eax, [ebp - 0x18]
push eax
push esi
push esi
push 2
lea eax, [ebp - 0x20]
push eax
push 0x9c040
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
mov edi, eax
cmp edi, esi
jne 0x1013970
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
jne 0x1013970
push 1
lea eax, [ebp - 0x18]
push eax
lea eax, [ebp - 0x40]
push eax
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_GetOverlappedResult]
mov edi, eax
push dword [ebp - 0x30]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp edi, esi
jne 0x1013992
test byte [0x102407c], 0x10
je 0x10139e1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push ebx
push 0x29
jmp 0x1013914
test byte [0x102407c], 0x10
je 0x10139cf
push ebx
push 0x2a
push dword [0x1024074]
push dword [0x1024070]
call fcn.0100335b
test byte [0x102407c], 0x10
je 0x10139cf
push dword [ebp - 8]
push ebx
push 0x2b
push dword [0x1024074]
push dword [0x1024070]
call fcn.01003493
mov eax, dword [ebp - 0x1c]
mov ecx, dword [ebp - 8]
mov dword [eax], ecx
mov dword [ebp - 4], esi
xor ebx, ebx
cmp dword [ebp - 4], ebx
jge 0x10139f6
cmp dword [ebp - 8], 0xffffffff
je 0x10139f6
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x1c]
or dword [eax], 0xffffffff
xor esi, esi
cmp dword [ebp - 0x10], esi
je 0x1013a07
push esi
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_CryptReleaseContext]
cmp dword [ebp - 0xc], esi
pop edi
pop esi
pop ebx
je 0x1013a18
push dword [ebp - 0xc]
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov eax, dword [ebp - 4]
leave
ret