Added "PAGED_CODE()", it cannot pass WPP example

1>errors in directory c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5
1>c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5\step5.c(179) : error C4013: ‘WPP_CALL_step5_c179’ undefined; assuming extern returning int

Basically i started with step5 example and it builds.
then made some changes, still builds.

Now in line 179 in step5.c, i added PAGED_CODE(), it won’t build anymore with the above error.
Any hints ? Thanks !

Line 179 of step5.c for me is

if (pDeviceContext->UsbDevice == NULL) {
status = WdfUsbTargetDeviceCreate(Device,
WDF_NO_OBJECT_ATTRIBUTES, <=== line 179
&pDeviceContext->UsbDevice);
if (!NT_SUCCESS(status)) {
KdPrint((“WdfUsbTargetDeviceCreate failed %!STATUS!\n”, status));
return status;
}
}

Post the actual code change you made

d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Tuesday, August 10, 2010 11:12 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Added “PAGED_CODE()”, it cannot pass WPP example

1>errors in directory c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5
1>c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5\step5.c(179) : error C4013: ‘WPP_CALL_step5_c179’ undefined; assuming extern returning int

Basically i started with step5 example and it builds.
then made some changes, still builds.

Now in line 179 in step5.c, i added PAGED_CODE(), it won’t build anymore with the above error.
Any hints ? Thanks !


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,

  1. cd c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5,
  2. build -ceZ works
  3. edit xxxxx@step5.c, after
    UNREFERENCED_PARAMETER(InputBufferLength);
    UNREFERENCED_PARAMETER(OutputBufferLength)

put another line
PAGED_CODE();
4. now i get

Configuring OACR for ‘WDKSamples:amd64chk’ -
Compiling - step5.c
1>errors in directory c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5
1>c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5\step5.c(242) : error C
4013: ‘WPP_CALL_step5_c242’ undefined; assuming extern returning int
Linking Executable - objchk_win7_amd64\amd64\osrusbfx2.sys
1>link : error LNK1181: cannot open input file ‘c:\winddk\7600.16385.1\src\usb\o
srusbfx2\kmdf\sys\step5\objchk_win7_amd64\amd64\step5.obj’
BUILD: Finish time: Tue Aug 10 15:57:19 2010
BUILD: Done

3 files compiled - 1 Error
1 executable built - 1 Error

please just post your code

On Aug 10, 2010 4:09 PM, wrote:

Doron,

1. cd c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5,
2. build -ceZ works
3. edit xxxxx@step5.c, after
UNREFERENCED_PARAMETER(InputBufferLength);
UNREFERENCED_PARAMETER(OutputBufferLength)

put another line
PAGED_CODE();
4. now i get

Configuring OACR for ‘WDKSamples:amd64chk’ -
Compiling - step5.c

1>errors in directory
c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5
1>c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5\step5.c(242) :
error C
4013: ‘WPP_CALL_step5_c242’ undefined; assuming extern returning int
Linking Executable - objchk_win7_amd64\amd64\osrusbfx2.sys
1>link : error LNK1181: cannot open input file
‘c:\winddk\7600.16385.1\src\usb\o
srusbfx2\kmdf\sys\step5\objchk_win7_amd64\amd64\step5.obj’
BUILD: Finish time: Tue Aug 10 15:57:19 2010
BUILD: Done

3 files compiled - 1 Error
1 executable built - 1 Error


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
h…

xxxxx@hotmail.com wrote:

Doron,

  1. cd c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5,
  2. build -ceZ works
  3. edit xxxxx@step5.c, after
    UNREFERENCED_PARAMETER(InputBufferLength);
    UNREFERENCED_PARAMETER(OutputBufferLength)

put another line
PAGED_CODE();
4. now i get

Configuring OACR for ‘WDKSamples:amd64chk’ -
> Compiling - step5.c
> 1>errors in directory c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5
> 1>c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5\step5.c(242) : error C
> 4013: ‘WPP_CALL_step5_c242’ undefined; assuming extern returning int
> Linking Executable - objchk_win7_amd64\amd64\osrusbfx2.sys

Yes, I can duplicate this. Very interesting problem. The PAGED_CODE()
macro has a KdPrint call embedded in it, and apparently that call is not
being properly caught by the WPP pre-processor.


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

Looks like wpp failed to update the tmh file after the change.
@ OP: try clean rebuild (build -cz)

–pa

wrote in message news:xxxxx@ntdev…
> Doron,
>
> 1. cd c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5,
> 2. build -ceZ works
> 3. edit xxxxx@step5.c, after
> UNREFERENCED_PARAMETER(InputBufferLength);
> UNREFERENCED_PARAMETER(OutputBufferLength)
>
> put another line
> PAGED_CODE();
> 4. now i get
>
> Configuring OACR for ‘WDKSamples:amd64chk’ -
> Compiling - step5.c
> 1>errors in directory
> c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5
> 1>c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5\step5.c(242) :
> error C
> 4013: ‘WPP_CALL_step5_c242’ undefined; assuming extern returning int
> Linking Executable - objchk_win7_amd64\amd64\osrusbfx2.sys
> 1>link : error LNK1181: cannot open input file
> ‘c:\winddk\7600.16385.1\src\usb\o
> srusbfx2\kmdf\sys\step5\objchk_win7_amd64\amd64\step5.obj’
> BUILD: Finish time: Tue Aug 10 15:57:19 2010
> BUILD: Done
>
> 3 files compiled - 1 Error
> 1 executable built - 1 Error
>

Pavel A. wrote:

Looks like wpp failed to update the tmh file after the change.
@ OP: try clean rebuild (build -cz)

Nope, that doesn’t do it. It’s more fundamental. The macro expansion
is not right. You can see that in the step5.i file.


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

Sounds like a bug bash type of bug to me :slight_smile:

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Tuesday, August 10, 2010 2:52 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Added “PAGED_CODE()”, it cannot pass WPP example

Pavel A. wrote:

Looks like wpp failed to update the tmh file after the change.
@ OP: try clean rebuild (build -cz)

Nope, that doesn’t do it. It’s more fundamental. The macro expansion is not right. You can see that in the step5.i file.


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


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,

just so you know, i applied for test engineer position in MS before, but never got the interview, :slight_smile:

xxxxx@hotmail.com wrote:

Configuring OACR for ‘WDKSamples:amd64chk’ -
> Compiling - step5.c
> 1>errors in directory c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5
> 1>c:\winddk\7600.16385.1\src\usb\osrusbfx2\kmdf\sys\step5\step5.c(242) : error C
> 4013: ‘WPP_CALL_step5_c242’ undefined; assuming extern returning int

So, here’s a new general rule: you cannot invoke your WPP trace macro
from inside another macro. WPP won’t catch it.

You can fix this problem by editing \winddk\7600.16385.1\inc\wdm.h and
changing line 11,555 from this:
KdPrint((“EX: Pageable code called at IRQL %d\n”,
KeGetCurrentIrql())); <br>to this:
DbgPrint(“EX: Pageable code called at IRQL %d\n”,
KeGetCurrentIrql()); <br>
I am now 100% convinced this is the correct way to solve this problem.
That is THE ONLY CASE in all of inc\api or inc\ddk where a macro calls
KdPrint. Here, we are already inside an #ifdef DBG block, so we know
the expansion will happen. And because that’s the only case, there are
no other calls that can trigger this same issue.

And yes, I’ve already filed a bug bash entry for this…


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

Tim,

Not sure your fix can work. I do have another messy code, if i put 1 more blank line before DriverEntry, it won’t compile. I del it, builds.

Tried your fix, still same result.

Blank line where? Between the function name and return type or before the entire declaration? In general, you are very vague when you are describing your changes. Just post the code (Before/after might help)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, August 11, 2010 12:28 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Added “PAGED_CODE()”, it cannot pass WPP example

Tim,

Not sure your fix can work. I do have another messy code, if i put 1 more blank line before DriverEntry, it won’t compile. I del it, builds.

Tried your fix, still same result.


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

not sure i can submit my code,
basically look at the lines between #endif and NTSTATUS,
if 2 lines, it builds, if 1 or 3, won’t build.


#ifdef ALLOC_PRAGMA
#pragma alloc_text( INIT, DriverEntry )
#pragma alloc_text( PAGE, Ksrtm64DeviceAdd)
#pragma alloc_text( PAGE, Ksrtm64DriverContextCleanup)
#pragma alloc_text( PAGE, Ksrtm64IoRead)
#pragma alloc_text( PAGE, Ksrtm64IoWrite)
#pragma alloc_text( PAGE, Ksrtm64IoDeviceControl)
#endif // ALLOC_PRAGMA

NTSTATUS
DriverEntry(

1>errors in directory c:\winddk\7600.16385.1\src\general…
1>c:\winddk\7600.16385.1\src\general\4.c(89) : error C40
13: ‘WPP_CALL_ksrtm64_c89’ undefined; assuming extern returning int
1>c:\winddk\7600.16385.1\src\general\4.c(89) : error C20
65: ‘DBG_INIT’ : undeclared identifier
1>c:\winddk\7600.16385.1\src\general\4.c(169) : error C4
013: ‘WPP_CALL_ksrtm64_c169’ undefined; assuming extern returning int

Blank lines can cause trouble ???

what is the compilation error? You have something really weird going on here

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, August 11, 2010 12:39 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Added “PAGED_CODE()”, it cannot pass WPP example

not sure i can submit my code,
basically look at the lines between #endif and NTSTATUS,
if 2 lines, it builds, if 1 or 3, won’t build.


#ifdef ALLOC_PRAGMA
#pragma alloc_text( INIT, DriverEntry )
#pragma alloc_text( PAGE, Ksrtm64DeviceAdd)
#pragma alloc_text( PAGE, Ksrtm64DriverContextCleanup)
#pragma alloc_text( PAGE, Ksrtm64IoRead)
#pragma alloc_text( PAGE, Ksrtm64IoWrite)
#pragma alloc_text( PAGE, Ksrtm64IoDeviceControl)
#endif // ALLOC_PRAGMA

NTSTATUS
DriverEntry(


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 don’t know what you are doing to get these results, but its not normal. Take any sample (unmodified), add a blank line after the pragma paged blocked and it will still compile

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, August 11, 2010 12:42 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Added “PAGED_CODE()”, it cannot pass WPP example

1>errors in directory c:\winddk\7600.16385.1\src\general…
1>c:\winddk\7600.16385.1\src\general\4.c(89) : error C40
13: ‘WPP_CALL_ksrtm64_c89’ undefined; assuming extern returning int
1>c:\winddk\7600.16385.1\src\general\4.c(89) : error C20
65: ‘DBG_INIT’ : undeclared identifier
1>c:\winddk\7600.16385.1\src\general\4.c(169) : error C4
013: ‘WPP_CALL_ksrtm64_c169’ undefined; assuming extern returning int …

Blank lines can cause trouble ???


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

xxxxx@hotmail.com wrote:

not sure i can submit my code,
basically look at the lines between #endif and NTSTATUS,
if 2 lines, it builds, if 1 or 3, won’t build.


#ifdef ALLOC_PRAGMA
#pragma alloc_text( INIT, DriverEntry )
#pragma alloc_text( PAGE, Ksrtm64DeviceAdd)
#pragma alloc_text( PAGE, Ksrtm64DriverContextCleanup)
#pragma alloc_text( PAGE, Ksrtm64IoRead)
#pragma alloc_text( PAGE, Ksrtm64IoWrite)
#pragma alloc_text( PAGE, Ksrtm64IoDeviceControl)
#endif // ALLOC_PRAGMA

1>errors in directory c:\winddk\7600.16385.1\src\general…
1>c:\winddk\7600.16385.1\src\general\4.c(89) : error C4013: ‘WPP_CALL_ksrtm64_c89’ undefined; assuming extern returning int
1>c:\winddk\7600.16385.1\src\general\4.c(89) : error C2065: ‘DBG_INIT’ : undeclared identifier
1>c:\winddk\7600.16385.1\src\general\4.c(169) : error C4013: ‘WPP_CALL_ksrtm64_c169’ undefined; assuming extern returning int

Blank lines can cause trouble ???

Blank lines never cause trouble, unless it’s in the middle of a
multiline preprocessor macro.

However, you have some real confusion going on here. Originally, you
were talking about osrusbfx2/kmdf/sys/step5. Here, you seem to be in
src/general, but it shows a file called “4.c”, which does not exist
anywhere. The osrusbfx2 sample does not include any alloc_text pragmas,
and none of the samples have any functions called Ksrtm64Xxxxx.

If you are creating your own driver, create it in a directory that is
not part of the DDK tree. If you really have a mystery you cannot
solve, send the source to me privately (timr at probo dot com) and I’ll
post an explanation.


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

Is it possible you are editing your source file with an editor that fumbles
the line ending? On windows, a line ending of a text file is CR+LF. On *nix
it’s LF, on Mac’s before OS X it used to be CR but since OS X is a *nix
flavor don’t know if LF is now the Mac standard. Many WIndows tools will
cope with *nix style line endings but some will not. Really, EVERY Windows
text file should have CR+LF as a line ending.

This is one way where a “blank” line can matter.

Jan

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-421069-
xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, August 11, 2010 12:42 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Added “PAGED_CODE()”, it cannot pass WPP example

1>errors in directory c:\winddk\7600.16385.1\src\general…
1>c:\winddk\7600.16385.1\src\general\4.c(89) : error C40
13: ‘WPP_CALL_ksrtm64_c89’ undefined; assuming extern returning int
1>c:\winddk\7600.16385.1\src\general\4.c(89) : error C20
65: ‘DBG_INIT’ : undeclared identifier
1>c:\winddk\7600.16385.1\src\general\4.c(169) : error C4
013: ‘WPP_CALL_ksrtm64_c169’ undefined; assuming extern returning int

Blank lines can cause trouble ???


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 Doron,

i’m behind the schedule so going back to the old LogEvent method.
But i’ll find some time next week to submit the broken case.

Thanks !

Doron Holan
xxxxx@microsoft.com
Join Date: 08 Sep 2005
Posts To This List: 5263
RE: RE:Added “PAGED_CODE()”, it cannot pass WPP example
I don’t know what you are doing to get these results, but its not normal. Take
any sample (unmodified), add a blank line after the pragma paged blocked and it
will still compile

d

Hi Tim,

The 4.c is a prototype code i’m building, which is a combination of features from the DDK samples.

BTW, how to do the normal reply (which contains your reaplies) instead of quick reply ?

Thanks !