[Win32utils-devel] eventlog

Heesob Park phasis at gmail.com
Tue Dec 4 20:06:14 EST 2007


Hi,

2007/12/5, Berger, Daniel <Daniel.Berger at qwest.com>:
>
> > -----Original Message-----
> > From: win32utils-devel-bounces at rubyforge.org
> > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of
> > Heesob Park
>
> <snip>
>
> > The win32-eventlog module needs to support of handling
> > parameters using ParameterMessageFile.
> >
> > Refer to
> > http://www.grimes.demon.co.uk/workshops/InstrWSEight.htm#nt_ev
> > ent_log ,
>
> I guess I'm not sure how supporting ParameterMessageFiles in the
> EventLog.add_event_source will fix what appears to be an issue in the
> get_description private method.
>
> In any case, is this patch all that's needed for the
> EventLog.add_event_source?
>
> ### Eclipse Workspace Patch 1.0
> #P win32-eventlog
> Index: lib/win32/eventlog.rb
> ===================================================================
> RCS file: /var/cvs/win32utils/win32-eventlog/lib/win32/eventlog.rb,v
> retrieving revision 1.36
> diff -u -r1.36 eventlog.rb
> --- lib/win32/eventlog.rb       4 Dec 2007 02:53:43 -0000       1.36
> +++ lib/win32/eventlog.rb       4 Dec 2007 17:28:24 -0000
> @@ -169,7 +169,7 @@
>          raise TypeError unless args.is_a?(Hash)
>
>          valid_keys = %w/source key_name category_count
> event_message_file
> -            category_message_file supported_types/
> +            category_message_file parameter_message_file
> supported_types/
>
>          key_base = "SYSTEM\\CurrentControlSet\\Services\\EventLog\\"
>
> @@ -315,6 +315,25 @@
>             end
>          end
>
> +         if hash['parameter_message_file']
> +            data = File.expand_path(hash['parameter_message_file'])
> +
> +            rv = RegSetValueEx(
> +               hkey,
> +               'ParameterMessageFile',
> +                0,
> +                REG_EXPAND_SZ,
> +                data,
> +                data.size
> +            )
> +
> +            if rv != ERROR_SUCCESS
> +               error = 'RegSetValueEx() failed: ' + get_last_error
> +               RegCloseKey(hkey)
> +               raise Error, error
> +            end
> +         end
> +
>          data = [hash['supported_types']].pack('L')
>          rv = RegSetValueEx(
>             hkey,
>
> Thanks,
>
> Dan


I meant the get_description method could handle not just EventMessagFile but
also ParameterMessageFile and other MessaeFiles like CategoryMessageFile,
GuidMessageFile to acquire correct description.

Regards,

Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20071205/30503484/attachment.html 


More information about the win32utils-devel mailing list