diff options
Diffstat (limited to 'include')
-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; }; |