win32-process 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -0
- data/lib/win32/process/constants.rb +1 -3
- data/lib/win32/process/functions.rb +38 -38
- data/lib/win32/process/helper.rb +2 -2
- data/lib/win32/process/structs.rb +9 -16
- data/lib/win32/process/version.rb +6 -0
- data/lib/win32/process.rb +115 -114
- data/lib/win32-process.rb +1 -1
- data/test/test_win32_process.rb +82 -82
- data/test/test_win32_process_kill.rb +36 -31
- data/win32-process.gemspec +5 -5
- metadata +8 -8
- data/README.md +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd3c8fe142d9a0f3c256f86f5e069eedff5f706ba99520ae4ed3e14d325b194
|
4
|
+
data.tar.gz: a97625f848a5b37bc167c3bebaa88a6265d3222f1e4ec529b7f8dd14f60400b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 555adadd2da8b60c2343f1b0499ccb32adcfd5d928271146a23b22f41e6e71386cae8cd6e0214a8faeb2a10768d3373364806aff68fc1e75b049c0e55c4f9d20
|
7
|
+
data.tar.gz: c2e792c58f3310b4bcd3d14e2c662abe0088ee136c1bea2679a1b07fd4e85a7725e564a78fcd931c1a54dbca70845acdf415f2bfa2a357b5c21cb743ec65da4f
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.10.0
|
@@ -1,9 +1,9 @@
|
|
1
|
-
if RUBY_PLATFORM ==
|
2
|
-
require
|
3
|
-
gem
|
1
|
+
if RUBY_PLATFORM == "java"
|
2
|
+
require "rubygems" unless defined?(Gem)
|
3
|
+
gem "ffi"
|
4
4
|
end
|
5
5
|
|
6
|
-
require
|
6
|
+
require "ffi" unless defined?(FFI)
|
7
7
|
|
8
8
|
module Process::Functions
|
9
9
|
module FFI::Library
|
@@ -26,58 +26,58 @@ module Process::Functions
|
|
26
26
|
ffi_lib :kernel32
|
27
27
|
|
28
28
|
attach_pfunc :CloseHandle, [:handle], :bool
|
29
|
-
attach_pfunc :CreateToolhelp32Snapshot,
|
30
|
-
attach_pfunc :GenerateConsoleCtrlEvent,
|
29
|
+
attach_pfunc :CreateToolhelp32Snapshot, %i{dword dword}, :handle
|
30
|
+
attach_pfunc :GenerateConsoleCtrlEvent, %i{dword dword}, :bool
|
31
31
|
attach_pfunc :GetCurrentProcess, [], :handle
|
32
32
|
attach_pfunc :GetModuleHandle, :GetModuleHandleA, [:string], :hmodule
|
33
|
-
attach_pfunc :GetProcessAffinityMask,
|
33
|
+
attach_pfunc :GetProcessAffinityMask, %i{handle pointer pointer}, :bool
|
34
34
|
attach_pfunc :GetPriorityClass, [:handle], :dword
|
35
|
-
attach_pfunc :GetProcAddress,
|
35
|
+
attach_pfunc :GetProcAddress, %i{hmodule string}, :pointer
|
36
36
|
attach_pfunc :GetVersionExA, [:pointer], :bool
|
37
|
-
attach_pfunc :Heap32ListFirst,
|
38
|
-
attach_pfunc :Heap32ListNext,
|
39
|
-
attach_pfunc :Heap32First,
|
37
|
+
attach_pfunc :Heap32ListFirst, %i{handle pointer}, :bool
|
38
|
+
attach_pfunc :Heap32ListNext, %i{handle pointer}, :bool
|
39
|
+
attach_pfunc :Heap32First, %i{pointer dword uintptr_t}, :bool
|
40
40
|
attach_pfunc :Heap32Next, [:pointer], :bool
|
41
|
-
attach_pfunc :Module32First,
|
42
|
-
attach_pfunc :Module32Next,
|
43
|
-
attach_pfunc :IsProcessInJob,
|
44
|
-
attach_pfunc :OpenProcess,
|
45
|
-
attach_pfunc :Process32First,
|
46
|
-
attach_pfunc :Process32Next,
|
47
|
-
attach_pfunc :SetHandleInformation,
|
41
|
+
attach_pfunc :Module32First, %i{handle pointer}, :bool
|
42
|
+
attach_pfunc :Module32Next, %i{handle pointer}, :bool
|
43
|
+
attach_pfunc :IsProcessInJob, %i{handle pointer pointer}, :bool # 2nd arg optional
|
44
|
+
attach_pfunc :OpenProcess, %i{dword int dword}, :handle
|
45
|
+
attach_pfunc :Process32First, %i{handle pointer}, :bool
|
46
|
+
attach_pfunc :Process32Next, %i{handle pointer}, :bool
|
47
|
+
attach_pfunc :SetHandleInformation, %i{handle dword dword}, :bool
|
48
48
|
attach_pfunc :SetErrorMode, [:uint], :uint
|
49
|
-
attach_pfunc :SetPriorityClass,
|
50
|
-
attach_pfunc :TerminateProcess,
|
51
|
-
attach_pfunc :Thread32First,
|
52
|
-
attach_pfunc :Thread32Next,
|
53
|
-
attach_pfunc :WaitForSingleObject,
|
49
|
+
attach_pfunc :SetPriorityClass, %i{handle dword}, :bool
|
50
|
+
attach_pfunc :TerminateProcess, %i{handle uint}, :bool
|
51
|
+
attach_pfunc :Thread32First, %i{handle pointer}, :bool
|
52
|
+
attach_pfunc :Thread32Next, %i{handle pointer}, :bool
|
53
|
+
attach_pfunc :WaitForSingleObject, %i{handle dword}, :dword
|
54
54
|
|
55
55
|
attach_pfunc :CreateRemoteThread,
|
56
|
-
|
56
|
+
%i{handle pointer size_t pointer pointer dword pointer}, :handle
|
57
57
|
|
58
58
|
attach_pfunc :GetVolumeInformationA,
|
59
|
-
|
59
|
+
%i{string pointer dword pointer pointer pointer pointer dword}, :bool
|
60
60
|
|
61
61
|
attach_pfunc :CreateProcessW,
|
62
|
-
|
63
|
-
|
62
|
+
%i{buffer_in buffer_inout pointer pointer int
|
63
|
+
dword buffer_in buffer_in pointer pointer}, :bool
|
64
64
|
|
65
|
-
attach_pfunc :AssignProcessToJobObject,
|
66
|
-
attach_pfunc :CreateJobObjectA,
|
67
|
-
attach_pfunc :OpenJobObjectA,
|
68
|
-
attach_pfunc :QueryInformationJobObject,
|
69
|
-
attach_pfunc :SetInformationJobObject,
|
70
|
-
attach_pfunc :GetExitCodeProcess,
|
65
|
+
attach_pfunc :AssignProcessToJobObject, %i{handle handle}, :bool
|
66
|
+
attach_pfunc :CreateJobObjectA, %i{pointer string}, :handle
|
67
|
+
attach_pfunc :OpenJobObjectA, %i{dword int string}, :handle
|
68
|
+
attach_pfunc :QueryInformationJobObject, %i{handle int pointer dword pointer}, :bool
|
69
|
+
attach_pfunc :SetInformationJobObject, %i{handle int pointer dword}, :bool
|
70
|
+
attach_pfunc :GetExitCodeProcess, %i{handle pointer}, :bool
|
71
71
|
|
72
72
|
ffi_lib :advapi32
|
73
73
|
|
74
|
-
attach_pfunc :ConvertSidToStringSidA,
|
75
|
-
attach_pfunc :GetTokenInformation,
|
76
|
-
attach_pfunc :OpenProcessToken,
|
74
|
+
attach_pfunc :ConvertSidToStringSidA, %i{buffer_in pointer}, :bool
|
75
|
+
attach_pfunc :GetTokenInformation, %i{handle int pointer dword pointer}, :bool
|
76
|
+
attach_pfunc :OpenProcessToken, %i{handle dword pointer}, :bool
|
77
77
|
|
78
78
|
attach_pfunc :CreateProcessWithLogonW,
|
79
|
-
|
80
|
-
|
79
|
+
%i{buffer_in buffer_in buffer_in dword buffer_in buffer_inout
|
80
|
+
dword buffer_in buffer_in pointer pointer}, :bool
|
81
81
|
|
82
82
|
ffi_lib FFI::Library::LIBC
|
83
83
|
|
data/lib/win32/process/helper.rb
CHANGED
@@ -2,12 +2,12 @@ class String
|
|
2
2
|
# Convert a regular string to a wide character string. This does not
|
3
3
|
# modify the receiver.
|
4
4
|
def to_wide_string
|
5
|
-
(self + 0.chr).encode(
|
5
|
+
(self + 0.chr).encode("UTF-16LE")
|
6
6
|
end
|
7
7
|
|
8
8
|
# Convert a regular string to a wide character string. This modifies
|
9
9
|
# the receiver.
|
10
10
|
def to_wide_string!
|
11
|
-
replace((self + 0.chr).encode(
|
11
|
+
replace((self + 0.chr).encode("UTF-16LE"))
|
12
12
|
end
|
13
13
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
if RUBY_PLATFORM ==
|
2
|
-
require
|
3
|
-
gem
|
1
|
+
if RUBY_PLATFORM == "java"
|
2
|
+
require "rubygems" unless defined?(Gem)
|
3
|
+
gem "ffi"
|
4
4
|
end
|
5
5
|
|
6
|
-
require
|
6
|
+
require "ffi" unless defined?(FFI)
|
7
7
|
|
8
8
|
module Process::Structs
|
9
9
|
extend FFI::Library
|
@@ -12,8 +12,6 @@ module Process::Structs
|
|
12
12
|
typedef :uintptr_t, :handle
|
13
13
|
typedef :short, :word
|
14
14
|
|
15
|
-
private
|
16
|
-
|
17
15
|
# sizeof(LARGE_INTEGER) == 8
|
18
16
|
class LARGE_INTEGER < FFI::Union
|
19
17
|
layout(:QuadPart, :long_long)
|
@@ -179,24 +177,21 @@ module Process::Structs
|
|
179
177
|
:process_handle,
|
180
178
|
:thread_handle,
|
181
179
|
:process_id,
|
182
|
-
:thread_id
|
183
|
-
)
|
180
|
+
:thread_id)
|
184
181
|
|
185
182
|
# Used by Process.snapshot
|
186
183
|
|
187
184
|
ThreadSnapInfo = Struct.new("ThreadSnapInfo",
|
188
185
|
:thread_id,
|
189
186
|
:process_id,
|
190
|
-
:base_priority
|
191
|
-
)
|
187
|
+
:base_priority)
|
192
188
|
|
193
189
|
HeapSnapInfo = Struct.new("HeapSnapInfo",
|
194
190
|
:address,
|
195
191
|
:block_size,
|
196
192
|
:flags,
|
197
193
|
:process_id,
|
198
|
-
:heap_id
|
199
|
-
)
|
194
|
+
:heap_id)
|
200
195
|
|
201
196
|
ModuleSnapInfo = Struct.new("ModuleSnapInfo",
|
202
197
|
:process_id,
|
@@ -204,8 +199,7 @@ module Process::Structs
|
|
204
199
|
:module_size,
|
205
200
|
:handle,
|
206
201
|
:name,
|
207
|
-
:path
|
208
|
-
)
|
202
|
+
:path)
|
209
203
|
|
210
204
|
ProcessSnapInfo = Struct.new("ProcessSnapInfo",
|
211
205
|
:process_id,
|
@@ -213,6 +207,5 @@ module Process::Structs
|
|
213
207
|
:parent_process_id,
|
214
208
|
:priority,
|
215
209
|
:flags,
|
216
|
-
:path
|
217
|
-
)
|
210
|
+
:path)
|
218
211
|
end
|