Error Reading Event Log

M

Milind T

Hi All,

The ReadEventLog function fails with error "1783" The stub received bad
data". Here I had opend the event log of Windows 2003 server. It works fine
for windows 2000 server. Here is the code
# define BUFFER_SIZE 1024*10

HANDLE h;
EVENTLOGRECORD *pevlr;
BYTE bBuffer[BUFFER_SIZE];
DWORD dwRead, dwNeeded, cRecords, dwThisRecord;
h = OpenEventLog( "Windows2003ServerName", "Security");
pevlr = (EVENTLOGRECORD *) &bBuffer;
if(! ReadEventLog(h, // event log handle
EVENTLOG_FORWARDS_READ | // reads forward
EVENTLOG_SEQUENTIAL_READ, // sequential read
0, // ignored for sequential reads
pevlr, // pointer to buffer
BUFFER_SIZE, // size of buffer
&dwRead, // number of bytes read
&dwNeeded)) // bytes in next record
{
DWORD dwError = GetLastError(); // ******* Error 1783" The stub
received bad data".
}


# The function fails only if the event log oned is of Windows 2003
# This function execution fails on Winodws 2000 as wel as on Winddows 200.
# I observed that, the function succeeeds if I specified small buffer size.
Lest than 500K.
# The function works fine if the event log opened is Windows 2000


Thanks,
Milind
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top