# File lib/win32/eventlog.rb, line 573
      def report_event(args)
         raise TypeError unless args.is_a?(Hash)
         
         valid_keys  = %w/source event_id category data event_type/
         num_strings = 0

         # Default values
         hash = {
            'source'   => @source,
            'event_id' => 0,
            'category' => 0,
            'data'     => 0
         }
         
         # Validate the keys, and convert symbols and case to lowercase strings.     
         args.each{ |key, val|
            key = key.to_s.downcase
            unless valid_keys.include?(key)
               raise ArgumentError, "invalid key '#{key}'"
            end
            hash[key] = val
         }
         
         # The event_type must be specified
         unless hash['event_type']
            raise Error, 'no event_type specified'
         end
         
         handle = RegisterEventSource(@server, hash['source'])
         
         if handle == 0
            error = 'RegisterEventSource() failed: ' + get_last_error
            raise Error, error
         end
         
         if hash['data'].is_a?(String)
            data = hash['data'] << 0.chr
            data = [data].pack('p*')
            num_strings = 1
         else
            data = 0
            num_strings = 0
         end
         
         bool = ReportEvent(
            handle,
            hash['event_type'],
            hash['category'],
            hash['event_id'],
            0,
            num_strings,
            0,
            data,
            0
         )
         
         unless bool
            error = 'ReportEvent() failed: ' + get_last_error
            raise Error, error
         end
         
         self
      end