[runtime] Fix "make distcheck"
[mono-project.git] / mono / io-layer / processes.h
blobc2b78d44387dbc11d3b0bd6105170b2bc74a07ec
1 /*
2 * processes.h: Process handles
4 * Author:
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002 Ximian, Inc.
8 */
10 #ifndef _WAPI_PROCESSES_H_
11 #define _WAPI_PROCESSES_H_
13 #ifdef HAVE_UNISTD_H
14 #include <unistd.h>
15 #endif
16 #include <glib.h>
18 #include <mono/io-layer/handles.h>
19 #include <mono/io-layer/access.h>
20 #include <mono/io-layer/versioninfo.h>
22 G_BEGIN_DECLS
24 typedef enum {
25 STARTF_USESHOWWINDOW=0x001,
26 STARTF_USESIZE=0x002,
27 STARTF_USEPOSITION=0x004,
28 STARTF_USECOUNTCHARS=0x008,
29 STARTF_USEFILLATTRIBUTE=0x010,
30 STARTF_RUNFULLSCREEN=0x020,
31 STARTF_FORCEONFEEDBACK=0x040,
32 STARTF_FORCEOFFFEEDBACK=0x080,
33 STARTF_USESTDHANDLES=0x100
34 } WapiStartupFlags;
37 typedef struct _WapiStartupInfo WapiStartupInfo;
39 struct _WapiStartupInfo
41 guint32 cb;
42 guchar *lpReserved;
43 guchar *lpDesktop;
44 guchar *lpTitle;
45 guint32 dwX;
46 guint32 dwY;
47 guint32 dwXSize;
48 guint32 dwYSize;
49 guint32 dwXCountChars;
50 guint32 dwYCountChars;
51 guint32 dwFillAttribute;
52 WapiStartupFlags dwFlags;
53 guint16 wShowWindow;
54 guint16 cbReserved2;
55 guint8 *lpReserved2;
56 gpointer hStdInput;
57 gpointer hStdOutput;
58 gpointer hStdError;
61 typedef struct _WapiProcessInformation WapiProcessInformation;
63 struct _WapiProcessInformation
65 gpointer hProcess;
66 gpointer hThread;
67 guint32 dwProcessId;
68 guint32 dwThreadId;
71 typedef enum {
72 SEE_MASK_CLASSNAME = 0x01,
73 SEE_MASK_CLASSKEY = 0x03,
74 SEE_MASK_IDLIST = 0x04,
75 SEE_MASK_INVOKEIDLIST = 0x0c,
76 SEE_MASK_ICON = 0x10,
77 SEE_MASK_HOTKEY = 0x20,
78 SEE_MASK_NOCLOSEPROCESS = 0x40,
79 SEE_MASK_CONNECTNETDRV = 0x80,
80 SEE_MASK_FLAG_DDEWAIT = 0x100,
81 SEE_MASK_DOENVSUBST = 0x200,
82 SEE_MASK_FLAG_NO_UI = 0x400,
83 SEE_MASK_NO_CONSOLE = 0x8000,
84 SEE_MASK_UNICODE = 0x10000,
85 SEE_MASK_HMONITOR = 0x200000,
86 /*SEE_MASK_FLAG_LOG_USAGE,*/
87 /*SEE_MASK_NOZONECHECKS,*/
88 } WapiShellExecuteInfoFlags;
90 typedef enum {
91 SW_HIDE = 0,
92 SW_SHOWNORMAL = 1,
93 SW_SHOWMINIMIZED = 2,
94 SW_MAXIMIZE = 3,
95 SW_SHOWMAXIMIZED = 3,
96 SW_SHOWNOACTIVATE = 4,
97 SW_SHOW = 5,
98 SW_MINIMIZE = 6,
99 SW_SHOWMINNOACTIVE = 7,
100 SW_SHOWNA = 8,
101 SW_RESTORE = 9,
102 SW_SHOWDEFAULT = 10,
103 } WapiShellExecuteShowFlags;
105 typedef struct _WapiShellExecuteInfo WapiShellExecuteInfo;
107 struct _WapiShellExecuteInfo
109 guint32 cbSize;
110 WapiShellExecuteInfoFlags fMask;
111 gpointer hwnd;
112 const gunichar2 *lpVerb;
113 const gunichar2 *lpFile;
114 const gunichar2 *lpParameters;
115 const gunichar2 *lpDirectory;
116 WapiShellExecuteShowFlags nShow;
117 gpointer hInstApp;
118 gpointer lpIDList;
119 const gunichar2 *lpClass;
120 gpointer hkeyClass;
121 guint32 dwHotKey;
122 union
124 gpointer hIcon;
125 gpointer hMonitor;
126 } u;
127 gpointer hProcess;
131 #define DEBUG_PROCESS 0x00000001
132 #define DEBUG_ONLY_THIS_PROCESS 0x00000002
133 #define CREATE_SUSPENDED 0x00000004
134 #define DETACHED_PROCESS 0x00000008
135 #define CREATE_NEW_CONSOLE 0x00000010
136 #define NORMAL_PRIORITY_CLASS 0x00000020
137 #define IDLE_PRIORITY_CLASS 0x00000040
138 #define HIGH_PRIORITY_CLASS 0x00000080
139 #define REALTIME_PRIORITY_CLASS 0x00000100
140 #define CREATE_NEW_PROCESS_GROUP 0x00000200
141 #define CREATE_UNICODE_ENVIRONMENT 0x00000400
142 #define CREATE_SEPARATE_WOW_VDM 0x00000800
143 #define CREATE_SHARED_WOW_VDM 0x00001000
144 #define CREATE_FORCEDOS 0x00002000
145 #define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
146 #define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
147 #define CREATE_BREAKAWAY_FROM_JOB 0x01000000
148 #define CREATE_WITH_USERPROFILE 0x02000000
149 #define CREATE_DEFAULT_ERROR_MODE 0x04000000
150 #define CREATE_NO_WINDOW 0x08000000
152 #ifdef NEW_STUFF
153 #define CREATE_PRESERVE_CODE_AUTHZ_LEVEL find out the value for this one...
154 #endif
156 #define PROCESS_TERMINATE 0x0001
157 #define PROCESS_CREATE_THREAD 0x0002
158 #define PROCESS_SET_SESSIONID 0x0004
159 #define PROCESS_VM_OPERATION 0x0008
160 #define PROCESS_VM_READ 0x0010
161 #define PROCESS_VM_WRITE 0x0020
162 #define PROCESS_DUP_HANDLE 0x0040
163 #define PROCESS_CREATE_PROCESS 0x0080
164 #define PROCESS_SET_QUOTA 0x0100
165 #define PROCESS_SET_INFORMATION 0x0200
166 #define PROCESS_QUERY_INFORMATION 0x0400
167 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff)
169 extern gboolean ShellExecuteEx (WapiShellExecuteInfo *sei);
170 extern gboolean CreateProcess (const gunichar2 *appname,
171 const gunichar2 *cmdline,
172 WapiSecurityAttributes *process_attrs,
173 WapiSecurityAttributes *thread_attrs,
174 gboolean inherit_handles, guint32 create_flags,
175 gpointer environ, const gunichar2 *cwd,
176 WapiStartupInfo *startup,
177 WapiProcessInformation *process_info);
178 extern gboolean CreateProcessWithLogonW (const gunichar2 *username,
179 const gunichar2 *domain,
180 const gunichar2 *password,
181 const guint32 logonFlags,
182 const gunichar2 *appname,
183 const gunichar2 *cmdline,
184 guint32 create_flags,
185 gpointer environ,
186 const gunichar2 *cwd,
187 WapiStartupInfo *startup,
188 WapiProcessInformation *process_info);
189 #define LOGON_WITH_PROFILE 0x00000001
190 #define LOGON_NETCREDENTIALS_ONLY 0x00000002
192 extern gpointer GetCurrentProcess (void);
193 extern guint32 GetProcessId (gpointer handle);
194 extern gboolean CloseProcess (gpointer handle);
195 extern gpointer OpenProcess (guint32 access, gboolean inherit, guint32 pid);
196 extern gboolean GetExitCodeProcess (gpointer process, guint32 *code);
197 extern gboolean GetProcessTimes (gpointer process, WapiFileTime *create_time,
198 WapiFileTime *exit_time,
199 WapiFileTime *kernel_time,
200 WapiFileTime *user_time);
201 extern gboolean EnumProcessModules (gpointer process, gpointer *modules,
202 guint32 size, guint32 *needed);
203 extern guint32 GetModuleBaseName (gpointer process, gpointer module,
204 gunichar2 *basename, guint32 size);
205 extern guint32 GetModuleFileNameEx (gpointer process, gpointer module,
206 gunichar2 *filename, guint32 size);
207 extern gboolean GetModuleInformation (gpointer process, gpointer module,
208 WapiModuleInfo *modinfo, guint32 size);
209 extern gboolean GetProcessWorkingSetSize (gpointer process, size_t *min,
210 size_t *max);
211 extern gboolean SetProcessWorkingSetSize (gpointer process, size_t min,
212 size_t max);
214 extern gboolean TerminateProcess (gpointer process, gint32 exitCode);
216 extern guint32 GetPriorityClass (gpointer process);
217 extern gboolean SetPriorityClass (gpointer process, guint32 priority_class);
219 gchar* wapi_process_get_path (pid_t pid);
221 void wapi_process_set_cli_launcher (char *path);
223 G_END_DECLS
225 #endif /* _WAPI_PROCESSES_H_ */