Hi,

Is it possible to generate custom error log messages for SCSI miniport driver?
I tried the following but no luck:

1. Created a message (.mc) file, compiled and generated a corresponding .rc
and .bin file, as per WDK and sample code.

2. Updated .inf file for event log as mentioned in the WDK and added .sys
file to look for messages.

3. Calling StorPortLogError() with this custom error ID.

After installing this driver, an event is getting logged in the event log,
however it complains that itâ??s not able to find the description.

The following message is displayed in the description instead of my custom
error message.

â??The description for Event ID ( 11 ) in Source (xyz) cannot be found. The
local computer may not have the necessary registry information or message DLL
files to display messages from a remote computer. You may be able to use the
/AUXSOURCE= flag to retrieve this description; see Help and Support for
details. The following information is part of the event: \Device\RaidPort8.
"

Is it possible to have custom error messages in storport-miniport driver? If
so could some one please point out the missing thing in the above steps?

Thanks,
Indira

Re: SCSI miniport-Custom Log messages by Volodymyr

Volodymyr
Tue Jul 22 04:52:57 CDT 2008

If you open your sys file in resource editor (for example, reshacker), and
goto message table, what id do you see there for your custom message?

--
Volodymyr, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)

"Indira" <Indira@discussions.microsoft.com> wrote in message
news:29503D5E-AF48-491B-986F-D97A391D9424@microsoft.com...
> Hi,
>
> Is it possible to generate custom error log messages for SCSI miniport
> driver?
> I tried the following but no luck:
>
> 1. Created a message (.mc) file, compiled and generated a corresponding
> .rc
> and .bin file, as per WDK and sample code.
>
> 2. Updated .inf file for event log as mentioned in the WDK and added .sys
> file to look for messages.
>
> 3. Calling StorPortLogError() with this custom error ID.
>
> After installing this driver, an event is getting logged in the event log,
> however it complains that it's not able to find the description.
>
> The following message is displayed in the description instead of my custom
> error message.
>
> "The description for Event ID ( 11 ) in Source (xyz) cannot be found. The
> local computer may not have the necessary registry information or message
> DLL
> files to display messages from a remote computer. You may be able to use
> the
> /AUXSOURCE= flag to retrieve this description; see Help and Support for
> details. The following information is part of the event:
> \Device\RaidPort8.
> "
>
> Is it possible to have custom error messages in storport-miniport driver?
> If
> so could some one please point out the missing thing in the above steps?
>
> Thanks,
> Indira
>



Re: SCSI miniport-Custom Log messages by DeStefan

DeStefan
Tue Jul 22 05:14:01 CDT 2008

Here a sample (considering that the mc file is named msglog.mc)

1.) Make sure that you use the custom build step for your .mc file:
Command Line: "mc msglog.mc -c"
Outputs: "msglog.rc;msglog.h"

2.) Make sure that you really link agains the .res file (which is
autogenerated by "mc.exe"). Usually this step is forgotten, but it is
mandatory else, the "mc.exe" will make the resource file, but the
resourcelinker does not know about this, since it is not involved
automatically. So add also at "Resources"->"Resource File Name"
"directory\msglog.res"

3.) Also make the necessary entries in the registry by your inf file. Here a
sample inf file section

4.) At least you need to reboot your machine one time to to give the
eventlog system the chance to update its registry values, which you modified
by your inf file


[ClassInstall32.Services]
AddService="MyService",0x00000002,AddServiceCommonSection,EventLogCommonSection,System,"MyServiceDescription"

;--------- EventLog Section -----------------------------------------------
[EventLogCommonSection]
AddReg=AddRegCommonEventLogSection

[AddRegCommonEventLogSection]
HKR,,"EventMessageFile",0x00020000,"%SystemRoot%\System32\iologmsg.dll;%12%\MyDriver.sys"
HKR,,"TypesSupported",0x00010001,0x00000007


"Volodymyr M. Shcherbyna" wrote:

> If you open your sys file in resource editor (for example, reshacker), and
> goto message table, what id do you see there for your custom message?
>
> --
> Volodymyr, blog: http://www.shcherbyna.com/
> (This posting is provided "AS IS" with no warranties, and confers no
> rights)
>
> "Indira" <Indira@discussions.microsoft.com> wrote in message
> news:29503D5E-AF48-491B-986F-D97A391D9424@microsoft.com...
> > Hi,
> >
> > Is it possible to generate custom error log messages for SCSI miniport
> > driver?
> > I tried the following but no luck:
> >
> > 1. Created a message (.mc) file, compiled and generated a corresponding
> > .rc
> > and .bin file, as per WDK and sample code.
> >
> > 2. Updated .inf file for event log as mentioned in the WDK and added .sys
> > file to look for messages.
> >
> > 3. Calling StorPortLogError() with this custom error ID.
> >
> > After installing this driver, an event is getting logged in the event log,
> > however it complains that it's not able to find the description.
> >
> > The following message is displayed in the description instead of my custom
> > error message.
> >
> > "The description for Event ID ( 11 ) in Source (xyz) cannot be found. The
> > local computer may not have the necessary registry information or message
> > DLL
> > files to display messages from a remote computer. You may be able to use
> > the
> > /AUXSOURCE= flag to retrieve this description; see Help and Support for
> > details. The following information is part of the event:
> > \Device\RaidPort8.
> > "
> >
> > Is it possible to have custom error messages in storport-miniport driver?
> > If
> > so could some one please point out the missing thing in the above steps?
> >
> > Thanks,
> > Indira
> >
>
>
>

Re: SCSI miniport-Custom Log messages by DeStefan

DeStefan
Tue Jul 22 05:17:01 CDT 2008

Sorry, forgot to mention it:

Use this API-Functions for error logging in eventlog instead of your
StorPortLogError():
IoAllocateErrorLogEntry(), IoWriteErrorLogEntry()


"DeStefan" wrote:

> Here a sample (considering that the mc file is named msglog.mc)
>
> 1.) Make sure that you use the custom build step for your .mc file:
> Command Line: "mc msglog.mc -c"
> Outputs: "msglog.rc;msglog.h"
>
> 2.) Make sure that you really link agains the .res file (which is
> autogenerated by "mc.exe"). Usually this step is forgotten, but it is
> mandatory else, the "mc.exe" will make the resource file, but the
> resourcelinker does not know about this, since it is not involved
> automatically. So add also at "Resources"->"Resource File Name"
> "directory\msglog.res"
>
> 3.) Also make the necessary entries in the registry by your inf file. Here a
> sample inf file section
>
> 4.) At least you need to reboot your machine one time to to give the
> eventlog system the chance to update its registry values, which you modified
> by your inf file
>
>
> [ClassInstall32.Services]
> AddService="MyService",0x00000002,AddServiceCommonSection,EventLogCommonSection,System,"MyServiceDescription"
>
> ;--------- EventLog Section -----------------------------------------------
> [EventLogCommonSection]
> AddReg=AddRegCommonEventLogSection
>
> [AddRegCommonEventLogSection]
> HKR,,"EventMessageFile",0x00020000,"%SystemRoot%\System32\iologmsg.dll;%12%\MyDriver.sys"
> HKR,,"TypesSupported",0x00010001,0x00000007
>
>
> "Volodymyr M. Shcherbyna" wrote:
>
> > If you open your sys file in resource editor (for example, reshacker), and
> > goto message table, what id do you see there for your custom message?
> >
> > --
> > Volodymyr, blog: http://www.shcherbyna.com/
> > (This posting is provided "AS IS" with no warranties, and confers no
> > rights)
> >
> > "Indira" <Indira@discussions.microsoft.com> wrote in message
> > news:29503D5E-AF48-491B-986F-D97A391D9424@microsoft.com...
> > > Hi,
> > >
> > > Is it possible to generate custom error log messages for SCSI miniport
> > > driver?
> > > I tried the following but no luck:
> > >
> > > 1. Created a message (.mc) file, compiled and generated a corresponding
> > > .rc
> > > and .bin file, as per WDK and sample code.
> > >
> > > 2. Updated .inf file for event log as mentioned in the WDK and added .sys
> > > file to look for messages.
> > >
> > > 3. Calling StorPortLogError() with this custom error ID.
> > >
> > > After installing this driver, an event is getting logged in the event log,
> > > however it complains that it's not able to find the description.
> > >
> > > The following message is displayed in the description instead of my custom
> > > error message.
> > >
> > > "The description for Event ID ( 11 ) in Source (xyz) cannot be found. The
> > > local computer may not have the necessary registry information or message
> > > DLL
> > > files to display messages from a remote computer. You may be able to use
> > > the
> > > /AUXSOURCE= flag to retrieve this description; see Help and Support for
> > > details. The following information is part of the event:
> > > \Device\RaidPort8.
> > > "
> > >
> > > Is it possible to have custom error messages in storport-miniport driver?
> > > If
> > > so could some one please point out the missing thing in the above steps?
> > >
> > > Thanks,
> > > Indira
> > >
> >
> >
> >

Re: SCSI miniport-Custom Log messages by Indira

Indira
Tue Jul 22 13:56:01 CDT 2008

Hi,

Thank you for the replies, here is the message table from .sys file.
I have added just one message to test and I don't see this message in the
log description.

1 MESSAGETABLE
{
65573, "Testing TEsting HBA"
}

Does this table look good?

I also include the msg.rc file generated by mc.exe as part of driver.rc.
The driver.res generated by the compiler has a message table and which is
same as .sys as shown above.

Isnâ??t it already linked as .sys file is referencing the table? And also if I
use IoWriteErrorLogEntry() instead of StorPortLogError(), does WHQL test not
complain about it?

Thanks,
Indira



"Volodymyr M. Shcherbyna" wrote:

> If you open your sys file in resource editor (for example, reshacker), and
> goto message table, what id do you see there for your custom message?
>
> --
> Volodymyr, blog: http://www.shcherbyna.com/
> (This posting is provided "AS IS" with no warranties, and confers no
> rights)
>
> "Indira" <Indira@discussions.microsoft.com> wrote in message
> news:29503D5E-AF48-491B-986F-D97A391D9424@microsoft.com...
> > Hi,
> >
> > Is it possible to generate custom error log messages for SCSI miniport
> > driver?
> > I tried the following but no luck:
> >
> > 1. Created a message (.mc) file, compiled and generated a corresponding
> > .rc
> > and .bin file, as per WDK and sample code.
> >
> > 2. Updated .inf file for event log as mentioned in the WDK and added .sys
> > file to look for messages.
> >
> > 3. Calling StorPortLogError() with this custom error ID.
> >
> > After installing this driver, an event is getting logged in the event log,
> > however it complains that it's not able to find the description.
> >
> > The following message is displayed in the description instead of my custom
> > error message.
> >
> > "The description for Event ID ( 11 ) in Source (xyz) cannot be found. The
> > local computer may not have the necessary registry information or message
> > DLL
> > files to display messages from a remote computer. You may be able to use
> > the
> > /AUXSOURCE= flag to retrieve this description; see Help and Support for
> > details. The following information is part of the event:
> > \Device\RaidPort8.
> > "
> >
> > Is it possible to have custom error messages in storport-miniport driver?
> > If
> > so could some one please point out the missing thing in the above steps?
> >
> > Thanks,
> > Indira
> >
>
>
>

Re: SCSI miniport-Custom Log messages by Indira

Indira
Wed Jul 23 02:06:00 CDT 2008

Hi,

Following parameteres were passed, while logging an event from the miniport
driver.

StorPortLogError(abcd,
NULL, 0, 0, 0,
TEST_MSG_TEST,
0);

With this, it logged an error in the event log with an event ID=11. In the
description it displayed that it can not find description for event ID 11.


Iâ??m wondering if StorPortLogError() ever takes any custom error messages.
When I tried following parameters, with a standard storport defined error
code as shown below.

StorPortLogError(abcd,
NULL, 0, 0, 0,
SP_BAD_FW_WARNING,
TEST_MSG_TEST);

It logged a â??Warningâ?? this time with an event ID=26 and still complaing
about not finding the description in .sys file.

Even following code, generated an error with event ID=11 in the event log.

StorPortLogError(abcd,
NULL, 0, 0, 0,
TEST_MSG_TEST,
TEST_MSG_TEST);

Does this StorPortLogError() accepts custom error messages?
If so where it might be looking for the description? As changing it to
SP_BAD_FW_WARNING seems to alter the behavior.

Thanks,
Indira


"Indira" wrote:

> Hi,
>
> Thank you for the replies, here is the message table from .sys file.
> I have added just one message to test and I don't see this message in the
> log description.
>
> 1 MESSAGETABLE
> {
> 65573, "Testing TEsting HBA"
> }
>
> Does this table look good?
>
> I also include the msg.rc file generated by mc.exe as part of driver.rc.
> The driver.res generated by the compiler has a message table and which is
> same as .sys as shown above.
>
> Isnâ??t it already linked as .sys file is referencing the table? And also if I
> use IoWriteErrorLogEntry() instead of StorPortLogError(), does WHQL test not
> complain about it?
>
> Thanks,
> Indira
>
>
>
> "Volodymyr M. Shcherbyna" wrote:
>
> > If you open your sys file in resource editor (for example, reshacker), and
> > goto message table, what id do you see there for your custom message?
> >
> > --
> > Volodymyr, blog: http://www.shcherbyna.com/
> > (This posting is provided "AS IS" with no warranties, and confers no
> > rights)
> >
> > "Indira" <Indira@discussions.microsoft.com> wrote in message
> > news:29503D5E-AF48-491B-986F-D97A391D9424@microsoft.com...
> > > Hi,
> > >
> > > Is it possible to generate custom error log messages for SCSI miniport
> > > driver?
> > > I tried the following but no luck:
> > >
> > > 1. Created a message (.mc) file, compiled and generated a corresponding
> > > .rc
> > > and .bin file, as per WDK and sample code.
> > >
> > > 2. Updated .inf file for event log as mentioned in the WDK and added .sys
> > > file to look for messages.
> > >
> > > 3. Calling StorPortLogError() with this custom error ID.
> > >
> > > After installing this driver, an event is getting logged in the event log,
> > > however it complains that it's not able to find the description.
> > >
> > > The following message is displayed in the description instead of my custom
> > > error message.
> > >
> > > "The description for Event ID ( 11 ) in Source (xyz) cannot be found. The
> > > local computer may not have the necessary registry information or message
> > > DLL
> > > files to display messages from a remote computer. You may be able to use
> > > the
> > > /AUXSOURCE= flag to retrieve this description; see Help and Support for
> > > details. The following information is part of the event:
> > > \Device\RaidPort8.
> > > "
> > >
> > > Is it possible to have custom error messages in storport-miniport driver?
> > > If
> > > so could some one please point out the missing thing in the above steps?
> > >
> > > Thanks,
> > > Indira
> > >
> >
> >
> >

Re: SCSI miniport-Custom Log messages by GottfriedStckl

GottfriedStckl
Wed Jul 23 05:07:01 CDT 2008

> 1 MESSAGETABLE
> {
> 65573, "Testing TEsting HBA"
> }
> Does this table look good?
Yes, if you really talk about the entry in your .sys file itself, this means
that the entry is in your .sys file and the problem is another. The way you
approaching the problem is correct so far. Now you can continue to search on
another point.

> Isnâ??t it already linked as .sys file is referencing the table? And also if I
> use IoWriteErrorLogEntry() instead of StorPortLogError(), does WHQL test not
> complain about it?
Just for information: If you log an error entry. the string of your error is
not postet to the eventlog service. Just the id, timestamp, asf.
When you oben the Windows eventviewer, it then searches the id, and then
looks for your .sys file and then takes the string out of the file. So, at
the time of logging, the string is NOT transferred (just for your
backgroundinformation).

So i still presume that the problem is, that your .sys file is not
registered correctly as data provider in the eventviewer's section in the
registry.
Since there is an entry (but with no useful information) this indicates that
your driver successfully posts the event into the eventqueue of the
loggingservice.
Now you have to figure out, why eventviewer is not able to recognize your
.sys file as data provider.

Re: SCSI miniport-Custom Log messages by GottfriedStckl

GottfriedStckl
Wed Jul 23 05:14:21 CDT 2008

I also wanted to let you know, that i have no experience with the
StorPortLogError() interface. But i am used to prefer the IoLogError...
Interface, since i know that this is absolutely the first choice for logging
information into eventlog.
I think that even though you use either interface for logging, the basic
fact is, that you must register you .sys file at the eventlogservice, so it
knows, where to extract the errorstrings...


> Hi,
>
> Following parameteres were passed, while logging an event from the miniport
> driver.
>
> StorPortLogError(abcd,
> NULL, 0, 0, 0,
> TEST_MSG_TEST,
> 0);
>
> With this, it logged an error in the event log with an event ID=11. In the
> description it displayed that it can not find description for event ID 11.
>
>
> Iâ??m wondering if StorPortLogError() ever takes any custom error messages.
> When I tried following parameters, with a standard storport defined error
> code as shown below.
>
> StorPortLogError(abcd,
> NULL, 0, 0, 0,
> SP_BAD_FW_WARNING,
> TEST_MSG_TEST);
>
> It logged a â??Warningâ?? this time with an event ID=26 and still complaing
> about not finding the description in .sys file.
>
> Even following code, generated an error with event ID=11 in the event log.
>
> StorPortLogError(abcd,
> NULL, 0, 0, 0,
> TEST_MSG_TEST,
> TEST_MSG_TEST);
>
> Does this StorPortLogError() accepts custom error messages?
> If so where it might be looking for the description? As changing it to
> SP_BAD_FW_WARNING seems to alter the behavior.
>
> Thanks,
> Indira
>
>
> "Indira" wrote:
>
> > Hi,
> >
> > Thank you for the replies, here is the message table from .sys file.
> > I have added just one message to test and I don't see this message in the
> > log description.
> >
> > 1 MESSAGETABLE
> > {
> > 65573, "Testing TEsting HBA"
> > }
> >
> > Does this table look good?
> >
> > I also include the msg.rc file generated by mc.exe as part of driver.rc.
> > The driver.res generated by the compiler has a message table and which is
> > same as .sys as shown above.
> >
> > Isnâ??t it already linked as .sys file is referencing the table? And also if I
> > use IoWriteErrorLogEntry() instead of StorPortLogError(), does WHQL test not
> > complain about it?
> >
> > Thanks,
> > Indira
> >
> >
> >
> > "Volodymyr M. Shcherbyna" wrote:
> >
> > > If you open your sys file in resource editor (for example, reshacker), and
> > > goto message table, what id do you see there for your custom message?
> > >
> > > --
> > > Volodymyr, blog: http://www.shcherbyna.com/
> > > (This posting is provided "AS IS" with no warranties, and confers no
> > > rights)
> > >
> > > "Indira" <Indira@discussions.microsoft.com> wrote in message
> > > news:29503D5E-AF48-491B-986F-D97A391D9424@microsoft.com...
> > > > Hi,
> > > >
> > > > Is it possible to generate custom error log messages for SCSI miniport
> > > > driver?
> > > > I tried the following but no luck:
> > > >
> > > > 1. Created a message (.mc) file, compiled and generated a corresponding
> > > > .rc
> > > > and .bin file, as per WDK and sample code.
> > > >
> > > > 2. Updated .inf file for event log as mentioned in the WDK and added .sys
> > > > file to look for messages.
> > > >
> > > > 3. Calling StorPortLogError() with this custom error ID.
> > > >
> > > > After installing this driver, an event is getting logged in the event log,
> > > > however it complains that it's not able to find the description.
> > > >
> > > > The following message is displayed in the description instead of my custom
> > > > error message.
> > > >
> > > > "The description for Event ID ( 11 ) in Source (xyz) cannot be found. The
> > > > local computer may not have the necessary registry information or message
> > > > DLL
> > > > files to display messages from a remote computer. You may be able to use
> > > > the
> > > > /AUXSOURCE= flag to retrieve this description; see Help and Support for
> > > > details. The following information is part of the event:
> > > > \Device\RaidPort8.
> > > > "
> > > >
> > > > Is it possible to have custom error messages in storport-miniport driver?
> > > > If
> > > > so could some one please point out the missing thing in the above steps?
> > > >
> > > > Thanks,
> > > > Indira
> > > >
> > >
> > >
> > >

Re: SCSI miniport-Custom Log messages by Maxim

Maxim
Fri Jul 25 09:12:10 CDT 2008

> â??The description for Event ID ( 11 ) in Source (xyz) cannot be found.

Add:

HKLM\SYSTEM\CurrentControlSet\Services\EventLog\System\<YourDriverServiceName>
TypesSupported DWORD 7
EventMessageFile EXPAND_SZ
%SystemRoot%\system32\drivers\YourDriverFileName.sys

You will probably also need to add the %SystemRoot%\system32\IoLogMsg.dll
before your driver with a semicolon.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: SCSI miniport-Custom Log messages by Maxim

Maxim
Fri Jul 25 09:13:39 CDT 2008

> I also wanted to let you know, that i have no experience with the
> StorPortLogError() interface. But i am used to prefer the IoLogError...

This is not important for the issue we're discussing. Events do result in the
log, the Event Viewer just cannot find the string table for them.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: SCSI miniport-Custom Log messages by Indira

Indira
Fri Jul 25 15:00:30 CDT 2008

Thank you all for the answers.

One more interesting thing I noticed is, though I pass different custom
error code, it always results into event ID=11. It looks like this
StorPortLogError() always expects error code, one from the predefined list,
defined in storport.h file. Has anyone encountered the same?

I could define custom error messages in NDIS driver and get it on to event
log without any problems. However I'm not able to do the same in SCSI
driver, could this be a restriction on SCSI miniport driver?

Thanks,
Indira


"Maxim S. Shatskih" wrote:

> > â??The description for Event ID ( 11 ) in Source (xyz) cannot be found.
>
> Add:
>
> HKLM\SYSTEM\CurrentControlSet\Services\EventLog\System\<YourDriverServiceName>
> TypesSupported DWORD 7
> EventMessageFile EXPAND_SZ
> %SystemRoot%\system32\drivers\YourDriverFileName.sys
>
> You will probably also need to add the %SystemRoot%\system32\IoLogMsg.dll
> before your driver with a semicolon.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
>