[SETUPLIB] Use a "well-known" length for disk volume labels (#7259)

Use the same `MAXIMUM_VOLUME_LABEL_LENGTH` as the one defined in the
WDK for specifying the length of buffers storing a volume label.
This commit is contained in:
Hermès Bélusca-Maïto
2024-08-27 20:48:26 +02:00
parent ca7b77d7f0
commit 12ee8fda7b
2 changed files with 7 additions and 2 deletions

View File

@@ -108,7 +108,7 @@ MountVolume(
struct
{
FILE_FS_VOLUME_INFORMATION;
WCHAR Data[255];
WCHAR Data[_countof(Volume->VolumeLabel)];
} LabelInfo;
Status = NtQueryVolumeInformationFile(VolumeHandle,

View File

@@ -7,13 +7,18 @@
#pragma once
/* The maximum volume label length is 32 characters */
#ifndef MAXIMUM_VOLUME_LABEL_LENGTH // Defined in wdm.h only
#define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
#endif
typedef struct _VOLINFO
{
// WCHAR VolumeName[MAX_PATH]; ///< Name in the DOS/Win32 namespace: "\??\Volume{GUID}\"
WCHAR DeviceName[MAX_PATH]; ///< NT device name: "\Device\HarddiskVolumeN"
WCHAR DriveLetter;
WCHAR VolumeLabel[20];
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR) + 1]; ///< Volume label, NUL-terminated
WCHAR FileSystem[MAX_PATH+1];
// VOLUME_TYPE VolumeType;