Re: trouble decoding managed call stack causing kernel complaint
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Mon, 29 Oct 2007 11:36:22 -0500
Second, as MSDN stated, the WPARAM and LPARAM of the WM_PAINT message is
not used. Where do you find the doc talks about them?
http://msdn2.microsoft.com/en-us/library/ms534901.aspx
The last paragraph "For some common controls, the default WM_PAINT message
processing checks the wParam parameter. If wParam is non-NULL, the control
assumes that the value is an HDC and paints using that device context."
The .NET Framework does this also, despite the language suggesting that
this behavior is only for common controls.
Got Spy++ running and it shows that WM_PAINT messages always have an "hdc:
00000000" (I assume that Spy++ is labelling wParam as "hdc" as it cracks
WM_PAINT).
So based on the .NET Framework code, viewed through Reflector, the bad HDC
must be returned from BeginPaint.
Except that I've just realized that the error doesn't occur during the call
to SelectPalette from inside Control.SetupPalette, but from the call in
Control.WmPaint to restore the palette.
Figured out how to use !DumpStackObjects (immediately after the return from
the complaining call to SelectPalette) to look into the PaintEventArgs, the
dc member matches the value in the error printed by SelectPalette, and it is
not a multiple of 4 (that is sufficient to make it an invalid handle,
right?).
I grabbed the address of the clipRect member of the PaintEventArgs and used
the memory window to view it -- is there a better way to view managed value
types? At any rate, all four 32-bit integers were zero.
.... ran some more, stopped on the call to Control.SetupPalette. Listed the
arguments. Ran again. The first call to SelectPalette went fine, the
second generated the complaint, yet the "bad handle" matched the argument to
Control.SetupPalette. Not sure why the same HDC would be good in one
SelectPalette and bad in the next (I can't see any way that EndPaint would
be called in between).
.
- Follow-Ups:
- Re: trouble decoding managed call stack causing kernel complaint
- From: "Jeffrey Tan[MSFT]"
- Re: trouble decoding managed call stack causing kernel complaint
- From: Ben Voigt [C++ MVP]
- Re: trouble decoding managed call stack causing kernel complaint
- References:
- trouble decoding managed call stack causing kernel complaint
- From: Ben Voigt [C++ MVP]
- Re: trouble decoding managed call stack causing kernel complaint
- From: Ben Voigt [C++ MVP]
- Re: trouble decoding managed call stack causing kernel complaint
- From: Ben Voigt [C++ MVP]
- Re: trouble decoding managed call stack causing kernel complaint
- From: "Jeffrey Tan[MSFT]"
- Re: trouble decoding managed call stack causing kernel complaint
- From: Ben Voigt [C++ MVP]
- trouble decoding managed call stack causing kernel complaint
- Prev by Date: Re: Problems using GetShortPathName
- Next by Date: Re: trouble decoding managed call stack causing kernel complaint
- Previous by thread: Re: trouble decoding managed call stack causing kernel complaint
- Next by thread: Re: trouble decoding managed call stack causing kernel complaint
- Index(es):
Relevant Pages
|