I found this thread very interesting and must say thank you for posting the
solution.
It seems a good way of transitioning between a Windows environment and “I’ve
got this very fast and cheap hardware on my desk that could do some
fantastic dedicated realtime stuff from time to time if only I could put
Windows on hold”. Then when it’s done you’re back in Windows.
I’d like to ask a couple of questions:
- Does it in fact it transition back to Windows ok or are the warnings that
it would screw up Windows screen handling true?
- Does it violate any Windows rules so this might break in a Windows update?
- Given that everything else is on hold, which I suppose would include power
and disk management etc, is there any possibility of hardware damage?
- Does anyone else see any major drawbacks to this?
Many thanks,
Mike
>>>>>>>>>>
----- Original Message -----
From: b@if0.com
To: Windows System Software Devs Interest List
Sent: Saturday, June 12, 2010 7:04 PM
Subject: RE:[ntdev] Write to screen inside kernel driver
SOLVED SOLVED SOLVED SOLVED SOLVED SOLVED SOLVED SOLVED SOLVED SOLVED
Dear Jan Bottorff, thank you very much for the DirectDraw idea.
I spent days on this, trying overlays etc, which wouldn’t work properly,
until I tried a different easier strategy allocating the whole screen as a
primary buffer. It took a long time as there is no decent documentation for
direct draw anymore.
Anyone who is interested in displaying graphics in Kernel mode by accessing
the display memory here it is:
(it’s in C, not C++)
a=DirectDrawCreateEx(NULL, (LPVOID *)&lpDD7, (LPVOID)&IID_IDirectDraw7,
NULL);
if FAILED(a) {ErrorPopup(a); return 0;}
a=IDirectDraw7_SetCooperativeLevel(lpDD7, hwnd, DDSCL_NORMAL);
if FAILED(a) {ErrorPopup(a); return 0;}
// primary surface: whole screen!
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_VIDEOMEMORY |
DDSCAPS_LOCALVIDMEM;
a=IDirectDraw7_CreateSurface(lpDD7, &ddsd, &videosurface, NULL);
if FAILED(a) {ErrorPopup(a); return 0;}
a=IDirectDrawSurface7_Lock(videosurface, NULL, &ddsd, DDLOCK_WRITEONLY |
DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, NULL);
if FAILED(a) {ErrorPopup(a); IDirectDraw7_Release(lpDD7); return 0;}
return ddsd.lpSurface; // video buffer addr
I passed the video buffer and all the other screen size parameters to my
driver via IOCTL, and now have a wonderful big animated progress bar moving,
I remembered my assembly direct screen writing days, made a great colourful
and animated progress bar in half day.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer