Function at 0x4204ec
Capabilities:
Check if file exists
Enumerate pe sections
Get file attributes
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffdc
push ebx
push esi
push edi
xor ebx, ebx
mov dword [ebp - 0x24], ebx
mov dword [ebp - 4], ebx
mov dword [ebp - 0x14], ebx
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0xc], ecx
mov dword [ebp - 8], edx
mov byte [ebp - 0xe], al
mov eax, dword [ebp + 8]
xor edx, edx
push ebp
push 0x420771
push dword fs:[edx]
mov dword fs:[edx], esp
xor ebx, ebx
test eax, eax
je 0x420530
cmp dword [eax + 0xa8], 0
jne 0x42071f
lea eax, [ebp - 0x18]
push eax
push 1
mov eax, dword [ebp + 0xc]
mov eax, dword [eax - 4]
mov edx, dword [eax + 0x4c]
mov ecx, 0x7fffffff
mov eax, 0x420790
call fcn.0040a5b8
mov edx, eax
mov eax, dword [ebp + 0xc]
mov eax, dword [eax - 4]
mov eax, dword [eax + 0x4c]
mov ecx, 0x7fffffff
call sub.rtl160.bpl__System__LStrCopy_qqrx27System__AnsiStringT_us_i0__ii
mov edx, 0x4207a0
mov eax, dword [ebp - 0x18]
call fcn.0040a43c
test al, al
jne 0x4205db
lea eax, [ebp - 0x24]
push eax
mov eax, dword [ebp + 0xc]
mov eax, dword [eax - 4]
mov eax, dword [eax + 0x4c]
call sub.rtl160.bpl__System__LStrLen_qqrx27System__AnsiStringT_us_i0__
push eax
mov eax, dword [ebp - 0x18]
call sub.rtl160.bpl__System__LStrLen_qqrx27System__AnsiStringT_us_i0__
pop ecx
sub ecx, eax
mov eax, dword [ebp + 0xc]
mov eax, dword [eax - 4]
mov eax, dword [eax + 0x4c]
mov edx, 1
call sub.rtl160.bpl__System__LStrCopy_qqrx27System__AnsiStringT_us_i0__ii
mov edx, dword [ebp - 0x24]
lea eax, [ebp - 0x14]
mov ecx, 0x4207a0
call sub.rtl160.bpl__System__LStrCat3_qqrr27System__AnsiStringT_us_i0__x27System__AnsiStringT_us_i0__t2
mov eax, dword [ebp - 0x14]
call sub.rtl160.bpl__System__LStrToPChar_qqrx27System__AnsiStringT_us_i0__
push eax
call sub.kernel32.dll_GetFileAttributesA
cmp eax, 0xffffffff
jne 0x4205ec
lea eax, [ebp - 0x14]
mov edx, dword [ebp + 0xc]
mov edx, dword [edx - 4]
mov edx, dword [edx + 0x4c]
call sub.rtl160.bpl__System__LStrLAsg_qqrr27System__AnsiStringT_us_i0__x27System__AnsiStringT_us_i0__
jmp 0x4205ec
lea eax, [ebp - 0x14]
mov edx, dword [ebp + 0xc]
mov edx, dword [edx - 4]
mov edx, dword [edx + 0x4c]
call sub.rtl160.bpl__System__LStrLAsg_qqrr27System__AnsiStringT_us_i0__x27System__AnsiStringT_us_i0__
mov eax, dword [ebp - 0x14]
call sub.rtl160.bpl__System__LStrToPChar_qqrx27System__AnsiStringT_us_i0__
mov esi, eax
push esi
call sub.kernel32.dll_GetFileAttributesA
cmp eax, 0xffffffff
je 0x420740
mov eax, dword [ebp - 0x14]
call fcn.0042033c
test al, al
jne 0x420740
push 0
push 0
push 3
push 0
push 3
push 0x80000000
push esi
call sub.kernel32.dll_CreateFileA
mov esi, eax
cmp esi, 0xffffffff
je 0x420740
push 0
push 0
push 0
push 2
push 0
push esi
call sub.kernel32.dll_CreateFileMappingW
mov edi, eax
test edi, edi
je 0x420717
push 0
push 0
push 0
push 4
push edi
call sub.kernel32.dll_MapViewOfFile
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
je 0x420711
mov eax, dword [ebp - 0x20]
call fcn.0040ec18
test eax, eax
je 0x4206fc
mov edx, eax
add edx, 0xf8
mov dword [ebp - 0x1c], edx
add dword [ebp - 0x1c], 0x28
mov edx, dword [ebp - 0x1c]
test byte [edx + 0x24], 0x20
je 0x4206b1
mov dword [ebp - 8], 3
mov edx, dword [ebp - 0x1c]
mov edx, dword [edx + 0xc]
mov dword [ebp - 0xc], edx
sub dword [ebp - 0x1c], 0x28
mov edx, dword [ebp - 0x1c]
mov edx, dword [edx + 0xc]
sub dword [ebp - 0xc], edx
jmp 0x4206b5
sub dword [ebp - 0x1c], 0x28
movzx edx, word [eax + 6]
dec edx
add edx, edx
add edx, edx
add edx, edx
lea edx, [edx + edx*4]
add dword [ebp - 0x1c], edx
mov edx, dword [ebp - 0x1c]
cmp dword [edx + 0x14], 0
je 0x420708
mov edx, dword [ebp - 0x1c]
mov edx, dword [edx + 0xc]
cmp edx, dword [eax + 0xa8]
jne 0x420708
mov ecx, dword [ebp - 0x1c]
mov ecx, dword [ecx + 0x14]
mov eax, dword [ebp - 0x20]
add ecx, eax
mov edx, ecx
push ebp
mov edx, dword [edx + 0x18]
add edx, eax
mov eax, edx
call fcn.00420194
pop ecx
mov ebx, eax
jmp 0x420708
push ebp
mov eax, dword [ebp - 0x20]
call fcn.00420194
pop ecx
mov ebx, eax
mov eax, dword [ebp - 0x20]
push eax
call sub.kernel32.dll_UnmapViewOfFile
push edi
call sub.kernel32.dll_CloseHandle
push esi
call sub.kernel32.dll_CloseHandle
jmp 0x420740
mov ecx, dword [ebp + 0xc]
mov ecx, dword [ecx - 4]
mov ecx, dword [ecx + 0x38]
mov ebx, ecx
add ebx, dword [eax + 0xa8]
mov edx, ebx
push ebp
mov eax, ecx
add eax, dword [edx + 0x14]
call fcn.00420194
pop ecx
mov ebx, eax
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x420778
lea eax, [ebp - 0x24]
call sub.rtl160.bpl__System__LStrClr_qqrpv
lea eax, [ebp - 0x18]
mov edx, 2
call sub.rtl160.bpl__System__LStrArrayClr_qqrpvi
lea eax, [ebp - 4]
mov edx, dword [0x41d1dc]
call sub.rtl160.bpl__System__DynArrayClear_qqrrpvpv
ret