From 0216114b9baf6213456fea37a00cd1e8e35f39fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 27 Aug 2024 20:48:26 +0200 Subject: [PATCH] ** wip volume --- base/setup/lib/utils/volutil.c | 2 +- base/setup/lib/utils/volutil.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/base/setup/lib/utils/volutil.c b/base/setup/lib/utils/volutil.c index 153488542a045..e165003cd4f63 100644 --- a/base/setup/lib/utils/volutil.c +++ b/base/setup/lib/utils/volutil.c @@ -108,7 +108,7 @@ MountVolume( struct { FILE_FS_VOLUME_INFORMATION; - WCHAR Data[255]; + WCHAR Data[_countof(Volume->VolumeLabel)]; } LabelInfo; Status = NtQueryVolumeInformationFile(VolumeHandle, diff --git a/base/setup/lib/utils/volutil.h b/base/setup/lib/utils/volutil.h index 2763bb898444c..ef3684e9f1ce0 100644 --- a/base/setup/lib/utils/volutil.h +++ b/base/setup/lib/utils/volutil.h @@ -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;