winevt_c 0.11.1 → 0.11.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 236cd5f44b0a13dd198baa83329a340742ae4e9ff618d01671cb48326e4da0c9
4
- data.tar.gz: 26cfad4e5eede9d60710672dabe47a61db41cc2d21861704fb94f00ea2c6c51f
3
+ metadata.gz: bc1b47b4841d2235e4c5629465b47b3eb7c088a6af6c74dfc95dc3962b5dc723
4
+ data.tar.gz: ab99b355b4f111cdfb048106b89f0d9faa649334a816a6b9d850d47c53bf33a5
5
5
  SHA512:
6
- metadata.gz: '081e7c41f48447bbb401c5a8483094b3258a521a97a7b301b44ac89d216d888cece8ab1f89406b8fafc694436574c2660f600cec9c053f098cb81e3d05d311d4'
7
- data.tar.gz: 4e5eb1006bd0e05d59bdfb361edf02025b1ab86a6f7fc66d9489b27b29cdf530f47a404ae8b8c17f32d167b44cddaa28d5bd89e58cef4a93cec65dfe486c6eb1
6
+ metadata.gz: 462bd61a7303bd104bb21162ed074aad9ecce63b7bbfca37d8d5ec66c9f05ed85a326a3408df3b38255782fea782d86590de660b61ca542bed27982d0a5c5bb3
7
+ data.tar.gz: 6091742c0526d238a1e79c35672b3c52775927224bb318c2b9dea13546e5a5e25b1637e2c97dcb09831ea8284ffc026e9c5d88846190194b5048aab37767a16a
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'monthly'
@@ -0,0 +1,33 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches: [master]
5
+ pull_request:
6
+ branches: [master]
7
+ schedule:
8
+ - cron: '0 0 1 * *'
9
+ jobs:
10
+ ruby-versions:
11
+ uses: ruby/actions/.github/workflows/ruby_versions.yml@master
12
+ with:
13
+ engine: cruby
14
+ min_version: 3.1
15
+ build:
16
+ needs: ruby-versions
17
+ runs-on: 'windows-latest'
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
22
+ exclude:
23
+ - ruby: head
24
+ name: Ruby ${{ matrix.ruby }}
25
+ steps:
26
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27
+ - uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ - name: Run tests
31
+ run: |
32
+ bundle install --jobs 4 --retry 3
33
+ bundle exec rake
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # winevt_c
2
2
 
3
- [![Build status](https://ci.appveyor.com/api/projects/status/o5771b3cb6x3acq0/branch/master?svg=true)](https://ci.appveyor.com/project/cosmo0920/winevt-c-6145k/branch/master)
3
+ [![Test](https://github.com/fluent-plugins-nursery/winevt_c/actions/workflows/test.yml/badge.svg)](https://github.com/fluent-plugins-nursery/winevt_c/actions/workflows/test.yml)
4
4
 
5
5
  ## Prerequisites
6
6
 
data/Rakefile CHANGED
@@ -1,8 +1,5 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
1
+ require "bundler/gem_tasks"
4
2
  require "rake/testtask"
5
- require 'rake_compiler_dock'
6
3
  require 'rake/clean'
7
4
 
8
5
  Rake::TestTask.new(:test) do |t|
@@ -13,23 +10,9 @@ end
13
10
 
14
11
  require "rake/extensiontask"
15
12
 
16
- spec = eval File.read("winevt_c.gemspec")
17
-
18
- Rake::ExtensionTask.new("winevt", spec) do |ext|
13
+ Rake::ExtensionTask.new("winevt") do |ext|
19
14
  ext.ext_dir = 'ext/winevt'
20
- ext.cross_compile = true
21
- ext.lib_dir = File.join(*['lib', 'winevt', ENV['FAT_DIR']].compact)
22
- # cross_platform names are of MRI's platform name
23
- ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
24
- end
25
-
26
- desc 'Build gems for Windows per rake-compiler-dock'
27
- task 'gem:native' do
28
- sh "bundle package"
29
- # See RUBY_CC_VERSION in https://github.com/rake-compiler/rake-compiler-dock/blob/master/Dockerfile.mri
30
- %w[ x86-mingw32 x64-mingw32 ].each do |plat|
31
- RakeCompilerDock.sh "bundle --local && bundle exec rake native:#{plat} gem RUBY_CC_VERSION=2.4.0:2.5.0:2.6.0:2.7.0:3.0.0", platform: plat
32
- end
15
+ ext.lib_dir = 'lib/winevt'
33
16
  end
34
17
 
35
18
  CLEAN.include('lib/winevt/winevt.*')
@@ -132,8 +132,6 @@ DWORD is_subscribable_channel_p(EVT_HANDLE hChannel, BOOL force_enumerate)
132
132
  EvtGetChannelConfigProperty(hChannel, (EVT_CHANNEL_CONFIG_PROPERTY_ID)Id, 0, dwBufferSize, pProperty, &dwBufferUsed);
133
133
  status = GetLastError();
134
134
  } else {
135
- free(pProperty);
136
-
137
135
  status = ERROR_OUTOFMEMORY;
138
136
 
139
137
  goto cleanup;
@@ -141,8 +139,6 @@ DWORD is_subscribable_channel_p(EVT_HANDLE hChannel, BOOL force_enumerate)
141
139
  }
142
140
 
143
141
  if (ERROR_SUCCESS != status) {
144
- free(pProperty);
145
-
146
142
  goto cleanup;
147
143
  }
148
144
  }
@@ -119,6 +119,9 @@ rb_winevt_query_initialize(VALUE argc, VALUE *argv, VALUE self)
119
119
  flags = EvtQueryChannelPath | EvtQueryTolerateQueryErrors;
120
120
  break;
121
121
  default:
122
+ if (hRemoteHandle != NULL) {
123
+ EvtClose(hRemoteHandle);
124
+ }
122
125
  rb_raise(rb_eArgError, "Expected a String, a Symbol, a Fixnum, or a NilClass instance");
123
126
  }
124
127
 
@@ -142,6 +145,9 @@ rb_winevt_query_initialize(VALUE argc, VALUE *argv, VALUE self)
142
145
  hRemoteHandle, evtChannel, evtXPath, flags);
143
146
  err = GetLastError();
144
147
  if (err != ERROR_SUCCESS) {
148
+ if (hRemoteHandle != NULL) {
149
+ EvtClose(hRemoteHandle);
150
+ }
145
151
  if (err == ERROR_EVT_CHANNEL_NOT_FOUND) {
146
152
  raise_channel_not_found_error(channel);
147
153
  }
@@ -562,6 +562,7 @@ get_description(EVT_HANDLE handle, LANGID langID, EVT_HANDLE hRemote)
562
562
  }
563
563
 
564
564
  if (status != ERROR_SUCCESS) {
565
+ EvtClose(renderContext);
565
566
  raise_system_error(rb_eWinevtQueryError, status);
566
567
  }
567
568
 
@@ -602,6 +603,7 @@ static char* convert_wstr(wchar_t *wstr)
602
603
  int len = 0;
603
604
  CHAR *ptr = NULL;
604
605
  DWORD err = ERROR_SUCCESS;
606
+ char *dup_str = NULL;
605
607
 
606
608
  len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
607
609
  if (len == 0) {
@@ -621,7 +623,10 @@ static char* convert_wstr(wchar_t *wstr)
621
623
  raise_system_error(rb_eRuntimeError, err);
622
624
  }
623
625
 
624
- return strdup(ptr);
626
+ dup_str = strdup(ptr);
627
+ RB_ALLOCV_END(vstr);
628
+
629
+ return dup_str;
625
630
  }
626
631
 
627
632
  static int ExpandSIDWString(PSID sid, CHAR **out_expanded)
@@ -1,3 +1,3 @@
1
1
  module Winevt
2
- VERSION = "0.11.1"
2
+ VERSION = "0.11.3"
3
3
  end
data/winevt_c.gemspec CHANGED
@@ -25,10 +25,9 @@ Gem::Specification.new do |spec|
25
25
  spec.license = "Apache-2.0"
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4".freeze)
27
27
 
28
- spec.add_development_dependency "bundler", [">= 1.16", "< 3"]
28
+ spec.add_development_dependency "bundler"
29
29
  spec.add_development_dependency "rake", "~> 13.0"
30
30
  spec.add_development_dependency "rake-compiler", "~> 1.0"
31
- spec.add_development_dependency "rake-compiler-dock", "~> 1.1.0"
32
31
  spec.add_development_dependency "test-unit", "~> 3.2"
33
32
  spec.add_development_dependency "yard", "~> 0.9"
34
33
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winevt_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-08-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -16,20 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '1.16'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3'
18
+ version: '0'
23
19
  type: :development
24
20
  prerelease: false
25
21
  version_requirements: !ruby/object:Gem::Requirement
26
22
  requirements:
27
23
  - - ">="
28
24
  - !ruby/object:Gem::Version
29
- version: '1.16'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '3'
25
+ version: '0'
33
26
  - !ruby/object:Gem::Dependency
34
27
  name: rake
35
28
  requirement: !ruby/object:Gem::Requirement
@@ -58,20 +51,6 @@ dependencies:
58
51
  - - "~>"
59
52
  - !ruby/object:Gem::Version
60
53
  version: '1.0'
61
- - !ruby/object:Gem::Dependency
62
- name: rake-compiler-dock
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: 1.1.0
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: 1.1.0
75
54
  - !ruby/object:Gem::Dependency
76
55
  name: test-unit
77
56
  requirement: !ruby/object:Gem::Requirement
@@ -109,13 +88,13 @@ extensions:
109
88
  extra_rdoc_files: []
110
89
  files:
111
90
  - ".clang-format"
112
- - ".github/workflows/linux.yml"
91
+ - ".github/dependabot.yml"
92
+ - ".github/workflows/test.yml"
113
93
  - ".gitignore"
114
94
  - Gemfile
115
95
  - LICENSE.txt
116
96
  - README.md
117
97
  - Rakefile
118
- - appveyor.yml
119
98
  - bin/console
120
99
  - bin/setup
121
100
  - example/bookmark.rb
@@ -141,13 +120,11 @@ files:
141
120
  - lib/winevt/session.rb
142
121
  - lib/winevt/subscribe.rb
143
122
  - lib/winevt/version.rb
144
- - ruby_install.ps1
145
123
  - winevt_c.gemspec
146
124
  homepage: https://github.com/fluent-plugins-nursery/winevt_c
147
125
  licenses:
148
126
  - Apache-2.0
149
127
  metadata: {}
150
- post_install_message:
151
128
  rdoc_options: []
152
129
  require_paths:
153
130
  - lib
@@ -162,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
139
  - !ruby/object:Gem::Version
163
140
  version: '0'
164
141
  requirements: []
165
- rubygems_version: 3.3.5
166
- signing_key:
142
+ rubygems_version: 4.0.6
167
143
  specification_version: 4
168
144
  summary: Windows Event Log API bindings from winevt.h.
169
145
  test_files: []
@@ -1,26 +0,0 @@
1
- name: Building fat gem
2
- on:
3
- - push
4
- - pull_request
5
- jobs:
6
- build:
7
- runs-on: ${{ matrix.os }}
8
- strategy:
9
- fail-fast: false
10
- matrix:
11
- ruby: [ '3.0', '3.1', '3.2' ]
12
- os:
13
- - ubuntu-latest
14
- name: Ruby ${{ matrix.ruby }} building fat gem testing on ${{ matrix.os }}
15
- steps:
16
- - uses: actions/checkout@v2
17
- - uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: ${{ matrix.ruby }}
20
- - name: building fat gem
21
- env:
22
- CI: true
23
- run: |
24
- gem install bundler rake
25
- bundle install --jobs 4 --retry 3
26
- bundle exec rake gem:native
data/appveyor.yml DELETED
@@ -1,53 +0,0 @@
1
- version: '{build}'
2
-
3
- image: Visual Studio 2019
4
-
5
- # init:
6
- # - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
7
-
8
- install:
9
- - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
10
- - ruby --version
11
- - gem --version
12
- - bundle --version
13
- - bundle install
14
- - ridk.cmd exec bundle exec rake compile
15
- build: off
16
- test_script:
17
- # - bundle exec rake test
18
- - bundle exec rake test TESTOPTS=-v
19
-
20
- # https://www.appveyor.com/docs/installed-software/#ruby
21
- environment:
22
- matrix:
23
- - ruby_version: "31-x64"
24
- - ruby_version: "31"
25
- - ruby_version: "30-x64"
26
- - ruby_version: "30"
27
- - ruby_version: "27-x64"
28
- - ruby_version: "27"
29
- - ruby_version: "26-x64"
30
- - ruby_version: "26"
31
- - ruby_version: "25-x64"
32
- - ruby_version: "25"
33
- - ruby_version: "24-x64"
34
- - ruby_version: "24"
35
-
36
- for:
37
- -
38
- matrix:
39
- only:
40
- - ruby_version: "31-x64"
41
- - ruby_version: "27-x64"
42
- - ruby_version: "27"
43
- - ruby_version: "26-x64"
44
- - ruby_version: "26"
45
- install:
46
- - ps: if ($ENV:ruby_version -ne "31-x64") { .\ruby_install.ps1 }
47
- - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
48
- - ruby --version
49
- - gem --version
50
- - bundle --version
51
- - ps: if ($ENV:ruby_version -eq "31-x64") { ridk.ps1 install 1 3 }
52
- - ridk.cmd exec bundle install
53
- - ridk.cmd exec bundle exec rake compile
data/ruby_install.ps1 DELETED
@@ -1,92 +0,0 @@
1
- $rubies = @(
2
- @{
3
- "version" = "Ruby 2.6.9-1"
4
- "install_path" = "C:\Ruby26"
5
- "download_url" = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.9-1/rubyinstaller-2.6.9-1-x86.exe"
6
- "devkit_url" = ""
7
- "devkit_paths" = @()
8
- "bundlerV2" = $true
9
- }
10
- @{
11
- "version" = "Ruby 2.6.9-1 (x64)"
12
- "install_path" = "C:\Ruby26-x64"
13
- "download_url" = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.9-1/rubyinstaller-2.6.9-1-x64.exe"
14
- "devkit_url" = ""
15
- "devkit_paths" = @()
16
- "bundlerV2" = $true
17
- }
18
- @{
19
- "version" = "Ruby 2.7.8-1"
20
- "install_path" = "C:\Ruby27"
21
- "download_url" = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.8-1/rubyinstaller-2.7.8-1-x86.exe"
22
- "devkit_url" = ""
23
- "devkit_paths" = @()
24
- "bundlerV2" = $true
25
- }
26
- @{
27
- "version" = "Ruby 2.7.8-1 (x64)"
28
- "install_path" = "C:\Ruby27-x64"
29
- "download_url" = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.8-1/rubyinstaller-2.7.8-1-x64.exe"
30
- "devkit_url" = ""
31
- "devkit_paths" = @()
32
- "bundlerV2" = $true
33
- }
34
- )
35
-
36
- function UpdateRubyPath($rubyPath) {
37
- $env:path = ($env:path -split ';' | Where-Object { -not $_.contains('\Ruby') }) -join ';'
38
- $env:path = "$rubyPath;$env:path"
39
- }
40
-
41
- function Install-Ruby($ruby) {
42
- Write-Host "Installing $($ruby.version)" -ForegroundColor Cyan
43
-
44
- # uninstall existing
45
- $rubyUninstallPath = "$ruby.install_path\unins000.exe"
46
- if ([IO.File]::Exists($rubyUninstallPath)) {
47
- Write-Host " Uninstalling previous Ruby 2.4..." -ForegroundColor Gray
48
- "`"$rubyUninstallPath`" /silent" | out-file "$env:temp\uninstall-ruby.cmd" -Encoding ASCII
49
- & "$env:temp\uninstall-ruby.cmd"
50
- del "$env:temp\uninstall-ruby.cmd"
51
- Start-Sleep -s 5
52
- }
53
-
54
- if (Test-Path $ruby.install_path) {
55
- Write-Host " Deleting $($ruby.install_path)" -ForegroundColor Gray
56
- Remove-Item $ruby.install_path -Force -Recurse
57
- }
58
-
59
- $exePath = "$($env:TEMP)\rubyinstaller.exe"
60
-
61
- Write-Host " Downloading $($ruby.version) from $($ruby.download_url)" -ForegroundColor Gray
62
- (New-Object Net.WebClient).DownloadFile($ruby.download_url, $exePath)
63
-
64
- Write-Host "Installing..." -ForegroundColor Gray
65
- cmd /c start /wait $exePath /verysilent /allusers /dir="$($ruby.install_path.replace('\', '/'))" /tasks="noassocfiles,nomodpath,noridkinstall"
66
- del $exePath
67
- Write-Host "Installed" -ForegroundColor Green
68
-
69
- # setup Ruby
70
- UpdateRubyPath "$($ruby.install_path)\bin"
71
- Write-Host "ruby --version" -ForegroundColor Gray
72
- cmd /c ruby --version
73
-
74
- Write-Host "gem --version" -ForegroundColor Gray
75
- cmd /c gem --version
76
-
77
- # list installed gems
78
- Write-Host "gem list --local" -ForegroundColor Gray
79
- cmd /c gem list --local
80
-
81
- # delete temp path
82
- if ($tempPath) {
83
- Write-Host " Cleaning up..." -ForegroundColor Gray
84
- Remove-Item $tempPath -Force -Recurse
85
- }
86
-
87
- Write-Host " Done!" -ForegroundColor Green
88
- }
89
-
90
- for ($i = 0; $i -lt $rubies.Count; $i++) {
91
- Install-Ruby $rubies[$i]
92
- }