win32-process 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/README +1 -1
- data/lib/win32/process.rb +1 -1
- data/lib/win32/process/functions.rb +31 -26
- data/lib/win32/process/structs.rb +29 -25
- data/test/test_win32_process.rb +1 -1
- data/win32-process.gemspec +1 -1
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
= 0.7.2 - 8-Apr-2013
|
2
|
+
* Fixed a 64 bit issue caused by the fact that HANDLE's were set as ulong
|
3
|
+
instead of intptr_t. Thanks go to Crossverse the spot.
|
4
|
+
* Added some typedefs in the underlying FFI code for Windows data types.
|
5
|
+
|
1
6
|
= 0.7.1 - 3-Jan-2013
|
2
7
|
* The _get_errno function is apparently not exported on on Windows XP or
|
3
8
|
earlier. On those platforms, FFI.errno is now used instead. Thanks go
|
data/README
CHANGED
data/lib/win32/process.rb
CHANGED
@@ -11,7 +11,7 @@ module Process
|
|
11
11
|
extend Process::Constants
|
12
12
|
|
13
13
|
# The version of the win32-process library.
|
14
|
-
WIN32_PROCESS_VERSION = '0.7.
|
14
|
+
WIN32_PROCESS_VERSION = '0.7.2'
|
15
15
|
|
16
16
|
# Disable popups. This mostly affects the Process.kill method.
|
17
17
|
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX)
|
@@ -16,53 +16,58 @@ module Process::Functions
|
|
16
16
|
|
17
17
|
extend FFI::Library
|
18
18
|
|
19
|
+
typedef :ulong, :dword
|
20
|
+
typedef :uintptr_t, :handle
|
21
|
+
typedef :uintptr_t, :hwnd
|
22
|
+
typedef :uintptr_t, :hmodule
|
23
|
+
|
19
24
|
ffi_lib :kernel32
|
20
25
|
|
21
|
-
attach_pfunc :CloseHandle, [:
|
22
|
-
attach_pfunc :GenerateConsoleCtrlEvent, [:
|
23
|
-
attach_pfunc :GetCurrentProcess, [], :
|
24
|
-
attach_pfunc :GetModuleHandle, :GetModuleHandleA, [:string], :
|
25
|
-
attach_pfunc :GetProcessAffinityMask, [:
|
26
|
-
attach_pfunc :GetPriorityClass, [:
|
27
|
-
attach_pfunc :GetProcAddress, [:
|
26
|
+
attach_pfunc :CloseHandle, [:handle], :bool
|
27
|
+
attach_pfunc :GenerateConsoleCtrlEvent, [:dword, :dword], :bool
|
28
|
+
attach_pfunc :GetCurrentProcess, [], :handle
|
29
|
+
attach_pfunc :GetModuleHandle, :GetModuleHandleA, [:string], :hmodule
|
30
|
+
attach_pfunc :GetProcessAffinityMask, [:handle, :pointer, :pointer], :bool
|
31
|
+
attach_pfunc :GetPriorityClass, [:handle], :dword
|
32
|
+
attach_pfunc :GetProcAddress, [:hmodule, :string], :pointer
|
28
33
|
attach_pfunc :GetVersionExA, [:pointer], :bool
|
29
|
-
attach_pfunc :IsProcessInJob, [:
|
30
|
-
attach_pfunc :OpenProcess, [:
|
31
|
-
attach_pfunc :SetHandleInformation, [:
|
34
|
+
attach_pfunc :IsProcessInJob, [:handle, :pointer, :pointer], :bool # 2nd arg optional
|
35
|
+
attach_pfunc :OpenProcess, [:dword, :bool, :dword], :handle
|
36
|
+
attach_pfunc :SetHandleInformation, [:handle, :dword, :dword], :bool
|
32
37
|
attach_pfunc :SetErrorMode, [:uint], :uint
|
33
|
-
attach_pfunc :SetPriorityClass, [:
|
34
|
-
attach_pfunc :TerminateProcess, [:
|
35
|
-
attach_pfunc :WaitForSingleObject, [:
|
38
|
+
attach_pfunc :SetPriorityClass, [:handle, :dword], :bool
|
39
|
+
attach_pfunc :TerminateProcess, [:handle, :uint], :bool
|
40
|
+
attach_pfunc :WaitForSingleObject, [:handle, :dword], :dword
|
36
41
|
|
37
42
|
attach_pfunc :CreateRemoteThread,
|
38
|
-
[:
|
43
|
+
[:handle, :pointer, :size_t, :pointer, :pointer, :dword, :pointer], :handle
|
39
44
|
|
40
45
|
attach_pfunc :GetVolumeInformationA,
|
41
|
-
[:string, :pointer, :
|
46
|
+
[:string, :pointer, :dword, :pointer, :pointer, :pointer, :pointer, :dword], :bool
|
42
47
|
|
43
48
|
attach_pfunc :CreateProcessW,
|
44
49
|
[:buffer_in, :buffer_in, :pointer, :pointer, :bool,
|
45
|
-
:
|
50
|
+
:dword, :buffer_in, :buffer_in, :pointer, :pointer], :bool
|
46
51
|
|
47
|
-
attach_pfunc :AssignProcessToJobObject, [:
|
48
|
-
attach_pfunc :CreateJobObjectA, [:pointer, :string], :
|
49
|
-
attach_pfunc :OpenJobObjectA, [:
|
50
|
-
attach_pfunc :QueryInformationJobObject, [:
|
51
|
-
attach_pfunc :SetInformationJobObject, [:
|
52
|
+
attach_pfunc :AssignProcessToJobObject, [:handle, :handle], :bool
|
53
|
+
attach_pfunc :CreateJobObjectA, [:pointer, :string], :handle
|
54
|
+
attach_pfunc :OpenJobObjectA, [:dword, :bool, :string], :handle
|
55
|
+
attach_pfunc :QueryInformationJobObject, [:handle, :int, :pointer, :dword, :pointer], :bool
|
56
|
+
attach_pfunc :SetInformationJobObject, [:handle, :int, :pointer, :dword], :bool
|
52
57
|
|
53
58
|
ffi_lib :advapi32
|
54
59
|
|
55
60
|
attach_pfunc :ConvertSidToStringSidA, [:buffer_in, :pointer], :bool
|
56
|
-
attach_pfunc :GetTokenInformation, [:
|
57
|
-
attach_pfunc :OpenProcessToken, [:
|
61
|
+
attach_pfunc :GetTokenInformation, [:handle, :int, :pointer, :dword, :pointer], :bool
|
62
|
+
attach_pfunc :OpenProcessToken, [:handle, :dword, :pointer], :bool
|
58
63
|
|
59
64
|
attach_pfunc :CreateProcessWithLogonW,
|
60
|
-
[:buffer_in, :buffer_in, :buffer_in, :
|
61
|
-
:
|
65
|
+
[:buffer_in, :buffer_in, :buffer_in, :dword, :buffer_in, :buffer_in,
|
66
|
+
:dword, :buffer_in, :buffer_in, :pointer, :pointer], :bool
|
62
67
|
|
63
68
|
ffi_lib FFI::Library::LIBC
|
64
69
|
|
65
|
-
attach_pfunc :get_osfhandle, :_get_osfhandle, [:int], :
|
70
|
+
attach_pfunc :get_osfhandle, :_get_osfhandle, [:int], :intptr_t
|
66
71
|
|
67
72
|
begin
|
68
73
|
attach_pfunc :get_errno, :_get_errno, [:pointer], :int
|
@@ -8,6 +8,10 @@ require 'ffi'
|
|
8
8
|
module Process::Structs
|
9
9
|
extend FFI::Library
|
10
10
|
|
11
|
+
typedef :ulong, :dword
|
12
|
+
typedef :uintptr_t, :handle
|
13
|
+
typedef :short, :word
|
14
|
+
|
11
15
|
private
|
12
16
|
|
13
17
|
# sizeof(LARGE_INTEGER) == 8
|
@@ -31,13 +35,13 @@ module Process::Structs
|
|
31
35
|
layout(
|
32
36
|
:PerProcessUserTimeLimit, LARGE_INTEGER,
|
33
37
|
:PerJobUserTimeLimit, LARGE_INTEGER,
|
34
|
-
:LimitFlags, :
|
38
|
+
:LimitFlags, :dword,
|
35
39
|
:MinimumWorkingSetSize, :size_t,
|
36
40
|
:MaximumWorkingSetSize, :size_t,
|
37
|
-
:ActiveProcessLimit, :
|
41
|
+
:ActiveProcessLimit, :dword,
|
38
42
|
:Affinity, :pointer,
|
39
|
-
:PriorityClass, :
|
40
|
-
:SchedulingClass, :
|
43
|
+
:PriorityClass, :dword,
|
44
|
+
:SchedulingClass, :dword
|
41
45
|
)
|
42
46
|
end
|
43
47
|
|
@@ -54,7 +58,7 @@ module Process::Structs
|
|
54
58
|
|
55
59
|
class SECURITY_ATTRIBUTES < FFI::Struct
|
56
60
|
layout(
|
57
|
-
:nLength, :
|
61
|
+
:nLength, :dword,
|
58
62
|
:lpSecurityDescriptor, :pointer,
|
59
63
|
:bInheritHandle, :bool
|
60
64
|
)
|
@@ -67,27 +71,27 @@ module Process::Structs
|
|
67
71
|
:lpReserved, :string,
|
68
72
|
:lpDesktop, :string,
|
69
73
|
:lpTitle, :string,
|
70
|
-
:dwX, :
|
71
|
-
:dwY, :
|
72
|
-
:dwXSize, :
|
73
|
-
:dwYSize, :
|
74
|
-
:dwXCountChars, :
|
75
|
-
:dwYCountChars, :
|
76
|
-
:dwFillAttribute, :
|
77
|
-
:dwFlags, :
|
78
|
-
:wShowWindow, :
|
79
|
-
:cbReserved2, :
|
74
|
+
:dwX, :dword,
|
75
|
+
:dwY, :dword,
|
76
|
+
:dwXSize, :dword,
|
77
|
+
:dwYSize, :dword,
|
78
|
+
:dwXCountChars, :dword,
|
79
|
+
:dwYCountChars, :dword,
|
80
|
+
:dwFillAttribute, :dword,
|
81
|
+
:dwFlags, :dword,
|
82
|
+
:wShowWindow, :word,
|
83
|
+
:cbReserved2, :word,
|
80
84
|
:lpReserved2, :pointer,
|
81
|
-
:hStdInput, :
|
82
|
-
:hStdOutput, :
|
83
|
-
:hStdError, :
|
85
|
+
:hStdInput, :handle,
|
86
|
+
:hStdOutput, :handle,
|
87
|
+
:hStdError, :handle
|
84
88
|
)
|
85
89
|
end
|
86
90
|
|
87
91
|
class PROCESS_INFORMATION < FFI::Struct
|
88
92
|
layout(
|
89
|
-
:hProcess, :
|
90
|
-
:hThread, :
|
93
|
+
:hProcess, :handle,
|
94
|
+
:hThread, :handle,
|
91
95
|
:dwProcessId, :ulong,
|
92
96
|
:dwThreadId, :ulong
|
93
97
|
)
|
@@ -95,11 +99,11 @@ module Process::Structs
|
|
95
99
|
|
96
100
|
class OSVERSIONINFO < FFI::Struct
|
97
101
|
layout(
|
98
|
-
:dwOSVersionInfoSize, :
|
99
|
-
:dwMajorVersion, :
|
100
|
-
:dwMinorVersion, :
|
101
|
-
:dwBuildNumber, :
|
102
|
-
:dwPlatformId, :
|
102
|
+
:dwOSVersionInfoSize, :dword,
|
103
|
+
:dwMajorVersion, :dword,
|
104
|
+
:dwMinorVersion, :dword,
|
105
|
+
:dwBuildNumber, :dword,
|
106
|
+
:dwPlatformId, :dword,
|
103
107
|
:szCSDVersion, [:char, 128]
|
104
108
|
)
|
105
109
|
end
|
data/test/test_win32_process.rb
CHANGED
@@ -25,7 +25,7 @@ class TC_Win32Process < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
test "win32-process version is set to the correct value" do
|
28
|
-
assert_equal('0.7.
|
28
|
+
assert_equal('0.7.2', Process::WIN32_PROCESS_VERSION)
|
29
29
|
end
|
30
30
|
|
31
31
|
test "create basic functionality" do
|
data/win32-process.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-process
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ffi
|