win32-service 2.1.6 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/win32/service.rb +32 -50
- data/lib/win32/windows/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef70f0e8d16323dd531f4a6558b910121fa02ed62a432e5e82a70bfa19736805
|
4
|
+
data.tar.gz: f1128b7daa3ec6d64cb374c554c291b222f37dd10079865f5be6ae930287c0bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9bb4ac05263a141d2a4fc1030e16b9d6df66af501917f3403fa082412055bd6c1118404e06b35531845bcbaa55ecd3f89e8677ec57c422b40c7cfa61d3a8e3d
|
7
|
+
data.tar.gz: be2e0f6108dd0093e582659ef201d78266cbcaa428e08eac3624146695bdc46337edbb3b5823179f3f5c541b881bb0e3d95c64fe1ef92ef636f1521a72053ef7
|
data/lib/win32/service.rb
CHANGED
@@ -898,59 +898,41 @@ module Win32
|
|
898
898
|
# Service.status('W32Time') => <struct Struct::ServiceStatus ...>
|
899
899
|
#
|
900
900
|
def self.status(service, host=nil)
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
# SERVICE_STATUS_PROCESS struct
|
915
|
-
status = SERVICE_STATUS_PROCESS.new
|
916
|
-
bytes = FFI::MemoryPointer.new(:ulong)
|
917
|
-
|
918
|
-
bool = QueryServiceStatusEx(
|
919
|
-
handle_scs,
|
920
|
-
SC_STATUS_PROCESS_INFO,
|
921
|
-
status,
|
922
|
-
status.size,
|
923
|
-
bytes
|
924
|
-
)
|
901
|
+
status = SERVICE_STATUS_PROCESS.new
|
902
|
+
bytes = FFI::MemoryPointer.new(:ulong)
|
903
|
+
|
904
|
+
open_sc_manager(host) do |scm_handle|
|
905
|
+
open_service(scm_handle, service, SERVICE_QUERY_STATUS) do |service_handle|
|
906
|
+
bool = QueryServiceStatusEx(
|
907
|
+
service_handle,
|
908
|
+
SC_STATUS_PROCESS_INFO,
|
909
|
+
status,
|
910
|
+
status.size,
|
911
|
+
bytes
|
912
|
+
)
|
925
913
|
|
926
|
-
|
927
|
-
|
928
|
-
service_type = get_service_type(status[:dwServiceType])
|
929
|
-
current_state = get_current_state(status[:dwCurrentState])
|
930
|
-
controls = get_controls_accepted(status[:dwControlsAccepted])
|
931
|
-
interactive = status[:dwServiceType] & SERVICE_INTERACTIVE_PROCESS > 0
|
932
|
-
|
933
|
-
# Note that the pid and service flags will always return 0 if you're
|
934
|
-
# on Windows NT 4 or using a version of Ruby compiled with VC++ 6
|
935
|
-
# or earlier.
|
936
|
-
#
|
937
|
-
status_struct = StatusStruct.new(
|
938
|
-
service_type,
|
939
|
-
current_state,
|
940
|
-
controls,
|
941
|
-
status[:dwWin32ExitCode],
|
942
|
-
status[:dwServiceSpecificExitCode],
|
943
|
-
status[:dwCheckPoint],
|
944
|
-
status[:dwWaitHint],
|
945
|
-
interactive,
|
946
|
-
status[:dwProcessId],
|
947
|
-
status[:dwServiceFlags]
|
948
|
-
)
|
949
|
-
ensure
|
950
|
-
close_service_handle(handle_scs)
|
951
|
-
close_service_handle(handle_scm)
|
914
|
+
FFI.raise_windows_error('QueryServiceStatusEx') unless bool
|
915
|
+
end
|
952
916
|
end
|
953
917
|
|
918
|
+
service_type = get_service_type(status[:dwServiceType])
|
919
|
+
current_state = get_current_state(status[:dwCurrentState])
|
920
|
+
controls = get_controls_accepted(status[:dwControlsAccepted])
|
921
|
+
interactive = status[:dwServiceType] & SERVICE_INTERACTIVE_PROCESS > 0
|
922
|
+
|
923
|
+
status_struct = StatusStruct.new(
|
924
|
+
service_type,
|
925
|
+
current_state,
|
926
|
+
controls,
|
927
|
+
status[:dwWin32ExitCode],
|
928
|
+
status[:dwServiceSpecificExitCode],
|
929
|
+
status[:dwCheckPoint],
|
930
|
+
status[:dwWaitHint],
|
931
|
+
interactive,
|
932
|
+
status[:dwProcessId],
|
933
|
+
status[:dwServiceFlags]
|
934
|
+
)
|
935
|
+
|
954
936
|
status_struct
|
955
937
|
end
|
956
938
|
|
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: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|