Fixed some bugs in MCI string parsing.
[wine] / include / msvcrt / process.h
1 /*
2  * Process definitions
3  *
4  * Derived from the mingw header written by Colin Peters.
5  * Modified for Wine use by Jon Griffiths and Francois Gouget.
6  * This file is in the public domain.
7  */
8 #ifndef __WINE_PROCESS_H
9 #define __WINE_PROCESS_H
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
12 #endif
13
14 #ifndef _WCHAR_T_DEFINED
15 #define _WCHAR_T_DEFINED
16 #ifndef __cplusplus
17 typedef unsigned short wchar_t;
18 #endif
19 #endif
20
21 /* Process creation flags */
22 #define _P_WAIT    0
23 #define _P_NOWAIT  1
24 #define _P_OVERLAY 2
25 #define _P_NOWAITO 3
26 #define _P_DETACH  4
27
28 #define _WAIT_CHILD      0
29 #define _WAIT_GRANDCHILD 1
30
31 #ifndef __stdcall
32 # ifdef __i386__
33 #  ifdef __GNUC__
34 #   define __stdcall __attribute__((__stdcall__))
35 #  elif defined(_MSC_VER)
36     /* Nothing needs to be done. __stdcall already exists */
37 #  else
38 #   error You need to define __stdcall for your compiler
39 #  endif
40 # else  /* __i386__ */
41 #  define __stdcall
42 # endif  /* __i386__ */
43 #endif /* __stdcall */
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49 typedef void (*_beginthread_start_routine_t)(void *);
50 typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
51
52 uintptr_t _beginthread(_beginthread_start_routine_t,unsigned int,void*);
53 uintptr_t _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*);
54 intptr_t    _cwait(int*,intptr_t,int);
55 void        _endthread(void);
56 void        _endthreadex(unsigned int);
57 intptr_t    _execl(const char*,const char*,...);
58 intptr_t    _execle(const char*,const char*,...);
59 intptr_t    _execlp(const char*,const char*,...);
60 intptr_t    _execlpe(const char*,const char*,...);
61 intptr_t    _execv(const char*,char* const *);
62 intptr_t    _execve(const char*,char* const *,const char* const *);
63 intptr_t    _execvp(const char*,char* const *);
64 intptr_t    _execvpe(const char*,char* const *,const char* const *);
65 int         _getpid(void);
66 intptr_t    _spawnl(int,const char*,const char*,...);
67 intptr_t    _spawnle(int,const char*,const char*,...);
68 intptr_t    _spawnlp(int,const char*,const char*,...);
69 intptr_t    _spawnlpe(int,const char*,const char*,...);
70 intptr_t    _spawnv(int,const char*,const char* const *);
71 intptr_t    _spawnve(int,const char*,const char* const *,const char* const *);
72 intptr_t    _spawnvp(int,const char*,const char* const *);
73 intptr_t    _spawnvpe(int,const char*,const char* const *,const char* const *);
74
75 void        _c_exit(void);
76 void        _cexit(void);
77 void        _exit(int);
78 void        abort(void);
79 void        exit(int);
80 int         system(const char*);
81
82 #ifndef _WPROCESS_DEFINED
83 #define _WPROCESS_DEFINED
84 intptr_t    _wexecl(const wchar_t*,const wchar_t*,...);
85 intptr_t    _wexecle(const wchar_t*,const wchar_t*,...);
86 intptr_t    _wexeclp(const wchar_t*,const wchar_t*,...);
87 intptr_t    _wexeclpe(const wchar_t*,const wchar_t*,...);
88 intptr_t    _wexecv(const wchar_t*,const wchar_t* const *);
89 intptr_t    _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
90 intptr_t    _wexecvp(const wchar_t*,const wchar_t* const *);
91 intptr_t    _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
92 intptr_t    _wspawnl(int,const wchar_t*,const wchar_t*,...);
93 intptr_t    _wspawnle(int,const wchar_t*,const wchar_t*,...);
94 intptr_t    _wspawnlp(int,const wchar_t*,const wchar_t*,...);
95 intptr_t    _wspawnlpe(int,const wchar_t*,const wchar_t*,...);
96 intptr_t    _wspawnv(int,const wchar_t*,const wchar_t* const *);
97 intptr_t    _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
98 intptr_t    _wspawnvp(int,const wchar_t*,const wchar_t* const *);
99 intptr_t    _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
100 int         _wsystem(const wchar_t*);
101 #endif /* _WPROCESS_DEFINED */
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107
108 #define P_WAIT          _P_WAIT
109 #define P_NOWAIT        _P_NOWAIT
110 #define P_OVERLAY       _P_OVERLAY
111 #define P_NOWAITO       _P_NOWAITO
112 #define P_DETACH        _P_DETACH
113
114 #define WAIT_CHILD      _WAIT_CHILD
115 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
116
117 static inline intptr_t cwait(int *status, intptr_t pid, int action) { return _cwait(status, pid, action); }
118 static inline int getpid(void) { return _getpid(); }
119 static inline intptr_t execv(const char* name, char* const* argv) { return _execv(name, argv); }
120 static inline intptr_t execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); }
121 static inline intptr_t execvp(const char* name, char* const* argv) { return _execvp(name, argv); }
122 static inline intptr_t execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); }
123 static inline intptr_t spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); }
124 static inline intptr_t spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); }
125 static inline intptr_t spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); }
126 static inline intptr_t spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); }
127
128 #if defined(__GNUC__) && (__GNUC__ < 4)
129 extern intptr_t execl(const char*,const char*,...) __attribute__((alias("_execl")));
130 extern intptr_t execle(const char*,const char*,...) __attribute__((alias("_execle")));
131 extern intptr_t execlp(const char*,const char*,...) __attribute__((alias("_execlp")));
132 extern intptr_t execlpe(const char*,const char*,...) __attribute__((alias("_execlpe")));
133 extern intptr_t spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl")));
134 extern intptr_t spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle")));
135 extern intptr_t spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp")));
136 extern intptr_t spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe")));
137 #else
138 #define execl    _execl
139 #define execle   _execle
140 #define execlp   _execlp
141 #define execlpe  _execlpe
142 #define spawnl   _spawnl
143 #define spawnle  _spawnle
144 #define spawnlp  _spawnlp
145 #define spawnlpe _spawnlpe
146 #endif  /* __GNUC__ */
147
148 #endif /* __WINE_PROCESS_H */