From: J. Lourens J. on
Hi All,

I'm quite new to C/C++ let alone driver writing.
I've writtin some apps in Delphi, but when it comes to
screen capturing then delphi just doesn't cut it.

I've received a Windows 7 Beta key with WDK, WLK and SDK.
I've succesfully build the mirror driver sample.
The Installation wouldn't go first time, but with another tool
from the WDK (DevCon) I was able to install the driver.

So I tried to figure out how this works,
there's a test application with a few cmdline options.
ddmlapp.exe -e This attaches the driver
-d This disconnects
-t This starts a DrvBitBlt ( but I don't know what this
does )
-w This opens up a small window with a blue canvas

Could someone please tell me what steps I have to take,
to modify the sample mirror driver.
To make one whole screen capture and start tracking updates from there.

The goal is remote administration, but I don't know if this is the right way
to do it.
I hope some one can point me in the right direchtion.

Thanks before hand,
Jonathan Lourens
From: Tim Roberts on
J. Lourens <J. Lourens(a)discussions.microsoft.com> wrote:
>
>I'm quite new to C/C++ let alone driver writing.

Then you have made a poor choice. Display drivers are among the more
complicated of Windows drivers, difficult to write, difficult to debug, and
the mirror drivers are a poorly documented subclass.

>I've writtin some apps in Delphi, but when it comes to
>screen capturing then delphi just doesn't cut it.

What does that mean? C can't do any magic beyond what Delphi can do. They
both have access to the same APIs.

> -t This starts a DrvBitBlt ( but I don't know what this does )

Google is your friend. You will NEED to know that to write a mirror
driver.

>Could someone please tell me what steps I have to take,
>to modify the sample mirror driver.
>To make one whole screen capture and start tracking updates from there.

You don't do screen captures in a mirror driver. The mirror driver does
not have access to the primary display surface. Instead, it is expected to
do its own drawing, and maintain its own copy of the desktop in a bitmap.

>The goal is remote administration, but I don't know if this is the right way
>to do it.

This problem has already been solved innumerable times. Have you looked at
VNC and its variants (like www.uvnc.com)? You would be much better served
by finding a way to modify one of those, instead of starting over from
scratch. Many people have struggled for months and months to get a mirror
driver to do what you describe.
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: J. Lourens on
Dear Tim,

Thanks for your response, and you are right. C/C++ can't do any more magic
then Delphi they both access the same api's, only differnce is that Delphi
can only compile (PE) .exe or Dll. No driver writing in delphi.

I'm aware of the struggle and the part that it is not documented.
And although it's going to be very hard.
I would still like to gain this knowledge

I hope someone can explain the key asspects, of doing the drawing yourself.
And pointing me in the right direction.

I know google is my best friend but like you said, it is rarely documented.


All help is greatly appreciated,
Jonathan Lourens

"Tim Roberts" wrote:

> J. Lourens <J. Lourens(a)discussions.microsoft.com> wrote:
> >
> >I'm quite new to C/C++ let alone driver writing.
>
> Then you have made a poor choice. Display drivers are among the more
> complicated of Windows drivers, difficult to write, difficult to debug, and
> the mirror drivers are a poorly documented subclass.
>
> >I've writtin some apps in Delphi, but when it comes to
> >screen capturing then delphi just doesn't cut it.
>
> What does that mean? C can't do any magic beyond what Delphi can do. They
> both have access to the same APIs.
>
> > -t This starts a DrvBitBlt ( but I don't know what this does )
>
> Google is your friend. You will NEED to know that to write a mirror
> driver.
>
> >Could someone please tell me what steps I have to take,
> >to modify the sample mirror driver.
> >To make one whole screen capture and start tracking updates from there.
>
> You don't do screen captures in a mirror driver. The mirror driver does
> not have access to the primary display surface. Instead, it is expected to
> do its own drawing, and maintain its own copy of the desktop in a bitmap.
>
> >The goal is remote administration, but I don't know if this is the right way
> >to do it.
>
> This problem has already been solved innumerable times. Have you looked at
> VNC and its variants (like www.uvnc.com)? You would be much better served
> by finding a way to modify one of those, instead of starting over from
> scratch. Many people have struggled for months and months to get a mirror
> driver to do what you describe.
> --
> Tim Roberts, timr(a)probo.com
> Providenza & Boekelheide, Inc.
>
From: Tim Roberts on
J. Lourens <JLourens(a)discussions.microsoft.com> wrote:
>
>Thanks for your response, and you are right. C/C++ can't do any more magic
>then Delphi they both access the same api's, only differnce is that Delphi
>can only compile (PE) .exe or Dll. No driver writing in delphi.

That's patently untrue. A driver is a normal PE DLL. There is no
difference. Several people have ported the include files and written
kernel drivers in Delphi, although I wouldn't recommend it...

>I'm aware of the struggle and the part that it is not documented.
>And although it's going to be very hard.
>I would still like to gain this knowledge
>
>I hope someone can explain the key asspects, of doing the drawing yourself.
>And pointing me in the right direction.

Check the sample in the WDK. You can pass most of the drawing on to GDI,
so you don't actually have to manipulate the bitmap yourself very much,
although you will want to intercept most of the calls so you know when the
bitmap has changed.

I'm still strongly recommending that you take a good, close look at VNC and
UltraVNC to find a way to make it do what you need. Really.
--
Tim Roberts, timr(a)probo.com
Providenza & Boekelheide, Inc.
From: Jonathan Wilson on
Tim Roberts wrote:
> That's patently untrue. A driver is a normal PE DLL. There is no
> difference. Several people have ported the include files and written
> kernel drivers in Delphi, although I wouldn't recommend it...
You would also need to port or provide implementations of all the base
runtime library functions (in the System unit IIRC) that Delphi calls as a
result of language keywords, operators and other base things.