[NTDEV]Mirror driver issue.

Hi,
I have been assigned to write mirror driver for our product. For that I am
try to debug available WDK mirror driver to understand the mechanism but I
am facing few issues. Any help or suggestion will be greatly appreciable.

Errors are as below…

  1. Not able to load mirror.dll file (don;t know how to load it.). Tried to
    load with windbg but did not get success.
  2. All CreateDC() calls are failing with error code 1801. I have google the
    error code but could not found anything useful. Just for information I have
    logged-in as administrator so I have complete rights. It seems like kernel
    mode driver is not able to allocate memory and that is the reason it is not
    able to return valid handle.
  3. All ExtEscape calls are also failing.

Note:

  1. I have not changed single line. Driver is building with 0 error/ 0
    warning.
  2. Able to load .sys file using windbg.

Thanks in advance.
/sarbojit

Information missing from post:

  • WDK version
  • used WDK “build environment”
  • type of test platform

Please read and follow:
http://catb.org/esr/faqs/smart-questions.html

Have you tried the sample app ?
C:\WinDDK\7600.16385.0\src\video\displays\mirror\app
(where 7600.16385.0 is the driver kit version you are using)

Tim.

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Sarbojit Sarkar
Sent: 08 July 2010 13:49
To: Windows System Software Devs Interest List
Subject: [ntdev] [NTDEV]Mirror driver issue.

Hi,
I have been assigned to write mirror driver for our product. For that I am try to debug available WDK mirror driver to understand the mechanism but I am facing few issues. Any help or suggestion will be greatly appreciable.

Errors are as below…

  1. Not able to load mirror.dll file (don;t know how to load it.). Tried to load with windbg but did not get success.
  2. All CreateDC() calls are failing with error code 1801. I have google the error code but could not found anything useful. Just for information I have logged-in as administrator so I have complete rights. It seems like kernel mode driver is not able to allocate memory and that is the reason it is not able to return valid handle.
  3. All ExtEscape calls are also failing.

Note:

  1. I have not changed single line. Driver is building with 0 error/ 0 warning.
  2. Able to load .sys file using windbg.

Thanks in advance.
/sarbojit

— 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

Sarbojit Sarkar wrote:

I have been assigned to write mirror driver for our product.

What kind of product? This problem has been so well-solved by so many
people that it’s hard for me to understand what anyone could hope to
bring to this party that hasn’t already been done.

For that I am try to debug available WDK mirror driver to understand
the mechanism but I am facing few issues. Any help or suggestion will
be greatly appreciable.

Errors are as below…

  1. Not able to load mirror.dll file (don;t know how to load it.).
    Tried to load with windbg but did not get success.

Did you try following the directions in the HTML file in the mirror
driver sample source code? That’s why they wrote them.

  1. All CreateDC() calls are failing with error code 1801. I have
    google the error code but could not found anything useful. Just for
    information I have logged-in as administrator so I have complete
    rights. It seems like kernel mode driver is not able to allocate
    memory and that is the reason it is not able to return valid handle.

Did you try looking in winerror.h, where virtually all user-mode error
codes are defined? 1801 is ERROR_INVALID_PRINTER_NAME. The message is
a little bit misleading, because it applies to ALL GDI drivers
(printers, plotters, and displays). In 99% of cases, CreateDC is used
with printers, so that’s where the error focuses.

The executive summary is that it could not find your mirror driver by
that name.

  1. All ExtEscape calls are also failing.

Well, of course. If you can’t create the DC, then it should be very
clear that you can’t send requests to it.

Note:

  1. I have not changed single line. Driver is building with 0 error/ 0
    warning.
  2. Able to load .sys file using windbg.

You cannot use windbg to load .sys files. Can you be more specific
about what you actually did here? I suspect you have a huge
misunderstanding. Mirror drivers, like all display drivers, are
installed using an INF file. There is one in the sample source code.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Yes, I am using WinDDK’s latest version.
I am using executable file available in
WinDDK\7600.16385.0\src\video\displays\mirror\app folder. Where I saw
createDC() is failing with error code 1801 and all other errors those I have
mentioned in my first mail.

Platform is WInXP-32bit

@Hagen,

  • used WDK “build environment”
    Did you mean to say checked/ free version? If yes, I am using checked
    version because I want to debug complete driver stack.
    If no, please let me know how to check build enviorment.

/sarbojit

On Thu, Jul 8, 2010 at 6:49 PM, Tim Green wrote:

> Have you tried the sample app ?
>
> C:\WinDDK\7600.16385.0\src\video\displays\mirror\app
>
> (where 7600.16385.0 is the driver kit version you are using)
>
>
>
> Tim.
>
>
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Sarbojit Sarkar
> Sent: 08 July 2010 13:49
>
> To: Windows System Software Devs Interest List
> Subject: [ntdev] [NTDEV]Mirror driver issue.
>
>
>
> Hi,
>
> I have been assigned to write mirror driver for our product. For that I
> am try to debug available WDK mirror driver to understand the mechanism but
> I am facing few issues. Any help or suggestion will be greatly appreciable.
>
>
>
> Errors are as below…
>
> 1. Not able to load mirror.dll file (don;t know how to load it.). Tried to
> load with windbg but did not get success.
>
> 2. All CreateDC() calls are failing with error code 1801. I have google the
> error code but could not found anything useful. Just for information I have
> logged-in as administrator so I have complete rights. It seems like kernel
> mode driver is not able to allocate memory and that is the reason it is not
> able to return valid handle.
>
> 3. All ExtEscape calls are also failing.
>
>
>
> Note:
>
> 1. I have not changed single line. Driver is building with 0 error/ 0
> warning.
>
> 2. Able to load .sys file using windbg.
>
>
>
> Thanks in advance.
>
> /sarbojit
>
>
>
> — 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
>
> —
> 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
>

Technically your one rev back. WinDDK is now at 7600.16365.1.

Gary G. Little

H (952) 223-1349

C (952) 454-4629

xxxxx@comcast.net

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Sarbojit Sarkar
Sent: Thursday, July 08, 2010 11:55 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] [NTDEV]Mirror driver issue.

Yes, I am using WinDDK’s latest version.

I am using executable file available in
WinDDK\7600.16385.0\src\video\displays\mirror\app folder. Where I saw
createDC() is failing with error code 1801 and all other errors those I have
mentioned in my first mail.

Platform is WInXP-32bit

@Hagen,

  • used WDK “build environment”

Did you mean to say checked/ free version? If yes, I am using checked
version because I want to debug complete driver stack.

If no, please let me know how to check build enviorment.

/sarbojit

On Thu, Jul 8, 2010 at 6:49 PM, Tim Green wrote:

Have you tried the sample app ?

C:\WinDDK\7600.16385.0\src\video\displays\mirror\app

(where 7600.16385.0 is the driver kit version you are using)

Tim.

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Sarbojit Sarkar
Sent: 08 July 2010 13:49

To: Windows System Software Devs Interest List

Subject: [ntdev] [NTDEV]Mirror driver issue.

Hi,

I have been assigned to write mirror driver for our product. For that I am
try to debug available WDK mirror driver to understand the mechanism but I
am facing few issues. Any help or suggestion will be greatly appreciable.

Errors are as below…

1. Not able to load mirror.dll file (don;t know how to load it.). Tried to
load with windbg but did not get success.

2. All CreateDC() calls are failing with error code 1801. I have google the
error code but could not found anything useful. Just for information I have
logged-in as administrator so I have complete rights. It seems like kernel
mode driver is not able to allocate memory and that is the reason it is not
able to return valid handle.

3. All ExtEscape calls are also failing.

Note:

1. I have not changed single line. Driver is building with 0 error/ 0
warning.

2. Able to load .sys file using windbg.

Thanks in advance.

/sarbojit

— 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



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

— 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

Sorry!! I am using latest one only i.e. 7600.16365.1.

I have followed all instructions mentioned in HTML file but it is still
failing( createDC() call is failing).

>> 2. Able to load .sys file using windbg.
Here I meant to say that I can put break points in available functions in
.sys but not in .dll and that is the reason I have assumed that .dll might
not be loaded.
[I am new to this world and I am trying to learn the things, so some time terminology that I will use may confuse you. I am really sorry for that.]

Current problems are:

  1. CreateDC() call is failing with error code 1801 (“invalid printer name.”)
    But I have not clue what is wrong here. I have google and found it could
    happen if user has limited rights. But in my case I have logged in as
    administrator so I am having full rights.

  2. I am not able to debug functions available in .dll library.

Any help or any suggestions will greatly appreciable.

Thanks in advance.
/sarbojit

On Thu, Jul 8, 2010 at 11:41 PM, Gary G. Little wrote:

> Technically your one rev back. WinDDK is now at 7600.16365.1.
>
>
>
> Gary G. Little
>
> H (952) 223-1349
>
> C (952) 454-4629
>
> xxxxx@comcast.net
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Sarbojit Sarkar
> Sent: Thursday, July 08, 2010 11:55 AM
>
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] [NTDEV]Mirror driver issue.
>
>
>
> Yes, I am using WinDDK’s latest version.
>
> I am using executable file available in
> WinDDK\7600.16385.0\src\video\displays\mirror\app folder. Where I saw
> createDC() is failing with error code 1801 and all other errors those I have
> mentioned in my first mail.
>
>
> Platform is WInXP-32bit
>
>
>
> @Hagen,
>
> - used WDK “build environment”
>
> Did you mean to say checked/ free version? If yes, I am using checked
> version because I want to debug complete driver stack.
>
> If no, please let me know how to check build enviorment.
>
>
>
> /sarbojit
>
>
> On Thu, Jul 8, 2010 at 6:49 PM, Tim Green
> wrote:
>
> Have you tried the sample app ?
>
> C:\WinDDK\7600.16385.0\src\video\displays\mirror\app
>
> (where 7600.16385.0 is the driver kit version you are using)
>
>
>
> Tim.
>
>
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Sarbojit Sarkar
> Sent: 08 July 2010 13:49
>
>
> To: Windows System Software Devs Interest List
>
> Subject: [ntdev] [NTDEV]Mirror driver issue.
>
>
>
> Hi,
>
> I have been assigned to write mirror driver for our product. For that I
> am try to debug available WDK mirror driver to understand the mechanism but
> I am facing few issues. Any help or suggestion will be greatly appreciable.
>
>
>
> Errors are as below…
>
> 1. Not able to load mirror.dll file (don;t know how to load it.). Tried to
> load with windbg but did not get success.
>
> 2. All CreateDC() calls are failing with error code 1801. I have google the
> error code but could not found anything useful. Just for information I have
> logged-in as administrator so I have complete rights. It seems like kernel
> mode driver is not able to allocate memory and that is the reason it is not
> able to return valid handle.
>
> 3. All ExtEscape calls are also failing.
>
>
>
> Note:
>
> 1. I have not changed single line. Driver is building with 0 error/ 0
> warning.
>
> 2. Able to load .sys file using windbg.
>
>
>
> Thanks in advance.
>
> /sarbojit
>
>
>
> — 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
>
>
> —
>
> 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
>
>
> — 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
>
> —
> 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
>

>> - used WDK “build environment”

Did you mean to say checked/ free version? If yes, I am using checked
version because I want to debug complete driver stack.
If no, please let me know how to check build enviorment.

Ouch.

To build any driver with the WDK, the normal way is to open a command
line shell with all relevant variables set up properly:
“Start” -> “Program Files” -> “Windows Driver Kits” -> “WDK 7600.*” ->
“Build Environments” -> “” -> “”.

It can make a vast difference if you use “Win2000/ia32/free” or e.g.
“Win7/ia64/checked” build environments. Better get this sorted first.

Did you try to enumerate loaded modules with lmi command (I would also
.reload before executing lmi)? Assuming that your mirror display driver
is really loaded the most likely reason why you can’t put breakpoints in
it is that display drivers are living in session space (not global
kernel space) and you are not in the right context. So, without going
into much details, if you break into debugger you need to switch to the
session space that contains your driver. On XP you can look for some
session 0 process (!sprocess 0 0 csrss.exe) and switch to it with
.process command. Now you should be able to put breakpoints with ba e1
.

Btw. what is your target system? Remember that there might be some
problems with using XPDM drivers on Vista and higher systems. So I would
actually recommend to test it first on XP.

Kris

From: Sarbojit Sarkar [mailto:xxxxx@gmail.com]
Posted At: Friday, July 09, 2010 7:24 AM
Posted To: ntdev
Conversation: [NTDEV]Mirror driver issue.
Subject: Re: [NTDEV]Mirror driver issue.

Sorry!! I am using latest one only i.e. 7600.16365.1.

I have followed all instructions mentioned in HTML file but it is still
failing( createDC() call is failing).

>>> 2. Able to load .sys file using windbg.

Here I meant to say that I can put break points in available functions
in .sys but not in .dll and that is the reason I have assumed that .dll
might not be loaded.

[I am new to this world and I am trying to learn the things, so some<br>time terminology that I will use may confuse you. I am really sorry for<br>that.]

Current problems are:

1. CreateDC() call is failing with error code 1801 (“invalid printer
name.”) But I have not clue what is wrong here. I have google and found
it could happen if user has limited rights. But in my case I have logged
in as administrator so I am having full rights.

2. I am not able to debug functions available in .dll library.

Any help or any suggestions will greatly appreciable.

Thanks in advance.

/sarbojit

On Thu, Jul 8, 2010 at 11:41 PM, Gary G. Little
wrote:

Technically your one rev back. WinDDK is now at 7600.16365.1.

Gary G. Little

H (952) 223-1349

C (952) 454-4629

xxxxx@comcast.net

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Sarbojit Sarkar
Sent: Thursday, July 08, 2010 11:55 AM

To: Windows System Software Devs Interest List

Subject: Re: [ntdev] [NTDEV]Mirror driver issue.

Yes, I am using WinDDK’s latest version.

I am using executable file available in
WinDDK\7600.16385.0\src\video\displays\mirror\app folder. Where I saw
createDC() is failing with error code 1801 and all other errors those I
have mentioned in my first mail.

Platform is WInXP-32bit

@Hagen,

- used WDK “build environment”

Did you mean to say checked/ free version? If yes, I am using checked
version because I want to debug complete driver stack.

If no, please let me know how to check build enviorment.

/sarbojit

On Thu, Jul 8, 2010 at 6:49 PM, Tim Green
wrote:

Have you tried the sample app ?

C:\WinDDK\7600.16385.0\src\video\displays\mirror\app

(where 7600.16385.0 is the driver kit version you are using)

Tim.

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Sarbojit Sarkar
Sent: 08 July 2010 13:49

To: Windows System Software Devs Interest List

Subject: [ntdev] [NTDEV]Mirror driver issue.

Hi,

I have been assigned to write mirror driver for our product. For that
I am try to debug available WDK mirror driver to understand the
mechanism but I am facing few issues. Any help or suggestion will be
greatly appreciable.

Errors are as below…

1. Not able to load mirror.dll file (don;t know how to load it.). Tried
to load with windbg but did not get success.

2. All CreateDC() calls are failing with error code 1801. I have google
the error code but could not found anything useful. Just for information
I have logged-in as administrator so I have complete rights. It seems
like kernel mode driver is not able to allocate memory and that is the
reason it is not able to return valid handle.

3. All ExtEscape calls are also failing.

Note:

1. I have not changed single line. Driver is building with 0 error/ 0
warning.

2. Able to load .sys file using windbg.

Thanks in advance.

/sarbojit

— 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



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

— 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


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

Sarbojit Sarkar wrote:

I have followed all instructions mentioned in HTML file but it is
still failing( createDC() call is failing).

You should post the contents of the “Services” registry key for your
mirror driver, so we can see how you did the configuration.

>>> 2. Able to load .sys file using windbg.
Here I meant to say that I can put break points in available functions
in .sys but not in .dll and that is the reason I have assumed that
.dll might not be loaded.
[I am new to this world and I am trying to learn the things, so some time terminology that I will use may confuse you. I am really sorry for that.]

You can use the “lmf” command to look at the list of loaded modules.
Or, you can turn on View -> Verbose Output to have WinDbg print a
message every time a module loads.

Current problems are:

  1. CreateDC() call is failing with error code 1801 (“invalid printer
    name.”) But I have not clue what is wrong here. I have google and
    found it could happen if user has limited rights. But in my case I
    have logged in as administrator so I am having full rights.

It can also happen if you have a configuration problem, so that the
system simply does not see your driver.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.