Function at 0x4165c0
Capabilities:
Inspect section memory permissions

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x44
mov dword [ebp - 0x1c], getsockname
mov eax, dword [ebp + 0xc]
and eax, 1
je 0x4165de
mov dword [ebp - 0x1c], 0x40000000
jmp 0x4165ed
mov ecx, dword [ebp + 0xc]
and ecx, 2
je 0x4165ed
mov dword [ebp - 0x1c], 0xc0000000
mov dword [ebp - 8], 3
mov edx, dword [ebp + 0xc]
and edx, 0x500
cmp edx, 0x500
jne 0x41660e
mov dword [ebp - 8], 1
jmp 0x41664c
mov eax, dword [ebp + 0xc]
and eax, 0x300
cmp eax, 0x300
jne 0x416626
mov dword [ebp - 8], 2
jmp 0x41664c
mov ecx, dword [ebp + 0xc]
and ecx, 0x100
je 0x41663a
mov dword [ebp - 8], 4
jmp 0x41664c
mov edx, dword [ebp + 0xc]
and edx, 0x200
je 0x41664c
mov dword [ebp - 8], 5
mov dword [ebp - 4], 0
mov eax, dword [ebp + 0xc]
and eax, 0x40
je 0x416667
mov ecx, dword [ebp - 4]
or ecx, 0x4000100
mov dword [ebp - 4], ecx
mov edx, dword [ebp + 0xc]
and edx, 0x80000000
je 0x41667d
mov eax, dword [ebp - 4]
or eax, 0x80000000
mov dword [ebp - 4], eax
mov ecx, dword [ebp + 0xc]
and ecx, 0x40000000
je 0x416694
mov edx, dword [ebp - 4]
or edx, 0x40000000
mov dword [ebp - 4], edx
mov eax, dword [ebp + 0xc]
and eax, 0x20000000
je 0x4166aa
mov ecx, dword [ebp - 4]
or ecx, 0x20000000
mov dword [ebp - 4], ecx
mov edx, dword [ebp + 0xc]
and edx, 0x10000000
je 0x4166c0
mov eax, dword [ebp - 4]
or eax, 0x10000000
mov dword [ebp - 4], eax
mov ecx, dword [ebp + 0xc]
and ecx, 0x8000000
je 0x4166d7
mov edx, dword [ebp - 4]
or edx, 0x8000000
mov dword [ebp - 4], edx
mov eax, dword [ebp + 0xc]
and eax, 0x4000000
je 0x4166ed
mov ecx, dword [ebp - 4]
or ecx, 0x4000000
mov dword [ebp - 4], ecx
mov edx, dword [ebp + 0xc]
and edx, 0x2000000
je 0x416703
mov eax, dword [ebp - 4]
or eax, 0x2000000
mov dword [ebp - 4], eax
mov ecx, dword [ebp + 0xc]
and ecx, 0x1000000
je 0x41671a
mov edx, dword [ebp - 4]
or edx, 0x1000000
mov dword [ebp - 4], edx
mov dword [ebp - 0x14], 0
mov eax, dword [ebp + 0xc]
and eax, 8
je 0x416746
mov ecx, 4
imul edx, ecx, 0
mov eax, dword [edx + 0x4cc404]
mov dword [ebp - 0x14], eax
mov ecx, dword [ebp - 0x14]
push ecx
call fcn.00416980
add esp, 4
movzx edx, word [ebp + 0x10]
mov dword [ebp - 0x20], edx
push 0
mov eax, dword [ebp - 4]
push eax
mov ecx, dword [ebp - 8]
push ecx
lea edx, [ebp - 0x44]
push edx
lea eax, [ebp - 0x30]
push eax
mov ecx, dword [ebp + 0x14]
push ecx
call fcn.00408fb0
add esp, 0xc
push eax
mov edx, dword [ebp - 0x20]
push edx
mov eax, dword [ebp - 0x1c]
push eax
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0xc], eax
mov edx, dword [ebp + 0xc]
and edx, 8
je 0x41683a
mov dword [ebp - 0x24], 0
cmp dword [ebp - 0xc], 0xffffffff
je 0x41682e
push 2
lea eax, [ebp - 0x24]
push eax
push 0
mov ecx, dword [ebp - 0xc]
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x41682e
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x41682e
mov edx, dword [ebp - 0x14]
push edx
call fcn.004169a0
add esp, 4
call fcn.00402330
mov dword [ebp - 0x10], eax
mov eax, dword [ebp - 0x10]
sub eax, 3
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], 0x4d
ja case.0x4167ec.1
mov ecx, dword [ebp - 0x10]
movzx edx, byte [ecx + 0x4168c0]
jmp dword [edx*4 + 0x4168ac]
call fcn.00479715
mov dword [eax], 0xc
jmp case.0x4167ec.1
call fcn.00479715
mov dword [eax], 0x11
jmp case.0x4167ec.1
call fcn.00479715
mov dword [eax], 0xd
jmp case.0x4167ec.1
call fcn.00479715
mov dword [eax], 2
or eax, 0xffffffff
jmp 0x4168a8
mov ecx, dword [ebp - 0x14]
push ecx
call fcn.004169a0
add esp, 4
cmp dword [ebp - 0xc], 0xffffffff
jne 0x4168a5
call fcn.00402330
mov dword [ebp - 0x18], eax
mov edx, dword [ebp - 0x18]
sub edx, 3
mov dword [ebp - 0x18], edx
cmp dword [ebp - 0x18], 0x4d
ja case.0x416861.1
mov eax, dword [ebp - 0x18]
movzx ecx, byte [eax + 0x416924]
jmp dword [ecx*4 + 0x416910]
call fcn.00479715
mov dword [eax], 0xc
jmp case.0x416861.1
call fcn.00479715
mov dword [eax], 0x11
jmp case.0x416861.1
call fcn.00479715
mov dword [eax], 0xd
jmp case.0x416861.1
call fcn.00479715
mov dword [eax], 2
mov eax, dword [ebp - 0xc]
jmp 0x4168a8
mov eax, dword [ebp - 0xc]
mov esp, ebp
pop ebp
ret