diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-16 02:00:12 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-16 02:05:40 +0300 |
commit | bfdf5415b5e025d795a1a7ee89946b00708f50b2 (patch) | |
tree | 7838c1f07dd704ef7bef288420e4e0f2f5dbe4b1 /include/winapi | |
parent | Handle: is_invalid -> is_valid (diff) | |
download | winapi-common-bfdf5415b5e025d795a1a7ee89946b00708f50b2.tar.gz winapi-common-bfdf5415b5e025d795a1a7ee89946b00708f50b2.zip |
Process: import pdb::Process from winapi-debug
Diffstat (limited to 'include/winapi')
-rw-r--r-- | include/winapi/process.hpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/winapi/process.hpp b/include/winapi/process.hpp index 2e1420f..b79d7c2 100644 --- a/include/winapi/process.hpp +++ b/include/winapi/process.hpp @@ -69,6 +69,8 @@ inline void swap(ShellParameters& a, ShellParameters& b) BOOST_NOEXCEPT_OR_NOTHR class Process { public: + using ID = DWORD; + static Process create(ProcessParameters); static Process create(const CommandLine&); static Process create(const CommandLine&, process::IO); @@ -76,28 +78,40 @@ public: static Process shell(const ShellParameters&); static Process shell(const CommandLine&); + static Process current(); + static Process open(ID, DWORD permissions = default_permissions()); + static Process open_r(ID); + + static DWORD default_permissions(); + static DWORD read_permissions(); + // VS 2013 won't generate these automatically. Process(Process&&) BOOST_NOEXCEPT_OR_NOTHROW; Process& operator=(Process) BOOST_NOEXCEPT_OR_NOTHROW; void swap(Process& other) BOOST_NOEXCEPT_OR_NOTHROW; Process(const Process&) = delete; + ID get_id() const { return m_id; } + const Handle& get_handle() const { return m_handle; } + bool is_running() const; void wait() const; void terminate(int ec = 0) const; void shut_down(int ec = 0) const; int get_exit_code() const; - static std::string get_exe_path(); + std::string get_exe_path() const; static Resource get_resource(uint32_t id); static std::string get_resource_string(uint32_t id); private: - explicit Process(Handle&& handle) : m_handle(std::move(handle)) {} + explicit Process(Handle&& handle); + Process(ID, Handle&& handle); static HMODULE get_exe_module(); + ID m_id; Handle m_handle; }; |