Hello,
I’m completely new in KMDF… and… I’m trying to get the name of the manufacturer over the USB.
Unfortunatelly, the following code causes the blue screen of death on my Vista…
The line that crashes the system is this one (numCharacters is 30):
KdPrint ( (“All ok, bailing out! %c%c%c%c\n”, memoryHandle[0],memoryHandle[1],memoryHandle[2],memoryHandle[3],memoryHandle[4] ));
What am I doing wrong? How to get the contents of the memoryHandle?
The return value of the WdfUsbTargetDeviceAllocAndQueryString is OK.
NTSTATUS getUSBDeviceDescriptorString( IN WDFDEVICE Device )
{
NTSTATUS status;
PDEVICE_CONTEXT pDeviceContext;
USHORT numCharacters;
PUSHORT stringBuf;
WDFMEMORY memoryHandle;
WDF_MEMORY_DESCRIPTOR memoryDescriptor;
//
// initialize variables
//
pDeviceContext = GetDeviceContext(Device);
status = WdfUsbTargetDeviceAllocAndQueryString(
pDeviceContext->WdfUsbTargetDevice,
WDF_NO_OBJECT_ATTRIBUTES,
&memoryHandle,
&numCharacters,
pDeviceContext->UsbDeviceDescriptor.iManufacturer,
0x0409
);
KdPrint ( (“All ok, bailing out! %c%c%c%c\n”, memoryHandle[0],memoryHandle[1],memoryHandle[2],memoryHandle[3],memoryHandle[4] ));
return -1;
}
Thanks.
Best regards,
Damir Colak