Unresolved extrenal when trying to use DbgPrintEx()

Hi,

When I attempt to use the function DbgPrintEx() instead of DbgPrint() I get
an unresolved external linker error LNK2019 in the source file that makes
the call and also an LNK1120 at the end of the build attempt. I am using
Windows XP Pro SP2 and WinDDK version 6001.18000.

The line that I am using is simply.

DbgPrintEx(DPFLTR_IHVDRIVER_ID, 32, “Anystring\n”);

Can anyone tell me why this happens?

Regards FarmerJo

FarmerJo wrote:

In your third parameter to dbgprintex, where is your format specifier? I
see only a newline character.

Matt

Hi,

When I attempt to use the function DbgPrintEx() instead of DbgPrint() I get
an unresolved external linker error LNK2019 in the source file that makes
the call and also an LNK1120 at the end of the build attempt. I am using
Windows XP Pro SP2 and WinDDK version 6001.18000.

The line that I am using is simply.

DbgPrintEx(DPFLTR_IHVDRIVER_ID, 32, “Anystring\n”);

Can anyone tell me why this happens?

Regards FarmerJo


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

That is a valid format specifier; there are no arguments, which is fine, but neither one is causing the linker error.

I have no idea of what is, as DbgPrintEx works on XP, but if you posted the actual error message, that would help.

Good luck,

mm

Matt wrote:

FarmerJo wrote:

In your third parameter to dbgprintex, where is your format specifier? I
see only a newline character.

Matt

> Hi,
>
> When I attempt to use the function DbgPrintEx() instead of DbgPrint()
> I get an unresolved external linker error LNK2019 in the source file
> that makes the call and also an LNK1120 at the end of the build
> attempt. I am using Windows XP Pro SP2 and WinDDK version 6001.18000.
>
> The line that I am using is simply.
>
> DbgPrintEx(DPFLTR_IHVDRIVER_ID, 32, “Anystring\n”);
>
> Can anyone tell me why this happens?
>
> Regards FarmerJo
>
>
> —
> 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
>
>

Martin O’Brien wrote:

I never use the Ex version, but I was assuming this was like DbgPrint
with regards to the format specifier parameter.

Instead of something like “%wZ” or “%s” tucked in there for the format
specifier, I see */“Anystring\n”…

/*I don’t see how that could be valid?

Matt

That is a valid format specifier; there are no arguments, which is
fine, but neither one is causing the linker error.

I have no idea of what is, as DbgPrintEx works on XP, but if you
posted the actual error message, that would help.

Good luck,

mm

Matt wrote:
> FarmerJo wrote:
>
> In your third parameter to dbgprintex, where is your format
> specifier? I see only a newline character.
>
> Matt
>
>> Hi,
>>
>> When I attempt to use the function DbgPrintEx() instead of
>> DbgPrint() I get an unresolved external linker error LNK2019 in the
>> source file that makes the call and also an LNK1120 at the end of
>> the build attempt. I am using Windows XP Pro SP2 and WinDDK version
>> 6001.18000.
>>
>> The line that I am using is simply.
>>
>> DbgPrintEx(DPFLTR_IHVDRIVER_ID, 32, “Anystring\n”);
>>
>> Can anyone tell me why this happens?
>>
>> Regards FarmerJo
>>
>>
>> —
>> 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

Maybe I’m missing something, but it just says to print something without any arguments, like ‘printf(“test\n”);’

mm

Matt wrote:

Martin O’Brien wrote:

I never use the Ex version, but I was assuming this was like DbgPrint
with regards to the format specifier parameter.

Instead of something like “%wZ” or “%s” tucked in there for the format
specifier, I see */“Anystring\n”…

/*I don’t see how that could be valid?

Matt

> That is a valid format specifier; there are no arguments, which is
> fine, but neither one is causing the linker error.
>
> I have no idea of what is, as DbgPrintEx works on XP, but if you
> posted the actual error message, that would help.
>
>
> Good luck,
>
> mm
>
> Matt wrote:
>> FarmerJo wrote:
>>
>> In your third parameter to dbgprintex, where is your format
>> specifier? I see only a newline character.
>>
>> Matt
>>
>>> Hi,
>>>
>>> When I attempt to use the function DbgPrintEx() instead of
>>> DbgPrint() I get an unresolved external linker error LNK2019 in the
>>> source file that makes the call and also an LNK1120 at the end of
>>> the build attempt. I am using Windows XP Pro SP2 and WinDDK version
>>> 6001.18000.
>>>
>>> The line that I am using is simply.
>>>
>>> DbgPrintEx(DPFLTR_IHVDRIVER_ID, 32, “Anystring\n”);
>>>
>>> Can anyone tell me why this happens?
>>>
>>> Regards FarmerJo
>>>
>>>
>>> —
>>> 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
>

Hi,

The exact error text is as follows.
.
.
1>c:\winddk\6001.18000\lib\wxp\i386\BufferOverflowK.lib
1>c:\winddk\6001.18000\lib\wxp\i386\wdm.lib
1>c:\winddk\6001.18000\lib\wxp\i386\sehupd.lib
1>init.obj : error LNK2019: unresolved external symbol __imp__DbgPrintEx
referenced in function _DriverEntry@8
1>d:\work\ctl\pcpprj\pcps0000\objchk_wxp_x86\i386\pcps0000.sys : fatal error
LNK1120: 1 unresolved externals
.
.
The module in which the call is made is init.c and this appears to compile
OK. The problem is at link time, and its almost as if a library is missing
or something like that.

This error also occurs when I build the project using a DOS box and
build.exe etc.

Regards FarmerJo

“Matt” wrote in message news:xxxxx@ntdev…
> Martin O’Brien wrote:
>
> I never use the Ex version, but I was assuming this was like DbgPrint with
> regards to the format specifier parameter.
>
> Instead of something like “%wZ” or “%s” tucked in there for the format
> specifier, I see */“Anystring\n”…
>
> /*I don’t see how that could be valid?
>
> Matt
>
>> That is a valid format specifier; there are no arguments, which is fine,
>> but neither one is causing the linker error.
>>
>> I have no idea of what is, as DbgPrintEx works on XP, but if you posted
>> the actual error message, that would help.
>>
>>
>> Good luck,
>>
>> mm
>>
>> Matt wrote:
>>> FarmerJo wrote:
>>>
>>> In your third parameter to dbgprintex, where is your format specifier? I
>>> see only a newline character.
>>>
>>> Matt
>>>
>>>> Hi,
>>>>
>>>> When I attempt to use the function DbgPrintEx() instead of DbgPrint() I
>>>> get an unresolved external linker error LNK2019 in the source file that
>>>> makes the call and also an LNK1120 at the end of the build attempt. I
>>>> am using Windows XP Pro SP2 and WinDDK version 6001.18000.
>>>>
>>>> The line that I am using is simply.
>>>>
>>>> DbgPrintEx(DPFLTR_IHVDRIVER_ID, 32, “Anystring\n”);
>>>>
>>>> Can anyone tell me why this happens?
>>>>
>>>> Regards FarmerJo
>>>>
>>>>
>>>> —
>>>> 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
>>
>
>

Martin O’Brien wrote:

On second thought, I’ll back away from my comments… I have done things
the way you specified with a regular
DbgPrint statement, but like I said I have never used the Ex version. I
was thinking it was unique in a sense due to
its extra argument parameters. I really have no idea now, to lazy to
test it now…

I was thinking the 3rd and last parameters would be like (“%wZ, %i”,
“Unicode string, integer#”) type arrangement…

Oh well, I’ll figure it out whenever I need it.

Matt

Maybe I’m missing something, but it just says to print something
without any arguments, like ‘printf(“test\n”);’

mm

Matt wrote:
> Martin O’Brien wrote:
>
> I never use the Ex version, but I was assuming this was like DbgPrint
> with regards to the format specifier parameter.
>
> Instead of something like “%wZ” or “%s” tucked in there for the
> format specifier, I see */“Anystring\n”…
>
> /*I don’t see how that could be valid?
>
> Matt
>
>> That is a valid format specifier; there are no arguments, which is
>> fine, but neither one is causing the linker error.
>>
>> I have no idea of what is, as DbgPrintEx works on XP, but if you
>> posted the actual error message, that would help.
>>
>>
>> Good luck,
>>
>> mm
>>
>> Matt wrote:
>>> FarmerJo wrote:
>>>
>>> In your third parameter to dbgprintex, where is your format
>>> specifier? I see only a newline character.
>>>
>>> Matt
>>>
>>>> Hi,
>>>>
>>>> When I attempt to use the function DbgPrintEx() instead of
>>>> DbgPrint() I get an unresolved external linker error LNK2019 in
>>>> the source file that makes the call and also an LNK1120 at the end
>>>> of the build attempt. I am using Windows XP Pro SP2 and WinDDK
>>>> version 6001.18000.
>>>>
>>>> The line that I am using is simply.
>>>>
>>>> DbgPrintEx(DPFLTR_IHVDRIVER_ID, 32, “Anystring\n”);
>>>>
>>>> Can anyone tell me why this happens?
>>>>
>>>> Regards FarmerJo
>>>>
>>>>
>>>> —
>>>> 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

Hi,

Has anyone got DbgPrintEx() to work for DDK 6001.18000 when using a Windows
XP PC?

Regards FarmerJo

I just built with 6001.18001. The statement that I used is
DbgPrintEx(DPFLTR_IHVDRIVER_ID, 32, “Test Print\n”)

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of FarmerJo
Sent: Monday, April 28, 2008 11:28 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Unresolved extrenal when trying to use DbgPrintEx()

Hi,

Has anyone got DbgPrintEx() to work for DDK 6001.18000 when using a Windows
XP PC?

Regards FarmerJo


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

Hi,

Presumably you only need to include wdm.h to use this function? Are you
building using a Visual Studio project or a DOS box and build.exe utility?
Are you using a Windows XP PC?

Regards FarmerJo

I usually include ntddk.h but the project I tested with includes ntifs.h.
I build using the build utility.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of FarmerJo
Sent: Monday, April 28, 2008 12:03 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Unresolved extrenal when trying to use DbgPrintEx()

Hi,

Presumably you only need to include wdm.h to use this function? Are you
building using a Visual Studio project or a DOS box and build.exe utility?
Are you using a Windows XP PC?

Regards FarmerJo


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

Your getting a linker error; header files aren’t the problem. If they were, you wouldn’t be able to compile. You aren’t using the
w2k libraries by accident, are you?

Good luck,

mm

FarmerJo wrote:

Hi,

Presumably you only need to include wdm.h to use this function? Are you
building using a Visual Studio project or a DOS box and build.exe utility?
Are you using a Windows XP PC?

Regards FarmerJo

Link against ntoskrnl.lib, not wdm.lib (by removing DRIVERTYPE=wdm in your sources). DbgPrintEx is not a WDM function.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Monday, April 28, 2008 8:28 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Unresolved extrenal when trying to use DbgPrintEx()

Hi,

Has anyone got DbgPrintEx() to work for DDK 6001.18000 when using a Windows
XP PC?

Regards FarmerJo


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

Doron:

This is not something that I would have considered, because it seems like DbgPrintEx() is a core function and would be exposed in
wdm.lib as well, but then again I also don’t use WDM, so maybe I’m missing something. Why is it not exposed? Inquiring minds want
to know.

Thanks,

mm

Doron Holan wrote:

Link against ntoskrnl.lib, not wdm.lib (by removing DRIVERTYPE=wdm in your sources). DbgPrintEx is not a WDM function.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Monday, April 28, 2008 8:28 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Unresolved extrenal when trying to use DbgPrintEx()

Hi,

Has anyone got DbgPrintEx() to work for DDK 6001.18000 when using a Windows
XP PC?

Regards FarmerJo


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

Martin O’Brien wrote:

This is not something that I would have considered, because it seems
like DbgPrintEx() is a core function and would be exposed in wdm.lib
as well, but then again I also don’t use WDM, so maybe I’m missing
something. Why is it not exposed? Inquiring minds want to know.

WDM carries a heavy burden of backwards compatibility, including (heaven
forbid) Win98.


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

Tim nailed it. WDM is a subset of the NT driver model as snapshotted by win9x releases over time, ending with WinME. Since win9x is no longer supported or released, the idea of WDM in terms of cross OS compat is no longer relevant. What remains of WDM is the name and the overall model, even if it is only supported by one OS family. WDM itself in terms of APIs has grown, but wdm.lib has not kept pace b/c it still matches the win9x subset of WDM. Any driver which targets win2k and beyond should really just link against ntoskrnl.lib

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Martin O’Brien
Sent: Monday, April 28, 2008 10:31 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Unresolved extrenal when trying to use DbgPrintEx()

Doron:

This is not something that I would have considered, because it seems like DbgPrintEx() is a core function and would be exposed in
wdm.lib as well, but then again I also don’t use WDM, so maybe I’m missing something. Why is it not exposed? Inquiring minds want
to know.

Thanks,

mm

Doron Holan wrote:

Link against ntoskrnl.lib, not wdm.lib (by removing DRIVERTYPE=wdm in your sources). DbgPrintEx is not a WDM function.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Monday, April 28, 2008 8:28 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Unresolved extrenal when trying to use DbgPrintEx()

Hi,

Has anyone got DbgPrintEx() to work for DDK 6001.18000 when using a Windows
XP PC?

Regards FarmerJo


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

Many thanks. you are right I do have DRIVERTYPE=wdm in my sources file. I
will try that tonight and let you know.

If this line is not present then does that mean that the driver is not a WDM
driver?

Regards FarmerJo

No, this line alone does not determine if your driver is a WDM driver. WDM is a runtime contract more than anything else vs compile time contract. This flag in the sources does the following (which is not a complete list, but you can peruse the makefile yourself and see what it does)

  1. Adds the wdm inc path to your INCLUDES
  2. Adds ntoskrnl.lib to the libs you link against
  3. modifies a section to your driver’s PE header indicating it is a WDM driver

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
Sent: Monday, April 28, 2008 11:44 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:Unresolved extrenal when trying to use DbgPrintEx()

Many thanks. you are right I do have DRIVERTYPE=wdm in my sources file. I
will try that tonight and let you know.

If this line is not present then does that mean that the driver is not a WDM
driver?

Regards FarmerJo


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

Drivertype=WDM and “wdm.h” are unfortunate and poorly defined anachronisms
that should be avoided by anyone except those poor developers who have
ordered to write windos 98 crap drivers. Stay away.

On Mon, Apr 28, 2008 at 2:44 PM, FarmerJo wrote:

> Many thanks. you are right I do have DRIVERTYPE=wdm in my sources file. I
> will try that tonight and let you know.
>
> If this line is not present then does that mean that the driver is not a
> WDM
> driver?
>
> Regards FarmerJo
>
>
>
> —
> 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
>


Mark Roddy

Thanks to both of you.

mm

Doron Holan wrote:

Tim nailed it. WDM is a subset of the NT driver model as snapshotted by win9x releases over time, ending with WinME. Since win9x is no longer supported or released, the idea of WDM in terms of cross OS compat is no longer relevant. What remains of WDM is the name and the overall model, even if it is only supported by one OS family. WDM itself in terms of APIs has grown, but wdm.lib has not kept pace b/c it still matches the win9x subset of WDM. Any driver which targets win2k and beyond should really just link against ntoskrnl.lib

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Martin O’Brien
Sent: Monday, April 28, 2008 10:31 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Unresolved extrenal when trying to use DbgPrintEx()

Doron:

This is not something that I would have considered, because it seems like DbgPrintEx() is a core function and would be exposed in
wdm.lib as well, but then again I also don’t use WDM, so maybe I’m missing something. Why is it not exposed? Inquiring minds want
to know.

Thanks,

mm

Doron Holan wrote:
> Link against ntoskrnl.lib, not wdm.lib (by removing DRIVERTYPE=wdm in your sources). DbgPrintEx is not a WDM function.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of FarmerJo
> Sent: Monday, April 28, 2008 8:28 AM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Unresolved extrenal when trying to use DbgPrintEx()
>
> Hi,
>
> Has anyone got DbgPrintEx() to work for DDK 6001.18000 when using a Windows
> XP PC?
>
> Regards FarmerJo
>
>
>
> —
> 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