ReportEvent generating incorrect error description

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I have an application in which I write events to event log viewer.
Before writing the events, I extract the NT Event information from the
message file. Example: I parse the Event Message file for Outlook and
extract the NT Event information. I get the event message file path
from the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\O­utlook

When I get the event information, I need to manually generate or write
that information into event log viewer. The information such as event
id, event desc and the severity.
I use the below API to write to event log:

void LogErrorMessage (HANDLE hSource, DWORD errcode, WORD errtype, char

*szMsg)
{
char *szList[1];
szList[0]=szMsg;
ReportEvent(hSource, EVENTLOG_INFORMATION_TYPE, 0, errcode,
NULL, 0,
NULL, (LPCTSTR*)szList[0], NULL );
}

Now when I execute the above function passing correct values, sometimes

I get the proper description written in the event log but sometimes I
get the below error description:

The description for Event ID ( 16 ) in Source ( Outlook ) 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: The event log file is corrupt.

I want to retrieve the event information successfully which is working
fine but writing the event to APPLICATION log is failing SOMETIMES.

Whats going wrong here? I have similar utility "SMGENIE.exe" which
successfully writes to event viewer.

Thanks,
Regards,
PI

.



Relevant Pages

  • Re: ReportEvent generating incorrect error description
    ... The way that eventlogs are *supposed* to work is that you provide a localized message resource DLL, and the event id is used to look up a format string. ... I have an application in which I write events to event log viewer. ... I extract the NT Event information from the ... I parse the Event Message file for Outlook and ...
    (microsoft.public.win32.programmer.kernel)
  • Re: ReportEvent generating incorrect error description
    ... string. ... I have an application in which I write events to event log viewer. ... I extract the NT Event information from the ... I parse the Event Message file for Outlook and ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Using Insertion Strings and Message Files when writing to event lo
    ... the dotnet languages newsgroups from the language you are using, ... I want to make full use of all the fields in an event log record - ... I would like to make use of a message file as well. ... but am giving it the insertion strings to combine with the message from ...
    (microsoft.public.dotnet.general)
  • Re: custom event log
    ... gotten that deep into event log stuff. ... Can we customize this standard message file? ... >> the standard .NET framework message file associated with it. ...
    (microsoft.public.dotnet.security)
  • RE: Event Log Resource Files
    ... sorted that writes to the event log, I just need to create the message file. ... > A Powerful Knowledge Sharing Platform ...
    (microsoft.public.vb.winapi)