win32-service 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c9e7a6cfd6aa6f113daf315e64979fb66c9c83b
4
- data.tar.gz: bc7920b71189a326bfd7b2b6e9affd2bd1fb1ded
3
+ metadata.gz: c044a38b8fd66f998b0db20693a785662116fb3b
4
+ data.tar.gz: d2b046ab3d2b41d7bef5c6ef7061d712bb580163
5
5
  SHA512:
6
- metadata.gz: c3bca8887a30ced151972c81d62d0d724ba3954b62b7ce435b02053ce91d674602a2d274955992c6b4a28d751ce574da8f2ffb6aa5045e27b0b6d0cb345fa5fe
7
- data.tar.gz: 8ad98044dd9fdee7917a2267715d0ecbd1b37d946525fba1a340391e877a6f340464fef6c31b4ad93f70e020e126ab5f986bc4830050d1bc66c366a2d9f59bda
6
+ metadata.gz: 22a107a68f5931c3efc0ad941db38330427189472e77fbb4952219f140af83a0d67f99bd3f808d12b1c822a40022ff87638e5dfe2589ce30b17429c07c4ee8a2
7
+ data.tar.gz: 9bd9c2828ac50944a97a09cabb9c8dac296cee1b18efe77f0dec7936a940bfa63997ff8d4e88bd21cf9922216472158e181ee64804eab2cd1b12680689e19bd0
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- ��~�ՒG/n�"J�+�r�״]�θ
2
- �#i"rty�\��TL#:��v
1
+ 5#�LwN�";F�T9�� *:�o[q1,��m�]h@.WL%��"
2
+ ������!��]E��#'F|<����Z,M��
3
+ ��A��o�%Y��Tp�� ��U*ɈR�SS�����y�:# :�����txV���Іψ8X��QOU���{����uxm%ceh Xk��_��.��Ju�??�� SWe�m��E!tl�D���.lhu�-��J�nюM�>aUF����V9{ �r����mfQ���˰���a$
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.8.9 - 26-Jun-2016
2
+ * Added the ffi-win32-extensions dependency.
3
+ * Changed the way service dependencies are determined.
4
+ * Removed the helper.rb file since it's no longer used.
5
+
1
6
  == 0.8.8 - 24-Jun-2016
2
7
  * Fixed the function prototypes for CreateEvent and AdjustTokenPrivileges
3
8
  where I was using :bool instead of :int.
data/MANIFEST CHANGED
@@ -13,6 +13,9 @@
13
13
  * lib/win32-service.rb
14
14
  * lib/win32/service.rb
15
15
  * lib/win32/daemon.rb
16
+ * lib/win32/windows/constants.rb
17
+ * lib/win32/windows/functions.rb
18
+ * lib/win32/windows/structs.rb
16
19
  * test/test_win32_daemon.rb
17
20
  * test/test_win32_service_configure.rb
18
21
  * test/test_win32_service_create.rb
@@ -1,4 +1,3 @@
1
- require_relative 'windows/helper'
2
1
  require_relative 'windows/constants'
3
2
  require_relative 'windows/structs'
4
3
  require_relative 'windows/functions'
@@ -16,7 +15,7 @@ module Win32
16
15
  extend Windows::ServiceFunctions
17
16
 
18
17
  # The version of this library
19
- VERSION = '0.8.8'
18
+ VERSION = '0.8.9'.freeze
20
19
 
21
20
  private
22
21
 
@@ -1,4 +1,4 @@
1
- require_relative 'windows/helper'
1
+ require 'ffi/win32/extensions'
2
2
  require_relative 'windows/constants'
3
3
  require_relative 'windows/structs'
4
4
  require_relative 'windows/functions'
@@ -17,7 +17,7 @@ module Win32
17
17
  extend Windows::ServiceFunctions
18
18
 
19
19
  # The version of the win32-service library
20
- VERSION = '0.8.8'
20
+ VERSION = '0.8.9'.freeze
21
21
 
22
22
  # SCM security and access rights
23
23
 
@@ -886,7 +886,7 @@ module Win32
886
886
  struct[:lpBinaryPathName].read_string,
887
887
  struct[:lpLoadOrderGroup].read_string,
888
888
  struct[:dwTagId],
889
- struct[:lpDependencies].read_array_of_null_separated_strings,
889
+ struct.dependencies,
890
890
  struct[:lpServiceStartName].read_string,
891
891
  struct[:lpDisplayName].read_string
892
892
  )
@@ -1073,7 +1073,7 @@ module Win32
1073
1073
  start_type = get_start_type(config_struct[:dwStartType])
1074
1074
  error_ctrl = get_error_control(config_struct[:dwErrorControl])
1075
1075
 
1076
- deps = config_struct[:lpDependencies].read_array_of_null_separated_strings
1076
+ deps = config_struct.dependencies
1077
1077
 
1078
1078
  begin
1079
1079
  buf = get_config2_info(handle_scs, SERVICE_CONFIG_DESCRIPTION)
@@ -41,7 +41,7 @@ module Windows
41
41
  attach_pfunc :CloseServiceHandle, [:handle], :bool
42
42
 
43
43
  attach_pfunc :ChangeServiceConfig, :ChangeServiceConfigA,
44
- [:handle, :dword, :dword, :dword, :str, :str, :ptr, :str, :str, :str, :str],
44
+ [:handle, :dword, :dword, :dword, :str, :str, :ptr, :ptr, :str, :str, :str],
45
45
  :bool
46
46
 
47
47
  attach_pfunc :ChangeServiceConfig2, :ChangeServiceConfig2A, [:handle, :dword, :ptr], :bool
@@ -61,6 +61,11 @@ module Windows
61
61
  :lpServiceStartName, :pointer,
62
62
  :lpDisplayName, :pointer
63
63
  )
64
+
65
+ def dependencies
66
+ length = self[:lpServiceStartName].address - self[:lpDependencies].address - 1
67
+ self[:lpDependencies].read_bytes(length).split(0.chr)
68
+ end
64
69
  end
65
70
 
66
71
  class SERVICE_STATUS_PROCESS < FFI::Struct
@@ -17,7 +17,7 @@ class TC_Daemon < Test::Unit::TestCase
17
17
  end
18
18
 
19
19
  test "version number is set properly" do
20
- assert_equal('0.8.8', Daemon::VERSION)
20
+ assert_equal('0.8.9', Daemon::VERSION)
21
21
  end
22
22
 
23
23
  test "constructor basic functionality" do
@@ -64,7 +64,7 @@ class TC_Win32_Service < Test::Unit::TestCase
64
64
  end
65
65
 
66
66
  test "version number is expected value" do
67
- assert_equal('0.8.8', Win32::Service::VERSION)
67
+ assert_equal('0.8.9', Win32::Service::VERSION)
68
68
  end
69
69
 
70
70
  test "services basic functionality" do
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'win32-service'
5
- spec.version = '0.8.8'
5
+ spec.version = '0.8.9'
6
6
  spec.authors = ['Daniel J. Berger', 'Park Heesob']
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.email = 'djberg96@gmail.com'
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec|
22
22
  ]
23
23
 
24
24
  spec.add_dependency('ffi')
25
+ spec.add_dependency('ffi-win32-extensions')
26
+
25
27
  spec.add_development_dependency('test-unit')
26
28
  spec.add_development_dependency('rake')
27
29
  spec.add_development_dependency('win32-security')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -31,7 +31,7 @@ cert_chain:
31
31
  EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
32
32
  tGSHgAmcLlkdGgan182qsE/4kKM=
33
33
  -----END CERTIFICATE-----
34
- date: 2016-06-25 00:00:00.000000000 Z
34
+ date: 2016-06-26 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ffi
@@ -47,6 +47,20 @@ dependencies:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
+ - !ruby/object:Gem::Dependency
51
+ name: ffi-win32-extensions
52
+ requirement: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
50
64
  - !ruby/object:Gem::Dependency
51
65
  name: test-unit
52
66
  requirement: !ruby/object:Gem::Requirement
@@ -124,7 +138,6 @@ files:
124
138
  - lib/win32/windows
125
139
  - lib/win32/windows/constants.rb
126
140
  - lib/win32/windows/functions.rb
127
- - lib/win32/windows/helper.rb
128
141
  - lib/win32/windows/structs.rb
129
142
  - lib/win32-daemon.rb
130
143
  - lib/win32-service.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,41 +0,0 @@
1
- require 'ffi'
2
-
3
- class FFI::Pointer
4
- def read_array_of_null_separated_strings
5
- elements = []
6
- loc = self
7
-
8
- while element = loc.read_string
9
- break if element.nil? || element == ""
10
- elements << element
11
- loc += element.size + 1
12
- end
13
-
14
- elements
15
- end
16
- end
17
-
18
- module FFI
19
- extend FFI::Library
20
-
21
- ffi_lib :kernel32
22
-
23
- attach_function :FormatMessage, :FormatMessageA,
24
- [:ulong, :pointer, :ulong, :ulong, :pointer, :ulong, :pointer], :ulong
25
-
26
- def win_error(function, err=FFI.errno)
27
- flags = 0x00001000 | 0x00000200
28
- buf = FFI::MemoryPointer.new(:char, 1024)
29
-
30
- FormatMessage(flags, nil, err , 0x0409, buf, 1024, nil)
31
-
32
- function + ': ' + buf.read_string.strip
33
- end
34
-
35
- def raise_windows_error(function, err=FFI.errno)
36
- raise SystemCallError.new(win_error(function, err), err)
37
- end
38
-
39
- module_function :win_error
40
- module_function :raise_windows_error
41
- end