Article View: borland.public.cppbuilder.nativeapi
Article #434Re: Using ReadEventLog()
From: Bob Gonder
Date: Mon, 14 Apr 2008 02:34
Date: Mon, 14 Apr 2008 02:34
27 lines
1986 bytes
1986 bytes
St๏ฟฝphane Lambert wrote:
> EVENTLOGRECORD CurrentEventLogRecord = {0};
> bool bSucceeded = ReadEventLog( hSystemEventLog,
> EVENTLOG_BACKWARDS_READ | EVENTLOG_SEQUENTIAL_READ,
> 0,
> &CurrentEventLogRecord,
> sizeof( CurrentEventLogRecord ),
> &dwBytesRead,
> &dwBytesNeeded );
> if ( bSucceeded == false )
> {
> showWindowsLastErrorMessage();
Also display sizeof(CurrentEventLogRecord) and dwBytesNeeded.
I suspect dwBytesNeeded is larger by a few bytes.
>When this code is executed, I get the following error:
> The data area passed to a system call is too small.
>
>What's the problem with this code?
Microsoft's example code uses a (large) char buffer,
and a moveable struct pointer. They also mention
there might be padding bytes added to the struct.
If you were supposed to read directly into a struct,
they probably would have shown it that way.
Technical Details
Message-ID:
<28g504du27t37u8ahncq2msjv410qrtk3l@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mailReferences:
<4802a44b@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4de00153f8983ebf X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Using ReadEventLog() Date: Sun, 13 Apr 2008 19:34:51 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <28g504du27t37u8ahncq2msjv410qrtk3l@4ax.com> References: <4802a44b@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 67.77.144.72 X-Trace: newsgroups.borland.com 1208140489 67.77.144.72 (13 Apr 2008 19:34:49 -0700) Lines: 29 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail