Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am getting a Blue Screen of death when running my application on Windows 7, 64-bit (x64). After debugging, I learned that the program sometimes crashes upon calling StretchBlt (member of CDC class). Something I saw on the blue screen:
win32k.sys
Dumping Physical Memory
PAGE_FAULT_IN_NONPAGED_AREA

When running the application without any other applications open, everything is fine. The application crashes only when certain other applications are open.

I used WinDbg and got the following:
PAGE_FAULT_IN_NONPAGED_AREA (50)
Invalid system memory was referenced. This cannot be protected by try-except,
it must be protected by a Probe. Typically the address is just plain bad or it
is pointing at freed memory.
Arguments:
Arg1: fffff900c4000020, memory referenced.
Arg2: 0000000000000000, value 0 = read operation, 1 = write operation.
Arg3: fffff960000f7e06, If non-zero, the instruction address which referenced the bad memory
address.
Arg4: 0000000000000002, (reserved)
Debugging Details:
------------------

Could not read faulting driver name
READ_ADDRESS: fffff900c4000020
FAULTING_IP:
win32k!GreGetSpoolMessage+84
fffff960`000f7e06 488b5220 mov rdx,qword ptr [rdx+20h]
MM_INTERNAL_CODE: 2
CUSTOMER_CRASH_COUNT: 1
DEFAULT_BUCKET_ID: VISTA_DRIVER_FAULT
BUGCHECK_STR: 0x50
CURRENT_IRQL: 0
LAST_CONTROL_TRANSFER: from fffff800029488f2 to fffff800028c9740
STACK_TEXT:
fffff880`043dc568 fffff800`029488f2 : 00000000`00000050 fffff900`c4000020 00000000`00000000 fffff880`043dc6d0 : nt!mbstowcs+0x3a
fffff880`043dc570 00000000`00000050 : fffff900`c4000020 00000000`00000000 fffff880`043dc6d0 00000000`00000002 : nt!IopDeleteLegacyKey+0x74
fffff880`043dc578 fffff900`c4000020 : 00000000`00000000 fffff880`043dc6d0 00000000`00000002 fffff960`002915b0 : 0x50
fffff880`043dc580 00000000`00000000 : fffff880`043dc6d0 00000000`00000002 fffff960`002915b0 00000000`00000ab8 : 0xfffff900`c4000020

STACK_COMMAND: .bugcheck ; kb
FOLLOWUP_IP:
win32k!GreGetSpoolMessage+84
fffff960`000f7e06 488b5220 mov rdx,qword ptr [rdx+20h]
SYMBOL_NAME: win32k!GreGetSpoolMessage+84
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: win32k
IMAGE_NAME: win32k.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 4c1c483f
FAILURE_BUCKET_ID: X64_0x50_win32k!GreGetSpoolMessage+84
BUCKET_ID: X64_0x50_win32k!GreGetSpoolMessage+84
Followup: MachineOwner

I tried:
kd>!pool fffff900c4000020

I got this:
The pool page you have specified is not in this dump.

Does anyone have any ideas?


Mike
Posted
Updated 21-Oct-10 10:53am
v8
Comments
mla154 6-Jun-12 16:35pm    
I found an answer here. Everything seems to work well with Windows 7.

http://www.codeproject.com/Tips/77955/GDI-Replacement-for-StretchBlt-With-Anti-Aliasing

Where did you get the device context from?
Does it work on other OSs like XP?
 
Share this answer
 
Comments
mla154 20-Oct-10 9:42am    
I'm getting the device context using CreateDC and I'm using CPrintDialog. Here is some code I use:

CDC dc;
CPrintDialog pd(false, 0 | 1048576 | 4);
DOCINFO di;
int nSize = sizeof(DOCINFO);

::ZeroMemory(&di, nSize);
di.cbSize = nSize;
di.lpszDocName = _T("");
pd.m_pd.Flags &= ~PD_SHOWHELP;
if (pd.DoModal() == IDCANCEL)
return;
DEVMODE *dm = pd.GetDevMode();
dc.CreateDC(pd.GetDriverName(), pd.GetDeviceName(), pd.GetPortName(), dm);
dc.StartDoc(&di);
:
:
dc.StretchBlt(...); //StrectchBlt has 10 parameters
:
:
dc.EndDoc();

Yes, it does work on XP and Vista. I'm wondering if this problem has something to do with Windows 7 being a 64 bit operating system.
Are you sure you're using CreateDC correctly? The first parameter should be a string with either DISPLAY or WINSPOOL.

CreateDC(_T("DISPLAY"), NULL, NULL, NULL)


Have a look at the link below for more info.


http://msdn.microsoft.com/en-us/library/dd183490%28VS.85%29.aspx[^]

Good luck!
 
Share this answer
 
Comments
mla154 20-Oct-10 13:26pm    
I am passing "winspool" (all lowercase) to the first parameter.
E.F. Nijboer 21-Oct-10 12:31pm    
Have a look here:
http://www.techreplies.com/drivers-43/problem-while-performing-stretchblt-hp-1010-a-746040/

as alternative:
http://www.archivum.info/microsoft.public.development.device.drivers/2008-05/00289/Re-Problem-while-performing-StretchBlt-on-HP-1010-HP-1018-HP-1020-and-HP-3050.html
Hi,

I am also getting a BSOD after the call StretchBlt when using CPrintDialog.
This happens only on Windows 7 32-bit, but not on XP and Vista too.
Any ideas are welcome.

Thanks.
 
Share this answer
 
Comments
mla154 6-Jun-12 16:37pm    
Try this:

http://www.codeproject.com/Tips/77955/GDI-Replacement-for-StretchBlt-With-Anti-Aliasing
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900