Function at 0x50d830
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x70
mov eax, dword [0x6480b4]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0x10]
mov ecx, dword [ebp + 0x20]
push esi
push edi
mov edi, dword [ebp + 0x18]
push eax
mov dword [ebp - 0x30], eax
lea eax, [ebp - 0x5c]
mov dword [ebp - 0x50], ecx
xor ecx, ecx
push edi
push eax
mov dword [ebp - 0x28], ecx
call fcn.0050d230
mov dword [ebp - 0x24], eax
add esp, 0xc
movzx eax, word [edi + 6]
mov edx, eax
mov esi, eax
imul edx, dword [ebp + 0x14]
neg esi
and esi, dword [ebp - 0x5c]
cmp dword [0x651b34], 0
mov dword [ebp - 0x48], esi
mov dword [ebp - 0x44], edx
jne 0x50d898
cmp byte [edi + 1], 0
jne 0x50d898
imul eax, eax, 0x7f
cmp esi, eax
cmova esi, eax
mov dword [ebp - 0x48], esi
mov dword [ebp - 0x4c], 3
test esi, esi
je 0x50dbdc
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x40], eax
mov eax, dword [ebp + 8]
push ebx
mov ebx, dword [ebp - 0x58]
mov dword [ebp - 0x3c], eax
xor ecx, ecx
cmp edx, dword [ebp - 0x48]
mov dword [ebp - 0x28], ecx
movzx ecx, word [edi + 6]
cmovb esi, edx
xor edx, edx
mov dword [ebp - 0x34], esi
mov eax, esi
div ecx
cmp dword [0x651b34], 0
mov edx, eax
mov dword [ebp - 0x2c], edx
je 0x50da1e
push dword [ebp - 0x40]
mov eax, ecx
push dword [ebp - 0x3c]
cdq
push edx
push eax
call fcn.0058c440
test byte [ebp + 0x1c], 1
xorps xmm0, xmm0
mov dword [ebp - 0x68], eax
mov eax, dword [ebp - 0x50]
movlpd qword [ebp - 0x70], xmm0
mov dword [ebp - 0x64], edx
mov dword [ebp - 0x60], eax
mov dword [ebp - 0x38], 0
je 0x50d980
test byte [edi + 0x30], 1
je 0x50d924
push esi
push 0
push ebx
call fcn.005c9220
add esp, 0xc
lea eax, [ebp - 0x70]
push eax
lea eax, [ebp - 0x38]
push eax
push esi
push ebx
push dword [edi + 0x24]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x50d968
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
jne 0x50d95f
lea eax, [ebp - 0x38]
push eax
lea eax, [ebp - 0x70]
push eax
push dword [edi + 0x24]
call fcn.0050c6c0
add esp, 0xc
test eax, eax
jne 0x50d968
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [edi + 0x38], eax
mov eax, dword [ebp - 0x24]
test eax, eax
je 0x50d9da
push dword [ebp - 0x38]
push ebx
push dword [ebp - 0x30]
call fcn.005c9900
add esp, 0xc
jmp 0x50d9d7
cmp dword [ebp - 0x24], 0
je 0x50d993
push esi
push dword [ebp - 0x30]
push ebx
call fcn.005c9900
add esp, 0xc
lea eax, [ebp - 0x70]
push eax
lea eax, [ebp - 0x38]
push eax
push esi
push ebx
push dword [edi + 0x24]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x50d9d7
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x3e5
jne 0x50d9ce
lea eax, [ebp - 0x38]
push eax
lea eax, [ebp - 0x70]
push eax
push dword [edi + 0x24]
call fcn.0050c6c0
add esp, 0xc
test eax, eax
jne 0x50d9d7
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [edi + 0x38], eax
mov eax, dword [ebp - 0x24]
cmp dword [ebp - 0x38], esi
jne 0x50d9ef
mov edx, dword [ebp - 0x2c]
mov ecx, 1
mov dword [ebp - 0x28], ecx
jmp 0x50db64
cmp dword [edi + 0x38], 0
jne 0x50db5b
sub dword [ebp - 0x4c], 1
je 0x50da0f
mov edx, dword [ebp - 0x44]
mov ecx, 1
mov dword [ebp - 0x28], ecx
jmp 0x50dbca
mov edx, dword [ebp - 0x2c]
mov dword [edi + 0x38], 0x4d5
jmp 0x50db61
mov al, byte [edi + 1]
cmp al, 0x20
jne 0x50db0a
cmp word [edi + 0x2c], 0
je 0x50db5e
push 0
push 0x4000000
push 0
push 0
push 0
push 0
push 0x5fcfcc
call dword [0x648de0]
mov dword [ebp - 0x34], eax
cmp eax, 0xffffffff
je 0x50db5b
movzx eax, word [edi + 0x2c]
sub eax, 0x41
mov dword [ebp - 0x20], ebx
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x2c]
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0x3c]
mov dword [ebp - 0x1c], eax
mov eax, 2
mov dword [ebp - 8], 1
mov dword [ebp - 0xc], 0
mov dword [ebp - 0x10], 0
test byte [ebp + 0x1c], al
je 0x50dab0
cmp dword [ebp - 0x24], 0
mov eax, 3
mov dword [ebp - 0x54], eax
je 0x50dab0
push esi
push dword [ebp - 0x30]
push ebx
call fcn.005c9900
mov eax, dword [ebp - 0x54]
add esp, 0xc
push 0
lea ecx, [ebp - 0x58]
push ecx
push 0x1c
lea ecx, [ebp - 0x20]
push ecx
push 0x1c
push ecx
push eax
push dword [ebp - 0x34]
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
test eax, eax
je 0x50dadc
test byte [ebp - 8], 1
jne 0x50dadc
mov dword [ebp - 0x28], 1
jmp 0x50dae6
movzx eax, word [ebp - 0x14]
shr eax, 8
mov dword [edi + 0x38], eax
test byte [ebp + 0x1c], 1
je 0x50daff
cmp dword [ebp - 0x24], 0
je 0x50daff
push esi
push ebx
push dword [ebp - 0x30]
call fcn.005c9900
add esp, 0xc
push dword [ebp - 0x34]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x50db5b
test al, al
jne 0x50db5e
test byte [ebp + 0x1c], 2
mov esi, 3
je 0x50db74
cmp dword [ebp - 0x24], 0
je 0x50db31
push dword [ebp - 0x34]
push dword [ebp - 0x30]
push ebx
call fcn.005c9900
mov edx, dword [ebp - 0x2c]
add esp, 0xc
mov al, byte [edi + 0x28]
sub al, 0x80
movzx eax, al
push eax
push edx
push ebx
push dword [ebp - 0x3c]
call dword [0x651b44]
test eax, eax
jne 0x50dba9
mov edx, dword [ebp - 0x2c]
sub esi, 1
jne 0x50db31
mov esi, dword [ebp - 0x34]
mov dword [edi + 0x38], 0xff
mov edx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0x24]
mov ecx, dword [ebp - 0x28]
add dword [ebp - 0x3c], edx
adc dword [ebp - 0x40], 0
test eax, eax
je 0x50dbc0
add dword [ebp - 0x30], esi
jmp 0x50dbc2
mov al, byte [edi + 0x28]
sub al, 0x80
movzx eax, al
push eax
push edx
push ebx
push dword [ebp - 0x3c]
call dword [0x651b40]
test eax, eax
jne 0x50db94
mov edx, dword [ebp - 0x2c]
sub esi, 1
jne 0x50db74
cmp dword [ebp - 0x24], 0
je 0x50dba9
push dword [ebp - 0x34]
push ebx
push dword [ebp - 0x30]
call fcn.005c9900
add esp, 0xc
test esi, esi
je 0x50db51
mov esi, dword [ebp - 0x34]
mov ecx, 1
mov edx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0x24]
mov dword [ebp - 0x28], ecx
jmp 0x50db64
add ebx, esi
mov edx, dword [ebp - 0x44]
sub edx, esi
mov dword [ebp - 0x44], edx
test edx, edx
je 0x50dbd9
mov esi, dword [ebp - 0x48]
test ecx, ecx
jne 0x50d8b7
pop ebx
jmp 0x50dbe1
mov eax, dword [ebp - 0x24]
xor ecx, ecx
pop edi
pop esi
test eax, eax
je 0x50dc04
push dword [0x651b3c]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov eax, dword [ebp - 0x28]
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0058bb64
mov esp, ebp
pop ebp
ret
mov eax, ecx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0058bb64
mov esp, ebp
pop ebp
ret