DDK Sample Mirror Driver surface management

Hello.
I have some questions / problems with the mirror driver sample from the
Windows DDK.
In DrvEnableSurface, the example mirror driver does the following call
sequence:
–snip–
mirrorsize = (ULONG)(sizeof(MIRRSURF) +
ppdev->lDeltaScreen * sizl.cy);
mirrsurf = (MIRRSURF *) EngAllocMem(FL_ZERO_MEMORY,
mirrorsize,
0x4D495252);
dhsurf = (DHSURF) mirrsurf;
hsurf = EngCreateDeviceSurface(dhsurf,
sizl,
ulBitmapType);
if (!EngAssociateSurface(hsurf, ppdev->hdevEng, flHooks))
–snip–

Question #1: Why is a video mirror driver, which is only supposed to work
on 2000 and XP, calling EngAssociateSurface instead of EngModifySurface? Is
this just a mistake in the DDK sample or is this the correct way for a
mirror driver is supposed to hook drawing calls on the main display
surface??? It’s also interesting because the DDK never talks about using
EngCreateDeviceSurface’s returned handle in EngAssociateSurface… in fact
it doesn’t say that you should use these two together at all… it’s like a
mix of the NT4/2000 ways of doing things…

Question #2: What exactly is EngAssociateSurface doing? In a normal driver
it would be associating a full screen-size surface to be the main display,
yet when we allocate memory, we only allocate enough to hold a MIRRSURF
struct, because ppdev->lDelta is always 0… We have no miniport to send
us modes in the mirror driver, so this member is never set (It’s hardcoded
to 0 in the InitPDEV function). And since I’m assuming that GDI doesn’t
draw directly onto our MIRRSURF or into non-existant space, what exactly
are we hooking calls to then?

Possible answer for Question #2:
I can call EngModifySurface, specifying NULL and 0 for pvScan0 and lDelta,
and it works exactly the same as EngAssociateSurface. GDI gives us back a
handle to a surface which is exactly the same surface that the main display
driver allocates/uses. Is this the way that we can gain access to the main
display (and everything that has been drawn onto it? even if it is in video
memory?)

Any thoughts / answers would be greatly appreciated…
Thanks,
sean


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> -----Original Message-----

From: xxxxx@stg.com [mailto:xxxxx@stg.com]
Sent: Thursday, November 29, 2001 3:01 AM
To: NT Developers Interest List
Subject: [ntdev] DDK Sample Mirror Driver surface management

Question #1: Why is a video mirror driver, which is only
supposed to work
on 2000 and XP, calling EngAssociateSurface instead of
EngModifySurface?

Display mirror driver architecture first appeared on NT4 SP3. As you
understand EngModifySurface did’t exist then. It became availbale since W2k.

Question #2: What exactly is EngAssociateSurface doing?
It just tells GDI that exact set of functions is implemented in the dispay
driver and they must be called to draw on that surface. If the surface is
DDB any other functions will be implemented trought that set. If the surface
is DIB, GDI can draw on that surface itself.


Bye,
SaB


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com