Skip to content

Commit 31b091c

Browse files
committed
[DISKPART] Improve the drive letter query
And disable some debug output
1 parent 7675b0e commit 31b091c

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

base/system/diskpart/partlist.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ ReadLayoutBuffer(
10851085

10861086
for (;;)
10871087
{
1088-
DPRINT1("Buffer size: %lu\n", LayoutBufferSize);
1088+
DPRINT("Buffer size: %lu\n", LayoutBufferSize);
10891089
Status = NtDeviceIoControlFile(FileHandle,
10901090
NULL,
10911091
NULL,
@@ -1118,7 +1118,6 @@ ReadLayoutBuffer(
11181118

11191119
DiskEntry->LayoutBuffer = NewLayoutBuffer;
11201120
}
1121-
11221121
}
11231122

11241123

@@ -1796,9 +1795,9 @@ GetVolumeSize(
17961795
FileFsFullSizeInformation);
17971796
if (NT_SUCCESS(Status))
17981797
{
1799-
DPRINT1("FullSizeInfo.TotalAllocationUnits %I64u\n", FullSizeInfo.TotalAllocationUnits.QuadPart);
1800-
DPRINT1("FullSizeInfo.SectorsPerAllocationUnit %lu\n", FullSizeInfo.SectorsPerAllocationUnit);
1801-
DPRINT1("FullSizeInfo.BytesPerSector %lu\n", FullSizeInfo.BytesPerSector);
1798+
DPRINT("FullSizeInfo.TotalAllocationUnits %I64u\n", FullSizeInfo.TotalAllocationUnits.QuadPart);
1799+
DPRINT("FullSizeInfo.SectorsPerAllocationUnit %lu\n", FullSizeInfo.SectorsPerAllocationUnit);
1800+
DPRINT("FullSizeInfo.BytesPerSector %lu\n", FullSizeInfo.BytesPerSector);
18021801

18031802
VolumeEntry->TotalAllocationUnits.QuadPart = FullSizeInfo.TotalAllocationUnits.QuadPart;
18041803
VolumeEntry->SectorsPerAllocationUnit = FullSizeInfo.SectorsPerAllocationUnit;
@@ -1814,17 +1813,17 @@ GetVolumeSize(
18141813
FileFsSizeInformation);
18151814
if (NT_SUCCESS(Status))
18161815
{
1817-
DPRINT1("SizeInfo.TotalAllocationUnits %I64u\n", SizeInfo.TotalAllocationUnits.QuadPart);
1818-
DPRINT1("SizeInfo.SectorsPerAllocationUnit %lu\n", SizeInfo.SectorsPerAllocationUnit);
1819-
DPRINT1("SizeInfo.BytesPerSector %lu\n", SizeInfo.BytesPerSector);
1816+
DPRINT("SizeInfo.TotalAllocationUnits %I64u\n", SizeInfo.TotalAllocationUnits.QuadPart);
1817+
DPRINT("SizeInfo.SectorsPerAllocationUnit %lu\n", SizeInfo.SectorsPerAllocationUnit);
1818+
DPRINT("SizeInfo.BytesPerSector %lu\n", SizeInfo.BytesPerSector);
18201819

18211820
VolumeEntry->TotalAllocationUnits.QuadPart = SizeInfo.TotalAllocationUnits.QuadPart;
18221821
VolumeEntry->SectorsPerAllocationUnit = SizeInfo.SectorsPerAllocationUnit;
18231822
VolumeEntry->BytesPerSector = SizeInfo.BytesPerSector;
18241823
}
18251824
else
18261825
{
1827-
DPRINT1("SizeInfo failed!\n");
1826+
DPRINT("GetVolumeSize() failed!\n");
18281827
}
18291828
}
18301829
}
@@ -1944,7 +1943,18 @@ AddVolumeToList(
19441943
ARRAYSIZE(szPathNames),
19451944
&dwLength))
19461945
{
1947-
VolumeEntry->DriveLetter = szPathNames[0];
1946+
INT nPathLength;
1947+
PWSTR pszPath = szPathNames;
1948+
while (*pszPath != UNICODE_NULL)
1949+
{
1950+
DPRINT("PathName: %S\n", pszPath);
1951+
nPathLength = wcslen(pszPath);
1952+
if ((nPathLength == 3) && (iswalpha(pszPath[0])) &&
1953+
(pszPath[1] == L':') && (pszPath[2] == L'\\'))
1954+
VolumeEntry->DriveLetter = pszPath[0];
1955+
1956+
pszPath += (nPathLength + 1);
1957+
}
19481958
}
19491959

19501960
InsertTailList(&VolumeListHead,

0 commit comments

Comments
 (0)