Function at 0x406c50
Capabilities:
Get disk size
Get storage device properties

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc4
mov eax, dword [section..data]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
lea eax, [ebp - 0xb8]
mov dword [ebp - 0xc4], edx
push eax
push ecx
mov dword [ebp - 0xc0], ecx
or ebx, 0xffffffff
call fcn.00406a20
add esp, 8
test eax, eax
jne 0x407096
mov esi, dword [ebp - 0xb8]
push esi
push str.Current_phy_disk_count:_d
call fcn.004044f0
add esp, 8
test esi, esi
jle 0x4070a3
xor ecx, ecx
mov eax, esi
mov edx, 0x218
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0040b401
mov edi, eax
add esp, 4
mov dword [ebp - 0xbc], edi
test edi, edi
jne 0x406cda
push str.Failed_to_alloc
jmp 0x40709b
imul eax, esi, 0x218
push eax
push 0
push edi
call fcn.004126f0
xor ecx, ecx
add esp, 0xc
mov dword [ebp - 0xb4], ecx
test esi, esi
jle 0x406fee
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
lea eax, [edi + 8]
mov edi, dword [sym.imp.KERNEL32.dll_DeviceIoControl]
mov dword [ebp - 0xb0], eax
cmp ebx, 0xffffffff
je 0x406d23
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0xb4]
push ecx
push str..PhysicalDrive_d
lea eax, [ebp - 0x88]
push 0x80
push eax
call fcn.0040b3ad
add esp, 0x10
lea eax, [ebp - 0x88]
push 0
push 0
push 3
push 0
push 1
push 0x80000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
call esi
push eax
lea eax, [ebp - 0x88]
push eax
push ebx
push str.Create_file_Handle:_p__s_status:_u
call fcn.004044f0
add esp, 0x10
cmp ebx, 0xffffffff
je 0x406fcb
push 0
lea eax, [ebp - 0x8c]
push eax
push 8
lea eax, [ebp - 0x98]
push eax
push 0
push 0
push 0x7405c
push ebx
call edi
test eax, eax
jne 0x406db3
call esi
push eax
push str.DeviceIoControl_IOCTL_DISK_GET_LENGTH_INFO_failed_error:_u
call fcn.004044f0
add esp, 8
jmp 0x406fcb
push dword [ebp - 0x94]
push dword [ebp - 0x98]
push dword [ebp - 0xb4]
push str.PHYSICALDRIVE_d_size__llu_bytes
call fcn.004044f0
add esp, 0x10
mov dword [ebp - 0xa4], 0
lea eax, [ebp - 0x8c]
mov dword [ebp - 0xa0], 0
push 0
push eax
push 8
lea eax, [ebp - 0xac]
push eax
push 0xc
lea eax, [ebp - 0xa4]
push eax
push 0x2d1400
push ebx
call edi
test eax, eax
jne 0x406e28
push dword [ebp - 0x8c]
call esi
push eax
push str.DeviceIoControl1_error:_u_dwBytes:_u
call fcn.004044f0
add esp, 0xc
jmp 0x406fcb
mov esi, dword [ebp - 0xa8]
push esi
cmp esi, 0x28
jae 0x406e46
push str.Invalid_DevDescHeader.Size:_u
call fcn.004044f0
add esp, 8
jmp 0x406fc5
call fcn.0040b401
mov edi, eax
add esp, 4
test edi, edi
jne 0x406e76
push esi
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
push eax
push str.failed_to_malloc_error:_u_len:_u
call fcn.004044f0
mov edi, dword [sym.imp.KERNEL32.dll_DeviceIoControl]
add esp, 0xc
jmp 0x406fcb
push 0
lea eax, [ebp - 0x8c]
push eax
push esi
push edi
push 0xc
lea eax, [ebp - 0xa4]
push eax
push 0x2d1400
push ebx
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
test eax, eax
jne 0x406eca
push dword [ebp - 0x8c]
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
push eax
push str.DeviceIoControl2_error:_u_dwBytes:_u
call fcn.004044f0
add esp, 0xc
push edi
call fcn.0040b3c9
mov edi, dword [sym.imp.KERNEL32.dll_DeviceIoControl]
add esp, 4
jmp 0x406fcb
mov ecx, dword [ebp - 0xb0]
movzx eax, byte [edi + 0xa]
mov dword [ecx + 4], eax
mov eax, dword [edi + 0x1c]
mov dword [ecx], eax
mov al, byte [edi + 8]
mov byte [ecx + 8], al
mov eax, dword [ebp - 0x98]
mov dword [ecx - 8], eax
mov eax, dword [ebp - 0x94]
mov dword [ecx - 4], eax
mov eax, dword [edi + 0xc]
test eax, eax
je 0x406f21
add eax, edi
lea esi, [ecx + 9]
push eax
push 0x80
push esi
call fcn.0040b358
add esp, 0xc
mov edx, 1
mov ecx, esi
call fcn.004043b0
mov ecx, dword [ebp - 0xb0]
mov eax, dword [edi + 0x10]
test eax, eax
je 0x406f4b
add eax, edi
lea esi, [ecx + 0x89]
push eax
push 0x80
push esi
call fcn.0040b358
add esp, 0xc
mov edx, 1
mov ecx, esi
call fcn.004043b0
mov eax, dword [edi + 0x14]
test eax, eax
je 0x406f7b
mov esi, dword [ebp - 0xb0]
add eax, edi
push eax
add esi, 0x109
push 0x80
push esi
call fcn.0040b358
add esp, 0xc
mov edx, 1
mov ecx, esi
call fcn.004043b0
mov ecx, dword [edi + 0x18]
test ecx, ecx
je 0x406fac
mov esi, dword [ebp - 0xb0]
lea eax, [ecx + edi]
push eax
add esi, 0x189
push 0x80
push esi
call fcn.0040b358
add esp, 0xc
mov edx, 1
mov ecx, esi
call fcn.004043b0
push edi
call fcn.0040b3c9
add esp, 4
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edi, dword [sym.imp.KERNEL32.dll_DeviceIoControl]
or ebx, 0xffffffff
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [ebp - 0xb4]
add dword [ebp - 0xb0], 0x218
inc ecx
mov dword [ebp - 0xb4], ecx
cmp ecx, dword [ebp - 0xb8]
jl 0x406d11
push str._DUMP_DISK_BEGIN_
call fcn.004044f0
mov ebx, dword [ebp - 0xb8]
add esp, 4
xor edi, edi
test ebx, ebx
jle 0x407050
mov esi, dword [ebp - 0xbc]
add esi, 0x11
mov ecx, dword [esi - 0xd]
lea eax, [esi + 0x80]
mov edx, dword [esi - 0x11]
push eax
push esi
push ecx
push edx
push ecx
push edx
call fcn.00406ba0
mov ecx, dword [esi - 9]
add esp, 8
push eax
push dword [esi - 5]
call fcn.00406ae0
push eax
push edi
push str.PhyDrv:_d_BusType:__4s_Removable:_u_Size:_dGB__llu__Name:_s__s
call fcn.004044f0
inc edi
add esp, 0x24
add esi, 0x218
cmp edi, ebx
jl 0x407010
push dword [0x4262e8]
push str.Ventoy_disk_is_PhyDvr_d
call fcn.004044f0
push str._DUMP_DISK_END_
call fcn.004044f0
mov ecx, dword [ebp - 0xc0]
add esp, 0xc
mov eax, dword [ebp - 0xbc]
mov dword [ecx], eax
mov eax, dword [ebp - 0xc4]
mov dword [eax], ebx
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040b2c4
mov esp, ebp
pop ebp
ret
push str.Failed_to_read_disk_count
call fcn.004044f0
add esp, 4
mov ecx, dword [ebp - 4]
mov eax, 1
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0040b2c4
mov esp, ebp
pop ebp
ret