0

I need to report an event that comes under critical category. Rest is working fine but i am having problems with using the ReportEvent for posting "critical" category event. Code sample is something like:

const WORD LM_NT_LOG_CATEGORY_CRITICAL = 1;

WORD category;

category = LM_NT_LOG_CATEGORY_UNKNOWN;

ReportEvent(hEventSource,logLevel,category, event,NULL,2,0,
                    (const TCHAR**) &lpszStrings,
                    NULL);

In Windows Event Viewer for this particular event i see a "1" in Category column instead of "critical". Can anyone please help me?

sandy
  • 616
  • 2
  • 9
  • 20
  • Take a look at this - the second answer may be relevant http://stackoverflow.com/questions/1290782/where-can-i-find-a-good-example-of-reportevent-function-usage – Jan S Nov 28 '11 at 09:56

1 Answers1

0

In order to get strings displayed in the Event Viewer you have to provide (and possibly localize) a mapping from your numeric categories. The rules are here.

Categories can be stored in a separate message file, or in a file that contains messages of other types. If you create a single message file, be sure that the categories are the first messages in the file.

Steve Townsend
  • 53,498
  • 9
  • 91
  • 140