[Win32utils-devel] Need a little help with the pureRubywin32-eventlog

Berger, Daniel Daniel.Berger at qwest.com
Wed May 17 17:26:11 EDT 2006



> -----Original Message-----
> From: win32utils-devel-bounces at rubyforge.org 
> [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of 
> Berger, Daniel
> Sent: Wednesday, May 17, 2006 12:07 PM
> To: Development and ideas for win32utils projects
> Subject: Re: [Win32utils-devel] Need a little help with the 
> pureRubywin32-eventlog
> 
> 
> > -----Original Message-----
> > From: win32utils-devel-bounces at rubyforge.org
> > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of 
> > Heesob Park
> > Sent: Tuesday, May 16, 2006 9:51 PM
> > To: Development and ideas for win32utils projects
> > Subject: Re: [Win32utils-devel] Need a little help with the 
> > pure Rubywin32-eventlog
> > 
> > 
> > Hi,
> > 
> > 2006/5/17, Daniel Berger <djberg96 at gmail.com>:
> > > Hi all,
> > >
> > > I'm working on the EventLog#read method for the pure Ruby
> > version of
> > > win32-eventlog, but I'm stuck on the get_description 
> private method.
> > >
> > > Here are the problems:
> > >
> > > * I don't think I'm advancing the EVENTLOGRECORD properly between
> > > iterations.  Take a look at the end of the "while dwread > 
> > 0" loop.  I
> > > get some records, but not all of them.
> > >
> > > * I'm not sure how to properly populate or pack/unpack 
> the va_list,
> > > which is later passed to the FormatMessage() function.
> > >
> > > Please take a look.
> > >
> > > Thanks,
> > >
> > > Dan
> > 
> > Here is the patch:
> 
> <snip>
> 
> Thanks.  That mostly seems to work.  However, I'm hitting a 
> segfault after a few records.  As far as I can tell this 
> happens when +buf+ is empty, but I'm not positive that's the culprit.
> 
> I also noticed that FormatMessage's parameter list is defined 
> as 'LPLLPLP' in error.rb (from windows-pr).  Thinking that 
> might be the culprit I tried changing the second param to 
> 'L', but that didn't seem to have any effect.
> 
> Any ideas?
> 
> Dan

Here's some more info.  Using the C version of win32-eventlog I can see
the record in question looks like this:

#<struct Struct::EventLogStruct record_number=12302, time_generated=Sat
Mar 18 23:13:43 MST 2006, ti
me_written=Sat Mar 18 23:13:43 MST 2006, event_id=11203,
event_type="error", category=0, source="Sms
Client", computer="CO3840GDJBERGEX", user=nil, description="Software
updates evaluation failed: coul
d not locate the scan component of the specified software update
inventory tool.  The scan component
 advertisement might not have run on the client
computer.\r\n\r\nPossible cause: Incorrect package a
nd program name in the Scan.ini file.\r\nSolution:  Verify that the
package and program name specifi
ed in the scan.ini file are correct.\r\n\r\nPossible cause: Scan
component was never run on client.\
r\nSolution: Specify that the scan component is run in a program
dependency of the software updates
package. This will ensure that new client computers always run the scan
component before software up
date installation is attempted.">

The description length is 664, so we should have enough buffer space.
Hm...looking at the records that precede it, this appears to be the
first description that contains "\r\n" in it.

In other news I don't think the user code is right.  The pure Ruby
version returns 'djberge' for the user instead of nil as it should.

HTH,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.



More information about the win32utils-devel mailing list