Class: ReservedNames::Win32::Process
- Defined in:
- lib/chef/win32/process.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Class Method Summary collapse
- .get_current_process ⇒ Object
- .get_process_handle_count(handle) ⇒ Object
- .get_process_id(handle) ⇒ Object
-
.get_process_memory_info(handle) ⇒ Object
Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights, AND the PROCESS_VM_READ right.
Instance Method Summary collapse
- #handle_count ⇒ Object
- #id ⇒ Object
-
#initialize(handle) ⇒ Process
constructor
A new instance of Process.
- #memory_info ⇒ Object
Constructor Details
#initialize(handle) ⇒ Process
Returns a new instance of Process.
33 34 35 |
# File 'lib/chef/win32/process.rb', line 33 def initialize(handle) @handle = handle end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
37 38 39 |
# File 'lib/chef/win32/process.rb', line 37 def handle @handle end |
Class Method Details
.get_current_process ⇒ Object
51 52 53 |
# File 'lib/chef/win32/process.rb', line 51 def self.get_current_process Process.new(Handle.new(GetCurrentProcess())) end |
.get_process_handle_count(handle) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/chef/win32/process.rb', line 55 def self.get_process_handle_count(handle) handle_count = FFI::MemoryPointer.new :uint32 unless GetProcessHandleCount(handle.handle, handle_count) Chef::ReservedNames::Win32::Error.raise! end handle_count.read_uint32 end |
.get_process_id(handle) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/chef/win32/process.rb', line 63 def self.get_process_id(handle) # Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights result = GetProcessId(handle.handle) if result == 0 Chef::ReservedNames::Win32::Error.raise! end result end |
.get_process_memory_info(handle) ⇒ Object
Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights, AND the PROCESS_VM_READ right
74 75 76 77 78 79 80 |
# File 'lib/chef/win32/process.rb', line 74 def self.get_process_memory_info(handle) memory_info = PROCESS_MEMORY_COUNTERS.new unless GetProcessMemoryInfo(handle.handle, memory_info, memory_info.size) Chef::ReservedNames::Win32::Error.raise! end memory_info end |