DrvCreateDeviceBitmap() Question

Hi,
I’ve been stuck on this problem for a little while and I don’t know
where else to turn.
I want my video driver to be able to create DIBs which GDI does all
the drawing on, and when ExtEscape is called on the HDC (with such a DIB
selected in) in user-mode, I want my DrvEscape function to be called
when it gets to the driver level.
Currently, I call EngCreateBitmap() from DrvCreateDeviceBitmap(). I
then call EngAssociateSurface() with no hooked functions (since I want
GDI to handle everything but Escape and Escape has no hook). This is
basically all. I return the HBITMAP returned from EngCreateBitmap().
Calling ExtEscape() does NOT call my DrvEscape(). I am sure I had this
working, but I changed something that had an impact and now it doesn’t.
Is what I’m trying to do possible? If so and you know how, could
explain what to do?
Also, if you can think of another way to get the SURFOBJ* given the
HDC, that would be helpful too because that is really the main reason
that I need to do this.
Thanks!

Erik

Hi,
I’ve been stuck on this problem for a little while and I don’t know
where else to turn.
I want my video driver to be able to create DIBs which GDI does all
the drawing on, and when ExtEscape is called on the HDC (with such a DIB
selected in) in user-mode, I want my DrvEscape function to be called
when it gets to the driver level.
Currently, I call EngCreateBitmap() from DrvCreateDeviceBitmap(). I
then call EngAssociateSurface() with no hooked functions (since I want
GDI to handle everything but Escape and Escape has no hook). This is
basically all. I return the HBITMAP returned from EngCreateBitmap().
Calling ExtEscape() does NOT call my DrvEscape(). I am sure I had this
working, but I changed something that had an impact and now it doesn’t.
Is what I’m trying to do possible? If so and you know how, could
explain what to do?
Also, if you can think of another way to get the SURFOBJ* given the
HDC, that would be helpful too because that is really the main reason
that I need to do this.
Thanks!

Erik

P.S. Sorry if HTML junk appears in the last post. I forgot to switch to
plain text before posting.

Erik,

make sure that you have { INDEX_DrvEscape, (PFN) DrvEscape }, defined in
your function list and the function DrvEscape will be called whenever
ExtEscape is called inside your user application. are you sure that your
mirror driver is being loaded? If my recollection serves, all ExtEscape
calls, even those destined for the original display driver, reach the mirror
driver. What are you going to do with the surface object when you get it?
DrvEscape copies memory from User mode and places it in kernel mode and will
do the reverse as well.

Jeff

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Shaw, Erik (Xetron)
Sent: Wednesday, July 27, 2005 11:26 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] DrvCreateDeviceBitmap() Question

Hi,
I’ve been stuck on this problem for a little while and I don’t know where
else to turn.
I want my video driver to be able to create DIBs which GDI does all the
drawing on, and when ExtEscape is called on the HDC (with such a DIB
selected in) in user-mode, I want my DrvEscape function to be called when it
gets to the driver level.
Currently, I call EngCreateBitmap() from DrvCreateDeviceBitmap(). I then
call EngAssociateSurface() with no hooked functions (since I want GDI to
handle everything but Escape and Escape has no hook). This is basically all.
I return the HBITMAP returned from EngCreateBitmap(). Calling ExtEscape()
does NOT call my DrvEscape(). I am sure I had this working, but I changed
something that had an impact and now it doesn’t.
Is what I’m trying to do possible? If so and you know how, could explain
what to do?
Also, if you can think of another way to get the SURFOBJ* given the HDC,
that would be helpful too because that is really the main reason that I need
to do this.
Thanks!
Erik


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Jeff,
I do have the functions defined and DrvEscape is called for my surface
when ExtEscape is called in user-mode for the surface’s HDC. I also
wanted to create a bitmap in my driver that would be using the same
interface.
I was just going to use DrvEscape to get the SURFOBJ* to the bitmap and
then replace the destination surface from each DrvXxx call seen in the
mirror driver with the SURFOBJ* for my bitmap, then call the related
EngXxx command. In this way the exact same image that is drawn on the
screen will be drawn to my bitmap.
Obviously, there is more difficulty involved in splitting this into a
client and server (including recreating the objects referenced by some
of the parameters on the client machine), but I think that this will be
doable and hopefully cut down on the network traffic that would result
from sending JPEGs of the screen change rectangles each time.
What do you think?

Erik

Date: Wed, 27 Jul 2005 11:42:43 -0400
From: “Jeffery Frazier”
> Subject: RE: DrvCreateDeviceBitmap() Question
>
> Erik,
>
> make sure that you have { INDEX_DrvEscape, (PFN) DrvEscape }, defined
in your function list and the function DrvEscape will be called whenever
ExtEscape > is called inside your user application. are you sure that
your mirror driver is being loaded? If my recollection serves, all
ExtEscape calls, even
> those destined for the original display driver, reach the mirror
driver. What are you going to do with the surface object when you get
it?
> DrvEscape copies memory from User mode and places it in kernel mode
and will do the reverse as well.
>
> Jeff

Erik,

Actually I don’t think DrvEscape will be called with a device bitmap. If
you only want to get the changes, you are going to have to know when and
where a drawing call is made, so you will have to hook all of the drawing
functions in the mirror driver. In each of these functions, you will have
to write this change information to some buffer that can then be polled in
user mode. Is this what you want to do? It seems like you want two
different mutually exclusive things: access to the bitmap at all times and
only wanting the changes to be sent. Which one are you actually wanting to
do?

Jeff

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Shaw, Erik (Xetron)
Sent: Thursday, July 28, 2005 10:29 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] DrvCreateDeviceBitmap() Question

Hi Jeff,
I do have the functions defined and DrvEscape is called for my surface when
ExtEscape is called in user-mode for the surface’s HDC. I also wanted to
create a bitmap in my driver that would be using the same interface.
I was just going to use DrvEscape to get the SURFOBJ* to the bitmap and
then replace the destination surface from each DrvXxx call seen in the
mirror driver with the SURFOBJ* for my bitmap, then call the related EngXxx
command. In this way the exact same image that is drawn on the screen will
be drawn to my bitmap.
Obviously, there is more difficulty involved in splitting this into a
client and server (including recreating the objects referenced by some of
the parameters on the client machine), but I think that this will be doable
and hopefully cut down on the network traffic that would result from sending
JPEGs of the screen change rectangles each time.
What do you think?
Erik

Date: Wed, 27 Jul 2005 11:42:43 -0400
From: “Jeffery Frazier”
> Subject: RE: DrvCreateDeviceBitmap() Question
>
> Erik,
>
> make sure that you have { INDEX_DrvEscape, (PFN) DrvEscape }, defined in
your function list and the function DrvEscape will be called whenever
ExtEscape > is called inside your user application. are you sure that your
mirror driver is being loaded? If my recollection serves, all ExtEscape
calls, even
> those destined for the original display driver, reach the mirror driver.
What are you going to do with the surface object when you get it?
> DrvEscape copies memory from User mode and places it in kernel mode and
will do the reverse as well.
>
> Jeff


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Jeff,
I guess I should have stated that this is two different drivers. The
mirror driver on the server would collect these rendering commands,
write them to a user-mode buffer, and this would be polled from a
service that would send them out over the network as you said.
On the client side, another driver would need to exist since I don’t
have access to the EngXxx functions from user-mode (also see note
below), I wanted to use DrvEscape on a bitmap in this driver (call it
the rendering driver) so that I could invoke GDI to actually make these
calls. If you are pretty sure DrvEscape won’t be called on even a Device
bitmap, then I suppose I could figure out a way to just draw to the
driver’s actual surface. I wasn’t planning on using the surface at all,
I just figured it may be easier to use a bitmap.
So do you think this design is really going to improve network traffic
over sending the already-drawn screen change rectangles themselves? Do
you think it is feasible?

Erik

Note: I found that some EngXxx functions ARE exported from GDI32.dll
with the same names and parameter numbers, however, they take different
parameter types that don’t seem to be available outside of Microsoft.
These must be for user-mode video drivers or something? This isn’t
something I knew existed.


X-Message-Number: 25
X-lyris-Id: 78382
Date: Thu, 28 Jul 2005 11:23:43 -0400
From: “Jeffery Frazier”
Subject: RE: DrvCreateDeviceBitmap() Question

Erik,

Actually I don’t think DrvEscape will be called with a device bitmap.
If
you only want to get the changes, you are going to have to know when and
where a drawing call is made, so you will have to hook all of the
drawing
functions in the mirror driver. In each of these functions, you will
have
to write this change information to some buffer that can then be polled
in
user mode. Is this what you want to do? It seems like you want two
different mutually exclusive things: access to the bitmap at all times
and
only wanting the changes to be sent. Which one are you actually wanting
to
do?

Jeff

Erik

Erik,

I don’t think that there is anything known as a user mode video driver. You
don’t need a driver on the client machine, you can just draw in any window
since you have the bitmaps. What I have read is that tracking the changes
is the best way to go. If you are going to do this, implement all of the
drawing operations and write the changes to a buffer, the user mode
application on the server would take the screen changes and encode them and
send them through the wire. You may be able to get a DrvEscape through a
device bitmap since its type is HDC in user mode, but it isn’t going to buy
you anything if you are trying to track the changes only.

If you want to track changes you must implement:
DrvAlphaBlend
DrvBitBlt
DrvCopyBits
DrvFillPath
DrvGradientFill
DrvLineTo
DrvPlgBlt
DrvStretchBlt
DrvStretchBltROP
DrvStrokeAndFillPath
DrvStrokePath
DrvTextOut
DrvTransparentBlt

for each of these functions, punt back to the GDI. Then in the updated
rectangle in the main surface, psoDest, copy the area that is updated into
the buffer that you have allocated to store the drawing commands.

Hope this helps,

Jeff

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Shaw, Erik (Xetron)
Sent: Thursday, July 28, 2005 1:41 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] DrvCreateDeviceBitmap() Question

Jeff,
I guess I should have stated that this is two different drivers. The
mirror driver on the server would collect these rendering commands, write
them to a user-mode buffer, and this would be polled from a service that
would send them out over the network as you said.
On the client side, another driver would need to exist since I don’t have
access to the EngXxx functions from user-mode (also see note below), I
wanted to use DrvEscape on a bitmap in this driver (call it the rendering
driver) so that I could invoke GDI to actually make these calls. If you are
pretty sure DrvEscape won’t be called on even a Device bitmap, then I
suppose I could figure out a way to just draw to the driver’s actual
surface. I wasn’t planning on using the surface at all, I just figured it
may be easier to use a bitmap.
So do you think this design is really going to improve network traffic
over sending the already-drawn screen change rectangles themselves? Do you
think it is feasible?
Erik

Note: I found that some EngXxx functions ARE exported from GDI32.dll with
the same names and parameter numbers, however, they take different parameter
types that don’t seem to be available outside of Microsoft. These must be
for user-mode video drivers or something? This isn’t something I knew
existed.


X-Message-Number: 25
X-lyris-Id: 78382
Date: Thu, 28 Jul 2005 11:23:43 -0400
From: “Jeffery Frazier”
Subject: RE: DrvCreateDeviceBitmap() Question
Erik,
Actually I don’t think DrvEscape will be called with a device bitmap. If
you only want to get the changes, you are going to have to know when and
where a drawing call is made, so you will have to hook all of the drawing
functions in the mirror driver. In each of these functions, you will have
to write this change information to some buffer that can then be polled in
user mode. Is this what you want to do? It seems like you want two
different mutually exclusive things: access to the bitmap at all times and
only wanting the changes to be sent. Which one are you actually wanting to
do?
Jeff

Erik


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com