1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//*****************************************************************************
5
6#ifndef _PROCESSCONTEXT_H
7#define _PROCESSCONTEXT_H
8
9struct ProcessDescriptor
10{
11 const static DWORD UNINITIALIZED_PID = 0;
12
13 static ProcessDescriptor Create(DWORD pid, LPCSTR applicationGroupId)
14 {
15 ProcessDescriptor pd;
16 pd.m_Pid = pid;
17 pd.m_ApplicationGroupId = applicationGroupId;
18
19 return pd;
20 }
21
22 static ProcessDescriptor FromCurrentProcess();
23 static ProcessDescriptor FromPid(DWORD pid)
24 {
25 return Create(pid, nullptr);
26 }
27 static ProcessDescriptor CreateUninitialized()
28 {
29 return Create(UNINITIALIZED_PID, nullptr);
30 }
31
32 bool IsInitialized() const { return m_Pid != UNINITIALIZED_PID; }
33
34 DWORD m_Pid;
35 LPCSTR m_ApplicationGroupId;
36};
37
38#endif // _PROCESSCONTEXT_H