Usage scenarios of ZwMakeTemporaryObject

Hello everybody,

I was going through one of the functions, ZwMakeTemporaryObject, in the WDK documentation. I understood what it does. But i did not understand where it could be used?
Can anyone please tell me the usage scenario for this function?

Thanks,
Tushar.

xxxxx@gmail.com wrote:

Hello everybody,

I was going through one of the functions, ZwMakeTemporaryObject, in the WDK documentation. I understood what it does. But i did not understand where it could be used?
Can anyone please tell me the usage scenario for this function?

The typical driver does not use this function. I had to go look it up.

Objects are deleted when the last handle that refers to the object is
closed. Some kernel objects are created as “permanent”, which just
means they are created with one extra reference to the handle, so that
they survive even after the last open handle is closed. In order to
delete those objects, it is necessary to get rid of that extra
reference. That’s what ZwMakeTemporaryObject does. It removes the
extra reference, so that the next “close” really does delete it.

When there is a specific API to delete such an object, the code probably
looks like this:
ZwOpen…( &handle );
ZwMakeTemporaryObject( &handle … );
ZwClose( handle );


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

To destroy the named object.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hello everybody,
>
> I was going through one of the functions, ZwMakeTemporaryObject, in the WDK
documentation. I understood what it does. But i did not understand where it
could be used?
> Can anyone please tell me the usage scenario for this function?
>
> Thanks,
> Tushar.
>