2007-03-22 Chris Toshok <toshok@ximian.com>
[mono-project/dkf.git] / mono / io-layer / processes.h
blobbd636e878ffdbee67393d0d048b5aaf2ea6ee44b
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 #include <glib.h>
15 #include <mono/io-layer/handles.h>
16 #include <mono/io-layer/access.h>
18 G_BEGIN_DECLS
20 typedef enum {
21 STARTF_USESHOWWINDOW=0x001,
22 STARTF_USESIZE=0x002,
23 STARTF_USEPOSITION=0x004,
24 STARTF_USECOUNTCHARS=0x008,
25 STARTF_USEFILLATTRIBUTE=0x010,
26 STARTF_RUNFULLSCREEN=0x020,
27 STARTF_FORCEONFEEDBACK=0x040,
28 STARTF_FORCEOFFFEEDBACK=0x080,
29 STARTF_USESTDHANDLES=0x100
30 } WapiStartupFlags;
33 typedef struct _WapiStartupInfo WapiStartupInfo;
35 struct _WapiStartupInfo
37 guint32 cb;
38 guchar *lpReserved;
39 guchar *lpDesktop;
40 guchar *lpTitle;
41 guint32 dwX;
42 guint32 dwY;
43 guint32 dwXSize;
44 guint32 dwYSize;
45 guint32 dwXCountChars;
46 guint32 dwYCountChars;
47 guint32 dwFillAttribute;
48 WapiStartupFlags dwFlags;
49 guint16 wShowWindow;
50 guint16 cbReserved2;
51 guint8 *lpReserved2;
52 gpointer hStdInput;
53 gpointer hStdOutput;
54 gpointer hStdError;
57 typedef struct _WapiProcessInformation WapiProcessInformation;
59 struct _WapiProcessInformation
61 gpointer hProcess;
62 gpointer hThread;
63 guint32 dwProcessId;
64 guint32 dwThreadId;
67 typedef enum {
68 SEE_MASK_CLASSNAME = 0x01,
69 SEE_MASK_CLASSKEY = 0x03,
70 SEE_MASK_IDLIST = 0x04,
71 SEE_MASK_INVOKEIDLIST = 0x0c,
72 SEE_MASK_ICON = 0x10,
73 SEE_MASK_HOTKEY = 0x20,
74 SEE_MASK_NOCLOSEPROCESS = 0x40,
75 SEE_MASK_CONNECTNETDRV = 0x80,
76 SEE_MASK_FLAG_DDEWAIT = 0x100,
77 SEE_MASK_DOENVSUBST = 0x200,
78 SEE_MASK_FLAG_NO_UI = 0x400,
79 SEE_MASK_NO_CONSOLE = 0x8000,
80 SEE_MASK_UNICODE = 0x10000,
81 SEE_MASK_HMONITOR = 0x200000,
82 /*SEE_MASK_FLAG_LOG_USAGE,*/
83 /*SEE_MASK_NOZONECHECKS,*/
84 } WapiShellExecuteInfoFlags;
86 typedef enum {
87 SW_HIDE = 0,
88 SW_SHOWNORMAL = 1,
89 SW_SHOWMINIMIZED = 2,
90 SW_MAXIMIZE = 3,
91 SW_SHOWMAXIMIZED = 3,
92 SW_SHOWNOACTIVATE = 4,
93 SW_SHOW = 5,
94 SW_MINIMIZE = 6,
95 SW_SHOWMINNOACTIVE = 7,
96 SW_SHOWNA = 8,
97 SW_RESTORE = 9,
98 SW_SHOWDEFAULT = 10,
99 } WapiShellExecuteShowFlags;
101 typedef struct _WapiShellExecuteInfo WapiShellExecuteInfo;
103 struct _WapiShellExecuteInfo
105 guint32 cbSize;
106 WapiShellExecuteInfoFlags fMask;
107 gpointer hwnd;
108 const gunichar2 *lpVerb;
109 const gunichar2 *lpFile;
110 const gunichar2 *lpParameters;
111 const gunichar2 *lpDirectory;
112 WapiShellExecuteShowFlags nShow;
113 gpointer hInstApp;
114 gpointer lpIDList;
115 const gunichar2 *lpClass;
116 gpointer hkeyClass;
117 guint32 dwHotKey;
118 union
120 gpointer hIcon;
121 gpointer hMonitor;
122 } u;
123 gpointer hProcess;
127 #define DEBUG_PROCESS 0x00000001
128 #define DEBUG_ONLY_THIS_PROCESS 0x00000002
129 #define CREATE_SUSPENDED 0x00000004
130 #define DETACHED_PROCESS 0x00000008
131 #define CREATE_NEW_CONSOLE 0x00000010
132 #define NORMAL_PRIORITY_CLASS 0x00000020
133 #define IDLE_PRIORITY_CLASS 0x00000040
134 #define HIGH_PRIORITY_CLASS 0x00000080
135 #define REALTIME_PRIORITY_CLASS 0x00000100
136 #define CREATE_NEW_PROCESS_GROUP 0x00000200
137 #define CREATE_UNICODE_ENVIRONMENT 0x00000400
138 #define CREATE_SEPARATE_WOW_VDM 0x00000800
139 #define CREATE_SHARED_WOW_VDM 0x00001000
140 #define CREATE_FORCEDOS 0x00002000
141 #define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
142 #define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
143 #define CREATE_BREAKAWAY_FROM_JOB 0x01000000
144 #define CREATE_WITH_USERPROFILE 0x02000000
145 #define CREATE_DEFAULT_ERROR_MODE 0x04000000
146 #define CREATE_NO_WINDOW 0x08000000
148 #ifdef NEW_STUFF
149 #define CREATE_PRESERVE_CODE_AUTHZ_LEVEL find out the value for this one...
150 #endif
152 #define PROCESS_TERMINATE 0x0001
153 #define PROCESS_CREATE_THREAD 0x0002
154 #define PROCESS_SET_SESSIONID 0x0004
155 #define PROCESS_VM_OPERATION 0x0008
156 #define PROCESS_VM_READ 0x0010
157 #define PROCESS_VM_WRITE 0x0020
158 #define PROCESS_DUP_HANDLE 0x0040
159 #define PROCESS_CREATE_PROCESS 0x0080
160 #define PROCESS_SET_QUOTA 0x0100
161 #define PROCESS_SET_INFORMATION 0x0200
162 #define PROCESS_QUERY_INFORMATION 0x0400
163 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff)
165 extern gboolean ShellExecuteEx (WapiShellExecuteInfo *sei);
166 extern gboolean CreateProcess (const gunichar2 *appname,
167 const gunichar2 *cmdline,
168 WapiSecurityAttributes *process_attrs,
169 WapiSecurityAttributes *thread_attrs,
170 gboolean inherit_handles, guint32 create_flags,
171 gpointer environ, const gunichar2 *cwd,
172 WapiStartupInfo *startup,
173 WapiProcessInformation *process_info);
174 extern gpointer GetCurrentProcess (void);
175 extern guint32 GetProcessId (gpointer handle);
176 extern guint32 GetCurrentProcessId (void);
177 extern gboolean EnumProcesses (guint32 *pids, guint32 len, guint32 *needed);
178 extern gpointer OpenProcess (guint32 access, gboolean inherit, guint32 pid);
179 extern gboolean GetExitCodeProcess (gpointer process, guint32 *code);
180 extern gboolean GetProcessTimes (gpointer process, WapiFileTime *create_time,
181 WapiFileTime *exit_time,
182 WapiFileTime *kernel_time,
183 WapiFileTime *user_time);
184 extern gboolean EnumProcessModules (gpointer process, gpointer *modules,
185 guint32 size, guint32 *needed);
186 extern guint32 GetModuleBaseName (gpointer process, gpointer module,
187 gunichar2 *basename, guint32 size);
188 extern gboolean GetProcessWorkingSetSize (gpointer process, size_t *min,
189 size_t *max);
190 extern gboolean SetProcessWorkingSetSize (gpointer process, size_t min,
191 size_t max);
193 extern gboolean TerminateProcess (gpointer process, gint32 exitCode);
195 G_END_DECLS
197 #endif /* _WAPI_PROCESSES_H_ */