win32-process 0.7.2 → 0.7.3

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.
@@ -1,105 +1,110 @@
1
- module Process::Constants
2
- private
3
-
4
- # Priority constants
5
-
6
- ABOVE_NORMAL_PRIORITY_CLASS = 0x0008000
7
- BELOW_NORMAL_PRIORITY_CLASS = 0x0004000
8
- HIGH_PRIORITY_CLASS = 0x0000080
9
- IDLE_PRIORITY_CLASS = 0x0000040
10
- NORMAL_PRIORITY_CLASS = 0x0000020
11
- REALTIME_PRIORITY_CLASS = 0x0000010
12
-
13
- # Error constants
14
-
15
- INVALID_HANDLE_VALUE = 0xffffffff
16
- ERROR_ACCESS_DENIED = 0x00000005
17
-
18
- # Process Access Rights
19
-
20
- PROCESS_TERMINATE = 0x00000001
21
- PROCESS_SET_INFORMATION = 0x00000200
22
- PROCESS_QUERY_INFORMATION = 0x00000400
23
- PROCESS_ALL_ACCESS = 0x001F0FFF
24
- PROCESS_VM_READ = 0x00000010
25
-
26
- # Process wait time for Process.kill
27
-
28
- INFINITE = 0xFFFFFFFF
29
-
30
- # Process creation flags
31
-
32
- CREATE_BREAKAWAY_FROM_JOB = 0x01000000
33
- CREATE_DEFAULT_ERROR_MODE = 0x04000000
34
- CREATE_NEW_CONSOLE = 0x00000010
35
- CREATE_NEW_PROCESS_GROUP = 0x00000200
36
- CREATE_NO_WINDOW = 0x08000000
37
- CREATE_PROTECTED_PROCESS = 0x00040000
38
- CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000
39
- CREATE_SEPARATE_WOW_VDM = 0x00000800
40
- CREATE_SHARED_WOW_VDM = 0x00001000
41
- CREATE_SUSPENDED = 0x00000004
42
- CREATE_UNICODE_ENVIRONMENT = 0x00000400
43
- DEBUG_ONLY_THIS_PROCESS = 0x00000002
44
- DEBUG_PROCESS = 0x00000001
45
- DETACHED_PROCESS = 0x00000008
46
- INHERIT_PARENT_AFFINITY = 0x00010000
47
-
48
- STARTF_USESHOWWINDOW = 0x00000001
49
- STARTF_USESIZE = 0x00000002
50
- STARTF_USEPOSITION = 0x00000004
51
- STARTF_USECOUNTCHARS = 0x00000008
52
- STARTF_USEFILLATTRIBUTE = 0x00000010
53
- STARTF_RUNFULLSCREEN = 0x00000020
54
- STARTF_FORCEONFEEDBACK = 0x00000040
55
- STARTF_FORCEOFFFEEDBACK = 0x00000080
56
- STARTF_USESTDHANDLES = 0x00000100
57
- STARTF_USEHOTKEY = 0x00000200
58
- STARTF_TITLEISLINKNAME = 0x00000800
59
- STARTF_TITLEISAPPID = 0x00001000
60
- STARTF_PREVENTPINNING = 0x00002000
61
-
62
- LOGON_WITH_PROFILE = 0x00000001
63
- LOGON_NETCREDENTIALS_ONLY = 0x00000002
64
-
65
- SHUTDOWN_NORETRY = 0x00000001
66
-
67
- # Security
68
-
69
- TokenUser = 1
70
- TOKEN_QUERY = 0x00000008
71
-
72
- # Define these for Windows. They are not actually used but are defined
73
- # for interface compatibility.
74
-
75
- PRIO_PROCESS = 0
76
- PRIO_PGRP = 1
77
- PRIO_USER = 2
78
-
79
- # Define these for Windows
80
-
81
- RLIMIT_CPU = 0 # PerProcessUserTimeLimit
82
- RLIMIT_FSIZE = 1 # Hard coded at 4TB - 64K (assumes NTFS)
83
- RLIMIT_AS = 5 # ProcessMemoryLimit
84
- RLIMIT_RSS = 5 # ProcessMemoryLimit
85
- RLIMIT_VMEM = 5 # ProcessMemoryLimit
86
-
87
- # Job constants
88
-
89
- JOB_OBJECT_SET_ATTRIBUTES = 0x00000002
90
- JOB_OBJECT_QUERY = 0x00000004
91
- JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002
92
- JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100
93
- JobObjectExtendedLimitInformation = 9
94
-
95
- # Console Events
96
-
97
- CTRL_C_EVENT = 0
98
- CTRL_BREAK_EVENT = 1
99
-
100
- # Miscellaneous
101
-
102
- HANDLE_FLAG_INHERIT = 0x00000001
103
- SEM_FAILCRITICALERRORS = 0x00000001
104
- SEM_NOGPFAULTERRORBOX = 0x00000002
105
- end
1
+ module Process::Constants
2
+ private
3
+
4
+ # Priority constants
5
+
6
+ ABOVE_NORMAL_PRIORITY_CLASS = 0x0008000
7
+ BELOW_NORMAL_PRIORITY_CLASS = 0x0004000
8
+ HIGH_PRIORITY_CLASS = 0x0000080
9
+ IDLE_PRIORITY_CLASS = 0x0000040
10
+ NORMAL_PRIORITY_CLASS = 0x0000020
11
+ REALTIME_PRIORITY_CLASS = 0x0000010
12
+
13
+ # Error constants
14
+
15
+ INVALID_HANDLE_VALUE = 0xffffffff
16
+ ERROR_ACCESS_DENIED = 0x00000005
17
+
18
+ # Process Access Rights
19
+
20
+ PROCESS_TERMINATE = 0x00000001
21
+ PROCESS_SET_INFORMATION = 0x00000200
22
+ PROCESS_QUERY_INFORMATION = 0x00000400
23
+ PROCESS_ALL_ACCESS = 0x001F0FFF
24
+ PROCESS_VM_READ = 0x00000010
25
+
26
+ # Process wait time for Process.kill
27
+
28
+ INFINITE = 0xFFFFFFFF
29
+
30
+ # Process creation flags
31
+
32
+ CREATE_BREAKAWAY_FROM_JOB = 0x01000000
33
+ CREATE_DEFAULT_ERROR_MODE = 0x04000000
34
+ CREATE_NEW_CONSOLE = 0x00000010
35
+ CREATE_NEW_PROCESS_GROUP = 0x00000200
36
+ CREATE_NO_WINDOW = 0x08000000
37
+ CREATE_PROTECTED_PROCESS = 0x00040000
38
+ CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000
39
+ CREATE_SEPARATE_WOW_VDM = 0x00000800
40
+ CREATE_SHARED_WOW_VDM = 0x00001000
41
+ CREATE_SUSPENDED = 0x00000004
42
+ CREATE_UNICODE_ENVIRONMENT = 0x00000400
43
+ DEBUG_ONLY_THIS_PROCESS = 0x00000002
44
+ DEBUG_PROCESS = 0x00000001
45
+ DETACHED_PROCESS = 0x00000008
46
+ INHERIT_PARENT_AFFINITY = 0x00010000
47
+
48
+ STARTF_USESHOWWINDOW = 0x00000001
49
+ STARTF_USESIZE = 0x00000002
50
+ STARTF_USEPOSITION = 0x00000004
51
+ STARTF_USECOUNTCHARS = 0x00000008
52
+ STARTF_USEFILLATTRIBUTE = 0x00000010
53
+ STARTF_RUNFULLSCREEN = 0x00000020
54
+ STARTF_FORCEONFEEDBACK = 0x00000040
55
+ STARTF_FORCEOFFFEEDBACK = 0x00000080
56
+ STARTF_USESTDHANDLES = 0x00000100
57
+ STARTF_USEHOTKEY = 0x00000200
58
+ STARTF_TITLEISLINKNAME = 0x00000800
59
+ STARTF_TITLEISAPPID = 0x00001000
60
+ STARTF_PREVENTPINNING = 0x00002000
61
+
62
+ LOGON_WITH_PROFILE = 0x00000001
63
+ LOGON_NETCREDENTIALS_ONLY = 0x00000002
64
+
65
+ SHUTDOWN_NORETRY = 0x00000001
66
+
67
+ # Security
68
+
69
+ TokenUser = 1
70
+ TOKEN_QUERY = 0x00000008
71
+
72
+ # Define these for Windows. They are not actually used but are defined
73
+ # for interface compatibility.
74
+
75
+ PRIO_PROCESS = 0
76
+ PRIO_PGRP = 1
77
+ PRIO_USER = 2
78
+
79
+ # Define these for Windows
80
+
81
+ RLIMIT_CPU = 0 # PerProcessUserTimeLimit
82
+ RLIMIT_FSIZE = 1 # Hard coded at 4TB - 64K (assumes NTFS)
83
+ RLIMIT_AS = 5 # ProcessMemoryLimit
84
+ RLIMIT_RSS = 5 # ProcessMemoryLimit
85
+ RLIMIT_VMEM = 5 # ProcessMemoryLimit
86
+
87
+ # Job constants
88
+
89
+ JOB_OBJECT_SET_ATTRIBUTES = 0x00000002
90
+ JOB_OBJECT_QUERY = 0x00000004
91
+ JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002
92
+ JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100
93
+ JobObjectExtendedLimitInformation = 9
94
+
95
+ # Console Events
96
+
97
+ CTRL_C_EVENT = 0
98
+ CTRL_BREAK_EVENT = 1
99
+
100
+ # Miscellaneous
101
+
102
+ HANDLE_FLAG_INHERIT = 0x00000001
103
+ SEM_FAILCRITICALERRORS = 0x00000001
104
+ SEM_NOGPFAULTERRORBOX = 0x00000002
105
+
106
+ # GetExitCodeProcess
107
+
108
+ STILL_ACTIVE = 259
109
+
110
+ end
@@ -1,77 +1,78 @@
1
- if RUBY_PLATFORM == 'java'
2
- require 'rubygems'
3
- gem 'ffi'
4
- end
5
-
6
- require 'ffi'
7
-
8
- module Process::Functions
9
- module FFI::Library
10
- # Wrapper method for attach_function + private
11
- def attach_pfunc(*args)
12
- attach_function(*args)
13
- private args[0]
14
- end
15
- end
16
-
17
- extend FFI::Library
18
-
19
- typedef :ulong, :dword
20
- typedef :uintptr_t, :handle
21
- typedef :uintptr_t, :hwnd
22
- typedef :uintptr_t, :hmodule
23
-
24
- ffi_lib :kernel32
25
-
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
33
- attach_pfunc :GetVersionExA, [:pointer], :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
37
- attach_pfunc :SetErrorMode, [:uint], :uint
38
- attach_pfunc :SetPriorityClass, [:handle, :dword], :bool
39
- attach_pfunc :TerminateProcess, [:handle, :uint], :bool
40
- attach_pfunc :WaitForSingleObject, [:handle, :dword], :dword
41
-
42
- attach_pfunc :CreateRemoteThread,
43
- [:handle, :pointer, :size_t, :pointer, :pointer, :dword, :pointer], :handle
44
-
45
- attach_pfunc :GetVolumeInformationA,
46
- [:string, :pointer, :dword, :pointer, :pointer, :pointer, :pointer, :dword], :bool
47
-
48
- attach_pfunc :CreateProcessW,
49
- [:buffer_in, :buffer_in, :pointer, :pointer, :bool,
50
- :dword, :buffer_in, :buffer_in, :pointer, :pointer], :bool
51
-
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
57
-
58
- ffi_lib :advapi32
59
-
60
- attach_pfunc :ConvertSidToStringSidA, [:buffer_in, :pointer], :bool
61
- attach_pfunc :GetTokenInformation, [:handle, :int, :pointer, :dword, :pointer], :bool
62
- attach_pfunc :OpenProcessToken, [:handle, :dword, :pointer], :bool
63
-
64
- attach_pfunc :CreateProcessWithLogonW,
65
- [:buffer_in, :buffer_in, :buffer_in, :dword, :buffer_in, :buffer_in,
66
- :dword, :buffer_in, :buffer_in, :pointer, :pointer], :bool
67
-
68
- ffi_lib FFI::Library::LIBC
69
-
70
- attach_pfunc :get_osfhandle, :_get_osfhandle, [:int], :intptr_t
71
-
72
- begin
73
- attach_pfunc :get_errno, :_get_errno, [:pointer], :int
74
- rescue FFI::NotFoundError
75
- # Do nothing, Windows XP or earlier.
76
- end
77
- end
1
+ if RUBY_PLATFORM == 'java'
2
+ require 'rubygems'
3
+ gem 'ffi'
4
+ end
5
+
6
+ require 'ffi'
7
+
8
+ module Process::Functions
9
+ module FFI::Library
10
+ # Wrapper method for attach_function + private
11
+ def attach_pfunc(*args)
12
+ attach_function(*args)
13
+ private args[0]
14
+ end
15
+ end
16
+
17
+ extend FFI::Library
18
+
19
+ typedef :ulong, :dword
20
+ typedef :uintptr_t, :handle
21
+ typedef :uintptr_t, :hwnd
22
+ typedef :uintptr_t, :hmodule
23
+
24
+ ffi_lib :kernel32
25
+
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
33
+ attach_pfunc :GetVersionExA, [:pointer], :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
37
+ attach_pfunc :SetErrorMode, [:uint], :uint
38
+ attach_pfunc :SetPriorityClass, [:handle, :dword], :bool
39
+ attach_pfunc :TerminateProcess, [:handle, :uint], :bool
40
+ attach_pfunc :WaitForSingleObject, [:handle, :dword], :dword
41
+
42
+ attach_pfunc :CreateRemoteThread,
43
+ [:handle, :pointer, :size_t, :pointer, :pointer, :dword, :pointer], :handle
44
+
45
+ attach_pfunc :GetVolumeInformationA,
46
+ [:string, :pointer, :dword, :pointer, :pointer, :pointer, :pointer, :dword], :bool
47
+
48
+ attach_pfunc :CreateProcessW,
49
+ [:buffer_in, :buffer_in, :pointer, :pointer, :bool,
50
+ :dword, :buffer_in, :buffer_in, :pointer, :pointer], :bool
51
+
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
57
+ attach_pfunc :GetExitCodeProcess, [:handle, :pointer], :bool
58
+
59
+ ffi_lib :advapi32
60
+
61
+ attach_pfunc :ConvertSidToStringSidA, [:buffer_in, :pointer], :bool
62
+ attach_pfunc :GetTokenInformation, [:handle, :int, :pointer, :dword, :pointer], :bool
63
+ attach_pfunc :OpenProcessToken, [:handle, :dword, :pointer], :bool
64
+
65
+ attach_pfunc :CreateProcessWithLogonW,
66
+ [:buffer_in, :buffer_in, :buffer_in, :dword, :buffer_in, :buffer_in,
67
+ :dword, :buffer_in, :buffer_in, :pointer, :pointer], :bool
68
+
69
+ ffi_lib FFI::Library::LIBC
70
+
71
+ attach_pfunc :get_osfhandle, :_get_osfhandle, [:int], :intptr_t
72
+
73
+ begin
74
+ attach_pfunc :get_errno, :_get_errno, [:pointer], :int
75
+ rescue FFI::NotFoundError
76
+ # Do nothing, Windows XP or earlier.
77
+ end
78
+ end
@@ -1,13 +1,13 @@
1
- class String
2
- # Convert a regular string to a wide character string. This does not
3
- # modify the receiver.
4
- def to_wide_string
5
- (self + 0.chr).encode('UTF-16LE')
6
- end
7
-
8
- # Convert a regular string to a wide character string. This modifies
9
- # the receiver.
10
- def to_wide_string!
11
- replace((self + 0.chr).encode('UTF-16LE'))
12
- end
13
- end
1
+ class String
2
+ # Convert a regular string to a wide character string. This does not
3
+ # modify the receiver.
4
+ def to_wide_string
5
+ (self + 0.chr).encode('UTF-16LE')
6
+ end
7
+
8
+ # Convert a regular string to a wide character string. This modifies
9
+ # the receiver.
10
+ def to_wide_string!
11
+ replace((self + 0.chr).encode('UTF-16LE'))
12
+ end
13
+ end
@@ -1,118 +1,118 @@
1
- if RUBY_PLATFORM == 'java'
2
- require 'rubygems'
3
- gem 'ffi'
4
- end
5
-
6
- require 'ffi'
7
-
8
- module Process::Structs
9
- extend FFI::Library
10
-
11
- typedef :ulong, :dword
12
- typedef :uintptr_t, :handle
13
- typedef :short, :word
14
-
15
- private
16
-
17
- # sizeof(LARGE_INTEGER) == 8
18
- class LARGE_INTEGER < FFI::Union
19
- layout(:QuadPart, :long_long)
20
- end
21
-
22
- # sizeof(IO_COUNTERS) == 48
23
- class IO_COUNTERS < FFI::Struct
24
- layout(
25
- :ReadOperationCount, :ulong_long,
26
- :WriteOperationCount, :ulong_long,
27
- :OtherOperationCount, :ulong_long,
28
- :ReadTransferCount, :ulong_long,
29
- :WriteTransferCount, :ulong_long,
30
- :OtherTransferCount, :ulong_long
31
- )
32
- end
33
-
34
- class JOBJECT_BASIC_LIMIT_INFORMATION < FFI::Struct
35
- layout(
36
- :PerProcessUserTimeLimit, LARGE_INTEGER,
37
- :PerJobUserTimeLimit, LARGE_INTEGER,
38
- :LimitFlags, :dword,
39
- :MinimumWorkingSetSize, :size_t,
40
- :MaximumWorkingSetSize, :size_t,
41
- :ActiveProcessLimit, :dword,
42
- :Affinity, :pointer,
43
- :PriorityClass, :dword,
44
- :SchedulingClass, :dword
45
- )
46
- end
47
-
48
- class JOBJECT_EXTENDED_LIMIT_INFORMATION < FFI::Struct
49
- layout(
50
- :BasicLimitInformation, JOBJECT_BASIC_LIMIT_INFORMATION,
51
- :IoInfo, IO_COUNTERS,
52
- :ProcessMemoryLimit, :size_t,
53
- :JobMemoryLimit, :size_t,
54
- :PeakProcessMemoryUsed, :size_t,
55
- :PeakJobMemoryUsed, :size_t
56
- )
57
- end
58
-
59
- class SECURITY_ATTRIBUTES < FFI::Struct
60
- layout(
61
- :nLength, :dword,
62
- :lpSecurityDescriptor, :pointer,
63
- :bInheritHandle, :bool
64
- )
65
- end
66
-
67
- # sizeof(STARTUPINFO) == 68
68
- class STARTUPINFO < FFI::Struct
69
- layout(
70
- :cb, :ulong,
71
- :lpReserved, :string,
72
- :lpDesktop, :string,
73
- :lpTitle, :string,
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,
84
- :lpReserved2, :pointer,
85
- :hStdInput, :handle,
86
- :hStdOutput, :handle,
87
- :hStdError, :handle
88
- )
89
- end
90
-
91
- class PROCESS_INFORMATION < FFI::Struct
92
- layout(
93
- :hProcess, :handle,
94
- :hThread, :handle,
95
- :dwProcessId, :ulong,
96
- :dwThreadId, :ulong
97
- )
98
- end
99
-
100
- class OSVERSIONINFO < FFI::Struct
101
- layout(
102
- :dwOSVersionInfoSize, :dword,
103
- :dwMajorVersion, :dword,
104
- :dwMinorVersion, :dword,
105
- :dwBuildNumber, :dword,
106
- :dwPlatformId, :dword,
107
- :szCSDVersion, [:char, 128]
108
- )
109
- end
110
-
111
- # Used by Process.create
112
- ProcessInfo = Struct.new("ProcessInfo",
113
- :process_handle,
114
- :thread_handle,
115
- :process_id,
116
- :thread_id
117
- )
118
- end
1
+ if RUBY_PLATFORM == 'java'
2
+ require 'rubygems'
3
+ gem 'ffi'
4
+ end
5
+
6
+ require 'ffi'
7
+
8
+ module Process::Structs
9
+ extend FFI::Library
10
+
11
+ typedef :ulong, :dword
12
+ typedef :uintptr_t, :handle
13
+ typedef :short, :word
14
+
15
+ private
16
+
17
+ # sizeof(LARGE_INTEGER) == 8
18
+ class LARGE_INTEGER < FFI::Union
19
+ layout(:QuadPart, :long_long)
20
+ end
21
+
22
+ # sizeof(IO_COUNTERS) == 48
23
+ class IO_COUNTERS < FFI::Struct
24
+ layout(
25
+ :ReadOperationCount, :ulong_long,
26
+ :WriteOperationCount, :ulong_long,
27
+ :OtherOperationCount, :ulong_long,
28
+ :ReadTransferCount, :ulong_long,
29
+ :WriteTransferCount, :ulong_long,
30
+ :OtherTransferCount, :ulong_long
31
+ )
32
+ end
33
+
34
+ class JOBJECT_BASIC_LIMIT_INFORMATION < FFI::Struct
35
+ layout(
36
+ :PerProcessUserTimeLimit, LARGE_INTEGER,
37
+ :PerJobUserTimeLimit, LARGE_INTEGER,
38
+ :LimitFlags, :dword,
39
+ :MinimumWorkingSetSize, :size_t,
40
+ :MaximumWorkingSetSize, :size_t,
41
+ :ActiveProcessLimit, :dword,
42
+ :Affinity, :pointer,
43
+ :PriorityClass, :dword,
44
+ :SchedulingClass, :dword
45
+ )
46
+ end
47
+
48
+ class JOBJECT_EXTENDED_LIMIT_INFORMATION < FFI::Struct
49
+ layout(
50
+ :BasicLimitInformation, JOBJECT_BASIC_LIMIT_INFORMATION,
51
+ :IoInfo, IO_COUNTERS,
52
+ :ProcessMemoryLimit, :size_t,
53
+ :JobMemoryLimit, :size_t,
54
+ :PeakProcessMemoryUsed, :size_t,
55
+ :PeakJobMemoryUsed, :size_t
56
+ )
57
+ end
58
+
59
+ class SECURITY_ATTRIBUTES < FFI::Struct
60
+ layout(
61
+ :nLength, :dword,
62
+ :lpSecurityDescriptor, :pointer,
63
+ :bInheritHandle, :bool
64
+ )
65
+ end
66
+
67
+ # sizeof(STARTUPINFO) == 68
68
+ class STARTUPINFO < FFI::Struct
69
+ layout(
70
+ :cb, :ulong,
71
+ :lpReserved, :string,
72
+ :lpDesktop, :string,
73
+ :lpTitle, :string,
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,
84
+ :lpReserved2, :pointer,
85
+ :hStdInput, :handle,
86
+ :hStdOutput, :handle,
87
+ :hStdError, :handle
88
+ )
89
+ end
90
+
91
+ class PROCESS_INFORMATION < FFI::Struct
92
+ layout(
93
+ :hProcess, :handle,
94
+ :hThread, :handle,
95
+ :dwProcessId, :ulong,
96
+ :dwThreadId, :ulong
97
+ )
98
+ end
99
+
100
+ class OSVERSIONINFO < FFI::Struct
101
+ layout(
102
+ :dwOSVersionInfoSize, :dword,
103
+ :dwMajorVersion, :dword,
104
+ :dwMinorVersion, :dword,
105
+ :dwBuildNumber, :dword,
106
+ :dwPlatformId, :dword,
107
+ :szCSDVersion, [:char, 128]
108
+ )
109
+ end
110
+
111
+ # Used by Process.create
112
+ ProcessInfo = Struct.new("ProcessInfo",
113
+ :process_handle,
114
+ :thread_handle,
115
+ :process_id,
116
+ :thread_id
117
+ )
118
+ end