Function at 0x1005a840
Capabilities:
Read file on windows
Read pipe
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov eax, 0x1001c
call fcn.1013e300
mov eax, dword [0x101f6e00]
xor eax, esp
mov dword [esp + 0x10018], eax
mov eax, dword [ebp + 8]
push ebx
push esi
push edi
mov edi, ecx
mov dword [esp + 0xc], eax
mov eax, dword [edi + 4]
cmp eax, 3
je 0x1005a87b
cmp eax, 1
jne 0x1005ad70
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov esi, dword [edi]
test esi, esi
je 0x1005ace8
mov eax, dword [esi + 4]
cmp eax, 0xffffffff
je 0x1005acfc
push 0
lea ecx, [esp + 0x20]
mov dword [esp + 0x20], 0
push ecx
push 0
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_PeekNamedPipe]
test eax, eax
je 0x1005acd7
cmp dword [esp + 0x1c], 8
jb 0x1005acfc
push 0
lea eax, [esp + 0x18]
mov dword [esp + 0x18], 0
push eax
push 8
lea eax, [esp + 0x2c]
push eax
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_ReadFile]
cmp eax, 1
jne 0x1005acd7
cmp dword [esp + 0x14], 8
je 0x1005a909
push 0x74
push 0x101d6560
push str.bytesToRead__bytesRead
call fcn.101598d0
add esp, 0xc
mov esi, dword [esp + 0x24]
test esi, esi
je 0x1005a9ad
mov ebx, dword [edi]
test ebx, ebx
je 0x1005aa74
mov eax, dword [ebx + 4]
cmp eax, 0xffffffff
je 0x1005aa88
push 0
lea ecx, [esp + 0x1c]
mov dword [esp + 0x1c], 0
push ecx
push 0
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_PeekNamedPipe]
test eax, eax
je 0x1005aa5e
cmp dword [esp + 0x18], esi
jb 0x1005aa88
push 0
lea eax, [esp + 0x18]
mov dword [esp + 0x18], 0
push eax
push esi
lea eax, [esp + 0x34]
push eax
push dword [ebx + 4]
call dword [sym.imp.KERNEL32.dll_ReadFile]
cmp eax, 1
jne 0x1005aa5e
cmp esi, dword [esp + 0x14]
je 0x1005a99a
push 0x74
push 0x101d6560
push str.bytesToRead__bytesRead
call fcn.101598d0
add esp, 0xc
mov eax, dword [esp + 0x24]
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov byte [esp + eax + 0x28], 0
mov esi, dword [esp + 0x24]
mov eax, dword [esp + 0x20]
cmp eax, 4
ja case.0x1005a9ba.0
jmp dword [eax*4 + 0x1005ad8c]
mov dword [esp + 0x20], 4
add esi, 8
je case.0x1005a9ba.4
mov eax, dword [edi]
test eax, eax
jne 0x1005a9ee
push 0x4f
push 0x101d6560
push str.self
call fcn.101598d0
add esp, 0xc
jmp 0x1005aa21
mov eax, dword [eax + 4]
cmp eax, 0xffffffff
je 0x1005aa21
push 0
lea ecx, [esp + 0x14]
mov dword [esp + 0x14], 0
push ecx
push esi
lea ecx, [esp + 0x2c]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
cmp eax, 1
jne 0x1005aa21
cmp dword [esp + 0x10], esi
je case.0x1005a9ba.4
mov ecx, dword [edi + 0xc]
test ecx, ecx
je 0x1005aa41
mov eax, dword [edi + 4]
cmp eax, 3
je 0x1005aa35
cmp eax, 1
jne 0x1005aa41
lea eax, [edi + 0x54]
push eax
push dword [edi + 0x50]
call ecx
add esp, 8
mov esi, dword [edi]
push dword [esi + 4]
call ebx
mov dword [esi + 4], 0xffffffff
mov byte [esi], 0
mov dword [edi + 4], 0
jmp case.0x1005a9ba.4
push dword [ebx + 4]
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
call eax
mov dword [ebx + 4], 0xffffffff
mov byte [ebx], 0
jmp 0x1005aa88
push 0x67
push 0x101d6560
push str.self
call fcn.101598d0
add esp, 0xc
lea ebx, [edi + 0x54]
mov dword [edi + 0x50], 2
mov ecx, str.Partial_data_in_frame
mov esi, 1
mov edx, ebx
sub esi, ecx
lea eax, [esi + ecx]
cmp eax, 0x100
jae 0x1005aab5
mov al, byte [ecx]
inc ecx
mov byte [edx], al
inc edx
cmp byte [ecx], 0
jne 0x1005aaa0
mov byte [edx], 0
mov ecx, dword [edi + 0xc]
test ecx, ecx
je 0x1005aad5
mov eax, dword [edi + 4]
cmp eax, 3
je 0x1005aacc
cmp eax, 1
jne 0x1005aad5
push ebx
push dword [edi + 0x50]
call ecx
add esp, 8
mov esi, dword [edi]
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x1005ad5f
mov esi, dword [esp + 0xc]
lea eax, [esp + 0x28]
push eax
mov ecx, esi
call fcn.1005ada0
test esi, esi
je 0x1005ab80
push str.code
lea eax, [esp + 0x14]
mov ecx, esi
push eax
call fcn.10059a00
cmp word [esi + 0xe], 3
lea ebx, [esi + 0xe]
je 0x1005ab2f
push 0x4e1
push 0x101d6aa8
push str.IsObject__
call fcn.101598d0
add esp, 0xc
mov eax, dword [esi]
lea ecx, [esi + 8]
mov esi, dword [esp + 0x10]
shl eax, 5
add eax, dword [ecx]
mov dword [esp + 0x18], ecx
cmp esi, eax
je 0x1005ab7c
mov al, byte [esi + 0x1e]
shr al, 5
test al, 1
je 0x1005ab7c
test byte [esi + 0x1e], 0x20
jne 0x1005ab6c
push 0x718
push 0x101d6aa8
push str.data_.f.flags__kIntFlag
call fcn.101598d0
add esp, 0xc
mov eax, dword [esi + 0x10]
mov esi, dword [esp + 0x18]
mov ecx, dword [esp + 0xc]
mov dword [edi + 0x50], eax
jmp 0x1005ab99
mov esi, dword [esp + 0xc]
mov ecx, dword [esp + 0xc]
lea ebx, [esi + 0xe]
add esi, 8
mov dword [edi + 0x50], 0
test ecx, ecx
je 0x1005ac21
push str.message
lea eax, [esp + 0x14]
push eax
call fcn.10059a00
cmp word [ebx], 3
je 0x1005abc5
push 0x4e1
push 0x101d6aa8
push str.IsObject__
call fcn.101598d0
add esp, 0xc
mov eax, dword [esp + 0xc]
mov ecx, dword [eax]
mov eax, dword [esp + 0x10]
shl ecx, 5
add ecx, dword [esi]
cmp eax, ecx
je 0x1005ac21
mov cx, word [eax + 0x1e]
shr cx, 0xa
test cl, 1
je 0x1005ac21
lea esi, [eax + 0x10]
mov ax, word [esi + 0xe]
shr ax, 0xa
test al, 1
jne 0x1005ac0b
push 0x73c
push 0x101d6aa8
push str.IsString__
call fcn.101598d0
add esp, 0xc
mov eax, 0x1000
test word [esi + 0xe], ax
jne 0x1005ac19
mov esi, dword [esi + 8]
mov eax, esi
test esi, esi
je 0x1005ac58
jmp 0x1005ac28
mov eax, 0x101d47e8
mov esi, eax
cmp byte [eax], 0
lea ecx, [edi + 0x54]
je 0x1005ac55
mov edx, 1
sub edx, eax
nop word [eax + eax]
lea eax, [edx + esi]
cmp eax, 0x100
jae 0x1005ac55
mov al, byte [esi]
inc esi
mov byte [ecx], al
inc ecx
cmp byte [esi], 0
jne 0x1005ac40
mov byte [ecx], 0
mov ecx, dword [edi + 0xc]
test ecx, ecx
je 0x1005aad5
mov eax, dword [edi + 4]
cmp eax, 3
je 0x1005ac74
cmp eax, 1
jne 0x1005aad5
lea eax, [edi + 0x54]
push eax
jmp 0x1005aacd
mov ecx, dword [esp + 0xc]
lea eax, [esp + 0x28]
push eax
call fcn.1005ada0
mov al, 1
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x10018]
xor ecx, esp
call fcn.1013c8c0
mov esp, ebp
pop ebp
ret 4
mov ecx, str.Bad_ipc_frame
mov dword [edi + 0x50], 2
mov esi, 1
lea edx, [edi + 0x54]
sub esi, ecx
nop word [eax + eax]
lea eax, [esi + ecx]
cmp eax, 0x100
jae 0x1005ad35
mov al, byte [ecx]
inc ecx
mov byte [edx], al
inc edx
cmp byte [ecx], 0
jne 0x1005acc0
jmp 0x1005ad35
push dword [esi + 4]
call ebx
mov dword [esi + 4], 0xffffffff
mov byte [esi], 0
jmp 0x1005acfc
push 0x67
push 0x101d6560
push str.self
call fcn.101598d0
add esp, 0xc
mov eax, dword [edi]
cmp byte [eax], 0
jne 0x1005ad70
mov ecx, str.Pipe_closed
mov dword [edi + 0x50], 1
mov esi, 1
lea edx, [edi + 0x54]
sub esi, ecx
nop dword [eax]
lea eax, [esi + ecx]
cmp eax, 0x100
jae 0x1005ad35
mov al, byte [ecx]
inc ecx
mov byte [edx], al
inc edx
cmp byte [ecx], 0
jne 0x1005ad20
mov byte [edx], 0
mov ecx, dword [edi + 0xc]
test ecx, ecx
je 0x1005ad58
mov eax, dword [edi + 4]
cmp eax, 3
je 0x1005ad4c
cmp eax, 1
jne 0x1005ad58
lea eax, [edi + 0x54]
push eax
push dword [edi + 0x50]
call ecx
add esp, 8
mov esi, dword [edi]
push dword [esi + 4]
call ebx
mov dword [esi + 4], 0xffffffff
mov byte [esi], 0
mov dword [edi + 4], 0
mov ecx, dword [esp + 0x10024]
xor al, al
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.1013c8c0
mov esp, ebp
pop ebp
ret 4