\\Device\\Harddisk0\\DR0
From: xuyibo.org Date: 2008-11-13 03:17 PM
DR0代表什么意思?看看wdk中\\WinDDK\\6000\\src\\storage\\class\\disk\\pnp.c中:\\\\Device\\\\Harddisk%d\\\\DR%d。
NTSTATUS
DiskGenerateDeviceName(
IN ULONG DeviceNumber,
OUT PUCHAR *RawName
)
/*++
Routine Description:
This routine will allocate a unicode string buffer and then fill it in
with a generated name for the specified device object.
It is the responsibility of the user to allocate a UNICODE_STRING structure
to pass in and to free UnicodeName->Buffer when done with it.
Arguments:
DeviceObject - a pointer to the device object
UnicodeName - a unicode string to put the name buffer into
Return Value:
status
--*/
#define FDO_NAME_FORMAT '\\\\Device\\\\Harddisk%d\\\\DR%d'
{
UCHAR rawName[64] = { 0 };
NTSTATUS status;
PAGED_CODE();
status = RtlStringCchPrintfA(rawName, sizeof(rawName) - 1, FDO_NAME_FORMAT, DeviceNumber,
diskDeviceSequenceNumber++);
if (!NT_SUCCESS(status)) {
TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_PNP, 'DiskGenerateDeviceName: Format FDO name failed with error: 0x%X\\n', status));
return status;
}
*RawName = ExAllocatePoolWithTag(PagedPool,
strlen(rawName) + 1,
DISK_TAG_NAME);
if(*RawName == NULL) {
return STATUS_INSUFFICIENT_RESOURCES;
}
status = RtlStringCchCopyA(*RawName, strlen(rawName) + 1, rawName);
if (!NT_SUCCESS(status)) {
TracePrint((TRACE_LEVEL_ERROR, TRACE_FLAG_PNP, 'DiskGenerateDeviceName: Device name copy failed with error: 0x%X\\n', status));
FREE_POOL(*RawName);
return status;
}
TracePrint((TRACE_LEVEL_INFORMATION, TRACE_FLAG_PNP, 'DiskGenerateDeviceName: generated \\'%s\\'\\n', rawName));
return STATUS_SUCCESS;
}