Why Failed on function call to DbgPrint in module NTOSKRNL.EXE

Hi

When i test NDISTest 6.0. My network driver fails one child job about
1c_kernelcalls. Failed logs as following:

Variation #6 Verifying calls made to NTOSKRNL.EXE
This comparison with NTOSKRNL.EXE is safe
FAILED: [20944] Failed on function call to DbgPrint in module
NTOSKRNL.EXE! This is a debug version of the driver.
This comparison with NTOSKRNL.EXE is safe
This comparison with NTOSKRNL.EXE is safe

It seems that DbgPrint is called in my driver during this test, but
actually i removed all DbgPrint functions from my driver.
Any suggestion?

Thanks
Annie

Dump / disassemble your driver to discover why DbgPrint is still referenced. The import stub was pulled in by something during the link operation. Perhaps you are linking a library that references DbgPrint() or a header file with a static/inline references it?

Good Luck,

Dave Cattley

Consulting Engineer

Systems Software Development

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of ANNIE LI
Sent: Friday, February 27, 2009 3:09 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Why Failed on function call to DbgPrint in module NTOSKRNL.EXE

Hi

When i test NDISTest 6.0. My network driver fails one child job about 1c_kernelcalls. Failed logs as following:

Variation #6 Verifying calls made to NTOSKRNL.EXE
This comparison with NTOSKRNL.EXE is safe
FAILED: [20944] Failed on function call to DbgPrint in module NTOSKRNL.EXE! This is a debug version of the driver.
This comparison with NTOSKRNL.EXE is safe
This comparison with NTOSKRNL.EXE is safe

It seems that DbgPrint is called in my driver during this test, but actually i removed all DbgPrint functions from my driver.
Any suggestion?

Thanks
Annie


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

Thanks for your information.

I detected only ntddk.h ndis.h included in my driver.

All lib linked to the driver are:

BufferOverflowK.lib
ntoskrnl.lib
hal.lib
wmilib.lib
ndis.lib
ntstrsafe.lib

I only find DbgPrint in ntoskrnl.lib and ntstrsafe.lib. In my opinion,
ntoskrnl.lib should have no problem. My doubt is whether ntstrsafe.lib
is safe or not? I use ntstrsafe.lib for RtlStringCbPrintfA. If it is
not safe, do i need to rewrite this function?

Thanks
Annie.

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

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of ANNIE LI
Sent: Saturday, February 28, 2009 4:47 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Why Failed on function call to DbgPrint
in module NTOSKRNL.EXE

I only find DbgPrint in ntoskrnl.lib and ntstrsafe.lib. In my
opinion,
ntoskrnl.lib should have no problem. My doubt is whether
ntstrsafe.lib
is safe or not? I use ntstrsafe.lib for RtlStringCbPrintfA. If it is
not safe, do i need to rewrite this function?

It depends how you define word ‘safe’ :wink: Using DbgPrint usually doesn’t
mean code is unsafe.

Do you really need ntstrsafe.lib? For XP and above drivers it shouldn’t
be necessary (see WDK docs) and drivers can use inline code from
ntstrsafe.h. Try to remove the library and make sure NTSTRSAFE_LIB
preprocessor symbols isn’t defined.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

Thanks.
My stupid fault! i link ntstrsafe.lib in my driver.
This failed job pass now after i remove it.

Thanks
Annie.

Ntstrsafe.lib should not contain any references to DbgPrint, are you sure this was the culprit?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of ANNIE LI
Sent: Saturday, February 28, 2009 12:18 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Why Failed on function call to DbgPrint in module NTOSKRNL.EXE

Thanks.
My stupid fault! i link ntstrsafe.lib in my driver.
This failed job pass now after i remove it.

Thanks
Annie.


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

I’m lazy to examine it right way but it contains string DbgPrint so I
presume it references it. WDK 7000, all library versions.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, March 02, 2009 11:25 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Failed on function call to DbgPrint
in module NTOSKRNL.EXE

Ntstrsafe.lib should not contain any references to DbgPrint,
are you sure this was the culprit?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of ANNIE LI
Sent: Saturday, February 28, 2009 12:18 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Why Failed on function call to DbgPrint
in module NTOSKRNL.EXE

Thanks.
My stupid fault! i link ntstrsafe.lib in my driver.
This failed job pass now after i remove it.

Thanks
Annie.


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

Found it. it is related to one of the OBJLIBFILES that is used to create ntstrsafe.lib (ntstrsafe.h has no explicit references to DbgPrint). I am looking at it further.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Monday, March 02, 2009 2:32 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Failed on function call to DbgPrint in module NTOSKRNL.EXE

I’m lazy to examine it right way but it contains string DbgPrint so I
presume it references it. WDK 7000, all library versions.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, March 02, 2009 11:25 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Why Failed on function call to DbgPrint
in module NTOSKRNL.EXE

Ntstrsafe.lib should not contain any references to DbgPrint,
are you sure this was the culprit?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of ANNIE LI
Sent: Saturday, February 28, 2009 12:18 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Why Failed on function call to DbgPrint
in module NTOSKRNL.EXE

Thanks.
My stupid fault! i link ntstrsafe.lib in my driver.
This failed job pass now after i remove it.

Thanks
Annie.


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

It does:

01C 00000000 UNDEF notype () External | DbgPrint

mm

Michal Vodicka wrote:

I’m lazy to examine it right way but it contains string DbgPrint so I
presume it references it. WDK 7000, all library versions.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
> Sent: Monday, March 02, 2009 11:25 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Why Failed on function call to DbgPrint
> in module NTOSKRNL.EXE
>
> Ntstrsafe.lib should not contain any references to DbgPrint,
> are you sure this was the culprit?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of ANNIE LI
> Sent: Saturday, February 28, 2009 12:18 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Why Failed on function call to DbgPrint
> in module NTOSKRNL.EXE
>
> Thanks.
> My stupid fault! i link ntstrsafe.lib in my driver.
> This failed job pass now after i remove it.
>
> Thanks
> Annie.
>
>
> —
> 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
>

This import started showing up on Vista’s version of ntstrsafe.lib, I am trying to see if I can get it removed …

Thx
d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Martin O’Brien
Sent: Monday, March 02, 2009 3:08 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Why Failed on function call to DbgPrint in module NTOSKRNL.EXE

It does:

01C 00000000 UNDEF notype () External | DbgPrint

mm

Michal Vodicka wrote:

I’m lazy to examine it right way but it contains string DbgPrint so I
presume it references it. WDK 7000, all library versions.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
> Sent: Monday, March 02, 2009 11:25 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Why Failed on function call to DbgPrint
> in module NTOSKRNL.EXE
>
> Ntstrsafe.lib should not contain any references to DbgPrint,
> are you sure this was the culprit?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of ANNIE LI
> Sent: Saturday, February 28, 2009 12:18 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Why Failed on function call to DbgPrint
> in module NTOSKRNL.EXE
>
> Thanks.
> My stupid fault! i link ntstrsafe.lib in my driver.
> This failed job pass now after i remove it.
>
> Thanks
> Annie.
>
>
> —
> 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

> Ntstrsafe.lib should not contain any references to DbgPrint, are you sure this was the culprit?

Yes, I am sure. After i remove Ntstrsafe.lib (only including
Ntstrsafe.h), this test case pass. It do not report any DbgPrint problem.

Thanks
Annie.