Index: util/win/process_info.h |
diff --git a/util/win/process_info.h b/util/win/process_info.h |
index dac7b7c920edad1d58ed0112fff48230174f921f..2d8b075bf6705a03d614df846f78c3b787328d6e 100644 |
--- a/util/win/process_info.h |
+++ b/util/win/process_info.h |
@@ -50,6 +50,40 @@ class ProcessInfo { |
time_t timestamp; |
}; |
+ struct Handle { |
+ Handle(); |
+ ~Handle(); |
+ |
+ //! \brief A string representation of the handle's type. |
+ std::wstring type_name; |
+ |
+ //! \brief The handle's value. |
+ //! |
+ //! See https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203 on |
+ //! 32 bit being the correct size for HANDLEs for proceses, even on Windows |
Mark Mentovai
2015/10/16 04:03:04
32 bits, plural. Also, `HANDLE`s. Not just handles
scottmg
2015/10/16 20:36:01
Done. Somehow I always feel illiterate after these
Mark Mentovai
2015/10/16 22:04:05
You can blame it on your text editor like I do. :)
|
+ //! x64. |
+ uint32_t handle; |
+ |
+ //! \brief The attributes for the handle, e.g. `OBJ_INHERIT`, |
+ //! `OBJ_CASE_INSENSITIVE`, etc. |
+ uint32_t attributes; |
+ |
+ //! \brief The `ACCESS_MASK` for the handle in this process. |
+ //! |
+ //! See |
+ //! http://blogs.msdn.com/b/openspecification/archive/2010/04/01/about-the-access-mask-structure.aspx |
+ //! for more information. |
+ uint32_t granted_access; |
+ |
+ //! \brief The number of kernel references to the object that this handle |
+ //! refers to. |
+ uint32_t pointer_count; |
+ |
+ //! \brief The number of open handles to the object that this handle refers |
+ //! to. |
+ uint32_t handle_count; |
+ }; |
+ |
ProcessInfo(); |
~ProcessInfo(); |
@@ -106,6 +140,9 @@ class ProcessInfo { |
std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRanges( |
const CheckedRange<WinVMAddress, WinVMSize>& range) const; |
+ //! \brief Retrieves information about open handles in the target process. |
+ const std::vector<Handle>& Handles(); |
+ |
private: |
template <class Traits> |
friend bool GetProcessBasicInformation(HANDLE process, |
@@ -122,13 +159,17 @@ class ProcessInfo { |
bool is_64_bit, |
ProcessInfo* process_info); |
+ std::vector<Handle> BuildHandleVector(HANDLE process) const; |
+ |
pid_t process_id_; |
pid_t inherited_from_process_id_; |
+ HANDLE process_; |
std::wstring command_line_; |
WinVMAddress peb_address_; |
WinVMSize peb_size_; |
std::vector<Module> modules_; |
std::vector<MEMORY_BASIC_INFORMATION64> memory_info_; |
+ std::vector<Handle> handles_; |
bool is_64_bit_; |
bool is_wow64_; |
InitializationStateDcheck initialized_; |