Compiler error with DbgPrint

Hi,

The win2k ddk comes with a sample called initio under
ntddk\src\storage\miniport. When I added the debug command DbgPrint or
KdPrint , the compiler is giving the following error:

D:\NTDDK\src\storage\miniport\initio>build -ceZ
BUILD: Object root set to: ==> objchk
BUILD: /i switch ignored
BUILD: Compile and Link for i386
BUILD: Compiling d:\ntddk\src\storage\miniport\initio directory
Compiling - ini910u.rc for i386
Compiling - ini910u.c for i386
ini910u.c(2662) : error C4013: ‘DbgPrint’ undefined; assuming extern
returning int
BUILD: Compile errors: not linking d:\ntddk\src\storage\miniport\initio
directory
BUILD: Done

2 files compiled - 1 Error

Do I have to use only DebugPrint for miniport drivers?. I tried that also.
The build is successful but the message from debugprint is not displayed
in debugview program.

Could you tell me how I can use DbgPrint in miniport driver or how to get
debug messages in miniport driver?

Thanks
Aru

“ScsiDebugPrint” ( or “DebugPrint” ) should be used ! It could be that a
centralized “debuglevel” has to be adapted in the registry or somewhere
else. If you add the line

unsigned long _cdecl DbgPrint ( char * Format, … );

at the top of the “ini910u.c”, you will be able to compile, link and trace
debugging at once.

Make sure you are in the checked build environment. Also, make sure you
have included a header (i.e. wdm.h or ntddk.h) which contains the
declaration for the DbgPrint function.

“Aru” wrote in message news:xxxxx@ntdev…
>
> Hi,
>
> The win2k ddk comes with a sample called initio under
> ntddk\src\storage\miniport. When I added the debug command DbgPrint or
> KdPrint , the compiler is giving the following error:
>
> D:\NTDDK\src\storage\miniport\initio>build -ceZ
> BUILD: Object root set to: ==> objchk
> BUILD: /i switch ignored
> BUILD: Compile and Link for i386
> BUILD: Compiling d:\ntddk\src\storage\miniport\initio directory
> Compiling - ini910u.rc for i386
> Compiling - ini910u.c for i386
> ini910u.c(2662) : error C4013: ‘DbgPrint’ undefined; assuming extern
> returning int
> BUILD: Compile errors: not linking d:\ntddk\src\storage\miniport\initio
> directory
> BUILD: Done
>
> 2 files compiled - 1 Error
>
> Do I have to use only DebugPrint for miniport drivers?. I tried that also.
> The build is successful but the message from debugprint is not displayed
> in debugview program.
>
> Could you tell me how I can use DbgPrint in miniport driver or how to get
> debug messages in miniport driver?
>
> Thanks
> Aru
>
>

Del,

Be careful. None of the “miniport” samples ( storage , video ) include
“ntddk.h” or wdm.h. They include “miniport.h” and maybe they is a reason
for that.

Use ScsiDebugPrint for scsi miniport drivers. However, I have never
gotten that to work as I wanted it to, and in fact I think that in w2k
at least it didn’t work at all.

Instead I use a very simple library that includes either wdm.h or
ntddk.h and provides wrappers for the core nt ddk functions that are not
included in the scsiport api and *ARE* legal to call at raised IRQL (and
generally at DIRQL.) I then link my miniport drivers to this library,
and everyone is happy, happy, happy. This approach sort of violates the
spirit of the scsiport api (you might lose portability to windos9x,) but
like who cares?

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Christiaan Ghijselinck”
To: “NT Developers Interest List”
Date: Mon, 18 Nov 2002 16:42:01 -0500
Subject: [ntdev] Re: Compiler error with DbgPrint

>
> Del,
>
> Be careful. None of the “miniport” samples ( storage , video ) include
> “ntddk.h” or wdm.h. They include “miniport.h” and maybe they is a
> reason
> for that.
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to %%email.unsub%%

you also lose the ability to load your miniport in the boot loader or
for crashdump if you use functions outside of the scsiport API.

-p

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Monday, November 18, 2002 2:00 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Compiler error with DbgPrint

Use ScsiDebugPrint for scsi miniport drivers. However, I have never
gotten that to work as I wanted it to, and in fact I think that in w2k
at least it didn’t work at all.

Instead I use a very simple library that includes either wdm.h or
ntddk.h and provides wrappers for the core nt ddk functions that are not

included in the scsiport api and *ARE* legal to call at raised IRQL (and

generally at DIRQL.) I then link my miniport drivers to this library,
and everyone is happy, happy, happy. This approach sort of violates the
spirit of the scsiport api (you might lose portability to windos9x,) but

like who cares?

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Christiaan Ghijselinck”
To: “NT Developers Interest List”
Date: Mon, 18 Nov 2002 16:42:01 -0500
Subject: [ntdev] Re: Compiler error with DbgPrint

>
> Del,
>
> Be careful. None of the “miniport” samples ( storage , video ) include

> “ntddk.h” or wdm.h. They include “miniport.h” and maybe they is a
> reason for that.
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com To
> unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

Hi,
That’s right. Both headers are not included. If I include them, I get lots
of redefinition error.

Is there any way to get debug messages from miniport drivers?.

Thanks
Aru
----- Original Message -----
From: “Christiaan Ghijselinck”
To: “NT Developers Interest List”
Sent: Tuesday, November 19, 2002 3:12 AM
Subject: [ntdev] Re: Compiler error with DbgPrint

>
> Del,
>
> Be careful. None of the “miniport” samples ( storage , video ) include
> “ntddk.h” or wdm.h. They include “miniport.h” and maybe they is a reason
> for that.
>
> —
> You are currently subscribed to ntdev as: xxxxx@npd.hcltech.com
> To unsubscribe send a blank email to %%email.unsub%%
>

Just like I stated previously, add the line

unsigned long _cdecl DbgPrint ( char * Format, … );

at top of the ini910u.c .
Add also “$(DDK_LIB_PATH)\ntoskrnl.lib” to TARGETLIBS in the “sources” file after the other lib includes.

It will compile and link, and I assume, the miniport will still work although, this is not the correct solution …

----- Original Message -----
From: “Arumugam k”
To: “NT Developers Interest List”
Sent: Tuesday, November 19, 2002 5:40 AM
Subject: [ntdev] Re: Compiler error with DbgPrint

> Hi,
> That’s right. Both headers are not included. If I include them, I get lots
> of redefinition error.
>
> Is there any way to get debug messages from miniport drivers?.
>
> Thanks
> Aru
> ----- Original Message -----
> From: “Christiaan Ghijselinck”
> To: “NT Developers Interest List”
> Sent: Tuesday, November 19, 2002 3:12 AM
> Subject: [ntdev] Re: Compiler error with DbgPrint
>
>
> >
> > Del,
> >
> > Be careful. None of the “miniport” samples ( storage , video ) include
> > “ntddk.h” or wdm.h. They include “miniport.h” and maybe they is a reason
> > for that.
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@npd.hcltech.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@Compaqnet.be
> To unsubscribe send a blank email to %%email.unsub%%
>

Hi,
Thanks for your reply.
Now I am not getting the compilation error.
But I am not getting the particular debug output.
-Aru
----- Original Message -----
From: Christiaan Ghijselinck
To: NT Developers Interest List
Sent: Tuesday, November 19, 2002 12:21 PM
Subject: [ntdev] Re: Compiler error with DbgPrint

Just like I stated previously, add the line

unsigned long _cdecl DbgPrint ( char * Format, … );

at top of the ini910u.c .
Add also “$(DDK_LIB_PATH)\ntoskrnl.lib” to TARGETLIBS in the “sources” file after the other lib includes.

It will compile and link, and I assume, the miniport will still work although, this is not the correct solution …

----- Original Message -----
From: “Arumugam k”
To: “NT Developers Interest List”
Sent: Tuesday, November 19, 2002 5:40 AM
Subject: [ntdev] Re: Compiler error with DbgPrint

> Hi,
> That’s right. Both headers are not included. If I include them, I get lots
> of redefinition error.
>
> Is there any way to get debug messages from miniport drivers?.
>
> Thanks
> Aru
> ----- Original Message -----
> From: “Christiaan Ghijselinck”
> To: “NT Developers Interest List”
> Sent: Tuesday, November 19, 2002 3:12 AM
> Subject: [ntdev] Re: Compiler error with DbgPrint
>
>
> >
> > Del,
> >
> > Be careful. None of the “miniport” samples ( storage , video ) include
> > “ntddk.h” or wdm.h. They include “miniport.h” and maybe they is a reason
> > for that.
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@npd.hcltech.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@Compaqnet.be
> To unsubscribe send a blank email to %%email.unsub%%
> —
You are currently subscribed to ntdev as: xxxxx@npd.hcltech.com
To unsubscribe send a blank email to %%email.unsub%%