[Win32utils-devel] eventlog

Berger, Daniel Daniel.Berger at qwest.com
Tue Dec 4 12:30:08 EST 2007


> -----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


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