Hello,
I am trying to get my own error messages out to the Event log, and am having some trouble. Here is what I have done so far:
I made a routine to enter event log entries, and have successfully gotten entries in the Event log. I have passed a couple of strings and dumpdata successfully by this method. The entry talks about “can’t find event ID nnn”, but at least I got the information in the log.
Made a *.MC file that has my message in it
Patterned after the serial driver example in the DDK, included the *.MC in the sources file, in the SOURCES= section.
In the OSR book, etc., there are mentions of makefile.inc and NTTARGETFILE0, but since the serial driver example didn’t have these, I didn’t include them either. I guess that the build system now includes knowledge of how to build message files?
build -cZ builds the message file, resulting in a *.rc, a *.h file and the MSG00001.bin file.
I added the registry keys for EventMessageFile and TypesSupported. I have been loading and unloading my driver with NET START and NET STOP, and noticed that when I was in the Event Viewer, I couldn’t copy a new driver over the old one after a NET STOP. I got an error dialog box stating “Cannot copy AmNdis50: The requested operation cannot be performed on a file with a user-mapped section open”. I figured that the Event Viewer had the driver file open. When I close the Event Viewer, then I can copy the file. That says to me that I got the registry entries right, and the Event Viewer was reading the file in an effort to resolve the event ID.
In doing some further investigation, I found that the sample serial driver that I built with build -cZ had the messages from the sermsg.mc file in the serial.sys file, near the end of the file. However, the one message I have so far for my driver isn’t at the end of the file. The *.rc file contains the following:
LANGUAGE 0x9,0x1
1 11 MSG00001.bin
A dump of MSG00001.bin has my event ID in it, and the message text in Unicode.
I did a comparison of the build logs, and couldn’t find anything different between the serial driver build log and my driver build log.
So, a couple of questions:
- Why is the message text in the serial.sys file, but no in my driver?
- Is there a good Windows utility that will output a dump of a binary file in hex?
Thanks!
Barry Kierstein
To answer #2, I am guessing you want to see if the MC benerated resource file is in the binary. The easiest way to do this is to open the driver binary itself (ie the .sys) in visual studio as an executable. You can then view the embedded resources by name.
d
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Thursday, March 03, 2005 6:56 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Getting messages for IoWriteErrorLogEntry
Note that the serial driver has serial.rc, which ends with #include serlog.rc.
Did you #include your “*.rc” file in your “.rc” file? Is your .rc file in your sources file?
Jerry.
>>>>>>
Hello,
I am trying to get my own error messages out to the Event log, and am having some trouble. ?Here is what I have done so far:
I made a routine to enter event log entries, and have successfully gotten entries in the Event log. ?I have passed a couple of strings and dumpdata successfully by this method. ?The entry talks about “can’t find event ID nnn”, but at least I got the information in the log.
Made a *.MC file that has my message in it
Patterned after the serial driver example in the DDK, included the *.MC in the sources file, in the SOURCES= section.
In the OSR book, etc., there are mentions of makefile.inc and NTTARGETFILE0, but since the serial driver example didn’t have these, I didn’t include them either. ?I guess that the build system now includes knowledge of how to build message files?
build -cZ builds the message file, resulting in a *.rc, a *.h file and the MSG00001.bin file.
I added the registry keys for EventMessageFile and TypesSupported. ?I have been loading and unloading my driver with NET START and NET STOP, and noticed that when I was in the Event Viewer, I couldn’t copy a new driver over the old one after a NET STOP. ?I got an error dialog box stating “Cannot copy AmNdis50: The requested operation cannot be performed on a file with a user-mapped section open”. ?I figured that the Event Viewer had the driver file open. ?When I close the Event Viewer, then I can copy the file. ?That says to me that I got the registry entries right, and the Event Viewer was reading the file in an effort to resolve the event ID.
In doing some further investigation, I found that the sample serial driver that I built with build -cZ had the messages from the sermsg.mc file in the serial.sys file, near the end of the file. ?However, the one message I have so far for my driver isn’t at the end of the file. ?The *.rc file contains the following:
LANGUAGE 0x9,0x1
1 11 MSG00001.bin
A dump of MSG00001.bin has my event ID in it, and the message text in Unicode.
I did a comparison of the build logs, and couldn’t find anything different between the serial driver build log and my driver build log.
So, a couple of questions:
1) ?Why is the message text in the serial.sys file, but no in my driver?
2) ?Is there a good Windows utility that will output a dump of a binary file in hex?
Thanks!
Barry Kierstein
<<<<<< —
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
Do you compile your message file with the -c option so set the Customer bit
in your status codes?
–
The personal opinion of
Gary G. Little
“Kierstein, Barry” <barry.kierstein> wrote in message
news:xxxxx@ntdev…
Hello,
I am trying to get my own error messages out to the Event log, and am having
some trouble. Here is what I have done so far:
I made a routine to enter event log entries, and have successfully gotten
entries in the Event log. I have passed a couple of strings and dumpdata
successfully by this method. The entry talks about “can’t find event ID
nnn”, but at least I got the information in the log.
Made a *.MC file that has my message in it
Patterned after the serial driver example in the DDK, included the *.MC in
the sources file, in the SOURCES= section.
In the OSR book, etc., there are mentions of makefile.inc and NTTARGETFILE0,
but since the serial driver example didn’t have these, I didn’t include them
either. I guess that the build system now includes knowledge of how to
build message files?
build -cZ builds the message file, resulting in a *.rc, a *.h file and the
MSG00001.bin file.
I added the registry keys for EventMessageFile and TypesSupported. I have
been loading and unloading my driver with NET START and NET STOP, and
noticed that when I was in the Event Viewer, I couldn’t copy a new driver
over the old one after a NET STOP. I got an error dialog box stating
“Cannot copy AmNdis50: The requested operation cannot be performed on a file
with a user-mapped section open”. I figured that the Event Viewer had the
driver file open. When I close the Event Viewer, then I can copy the file.
That says to me that I got the registry entries right, and the Event Viewer
was reading the file in an effort to resolve the event ID.
In doing some further investigation, I found that the sample serial driver
that I built with build -cZ had the messages from the sermsg.mc file in the
serial.sys file, near the end of the file. However, the one message I have
so far for my driver isn’t at the end of the file. The *.rc file contains
the following:
LANGUAGE 0x9,0x1
1 11 MSG00001.bin
A dump of MSG00001.bin has my event ID in it, and the message text in
Unicode.
I did a comparison of the build logs, and couldn’t find anything different
between the serial driver build log and my driver build log.
So, a couple of questions:
1) Why is the message text in the serial.sys file, but no in my driver?
2) Is there a good Windows utility that will output a dump of a binary file
in hex?
Thanks!
Barry Kierstein</barry.kierstein>
Hello,
The problem was that my message .RC file was not included in the main .RC file. Once I did that, then the messages were included in the driver, and things worked. Much thanks! I now see it in the driver development book, but with all the other new stuff to learn, I somehow didn’t pick up that part.
Also thanks for the “dump” functionality in MS Development Studio. I had not noticed the “type of import” combo box before.
Barry Kierstein
>2) Is there a good Windows utility that will output a dump of a binary file
in hex?
Try porting GNU “od” to Win32, it is trivial.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Maxim S. Shatskih wrote:
>2) Is there a good Windows utility that will output a dump of a binary file
>
>
in hex?
Try porting GNU “od” to Win32, it is trivial.
The similar tool “xxd” is included with vim, and is already ported.
–