win32-eventlog 0.4.9 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +11 -0
 - data/MANIFEST +2 -3
 - data/README +2 -4
 - data/Rakefile +1 -2
 - data/lib/win32/eventlog.rb +231 -95
 - data/lib/win32/mc.rb +2 -2
 - data/test/{tc_eventlog.rb → test_eventlog.rb} +4 -2
 - data/test/test_mc.rb +67 -0
 - data/win32-eventlog-0.5.0.gem +0 -0
 - data/win32-eventlog.gemspec +7 -4
 - metadata +30 -8
 - data/test/tc_mc.rb +0 -47
 - data/test/ts_all.rb +0 -5
 
    
        data/CHANGES
    CHANGED
    
    | 
         @@ -1,3 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = 0.5.0 - 12-Sep-2008
         
     | 
| 
      
 2 
     | 
    
         
            +
            * Fixed an issue for Windows Vista and later where some event descriptions
         
     | 
| 
      
 3 
     | 
    
         
            +
              were missing. This fix requires windows-pr 0.9.3 or later.
         
     | 
| 
      
 4 
     | 
    
         
            +
            * The EventLog#full? method now raises an EventLog::Error if it should fail
         
     | 
| 
      
 5 
     | 
    
         
            +
              instead of a StandardError.
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Minor tweak to mc.rb - chomp the input file name if run as a program.
         
     | 
| 
      
 7 
     | 
    
         
            +
            * Added test-unit 2.0.0 or later as a dependency.
         
     | 
| 
      
 8 
     | 
    
         
            +
            * Added ptools as a dependency for the sake of the test suite.
         
     | 
| 
      
 9 
     | 
    
         
            +
            * Renamed the test files to start with 'test_'.
         
     | 
| 
      
 10 
     | 
    
         
            +
            * Removed the ts_all.rb file.
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
       1 
12 
     | 
    
         
             
            = 0.4.9 - 7-Sep-2008
         
     | 
| 
       2 
13 
     | 
    
         
             
            * The private get_description method, which is used internally to read the
         
     | 
| 
       3 
14 
     | 
    
         
             
              event log, has been updated to work with 64 bit Windows. The changes needed
         
     | 
    
        data/MANIFEST
    CHANGED
    
    
    
        data/README
    CHANGED
    
    | 
         @@ -8,7 +8,7 @@ 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            = Prerequisites
         
     | 
| 
       10 
10 
     | 
    
         
             
               Ruby 1.8.2 or later.
         
     | 
| 
       11 
     | 
    
         
            -
               windows-pr 0. 
     | 
| 
      
 11 
     | 
    
         
            +
               windows-pr 0.9.3 or later.
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
               The 'mc', 'rc' and 'link' command line tools are required to create and
         
     | 
| 
       14 
14 
     | 
    
         
             
               install message sources. You won't need these for simply reading from or
         
     | 
| 
         @@ -50,9 +50,7 @@ 
     | 
|
| 
       50 
50 
     | 
    
         
             
               them somewhere on your system.
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
            = Known Issues
         
     | 
| 
       53 
     | 
    
         
            -
                
     | 
| 
       54 
     | 
    
         
            -
               be picked up because of a new event logging format and api that Microsoft
         
     | 
| 
       55 
     | 
    
         
            -
               has introduced. This will be addressed in the next major release.
         
     | 
| 
      
 53 
     | 
    
         
            +
               None known.
         
     | 
| 
       56 
54 
     | 
    
         | 
| 
       57 
55 
     | 
    
         
             
               Please file any bug reports on the project page at
         
     | 
| 
       58 
56 
     | 
    
         
             
               http://www.rubyforge.org/projects/win32utils.
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/win32/eventlog.rb
    CHANGED
    
    | 
         @@ -38,7 +38,7 @@ module Win32 
     | 
|
| 
       38 
38 
     | 
    
         
             
                  extend Windows::Registry
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                  # The version of the win32-eventlog library
         
     | 
| 
       41 
     | 
    
         
            -
                  VERSION = '0. 
     | 
| 
      
 41 
     | 
    
         
            +
                  VERSION = '0.5.0'
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                  # Aliased read flags
         
     | 
| 
       44 
44 
     | 
    
         
             
                  FORWARDS_READ   = EVENTLOG_FORWARDS_READ
         
     | 
| 
         @@ -405,7 +405,7 @@ module Win32 
     | 
|
| 
       405 
405 
     | 
    
         
             
                     needed = [0].pack('L')
         
     | 
| 
       406 
406 
     | 
    
         | 
| 
       407 
407 
     | 
    
         
             
                     unless GetEventLogInformation(@handle, 0, buf, buf.size, needed)
         
     | 
| 
       408 
     | 
    
         
            -
                        raise 'GetEventLogInformation() failed: ' + get_last_error
         
     | 
| 
      
 408 
     | 
    
         
            +
                        raise Error, 'GetEventLogInformation() failed: ' + get_last_error
         
     | 
| 
       409 
409 
     | 
    
         
             
                     end
         
     | 
| 
       410 
410 
     | 
    
         | 
| 
       411 
411 
     | 
    
         
             
                     buf[0,4].unpack('L')[0] != 0
         
     | 
| 
         @@ -827,7 +827,7 @@ module Win32 
     | 
|
| 
       827 
827 
     | 
    
         
             
                  # buffer.
         
     | 
| 
       828 
828 
     | 
    
         
             
                  #      
         
     | 
| 
       829 
829 
     | 
    
         
             
                  def get_description(rec, event_source, lkey)
         
     | 
| 
       830 
     | 
    
         
            -
                     str     = rec[rec[36,4].unpack('L')[0] .. -1] 
     | 
| 
      
 830 
     | 
    
         
            +
                     str     = rec[rec[36,4].unpack('L')[0] .. -1]
         
     | 
| 
       831 
831 
     | 
    
         
             
                     num     = rec[26,2].unpack('S')[0] # NumStrings
         
     | 
| 
       832 
832 
     | 
    
         
             
                     hkey    = [0].pack('L')
         
     | 
| 
       833 
833 
     | 
    
         
             
                     key     = BASE_KEY + "#{@source}\\#{event_source}"
         
     | 
| 
         @@ -839,75 +839,199 @@ module Win32 
     | 
|
| 
       839 
839 
     | 
    
         
             
                           old_wow_val = 0.chr * 4
         
     | 
| 
       840 
840 
     | 
    
         
             
                           Wow64DisableWow64FsRedirection(old_wow_val)
         
     | 
| 
       841 
841 
     | 
    
         
             
                        end
         
     | 
| 
       842 
     | 
    
         
            -
             
     | 
| 
      
 842 
     | 
    
         
            +
             
     | 
| 
      
 843 
     | 
    
         
            +
                        param_exe = nil
         
     | 
| 
      
 844 
     | 
    
         
            +
                        message_exe = nil
         
     | 
| 
      
 845 
     | 
    
         
            +
             
     | 
| 
       843 
846 
     | 
    
         
             
                        if RegOpenKeyEx(lkey, key, 0, KEY_READ, hkey) == 0
         
     | 
| 
       844 
     | 
    
         
            -
                           value = 'ParameterMessageFile'
         
     | 
| 
       845 
     | 
    
         
            -
                           file  = 0.chr * MAX_SIZE
         
     | 
| 
       846 
847 
     | 
    
         
             
                           hkey  = hkey.unpack('L')[0]
         
     | 
| 
       847 
     | 
    
         
            -
             
     | 
| 
       848 
     | 
    
         
            -
             
     | 
| 
       849 
     | 
    
         
            -
                            
     | 
| 
       850 
     | 
    
         
            -
             
     | 
| 
       851 
     | 
    
         
            -
             
     | 
| 
      
 848 
     | 
    
         
            +
             
     | 
| 
      
 849 
     | 
    
         
            +
                           value = 'providerGuid'
         
     | 
| 
      
 850 
     | 
    
         
            +
                           guid  = 0.chr * MAX_SIZE
         
     | 
| 
      
 851 
     | 
    
         
            +
                           size  = [ guid.length].pack('L')
         
     | 
| 
      
 852 
     | 
    
         
            +
             
     | 
| 
      
 853 
     | 
    
         
            +
                           if RegQueryValueEx(hkey, value, 0, 0, guid, size) == 0
         
     | 
| 
      
 854 
     | 
    
         
            +
                              guid  = guid.nstrip
         
     | 
| 
      
 855 
     | 
    
         
            +
                              hkey2 = [0].pack('L')
         
     | 
| 
      
 856 
     | 
    
         
            +
                              key   = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
         
     | 
| 
      
 857 
     | 
    
         
            +
                              key   << "WINEVT\\Publishers\\#{guid}"
         
     | 
| 
      
 858 
     | 
    
         
            +
                             
         
     | 
| 
      
 859 
     | 
    
         
            +
                              if RegOpenKeyEx(lkey, key, 0, KEY_READ|0x100, hkey2) == 0
         
     | 
| 
      
 860 
     | 
    
         
            +
                                 hkey2  = hkey2.unpack('L')[0]
         
     | 
| 
      
 861 
     | 
    
         
            +
                                 value = 'ParameterMessageFile'
         
     | 
| 
      
 862 
     | 
    
         
            +
                                 file  = 0.chr * MAX_SIZE
         
     | 
| 
      
 863 
     | 
    
         
            +
                                 size  = [ file.length].pack('L')
         
     | 
| 
      
 864 
     | 
    
         
            +
             
     | 
| 
      
 865 
     | 
    
         
            +
                                 if RegQueryValueEx(hkey2, value, 0, 0, file, size) == 0
         
     | 
| 
      
 866 
     | 
    
         
            +
                                    file = file.nstrip
         
     | 
| 
      
 867 
     | 
    
         
            +
                                    exe  = 0.chr * MAX_SIZE
         
     | 
| 
      
 868 
     | 
    
         
            +
                                    ExpandEnvironmentStrings(file, exe, exe.size)
         
     | 
| 
      
 869 
     | 
    
         
            +
                                    param_exe = exe.nstrip
         
     | 
| 
      
 870 
     | 
    
         
            +
                                 end
         
     | 
| 
      
 871 
     | 
    
         
            +
                              
         
     | 
| 
      
 872 
     | 
    
         
            +
                                 value = 'MessageFileName'
         
     | 
| 
      
 873 
     | 
    
         
            +
                                 file  = 0.chr * MAX_SIZE
         
     | 
| 
      
 874 
     | 
    
         
            +
                                 size  = [file.length].pack('L')
         
     | 
| 
      
 875 
     | 
    
         
            +
             
     | 
| 
      
 876 
     | 
    
         
            +
                                 if RegQueryValueEx(hkey2, value, 0, 0, file, size) == 0
         
     | 
| 
      
 877 
     | 
    
         
            +
                                    file = file.nstrip
         
     | 
| 
      
 878 
     | 
    
         
            +
                                    exe  = 0.chr * MAX_SIZE
         
     | 
| 
      
 879 
     | 
    
         
            +
                                    ExpandEnvironmentStrings(file, exe, exe.size)
         
     | 
| 
      
 880 
     | 
    
         
            +
                                    message_exe = exe.nstrip
         
     | 
| 
      
 881 
     | 
    
         
            +
                                 end
         
     | 
| 
      
 882 
     | 
    
         
            +
                                 
         
     | 
| 
      
 883 
     | 
    
         
            +
                                 RegCloseKey(hkey2)
         
     | 
| 
      
 884 
     | 
    
         
            +
                              end
         
     | 
| 
      
 885 
     | 
    
         
            +
                           else
         
     | 
| 
      
 886 
     | 
    
         
            +
                              value = 'ParameterMessageFile'
         
     | 
| 
      
 887 
     | 
    
         
            +
                              file  = 0.chr * MAX_SIZE
         
     | 
| 
      
 888 
     | 
    
         
            +
                              size  = [ file.length].pack('L')
         
     | 
| 
      
 889 
     | 
    
         
            +
             
     | 
| 
      
 890 
     | 
    
         
            +
                              if RegQueryValueEx(hkey, value, 0, 0, file, size) == 0
         
     | 
| 
      
 891 
     | 
    
         
            +
                                 file = file.nstrip
         
     | 
| 
      
 892 
     | 
    
         
            +
                                 exe  = 0.chr * MAX_SIZE
         
     | 
| 
      
 893 
     | 
    
         
            +
                                 ExpandEnvironmentStrings(file, exe, exe.size)
         
     | 
| 
      
 894 
     | 
    
         
            +
                                 param_exe = exe.nstrip
         
     | 
| 
      
 895 
     | 
    
         
            +
                              end
         
     | 
| 
      
 896 
     | 
    
         
            +
             
     | 
| 
      
 897 
     | 
    
         
            +
                              value = 'EventMessageFile'
         
     | 
| 
      
 898 
     | 
    
         
            +
                              file  = 0.chr * MAX_SIZE
         
     | 
| 
      
 899 
     | 
    
         
            +
                              size  = [file.length].pack('L')
         
     | 
| 
      
 900 
     | 
    
         
            +
             
     | 
| 
      
 901 
     | 
    
         
            +
                              if RegQueryValueEx(hkey, value, 0, 0, file, size) == 0
         
     | 
| 
      
 902 
     | 
    
         
            +
                                 file = file.nstrip
         
     | 
| 
      
 903 
     | 
    
         
            +
                                 exe  = 0.chr * MAX_SIZE
         
     | 
| 
      
 904 
     | 
    
         
            +
                                 ExpandEnvironmentStrings(file, exe, exe.size)
         
     | 
| 
      
 905 
     | 
    
         
            +
                                 message_exe = exe.nstrip
         
     | 
| 
      
 906 
     | 
    
         
            +
                               end
         
     | 
| 
      
 907 
     | 
    
         
            +
                            end
         
     | 
| 
      
 908 
     | 
    
         
            +
                             
         
     | 
| 
      
 909 
     | 
    
         
            +
                            RegCloseKey(hkey)
         
     | 
| 
      
 910 
     | 
    
         
            +
                        elsif defined? EvtOpenPublisherMetadata # Vista or later
         
     | 
| 
      
 911 
     | 
    
         
            +
                           pubMetadata = EvtOpenPublisherMetadata(
         
     | 
| 
      
 912 
     | 
    
         
            +
                              0,
         
     | 
| 
      
 913 
     | 
    
         
            +
                              multi_to_wide(event_source),
         
     | 
| 
      
 914 
     | 
    
         
            +
                              0,
         
     | 
| 
      
 915 
     | 
    
         
            +
                              1024, # Default LCID
         
     | 
| 
      
 916 
     | 
    
         
            +
                              0
         
     | 
| 
      
 917 
     | 
    
         
            +
                           )
         
     | 
| 
      
 918 
     | 
    
         
            +
                          
         
     | 
| 
      
 919 
     | 
    
         
            +
                           if pubMetadata > 0
         
     | 
| 
      
 920 
     | 
    
         
            +
                              buf2 = 0.chr * 8192
         
     | 
| 
      
 921 
     | 
    
         
            +
                              val  = 0.chr*4
         
     | 
| 
      
 922 
     | 
    
         
            +
                             
         
     | 
| 
      
 923 
     | 
    
         
            +
                              EvtGetPublisherMetadataProperty(
         
     | 
| 
      
 924 
     | 
    
         
            +
                                 pubMetadata,
         
     | 
| 
      
 925 
     | 
    
         
            +
                                 2, # EvtPublisherMetadataParameterFilePath
         
     | 
| 
      
 926 
     | 
    
         
            +
                                 0,
         
     | 
| 
      
 927 
     | 
    
         
            +
                                 8192,
         
     | 
| 
      
 928 
     | 
    
         
            +
                                 buf2,
         
     | 
| 
      
 929 
     | 
    
         
            +
                                 val
         
     | 
| 
      
 930 
     | 
    
         
            +
                              )
         
     | 
| 
      
 931 
     | 
    
         
            +
                             
         
     | 
| 
      
 932 
     | 
    
         
            +
                              file = wide_to_multi(buf2[16..-1])
         
     | 
| 
      
 933 
     | 
    
         
            +
                              exe  = 0.chr * MAX_SIZE
         
     | 
| 
       852 
934 
     | 
    
         
             
                              ExpandEnvironmentStrings(file, exe, exe.size)
         
     | 
| 
       853 
     | 
    
         
            -
                               
     | 
| 
      
 935 
     | 
    
         
            +
                              param_exe = exe.nstrip
         
     | 
| 
      
 936 
     | 
    
         
            +
             
     | 
| 
      
 937 
     | 
    
         
            +
                              buf2 = 0.chr * 8192
         
     | 
| 
      
 938 
     | 
    
         
            +
                              val = 0.chr*4
         
     | 
| 
       854 
939 
     | 
    
         | 
| 
       855 
     | 
    
         
            -
                               
     | 
| 
       856 
     | 
    
         
            -
                                  
     | 
| 
      
 940 
     | 
    
         
            +
                              EvtGetPublisherMetadataProperty(
         
     | 
| 
      
 941 
     | 
    
         
            +
                                 pubMetadata,
         
     | 
| 
      
 942 
     | 
    
         
            +
                                 3, # EvtPublisherMetadataMessageFilePath
         
     | 
| 
      
 943 
     | 
    
         
            +
                                 0,
         
     | 
| 
      
 944 
     | 
    
         
            +
                                 8192,
         
     | 
| 
      
 945 
     | 
    
         
            +
                                 buf2,
         
     | 
| 
      
 946 
     | 
    
         
            +
                                 val
         
     | 
| 
      
 947 
     | 
    
         
            +
                              )
         
     | 
| 
       857 
948 
     | 
    
         | 
| 
       858 
     | 
    
         
            -
             
     | 
| 
       859 
     | 
    
         
            -
             
     | 
| 
       860 
     | 
    
         
            -
             
     | 
| 
       861 
     | 
    
         
            -
             
     | 
| 
      
 949 
     | 
    
         
            +
                              file = wide_to_multi(buf2[16..-1])
         
     | 
| 
      
 950 
     | 
    
         
            +
                              exe  = 0.chr * MAX_SIZE
         
     | 
| 
      
 951 
     | 
    
         
            +
                              ExpandEnvironmentStrings(file, exe, exe.size)
         
     | 
| 
      
 952 
     | 
    
         
            +
                              message_exe = exe.nstrip
         
     | 
| 
      
 953 
     | 
    
         
            +
                              EvtClose(pubMetadata)
         
     | 
| 
      
 954 
     | 
    
         
            +
                           end
         
     | 
| 
      
 955 
     | 
    
         
            +
                        end
         
     | 
| 
      
 956 
     | 
    
         
            +
             
     | 
| 
      
 957 
     | 
    
         
            +
                        if param_exe != nil
         
     | 
| 
      
 958 
     | 
    
         
            +
                           va_list = va_list0.map{ |v|
         
     | 
| 
      
 959 
     | 
    
         
            +
                              va = v
         
     | 
| 
      
 960 
     | 
    
         
            +
             
     | 
| 
      
 961 
     | 
    
         
            +
                              v.scan(/%%(\d+)/).uniq.each{ |x|
         
     | 
| 
      
 962 
     | 
    
         
            +
                                 param_exe.split(';').each{ |file|
         
     | 
| 
      
 963 
     | 
    
         
            +
                                    hmodule  = LoadLibraryEx(
         
     | 
| 
      
 964 
     | 
    
         
            +
                                       file,
         
     | 
| 
      
 965 
     | 
    
         
            +
                                       0,
         
     | 
| 
      
 966 
     | 
    
         
            +
                                       DONT_RESOLVE_DLL_REFERENCES |
         
     | 
| 
      
 967 
     | 
    
         
            +
                                       LOAD_LIBRARY_AS_DATAFILE
         
     | 
| 
      
 968 
     | 
    
         
            +
                                    )
         
     | 
| 
      
 969 
     | 
    
         
            +
             
     | 
| 
      
 970 
     | 
    
         
            +
                                    if hmodule != 0
         
     | 
| 
      
 971 
     | 
    
         
            +
                                       res = FormatMessage(
         
     | 
| 
      
 972 
     | 
    
         
            +
                                          FORMAT_MESSAGE_FROM_HMODULE |
         
     | 
| 
      
 973 
     | 
    
         
            +
                                          FORMAT_MESSAGE_ARGUMENT_ARRAY,
         
     | 
| 
      
 974 
     | 
    
         
            +
                                          hmodule,
         
     | 
| 
      
 975 
     | 
    
         
            +
                                          x.first.to_i,
         
     | 
| 
       862 
976 
     | 
    
         
             
                                          0,
         
     | 
| 
       863 
     | 
    
         
            -
                                           
     | 
| 
       864 
     | 
    
         
            -
                                           
     | 
| 
      
 977 
     | 
    
         
            +
                                          buf,
         
     | 
| 
      
 978 
     | 
    
         
            +
                                          buf.size,
         
     | 
| 
      
 979 
     | 
    
         
            +
                                          v
         
     | 
| 
       865 
980 
     | 
    
         
             
                                       )
         
     | 
| 
       866 
     | 
    
         
            -
             
     | 
| 
       867 
     | 
    
         
            -
                                       if  
     | 
| 
       868 
     | 
    
         
            -
                                           
     | 
| 
      
 981 
     | 
    
         
            +
                              
         
     | 
| 
      
 982 
     | 
    
         
            +
                                       if res == 0
         
     | 
| 
      
 983 
     | 
    
         
            +
                                          event_id = 0xB0000000 | event_id
         
     | 
| 
      
 984 
     | 
    
         
            +
                                          res = FormatMessage(
         
     | 
| 
       869 
985 
     | 
    
         
             
                                             FORMAT_MESSAGE_FROM_HMODULE |
         
     | 
| 
       870 
     | 
    
         
            -
                                              
     | 
| 
      
 986 
     | 
    
         
            +
                                             FORMAT_MESSAGE_IGNORE_INSERTS,
         
     | 
| 
       871 
987 
     | 
    
         
             
                                             hmodule,
         
     | 
| 
       872 
     | 
    
         
            -
                                              
     | 
| 
      
 988 
     | 
    
         
            +
                                             event_id,
         
     | 
| 
       873 
989 
     | 
    
         
             
                                             0,
         
     | 
| 
       874 
990 
     | 
    
         
             
                                             buf,
         
     | 
| 
       875 
991 
     | 
    
         
             
                                             buf.size,
         
     | 
| 
       876 
     | 
    
         
            -
                                              
     | 
| 
      
 992 
     | 
    
         
            +
                                             nil
         
     | 
| 
       877 
993 
     | 
    
         
             
                                          )
         
     | 
| 
       878 
     | 
    
         
            -
                                          FreeLibrary(hmodule)
         
     | 
| 
       879 
     | 
    
         
            -
                                          break if buf.nstrip != ""
         
     | 
| 
       880 
994 
     | 
    
         
             
                                       end
         
     | 
| 
       881 
     | 
    
         
            -
             
     | 
| 
       882 
     | 
    
         
            -
             
     | 
| 
      
 995 
     | 
    
         
            +
             
     | 
| 
      
 996 
     | 
    
         
            +
                                       FreeLibrary(hmodule)
         
     | 
| 
      
 997 
     | 
    
         
            +
                                       break if buf.nstrip != ""
         
     | 
| 
      
 998 
     | 
    
         
            +
                                    end
         
     | 
| 
       883 
999 
     | 
    
         
             
                                 }
         
     | 
| 
       884 
     | 
    
         
            -
                                 va
         
     | 
| 
      
 1000 
     | 
    
         
            +
                                 va = va.gsub("%%#{x.first}", buf.nstrip)
         
     | 
| 
       885 
1001 
     | 
    
         
             
                              }
         
     | 
| 
       886 
     | 
    
         
            -
             
     | 
| 
       887 
     | 
    
         
            -
             
     | 
| 
       888 
     | 
    
         
            -
             
     | 
| 
       889 
     | 
    
         
            -
             
     | 
| 
       890 
     | 
    
         
            -
             
     | 
| 
       891 
     | 
    
         
            -
             
     | 
| 
       892 
     | 
    
         
            -
             
     | 
| 
       893 
     | 
    
         
            -
             
     | 
| 
       894 
     | 
    
         
            -
             
     | 
| 
       895 
     | 
    
         
            -
             
     | 
| 
       896 
     | 
    
         
            -
             
     | 
| 
       897 
     | 
    
         
            -
             
     | 
| 
       898 
     | 
    
         
            -
             
     | 
| 
       899 
     | 
    
         
            -
                               
     | 
| 
       900 
     | 
    
         
            -
             
     | 
| 
       901 
     | 
    
         
            -
             
     | 
| 
       902 
     | 
    
         
            -
             
     | 
| 
      
 1002 
     | 
    
         
            +
                              va
         
     | 
| 
      
 1003 
     | 
    
         
            +
                           }
         
     | 
| 
      
 1004 
     | 
    
         
            +
                        end
         
     | 
| 
      
 1005 
     | 
    
         
            +
             
     | 
| 
      
 1006 
     | 
    
         
            +
                        if message_exe != nil
         
     | 
| 
      
 1007 
     | 
    
         
            +
                           buf  = 0.chr * 8192 # Reset the buffer
         
     | 
| 
      
 1008 
     | 
    
         
            +
             
     | 
| 
      
 1009 
     | 
    
         
            +
                           # Try to retrieve message *without* expanding the inserts yet
         
     | 
| 
      
 1010 
     | 
    
         
            +
                           message_exe.split(';').each{ |file|
         
     | 
| 
      
 1011 
     | 
    
         
            +
                              hmodule = LoadLibraryEx(
         
     | 
| 
      
 1012 
     | 
    
         
            +
                                 file,
         
     | 
| 
      
 1013 
     | 
    
         
            +
                                 0,
         
     | 
| 
      
 1014 
     | 
    
         
            +
                                 DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE
         
     | 
| 
      
 1015 
     | 
    
         
            +
                              )
         
     | 
| 
      
 1016 
     | 
    
         
            +
             
     | 
| 
      
 1017 
     | 
    
         
            +
                              event_id = rec[20,4].unpack('L')[0]
         
     | 
| 
      
 1018 
     | 
    
         
            +
                              
         
     | 
| 
      
 1019 
     | 
    
         
            +
                              if hmodule != 0
         
     | 
| 
      
 1020 
     | 
    
         
            +
                                 res = FormatMessage(
         
     | 
| 
      
 1021 
     | 
    
         
            +
                                    FORMAT_MESSAGE_FROM_HMODULE |
         
     | 
| 
      
 1022 
     | 
    
         
            +
                                    FORMAT_MESSAGE_IGNORE_INSERTS,
         
     | 
| 
      
 1023 
     | 
    
         
            +
                                    hmodule,
         
     | 
| 
      
 1024 
     | 
    
         
            +
                                    event_id,
         
     | 
| 
       903 
1025 
     | 
    
         
             
                                    0,
         
     | 
| 
       904 
     | 
    
         
            -
                                     
     | 
| 
      
 1026 
     | 
    
         
            +
                                    buf,
         
     | 
| 
      
 1027 
     | 
    
         
            +
                                    buf.size,
         
     | 
| 
      
 1028 
     | 
    
         
            +
                                    nil
         
     | 
| 
       905 
1029 
     | 
    
         
             
                                 )
         
     | 
| 
       906 
     | 
    
         
            -
             
     | 
| 
       907 
     | 
    
         
            -
                                  
     | 
| 
       908 
     | 
    
         
            -
             
     | 
| 
       909 
     | 
    
         
            -
             
     | 
| 
       910 
     | 
    
         
            -
                                    FormatMessage(
         
     | 
| 
      
 1030 
     | 
    
         
            +
                              
         
     | 
| 
      
 1031 
     | 
    
         
            +
                                 if res == 0
         
     | 
| 
      
 1032 
     | 
    
         
            +
                                    event_id = 0xB0000000 | event_id
         
     | 
| 
      
 1033 
     | 
    
         
            +
                              
         
     | 
| 
      
 1034 
     | 
    
         
            +
                                    res = FormatMessage(
         
     | 
| 
       911 
1035 
     | 
    
         
             
                                       FORMAT_MESSAGE_FROM_HMODULE |
         
     | 
| 
       912 
1036 
     | 
    
         
             
                                       FORMAT_MESSAGE_IGNORE_INSERTS,
         
     | 
| 
       913 
1037 
     | 
    
         
             
                                       hmodule,
         
     | 
| 
         @@ -917,39 +1041,52 @@ module Win32 
     | 
|
| 
       917 
1041 
     | 
    
         
             
                                       buf.size,
         
     | 
| 
       918 
1042 
     | 
    
         
             
                                       nil
         
     | 
| 
       919 
1043 
     | 
    
         
             
                                    )
         
     | 
| 
       920 
     | 
    
         
            -
                                         
         
     | 
| 
       921 
     | 
    
         
            -
                                    FreeLibrary(hmodule)
         
     | 
| 
       922 
     | 
    
         
            -
                                    break if buf.nstrip != "" # All messages read
         
     | 
| 
       923 
1044 
     | 
    
         
             
                                 end
         
     | 
| 
       924 
     | 
    
         
            -
                              }
         
     | 
| 
       925 
1045 
     | 
    
         | 
| 
       926 
     | 
    
         
            -
             
     | 
| 
       927 
     | 
    
         
            -
             
     | 
| 
       928 
     | 
    
         
            -
                              # Determine higest %n insert number
         
     | 
| 
       929 
     | 
    
         
            -
                              max_insert = [num, buf.nstrip.scan(/%(\d+)/).map{ |x| x[0].to_i }.max].compact.max
         
     | 
| 
       930 
     | 
    
         
            -
             
     | 
| 
       931 
     | 
    
         
            -
                              # Insert dummy strings not provided by caller
         
     | 
| 
       932 
     | 
    
         
            -
                              ((num+1)..(max_insert)).each{ |x| va_list.push("%#{x}") }
         
     | 
| 
       933 
     | 
    
         
            -
                     
         
     | 
| 
       934 
     | 
    
         
            -
                              if num == 0
         
     | 
| 
       935 
     | 
    
         
            -
                                 va_list_ptr = 0.chr * 4
         
     | 
| 
       936 
     | 
    
         
            -
                              else
         
     | 
| 
       937 
     | 
    
         
            -
                                 va_list_ptr = va_list.map{ |x|
         
     | 
| 
       938 
     | 
    
         
            -
                                    [x + 0.chr].pack('P').unpack('L')[0]
         
     | 
| 
       939 
     | 
    
         
            -
                                 }.pack('L*')
         
     | 
| 
      
 1046 
     | 
    
         
            +
                                 FreeLibrary(hmodule)
         
     | 
| 
      
 1047 
     | 
    
         
            +
                                 break if buf.nstrip != "" # All messages read
         
     | 
| 
       940 
1048 
     | 
    
         
             
                              end
         
     | 
| 
       941 
     | 
    
         
            -
             
     | 
| 
       942 
     | 
    
         
            -
             
     | 
| 
       943 
     | 
    
         
            -
             
     | 
| 
       944 
     | 
    
         
            -
             
     | 
| 
      
 1049 
     | 
    
         
            +
                           }
         
     | 
| 
      
 1050 
     | 
    
         
            +
             
     | 
| 
      
 1051 
     | 
    
         
            +
                           # Determine higest %n insert number
         
     | 
| 
      
 1052 
     | 
    
         
            +
                           max_insert = [num, buf.nstrip.scan(/%(\d+)/).map{ |x| x[0].to_i }.max].compact.max
         
     | 
| 
      
 1053 
     | 
    
         
            +
             
     | 
| 
      
 1054 
     | 
    
         
            +
                           # Insert dummy strings not provided by caller
         
     | 
| 
      
 1055 
     | 
    
         
            +
                           ((num+1)..(max_insert)).each{ |x| va_list.push("%#{x}") }
         
     | 
| 
      
 1056 
     | 
    
         
            +
             
     | 
| 
      
 1057 
     | 
    
         
            +
                           if num == 0
         
     | 
| 
      
 1058 
     | 
    
         
            +
                              va_list_ptr = 0.chr * 4
         
     | 
| 
      
 1059 
     | 
    
         
            +
                           else
         
     | 
| 
      
 1060 
     | 
    
         
            +
                              va_list_ptr = va_list.map{ |x|
         
     | 
| 
      
 1061 
     | 
    
         
            +
                                 [x + 0.chr].pack('P').unpack('L')[0]
         
     | 
| 
      
 1062 
     | 
    
         
            +
                              }.pack('L*')
         
     | 
| 
      
 1063 
     | 
    
         
            +
                           end
         
     | 
| 
      
 1064 
     | 
    
         
            +
                              
         
     | 
| 
      
 1065 
     | 
    
         
            +
                           message_exe.split(';').each{ |file|
         
     | 
| 
      
 1066 
     | 
    
         
            +
                              hmodule = LoadLibraryEx(
         
     | 
| 
      
 1067 
     | 
    
         
            +
                                 file,
         
     | 
| 
      
 1068 
     | 
    
         
            +
                                 0,
         
     | 
| 
      
 1069 
     | 
    
         
            +
                                 DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE
         
     | 
| 
      
 1070 
     | 
    
         
            +
                              )
         
     | 
| 
      
 1071 
     | 
    
         
            +
             
     | 
| 
      
 1072 
     | 
    
         
            +
                              event_id = rec[20,4].unpack('L')[0]
         
     | 
| 
      
 1073 
     | 
    
         
            +
             
     | 
| 
      
 1074 
     | 
    
         
            +
                              if hmodule != 0
         
     | 
| 
      
 1075 
     | 
    
         
            +
                                 res = FormatMessage(
         
     | 
| 
      
 1076 
     | 
    
         
            +
                                    FORMAT_MESSAGE_FROM_HMODULE |
         
     | 
| 
      
 1077 
     | 
    
         
            +
                                    FORMAT_MESSAGE_ARGUMENT_ARRAY,
         
     | 
| 
      
 1078 
     | 
    
         
            +
                                    hmodule,
         
     | 
| 
      
 1079 
     | 
    
         
            +
                                    event_id,
         
     | 
| 
       945 
1080 
     | 
    
         
             
                                    0,
         
     | 
| 
       946 
     | 
    
         
            -
                                     
     | 
| 
      
 1081 
     | 
    
         
            +
                                    buf,
         
     | 
| 
      
 1082 
     | 
    
         
            +
                                    buf.size,
         
     | 
| 
      
 1083 
     | 
    
         
            +
                                    va_list_ptr
         
     | 
| 
       947 
1084 
     | 
    
         
             
                                 )
         
     | 
| 
       948 
     | 
    
         
            -
             
     | 
| 
       949 
     | 
    
         
            -
                                 event_id = rec[20,4].unpack('L')[0]
         
     | 
| 
       950 
1085 
     | 
    
         | 
| 
       951 
     | 
    
         
            -
                                 if  
     | 
| 
       952 
     | 
    
         
            -
                                     
     | 
| 
      
 1086 
     | 
    
         
            +
                                 if res == 0
         
     | 
| 
      
 1087 
     | 
    
         
            +
                                    event_id = 0xB0000000 | event_id
         
     | 
| 
      
 1088 
     | 
    
         
            +
                              
         
     | 
| 
      
 1089 
     | 
    
         
            +
                                    res = FormatMessage(
         
     | 
| 
       953 
1090 
     | 
    
         
             
                                       FORMAT_MESSAGE_FROM_HMODULE |
         
     | 
| 
       954 
1091 
     | 
    
         
             
                                       FORMAT_MESSAGE_ARGUMENT_ARRAY,
         
     | 
| 
       955 
1092 
     | 
    
         
             
                                       hmodule,
         
     | 
| 
         @@ -959,21 +1096,20 @@ module Win32 
     | 
|
| 
       959 
1096 
     | 
    
         
             
                                       buf.size,
         
     | 
| 
       960 
1097 
     | 
    
         
             
                                       va_list_ptr
         
     | 
| 
       961 
1098 
     | 
    
         
             
                                    )
         
     | 
| 
       962 
     | 
    
         
            -
                                         
         
     | 
| 
       963 
     | 
    
         
            -
                                    FreeLibrary(hmodule)
         
     | 
| 
       964 
     | 
    
         
            -
                                    break if buf.nstrip != "" # All messages read
         
     | 
| 
       965 
1099 
     | 
    
         
             
                                 end
         
     | 
| 
       966 
     | 
    
         
            -
             
     | 
| 
       967 
     | 
    
         
            -
             
     | 
| 
       968 
     | 
    
         
            -
             
     | 
| 
       969 
     | 
    
         
            -
             
     | 
| 
       970 
     | 
    
         
            -
             
     | 
| 
       971 
     | 
    
         
            -
                        if defined? Wow64RevertWow64FsRedirection
         
     | 
| 
       972 
     | 
    
         
            -
                           Wow64RevertWow64FsRedirection(old_wow_val.unpack('L')[0])
         
     | 
| 
      
 1100 
     | 
    
         
            +
             
     | 
| 
      
 1101 
     | 
    
         
            +
                                 FreeLibrary(hmodule)
         
     | 
| 
      
 1102 
     | 
    
         
            +
                                 break if buf.nstrip != "" # All messages read
         
     | 
| 
      
 1103 
     | 
    
         
            +
                              end
         
     | 
| 
      
 1104 
     | 
    
         
            +
                           }
         
     | 
| 
       973 
1105 
     | 
    
         
             
                        end
         
     | 
| 
       974 
     | 
    
         
            -
             
     | 
| 
      
 1106 
     | 
    
         
            +
                    ensure
         
     | 
| 
      
 1107 
     | 
    
         
            +
                       if defined? Wow64RevertWow64FsRedirection
         
     | 
| 
      
 1108 
     | 
    
         
            +
                          Wow64RevertWow64FsRedirection(old_wow_val.unpack('L')[0])
         
     | 
| 
      
 1109 
     | 
    
         
            +
                       end
         
     | 
| 
      
 1110 
     | 
    
         
            +
                    end
         
     | 
| 
       975 
1111 
     | 
    
         | 
| 
       976 
     | 
    
         
            -
             
     | 
| 
       977 
     | 
    
         
            -
             
     | 
| 
      
 1112 
     | 
    
         
            +
                    [va_list0, buf.nstrip]
         
     | 
| 
      
 1113 
     | 
    
         
            +
                 end      
         
     | 
| 
       978 
1114 
     | 
    
         
             
               end
         
     | 
| 
       979 
     | 
    
         
            -
            end
         
     | 
| 
      
 1115 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/win32/mc.rb
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ module Win32 
     | 
|
| 
       2 
2 
     | 
    
         
             
               class MC
         
     | 
| 
       3 
3 
     | 
    
         
             
                  class Error < StandardError; end;
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                  VERSION = '0.1. 
     | 
| 
      
 5 
     | 
    
         
            +
                  VERSION = '0.1.4'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                  attr_accessor :mc_file, :res_file, :dll_file
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
         @@ -97,7 +97,7 @@ if $0 == __FILE__ 
     | 
|
| 
       97 
97 
     | 
    
         
             
            		raise MC::Error, msg
         
     | 
| 
       98 
98 
     | 
    
         
             
            	end
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
            	m = MC.new(mc_file)
         
     | 
| 
      
 100 
     | 
    
         
            +
            	m = MC.new(mc_file.chomp)
         
     | 
| 
       101 
101 
     | 
    
         
             
            	m.create_header
         
     | 
| 
       102 
102 
     | 
    
         
             
            	m.create_res_file
         
     | 
| 
       103 
103 
     | 
    
         
             
            	m.create_dll_file
         
     | 
| 
         @@ -1,10 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ##############################################################################
         
     | 
| 
       2 
     | 
    
         
            -
            #  
     | 
| 
      
 2 
     | 
    
         
            +
            # test_eventlog.rb
         
     | 
| 
       3 
3 
     | 
    
         
             
            #
         
     | 
| 
       4 
4 
     | 
    
         
             
            # Test case for the win32-eventlog package. You should run this test case
         
     | 
| 
       5 
5 
     | 
    
         
             
            # via the 'rake test' Rakefile task. This test will take a minute or two
         
     | 
| 
       6 
6 
     | 
    
         
             
            # to complete.
         
     | 
| 
       7 
7 
     | 
    
         
             
            #############################################################################
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 9 
     | 
    
         
            +
            gem 'test-unit'
         
     | 
| 
       8 
10 
     | 
    
         
             
            require 'test/unit'
         
     | 
| 
       9 
11 
     | 
    
         
             
            require 'win32/eventlog'
         
     | 
| 
       10 
12 
     | 
    
         
             
            require 'socket'
         
     | 
| 
         @@ -23,7 +25,7 @@ class TC_EventLog < Test::Unit::TestCase 
     | 
|
| 
       23 
25 
     | 
    
         
             
               end
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
27 
     | 
    
         
             
               def test_version
         
     | 
| 
       26 
     | 
    
         
            -
                  assert_equal('0. 
     | 
| 
      
 28 
     | 
    
         
            +
                  assert_equal('0.5.0', EventLog::VERSION)
         
     | 
| 
       27 
29 
     | 
    
         
             
               end
         
     | 
| 
       28 
30 
     | 
    
         | 
| 
       29 
31 
     | 
    
         
             
               # Use the alias to validate it as well.
         
     | 
    
        data/test/test_mc.rb
    ADDED
    
    | 
         @@ -0,0 +1,67 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ############################################################################
         
     | 
| 
      
 2 
     | 
    
         
            +
            # test_mc.rb
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Test suite for the win32-mc library. The tests need to run in a specific
         
     | 
| 
      
 5 
     | 
    
         
            +
            # order, hence the numerics added to the method names.
         
     | 
| 
      
 6 
     | 
    
         
            +
            #
         
     | 
| 
      
 7 
     | 
    
         
            +
            # This test case should be run via the 'rake test' Rakefile task.
         
     | 
| 
      
 8 
     | 
    
         
            +
            ############################################################################
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 10 
     | 
    
         
            +
            gem 'test-unit'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'test/unit'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require 'win32/mc'
         
     | 
| 
      
 13 
     | 
    
         
            +
            require 'ptools'
         
     | 
| 
      
 14 
     | 
    
         
            +
            include Win32
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            class TC_Win32_MC < Test::Unit::TestCase
         
     | 
| 
      
 17 
     | 
    
         
            +
               class << self
         
     | 
| 
      
 18 
     | 
    
         
            +
                  def startup
         
     | 
| 
      
 19 
     | 
    
         
            +
                     Dir.chdir('test') unless File.basename(Dir.pwd) == 'test'
         
     | 
| 
      
 20 
     | 
    
         
            +
                     @@mc_cmd = File.which('mc')
         
     | 
| 
      
 21 
     | 
    
         
            +
                     @@rc_cmd = File.which('rc')
         
     | 
| 
      
 22 
     | 
    
         
            +
                     @@link_cmd = File.which('link')
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  
         
     | 
| 
      
 25 
     | 
    
         
            +
                  def shutdown
         
     | 
| 
      
 26 
     | 
    
         
            +
                     @@mc_cmd = nil
         
     | 
| 
      
 27 
     | 
    
         
            +
                     @@rc_cmd = nil
         
     | 
| 
      
 28 
     | 
    
         
            +
                     @@link_cmd = nil
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end      
         
     | 
| 
      
 30 
     | 
    
         
            +
               end
         
     | 
| 
      
 31 
     | 
    
         
            +
               
         
     | 
| 
      
 32 
     | 
    
         
            +
               def setup 
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @mc = MC.new('foo.mc')
         
     | 
| 
      
 34 
     | 
    
         
            +
               end
         
     | 
| 
      
 35 
     | 
    
         
            +
               
         
     | 
| 
      
 36 
     | 
    
         
            +
               def test_01_version
         
     | 
| 
      
 37 
     | 
    
         
            +
                  assert_equal('0.1.4', MC::VERSION)
         
     | 
| 
      
 38 
     | 
    
         
            +
               end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
               def test_02_create_header
         
     | 
| 
      
 41 
     | 
    
         
            +
                  omit_if(@@mc_cmd.nil?, "'mc' command not found - skipping")
         
     | 
| 
      
 42 
     | 
    
         
            +
                  assert_respond_to(@mc, :create_header)
         
     | 
| 
      
 43 
     | 
    
         
            +
                  assert_equal(true, @mc.create_header)
         
     | 
| 
      
 44 
     | 
    
         
            +
               end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
               def test_03_create_res_file
         
     | 
| 
      
 47 
     | 
    
         
            +
                  omit_if(@@rc_cmd.nil?, "'rc' command not found - skipping")
         
     | 
| 
      
 48 
     | 
    
         
            +
                  assert_respond_to(@mc, :create_res_file)
         
     | 
| 
      
 49 
     | 
    
         
            +
                  assert_equal(true, @mc.create_res_file)
         
     | 
| 
      
 50 
     | 
    
         
            +
               end
         
     | 
| 
      
 51 
     | 
    
         
            +
               
         
     | 
| 
      
 52 
     | 
    
         
            +
               def test_04_create_dll_file
         
     | 
| 
      
 53 
     | 
    
         
            +
                  omit_if(@@link_cmd.nil?, "'link' command not found - skipping")
         
     | 
| 
      
 54 
     | 
    
         
            +
                  assert_respond_to(@mc, :create_dll_file)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  assert_equal(true, @mc.create_dll_file)
         
     | 
| 
      
 56 
     | 
    
         
            +
               end
         
     | 
| 
      
 57 
     | 
    
         
            +
               
         
     | 
| 
      
 58 
     | 
    
         
            +
               def test_05_clean
         
     | 
| 
      
 59 
     | 
    
         
            +
                  assert_respond_to(@mc, :clean)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  assert_nothing_raised{ @mc.clean }
         
     | 
| 
      
 61 
     | 
    
         
            +
               end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
               def teardown
         
     | 
| 
      
 64 
     | 
    
         
            +
                  @mc = nil
         
     | 
| 
      
 65 
     | 
    
         
            +
                  File.delete('foo.dll') rescue nil
         
     | 
| 
      
 66 
     | 
    
         
            +
               end
         
     | 
| 
      
 67 
     | 
    
         
            +
            end
         
     | 
| 
         
            File without changes
         
     | 
    
        data/win32-eventlog.gemspec
    CHANGED
    
    | 
         @@ -2,20 +2,23 @@ require "rubygems" 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            spec = Gem::Specification.new do |gem|
         
     | 
| 
       4 
4 
     | 
    
         
             
               gem.name        = "win32-eventlog"
         
     | 
| 
       5 
     | 
    
         
            -
               gem.version     = "0. 
     | 
| 
       6 
     | 
    
         
            -
               gem. 
     | 
| 
      
 5 
     | 
    
         
            +
               gem.version     = "0.5.0"
         
     | 
| 
      
 6 
     | 
    
         
            +
               gem.authors     = ["Daniel J. Berger", "Park Heesob"]
         
     | 
| 
       7 
7 
     | 
    
         
             
               gem.email       = "djberg96@gmail.com"
         
     | 
| 
       8 
8 
     | 
    
         
             
               gem.homepage    = "http://www.rubyforge.org/projects/win32utils"
         
     | 
| 
       9 
9 
     | 
    
         
             
               gem.platform    = Gem::Platform::RUBY
         
     | 
| 
       10 
10 
     | 
    
         
             
               gem.summary     = "Interface for the MS Windows Event Log."
         
     | 
| 
       11 
11 
     | 
    
         
             
               gem.description = "Interface for the MS Windows Event Log."
         
     | 
| 
       12 
     | 
    
         
            -
               gem. 
     | 
| 
      
 12 
     | 
    
         
            +
               gem.test_files  = Dir["test/*.rb"]
         
     | 
| 
       13 
13 
     | 
    
         
             
               gem.has_rdoc    = true
         
     | 
| 
      
 14 
     | 
    
         
            +
               gem.rubyforge_project = 'win32utils'
         
     | 
| 
       14 
15 
     | 
    
         
             
               gem.files       = Dir["lib/win32/*.rb"] + Dir["test/*"] + Dir["[A-Z]*"]
         
     | 
| 
       15 
16 
     | 
    
         
             
               gem.files.reject! { |fn| fn.include? "CVS" }
         
     | 
| 
       16 
17 
     | 
    
         
             
               gem.require_path = "lib"
         
     | 
| 
       17 
18 
     | 
    
         
             
               gem.extra_rdoc_files = ["README", "CHANGES", "MANIFEST", "doc/tutorial.txt"]
         
     | 
| 
       18 
     | 
    
         
            -
               gem.add_dependency("windows-pr", ">= 0. 
     | 
| 
      
 19 
     | 
    
         
            +
               gem.add_dependency("windows-pr", ">= 0.9.3")
         
     | 
| 
      
 20 
     | 
    
         
            +
               gem.add_dependency("ptools", ">= 1.1.6")
         
     | 
| 
      
 21 
     | 
    
         
            +
               gem.add_dependency("test-unit", ">= 2.0.0")
         
     | 
| 
       19 
22 
     | 
    
         
             
            end
         
     | 
| 
       20 
23 
     | 
    
         | 
| 
       21 
24 
     | 
    
         
             
            if $0 == __FILE__
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: win32-eventlog
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Daniel J. Berger
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Park Heesob
         
     | 
| 
       8 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2008-09- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2008-09-12 00:00:00 -06:00
         
     | 
| 
       13 
14 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
15 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -20,7 +21,27 @@ dependencies: 
     | 
|
| 
       20 
21 
     | 
    
         
             
                requirements: 
         
     | 
| 
       21 
22 
     | 
    
         
             
                - - ">="
         
     | 
| 
       22 
23 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       23 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 24 
     | 
    
         
            +
                    version: 0.9.3
         
     | 
| 
      
 25 
     | 
    
         
            +
                version: 
         
     | 
| 
      
 26 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 27 
     | 
    
         
            +
              name: ptools
         
     | 
| 
      
 28 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 29 
     | 
    
         
            +
              version_requirement: 
         
     | 
| 
      
 30 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 31 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 32 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 33 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 34 
     | 
    
         
            +
                    version: 1.1.6
         
     | 
| 
      
 35 
     | 
    
         
            +
                version: 
         
     | 
| 
      
 36 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 37 
     | 
    
         
            +
              name: test-unit
         
     | 
| 
      
 38 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 39 
     | 
    
         
            +
              version_requirement: 
         
     | 
| 
      
 40 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 41 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 42 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 43 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 44 
     | 
    
         
            +
                    version: 2.0.0
         
     | 
| 
       24 
45 
     | 
    
         
             
                version: 
         
     | 
| 
       25 
46 
     | 
    
         
             
            description: Interface for the MS Windows Event Log.
         
     | 
| 
       26 
47 
     | 
    
         
             
            email: djberg96@gmail.com
         
     | 
| 
         @@ -37,9 +58,8 @@ files: 
     | 
|
| 
       37 
58 
     | 
    
         
             
            - lib/win32/eventlog.rb
         
     | 
| 
       38 
59 
     | 
    
         
             
            - lib/win32/mc.rb
         
     | 
| 
       39 
60 
     | 
    
         
             
            - test/foo.mc
         
     | 
| 
       40 
     | 
    
         
            -
            - test/ 
     | 
| 
       41 
     | 
    
         
            -
            - test/ 
     | 
| 
       42 
     | 
    
         
            -
            - test/ts_all.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - test/test_eventlog.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - test/test_mc.rb
         
     | 
| 
       43 
63 
     | 
    
         
             
            - CHANGES
         
     | 
| 
       44 
64 
     | 
    
         
             
            - doc
         
     | 
| 
       45 
65 
     | 
    
         
             
            - examples
         
     | 
| 
         @@ -49,6 +69,7 @@ files: 
     | 
|
| 
       49 
69 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       50 
70 
     | 
    
         
             
            - README
         
     | 
| 
       51 
71 
     | 
    
         
             
            - test
         
     | 
| 
      
 72 
     | 
    
         
            +
            - win32-eventlog-0.5.0.gem
         
     | 
| 
       52 
73 
     | 
    
         
             
            - win32-eventlog.gemspec
         
     | 
| 
       53 
74 
     | 
    
         
             
            - doc/tutorial.txt
         
     | 
| 
       54 
75 
     | 
    
         
             
            has_rdoc: true
         
     | 
| 
         @@ -72,10 +93,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       72 
93 
     | 
    
         
             
              version: 
         
     | 
| 
       73 
94 
     | 
    
         
             
            requirements: []
         
     | 
| 
       74 
95 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
            rubyforge_project: 
         
     | 
| 
      
 96 
     | 
    
         
            +
            rubyforge_project: win32utils
         
     | 
| 
       76 
97 
     | 
    
         
             
            rubygems_version: 1.2.0
         
     | 
| 
       77 
98 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       78 
99 
     | 
    
         
             
            specification_version: 2
         
     | 
| 
       79 
100 
     | 
    
         
             
            summary: Interface for the MS Windows Event Log.
         
     | 
| 
       80 
101 
     | 
    
         
             
            test_files: 
         
     | 
| 
       81 
     | 
    
         
            -
            - test/ 
     | 
| 
      
 102 
     | 
    
         
            +
            - test/test_eventlog.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - test/test_mc.rb
         
     | 
    
        data/test/tc_mc.rb
    DELETED
    
    | 
         @@ -1,47 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ############################################################################
         
     | 
| 
       2 
     | 
    
         
            -
            # tc_mc.rb
         
     | 
| 
       3 
     | 
    
         
            -
            #
         
     | 
| 
       4 
     | 
    
         
            -
            # Test suite for the win32-mc package.  The tests need to run in a specific
         
     | 
| 
       5 
     | 
    
         
            -
            # order, hence the numerics added to the method names.
         
     | 
| 
       6 
     | 
    
         
            -
            #
         
     | 
| 
       7 
     | 
    
         
            -
            # This test case should be run via the 'rake test' Rakefile task.
         
     | 
| 
       8 
     | 
    
         
            -
            ############################################################################
         
     | 
| 
       9 
     | 
    
         
            -
            require 'test/unit'
         
     | 
| 
       10 
     | 
    
         
            -
            require 'win32/mc'
         
     | 
| 
       11 
     | 
    
         
            -
            include Win32
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            class TC_Win32_MC < Test::Unit::TestCase
         
     | 
| 
       14 
     | 
    
         
            -
               def setup
         
     | 
| 
       15 
     | 
    
         
            -
                  Dir.chdir('test') unless File.basename(Dir.pwd) == 'test'
         
     | 
| 
       16 
     | 
    
         
            -
                  @mc = MC.new('foo.mc')
         
     | 
| 
       17 
     | 
    
         
            -
               end
         
     | 
| 
       18 
     | 
    
         
            -
               
         
     | 
| 
       19 
     | 
    
         
            -
               def test_01_version
         
     | 
| 
       20 
     | 
    
         
            -
                  assert_equal('0.1.3', MC::VERSION)
         
     | 
| 
       21 
     | 
    
         
            -
               end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
               def test_02_create_header
         
     | 
| 
       24 
     | 
    
         
            -
                  assert_respond_to(@mc, :create_header)
         
     | 
| 
       25 
     | 
    
         
            -
                  assert_nothing_raised{ @mc.create_header }
         
     | 
| 
       26 
     | 
    
         
            -
               end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
               def test_03_create_res_file
         
     | 
| 
       29 
     | 
    
         
            -
                  assert_respond_to(@mc, :create_res_file)
         
     | 
| 
       30 
     | 
    
         
            -
                  assert_nothing_raised{ @mc.create_res_file }
         
     | 
| 
       31 
     | 
    
         
            -
               end
         
     | 
| 
       32 
     | 
    
         
            -
               
         
     | 
| 
       33 
     | 
    
         
            -
               def test_04_create_dll_file
         
     | 
| 
       34 
     | 
    
         
            -
                  assert_respond_to(@mc, :create_dll_file)
         
     | 
| 
       35 
     | 
    
         
            -
                  assert_nothing_raised{ @mc.create_dll_file }
         
     | 
| 
       36 
     | 
    
         
            -
               end
         
     | 
| 
       37 
     | 
    
         
            -
               
         
     | 
| 
       38 
     | 
    
         
            -
               def test_05_clean
         
     | 
| 
       39 
     | 
    
         
            -
                  assert_respond_to(@mc, :clean)
         
     | 
| 
       40 
     | 
    
         
            -
                  assert_nothing_raised{ @mc.clean }
         
     | 
| 
       41 
     | 
    
         
            -
               end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
               def teardown
         
     | 
| 
       44 
     | 
    
         
            -
                  @mc = nil
         
     | 
| 
       45 
     | 
    
         
            -
                  File.delete('foo.dll') rescue nil
         
     | 
| 
       46 
     | 
    
         
            -
               end
         
     | 
| 
       47 
     | 
    
         
            -
            end
         
     |