From: Don Burn on 1 Jun 2010 11:39 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 [mailto:MikeFochtman(a)discussions.microsoft.com] > 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/download/d/1/d/d1dd7745-426b-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" <MikeFochtman(a)discussions.microsoft.com> wrote in > > message news:8CC6FA03-4C3A-458C-A573-64B9FCC0416B(a)microsoft.com... > > > 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 >
From: Doron Holan [MSFT] on 1 Jun 2010 12:48 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-FB06A9F190CA(a)microsoft.com... Sorry I didn't get back sooner... I reviewed the presentation that Don had mentioned... http://download.microsoft.com/download/d/1/d/d1dd7745-426b-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" <MikeFochtman(a)discussions.microsoft.com> wrote in message > news:8CC6FA03-4C3A-458C-A573-64B9FCC0416B(a)microsoft.com... > > 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 > > > > > . >
From: Mike Fochtman on 3 Jun 2010 12:55 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 [mailto:MikeFochtman(a)discussions.microsoft.com] > > 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/download/d/1/d/d1dd7745-426b-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" <MikeFochtman(a)discussions.microsoft.com> wrote in > > > message news:8CC6FA03-4C3A-458C-A573-64B9FCC0416B(a)microsoft.com... > > > > 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 > > > > . >
From: Doron Holan [MSFT] on 3 Jun 2010 14:36
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-40CC7C9CE41C(a)microsoft.com... 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 [mailto:MikeFochtman(a)discussions.microsoft.com] > > 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/download/d/1/d/d1dd7745-426b-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" <MikeFochtman(a)discussions.microsoft.com> wrote in > > > message news:8CC6FA03-4C3A-458C-A573-64B9FCC0416B(a)microsoft.com... > > > > 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 > > > > . > |