win32-eventlog 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,4 +1,11 @@
1
- = 0.4.7 - 8-Dec-2008
1
+ = 0.4.8 - 17-May-2008
2
+ * Fixed in a bug in the EventLog#read method where a log entry requiring
3
+ over 64k would fail and spiral into an infinite loop. Thanks go to
4
+ Stuart Clarke for the spot.
5
+ * Improved handling of failed log reading in the read_last_event private
6
+ method.
7
+
8
+ = 0.4.7 - 8-Dec-2007
2
9
  * Fixed a bug where you couldn't write to custom (parent) event sources.
3
10
  Thanks go to Tim Uckun for the spot.
4
11
  * Now handles ParameterMessageFiles, both in the EventLog.add_event_source
@@ -37,7 +37,7 @@ module Win32
37
37
  extend Windows::Error
38
38
  extend Windows::Registry
39
39
 
40
- VERSION = '0.4.7'
40
+ VERSION = '0.4.8'
41
41
 
42
42
  # Aliased read flags
43
43
  FORWARDS_READ = EVENTLOG_FORWARDS_READ
@@ -536,8 +536,7 @@ module Win32
536
536
  # If no block is given the method returns an array of EventLogStruct's.
537
537
  #
538
538
  def read(flags = nil, offset = 0)
539
- buf = 0.chr * BUFFER_SIZE # 64k buffer
540
- size = buf.size
539
+ buf = 0.chr * BUFFER_SIZE # 64k buffer
541
540
  read = [0].pack('L')
542
541
  needed = [0].pack('L')
543
542
  array = []
@@ -555,12 +554,14 @@ module Win32
555
554
  lkey = hkey.unpack('L').first
556
555
  end
557
556
 
558
- while ReadEventLog(@handle, flags, offset, buf, size, read, needed) ||
557
+ while ReadEventLog(@handle, flags, offset, buf, buf.size, read, needed) ||
559
558
  GetLastError() == ERROR_INSUFFICIENT_BUFFER
560
559
 
561
560
  if GetLastError() == ERROR_INSUFFICIENT_BUFFER
562
- buf += 0.chr * needed.unpack('L')[0]
563
- ReadEventLog(@handle, flags, offset, buf, size, read, needed)
561
+ buf = (0.chr * buf.size) + (0.chr * needed.unpack('L')[0])
562
+ unless ReadEventLog(@handle, flags, offset, buf, buf.size, read, needed)
563
+ raise Error, get_last_error
564
+ end
564
565
  end
565
566
 
566
567
  dwread = read.unpack('L')[0]
@@ -721,7 +722,18 @@ module Win32
721
722
  lkey = HKEY_LOCAL_MACHINE
722
723
 
723
724
  flags = EVENTLOG_BACKWARDS_READ | EVENTLOG_SEQUENTIAL_READ
724
- ReadEventLog(@handle, flags, 0, buf, buf.size, read, needed)
725
+
726
+ unless ReadEventLog(@handle, flags, 0, buf, buf.size, read, needed)
727
+ error = GetLastError()
728
+ if error == ERROR_INSUFFICIENT_BUFFER
729
+ buf = (0.chr * buf.size) + (0.chr * needed.unpack('L')[0])
730
+ unless ReadEventLog(@handle, flags, 0, buf, buf.size, read, needed)
731
+ raise Error, get_last_error
732
+ end
733
+ else
734
+ raise Error, get_last_error(error)
735
+ end
736
+ end
725
737
 
726
738
  if @server
727
739
  hkey = [0].pack('L')
@@ -23,7 +23,7 @@ class TC_EventLog < Test::Unit::TestCase
23
23
  end
24
24
 
25
25
  def test_version
26
- assert_equal('0.4.7', EventLog::VERSION)
26
+ assert_equal('0.4.8', EventLog::VERSION)
27
27
  end
28
28
 
29
29
  # Use the alias to validate it as well.
@@ -2,7 +2,7 @@ require "rubygems"
2
2
 
3
3
  spec = Gem::Specification.new do |gem|
4
4
  gem.name = "win32-eventlog"
5
- gem.version = "0.4.7"
5
+ gem.version = "0.4.8"
6
6
  gem.author = "Daniel J. Berger"
7
7
  gem.email = "djberg96@gmail.com"
8
8
  gem.homepage = "http://www.rubyforge.org/projects/win32utils"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-eventlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2007-12-08 00:00:00 -07:00
12
+ date: 2008-05-17 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  requirements: []
75
75
 
76
76
  rubyforge_project:
77
- rubygems_version: 0.9.5
77
+ rubygems_version: 1.1.1
78
78
  signing_key:
79
79
  specification_version: 2
80
80
  summary: Interface for the MS Windows Event Log.