2 * processes.h: Process handles
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002 Ximian, Inc.
10 #ifndef _WAPI_PROCESSES_H_
11 #define _WAPI_PROCESSES_H_
18 #include <mono/io-layer/access.h>
19 #include <mono/io-layer/versioninfo.h>
24 STARTF_USESHOWWINDOW=0x001,
26 STARTF_USEPOSITION=0x004,
27 STARTF_USECOUNTCHARS=0x008,
28 STARTF_USEFILLATTRIBUTE=0x010,
29 STARTF_RUNFULLSCREEN=0x020,
30 STARTF_FORCEONFEEDBACK=0x040,
31 STARTF_FORCEOFFFEEDBACK=0x080,
32 STARTF_USESTDHANDLES=0x100
36 typedef struct _WapiStartupInfo WapiStartupInfo;
38 struct _WapiStartupInfo
48 guint32 dwXCountChars;
49 guint32 dwYCountChars;
50 guint32 dwFillAttribute;
51 WapiStartupFlags dwFlags;
60 typedef struct _WapiProcessInformation WapiProcessInformation;
62 struct _WapiProcessInformation
71 SEE_MASK_CLASSNAME = 0x01,
72 SEE_MASK_CLASSKEY = 0x03,
73 SEE_MASK_IDLIST = 0x04,
74 SEE_MASK_INVOKEIDLIST = 0x0c,
76 SEE_MASK_HOTKEY = 0x20,
77 SEE_MASK_NOCLOSEPROCESS = 0x40,
78 SEE_MASK_CONNECTNETDRV = 0x80,
79 SEE_MASK_FLAG_DDEWAIT = 0x100,
80 SEE_MASK_DOENVSUBST = 0x200,
81 SEE_MASK_FLAG_NO_UI = 0x400,
82 SEE_MASK_NO_CONSOLE = 0x8000,
83 SEE_MASK_UNICODE = 0x10000,
84 SEE_MASK_HMONITOR = 0x200000,
85 /*SEE_MASK_FLAG_LOG_USAGE,*/
86 /*SEE_MASK_NOZONECHECKS,*/
87 } WapiShellExecuteInfoFlags;
95 SW_SHOWNOACTIVATE = 4,
98 SW_SHOWMINNOACTIVE = 7,
102 } WapiShellExecuteShowFlags;
104 typedef struct _WapiShellExecuteInfo WapiShellExecuteInfo;
106 struct _WapiShellExecuteInfo
111 const gunichar2 *lpVerb;
112 const gunichar2 *lpFile;
113 const gunichar2 *lpParameters;
114 const gunichar2 *lpDirectory;
118 const gunichar2 *lpClass;
130 #define DEBUG_PROCESS 0x00000001
131 #define DEBUG_ONLY_THIS_PROCESS 0x00000002
132 #define CREATE_SUSPENDED 0x00000004
133 #define DETACHED_PROCESS 0x00000008
134 #define CREATE_NEW_CONSOLE 0x00000010
135 #define NORMAL_PRIORITY_CLASS 0x00000020
136 #define IDLE_PRIORITY_CLASS 0x00000040
137 #define HIGH_PRIORITY_CLASS 0x00000080
138 #define REALTIME_PRIORITY_CLASS 0x00000100
139 #define CREATE_NEW_PROCESS_GROUP 0x00000200
140 #define CREATE_UNICODE_ENVIRONMENT 0x00000400
141 #define CREATE_SEPARATE_WOW_VDM 0x00000800
142 #define CREATE_SHARED_WOW_VDM 0x00001000
143 #define CREATE_FORCEDOS 0x00002000
144 #define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
145 #define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
146 #define CREATE_BREAKAWAY_FROM_JOB 0x01000000
147 #define CREATE_WITH_USERPROFILE 0x02000000
148 #define CREATE_DEFAULT_ERROR_MODE 0x04000000
149 #define CREATE_NO_WINDOW 0x08000000
152 #define CREATE_PRESERVE_CODE_AUTHZ_LEVEL find out the value for this one...
155 #define PROCESS_TERMINATE 0x0001
156 #define PROCESS_CREATE_THREAD 0x0002
157 #define PROCESS_SET_SESSIONID 0x0004
158 #define PROCESS_VM_OPERATION 0x0008
159 #define PROCESS_VM_READ 0x0010
160 #define PROCESS_VM_WRITE 0x0020
161 #define PROCESS_DUP_HANDLE 0x0040
162 #define PROCESS_CREATE_PROCESS 0x0080
163 #define PROCESS_SET_QUOTA 0x0100
164 #define PROCESS_SET_INFORMATION 0x0200
165 #define PROCESS_QUERY_INFORMATION 0x0400
166 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff)
168 extern gboolean ShellExecuteEx (WapiShellExecuteInfo *sei);
169 extern gboolean CreateProcess (const gunichar2 *appname,
170 const gunichar2 *cmdline,
171 WapiSecurityAttributes *process_attrs,
172 WapiSecurityAttributes *thread_attrs,
173 gboolean inherit_handles, guint32 create_flags,
174 gpointer environ, const gunichar2 *cwd,
175 WapiStartupInfo *startup,
176 WapiProcessInformation *process_info);
177 extern gboolean CreateProcessWithLogonW (const gunichar2 *username,
178 const gunichar2 *domain,
179 const gunichar2 *password,
180 const guint32 logonFlags,
181 const gunichar2 *appname,
182 const gunichar2 *cmdline,
183 guint32 create_flags,
185 const gunichar2 *cwd,
186 WapiStartupInfo *startup,
187 WapiProcessInformation *process_info);
188 #define LOGON_WITH_PROFILE 0x00000001
189 #define LOGON_NETCREDENTIALS_ONLY 0x00000002
191 extern gpointer GetCurrentProcess (void);
192 extern guint32 GetProcessId (gpointer handle);
193 extern gboolean CloseProcess (gpointer handle);
194 extern gpointer OpenProcess (guint32 access, gboolean inherit, guint32 pid);
195 extern gboolean GetExitCodeProcess (gpointer process, guint32 *code);
196 extern gboolean GetProcessTimes (gpointer process, WapiFileTime *create_time,
197 WapiFileTime *exit_time,
198 WapiFileTime *kernel_time,
199 WapiFileTime *user_time);
200 extern gboolean EnumProcessModules (gpointer process, gpointer *modules,
201 guint32 size, guint32 *needed);
202 extern guint32 GetModuleBaseName (gpointer process, gpointer module,
203 gunichar2 *basename, guint32 size);
204 extern guint32 GetModuleFileNameEx (gpointer process, gpointer module,
205 gunichar2 *filename, guint32 size);
206 extern gboolean GetModuleInformation (gpointer process, gpointer module,
207 WapiModuleInfo *modinfo, guint32 size);
208 extern gboolean GetProcessWorkingSetSize (gpointer process, size_t *min,
210 extern gboolean SetProcessWorkingSetSize (gpointer process, size_t min,
213 extern gboolean TerminateProcess (gpointer process, gint32 exitCode);
215 extern guint32 GetPriorityClass (gpointer process);
216 extern gboolean SetPriorityClass (gpointer process, guint32 priority_class);
218 gchar* wapi_process_get_path (pid_t pid);
220 void wapi_process_set_cli_launcher (char *path);
224 #endif /* _WAPI_PROCESSES_H_ */