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/handles.h>
19 #include <mono/io-layer/access.h>
20 #include <mono/io-layer/versioninfo.h>
25 STARTF_USESHOWWINDOW
=0x001,
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
37 typedef struct _WapiStartupInfo WapiStartupInfo
;
39 struct _WapiStartupInfo
49 guint32 dwXCountChars
;
50 guint32 dwYCountChars
;
51 guint32 dwFillAttribute
;
52 WapiStartupFlags dwFlags
;
61 typedef struct _WapiProcessInformation WapiProcessInformation
;
63 struct _WapiProcessInformation
72 SEE_MASK_CLASSNAME
= 0x01,
73 SEE_MASK_CLASSKEY
= 0x03,
74 SEE_MASK_IDLIST
= 0x04,
75 SEE_MASK_INVOKEIDLIST
= 0x0c,
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
;
96 SW_SHOWNOACTIVATE
= 4,
99 SW_SHOWMINNOACTIVE
= 7,
103 } WapiShellExecuteShowFlags
;
105 typedef struct _WapiShellExecuteInfo WapiShellExecuteInfo
;
107 struct _WapiShellExecuteInfo
110 WapiShellExecuteInfoFlags fMask
;
112 const gunichar2
*lpVerb
;
113 const gunichar2
*lpFile
;
114 const gunichar2
*lpParameters
;
115 const gunichar2
*lpDirectory
;
116 WapiShellExecuteShowFlags nShow
;
119 const gunichar2
*lpClass
;
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
153 #define CREATE_PRESERVE_CODE_AUTHZ_LEVEL find out the value for this one...
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
,
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
,
211 extern gboolean
SetProcessWorkingSetSize (gpointer process
, size_t min
,
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
);
225 #endif /* _WAPI_PROCESSES_H_ */