Adding symbolic link to USBFDO.

svn path=/trunk/; revision=15807
This commit is contained in:
James Tabor 2005-06-05 15:50:55 +00:00
parent 34fea9606b
commit 4c7bbd9c39

View file

@ -37,6 +37,8 @@ AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
NTSTATUS Status;
WCHAR DeviceBuffer[20];
UNICODE_STRING DeviceName;
WCHAR LinkDeviceBuffer[20];
UNICODE_STRING LinkDeviceName;
POHCI_DRIVER_EXTENSION DriverExtension;
POHCI_DEVICE_EXTENSION DeviceExtension;
ULONG Size, DeviceNumber;
@ -62,7 +64,7 @@ AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
// Create a unicode device name
DeviceNumber = 0; //TODO: Allocate new device number every time
swprintf(DeviceBuffer, L"\\Device\\USBPDO-%lu", DeviceNumber);
swprintf(DeviceBuffer, L"\\Device\\USBFDO-%lu", DeviceNumber);
RtlInitUnicodeString(&DeviceName, DeviceBuffer);
Status = IoCreateDevice(DriverObject,
@ -93,6 +95,16 @@ AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
DeviceExtension->FunctionalDeviceObject = fdo;
DeviceExtension->DriverExtension = DriverExtension;
swprintf(LinkDeviceBuffer, L"\\??\\HCD%lu", DeviceNumber);
RtlInitUnicodeString(&LinkDeviceName, LinkDeviceBuffer);
Status = IoCreateSymbolicLink(&LinkDeviceName, &DeviceName);
if (!NT_SUCCESS(Status))
{
DPRINT1("IoCreateSymbolicLink call failed with status 0x%08x\n", Status);
return Status;
}
/* Get bus number from the upper level bus driver. */
Size = sizeof(ULONG);
/* Status = IoGetDeviceProperty(