Function at 0x47b654
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x7c
mov ebx, dword [ebp + 8]
mov dword [ebp - 0x28], 0
cmp byte [ebx + 0x6c], 0
je 0x47b6a4
mov eax, dword [ebx + 0x28]
mov eax, dword [eax + 0xa0]
mov dword [ebp - 0x28], eax
mov dword [ebx + 0x60], eax
mov dword [esp], eax
call fcn.0050963c
mov dword [ebx + 0x30], eax
mov esi, dword [ebx + 0x28]
add esi, 0xa4
mov ecx, dword [ebx + 0x60]
mov edi, eax
rep movsb byte es:[edi], byte [esi]
mov al, 1
add esp, 0x7c
pop ebx
pop esi
pop edi
leave
ret
lea edx, [ebp - 0x4c]
mov ecx, dword [ebp + 0xc]
mov eax, dword [ecx]
call fcn.0047b244
mov byte [ebp - 0x60], al
lea eax, [ebp - 0x19]
mov dword [esp + 8], eax
mov eax, dword [ebx + 8]
mov dword [esp + 4], eax
lea esi, [ebp - 0x2c]
mov dword [esp], esi
call fcn.004da74c
mov dword [esp + 4], str.BLANK.bin
mov dword [esp], esi
call fcn.004b3f40
mov esi, eax
mov eax, dword [ebp - 0x2c]
lea edi, [eax - 0xc]
cmp edi, 0x521134
jne 0x47b9f8
test esi, esi
jne 0x47b760
mov al, byte [ebp - 0x60]
dec eax
cmp al, 1
jbe 0x47b7fc
lea eax, [ebp - 0x1d]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Error_this_CSDB_command_requires_a_payload
lea esi, [ebp - 0x3c]
mov dword [esp], esi
call fcn.004da74c
mov dword [esp], 8
call fcn.0050981c
mov edi, eax
mov dword [esp + 4], esi
mov dword [esp], eax
call fcn.004e7434
mov eax, dword [ebp - 0x3c]
lea esi, [eax - 0xc]
mov edx, 0x521134
cmp edx, esi
jne 0x47bb4c
mov dword [esp + 8], 0x4e75ac
mov dword [esp + 4], 0x536f34
mov dword [esp], edi
call fcn.0050a02c
mov eax, dword [ebx + 8]
mov dword [ebp - 0x60], eax
mov dword [esp + 4], 0x52fe02
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov esi, eax
test eax, eax
je 0x47ba80
mov dword [esp], eax
call sub.msvcrt.dll_rewind
mov dword [esp + 8], 2
mov dword [esp + 4], 0
mov dword [esp], esi
call sub.msvcrt.dll_fseek
mov dword [esp], esi
call sub.msvcrt.dll_ftell
mov edi, eax
mov dword [esp], esi
call sub.msvcrt.dll_rewind
mov dword [ebx + 0x60], edi
test edi, edi
je 0x47b8f8
mov dword [esp], edi
call fcn.0050963c
mov dword [ebx + 0x30], eax
test eax, eax
je 0x47baf4
mov dword [esp + 0xc], esi
mov edx, dword [ebx + 0x60]
mov dword [esp + 8], edx
mov dword [esp + 4], 1
mov dword [esp], eax
call sub.msvcrt.dll_fread
cmp dword [ebx + 0x60], eax
jne 0x47b9a0
mov dword [esp], esi
call sub.msvcrt.dll_fclose
mov eax, dword [ebx + 0x60]
xor esi, esi
cmp eax, 4
ja 0x47b950
add eax, 0xc
cmp eax, 0x20000
jbe 0x47b868
lea eax, [ebp - 0x1f]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Error_CSDB_payload_too_large
lea esi, [ebp - 0x44]
mov dword [esp], esi
call fcn.004da74c
mov dword [esp], 8
call fcn.0050981c
mov edi, eax
mov dword [esp + 4], esi
mov dword [esp], eax
call fcn.004e7434
mov dword [esp], esi
call fcn.004dad88
mov dword [esp + 8], 0x4e75ac
mov dword [esp + 4], 0x536f34
mov dword [esp], edi
call fcn.0050a02c
mov dword [esp], eax
call fcn.0050963c
mov dword [ebp - 0x60], eax
mov dword [eax], 0x42445343
mov byte [eax + 4], 1
lea edx, [ebp - 0x4c]
mov ecx, dword [ebp + 0xc]
mov eax, dword [ecx]
call fcn.0047b244
mov edx, dword [ebp - 0x60]
mov byte [edx + 5], al
mov eax, dword [ebx + 0x60]
add eax, 0xc
mov dword [ebp - 0x28], eax
mov dword [edx + 8], eax
mov eax, edx
add eax, 0xc
mov esi, dword [ebx + 0x30]
mov ecx, dword [ebx + 0x60]
mov edi, eax
rep movsb byte es:[edi], byte [esi]
mov eax, dword [ebx + 0x60]
add eax, 0xc
mov dword [ebx + 0x60], eax
mov dword [esp], eax
call fcn.0050963c
mov dword [ebx + 0x30], eax
test eax, eax
je 0x47b8cd
mov ecx, dword [ebx + 0x60]
mov edi, eax
mov esi, dword [ebp - 0x60]
rep movsb byte es:[edi], byte [esi]
mov edx, dword [ebp - 0x60]
test edx, edx
je 0x47b8df
mov eax, dword [ebp - 0x60]
mov dword [esp], eax
call fcn.00509610
mov dword [esp], ebx
call fcn.00479ed4
test al, al
je 0x47ba2c
mov al, 1
jmp 0x47b699
lea eax, [ebp - 0x1a]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Error_CSDB_payload_size_equals_0
lea edi, [ebp - 0x30]
mov dword [esp], edi
call fcn.004da74c
mov dword [esp], 8
call fcn.0050981c
mov dword [ebp - 0x5c], eax
mov dword [esp + 4], edi
mov dword [esp], eax
call fcn.004e7434
mov dword [esp], edi
call fcn.004dad88
mov dword [esp + 8], 0x4e75ac
mov dword [esp + 4], 0x536f34
mov edx, dword [ebp - 0x5c]
mov dword [esp], edx
call fcn.0050a02c
lea eax, [ebp - 0x1e]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 4
mov eax, dword [ebx + 0x30]
mov dword [esp + 4], eax
lea edi, [ebp - 0x40]
mov dword [esp], edi
call fcn.004da798
mov esi, 1
mov dword [esp + 4], str.CSDB
mov dword [esp], edi
call fcn.004b3f40
mov esi, eax
mov dword [esp], edi
call fcn.004dad88
test esi, esi
je 0x47b8df
mov eax, dword [ebx + 0x60]
jmp 0x47b80a
lea eax, [ebp - 0x1c]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Error_reading_CSDB_from_file
lea edi, [ebp - 0x38]
mov dword [esp], edi
call fcn.004da74c
mov dword [esp], 8
call fcn.0050981c
mov dword [ebp - 0x5c], eax
mov dword [esp + 4], edi
mov dword [esp], eax
call fcn.004e7434
mov dword [esp], edi
call fcn.004dad88
mov dword [esp + 8], 0x4e75ac
mov dword [esp + 4], 0x536f34
mov ecx, dword [ebp - 0x5c]
mov dword [esp], ecx
call fcn.0050a02c
cmp dword [0x51b4e0], 0
jne 0x47bb7e
mov eax, dword [edi + 8]
lea edx, [eax - 1]
mov dword [edi + 8], edx
test eax, eax
jg 0x47b6f1
lea eax, [ebp - 0x21]
mov dword [esp + 4], eax
mov dword [esp], edi
call fcn.004d9148
jmp 0x47b6f1
lea eax, [ebp - 0x20]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Error_restructuring_FUPH
lea esi, [ebp - 0x48]
mov dword [esp], esi
call fcn.004da74c
mov dword [esp], 8
call fcn.0050981c
mov edi, eax
mov dword [esp + 4], esi
mov dword [esp], eax
call fcn.004e7434
mov dword [esp], esi
call fcn.004dad88
mov dword [esp + 8], 0x4e75ac
mov dword [esp + 4], 0x536f34
mov dword [esp], edi
call fcn.0050a02c
lea eax, [ebp - 0x22]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Cannot_Open_File:
lea edx, [ebp - 0x4c]
mov dword [esp], edx
call fcn.004da74c
xor eax, eax
mov ecx, 0xffffffff
mov edi, dword [ebp - 0x60]
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov dword [esp + 8], ecx
mov ecx, dword [ebp - 0x60]
mov dword [esp + 4], ecx
lea eax, [ebp - 0x4c]
mov dword [esp], eax
call fcn.004d957c
mov dword [esp], 8
call fcn.0050981c
mov esi, eax
lea edx, [ebp - 0x4c]
mov dword [esp + 4], edx
mov dword [esp], eax
call fcn.004e7434
mov dword [esp + 8], 0x4e75ac
mov dword [esp + 4], 0x536f34
mov dword [esp], esi
call fcn.0050a02c
lea eax, [ebp - 0x1b]
mov dword [esp + 8], eax
mov dword [esp + 4], str.Error_allocating_CSDB_buffer
lea edi, [ebp - 0x34]
mov dword [esp], edi
call fcn.004da74c
mov dword [esp], 8
call fcn.0050981c
mov dword [ebp - 0x5c], eax
mov dword [esp + 4], edi
mov dword [esp], eax
call fcn.004e7434
mov dword [esp], edi
call fcn.004dad88
mov dword [esp + 8], 0x4e75ac
mov dword [esp + 4], 0x536f34
mov eax, dword [ebp - 0x5c]
mov dword [esp], eax
call fcn.0050a02c
cmp dword [0x51b4e0], 0
jne 0x47bda5
mov eax, dword [esi + 8]
lea edx, [eax - 1]
mov dword [esi + 8], edx
test eax, eax
jg 0x47b748
lea eax, [ebp - 0x23]
mov dword [esp + 4], eax
mov dword [esp], esi
call fcn.004d9148
jmp 0x47b748
mov dword [esp + 4], 0xffffffff
sub eax, 4
mov dword [esp], eax
call fcn.004ae5e4
jmp 0x47ba0e
mov dword [esp + 4], 0xffffffff
sub eax, 4
mov dword [esp], eax
call fcn.004ae5e4
jmp 0x47bb62