Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > WDF for Storage CLASS device

Reply
Thread Tools Display Modes

WDF for Storage CLASS device

 
 
Mike Fochtman
Guest
Posts: n/a

 
      05-10-2010
I've got an old WDM driver for a SCSI device. This 'SCSI Processor' device
needs exact CDB structure (6-byte CDB) to work. And that all worked under
the WDM driver. (a note under WDM storage class drivers says you have to use
Storage Class to talk with other SCSI devices such as scanners, so that's
what I did in the past)

Now I want to write a WDF driver for this device. Can a WDF driver setup
the SRB and CDB for such a device? How do I get access to the CDB that is
built for each Irp from the Foundation?

(it just seems like the WDF would make my driver a lot simpler, handling a
lot of the 'boiler-plate' coding)

Thanks,

Mike


 
Reply With Quote
 
 
 
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      05-10-2010
KMDF does not natively format or understand CDBs and SRBs. KMDF will help
you with queueing incoming storage requests as well generically formatting
them/tracking sent requests though. you would still have the code in your
driver which formats the CDB/SRB data structure though.

d

--

This posting is provided "AS IS" with no warranties, and confers no rights.


"Mike Fochtman" <> wrote in message
news:8CC6FA03-4C3A-458C-A573-...
> I've got an old WDM driver for a SCSI device. This 'SCSI Processor'
> device
> needs exact CDB structure (6-byte CDB) to work. And that all worked under
> the WDM driver. (a note under WDM storage class drivers says you have to
> use
> Storage Class to talk with other SCSI devices such as scanners, so that's
> what I did in the past)
>
> Now I want to write a WDF driver for this device. Can a WDF driver setup
> the SRB and CDB for such a device? How do I get access to the CDB that is
> built for each Irp from the Foundation?
>
> (it just seems like the WDF would make my driver a lot simpler, handling a
> lot of the 'boiler-plate' coding)
>
> Thanks,
>
> Mike
>
>

 
Reply With Quote
 
Mike Fochtman
Guest
Posts: n/a

 
      05-10-2010


"Don Burn" wrote:

> My reading of your question is can WDF support a driver at the storage
> class layer, i.e. like the disk and tape, but in this case your scanner.


Yes, that's the idea. This device is very SCSI specific and I need to set
up the CDB length etc...

> The answer is yes, Microsoft did a talk on this at the last DDC see
> http://download.microsoft.com/downlo...681_ddc08.pptx
>


Thanks, I'll give that a good read through.

>
> Don Burn (MVP, Windows DKD)
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>
>
>
> > -----Original Message-----
> > From: Mike Fochtman [private.php?do=newpm&u=]
> > Posted At: Monday, May 10, 2010 11:52 AM
> > Posted To: microsoft.public.development.device.drivers
> > Conversation: WDF for Storage CLASS device
> > Subject: WDF for Storage CLASS device
> >
> > I've got an old WDM driver for a SCSI device. This 'SCSI Processor'
> > device
> > needs exact CDB structure (6-byte CDB) to work. And that all worked
> > under the
> > WDM driver. (a note under WDM storage class drivers says you have to
> > use
> > Storage Class to talk with other SCSI devices such as scanners, so
> > that's what
> > I did in the past)
> >
> > Now I want to write a WDF driver for this device. Can a WDF driver
> > setup the
> > SRB and CDB for such a device? How do I get access to the CDB that is
> > built
> > for each Irp from the Foundation?
> >
> > (it just seems like the WDF would make my driver a lot simpler, handling
> > a lot
> > of the 'boiler-plate' coding)
> >
> > Thanks,
> >
> > Mike
> >
> >
> >
> > __________ Information from ESET Smart Security, version of virus
> > signature
> > database 5102 (20100510) __________
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >

>
> .
>

 
Reply With Quote
 
Mike Fochtman
Guest
Posts: n/a

 
      06-01-2010
Sorry I didn't get back sooner...

I reviewed the presentation that Don had mentioned...
http://download.microsoft.com/downlo...681_ddc08.pptx

But it was a bit light on details.

Yes, I want to use the KMDF to handle some of the routine queing and Power
stuff and then have my driver custom format the CDBs and SRBs.

I'm trying to figure out how to get access to the IRP/SRB and CDB so I can
change them. Can I do that from the WDF Request object? Most of the samples
just use a Wdf format method and don't show how to access these structures.

Thanks,



"Doron Holan [MSFT]" wrote:

> KMDF does not natively format or understand CDBs and SRBs. KMDF will help
> you with queueing incoming storage requests as well generically formatting
> them/tracking sent requests though. you would still have the code in your
> driver which formats the CDB/SRB data structure though.
>
> d
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Mike Fochtman" <> wrote in message
> news:8CC6FA03-4C3A-458C-A573-...
> > I've got an old WDM driver for a SCSI device. This 'SCSI Processor'
> > device
> > needs exact CDB structure (6-byte CDB) to work. And that all worked under
> > the WDM driver. (a note under WDM storage class drivers says you have to
> > use
> > Storage Class to talk with other SCSI devices such as scanners, so that's
> > what I did in the past)
> >
> > Now I want to write a WDF driver for this device. Can a WDF driver setup
> > the SRB and CDB for such a device? How do I get access to the CDB that is
> > built for each Irp from the Foundation?
> >
> > (it just seems like the WDF would make my driver a lot simpler, handling a
> > lot of the 'boiler-plate' coding)
> >
> > Thanks,
> >
> > Mike
> >
> >

> .
>

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      06-01-2010
You can format it on your own using WdfRequestWdmFormatUsingStackLocation.
you can get the PIRP by calling WdfRequestWdmGetIrp

d

"Mike Fochtman" wrote in message
news:2A2B3B83-A878-4EE4-90C4-...

Sorry I didn't get back sooner...

I reviewed the presentation that Don had mentioned...
http://download.microsoft.com/downlo...681_ddc08.pptx

But it was a bit light on details.

Yes, I want to use the KMDF to handle some of the routine queing and Power
stuff and then have my driver custom format the CDBs and SRBs.

I'm trying to figure out how to get access to the IRP/SRB and CDB so I can
change them. Can I do that from the WDF Request object? Most of the
samples
just use a Wdf format method and don't show how to access these structures.

Thanks,



"Doron Holan [MSFT]" wrote:

> KMDF does not natively format or understand CDBs and SRBs. KMDF will help
> you with queueing incoming storage requests as well generically formatting
> them/tracking sent requests though. you would still have the code in your
> driver which formats the CDB/SRB data structure though.
>
> d
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "Mike Fochtman" <> wrote in message
> news:8CC6FA03-4C3A-458C-A573-...
> > I've got an old WDM driver for a SCSI device. This 'SCSI Processor'
> > device
> > needs exact CDB structure (6-byte CDB) to work. And that all worked
> > under
> > the WDM driver. (a note under WDM storage class drivers says you have
> > to
> > use
> > Storage Class to talk with other SCSI devices such as scanners, so
> > that's
> > what I did in the past)
> >
> > Now I want to write a WDF driver for this device. Can a WDF driver
> > setup
> > the SRB and CDB for such a device? How do I get access to the CDB that
> > is
> > built for each Irp from the Foundation?
> >
> > (it just seems like the WDF would make my driver a lot simpler, handling
> > a
> > lot of the 'boiler-plate' coding)
> >
> > Thanks,
> >
> > Mike
> >
> >

> .
>


 
Reply With Quote
 
Mike Fochtman
Guest
Posts: n/a

 
      06-03-2010
Well... not exactly what I want. Sorry I wasn't clear. I want to intercept
READ/WRITE, not DEVICECONTROL.

Under WDM, my driver was servicing IRP_MJ_READ and IRP_MJ_WRITE functions
and going into the CDB and changing the SCSIOP code to SEND and RECV (that's
the SCSI codes that the 'processor' SCSI device responded to). Then it would
change the CDB length to 6 bytes (again, that is what the SCSI device expects
instead of the 10 byte CDB that my driver would get from I/O manager. Then
it would simply send this on down the stack to the SCSI miniport driver,
which took and sent it out the SCSI bus to the device.

So the app would CreateFile() on the symbolic link for the device (created
during AddDevice()), then just WriteFile() or ReadFile() to send data to/from
the device.


So if I understand you and Doran, under WDF, I think I want to use EvtIoRead
and EvtIoWRite to intercept these requests. Then in each of these use
WdfRequestWdmGetIrp() to get the IRP from the WdfRequest object. Then I can
use GetCurrentStackLocation(), make my changes to the CDB, format the request
for the local io target using WdfRequestFormatUsingStackLocation(), then send
(synchronously) to the local I/O target.

Does this seem like the right idea for WDF given what I had done under WDM?
Does it make sense?

I'd really like to use WDF for all the 'boiler plate' PnP/Power code, even
the default Create/Close function calls so I can concentrate on just the code
for communicating with the device. But being new to WDF, I'm struggling.

Thanks to you and Doron Holan for your help.

Mike Fochtman


"Don Burn" wrote:

> Yes you can access them. IRP_MJ_SCSI is actually
> IRP_MJ_INTERNAL_DEVICE_CONTROL so set up a WDF driver to handle that call.
> You can find the information on how the data is organized by looking at
> the disk class driver in the WDK, this driver creates IRP_MJ_SCSI requests
> so is a good reference.
>
>
> Don Burn (MVP, Windows DKD)
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>
>
>
> > -----Original Message-----
> > From: Mike Fochtman [private.php?do=newpm&u=]
> > Posted At: Tuesday, June 01, 2010 11:32 AM
> > Posted To: microsoft.public.development.device.drivers
> > Conversation: WDF for Storage CLASS device
> > Subject: Re: WDF for Storage CLASS device
> >
> > Sorry I didn't get back sooner...
> >
> > I reviewed the presentation that Don had mentioned...
> > http://download.microsoft.com/downlo...26b-4cc3-a269-
> > abbbe427c0ef/dde-t681_ddc08.pptx
> >
> > But it was a bit light on details.
> >
> > Yes, I want to use the KMDF to handle some of the routine queing and
> > Power
> > stuff and then have my driver custom format the CDBs and SRBs.
> >
> > I'm trying to figure out how to get access to the IRP/SRB and CDB so I
> > can
> > change them. Can I do that from the WDF Request object? Most of the
> > samples
> > just use a Wdf format method and don't show how to access these
> > structures.
> >
> > Thanks,
> >
> >
> >
> > "Doron Holan [MSFT]" wrote:
> >
> > > KMDF does not natively format or understand CDBs and SRBs. KMDF will
> > > help you with queueing incoming storage requests as well generically
> > > formatting them/tracking sent requests though. you would still have
> > > the code in your driver which formats the CDB/SRB data structure
> > > though.
> > >
> > > d
> > >
> > > --
> > >
> > > This posting is provided "AS IS" with no warranties, and confers no
> > > rights.
> > >
> > >
> > > "Mike Fochtman" <> wrote in
> > > message news:8CC6FA03-4C3A-458C-A573-...
> > > > I've got an old WDM driver for a SCSI device. This 'SCSI Processor'
> > > > device
> > > > needs exact CDB structure (6-byte CDB) to work. And that all worked
> > > > under the WDM driver. (a note under WDM storage class drivers says
> > > > you have to use Storage Class to talk with other SCSI devices such
> > > > as scanners, so that's what I did in the past)
> > > >
> > > > Now I want to write a WDF driver for this device. Can a WDF driver
> > > > setup the SRB and CDB for such a device? How do I get access to the
> > > > CDB that is built for each Irp from the Foundation?
> > > >
> > > > (it just seems like the WDF would make my driver a lot simpler,
> > > > handling a lot of the 'boiler-plate' coding)
> > > >
> > > > Thanks,
> > > >
> > > > Mike
> > > >
> > > >
> > > .
> > >

> >
> >
> > __________ Information from ESET Smart Security, version of virus
> > signature
> > database 5163 (20100601) __________
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >

>
> .
>

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      06-03-2010
that makes sense. if you are just manipulating the CDB (vs using your own),
you can use WdfRequestFormatUsingCurrentType to do the equivalent of
IoCopyCurrentIrpStackLocationToNext

d

"Mike Fochtman" wrote in message
news:F98CCDD7-8CB8-4612-8847-...

Well... not exactly what I want. Sorry I wasn't clear. I want to intercept
READ/WRITE, not DEVICECONTROL.

Under WDM, my driver was servicing IRP_MJ_READ and IRP_MJ_WRITE functions
and going into the CDB and changing the SCSIOP code to SEND and RECV (that's
the SCSI codes that the 'processor' SCSI device responded to). Then it
would
change the CDB length to 6 bytes (again, that is what the SCSI device
expects
instead of the 10 byte CDB that my driver would get from I/O manager. Then
it would simply send this on down the stack to the SCSI miniport driver,
which took and sent it out the SCSI bus to the device.

So the app would CreateFile() on the symbolic link for the device (created
during AddDevice()), then just WriteFile() or ReadFile() to send data
to/from
the device.


So if I understand you and Doran, under WDF, I think I want to use EvtIoRead
and EvtIoWRite to intercept these requests. Then in each of these use
WdfRequestWdmGetIrp() to get the IRP from the WdfRequest object. Then I can
use GetCurrentStackLocation(), make my changes to the CDB, format the
request
for the local io target using WdfRequestFormatUsingStackLocation(), then
send
(synchronously) to the local I/O target.

Does this seem like the right idea for WDF given what I had done under WDM?
Does it make sense?

I'd really like to use WDF for all the 'boiler plate' PnP/Power code, even
the default Create/Close function calls so I can concentrate on just the
code
for communicating with the device. But being new to WDF, I'm struggling.

Thanks to you and Doron Holan for your help.

Mike Fochtman


"Don Burn" wrote:

> Yes you can access them. IRP_MJ_SCSI is actually
> IRP_MJ_INTERNAL_DEVICE_CONTROL so set up a WDF driver to handle that call.
> You can find the information on how the data is organized by looking at
> the disk class driver in the WDK, this driver creates IRP_MJ_SCSI requests
> so is a good reference.
>
>
> Don Burn (MVP, Windows DKD)
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>
>
>
> > -----Original Message-----
> > From: Mike Fochtman [private.php?do=newpm&u=]
> > Posted At: Tuesday, June 01, 2010 11:32 AM
> > Posted To: microsoft.public.development.device.drivers
> > Conversation: WDF for Storage CLASS device
> > Subject: Re: WDF for Storage CLASS device
> >
> > Sorry I didn't get back sooner...
> >
> > I reviewed the presentation that Don had mentioned...
> > http://download.microsoft.com/downlo...26b-4cc3-a269-
> > abbbe427c0ef/dde-t681_ddc08.pptx
> >
> > But it was a bit light on details.
> >
> > Yes, I want to use the KMDF to handle some of the routine queing and
> > Power
> > stuff and then have my driver custom format the CDBs and SRBs.
> >
> > I'm trying to figure out how to get access to the IRP/SRB and CDB so I
> > can
> > change them. Can I do that from the WDF Request object? Most of the
> > samples
> > just use a Wdf format method and don't show how to access these
> > structures.
> >
> > Thanks,
> >
> >
> >
> > "Doron Holan [MSFT]" wrote:
> >
> > > KMDF does not natively format or understand CDBs and SRBs. KMDF will
> > > help you with queueing incoming storage requests as well generically
> > > formatting them/tracking sent requests though. you would still have
> > > the code in your driver which formats the CDB/SRB data structure
> > > though.
> > >
> > > d
> > >
> > > --
> > >
> > > This posting is provided "AS IS" with no warranties, and confers no
> > > rights.
> > >
> > >
> > > "Mike Fochtman" <> wrote in
> > > message news:8CC6FA03-4C3A-458C-A573-...
> > > > I've got an old WDM driver for a SCSI device. This 'SCSI Processor'
> > > > device
> > > > needs exact CDB structure (6-byte CDB) to work. And that all worked
> > > > under the WDM driver. (a note under WDM storage class drivers says
> > > > you have to use Storage Class to talk with other SCSI devices such
> > > > as scanners, so that's what I did in the past)
> > > >
> > > > Now I want to write a WDF driver for this device. Can a WDF driver
> > > > setup the SRB and CDB for such a device? How do I get access to the
> > > > CDB that is built for each Irp from the Foundation?
> > > >
> > > > (it just seems like the WDF would make my driver a lot simpler,
> > > > handling a lot of the 'boiler-plate' coding)
> > > >
> > > > Thanks,
> > > >
> > > > Mike
> > > >
> > > >
> > > .
> > >

> >
> >
> > __________ Information from ESET Smart Security, version of virus
> > signature
> > database 5163 (20100601) __________
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >

>
> .
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to simulated a UVC device with DSF ? Windows Vista Drivers 1 10-23-2010 07:30 AM
active sync issue mk3100 patrick craig ActiveSync 0 01-15-2010 05:06 AM
WMDC not syncing Ben ActiveSync 19 04-25-2008 03:43 PM
My PnP Monitor is seen as Non PnP??? Colin Windows Vista Hardware 1 11-29-2007 05:01 PM
WMDC, Ipaq PPC2K3, Vista Jan, Philippe ActiveSync 8 06-28-2007 02:54 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59