From: PRANAV KANT GAUR on 4 Apr 2010 01:07 I trying to debug my KMDF USB mass storage device driver on win xp as target and vista sp2 as host(with debugger),windbg displays value of 'status' of call to WdfUsbTargetDeviceCreate routine as: 0xc00000bb,which indicates an error. kd> !error 0xc00000bb Error code: (NTSTATUS) 0xc00000bb (3221225659) - The request is not supported. What can be concluded from 'The request is not supported.' message ? Whether it means that a call to 'WdfUsbTargetDeviceCreate' routine is not supported but why?
From: Tim Roberts on 6 Apr 2010 00:10 PRANAV KANT GAUR <PRANAVKANTGAUR(a)discussions.microsoft.com> wrote: > >I trying to debug my KMDF USB mass storage device driver on win xp as target >and vista sp2 as host(with debugger),windbg displays value of 'status' of >call to WdfUsbTargetDeviceCreate routine as: >0xc00000bb,which indicates an error. > >kd> !error 0xc00000bb >Error code: (NTSTATUS) 0xc00000bb (3221225659) - The request is not supported. > >What can be concluded from 'The request is not supported.' message ? >Whether it means that a call to 'WdfUsbTargetDeviceCreate' routine is not >supported but why? Remember that virtually all of the WDF IoTarget requests end up creating an IRP and sending it down the stack. Such an IRP is initialized with STATUS_NOT_SUPPORTED, and if no one handles the request, that's the status you'll end up with. I'm not convinced it's possible to write a USB Mass Storage Driver with KMDF. Are you writing a full function driver, or just a filter? If a filter, where are you filtering? -- Tim Roberts, timr(a)probo.com Providenza & Boekelheide, Inc.
From: PRANAV KANT GAUR on 6 Apr 2010 13:15 "Tim Roberts" wrote: > PRANAV KANT GAUR <PRANAVKANTGAUR(a)discussions.microsoft.com> wrote: > > > >I trying to debug my KMDF USB mass storage device driver on win xp as target > >and vista sp2 as host(with debugger),windbg displays value of 'status' of > >call to WdfUsbTargetDeviceCreate routine as: > >0xc00000bb,which indicates an error. > > > >kd> !error 0xc00000bb > >Error code: (NTSTATUS) 0xc00000bb (3221225659) - The request is not supported. > > > >What can be concluded from 'The request is not supported.' message ? > >Whether it means that a call to 'WdfUsbTargetDeviceCreate' routine is not > >supported but why? > > Remember that virtually all of the WDF IoTarget requests end up creating an > IRP and sending it down the stack. Such an IRP is initialized with > STATUS_NOT_SUPPORTED, and if no one handles the request, that's the status > you'll end up with. > > I'm not convinced it's possible to write a USB Mass Storage Driver with > KMDF. Are you writing a full function driver, or just a filter? If a > filter, where are you filtering? > -- > Tim Roberts, timr(a)probo.com > Providenza & Boekelheide, Inc. > . Sir,I have tried to replace the vendor provided USB mass storage device driver for flash drive through the driver written by me.For this i have taken reference from OSRUSBFX2 sample in WDK.I considered the role of vendor provided driver as a function driver(please correct me,if i am wrong). Till now i have provided routines for bulk read & write operations in it. Sir,If i am wrong in interpreting scope\feasibilty of this work through WDK,then please guide me ?
From: Tim Roberts on 8 Apr 2010 00:26 PRANAV KANT GAUR <PRANAVKANTGAUR(a)discussions.microsoft.com> wrote: > >Sir,I have tried to replace the vendor provided USB mass storage device >driver for flash drive through the driver written by me.For this i have taken >reference from OSRUSBFX2 sample in WDK.I considered the role of vendor >provided driver as a function driver(please correct me,if i am wrong). >Till now i have provided routines for bulk read & write operations in it. > >Sir,If i am wrong in interpreting scope\feasibilty of this work through >WDK,then please guide me ? If you have written a driver to replace usbstor.sys, then you are a function driver. Do you know what requests usbstor.sys expects, and what format the URBs are you that you have to send? Perhaps you should show us the code, so we can see how and where you're calling WdfUsbTargetDeviceCreate. -- Tim Roberts, timr(a)probo.com Providenza & Boekelheide, Inc.
From: PRANAV KANT GAUR on 8 Apr 2010 09:47
"Tim Roberts" wrote: > PRANAV KANT GAUR <PRANAVKANTGAUR(a)discussions.microsoft.com> wrote: > > > >Sir,I have tried to replace the vendor provided USB mass storage device > >driver for flash drive through the driver written by me.For this i have taken > >reference from OSRUSBFX2 sample in WDK.I considered the role of vendor > >provided driver as a function driver(please correct me,if i am wrong). > >Till now i have provided routines for bulk read & write operations in it. > > > >Sir,If i am wrong in interpreting scope\feasibilty of this work through > >WDK,then please guide me ? > > If you have written a driver to replace usbstor.sys, then you are a > function driver. > > Do you know what requests usbstor.sys expects, and what format the URBs are > you that you have to send? > > Perhaps you should show us the code, so we can see how and where you're > calling WdfUsbTargetDeviceCreate. > -- > Tim Roberts, timr(a)probo.com > Providenza & Boekelheide, Inc. > . Here is the complete code #include"ntddk.h" #include"wdf.h" #include"wdm.h" #include"prototypes.h" #pragma warning(disable:4200) #pragma warning(disable:4201) #pragma warning(disable:4214) #include"usbdi.h" #pragma warning(default:4200) #pragma warning(default:4201) #pragma warning(default:4214) #include"wdfusb.h" #include"initguid.h" #define INTERRUPT_IN_ENDPOINT_INDEX 0 #define BULK_OUT_ENDPOINT_INDEX 1 #define BULK_IN_ENDPOINT_INDEX 2 DEFINE_GUID(GUID_DEVINTERFACE_MYUSB, 0xb466f376, 0x7b19, 0x4e70, 0x8b, 0x7f, 0x60, 0x16, 0x3c, 0x1f, 0x2c, 0xe6); typedef struct _DEVICE_CONTEXT{ WDFUSBDEVICE usbdevice; WDFUSBINTERFACE usbinterface; WDFUSBPIPE bulkreadpipe; WDFUSBPIPE bulkwritepipe; WDFUSBPIPE interruptpipe; }DEVICE_CONTEXT,*PDEVICE_CONTEXT; WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT,getdevicecontext) NTSTATUS DriverEntry(IN PDRIVER_OBJECT mydriverobject, IN PUNICODE_STRING registrypath ) { WDF_DRIVER_CONFIG config; NTSTATUS status; WDF_DRIVER_CONFIG_INIT(&config,EvtDeviceAdd); status=WdfDriverCreate(mydriverobject,registrypath,WDF_NO_OBJECT_ATTRIBUTES,&config,WDF_NO_HANDLE); if(!NT_SUCCESS(status)) DbgPrint("MY DRIVER CREATE FAILED 0x%x\n",status); return status; } NTSTATUS EvtDeviceAdd( IN WDFDRIVER driver, IN PWDFDEVICE_INIT deviceinit ) { WDF_OBJECT_ATTRIBUTES attribute; NTSTATUS status; WDFDEVICE device; PDEVICE_CONTEXT pcontext; WDF_PNPPOWER_EVENT_CALLBACKS pnppowercallbacks; WDF_IO_QUEUE_CONFIG ioqueueconfig; UNREFERENCED_PARAMETER(driver); WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnppowercallbacks); pnppowercallbacks.EvtDevicePrepareHardware=EvtDevicePrepareHardware; WdfDeviceInitSetPnpPowerEventCallbacks(deviceinit,&pnppowercallbacks); WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attribute,DEVICE_CONTEXT); status=WdfDeviceCreate(&deviceinit,&attribute,&device); if(!NT_SUCCESS(status)) { DbgPrint("FRAME DEVICE OBJECT CREATION FAILED WITH STATUS 0x%x\n",status); return status; } pcontext=getdevicecontext(device); status=WdfDeviceCreateDeviceInterface(device,(LPGUID)&GUID_DEVINTERFACE_MYUSB,NULL); if(!NT_SUCCESS(status)) { DbgPrint(" CREATE DEVICE INTERFACE FAILED WITH STATUS 0x%x",status); return status; } WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioqueueconfig,WdfIoQueueDispatchParallel); ioqueueconfig.EvtIoRead=EvtIoRead; ioqueueconfig.EvtIoWrite=EvtIoWrite; status=WdfIoQueueCreate(device,&ioqueueconfig,WDF_NO_OBJECT_ATTRIBUTES,WDF_NO_HANDLE); if(!NT_SUCCESS(status)) { DbgPrint("queue creation failed with status 0x%x\n",status); return status; } return status; } NTSTATUS EvtDevicePrepareHardware ( IN WDFDEVICE device, IN WDFCMRESLIST resourcelist, IN WDFCMRESLIST translatedresourcelist ) { NTSTATUS status; PDEVICE_CONTEXT pcontext; WDF_USB_DEVICE_SELECT_CONFIG_PARAMS configparams; UNREFERENCED_PARAMETER(resourcelist); UNREFERENCED_PARAMETER(translatedresourcelist); pcontext=getdevicecontext(device); status=WdfUsbTargetDeviceCreate(device,WDF_NO_OBJECT_ATTRIBUTES,&pcontext->usbdevice); if(!NT_SUCCESS(status)) { DbgPrint("TARGET DEVICE CREATION FAILED WITH STATUS 0x%x\n",status); return status; } WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE(&configparams); status=WdfUsbTargetDeviceSelectConfig(pcontext->usbdevice,WDF_NO_OBJECT_ATTRIBUTES,&configparams); if(!NT_SUCCESS(status)) { DbgPrint("CONFIGURATION SELECTION FOR DEVICE FAILED WITH STATUS 0x%x/n",status); return status; } pcontext->usbinterface=configparams.Types.SingleInterface.ConfiguredUsbInterface; pcontext->bulkreadpipe=WdfUsbInterfaceGetConfiguredPipe(pcontext->usbinterface,BULK_IN_ENDPOINT_INDEX,NULL); WdfUsbTargetPipeSetNoMaximumPacketSizeCheck(pcontext->bulkreadpipe); pcontext->bulkwritepipe=WdfUsbInterfaceGetConfiguredPipe(pcontext-> usbinterface,BULK_OUT_ENDPOINT_INDEX,NULL); WdfUsbTargetPipeSetNoMaximumPacketSizeCheck(pcontext->bulkwritepipe); pcontext->interruptpipe=WdfUsbInterfaceGetConfiguredPipe(pcontext-> usbinterface,INTERRUPT_IN_ENDPOINT_INDEX,NULL); WdfUsbTargetPipeSetNoMaximumPacketSizeCheck(pcontext->interruptpipe); return status; } VOID EvtIoRead( IN WDFQUEUE queue, IN WDFREQUEST request, IN size_t length ) { WDFUSBPIPE pipe; WDFMEMORY memory; NTSTATUS status; BOOLEAN ret; PDEVICE_CONTEXT pcontext; UNREFERENCED_PARAMETER(length); pcontext=getdevicecontext(WdfIoQueueGetDevice(queue)); pipe=pcontext->bulkreadpipe; status=WdfRequestRetrieveOutputMemory(request,&memory);if(!NT_SUCCESS(status)) goto exit; status=WdfUsbTargetPipeFormatRequestForRead(pipe,request,memory,NULL);if(!NT_SUCCESS(status)) goto exit; WdfRequestSetCompletionRoutine(request,EvtRequestReadCompletionRoutine,pipe); ret=WdfRequestSend(request,WdfUsbTargetPipeGetIoTarget(pipe),WDF_NO_SEND_OPTIONS); if(ret==FALSE) { status=WdfRequestGetStatus(request); goto exit; } else return; exit: WdfRequestCompleteWithInformation(request,status,0); return; } VOID EvtRequestReadCompletionRoutine ( IN WDFREQUEST request, IN WDFIOTARGET target, PWDF_REQUEST_COMPLETION_PARAMS completionparams, IN WDFCONTEXT context ) { NTSTATUS status; size_t bytesread=0; PWDF_USB_REQUEST_COMPLETION_PARAMS usbcompletionparams; UNREFERENCED_PARAMETER(target); UNREFERENCED_PARAMETER(context); status=completionparams->IoStatus.Status; usbcompletionparams=completionparams->Parameters.Usb.Completion; bytesread=usbcompletionparams->Parameters.PipeRead.Length; if(NT_SUCCESS(status)) DbgPrint("NUMBER OF BYTES READ ARE:%I64d\n",(INT64)bytesread); else DbgPrint("READING FAILED WITH REQUEST STATUS 0x%x & USBD STATUS 0x%x",status,usbcompletionparams->UsbdStatus); WdfRequestCompleteWithInformation(request,status,bytesread); return; } VOID EvtIoWrite ( IN WDFQUEUE queue, IN WDFREQUEST request, IN size_t length ) { NTSTATUS status; WDFUSBPIPE pipe; WDFMEMORY memory; PDEVICE_CONTEXT pcontext; BOOLEAN ret; UNREFERENCED_PARAMETER(length); status=WdfRequestRetrieveInputMemory(request,&memory); if(!NT_SUCCESS(status)) goto exit; pcontext=getdevicecontext(WdfIoQueueGetDevice(queue)); pipe=pcontext->bulkwritepipe; status=WdfUsbTargetPipeFormatRequestForWrite(pipe,request,memory,NULL); if(!NT_SUCCESS(status)) goto exit; WdfRequestSetCompletionRoutine(request,EvtRequestWriteCompletionRoutine,pipe); ret=WdfRequestSend(request,WdfUsbTargetPipeGetIoTarget(pipe),WDF_NO_SEND_OPTIONS); if(ret==FALSE) { status=WdfRequestGetStatus(request); goto exit; } else return; exit: WdfRequestCompleteWithInformation(request,status,0); return; } VOID EvtRequestWriteCompletionRoutine ( IN WDFREQUEST request, IN WDFIOTARGET target, IN PWDF_REQUEST_COMPLETION_PARAMS completionparams, IN WDFCONTEXT context ) { NTSTATUS status; size_t byteswritten=0; PWDF_USB_REQUEST_COMPLETION_PARAMS usbcompletionparams; UNREFERENCED_PARAMETER(context); UNREFERENCED_PARAMETER(target); status=completionparams->IoStatus.Status; usbcompletionparams=completionparams->Parameters.Usb.Completion; byteswritten=usbcompletionparams->Parameters.PipeWrite.Length; if(NT_SUCCESS(status)) { DbgPrint("NUMBER OF BYTES WRITTEN ARE:%I64d",(INT64)byteswritten); } else DbgPrint("WRITE OPERATION FAILED WITH REQUEST STATUE 0x%x & USBD STATUS 0x%x\n",status,usbcompletionparams->UsbdStatus); WdfRequestCompleteWithInformation(request,status,byteswritten); return; } |