Function at 0x101812f0
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x4c
push ebx
push esi
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__get_osfhandle]
add esp, 4
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x30], 0
mov dword [ebp - 0x24], 0
mov ecx, dword [ebp - 0x34]
push ecx
call fcn.10186ef0
add esp, 4
test eax, eax
je 0x10181345
push 0
mov edx, dword [ebp + 0x10]
push edx
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
call sym.ruby.dll__rb_w32_recv_16
jmp 0x101817bc
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__get_osfhandle]
add esp, 4
cmp eax, 0xffffffff
jne 0x1018135f
or eax, 0xffffffff
jmp 0x101817bc
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
movzx ecx, byte [eax + 0x28]
and ecx, 0x80
je 0x10181391
mov edx, dword [ebp + 0x10]
push edx
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__read]
add esp, 0xc
jmp 0x101817bc
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp dword [ebp + 0x10], 0
je 0x101813bf
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
movzx ecx, byte [eax + 0x28]
and ecx, 2
je 0x101813fb
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
movzx ebx, byte [eax + 0x28]
and ebx, 0xfffffffd
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
mov byte [eax + 0x28], bl
mov ecx, dword [ebp + 8]
push ecx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
xor eax, eax
jmp 0x101817bc
mov dword [ebp - 0x18], 0
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
mov eax, dword [eax + 0x18]
push eax
call fcn.10186f20
add esp, 4
test eax, eax
je 0x10181442
cmp dword [0x1026cdac], 6
jb 0x10181439
cmp dword [0x1026cdac], 6
jne 0x10181442
cmp dword [0x1026cdb0], 2
jae 0x10181442
mov dword [ebp - 0x1c], 1
jmp 0x10181449
mov dword [ebp - 0x1c], 0
mov ecx, dword [ebp - 0x1c]
mov dword [ebp - 0x14], ecx
cmp dword [ebp - 0x14], 0
je 0x1018148d
lea edx, [ebp - 0x38]
push edx
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
mov ecx, dword [eax + 0x18]
push ecx
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
mov edx, dword [ebp - 0x38]
and edx, 2
je 0x10181480
mov dword [ebp - 0x20], 1
jmp 0x10181487
mov dword [ebp - 0x20], 0
mov eax, dword [ebp - 0x20]
mov dword [ebp - 0x30], eax
cmp dword [ebp - 0x14], 0
je 0x101814ca
mov ecx, dword [ebp + 8]
push ecx
call fcn.10186ec0
add esp, 4
mov edx, dword [eax + 0x18]
push edx
call fcn.10189730
add esp, 4
cmp dword [ebp - 0x24], 0
je 0x101814ba
mov dword [ebp - 8], 1
jmp 0x101814c8
mov dword [ebp - 8], 0
mov dword [ebp - 0x24], 1
jmp 0x101814d0
mov eax, dword [ebp + 0x10]
mov dword [ebp - 8], eax
mov ecx, dword [ebp + 0x10]
sub ecx, dword [ebp - 8]
mov dword [ebp + 0x10], ecx
cmp dword [0x1026cda4], 0
je 0x10181517
mov edx, dword [ebp + 8]
push edx
lea eax, [ebp - 0x4c]
push eax
call fcn.1018a160
add esp, 8
test eax, eax
je 0x10181511
mov ecx, dword [ebp + 8]
push ecx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
or eax, 0xffffffff
jmp 0x101817bc
lea edx, [ebp - 0x4c]
mov dword [ebp - 0x10], edx
mov eax, dword [ebp - 0x10]
push eax
lea ecx, [ebp - 0xc]
push ecx
mov edx, dword [ebp - 8]
push edx
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
call fcn.10186ec0
add esp, 4
mov edx, dword [eax + 0x18]
push edx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x101816f9
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0x3e5
je 0x101815d4
cmp dword [ebp - 0x10], 0
je 0x10181567
mov eax, dword [ebp - 0x3c]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 4], 5
jne 0x1018157b
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 9
jmp 0x101815b9
cmp dword [ebp - 4], 0x6d
je 0x10181587
cmp dword [ebp - 4], 0x26
jne 0x101815a3
mov ecx, dword [ebp + 8]
push ecx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
xor eax, eax
jmp 0x101817bc
mov edx, dword [ebp - 4]
push edx
call sym.ruby.dll_rb_w32_map_errno
add esp, 4
mov esi, eax
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], esi
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
or eax, 0xffffffff
jmp 0x101817bc
cmp dword [ebp - 0x10], 0
je 0x101816f7
push 0xffffffffffffffff
push 1
lea ecx, [ebp - 0x3c]
push ecx
call sym.ruby.dll_rb_w32_wait_events_blocking
add esp, 0xc
mov dword [ebp - 0x28], eax
cmp dword [ebp - 0x28], 0
je 0x1018165f
cmp dword [ebp - 0x28], 1
jne 0x1018160b
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 4
jmp 0x10181624
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call sym.ruby.dll_rb_w32_map_errno
add esp, 4
mov esi, eax
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], esi
mov edx, dword [ebp - 0x3c]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
mov ecx, dword [eax + 0x18]
push ecx
call dword [0x1026cda4]
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
or eax, 0xffffffff
jmp 0x101817bc
push 1
lea eax, [ebp - 0xc]
push eax
lea ecx, [ebp - 0x4c]
push ecx
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
mov eax, dword [eax + 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_GetOverlappedResult]
test eax, eax
jne 0x101816f7
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0x26
je 0x101816f7
mov dword [ebp - 0x2c], 0
cmp dword [ebp - 4], 0x6d
je 0x101816bc
mov ecx, dword [ebp - 4]
push ecx
call sym.ruby.dll_rb_w32_map_errno
add esp, 4
mov esi, eax
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], esi
mov dword [ebp - 0x2c], 0xffffffff
mov edx, dword [ebp - 0x3c]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
mov ecx, dword [eax + 0x18]
push ecx
call dword [0x1026cda4]
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebp - 0x2c]
jmp 0x101817bc
jmp 0x10181718
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 4], eax
mov eax, dword [ebp - 4]
push eax
call sym.ruby.dll_rb_w32_map_errno
add esp, 4
mov esi, eax
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], esi
cmp dword [ebp - 0x10], 0
je 0x10181732
mov ecx, dword [ebp - 0xc]
push ecx
mov edx, dword [ebp + 8]
push edx
lea eax, [ebp - 0x4c]
push eax
call fcn.1018a270
add esp, 0xc
mov ecx, dword [ebp - 0x18]
add ecx, dword [ebp - 0xc]
mov dword [ebp - 0x18], ecx
mov edx, dword [ebp - 0xc]
cmp edx, dword [ebp - 8]
jb 0x1018177e
mov eax, dword [ebp + 0xc]
add eax, dword [ebp - 0xc]
mov dword [ebp + 0xc], eax
cmp dword [ebp - 4], 0x3e3
je 0x1018177e
cmp dword [ebp - 0x14], 0
je 0x10181773
cmp dword [ebp - 8], 1
jne 0x10181773
cmp dword [ebp - 0x30], 0
je 0x1018177e
mov ecx, dword [ebp + 0xc]
movsx edx, byte [ecx - 1]
cmp edx, 0xa
je 0x1018177e
cmp dword [ebp + 0x10], 0
jbe 0x1018177e
jmp 0x1018148d
cmp dword [ebp - 0xc], 0
jne 0x101817a6
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
movzx ebx, byte [eax + 0x28]
or ebx, 2
mov ecx, dword [ebp + 8]
push ecx
call fcn.10186ec0
add esp, 4
mov byte [eax + 0x28], bl
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebp - 0x18]
pop esi
pop ebx
mov esp, ebp
pop ebp
ret