No, making a copy of a pointer is not going to increment the objects
reference count. So only when you do an explict call that changes the
reference count do you need to worry.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
"Nikhil" <> wrote in message
news:AE9D47D4-62E9-4902-B3E1-...
> Hi,
>
> I am using IoGetDeviceObjectPointer() API to get handle to a named device
> object. In that call I am passing device object and file object as local
> variables (stack variables). Once IoGetDeviceObjectPointer() returns
> success, I am acquiring spin lock and copying those device object and file
> object to a permanent storage. My question is do I need to call
> ObDereferenceObject() for a stack variable which I passed in
> IoGetDeviceObjectPointer() API? I am calling
> ObDereferenceObject(FileObject)
> later on when I the close device stack.
>
> The code is something like this.
>
> Status = IoGetDeviceObject(xxx, xxx, &TempFO, &TempDO).
>
> if (NT_SUCCESS(Status) {
>
> Acquire spin lock;
>
> PermFO = TempFO;
> PermDO = TempDO;
>
> Release spin lock;
> }
>
> CloseStack() {
> ObDereferenceObject(PermFO);
> }
>
> My question is do I need to ObDereferenceObject(TempFO) somewhere in the
> code?????
>
> Thanks.
>
|