Messagetable conflict trying to use both ETW + IoWriteErrorLogMessage

OK boys… I could use some insight. I have a problem similar to that described in this thread http: where AlexBe managed to provide an answer that helped the OP.

But I?ll be damned if I can figure out the solution.

I?m working in the Win7 Build Environment of the Win7 WDK. Thus, I?m using a SOURCES file.

I’ve got a driver that uses ETW (and an XML manifest – not WPP tracing) to write trace information. I’m trying to add support for writing to the Windows System Event Log using IoWriteErrorLogEntry and its associated MC file.

Each works independently.

The Message Compiler runs and generates an RC file and associated header file for the message data in the manifest, and the Message Compiler runs a second time and generates an RC file and associated header file for the message data defined in the MC file.

When I try to include both of the above RC files generated by the MC into my (main) RC file that contains the version resource, I get an error that says:

“error CVT1100: duplicate resource. type:MESSAGETABLE, name:1, language:0x0409”

So? the message numbers SEEM to be colliding, because the MC runs twice starting with message number 1 each time.

I?ve tried adding the following to my sources file and removing the MC stuff from makefile.inc (and removing the associated NTTARGETFIL0):

EVENTS_MANIFEST=MyDriver.xml
EVENTS_MANIFEST_MC_INPUT_FILE= MyDriver.mc
DISABLE_SOURCE_MANIFEST_VALIDATION=1
MC_GENERATE_EVENTS_FOR_KERNELMODE=1

But that gets me an error as follows:

mc : error : Invalid baseline path name c:\winddk\7600.16385.1\bin\providers\Vista

This HAS to be possible? Doesn’t it? I?d appreciate any help,

Peter
OSR</http:>

Why do you need to run it twice? In fact, the error message you are
getting is correct, because there are two MESSAGETABLE resources with the
same resource ID (yes, the whole resource structure sucks, but it’s what
we’re stuck with). But I’m missing why you need to run it twice, because
it will, indeed, generate two tables, both labeled with the resource ID 1;
that’s what it is supposed to do, and therefore you should only run it
once, or, use only one of the .rc files and consider the second one an
accidental side effect of running it twice.

I also recommend never using the +1 construct to number messages. If a
message is deleted or added, this adds catastrophic failure to the use of
the event log, because all the old event log messages are using the old
enumeration, but they are going to be decoded against the new enumeration.
Use absolute integers; my polilcy has been when a message is deprecated,
I change its text from
This is an error
to
DEPRECATED (V.3): This is an error

the result is that the new MESSAGETABLE can be presented to the event
viewer and the users will still get intelligible message text renderings.
joe

OK boys… I could use some insight. I have a problem similar to that
described in this thread
http: where AlexBe managed
> to provide an answer that helped the OP.
>
> But I?ll be damned if I can figure out the solution.
>
> I?m working in the Win7 Build Environment of the Win7 WDK. Thus, I?m
> using a SOURCES file.
>
> I’ve got a driver that uses ETW (and an XML manifest – not WPP tracing)
> to write trace information. I’m trying to add support for writing to the
> Windows System Event Log using IoWriteErrorLogEntry and its associated MC
> file.
>
> Each works independently.
>
> The Message Compiler runs and generates an RC file and associated header
> file for the message data in the manifest, and the Message Compiler runs a
> second time and generates an RC file and associated header file for the
> message data defined in the MC file.
>
> When I try to include both of the above RC files generated by the MC into
> my (main) RC file that contains the version resource, I get an error that
> says:
>
> “error CVT1100: duplicate resource. type:MESSAGETABLE, name:1,
> language:0x0409”
>
> So? the message numbers SEEM to be colliding, because the MC runs twice
> starting with message number 1 each time.
>
> I?ve tried adding the following to my sources file and removing the MC
> stuff from makefile.inc (and removing the associated NTTARGETFIL0):
>
> EVENTS_MANIFEST=MyDriver.xml
> EVENTS_MANIFEST_MC_INPUT_FILE= MyDriver.mc
> DISABLE_SOURCE_MANIFEST_VALIDATION=1
> MC_GENERATE_EVENTS_FOR_KERNELMODE=1
>
> But that gets me an error as follows:
>
> mc : error : Invalid baseline path name
> c:\winddk\7600.16385.1\bin\providers\Vista
>
> This HAS to be possible? Doesn’t it? I?d appreciate any help,
>
> Peter
> OSR
>
>
> —
> 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
></http:>

Thanks for the reply.

If you can tell me how to run the MC once, specifying two inputs of different formats (one XML manifest and the other MC definition), I’d be greatly appreciative.

So, basically I need to do the following for the XML manifest:

$(O)\MyDriverEvents.h: MyDriverEvents.xml
$(MC) -km -h $(OBJ_PATH)$(O) -r $(OBJ_PATH)$(O) -z MyDriverEvents -b $**

PLUS, the usual thing for the MC file.

Peter
OSR

If you truly can’t get both mc outputs to be in the same binary, you could have a resource only DLL that contains your error log message table and you change your INF to point to the DLL, not the sys. You can still consume the generated .h from the .sys

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Tuesday, June 26, 2012 1:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Messagetable conflict trying to use both ETW + IoWriteErrorLogMessage

Thanks for the reply.

If you can tell me how to run the MC once, specifying two inputs of different formats (one XML manifest and the other MC definition), I’d be greatly appreciative.

So, basically I need to do the following for the XML manifest:

$(O)\MyDriverEvents.h: MyDriverEvents.xml
$(MC) -km -h $(OBJ_PATH)$(O) -r $(OBJ_PATH)$(O) -z MyDriverEvents -b $**

PLUS, the usual thing for the MC file.

Peter
OSR


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’s a very good fallback, thanks Doron. Yes… that’ll definitely work.

I’m presently using my chainsaw trying to make Dr. Newcomer’s approach work… Jamming them into the same file using some hideous makefile.inc hackery. It makes me feel dirty, but…

P

This is unfortunate, but here are 2 workarounds:

  1. Create the directory mc is complaining about (can be empty) c:\winddk\7600.16385.1\bin\providers\Vista
  2. edit madefile.def are move “EVENTS_VALIDATE_OPTION”

Thanks,
Alex

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Tuesday, June 26, 2012 12:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Messagetable conflict trying to use both ETW + IoWriteErrorLogMessage

OK boys… I could use some insight. I have a problem similar to that described in this thread http: where AlexBe managed to provide an answer that helped the OP.

But I?ll be damned if I can figure out the solution.

I?m working in the Win7 Build Environment of the Win7 WDK. Thus, I?m using a SOURCES file.

I’ve got a driver that uses ETW (and an XML manifest – not WPP tracing) to write trace information. I’m trying to add support for writing to the Windows System Event Log using IoWriteErrorLogEntry and its associated MC file.

Each works independently.

The Message Compiler runs and generates an RC file and associated header file for the message data in the manifest, and the Message Compiler runs a second time and generates an RC file and associated header file for the message data defined in the MC file.

When I try to include both of the above RC files generated by the MC into my (main) RC file that contains the version resource, I get an error that says:

“error CVT1100: duplicate resource. type:MESSAGETABLE, name:1, language:0x0409”

So? the message numbers SEEM to be colliding, because the MC runs twice starting with message number 1 each time.

I?ve tried adding the following to my sources file and removing the MC stuff from makefile.inc (and removing the associated NTTARGETFIL0):

EVENTS_MANIFEST=MyDriver.xml
EVENTS_MANIFEST_MC_INPUT_FILE= MyDriver.mc
DISABLE_SOURCE_MANIFEST_VALIDATION=1
MC_GENERATE_EVENTS_FOR_KERNELMODE=1

But that gets me an error as follows:

mc : error : Invalid baseline path name c:\winddk\7600.16385.1\bin\providers\Vista

This HAS to be possible? Doesn’t it? I?d appreciate any help,

Peter
OSR


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</http:>

Thank you, Alex. You at least confirmed I’m not disposed of my senses.

Other than that (since I have your ear… and perhaps just for those who read this in the archives) SHOULD the rest of the SOURCES file “magic” I’ve tossed-in work?

EVENTS_MANIFEST=MyDriver.xml
EVENTS_MANIFEST_MC_INPUT_FILE= MyDriver.mc
DISABLE_SOURCE_MANIFEST_VALIDATION=1
MC_GENERATE_EVENTS_FOR_KERNELMODE=1

If using the above, I neither have to use a makefile.inc NOR do I need to specify the MC file in my SOURCES= line, is that correct?

I guess the other option is to REMOVE all the “magic” above from my SOURCES file above and use a MAKEFILE.INC to build a single RC file. I’m trying that option now.

Peter
OSR

I don’t have Win7 WDK handy to check, but those directives should work, and are preferable to crufting your own targets/manually invoking MC. The only note is that the directive to do KM code generation is:

EVENTS_GENERATE_EVENTS_FOR_KERNELMODE = 1

There are two more directives which are quite handy for logging code generation to control the name of the output header file and logging macro:

EVENTS_GENERATED_EVENT_MACRO_PREFIX=MyTrace
EVENTS_MANIFEST_OUTPUT_FILE_BASENAME=MyEvents

Thanks,
Alex

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Tuesday, June 26, 2012 2:48 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Messagetable conflict trying to use both ETW + IoWriteErrorLogMessage

Thank you, Alex. You at least confirmed I’m not disposed of my senses.

Other than that (since I have your ear… and perhaps just for those who read this in the archives) SHOULD the rest of the SOURCES file “magic” I’ve tossed-in work?

EVENTS_MANIFEST=MyDriver.xml
EVENTS_MANIFEST_MC_INPUT_FILE= MyDriver.mc
DISABLE_SOURCE_MANIFEST_VALIDATION=1
MC_GENERATE_EVENTS_FOR_KERNELMODE=1

If using the above, I neither have to use a makefile.inc NOR do I need to specify the MC file in my SOURCES= line, is that correct?

I guess the other option is to REMOVE all the “magic” above from my SOURCES file above and use a MAKEFILE.INC to build a single RC file. I’m trying that option now.

Peter
OSR


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