Outside of debugging, the instantaneous reference count is worthless,
because it is not stable with respect to synchronization. And, the only
thing that you should be doing to a reference count is raising or lowering
it.
I do agree with your list of fallbacks. I’m not saying that undocumented
calls or structures should never be used – only that they should be a last
resort, and that the developer has a responsibility to mitigate the damage
this could cause.
– arlie
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tony Mason
Sent: Monday, August 08, 2005 2:40 PM
To: Windows System Software Devs Interest List
Subject: SPAM-LOW: RE: [ntdev] Referencing a RegKey Object from handle
Not everything. For example, the reference count on the object is not
available. The usual trick I’ve seen used is to call
ObReferenceObject/ObDereferenceObject, which are documented as VOID
functions in the DDK but actually return LONG_PTR values (side note: I
actually logged a bug against the DDK documentation and was told that they
wouldn’t fix it because the developer didn’t want to tell people what the
meaning of the values returned by these functions was!)
Sometimes some of this information is obscured and results in bugs, which is
not a good thing (but not justification for using undocumented features).
For example, a general rule here is that inside a filter you should NOT call
ObReferenceObject and ObDereferenceObject in the IRP_MJ_CLEANUP handler
before passing the request to the underlying driver - that triggers the
IRP_MJ_CLOSE call!
But the bottom line is: if you can do it in a documented and supported
fashion, do it that way. If you have no choice, log a bug. If you
can’t wait for a bug fix, fix it and make damned sure you handle the failure
case gracefully (refuse to load, disable your functionality, log a nice
message, send an e-mail to yourself, whatever…)
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Arlie Davis
Sent: Monday, August 08, 2005 2:30 PM
To: ntdev redirect
Subject: Re:[ntdev] Referencing a RegKey Object from handle
But not zero, and you provide absolutely no protection for your clients
if/when the change does occur.
And again, you have not provided any evidence that you *need* direct access
to the object header. Everything in object header is exposed through
documented, supported APIs, all of which give an indication of what sort of
semantic change you want to occur (such as changing the reference count on
an object).
Do you think data encapsulation is a bad thing? Should the DDK just be a
list of #defines of variable addresses?
– arlie
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Monday, August 08, 2005 2:15 PM
To: Windows System Software Devs Interest List
Subject: SPAM-LOW: Re: Re:[ntdev] Referencing a RegKey Object from handle
Any chances that OBJECT_HEADER will change? Very, very minor.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@osr.com To unsubscribe send
a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com