From: gti4ever on
Hi,

I used CreateWdfFile() in my UMDF driver in order to create a file object
for my driver created request.

However, when I call Close() for that file object in my OnReleaseHardware(),
I always get the following exception in Windbg:

**** WUDF DriverStop - Internal error 0x400000000000000
**** in Host
****
d:\w7rtm\drivers\wdf\umdf\DriverHost\common\inc\private\TrackedObject.h:347(CTrackedObject::Release):
Dereference of destroyed object, Context Record: .cxr 0x000000000100EC40

I ended up commented out all the code and simple call CreateWdfFile() in my
device Configure() funtion and call Close() in my OnReleaseHardwar() function
and still got the same error!!

My code is pretty much the same as the one in Doron's blog:
http://blogs.msdn.com/888_umdf_4_you/archive/2007/04/13/2117342.aspx

Did I miss something? Or did I use the file object wrong?

Regards,

G.
From: Egidio [MSFT] on
Make sure:
- Make sure CreateWdfFile is successful
- Make sure you use the same handle in the close operation.
- Are you taking and releasing references on this object, make sure #addRef
== #releases.
- Experiment: try moving the close() in the same routine as CreateWdfFile(),
does it work?

Egi.

"gti4ever" <gti4ever(a)discussions.microsoft.com> wrote in message
news:81EA3850-C386-4BDD-AF52-85BDB792B7F0(a)microsoft.com...
> Hi,
>
> I used CreateWdfFile() in my UMDF driver in order to create a file object
> for my driver created request.
>
> However, when I call Close() for that file object in my
> OnReleaseHardware(),
> I always get the following exception in Windbg:
>
> **** WUDF DriverStop - Internal error 0x400000000000000
> **** in Host
> ****
> d:\w7rtm\drivers\wdf\umdf\DriverHost\common\inc\private\TrackedObject.h:347(CTrackedObject::Release):
> Dereference of destroyed object, Context Record: .cxr 0x000000000100EC40
>
> I ended up commented out all the code and simple call CreateWdfFile() in
> my
> device Configure() funtion and call Close() in my OnReleaseHardwar()
> function
> and still got the same error!!
>
> My code is pretty much the same as the one in Doron's blog:
> http://blogs.msdn.com/888_umdf_4_you/archive/2007/04/13/2117342.aspx
>
> Did I miss something? Or did I use the file object wrong?
>
> Regards,
>
> G.

From: Doron Holan [MSFT] on
that is pat's blog, not mine ;)

d

--

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


"Egidio [MSFT]" <egidio(a)online.microsoft.com> wrote in message
news:OMNusTi5KHA.348(a)TK2MSFTNGP02.phx.gbl...
> Make sure:
> - Make sure CreateWdfFile is successful
> - Make sure you use the same handle in the close operation.
> - Are you taking and releasing references on this object, make sure
> #addRef == #releases.
> - Experiment: try moving the close() in the same routine as
> CreateWdfFile(), does it work?
>
> Egi.
>
> "gti4ever" <gti4ever(a)discussions.microsoft.com> wrote in message
> news:81EA3850-C386-4BDD-AF52-85BDB792B7F0(a)microsoft.com...
>> Hi,
>>
>> I used CreateWdfFile() in my UMDF driver in order to create a file object
>> for my driver created request.
>>
>> However, when I call Close() for that file object in my
>> OnReleaseHardware(),
>> I always get the following exception in Windbg:
>>
>> **** WUDF DriverStop - Internal error 0x400000000000000
>> **** in Host
>> ****
>> d:\w7rtm\drivers\wdf\umdf\DriverHost\common\inc\private\TrackedObject.h:347(CTrackedObject::Release):
>> Dereference of destroyed object, Context Record: .cxr 0x000000000100EC40
>>
>> I ended up commented out all the code and simple call CreateWdfFile() in
>> my
>> device Configure() funtion and call Close() in my OnReleaseHardwar()
>> function
>> and still got the same error!!
>>
>> My code is pretty much the same as the one in Doron's blog:
>> http://blogs.msdn.com/888_umdf_4_you/archive/2007/04/13/2117342.aspx
>>
>> Did I miss something? Or did I use the file object wrong?
>>
>> Regards,
>>
>> G.
>
From: gti4ever on
I got it working by switching to CComPtr smart pointer and also put Close()
in the same routine.

Thanks for the suggestion.

G.

"Egidio [MSFT]" wrote:

> Make sure:
> - Make sure CreateWdfFile is successful
> - Make sure you use the same handle in the close operation.
> - Are you taking and releasing references on this object, make sure #addRef
> == #releases.
> - Experiment: try moving the close() in the same routine as CreateWdfFile(),
> does it work?
>
> Egi.
>

From: gti4ever on
Ah, sorry.

I got confused with Pat, Ilias and your blogs all the time.

G.

"Doron Holan [MSFT]" wrote:

> that is pat's blog, not mine ;)
>
> d