I’ve created a WDFTIMER and specified the device as the parent object. However, in the timer callback when I try to use WdfTimerGetParentObject() to get the device, it complains about not being able to convert a WDFOBJECT to a WDFDEVICE.
This is my first go-round with kernel-mode timers, so evidently I need to learn some fancy dancing to get at my device so I can get ahold of my device context.
Do I have to set the timer parent object to something other than the device, or is there a better way to get at my device using my WDFTIMER handle?
Thanks!
Is this a driver running in miniport mode? What is the callstack when you get this error?
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, February 27, 2008 3:49 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Regarding timers with device as parent objects
I’ve created a WDFTIMER and specified the device as the parent object. However, in the timer callback when I try to use WdfTimerGetParentObject() to get the device, it complains about not being able to convert a WDFOBJECT to a WDFDEVICE.
This is my first go-round with kernel-mode timers, so evidently I need to learn some fancy dancing to get at my device so I can get ahold of my device context.
Do I have to set the timer parent object to something other than the device, or is there a better way to get at my device using my WDFTIMER handle?
Thanks!
NTDEV is sponsored by OSR
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
It’s not a Miniport driver. Previously I must have overlooked the build log entry I needed. It appears as though I needed to typecast the WDFOBJECT to a WDFDEVICE object prior to assigning it.
The example I was working from had a queue object as the parent and they didn’t specifically cast the WDFOBJECT returned from WdfTimerGetParentObject either. Oh well.
Thanks for the quick reply though. The ‘regulars’ here are amazing, and I hate to wear-out my welcome with questions like these. Especially when my problem was a lack of patience.
Just so I am clear, this was a compiler error that you were seeing and not a runtime error. Is that right?
Thx
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, February 27, 2008 4:10 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Regarding timers with device as parent objects
It’s not a Miniport driver. Previously I must have overlooked the build log entry I needed. It appears as though I needed to typecast the WDFOBJECT to a WDFDEVICE object prior to assigning it.
The example I was working from had a queue object as the parent and they didn’t specifically cast the WDFOBJECT returned from WdfTimerGetParentObject either. Oh well.
Thanks for the quick reply though. The ‘regulars’ here are amazing, and I hate to wear-out my welcome with questions like these. Especially when my problem was a lack of patience.
NTDEV is sponsored by OSR
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
xxxxx@hotmail.com wrote:
It’s not a Miniport driver. Previously I must have overlooked the build log entry I needed. It appears as though I needed to typecast the WDFOBJECT to a WDFDEVICE object prior to assigning it.
C doesn’t care, and will allow a WDFOBJECT to be used anywhere a
WDFDEVICE (or any other descendant) is expected. C++ cares, and
requires a cast.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.