-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add process_iterator helper #509
base: master
Are you sure you want to change the base?
Conversation
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) | ||
|
||
#if (__WI_LIBCPP_STD_VER >= 17) && WI_HAS_INCLUDE(<string_view>, 1) // Assume present if C++17 | ||
#if defined(WIL_ENABLE_EXCEPTIONS) | ||
|
||
#if __cpp_lib_string_view >= 201606L |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) | |
#if (__WI_LIBCPP_STD_VER >= 17) && WI_HAS_INCLUDE(<string_view>, 1) // Assume present if C++17 | |
#if defined(WIL_ENABLE_EXCEPTIONS) | |
#if __cpp_lib_string_view >= 201606L | |
#include "common.h" | |
#if WIL_USE_STL && (__WI_LIBCPP_STD_VER >= 17) && WI_HAS_INCLUDE(<string_view>, 1) // Assume present if C++17 | |
#include <string_view> | |
#endif | |
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && defined(WIL_ENABLE_EXCEPTIONS) && (__cpp_lib_string_view >= 201606L) |
Use WIL_USE_STL
to determine if it's okay to use the STL.
Need to include common.h
for WIL_ENABLE_EXCEPTIONS
and WIL_USE_STL
definitions.
Need to include string_view
to get the definition of __cpp_lib_string_view
#include <string> | ||
#include <TlHelp32.h> | ||
|
||
#define __WIL_PROCESS_ITERATOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have an include guard, so this seems unnecessary
DWORD ProcessID{}; | ||
ULONG_PTR ThreadCount{}; | ||
DWORD ParentProcessID{}; | ||
LONG BasePriority{}; | ||
std::wstring ProcessName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DWORD ProcessID{}; | |
ULONG_PTR ThreadCount{}; | |
DWORD ParentProcessID{}; | |
LONG BasePriority{}; | |
std::wstring ProcessName; | |
DWORD process_id{}; | |
ULONG_PTR thread_count{}; | |
DWORD parent_process_id{}; | |
LONG base_priority{}; | |
std::wstring process_name; |
Use snake_case
}; | ||
} // namespace details | ||
|
||
struct process_iterator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this an "iterator" when it's not actually an iterator is misleading
This adds a little iterator class to abstract away the toolhelp apis.