Function at 0x40301b
Capabilities:
Get disk information
Query or enumerate registry value
Set registry value

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x870
mov eax, dword [0x40bccc]
push ebx
mov ebx, dword [ebp + 8]
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0x10]
push esi
mov esi, dword [ebp + 0xc]
push 0x40b2d0
mov dword [ebp - 0x854], ebx
mov dword [ebp - 0x864], eax
mov byte [ebp - 0x845], 1
call fcn.00408097
pop ecx
lea eax, [esi + eax*2 + 0x18]
push eax
call fcn.004040fe
mov dword [ebp - 0x86c], eax
mov eax, dword [esi + 0x6c]
cmp eax, 0xffffffff
je 0x4030bb
lea ecx, [ebp - 0x85c]
push ecx
push 0
push 0x20
lea ecx, [ebp - 0x24]
push ecx
push eax
call sub.MSPORTS.DLL_ComDBGetCurrentPortUsage
mov edx, dword [ebp + 0x14]
mov eax, edx
and eax, 7
je 0x403097
lea ecx, [eax - 1]
mov al, 1
shl al, cl
jmp 0x403099
mov al, 0x80
dec edx
shr edx, 3
test byte [ebp + edx - 0x24], al
je 0x4030bb
push 0x44
push 0x38
push 5
push ebx
call fcn.0040417e
add esp, 0x10
cmp eax, 7
je 0x4033e4
push edi
push 0x50
lea eax, [ebp - 0xd0]
lea edi, [esi + 0x18]
push eax
push edi
mov dword [ebp - 0x858], edi
call dword [sym.imp.KERNEL32.dll_QueryDosDeviceW]
test eax, eax
jne 0x4030e1
mov byte [ebp - 0x845], al
jmp 0x40313c
push 0x4012f4
lea eax, [ebp - 0x2c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
push edi
lea eax, [ebp - 0x2c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcatW]
xor eax, eax
push eax
push 0x80
push 3
push eax
push eax
push 0x80000000
lea eax, [ebp - 0x2c]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
jne 0x403135
push 0x14
push 0x38
push 0x3b
push ebx
call fcn.0040417e
add esp, 0x10
cmp eax, 7
je 0x4033e3
jmp 0x40313c
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp + 0x14]
lea ebx, [esi + 0x40]
push 0x4012c4
push ebx
call dword [sym.imp.USER32.dll_wsprintfW]
push ebx
call fcn.00408097
add esp, 0x10
cmp byte [ebp - 0x845], 0
lea eax, [eax + eax + 2]
mov dword [ebp - 0x860], eax
je 0x4032aa
push 0x50
lea eax, [ebp - 0xd0]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_QueryDosDeviceW]
test eax, eax
jne 0x40319b
push 0x10
push 0x38
push 0x3c
push dword [ebp - 0x854]
call fcn.0040417e
add esp, 0x10
jmp 0x4033e3
push 0
push edi
mov edi, dword [sym.imp.KERNEL32.dll_DefineDosDeviceW]
push 2
call edi
mov dword [ebp - 0x84c], eax
lea eax, [ebp - 0xd0]
push eax
push ebx
push 1
call edi
test eax, eax
jne 0x4031d9
cmp dword [ebp - 0x84c], eax
je 0x403182
lea eax, [ebp - 0xd0]
push eax
push dword [ebp - 0x858]
push 1
call edi
jmp 0x403182
lea eax, [ebp - 0x850]
push eax
push 0xf003f
xor edi, edi
push edi
push str.HardwareDeviceMapSerialComm
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x403298
mov dword [ebp - 0x84c], edi
lea eax, [ebp - 0x868]
push eax
lea eax, [ebp - 0x174]
push eax
lea eax, [ebp - 0x85c]
push eax
push edi
lea eax, [ebp - 0x870]
push eax
lea eax, [ebp - 0x218]
push eax
push dword [ebp - 0x84c]
mov dword [ebp - 0x870], 0x51
push dword [ebp - 0x850]
mov dword [ebp - 0x868], 0xa2
call dword [sym.imp.ADVAPI32.dll_RegEnumValueW]
inc dword [ebp - 0x84c]
cmp eax, edi
jne 0x403298
cmp dword [ebp - 0x85c], 1
jne 0x403206
push dword [ebp - 0x858]
lea eax, [ebp - 0x174]
push eax
call fcn.00407f73
test eax, eax
pop ecx
pop ecx
jne 0x403206
push dword [ebp - 0x860]
lea eax, [ebp - 0x218]
push ebx
push 1
push edi
push eax
push dword [ebp - 0x850]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
push dword [ebp - 0x850]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov edi, dword [ebp - 0x858]
mov eax, dword [esi + 0x6c]
cmp eax, 0xffffffff
je 0x4032cd
push dword [ebp - 0x86c]
push eax
call sub.MSPORTS.DLL_ComDBReleasePort
push 0
push 1
push dword [ebp + 0x14]
push dword [esi + 0x6c]
call sub.MSPORTS.DLL_ComDBClaimPort
push 0x100
lea eax, [ebp - 0x418]
push eax
push 0x1d
push dword [0x40bd20]
call dword [sym.imp.USER32.dll_LoadStringW]
test eax, eax
je 0x40332d
xor eax, eax
push eax
push 0x200
lea ecx, [ebp - 0x618]
push ecx
push eax
push eax
push dword [esi + 0x74]
push dword [esi + 0x70]
call dword [sym.imp.SETUPAPI.dll_SetupDiGetDeviceRegistryPropertyW]
test eax, eax
je 0x40332d
push ebx
lea eax, [ebp - 0x618]
push eax
lea eax, [ebp - 0x418]
push eax
lea eax, [ebp - 0xd0]
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x10
jmp 0x40333b
push ebx
lea eax, [ebp - 0xd0]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
lea eax, [ebp - 0xd0]
push eax
call fcn.00408097
pop ecx
lea eax, [eax + eax + 2]
push eax
lea eax, [ebp - 0xd0]
push eax
push 0xc
push dword [esi + 0x74]
push dword [esi + 0x70]
call dword [sym.imp.SETUPAPI.dll_SetupDiSetDeviceRegistryPropertyW]
push ebx
push edi
push dword [ebp - 0x854]
call dword [sym.imp.USER32.dll_GetParent]
push eax
call fcn.00402e5a
push ebx
push edi
call fcn.00402f5f
push dword [ebp - 0x860]
push ebx
push 1
push 0
push str.PortName
push dword [ebp - 0x864]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
xor eax, eax
mov ecx, 0x8b
lea edi, [ebp - 0x844]
rep stosd dword es:[edi], eax
lea eax, [ebp - 0x844]
push eax
push dword [esi + 0x74]
mov dword [ebp - 0x844], 0x22c
push dword [esi + 0x70]
call dword [sym.imp.SETUPAPI.dll_SetupDiGetDeviceInstallParamsW]
test eax, eax
je 0x4033e3
or byte [ebp - 0x83f], 0x40
lea eax, [ebp - 0x844]
push eax
push dword [esi + 0x74]
push dword [esi + 0x70]
call dword [sym.imp.SETUPAPI.dll_SetupDiSetDeviceInstallParamsW]
pop edi
mov ecx, dword [ebp - 4]
pop esi
pop ebx
call fcn.00407e73
leave
ret 0x10