WPP's Custom Enumeration Type

Hello,

I want to define custom enumeration types for pre-defined enumerations in WDK’s header files (e.g. PROCESSINFOCLASS in ntddk.h, NDIS_MEDIUM in ntddndis.h).

I added following codes to tracedrv.h in WDK’s tracedrv sample :

#include <ntddk.h>
#include <ntddndis.h>



// begin_wpp config
// CUSTOM_TYPE(ProcessInfoClass, ItemEnum(PROCESSINFOCLASS));
// CUSTOM_TYPE(NdisMedium, ItemEnum(NDIS_MEDIUM));
// end_wpp

I then used this, like so :

PROCESSINFOCLASS processInfoClass = ProcessConsoleHostProcess;
NDIS_MEDIUM ndisMedium = NdisPhysicalMediumWirelessWan;

DoTraceMessage(FLAG_ONE, “%!ProcessInfoClass!”, processInfoClass);
DoTraceMessage(FLAG_ONE, “%!NdisMedium!”, ndisMedium);

But, TraceView displays integer values, instead of textual names of enumerations above.

So, I tried to add -scan parameters to RUN_WPP macro in sources file.

RUN_WPP = … -scan:ntddk.h -scan:ntddndis.h …

As a result, I’ve got following errors messages.

1>1>d:\testprojects\tracing\tracedrv\wpp : error : (WppCreateFile)Cannot open file ntddk.h, error 2
1>1>d:\testprojects\tracing\tracedrv\wpp : error : (WppCreateFile)Cannot open file ntddndis.h, error 2

Can WPP find header files which isn’t in local directory?
Any help would be appreciated.

Thanks in advance.</ntddndis.h></ntddk.h>

Use a fully qualified path,

RUN_WPP = … -scan:$(ddk_inc_path)\ntddk.h

d

debt from my phone


From: xxxxx@gmail.com
Sent: 7/2/2012 12:48 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WPP’s Custom Enumeration Type

Hello,

I want to define custom enumeration types for pre-defined enumerations in WDK’s header files (e.g. PROCESSINFOCLASS in ntddk.h, NDIS_MEDIUM in ntddndis.h).

I added following codes to tracedrv.h in WDK’s tracedrv sample :

#include <ntddk.h>
#include <ntddndis.h>



// begin_wpp config
// CUSTOM_TYPE(ProcessInfoClass, ItemEnum(PROCESSINFOCLASS));
// CUSTOM_TYPE(NdisMedium, ItemEnum(NDIS_MEDIUM));
// end_wpp

I then used this, like so :

PROCESSINFOCLASS processInfoClass = ProcessConsoleHostProcess;
NDIS_MEDIUM ndisMedium = NdisPhysicalMediumWirelessWan;

DoTraceMessage(FLAG_ONE, “%!ProcessInfoClass!”, processInfoClass);
DoTraceMessage(FLAG_ONE, “%!NdisMedium!”, ndisMedium);

But, TraceView displays integer values, instead of textual names of enumerations above.

So, I tried to add -scan parameters to RUN_WPP macro in sources file.

RUN_WPP = … -scan:ntddk.h -scan:ntddndis.h …

As a result, I’ve got following errors messages.

1>1>d:\testprojects\tracing\tracedrv\wpp : error : (WppCreateFile)Cannot open file ntddk.h, error 2
1>1>d:\testprojects\tracing\tracedrv\wpp : error : (WppCreateFile)Cannot open file ntddndis.h, error 2

Can WPP find header files which isn’t in local directory?
Any help would be appreciated.

Thanks in advance.


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</ntddndis.h></ntddk.h>

Thanks for your answer.

As you said, I used a fully qualified path.
WPP then found correct header file path.

But, WPP spited out another error message.

1>1>c:\winddk\7600.16385.1\inc\ddk\ntddk.h(1604) : error : (ParseConfigCallback)Function while is already defined

1>1>c:\winddk\7600.16385.1\inc\ddk\ndis.h(2289) : error : (ParseConfigCallback)Function MmGetMdlByteCount is already defined

What does this error message mean?

Probably that a previous -scan header on the command line includes these files and you are getting multiple definitions. What it probably fundamentally means is that even if you get rid of the multiple definition errors, you will still not get the functionality you want because wpp -scan is already scanning these headers and not expanding the custom types as is.

d

debt from my phone


From: xxxxx@gmail.com
Sent: 7/2/2012 6:26 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WPP’s Custom Enumeration Type

Thanks for your answer.

As you said, I used a fully qualified path.
WPP then found correct header file path.

But, WPP spited out another error message.

1>1>c:\winddk\7600.16385.1\inc\ddk\ntddk.h(1604) : error : (ParseConfigCallback)Function while is already defined

1>1>c:\winddk\7600.16385.1\inc\ddk\ndis.h(2289) : error : (ParseConfigCallback)Function MmGetMdlByteCount is already defined

What does this error message mean?


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

Information needed to decode the “enum” is extracted from the PDB file, which means that WPP does not need to scan the file containing the enum definition (e.g. ntddk.h). The file which needs to be scanned is the one which has begin_wpp/end_wpp goo, which I am guessing you were already doing since traces with !%ProcessInfoClass% compiled corectly.
In your case the problem is that WPP decoder does not do a good job handling typedefs. PROCESSINFOCLASS is a typedef for _PROCESSINFOCLASS). Remove scan of the ntddk.h and change your wpp config to say as below (note the underscore)

// begin_wpp config
// CUSTOM_TYPE(ProcessInfoClass, ItemEnum(_PROCESSINFOCLASS));
// CUSTOM_TYPE(NdisMedium, ItemEnum(_NDIS_MEDIUM));
// end_wpp

And it should get decoded correctly. You can verify that by running tracepdb to extract the TMF files and making sure that TMF has something like.

#enumv _PROCESSINFOCLASS
{
ProcessBasicInformation,0x0
ProcessQuotaLimits,0x1
ProcessIoCounters,0x2
ProcessVmCounters,0x3
ProcessTimes,0x4
ProcessBasePriority,0x5
ProcessRaisePriority,0x6
ProcessDebugPort,0x7
ProcessExceptionPort,0x8
ProcessAccessToken,0x9
ProcessLdtInformation,0xA
ProcessLdtSize,0xB
ProcessDefaultHardErrorMode,0xC
ProcessIoPortHandlers,0xD
ProcessPooledUsageAndLimits,0xE
ProcessWorkingSetWatch,0xF
ProcessUserModeIOPL,0x10
ProcessEnableAlignmentFaultFixup,0x11
ProcessPriorityClass,0x12
ProcessWx86Information,0x13
ProcessHandleCount,0x14
ProcessAffinityMask,0x15
ProcessPriorityBoost,0x16
ProcessDeviceMap,0x17
ProcessSessionInformation,0x18
ProcessForegroundInformation,0x19
ProcessWow64Information,0x1A
ProcessImageFileName,0x1B
ProcessLUIDDeviceMapsEnabled,0x1C
ProcessBreakOnTermination,0x1D
ProcessDebugObjectHandle,0x1E
ProcessDebugFlags,0x1F
ProcessHandleTracing,0x20
ProcessIoPriority,0x21
ProcessExecuteFlags,0x22
ProcessTlsInformation,0x23
ProcessCookie,0x24
ProcessImageInformation,0x25
ProcessCycleTime,0x26
ProcessPagePriority,0x27
ProcessInstrumentationCallback,0x28
ProcessThreadStackAllocation,0x29
ProcessWorkingSetWatchEx,0x2A
ProcessImageFileNameWin32,0x2B
ProcessImageFileMapping,0x2C
ProcessAffinityUpdateMode,0x2D
ProcessMemoryAllocationMode,0x2E
ProcessGroupInformation,0x2F
ProcessTokenVirtualizationEnabled,0x30
ProcessConsoleHostProcess,0x31
ProcessWindowInformation,0x32
ProcessHandleInformation,0x33
ProcessMitigationPolicy,0x34
ProcessDynamicFunctionTableInformation,0x35
ProcessHandleCheckingMode,0x36
ProcessKeepAliveCount,0x37
ProcessRevokeFileHandles,0x38
ProcessWorkingSetControl,0x39
MaxProcessInfoClass,0x3A
}

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, July 02, 2012 7:05 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP’s Custom Enumeration Type

Use a fully qualified path,

RUN_WPP = … -scan:$(ddk_inc_path)\ntddk.h

d

debt from my phone


From: xxxxx@gmail.com
Sent: 7/2/2012 12:48 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WPP’s Custom Enumeration Type
Hello,

I want to define custom enumeration types for pre-defined enumerations in WDK’s header files (e.g. PROCESSINFOCLASS in ntddk.h, NDIS_MEDIUM in ntddndis.h).

I added following codes to tracedrv.h in WDK’s tracedrv sample :

#include <ntddk.h>
#include <ntddndis.h>



// begin_wpp config
// CUSTOM_TYPE(ProcessInfoClass, ItemEnum(PROCESSINFOCLASS));
// CUSTOM_TYPE(NdisMedium, ItemEnum(NDIS_MEDIUM));
// end_wpp

I then used this, like so :

PROCESSINFOCLASS processInfoClass = ProcessConsoleHostProcess;
NDIS_MEDIUM ndisMedium = NdisPhysicalMediumWirelessWan;

DoTraceMessage(FLAG_ONE, “%!ProcessInfoClass!”, processInfoClass);
DoTraceMessage(FLAG_ONE, “%!NdisMedium!”, ndisMedium);

But, TraceView displays integer values, instead of textual names of enumerations above.

So, I tried to add -scan parameters to RUN_WPP macro in sources file.

RUN_WPP = … -scan:ntddk.h -scan:ntddndis.h …

As a result, I’ve got following errors messages.

1>1>d:\testprojects\tracing\tracedrv\wpp : error : (WppCreateFile)Cannot open file ntddk.h, error 2
1>1>d:\testprojects\tracing\tracedrv\wpp : error : (WppCreateFile)Cannot open file ntddndis.h, error 2

Can WPP find header files which isn’t in local directory?
Any help would be appreciated.

Thanks in advance.


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</ntddndis.h></ntddk.h>

I just replied to the other fork of this thread with info on what the problem is, there is no need to scan ntddk.h…
Thanks,
Alex

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, July 02, 2012 7:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WPP’s Custom Enumeration Type

Probably that a previous -scan header on the command line includes these files and you are getting multiple definitions. What it probably fundamentally means is that even if you get rid of the multiple definition errors, you will still not get the functionality you want because wpp -scan is already scanning these headers and not expanding the custom types as is.

d

debt from my phone


From: xxxxx@gmail.com
Sent: 7/2/2012 6:26 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WPP’s Custom Enumeration Type
Thanks for your answer.

As you said, I used a fully qualified path.
WPP then found correct header file path.

But, WPP spited out another error message.

1>1>c:\winddk\7600.16385.1\inc\ddk\ntddk.h(1604) : error : (ParseConfigCallback)Function while is already defined

1>1>c:\winddk\7600.16385.1\inc\ddk\ndis.h(2289) : error : (ParseConfigCallback)Function MmGetMdlByteCount is already defined

What does this error message mean?


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

Thank you so much!

It works well.