Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > How to check if WDF object handler is valid?

Reply
Thread Tools Display Modes

How to check if WDF object handler is valid?

 
 
Michal Jablonski
Guest
Posts: n/a

 
      06-01-2009
How can I check if the WDF object handler is valid or not ? For example I
want to call WdfObjectDelete but I'm not sure whether the object was
correctly initialized in a first place.
 
Reply With Quote
 
 
 
 
Maxim S. Shatskih
Guest
Posts: n/a

 
      06-01-2009
> How can I check if the WDF object handler is valid or not ? For example I
> want to call WdfObjectDelete but I'm not sure whether the object was
> correctly initialized in a first place.


You should not code this way, you should only call delete for the objects which are surely still alive.

--
Maxim S. Shatskih
Windows DDK MVP

http://www.storagecraft.com

 
Reply With Quote
 
Michal Jablonski
Guest
Posts: n/a

 
      06-02-2009

> You should not code this way, you should only call delete for the objects which are surely still alive.


Thanks for the answer, but it did not answered my query. Question is whether
there is any function/magic that validates the object handler. The story with
WdfObjectDelete was only an example (maybe not perfect indeed) for better
understanding what I am looking for.

Michal
 
Reply With Quote
 
Kumar Rajeev [MSFT]
Guest
Posts: n/a

 
      06-02-2009
KMDF DDIs only check for object handle to be non-NULL. As suggested by
previous poster, caller has to make sure that he doesn't pass an invalid
object to KMDF DDI.

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

"Michal Jablonski" <> wrote in
message news:F31FF294-C02F-4D57-BE3A-...
>
>> You should not code this way, you should only call delete for the objects
>> which are surely still alive.

>
> Thanks for the answer, but it did not answered my query. Question is
> whether
> there is any function/magic that validates the object handler. The story
> with
> WdfObjectDelete was only an example (maybe not perfect indeed) for better
> understanding what I am looking for.
>
> Michal


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

 
      06-02-2009
no, maxim's answer is correct. there is no "is this valid" API. even if
there was one, as soon as it returned, the answer could be wrong b/c someone
else would delete the object. you need to track enough state such that you
know in your driver if you have something valid or not

d

--

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


"Michal Jablonski" <> wrote in
message news:F31FF294-C02F-4D57-BE3A-...
>
>> You should not code this way, you should only call delete for the objects
>> which are surely still alive.

>
> Thanks for the answer, but it did not answered my query. Question is
> whether
> there is any function/magic that validates the object handler. The story
> with
> WdfObjectDelete was only an example (maybe not perfect indeed) for better
> understanding what I am looking for.
>
> Michal


 
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
Make Non Microsoft mail handler the default mail handler Eddie Windows Vista General Discussion 7 05-30-2007 12:06 AM
HowTo simply check if a given driver packge includes a valid WHQL/DTM .cat file? Nick Rivers Windows Vista Drivers 3 05-08-2007 01:33 PM
OL2003: Recurring Appointments "object is not valid" on delete kmarlowe Windows Vista Mail 2 04-02-2007 09:44 PM
How can I check if the device object is valid? yang Windows Vista Drivers 2 01-11-2006 03:21 PM
Getting File Object and Device Object without Device Name Shankar Windows Vista Drivers 2 10-17-2005 11:41 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