win32-process 0.7.1 → 0.7.2

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.
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
@@ -63,7 +63,7 @@
63
63
  Artistic 2.0
64
64
 
65
65
  = Copyright
66
- (C) 2003-2012 Daniel J. Berger
66
+ (C) 2003-2013 Daniel J. Berger
67
67
  All Rights Reserved
68
68
 
69
69
  = Warranty
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.1'
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, [:ulong], :bool
22
- attach_pfunc :GenerateConsoleCtrlEvent, [:ulong, :ulong], :bool
23
- attach_pfunc :GetCurrentProcess, [], :ulong
24
- attach_pfunc :GetModuleHandle, :GetModuleHandleA, [:string], :ulong
25
- attach_pfunc :GetProcessAffinityMask, [:ulong, :pointer, :pointer], :bool
26
- attach_pfunc :GetPriorityClass, [:ulong], :ulong
27
- attach_pfunc :GetProcAddress, [:ulong, :string], :ulong
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, [:ulong, :pointer, :pointer], :void
30
- attach_pfunc :OpenProcess, [:ulong, :bool, :ulong], :ulong
31
- attach_pfunc :SetHandleInformation, [:ulong, :ulong, :ulong], :bool
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, [:ulong, :ulong], :bool
34
- attach_pfunc :TerminateProcess, [:ulong, :uint], :bool
35
- attach_pfunc :WaitForSingleObject, [:ulong, :ulong], :ulong
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
- [:ulong, :pointer, :size_t, :ulong, :pointer, :ulong, :pointer], :ulong
43
+ [:handle, :pointer, :size_t, :pointer, :pointer, :dword, :pointer], :handle
39
44
 
40
45
  attach_pfunc :GetVolumeInformationA,
41
- [:string, :pointer, :ulong, :pointer, :pointer, :pointer, :pointer, :ulong], :bool
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
- :ulong, :buffer_in, :buffer_in, :pointer, :pointer], :bool
50
+ :dword, :buffer_in, :buffer_in, :pointer, :pointer], :bool
46
51
 
47
- attach_pfunc :AssignProcessToJobObject, [:ulong, :ulong], :bool
48
- attach_pfunc :CreateJobObjectA, [:pointer, :string], :ulong
49
- attach_pfunc :OpenJobObjectA, [:ulong, :bool, :string], :ulong
50
- attach_pfunc :QueryInformationJobObject, [:ulong, :int, :pointer, :ulong, :pointer], :bool
51
- attach_pfunc :SetInformationJobObject, [:ulong, :int, :pointer, :ulong], :bool
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, [:ulong, :int, :pointer, :ulong, :pointer], :bool
57
- attach_pfunc :OpenProcessToken, [:ulong, :ulong, :pointer], :bool
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, :ulong, :buffer_in, :buffer_in,
61
- :ulong, :buffer_in, :buffer_in, :pointer, :pointer], :bool
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], :ulong
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, :ulong,
38
+ :LimitFlags, :dword,
35
39
  :MinimumWorkingSetSize, :size_t,
36
40
  :MaximumWorkingSetSize, :size_t,
37
- :ActiveProcessLimit, :ulong,
41
+ :ActiveProcessLimit, :dword,
38
42
  :Affinity, :pointer,
39
- :PriorityClass, :ulong,
40
- :SchedulingClass, :ulong
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, :ulong,
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, :ulong,
71
- :dwY, :ulong,
72
- :dwXSize, :ulong,
73
- :dwYSize, :ulong,
74
- :dwXCountChars, :ulong,
75
- :dwYCountChars, :ulong,
76
- :dwFillAttribute, :ulong,
77
- :dwFlags, :ulong,
78
- :wShowWindow, :short,
79
- :cbReserved2, :short,
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, :ulong,
82
- :hStdOutput, :ulong,
83
- :hStdError, :ulong
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, :ulong,
90
- :hThread, :ulong,
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, :ulong,
99
- :dwMajorVersion, :ulong,
100
- :dwMinorVersion, :ulong,
101
- :dwBuildNumber, :ulong,
102
- :dwPlatformId, :ulong,
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
@@ -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.1', Process::WIN32_PROCESS_VERSION)
28
+ assert_equal('0.7.2', Process::WIN32_PROCESS_VERSION)
29
29
  end
30
30
 
31
31
  test "create basic functionality" do
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'win32-process'
5
- spec.version = '0.7.1'
5
+ spec.version = '0.7.2'
6
6
  spec.license = 'Artistic 2.0'
7
7
  spec.authors = ['Daniel Berger', 'Park Heesob']
8
8
  spec.email = 'djberg96@gmail.com'
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.1
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-01-03 00:00:00.000000000 Z
13
+ date: 2013-04-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi