ReportEvent generating incorrect error description
- From: ipramod@xxxxxxxxx
- Date: 18 Jan 2007 08:04:28 -0800
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\Outlook
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
.
- Follow-Ups:
- Re: ReportEvent generating incorrect error description
- From: Skywing [MVP]
- Re: ReportEvent generating incorrect error description
- Prev by Date: Single Stepping Problem
- Next by Date: Running Devcon.exe from a batch file using scheduler
- Previous by thread: Single Stepping Problem
- Next by thread: Re: ReportEvent generating incorrect error description
- Index(es):
Relevant Pages
|