Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > How can I check if the device object is valid?

Reply
Thread Tools Display Modes

How can I check if the device object is valid?

 
 
yang
Guest
Posts: n/a

 
      01-11-2006
I get the device object, the later, I want to check if it is valid. How can I
do?

Thanks!

yang
--
Help
 
Reply With Quote
 
 
 
 
Doron Holan [MS]
Guest
Posts: n/a

 
      01-11-2006
you don't. you have to assume it is valid. if you get the devobj, you can
always call ObReferenceObject on it to increment the ref count and call
ObDereferenceObject when you are done with it.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"yang" <> wrote in message
news:9AF11DB2-16CB-43CA-806C-...
>I get the device object, the later, I want to check if it is valid. How can
>I
> do?
>
> Thanks!
>
> yang
> --
> Help



 
Reply With Quote
 
Gary G. Little
Guest
Posts: n/a

 
      01-11-2006
Doron's right, mostly you simply assume what you have is a device object. If
you want to be paranoid about it you can check the sanity values of Type and
Size in the first two fields of the device object. However ... those are
opaque and are changeable with no thought of impact to your code.

Besides, an invalid device object becomes rather apparent rather fast. They
do not simply go stale with disuse. If you are concerned about it
"disappearing " before you use it, as Doron states, when you acquire it you
should be incrementing/decremeting it's reference count if your method of
acquisition and detaching does not do so.

--
The personal opinion of
Gary G. Litte

"yang" <> wrote in message
news:9AF11DB2-16CB-43CA-806C-...
>I get the device object, the later, I want to check if it is valid. How can
>I
> do?
>
> Thanks!
>
> yang
> --
> Help



 
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
OL2003: Recurring Appointments "object is not valid" on delete kmarlowe Windows Vista Mail 2 04-02-2007 08:44 PM
Getting the File Object and Device Object if Device Name is not kn Shankar Windows Vista Drivers 1 10-19-2005 12:25 AM
Getting File Object and Device Object without Device Name Shankar Windows Vista Drivers 2 10-17-2005 10:41 PM
How to put real device object into control object's device extensi Robert Windows Vista Drivers 1 06-14-2005 03:15 PM
How to get the lowest device object Xieshumin Windows Vista Drivers 1 07-31-2004 11:31 AM



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