[NTOS:IO] IoVolumeDeviceToDosName(): Add SAL2 annotations, fix pool tag (#6989)

The DEV2DOS tag value is from the official Windows pooltag.txt file.
This commit is contained in:
Hermès Bélusca-Maïto 2024-06-04 17:18:13 +02:00
parent 5afb7ab003
commit e4748fe448
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 7 additions and 4 deletions

View file

@ -94,6 +94,7 @@
#define TAG_VPB ' BPV'
#define TAG_RTLREGISTRY 'vrqR'
#define TAG_PNP_DEVACTION 'aDpP'
#define TAG_DEV2DOS ' d2D'
/* Loader Related Tags */
#define TAG_MODULE_OBJECT 'omlk' /* klmo - kernel ldr module object */

View file

@ -1276,8 +1276,10 @@ IoSetSystemPartition(IN PUNICODE_STRING VolumeNameString)
*/
NTSTATUS
NTAPI
IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
OUT PUNICODE_STRING DosName)
IoVolumeDeviceToDosName(
_In_ PVOID VolumeDeviceObject,
_Out_ _When_(return==0, _At_(DosName->Buffer, __drv_allocatesMem(Mem)))
PUNICODE_STRING DosName)
{
NTSTATUS Status;
ULONG Length;
@ -1373,7 +1375,7 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
/* Reallocate the memory, even in case of success, because
* that's the buffer that will be returned to the caller */
VolumePathPtr = ExAllocatePoolWithTag(PagedPool, Length, 'D2d ');
VolumePathPtr = ExAllocatePoolWithTag(PagedPool, Length, TAG_DEV2DOS);
if (!VolumePathPtr)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
@ -1418,7 +1420,7 @@ IoVolumeDeviceToDosName(IN PVOID VolumeDeviceObject,
goto Quit;
ReleaseMemory:
ExFreePoolWithTag(VolumePathPtr, 'D2d ');
ExFreePoolWithTag(VolumePathPtr, TAG_DEV2DOS);
Quit:
ObDereferenceObject(FileObject);