Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong PartitionCount output in windevblk_test.exe #1

Open
xja opened this issue Jul 10, 2022 · 2 comments
Open

Wrong PartitionCount output in windevblk_test.exe #1

xja opened this issue Jul 10, 2022 · 2 comments

Comments

@xja
Copy link

xja commented Jul 10, 2022

Environment

  • Windows 10 LTSC 21H2 64bit on VirtualBox
  • Microsoft Visual Studio Community 2019 Version 16.11.16
  • 3 Disks attached

Problem

Drive 2 (\.\PhysicalDrive2) is a newly initialized disk, which doesn't contain any partition at all, but the test exe reports that disk has 4 partitions.

Disk list

PS C:\Users\Administrator> get-disk

Number Friendly Name Serial Number                    HealthStatus         OperationalStatus      Total Size Partition
                                                                                                             Style
------ ------------- -------------                    ------------         -----------------      ---------- ----------
0      VBOX HARDDISK VB0fd0b492-e16ac651              Healthy              Online                      50 GB GPT
1      VBOX HARDDISK VB5d6967dd-87d0fa5b              Healthy              Online                      25 GB RAW
2      VBOX HARDDISK VB4dd4fce2-2c11a706              Healthy              Online                      15 GB MBR

PS C:\Users\Administrator> get-partition -DiskNumber 2
Get-Partition : No MSFT_Partition objects found with property 'DiskNumber' equal to '2'. Verify the value of the property and retry.
At line:1 char:1
+ get-partition -DiskNumber 2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (2:UInt32) [Get-Partition], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound_DiskNumber,Get-Partition

Windevblk_test.exe output

Drive 0:
   SerialNumber: VB0fd0b492-e16ac651
   ModelNumber: VBOX HARDDISK
   VendorId:
   ProductRevision: 1.0
   DevicePath: \\?\scsi#disk&ven_vbox&prod_harddisk#4&2617aeae&0&000000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
   ShortDevicePath: \\.\PhysicalDrive0
   canBePartitioned: 1
   PartitionStyle: 1
   PartitionCount: 4
   Gpt.DiskId: {FF508A7C-71A2-4268-9F4C-CEB9AACE6D68}
   Gpt.StartingUsableOffset: 17408
   Gpt.UsableLength: 53687056896
   Gpt.MaxPartitionCount: 128
   *Partition 0 (PosixPath = /dev/sda):
      PartitionLength: 53687091200
      StartingOffset: 0
      EndingOffset: 53687091200
      szFileSystemName:
      szRootPathName:
      szVolumeName:
      szVolumePathName:
   *Partition 1 (PosixPath = /dev/sda1):
      PartitionLength: 104857600
      StartingOffset: 1048576
      EndingOffset: 105906176
      Gpt.PartitionType: {C12A7328-F81F-11D2-BA4B-00A0C93EC93B}
      Gpt.PartitionId: {D297DA11-75C0-4D9A-A08B-EA426FF98DB1}
      szFileSystemName: FAT32
      szRootPathName: \\?\Volume{d297da11-75c0-4d9a-a08b-ea426ff98db1}\
      szVolumeName:
      szVolumePathName:
   *Partition 2 (PosixPath = /dev/sda2):
      PartitionLength: 16777216
      StartingOffset: 105906176
      EndingOffset: 122683392
      Gpt.PartitionType: {E3C9E316-0B5C-4DB8-817D-F92DF00215AE}
      Gpt.PartitionId: {F4E82308-4691-4E74-BE49-44B8205D063B}
      szFileSystemName:
      szRootPathName:
      szVolumeName:
      szVolumePathName:
   *Partition 3 (PosixPath = /dev/sda3):
      PartitionLength: 52963463168
      StartingOffset: 122683392
      EndingOffset: 53086146560
      Gpt.PartitionType: {EBD0A0A2-B9E5-4433-87C0-68B6B72699C7}
      Gpt.PartitionId: {B6472378-6D6F-4934-9D97-5796A8B39145}
      szFileSystemName: NTFS
      szRootPathName: \\?\Volume{b6472378-6d6f-4934-9d97-5796a8b39145}\
      szVolumeName:
      szVolumePathName: C:\
   *Partition 4 (PosixPath = /dev/sda4):
      PartitionLength: 598736896
      StartingOffset: 53086257152
      EndingOffset: 53684994048
      Gpt.PartitionType: {DE94BBA4-06D1-4D40-A16A-BFD50179D6AC}
      Gpt.PartitionId: {62D027E5-5D0A-4AE1-8797-7254990BC06D}
      szFileSystemName: NTFS
      szRootPathName: \\?\Volume{62d027e5-5d0a-4ae1-8797-7254990bc06d}\
      szVolumeName:
      szVolumePathName:
Drive 1:
   SerialNumber: VB5d6967dd-87d0fa5b
   ModelNumber: VBOX HARDDISK
   VendorId:
   ProductRevision: 1.0
   DevicePath: \\?\scsi#disk&ven_vbox&prod_harddisk#4&2617aeae&0&020000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
   ShortDevicePath: \\.\PhysicalDrive1
   canBePartitioned: 1
   PartitionStyle: 0
   PartitionCount: 0
   Mbr.CheckSum: 0x0
   Mbr.Signature: 0x0
   *Partition 0 (PosixPath = /dev/sdb):
      PartitionLength: 26843545600
      StartingOffset: 0
      EndingOffset: 26843545600
      szFileSystemName:
      szRootPathName:
      szVolumeName:
      szVolumePathName:
Drive 2:
   SerialNumber: VB4dd4fce2-2c11a706
   ModelNumber: VBOX HARDDISK
   VendorId:
   ProductRevision: 1.0
   DevicePath: \\?\scsi#disk&ven_vbox&prod_harddisk#4&2617aeae&0&030000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
   ShortDevicePath: \\.\PhysicalDrive2
   canBePartitioned: 1
   PartitionStyle: 0
   PartitionCount: 4
   Mbr.CheckSum: 0xcdd8e482
   Mbr.Signature: 0x87d21b7e
   *Partition 0 (PosixPath = /dev/sdc):
      PartitionLength: 16106127360
      StartingOffset: 0
      EndingOffset: 16106127360
      szFileSystemName:
      szRootPathName:
      szVolumeName:
      szVolumePathName:

Press a key to exit
@xja
Copy link
Author

xja commented Jul 10, 2022

According to DRIVE_LAYOUT_INFORMATION_EX - Win32 apps | Microsoft Docs, PartitionStyle value of uninitialized disk(PARTITION_STYLE_RAW) is 2, but we get a PartitionStyle: 0 in Drive 1(\.\PhysicalDrive1), is this correct?

@vricosti
Copy link
Owner

vricosti commented Nov 2, 2022

According to DRIVE_LAYOUT_INFORMATION_EX - Win32 apps | Microsoft Docs, PartitionStyle value of uninitialized disk(PARTITION_STYLE_RAW) is 2, but we get a PartitionStyle: 0 in Drive 1(.\PhysicalDrive1), is this correct?

It seems so... Cannot do anything special if Windows api is giving wrong info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants