Function at 0x59805424
Capabilities:
Check os version
Get file size
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffc4
push ebx
push esi
push edi
xor edx, edx
mov dword [ebp - 0x3c], edx
mov dword [ebp - 0x38], edx
mov dword [ebp - 4], edx
mov ebx, eax
lea eax, [ebp - 0x18]
mov edx, dword [sym.madExcept_.bpl___xp_21Madmapfile_TMfSegment]
call sub.rtl120.bpl__System__InitializeRecord_qqrpvt1
xor eax, eax
push ebp
push 0x598057fb
push dword fs:[eax]
mov dword fs:[eax], esp
mov byte [ebp - 0x19], 0
call sub.kernel32.dll_GetVersion
test eax, 0x80000000
jne 0x59805486
push 0
push 0
push 3
push 0
push 1
push 0x80000000
mov eax, ebx
call sub.rtl120.bpl__System__UStrToPWChar_qqrx20System_UnicodeString
push eax
call sub.kernel32.dll_CreateFileW
mov ebx, eax
jmp 0x598054b4
push 0
push 0
push 3
push 0
push 1
push 0x80000000
lea eax, [ebp - 0x38]
mov edx, ebx
mov ecx, 0
call sub.rtl120.bpl__System__LStrFromUStr_qqrr27System__AnsiStringT_us_i0__x20System_UnicodeStringus
mov eax, dword [ebp - 0x38]
call sub.rtl120.bpl__System__LStrToPChar_qqrx27System__AnsiStringT_us_i0__
push eax
call sub.kernel32.dll_CreateFileA
mov ebx, eax
cmp ebx, 0xffffffff
je 0x598057c7
push 0
push 0
push 0
push 2
push 0
push ebx
call sub.kernel32.dll_CreateFileMappingW
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
je 0x598057c1
push 0
push 0
push 0
push 4
mov eax, dword [ebp - 0x20]
push eax
call sub.kernel32.dll_MapViewOfFile
mov esi, eax
test esi, esi
je 0x598057b8
push 0
push ebx
call sub.kernel32.dll_GetFileSize
cmp eax, 0x22
jbe 0x5980551f
push 0
push ebx
call sub.kernel32.dll_GetFileSize
and eax, 3
test eax, eax
jne 0x5980551f
cmp dword [esi], 0x4742444a
jne 0x5980551f
cmp byte [esi + 4], 1
je 0x59805523
xor eax, eax
jmp 0x59805525
mov al, 1
mov byte [ebp - 0x19], al
cmp byte [ebp - 0x19], 0
je 0x59805577
cmp byte [esi + 0x21], 0
je 0x59805577
mov eax, dword [esi + 0x1d]
neg eax
mov dword [ebp - 0x24], eax
mov edi, esi
push 0
push ebx
call sub.kernel32.dll_GetFileSize
shr eax, 2
test eax, eax
jle 0x59805562
mov dword [ebp - 0x28], 1
mov edx, dword [edi]
add dword [ebp - 0x24], edx
add edi, 4
inc dword [ebp - 0x28]
dec eax
jne 0x59805554
mov eax, dword [ebp - 0x24]
shr eax, 8
mov edx, dword [ebp - 0x24]
shl edx, 0x18
or eax, edx
cmp eax, dword [esi + 0x1d]
sete byte [ebp - 0x19]
cmp byte [ebp - 0x19], 0
je 0x598057b2
mov eax, esi
add eax, dword [esi + 9]
mov dword [ebp - 0x2c], eax
xor eax, eax
mov dword [ebp - 0x30], eax
xor eax, eax
mov dword [ebp - 0x34], eax
jmp 0x598055fe
mov eax, dword [ebp - 0x28]
add dword [ebp - 0x30], eax
lea edx, [ebp - 0x28]
lea eax, [ebp - 0x2c]
call fcn.598053f0
mov eax, dword [ebp - 0x28]
add dword [ebp - 0x34], eax
lea ecx, [ebp - 4]
mov eax, esi
mov edx, dword [ebp - 0x34]
call fcn.59805388
push 1
mov edi, dword [sym.imp.madBasic_.bpl__Madstrings_PosStrW]
mov edi, dword [edi]
mov ecx, 0x7fffffff
mov edx, dword [ebp - 4]
mov eax, 0x5980581c
call edi
mov ecx, eax
lea eax, [ebp - 4]
mov edx, 1
call sub.rtl120.bpl__System__UStrDelete_qqrr20System_UnicodeStringii
mov eax, dword [ebp - 0x30]
push eax
push 1
mov eax, dword [ebp - 4]
push eax
push 0
push 0
mov eax, dword [ebp + 8]
mov eax, dword [eax - 4]
mov cl, 1
mov dl, 1
call sym.madExcept_.bpl__Madmapfile_TMapFile_Segment_NewItem_qqroouiui20System_UnicodeStringoo
lea edx, [ebp - 0x28]
lea eax, [ebp - 0x2c]
call fcn.598053f0
test al, al
jne 0x59805595
mov eax, dword [ebp + 8]
mov eax, dword [eax - 4]
mov eax, dword [eax + 0xc]
test eax, eax
jle 0x59805671
mov edx, dword [ebp + 8]
push edx
mov edx, dword [ebp + 8]
mov edx, eax
dec edx
xor eax, eax
call fcn.598046e8
pop ecx
mov eax, dword [ebp + 8]
push eax
xor eax, eax
call fcn.5980495c
pop ecx
mov eax, dword [ebp + 8]
mov eax, dword [eax - 4]
mov eax, dword [eax + 0x44]
test eax, eax
jbe 0x59805671
mov edx, dword [ebp + 8]
mov edx, dword [edx - 4]
mov edx, dword [edx + 0xc]
lea edx, [edx + edx*4]
mov ecx, dword [ebp + 8]
mov ecx, dword [ecx - 4]
mov ecx, dword [ecx + 8]
mov edi, dword [ebp + 8]
sub eax, dword [ecx + edx*4 - 0x10]
mov ecx, dword [ebp + 8]
mov ecx, dword [ebp + 8]
mov ecx, dword [ecx - 4]
mov ecx, dword [ecx + 8]
mov dword [ecx + edx*4 - 0xc], eax
xor eax, eax
mov dword [ebp - 0x30], eax
xor eax, eax
mov dword [ebp - 0x34], eax
xor edi, edi
mov eax, esi
add eax, dword [esi + 0xd]
mov dword [ebp - 0x2c], eax
jmp 0x59805749
mov byte [edx + 2], bl
cmp edi, 2
je 0x598057e0
movzx ebx, byte [ecx + 3]
mov byte [edx + 3], bl
cmp edi, 3
je 0x598057e0
movzx ebx, byte [ecx + 4]
mov byte [edx + 4], bl
cmp edi, 4
je 0x598057e0
movzx ebx, byte [ecx + 5]
mov byte [edx + 5], bl
cmp edi, 5
je 0x598057e0
movzx ebx, byte [ecx + 6]
mov byte [edx + 6], bl
cmp edi, 6
je 0x598057e0
movzx ebx, byte [ecx + 7]
mov byte [edx + 7], bl
cmp edi, 7
je 0x598057e0
movzx ebx, byte [ecx + 8]
mov byte [edx + 8], bl
cmp edi, 8
je 0x598057e0
movzx ebx, byte [ecx + 9]
mov byte [edx + 9], bl
cmp edi, 9
je 0x598057e0
movzx ebx, byte [ecx + 0xa]
mov byte [edx + 0xa], bl
cmp edi, 0xa
je 0x598057e0
or dh, byte [ebx + ebp + 0xf]
mov dh, 0x59
movzx ebx, byte [ecx + 0xb]
mov byte [edx + 0xb], bl
cmp edi, 0xb
je 0x598057e0
or ecx, dword [eax - 0x7cf4a6]
or esi, dword [edi + ebx + 0xf]
mov dh, 0x59
or al, 0x88
pop edx
movzx ebx, byte [ecx + 0xc]
mov byte [edx + 0xc], bl
cmp edi, 0xc
je 0x598057e0
or al, 0x83
dec dword [esp + esi*2]
adc ecx, dword [edi]
mov dh, 0x59
or eax, 0x830d5a88
dec dword [0xb60f0774]
dec ecx
push cs
movzx ebx, byte [ecx + 0xd]
mov byte [edx + 0xd], bl
cmp edi, 0xd
je 0x598057e0
movzx ecx, byte [ecx + 0xe]
mov byte [edx + 0xe], cl
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret