Function at 0x40a830
Capabilities:
Get common file path
Get file size
Read file on windows
Read file via mapping

Disassembly:
mov eax, dword [esp + 8]
sub esp, 0x12c
push ebx
push ebp
xor ebx, ebx
push esi
cmp eax, 1
push edi
jne 0x40a888
push 0x14
push ebx
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
cmp esi, ebx
je 0x40a87b
mov eax, dword [esp + 0x140]
mov dword [esi], 1
push eax
mov dword [esi + 4], ebx
mov dword [esi + 8], ebx
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov dword [esi + 0xc], eax
mov dword [esi + 0x10], ebx
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x12c
ret
mov ebp, dword [esp + 0x140]
cmp byte [ebp + 1], 0x3a
jne 0x40a8bb
cmp byte [ebp + 2], 0x5c
jne 0x40a8bb
mov edi, ebp
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0x38]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
jmp 0x40a91d
lea ecx, [esp + 0x38]
push 0x104
push ecx
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
mov edi, 0x4170a0
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0x38]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edi, edx
mov edx, ecx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, edx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
lea edx, [esp + 0x38]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov edi, ebp
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov ebp, ecx
mov edi, edx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebp
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebp
xor ebp, ebp
and ecx, 3
push ebp
push 0x80
push 3
push ebp
push 3
lea eax, [esp + 0x4c]
push SysReAllocStringLen
push eax
rep movsb byte es:[edi], byte [esi]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
je 0x40aace
lea ecx, [esp + 0x14]
mov dword [esp + 0x14], ebp
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
cmp edi, ebp
je 0x40aa13
cmp dword [esp + 0x14], ebp
jne 0x40aa13
cmp dword [esp + 0x144], 2
jne 0x40aa43
lea edx, [esp + 0x24]
push 1
push edx
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
push ebp
push ebp
lea eax, [esp + 0x2c]
push 1
push eax
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
mov edx, dword [esp + 0x14]
push ebp
push edi
push edx
lea eax, [esp + 0x24]
push 2
lea ecx, [esp + 0x34]
push eax
push esi
mov dword [esp + 0x30], 0xc
mov dword [esp + 0x38], ebp
mov dword [esp + 0x34], ecx
call dword [sym.imp.KERNEL32.dll_CreateFileMappingA]
mov ebp, eax
test ebp, ebp
je 0x40aa13
push 0
push 0
push 0
push 4
push ebp
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
test eax, eax
mov dword [esp + 0x10], eax
je 0x40aa3a
push 0x14
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
test ebx, ebx
je 0x40aa2f
mov ecx, dword [esp + 0x10]
mov dword [ebx], 2
mov dword [ebx + 4], esi
mov dword [ebx + 8], ebp
mov dword [ebx + 0xc], ecx
mov dword [ebx + 0x10], edi
test ebx, ebx
jne 0x40aad4
test esi, esi
je 0x40aad4
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
mov eax, ebx
pop ebp
pop ebx
add esp, 0x12c
ret
mov edx, dword [esp + 0x10]
push edx
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40aa13
push edi
push ebp
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebp, eax
test ebp, ebp
je 0x40aa13
push 0
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea eax, [esp + 0x10]
push 0
push eax
push edi
push ebp
push esi
mov dword [esp + 0x24], 0
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40aac3
cmp dword [esp + 0x10], edi
jne 0x40aac3
push 0x14
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
xor eax, eax
cmp ebx, eax
je 0x40aab5
mov ecx, dword [esp + 0x144]
mov dword [ebx + 4], eax
mov dword [ebx], ecx
mov dword [ebx + 8], eax
mov dword [ebx + 0xc], ebp
mov dword [ebx + 0x10], edi
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor esi, esi
jmp 0x40aa0b
call dword [sym.imp.KERNEL32.dll_GetLastError]
jmp 0x40aa13
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop edi
pop esi
mov eax, ebx
pop ebp
pop ebx
add esp, 0x12c
ret