Hi,
How can I create multiple device objects in a wdm driver?
Hi,
How can I create multiple device objects in a wdm driver?
Use either IoCreateDevice() or IoCreateDeviceSecure().
MSDN.
I know about them. I didn’t know Is it necessary to write a bus driver or
not?
On Wed, Aug 13, 2014 at 11:02 AM, wrote:
> Use either IoCreateDevice() or IoCreateDeviceSecure().
> MSDN.
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>> I didn’t know Is it necessary to write a bus driver
Be specific why & for what you want to write a driver either bus or filter?
I want to have 4 device nodes. I think it is better to write one bus driver
and all 4 device nodes connected to this bus. Then for these 4 device nodes
I can write a function driver.
Is it right?
On Wed, Aug 13, 2014 at 12:07 PM, wrote:
> >> I didn’t know Is it necessary to write a bus driver
>
> Be specific why & for what you want to write a driver either bus or filter?
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Yes, it is better to do it this way.
The reason is that you have to consider the PnP/Power relationships: If you merely IoCreateDevice several Device Objects, how are they “accounted for” by the system? What would their PDO be? What Dev Node would represent them? If you’re answer is “Well, all N of these Device Objects are created as a result of being enumerated by one PDO” what you’re describing is essentially a bus driver, right? A “Parent” (that is the FDO for the enumerated PDO) and the “Children” N peers that “appear” as a result of the Parent starting.
It’s also *much* better to do it in WDF if at ALL possible. Writing a simple KMDF bus driver is a BREEZE. Writing a WDM bus driver pretty much sucks. Even if you’ve never used KMDf, trust me… it’ll take you less time to learn KMDF and write the driver then write the bus driver in WDM and get the PnP/Power handling right. Seriously.
Peter
OSR
@OSRDrivers
Thank you for attention.
Then do you mean it’s better to write function driver (KMDF) and bus driver
(wdm)?
So what’s the starting point for writing bus driver? I had a look at
toaster sample on win ddk 7.1 last day, I didn’t understand
exactly connecting between child devices an parent device.
For one thing, I’ve recently written wdm function driver for
root-enumerated my especial devices. If I write a bus driver, how can I
make this bus driver create 4 these especial devices? How bus driver manage
child devices?
Thank you again for the comments.
On Wed, Aug 13, 2014 at 4:55 PM, wrote:
>
>
> Yes, it is better to do it this way.
>
> The reason is that you have to consider the PnP/Power relationships: If
> you merely IoCreateDevice several Device Objects, how are they “accounted
> for” by the system? What would their PDO be? What Dev Node would represent
> them? If you’re answer is “Well, all N of these Device Objects are created
> as a result of being enumerated by one PDO” what you’re describing is
> essentially a bus driver, right? A “Parent” (that is the FDO for the
> enumerated PDO) and the “Children” N peers that “appear” as a result of the
> Parent starting.
>
> It’s also much better to do it in WDF if at ALL possible. Writing a
> simple KMDF bus driver is a BREEZE. Writing a WDM bus driver pretty much
> sucks. Even if you’ve never used KMDf, trust me… it’ll take you less
> time to learn KMDF and write the driver then write the bus driver in WDM
> and get the PnP/Power handling right. Seriously.
>
> Peter
> OSR
> @OSRDrivers
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
No, the bus driver should be KMDF. Still, why write a bus driver when you can just install 4 root enumerated devices and skip the added complexity of a bus driver? What bigger problem do you think you are solving?
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of elahe shekuhi
Sent: Wednesday, August 13, 2014 11:38 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Creating multiple device objects in a wdm driver
Thank you for attention.
Then do you mean it’s better to write function driver (KMDF) and bus driver (wdm)?
So what’s the starting point for writing bus driver? I had a look at toaster sample on win ddk 7.1 last day, I didn’t understand exactly connecting between child devices an parent device.
For one thing, I’ve recently written wdm function driver for root-enumerated my especial devices. If I write a bus driver, how can I make this bus driver create 4 these especial devices? How bus driver manage child devices?
Thank you again for the comments.
On Wed, Aug 13, 2014 at 4:55 PM, > wrote:
Yes, it is better to do it this way.
The reason is that you have to consider the PnP/Power relationships: If you merely IoCreateDevice several Device Objects, how are they “accounted for” by the system? What would their PDO be? What Dev Node would represent them? If you’re answer is “Well, all N of these Device Objects are created as a result of being enumerated by one PDO” what you’re describing is essentially a bus driver, right? A “Parent” (that is the FDO for the enumerated PDO) and the “Children” N peers that “appear” as a result of the Parent starting.
It’s also much better to do it in WDF if at ALL possible. Writing a simple KMDF bus driver is a BREEZE. Writing a WDM bus driver pretty much sucks. Even if you’ve never used KMDf, trust me… it’ll take you less time to learn KMDF and write the driver then write the bus driver in WDM and get the PnP/Power handling right. Seriously.
Peter
OSR
@OSRDrivers
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Hi Doron,
Thanks a lot for your attention.
I think it is more manageable than when there are 4 separated root
enumerated devices.
I want to connect these 4 devices with my especial physical hardware.
I don’t know how connection should be established and How can I keep track
when one of these devices is inserted or removed?
Thank you again for your helpful comments
On Thu, Aug 14, 2014 at 10:11 AM, Doron Holan
wrote:
> No, the bus driver should be KMDF. Still, why write a bus driver when
> you can just install 4 root enumerated devices and skip the added
> complexity of a bus driver? What bigger problem do you think you are
> solving?
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *elahe shekuhi
> Sent: Wednesday, August 13, 2014 11:38 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Creating multiple device objects in a wdm driver
>
>
>
> Thank you for attention.
>
>
>
> Then do you mean it’s better to write function driver (KMDF) and bus
> driver (wdm)?
>
> So what’s the starting point for writing bus driver? I had a look at
> toaster sample on win ddk 7.1 last day, I didn’t understand
> exactly connecting between child devices an parent device.
>
>
>
> For one thing, I’ve recently written wdm function driver for
> root-enumerated my especial devices. If I write a bus driver, how can I
> make this bus driver create 4 these especial devices? How bus driver manage
> child devices?
>
>
>
> Thank you again for the comments.
>
>
>
>
>
> On Wed, Aug 13, 2014 at 4:55 PM, wrote:
>
>
>
> Yes, it is better to do it this way.
>
> The reason is that you have to consider the PnP/Power relationships: If
> you merely IoCreateDevice several Device Objects, how are they “accounted
> for” by the system? What would their PDO be? What Dev Node would represent
> them? If you’re answer is “Well, all N of these Device Objects are created
> as a result of being enumerated by one PDO” what you’re describing is
> essentially a bus driver, right? A “Parent” (that is the FDO for the
> enumerated PDO) and the “Children” N peers that “appear” as a result of the
> Parent starting.
>
> It’s also much better to do it in WDF if at ALL possible. Writing a
> simple KMDF bus driver is a BREEZE. Writing a WDM bus driver pretty much
> sucks. Even if you’ve never used KMDf, trust me… it’ll take you less
> time to learn KMDF and write the driver then write the bus driver in WDM
> and get the PnP/Power handling right. Seriously.
>
> Peter
> OSR
> @OSRDrivers
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
>
> — NTDEV is sponsored by OSR Visit the list at:
> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
You never said you had real hardware. If you do, you want the driver associated with the HW to be a bus driver and create 4 pdos. This way each instance of your HW will have the 4 children
d
Bent from my phone
From: elahe shekuhimailto:xxxxx
Sent: ?8/?14/?2014 12:07 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: Re: [ntdev] Creating multiple device objects in a wdm driver
Hi Doron,
Thanks a lot for your attention.
I think it is more manageable than when there are 4 separated root enumerated devices.
I want to connect these 4 devices with my especial physical hardware. I don’t know how connection should be established and How can I keep track when one of these devices is inserted or removed?
Thank you again for your helpful comments
On Thu, Aug 14, 2014 at 10:11 AM, Doron Holan > wrote:
No, the bus driver should be KMDF. Still, why write a bus driver when you can just install 4 root enumerated devices and skip the added complexity of a bus driver? What bigger problem do you think you are solving?
From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of elahe shekuhi
Sent: Wednesday, August 13, 2014 11:38 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Creating multiple device objects in a wdm driver
Thank you for attention.
Then do you mean it’s better to write function driver (KMDF) and bus driver (wdm)?
So what’s the starting point for writing bus driver? I had a look at toaster sample on win ddk 7.1 last day, I didn’t understand exactly connecting between child devices an parent device.
For one thing, I’ve recently written wdm function driver for root-enumerated my especial devices. If I write a bus driver, how can I make this bus driver create 4 these especial devices? How bus driver manage child devices?
Thank you again for the comments.
On Wed, Aug 13, 2014 at 4:55 PM, > wrote:
Yes, it is better to do it this way.
The reason is that you have to consider the PnP/Power relationships: If you merely IoCreateDevice several Device Objects, how are they “accounted for” by the system? What would their PDO be? What Dev Node would represent them? If you’re answer is “Well, all N of these Device Objects are created as a result of being enumerated by one PDO” what you’re describing is essentially a bus driver, right? A “Parent” (that is the FDO for the enumerated PDO) and the “Children” N peers that “appear” as a result of the Parent starting.
It’s also much better to do it in WDF if at ALL possible. Writing a simple KMDF bus driver is a BREEZE. Writing a WDM bus driver pretty much sucks. Even if you’ve never used KMDf, trust me… it’ll take you less time to learn KMDF and write the driver then write the bus driver in WDM and get the PnP/Power handling right. Seriously.
Peter
OSR
@OSRDrivers
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>
Thanks a lot for your attention.
I have an USB device, I Don’t want to communicate with my device using the
driver.
The only thing I want is it seems like smart card reader. I mean when I
insert my device into USB
port one of my readers ( i.e virtual reader) showed smart card inserted.
Searching the web, I found “iKey driver” that is similar to I want. So,
must I have a bus driver?
On Thu, Aug 14, 2014 at 6:43 PM, Doron Holan
wrote:
> You never said you had real hardware. If you do, you want the driver
> associated with the HW to be a bus driver and create 4 pdos. This way each
> instance of your HW will have the 4 children
>
> d
>
> Bent from my phone
> ------------------------------
> From: elahe shekuhi
> Sent: 8/14/2014 12:07 AM
>
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Creating multiple device objects in a wdm driver
>
> Hi Doron,
>
> Thanks a lot for your attention.
>
> I think it is more manageable than when there are 4 separated root
> enumerated devices.
>
> I want to connect these 4 devices with my especial physical hardware.
> I don’t know how connection should be established and How can I keep track
> when one of these devices is inserted or removed?
>
> Thank you again for your helpful comments
>
>
> On Thu, Aug 14, 2014 at 10:11 AM, Doron Holan
> wrote:
>
>> No, the bus driver should be KMDF. Still, why write a bus driver when
>> you can just install 4 root enumerated devices and skip the added
>> complexity of a bus driver? What bigger problem do you think you are
>> solving?
>>
>>
>>
>> From: xxxxx@lists.osr.com [mailto:
>> xxxxx@lists.osr.com] *On Behalf Of *elahe shekuhi
>> Sent: Wednesday, August 13, 2014 11:38 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] Creating multiple device objects in a wdm driver
>>
>>
>>
>> Thank you for attention.
>>
>>
>>
>> Then do you mean it’s better to write function driver (KMDF) and bus
>> driver (wdm)?
>>
>> So what’s the starting point for writing bus driver? I had a look at
>> toaster sample on win ddk 7.1 last day, I didn’t understand
>> exactly connecting between child devices an parent device.
>>
>>
>>
>> For one thing, I’ve recently written wdm function driver for
>> root-enumerated my especial devices. If I write a bus driver, how can I
>> make this bus driver create 4 these especial devices? How bus driver manage
>> child devices?
>>
>>
>>
>> Thank you again for the comments.
>>
>>
>>
>>
>>
>> On Wed, Aug 13, 2014 at 4:55 PM, wrote:
>>
>>
>>
>> Yes, it is better to do it this way.
>>
>> The reason is that you have to consider the PnP/Power relationships: If
>> you merely IoCreateDevice several Device Objects, how are they “accounted
>> for” by the system? What would their PDO be? What Dev Node would represent
>> them? If you’re answer is “Well, all N of these Device Objects are created
>> as a result of being enumerated by one PDO” what you’re describing is
>> essentially a bus driver, right? A “Parent” (that is the FDO for the
>> enumerated PDO) and the “Children” N peers that “appear” as a result of the
>> Parent starting.
>>
>> It’s also much better to do it in WDF if at ALL possible. Writing a
>> simple KMDF bus driver is a BREEZE. Writing a WDM bus driver pretty much
>> sucks. Even if you’ve never used KMDf, trust me… it’ll take you less
>> time to learn KMDF and write the driver then write the bus driver in WDM
>> and get the PnP/Power handling right. Seriously.
>>
>> Peter
>> OSR
>> @OSRDrivers
>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>>
>> — NTDEV is sponsored by OSR Visit the list at:
>> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
>> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
>> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
>> the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
> — NTDEV is sponsored by OSR Visit the list at:
> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
So which is it, your device is somehow dependent on your specific hardware, or no your driver is just pure software and it doesn?t matter if your specific hardware is inserted or not?
It sounds like you have a piece of USB hardware, and you want your driver, which exposes smart card interfaces, to track the insertion and removal of your device?
It?s been about 15 years since I worked on Windows smart card drivers, but there is a specific framework for smart cards to have a vendor specific module to deal with the unique details of your hardware. The MSFT docs for all this seem to be at http://msdn.microsoft.com/en-us/library/windows/desktop/aa380142(v=vs.85).aspx
There is a difference between a smart card reader (a thing you plug into a USB port and has removable smart cards that have their own electrical and functional standards), and a smart card with connects to a computer via a smart card reader. Some devices combine both the reader and the smart card into a single device, like for example a USB crypto fob (the iKey is such a device). Code to support specific smart cards was just a DLL with specific COM interfaces (smart card service provider), and not a driver. The system includes support for smarts cards that conform to a specific standard. Some smart cards also have a number of proprietary operations, like for device configuration. For a merged reader/card gadget, I assume you may need to write both a reader driver and a provider DLL, although if you conform to the correct standard, you may be able to use a generic card provider. The OS also comes with a driver for a USB reader conforming to a specific standard, the site http://msdn.microsoft.com/en-us/library/windows/hardware/dn653571(v=vs.85).aspx has some details. If your device doesn?t conform to this standard, you might be able to create a translation driver that talks to your device on the bottom and looks like a standard reader on the top.
I think what you need to do is carefully understand what end user operations/APIs you want to support, and work backwards and understand what code is required to support that functionality. By end user operations, I mean things like using a smart card in place of login credentials, or using a smart card to supply SSL client authentication certificates, or using a smart card to support CryptoAPI/CNG API digital signature operations in the device (like with a private key that was generated in the device and can never be exported). The whole crypto subsystem was revamped with I believe the Vista release.
I?ve noticed there is often a gap between what I expect a smart card like device to do and what I would like it to do. For example, long ago I used to keep my code signing key on a USB fob gadget, and could point signtool to the certificates on my gadget. Last I tried, this device no longer worked, as the OS interfaces had changed or something, and the gadget vendor had not updated the drivers.
You might also look at the Win 8.1 virtual smart card functionality that uses a TPM, as an example of mapping between one device and a thing that functions like a smart card. It basically can create multiple virtual smart card readers with a permenantly inserted virtual smart card. I played with this a bit, and by setting a registry option, it supports importing a crypto certificate into the virtual smart card. I never got around to trying it, but it seemed like this may work as a secure store for code signing keys.
Jan
On Aug 14, 2014, at 10:32 AM, elahe shekuhi wrote:
> Thanks a lot for your attention.
>
> I have an USB device, I Don’t want to communicate with my device using the driver.
>
> The only thing I want is it seems like smart card reader. I mean when I insert my device into USB
> port one of my readers ( i.e virtual reader) showed smart card inserted.
>
> Searching the web, I found “iKey driver” that is similar to I want. So, must I have a bus driver?
>