ReactOS 0.4.16-dev-2104-gb84fa49
process.c
Go to the documentation of this file.
1/*
2 * msvcrt.dll spawn/exec functions
3 *
4 * Copyright 1996,1998 Marcus Meissner
5 * Copyright 1996 Jukka Iivonen
6 * Copyright 1997,2000 Uwe Bonnes
7 * Copyright 2000 Jon Griffiths
8 * Copyright 2007 Hans Leidekker
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 *
24 * FIXME:
25 * -File handles need some special handling. Sometimes children get
26 * open file handles, sometimes not. The docs are confusing
27 * -No check for maximum path/argument/environment size is done
28 */
29
30#include <fcntl.h>
31#include <io.h>
32#include <process.h>
33#include <stdarg.h>
34
35#include "msvcrt.h"
36#include <winnls.h>
37#include "mtdll.h"
38#include "wine/debug.h"
39
41
42static void msvcrt_search_executable(const wchar_t *name, wchar_t *fullname, int use_path)
43{
44 static const wchar_t suffix[][5] =
45 {L".com", L".exe", L".bat", L".cmd"};
46
47 wchar_t buffer[MAX_PATH];
48 const wchar_t *env, *p, *end;
49 unsigned int i, name_len, path_len;
50 int extension = 1;
51
52 *fullname = '\0';
53#ifndef __REACTOS__
55#endif
56
57 end = name + MAX_PATH - 1;
58 for(p = name; p < end; p++)
59 if(!*p) break;
60 name_len = p - name;
61
62 /* FIXME extra-long names are silently truncated */
63 memcpy(buffer, name, name_len * sizeof(wchar_t));
64 buffer[name_len] = '\0';
65
66 /* try current dir first */
68 {
70 return;
71 }
72
73 for (p--; p >= name; p--)
74 if (*p == '\\' || *p == '/' || *p == ':' || *p == '.') break;
75
76 /* if there's no extension, try some well-known extensions */
77 if ((p < name || *p != '.') && name_len <= MAX_PATH - 5)
78 {
79 for (i = 0; i < 4; i++)
80 {
81 memcpy(buffer + name_len, suffix[i], 5 * sizeof(wchar_t));
83 {
85 return;
86 }
87 }
88 extension = 0;
89 }
90
91 if (!use_path || !(env = _wgetenv(L"PATH"))) return;
92
93 /* now try search path */
94 do
95 {
96 p = env;
97 while (*p && *p != ';') p++;
98 if (p == env) return;
99
100 path_len = p - env;
101 if (path_len + name_len <= MAX_PATH - 2)
102 {
103 memcpy(buffer, env, path_len * sizeof(wchar_t));
104 if (buffer[path_len] != '/' && buffer[path_len] != '\\')
105 {
106 buffer[path_len++] = '\\';
107 buffer[path_len] = '\0';
108 }
109 else buffer[path_len] = '\0';
110
113 {
115 return;
116 }
117 }
118 /* again, if there's no extension, try some well-known extensions */
119 if (!extension && path_len + name_len <= MAX_PATH - 5)
120 {
121 for (i = 0; i < 4; i++)
122 {
123 memcpy(buffer + path_len + name_len, suffix[i], 5 * sizeof(wchar_t));
125 {
127 return;
128 }
129 }
130 }
131 env = *p ? p + 1 : p;
132 } while(1);
133}
134
135static intptr_t msvcrt_spawn(int flags, const wchar_t* exe, wchar_t* cmdline,
136 wchar_t* env, int use_path)
137{
138 STARTUPINFOW si;
140 wchar_t fullname[MAX_PATH];
142
143 TRACE("%x %s %s %s %d\n", flags, debugstr_w(exe), debugstr_w(cmdline), debugstr_w(env), use_path);
144
145 if ((unsigned)flags > _P_DETACH)
146 {
147 *_errno() = EINVAL;
148 return -1;
149 }
150
151 msvcrt_search_executable(exe, fullname, use_path);
152
153 memset(&si, 0, sizeof(si));
154 si.cb = sizeof(si);
158 create_flags, env, NULL, &si, &pi))
159 {
161 free(si.lpReserved2);
162 return -1;
163 }
164
165 free(si.lpReserved2);
166 switch(flags)
167 {
168 case _P_WAIT:
170 GetExitCodeProcess(pi.hProcess,&pi.dwProcessId);
171 CloseHandle(pi.hProcess);
172 CloseHandle(pi.hThread);
173 return pi.dwProcessId;
174 case _P_DETACH:
175 CloseHandle(pi.hProcess);
176 pi.hProcess = 0;
177 /* fall through */
178 case _P_NOWAIT:
179 case _P_NOWAITO:
180 CloseHandle(pi.hThread);
181 return (intptr_t)pi.hProcess;
182 case _P_OVERLAY:
183 _exit(0);
184 }
185 return -1; /* can't reach here */
186}
187
188/* INTERNAL: Convert wide argv list to a single 'delim'-separated wide string, with an
189 * extra '\0' to terminate it.
190 */
191static wchar_t* msvcrt_argvtos(const wchar_t* const* arg, wchar_t delim)
192{
193 const wchar_t* const* a;
194 int size;
195 wchar_t* p;
196 wchar_t* ret;
197
198 if (!arg)
199 {
200 /* Return NULL for an empty environment list */
201 return NULL;
202 }
203
204 /* get length */
205 a = arg;
206 size = 0;
207 while (*a)
208 {
209 size += wcslen(*a) + 1;
210 a++;
211 }
212
213 ret = malloc((size + 1) * sizeof(wchar_t));
214 if (!ret)
215 return NULL;
216
217 /* fill string */
218 a = arg;
219 p = ret;
220 while (*a)
221 {
222 int len = wcslen(*a);
223 memcpy(p,*a,len * sizeof(wchar_t));
224 p += len;
225 *p++ = delim;
226 a++;
227 }
228 if (delim && p > ret) p[-1] = 0;
229 else *p = 0;
230 return ret;
231}
232
233/* INTERNAL: Convert ansi argv list to a single wide string, use ' ' or '\0'
234 * as separator depending on env argument.
235 */
236static wchar_t *msvcrt_argvtos_aw(const char * const *arg, BOOL env)
237{
238 UINT cp = env ? CP_ACP : get_aw_cp();
239 const char * const *a;
240 unsigned int len;
241 wchar_t *p, *ret;
242
243 if (!arg)
244 {
245 /* Return NULL for an empty environment list */
246 return NULL;
247 }
248
249 /* get length */
250 a = arg;
251 len = 0;
252 while (*a)
253 {
254 len += MultiByteToWideChar(cp, 0, *a, -1, NULL, 0);
255 a++;
256 }
257
258 ret = malloc((len + 1) * sizeof(wchar_t));
259 if (!ret)
260 return NULL;
261
262 /* fill string */
263 a = arg;
264 p = ret;
265 while (*a)
266 {
267 p += MultiByteToWideChar(cp, 0, *a, strlen(*a), p, len - (p - ret));
268 *p++ = env ? 0 : ' ';
269 a++;
270 }
271 if (!env && p > ret) p[-1] = 0;
272 else *p = 0;
273 return ret;
274}
275
276/* INTERNAL: Convert wide va_list to a single 'delim'-separated wide string, with an
277 * extra '\0' to terminate it.
278 */
279static wchar_t *msvcrt_valisttos(const wchar_t *arg0, va_list alist, wchar_t delim)
280{
281 unsigned int size = 0, pos = 0;
282 const wchar_t *arg;
283 wchar_t *new, *ret = NULL;
284
285 for (arg = arg0; arg; arg = va_arg( alist, wchar_t * ))
286 {
287 unsigned int len = wcslen( arg ) + 1;
288 if (pos + len >= size)
289 {
290 size = max( 256, size * 2 );
291 size = max( size, pos + len + 1 );
292 if (!(new = realloc( ret, size * sizeof(wchar_t) )))
293 {
294 free( ret );
295 return NULL;
296 }
297 ret = new;
298 }
299 wcscpy( ret + pos, arg );
300 pos += len;
301 ret[pos - 1] = delim;
302 }
303 if (pos)
304 {
305 if (delim) ret[pos - 1] = 0;
306 else ret[pos] = 0;
307 }
308 return ret;
309}
310
311/* INTERNAL: Convert ansi va_list to a single 'delim'-separated wide string, with an
312 * extra '\0' to terminate it.
313 */
314static wchar_t *msvcrt_valisttos_aw(const char *arg0, va_list alist, wchar_t delim)
315{
316 unsigned int size = 0, pos = 0;
317 const char *arg;
318 wchar_t *new, *ret = NULL;
319
320 for (arg = arg0; arg; arg = va_arg( alist, char * ))
321 {
322 unsigned int len = convert_acp_utf8_to_wcs( arg, NULL, 0 );
323 if (pos + len >= size)
324 {
325 size = max( 256, size * 2 );
326 size = max( size, pos + len + 1 );
327 if (!(new = realloc( ret, size * sizeof(wchar_t) )))
328 {
329 free( ret );
330 return NULL;
331 }
332 ret = new;
333 }
335 ret[pos - 1] = delim;
336 }
337 if (pos)
338 {
339 if (delim) ret[pos - 1] = 0;
340 else ret[pos] = 0;
341 }
342 return ret;
343}
344
345/* INTERNAL: retrieve COMSPEC environment variable */
346static wchar_t *msvcrt_get_comspec(void)
347{
348 wchar_t *ret;
349 unsigned int len;
350
351 if (!(len = GetEnvironmentVariableW(L"COMSPEC", NULL, 0))) len = 4;
352 if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(wchar_t))))
353 {
354 if (!GetEnvironmentVariableW(L"COMSPEC", ret, len)) wcscpy(ret, L"cmd");
355 }
356 return ret;
357}
358
359/*********************************************************************
360 * _cwait (MSVCRT.@)
361 */
363{
364 HANDLE hPid = (HANDLE)pid;
365 int doserrno;
366
367 if (!WaitForSingleObject(hPid, INFINITE))
368 {
369 if (status)
370 {
371 DWORD stat;
372 GetExitCodeProcess(hPid, &stat);
373 *status = (int)stat;
374 }
375 return pid;
376 }
377 doserrno = GetLastError();
378
379 if (doserrno == ERROR_INVALID_HANDLE)
380 {
381 *_errno() = ECHILD;
382 *__doserrno() = doserrno;
383 }
384 else
385 msvcrt_set_errno(doserrno);
386
387 return status ? *status = -1 : -1;
388}
389
390/*********************************************************************
391 * _wexecl (MSVCRT.@)
392 *
393 * Unicode version of _execl
394 */
395intptr_t WINAPIV _wexecl(const wchar_t* name, const wchar_t* arg0, ...)
396{
397 va_list ap;
398 wchar_t *args;
400
401 va_start(ap, arg0);
402 args = msvcrt_valisttos(arg0, ap, ' ');
403 va_end(ap);
404
406
407 free(args);
408 return ret;
409}
410
411/*********************************************************************
412 * _execl (MSVCRT.@)
413 *
414 * Like on Windows, this function does not handle arguments with spaces
415 * or double-quotes.
416 */
417intptr_t WINAPIV _execl(const char* name, const char* arg0, ...)
418{
419 va_list ap;
420 wchar_t *nameW, *args;
422
423 if (!(nameW = wstrdupa_utf8(name))) return -1;
424
425 va_start(ap, arg0);
426 args = msvcrt_valisttos_aw(arg0, ap, ' ');
427 va_end(ap);
428
430
431 free(nameW);
432 free(args);
433 return ret;
434}
435
436/*********************************************************************
437 * _wexecle (MSVCRT.@)
438 *
439 * Unicode version of _execle
440 */
441intptr_t WINAPIV _wexecle(const wchar_t* name, const wchar_t* arg0, ...)
442{
443 va_list ap;
444 wchar_t *args, *envs = NULL;
445 const wchar_t * const *envp;
447
448 va_start(ap, arg0);
449 args = msvcrt_valisttos(arg0, ap, ' ');
450 va_end(ap);
451
452 va_start(ap, arg0);
453 while (va_arg( ap, wchar_t * ) != NULL) /*nothing*/;
454 envp = va_arg( ap, const wchar_t * const * );
455 if (envp) envs = msvcrt_argvtos(envp, 0);
456 va_end(ap);
457
458 ret = msvcrt_spawn(_P_OVERLAY, name, args, envs, 0);
459
460 free(args);
461 free(envs);
462 return ret;
463}
464
465/*********************************************************************
466 * _execle (MSVCRT.@)
467 */
468intptr_t WINAPIV _execle(const char* name, const char* arg0, ...)
469{
470 va_list ap;
471 wchar_t *nameW, *args, *envs = NULL;
472 const char * const *envp;
474
475 if (!(nameW = wstrdupa_utf8(name))) return -1;
476
477 va_start(ap, arg0);
478 args = msvcrt_valisttos_aw(arg0, ap, ' ');
479 va_end(ap);
480
481 va_start(ap, arg0);
482 while (va_arg( ap, char * ) != NULL) /*nothing*/;
483 envp = va_arg( ap, const char * const * );
484 if (envp) envs = msvcrt_argvtos_aw(envp, TRUE);
485 va_end(ap);
486
487 ret = msvcrt_spawn(_P_OVERLAY, nameW, args, envs, 0);
488
489 free(nameW);
490 free(args);
491 free(envs);
492 return ret;
493}
494
495/*********************************************************************
496 * _wexeclp (MSVCRT.@)
497 *
498 * Unicode version of _execlp
499 */
500intptr_t WINAPIV _wexeclp(const wchar_t* name, const wchar_t* arg0, ...)
501{
502 va_list ap;
503 wchar_t *args;
505
506 va_start(ap, arg0);
507 args = msvcrt_valisttos(arg0, ap, ' ');
508 va_end(ap);
509
511
512 free(args);
513 return ret;
514}
515
516/*********************************************************************
517 * _execlp (MSVCRT.@)
518 *
519 * Like on Windows, this function does not handle arguments with spaces
520 * or double-quotes.
521 */
522intptr_t WINAPIV _execlp(const char* name, const char* arg0, ...)
523{
524 va_list ap;
525 wchar_t *nameW, *args;
527
528 if (!(nameW = wstrdupa_utf8(name))) return -1;
529
530 va_start(ap, arg0);
531 args = msvcrt_valisttos_aw(arg0, ap, ' ');
532 va_end(ap);
533
535
536 free(nameW);
537 free(args);
538 return ret;
539}
540
541/*********************************************************************
542 * _wexeclpe (MSVCRT.@)
543 *
544 * Unicode version of _execlpe
545 */
546intptr_t WINAPIV _wexeclpe(const wchar_t* name, const wchar_t* arg0, ...)
547{
548 va_list ap;
549 wchar_t *args, *envs = NULL;
550 const wchar_t * const *envp;
552
553 va_start(ap, arg0);
554 args = msvcrt_valisttos(arg0, ap, ' ');
555 va_end(ap);
556
557 va_start(ap, arg0);
558 while (va_arg( ap, wchar_t * ) != NULL) /*nothing*/;
559 envp = va_arg( ap, const wchar_t * const * );
560 if (envp) envs = msvcrt_argvtos(envp, 0);
561 va_end(ap);
562
563 ret = msvcrt_spawn(_P_OVERLAY, name, args, envs, 1);
564
565 free(args);
566 free(envs);
567 return ret;
568}
569
570/*********************************************************************
571 * _execlpe (MSVCRT.@)
572 */
573intptr_t WINAPIV _execlpe(const char* name, const char* arg0, ...)
574{
575 va_list ap;
576 wchar_t *nameW, *args, *envs = NULL;
577 const char * const *envp;
579
580 if (!(nameW = wstrdupa_utf8(name))) return -1;
581
582 va_start(ap, arg0);
583 args = msvcrt_valisttos_aw(arg0, ap, ' ');
584 va_end(ap);
585
586 va_start(ap, arg0);
587 while (va_arg( ap, char * ) != NULL) /*nothing*/;
588 envp = va_arg( ap, const char * const * );
589 if (envp) envs = msvcrt_argvtos_aw(envp, TRUE);
590 va_end(ap);
591
592 ret = msvcrt_spawn(_P_OVERLAY, nameW, args, envs, 1);
593
594 free(nameW);
595 free(args);
596 free(envs);
597 return ret;
598}
599
600/*********************************************************************
601 * _wexecv (MSVCRT.@)
602 *
603 * Unicode version of _execv
604 */
605intptr_t CDECL _wexecv(const wchar_t* name, const wchar_t* const* argv)
606{
607 return _wspawnve(_P_OVERLAY, name, argv, NULL);
608}
609
610/*********************************************************************
611 * _execv (MSVCRT.@)
612 *
613 * Like on Windows, this function does not handle arguments with spaces
614 * or double-quotes.
615 */
616intptr_t CDECL _execv(const char* name, const char* const* argv)
617{
618 return _spawnve(_P_OVERLAY, name, argv, NULL);
619}
620
621/*********************************************************************
622 * _wexecve (MSVCRT.@)
623 *
624 * Unicode version of _execve
625 */
626intptr_t CDECL _wexecve(const wchar_t* name, const wchar_t* const* argv, const wchar_t* const* envv)
627{
628 return _wspawnve(_P_OVERLAY, name, argv, envv);
629}
630
631/*********************************************************************
632 * _execve (MSVCRT.@)
633 *
634 * Like on Windows, this function does not handle arguments with spaces
635 * or double-quotes.
636 */
637intptr_t CDECL _execve(const char* name, const char* const* argv, const char* const* envv)
638{
639 return _spawnve(_P_OVERLAY, name, argv, envv);
640}
641
642/*********************************************************************
643 * _wexecvpe (MSVCRT.@)
644 *
645 * Unicode version of _execvpe
646 */
647intptr_t CDECL _wexecvpe(const wchar_t* name, const wchar_t* const* argv, const wchar_t* const* envv)
648{
649 return _wspawnvpe(_P_OVERLAY, name, argv, envv);
650}
651
652/*********************************************************************
653 * _execvpe (MSVCRT.@)
654 *
655 * Like on Windows, this function does not handle arguments with spaces
656 * or double-quotes.
657 */
658intptr_t CDECL _execvpe(const char* name, const char* const* argv, const char* const* envv)
659{
660 return _spawnvpe(_P_OVERLAY, name, argv, envv);
661}
662
663/*********************************************************************
664 * _wexecvp (MSVCRT.@)
665 *
666 * Unicode version of _execvp
667 */
668intptr_t CDECL _wexecvp(const wchar_t* name, const wchar_t* const* argv)
669{
670 return _wexecvpe(name, argv, NULL);
671}
672
673/*********************************************************************
674 * _execvp (MSVCRT.@)
675 *
676 * Like on Windows, this function does not handle arguments with spaces
677 * or double-quotes.
678 */
679intptr_t CDECL _execvp(const char* name, const char* const* argv)
680{
681 return _execvpe(name, argv, NULL);
682}
683
684/*********************************************************************
685 * _wspawnl (MSVCRT.@)
686 *
687 * Unicode version of _spawnl
688 */
689intptr_t WINAPIV _wspawnl(int flags, const wchar_t* name, const wchar_t* arg0, ...)
690{
691 va_list ap;
692 wchar_t *args;
694
695 va_start(ap, arg0);
696 args = msvcrt_valisttos(arg0, ap, ' ');
697 va_end(ap);
698
700
701 free(args);
702 return ret;
703}
704
705/*********************************************************************
706 * _spawnl (MSVCRT.@)
707 *
708 * Like on Windows, this function does not handle arguments with spaces
709 * or double-quotes.
710 */
711intptr_t WINAPIV _spawnl(int flags, const char* name, const char* arg0, ...)
712{
713 va_list ap;
714 wchar_t *nameW, *args;
716
717 if (!(nameW = wstrdupa_utf8(name))) return -1;
718
719 va_start(ap, arg0);
720 args = msvcrt_valisttos_aw(arg0, ap, ' ');
721 va_end(ap);
722
724
725 free(nameW);
726 free(args);
727 return ret;
728}
729
730/*********************************************************************
731 * _wspawnle (MSVCRT.@)
732 *
733 * Unicode version of _spawnle
734 */
735intptr_t WINAPIV _wspawnle(int flags, const wchar_t* name, const wchar_t* arg0, ...)
736{
737 va_list ap;
738 wchar_t *args, *envs = NULL;
739 const wchar_t * const *envp;
741
742 va_start(ap, arg0);
743 args = msvcrt_valisttos(arg0, ap, ' ');
744 va_end(ap);
745
746 va_start(ap, arg0);
747 while (va_arg( ap, wchar_t * ) != NULL) /*nothing*/;
748 envp = va_arg( ap, const wchar_t * const * );
749 if (envp) envs = msvcrt_argvtos(envp, 0);
750 va_end(ap);
751
752 ret = msvcrt_spawn(flags, name, args, envs, 0);
753
754 free(args);
755 free(envs);
756 return ret;
757}
758
759/*********************************************************************
760 * _spawnle (MSVCRT.@)
761 */
762intptr_t WINAPIV _spawnle(int flags, const char* name, const char* arg0, ...)
763{
764 va_list ap;
765 wchar_t *nameW, *args, *envs = NULL;
766 const char * const *envp;
768
769 if (!(nameW = wstrdupa_utf8(name))) return -1;
770
771 va_start(ap, arg0);
772 args = msvcrt_valisttos_aw(arg0, ap, ' ');
773 va_end(ap);
774
775 va_start(ap, arg0);
776 while (va_arg( ap, char * ) != NULL) /*nothing*/;
777 envp = va_arg( ap, const char * const * );
778 if (envp) envs = msvcrt_argvtos_aw(envp, TRUE);
779 va_end(ap);
780
781 ret = msvcrt_spawn(flags, nameW, args, envs, 0);
782
783 free(nameW);
784 free(args);
785 free(envs);
786 return ret;
787}
788
789/*********************************************************************
790 * _wspawnlp (MSVCRT.@)
791 *
792 * Unicode version of _spawnlp
793 */
794intptr_t WINAPIV _wspawnlp(int flags, const wchar_t* name, const wchar_t* arg0, ...)
795{
796 va_list ap;
797 wchar_t *args;
799
800 va_start(ap, arg0);
801 args = msvcrt_valisttos(arg0, ap, ' ');
802 va_end(ap);
803
805
806 free(args);
807 return ret;
808}
809
810/*********************************************************************
811 * _spawnlp (MSVCRT.@)
812 *
813 * Like on Windows, this function does not handle arguments with spaces
814 * or double-quotes.
815 */
816intptr_t WINAPIV _spawnlp(int flags, const char* name, const char* arg0, ...)
817{
818 va_list ap;
819 wchar_t *nameW, *args;
821
822 if (!(nameW = wstrdupa_utf8(name))) return -1;
823
824 va_start(ap, arg0);
825 args = msvcrt_valisttos_aw(arg0, ap, ' ');
826 va_end(ap);
827
829
830 free(nameW);
831 free(args);
832 return ret;
833}
834
835/*********************************************************************
836 * _wspawnlpe (MSVCRT.@)
837 *
838 * Unicode version of _spawnlpe
839 */
840intptr_t WINAPIV _wspawnlpe(int flags, const wchar_t* name, const wchar_t* arg0, ...)
841{
842 va_list ap;
843 wchar_t *args, *envs = NULL;
844 const wchar_t * const *envp;
846
847 va_start(ap, arg0);
848 args = msvcrt_valisttos(arg0, ap, ' ');
849 va_end(ap);
850
851 va_start(ap, arg0);
852 while (va_arg( ap, wchar_t * ) != NULL) /*nothing*/;
853 envp = va_arg( ap, const wchar_t * const * );
854 if (envp) envs = msvcrt_argvtos(envp, 0);
855 va_end(ap);
856
857 ret = msvcrt_spawn(flags, name, args, envs, 1);
858
859 free(args);
860 free(envs);
861 return ret;
862}
863
864/*********************************************************************
865 * _spawnlpe (MSVCRT.@)
866 */
867intptr_t WINAPIV _spawnlpe(int flags, const char* name, const char* arg0, ...)
868{
869 va_list ap;
870 wchar_t *nameW, *args, *envs = NULL;
871 const char * const *envp;
873
874 if (!(nameW = wstrdupa_utf8(name))) return -1;
875
876 va_start(ap, arg0);
877 args = msvcrt_valisttos_aw(arg0, ap, ' ');
878 va_end(ap);
879
880 va_start(ap, arg0);
881 while (va_arg( ap, char * ) != NULL) /*nothing*/;
882 envp = va_arg( ap, const char * const * );
883 if (envp) envs = msvcrt_argvtos_aw(envp, TRUE);
884 va_end(ap);
885
886 ret = msvcrt_spawn(flags, nameW, args, envs, 1);
887
888 free(nameW);
889 free(args);
890 free(envs);
891 return ret;
892}
893
894/*********************************************************************
895 * _spawnve (MSVCRT.@)
896 *
897 * Like on Windows, this function does not handle arguments with spaces
898 * or double-quotes.
899 */
900intptr_t CDECL _spawnve(int flags, const char* name, const char* const* argv,
901 const char* const* envv)
902{
903 wchar_t *nameW, *args, *envs;
905
906 if (!(nameW = wstrdupa_utf8(name))) return -1;
907
909 envs = msvcrt_argvtos_aw(envv, TRUE);
910
911 ret = msvcrt_spawn(flags, nameW, args, envs, 0);
912
913 free(nameW);
914 free(args);
915 free(envs);
916 return ret;
917}
918
919/*********************************************************************
920 * _wspawnve (MSVCRT.@)
921 *
922 * Unicode version of _spawnve
923 */
924intptr_t CDECL _wspawnve(int flags, const wchar_t* name, const wchar_t* const* argv,
925 const wchar_t* const* envv)
926{
927 wchar_t *args, *envs;
929
930 args = msvcrt_argvtos(argv, ' ');
931 envs = msvcrt_argvtos(envv, 0);
932
933 ret = msvcrt_spawn(flags, name, args, envs, 0);
934
935 free(args);
936 free(envs);
937 return ret;
938}
939
940/*********************************************************************
941 * _spawnv (MSVCRT.@)
942 *
943 * Like on Windows, this function does not handle arguments with spaces
944 * or double-quotes.
945 */
946intptr_t CDECL _spawnv(int flags, const char* name, const char* const* argv)
947{
948 return _spawnve(flags, name, argv, NULL);
949}
950
951/*********************************************************************
952 * _wspawnv (MSVCRT.@)
953 *
954 * Unicode version of _spawnv
955 */
956intptr_t CDECL _wspawnv(int flags, const wchar_t* name, const wchar_t* const* argv)
957{
958 return _wspawnve(flags, name, argv, NULL);
959}
960
961/*********************************************************************
962 * _spawnvpe (MSVCRT.@)
963 *
964 * Like on Windows, this function does not handle arguments with spaces
965 * or double-quotes.
966 */
967intptr_t CDECL _spawnvpe(int flags, const char* name, const char* const* argv,
968 const char* const* envv)
969{
970 wchar_t *nameW, *args, *envs;
972
973 if (!(nameW = wstrdupa_utf8(name))) return -1;
974
976 envs = msvcrt_argvtos_aw(envv, TRUE);
977
978 ret = msvcrt_spawn(flags, nameW, args, envs, 1);
979
980 free(nameW);
981 free(args);
982 free(envs);
983 return ret;
984}
985
986/*********************************************************************
987 * _wspawnvpe (MSVCRT.@)
988 *
989 * Unicode version of _spawnvpe
990 */
991intptr_t CDECL _wspawnvpe(int flags, const wchar_t* name, const wchar_t* const* argv,
992 const wchar_t* const* envv)
993{
994 wchar_t *args, *envs;
996
997 args = msvcrt_argvtos(argv, ' ');
998 envs = msvcrt_argvtos(envv, 0);
999
1000 ret = msvcrt_spawn(flags, name, args, envs, 1);
1001
1002 free(args);
1003 free(envs);
1004 return ret;
1005}
1006
1007/*********************************************************************
1008 * _spawnvp (MSVCRT.@)
1009 *
1010 * Like on Windows, this function does not handle arguments with spaces
1011 * or double-quotes.
1012 */
1013intptr_t CDECL _spawnvp(int flags, const char* name, const char* const* argv)
1014{
1015 return _spawnvpe(flags, name, argv, NULL);
1016}
1017
1018/*********************************************************************
1019 * _wspawnvp (MSVCRT.@)
1020 *
1021 * Unicode version of _spawnvp
1022 */
1023intptr_t CDECL _wspawnvp(int flags, const wchar_t* name, const wchar_t* const* argv)
1024{
1025 return _wspawnvpe(flags, name, argv, NULL);
1026}
1027
1028static struct popen_handle {
1033
1035{
1037}
1038
1039/*********************************************************************
1040 * _wpopen (MSVCRT.@)
1041 *
1042 * Unicode version of _popen
1043 */
1044FILE* CDECL _wpopen(const wchar_t* command, const wchar_t* mode)
1045{
1046 wchar_t *comspec, *fullcmd, fullname[MAX_PATH];
1047 int textmode, fds[2], fd_parent, fd_child;
1048 struct popen_handle *container;
1051 const wchar_t *p;
1052 unsigned int len;
1053 STARTUPINFOW si;
1054 FILE *ret;
1055 DWORD i;
1056 BOOL r;
1057
1058 TRACE("(command=%s, mode=%s)\n", debugstr_w(command), debugstr_w(mode));
1059
1060 if (!command || !mode)
1061 return NULL;
1062
1066 for (p = mode; *p; p++)
1067 {
1068 switch (*p)
1069 {
1070 case 'W':
1071 case 'w':
1072 read_pipe = FALSE;
1073 break;
1074 case 'B':
1075 case 'b':
1077 textmode &= ~_O_TEXT;
1078 break;
1079 case 'T':
1080 case 't':
1081 textmode |= _O_TEXT;
1082 textmode &= ~_O_BINARY;
1083 break;
1084 }
1085 }
1086 if (_pipe(fds, 0, textmode) == -1)
1087 return NULL;
1088
1089 if (read_pipe)
1090 {
1091 fd_parent = fds[0];
1092 fd_child = _dup(fds[1]);
1093 _close(fds[1]);
1094 }
1095 else
1096 {
1097 fd_parent = fds[1];
1098 fd_child = _dup(fds[0]);
1099 _close(fds[0]);
1100 }
1101 if (fd_child == -1)
1102 {
1103 _close(fd_parent);
1104 return NULL;
1105 }
1106 ret = _wfdopen(fd_parent, mode);
1107 if (!ret)
1108 {
1109 _close(fd_child);
1110 return NULL;
1111 }
1112
1114 for (i = 0; i < popen_handles_size; i++)
1115 {
1116 if (!popen_handles[i].f)
1117 break;
1118 }
1119 if (i == popen_handles_size)
1120 {
1122 container = realloc(popen_handles, i * sizeof(*container));
1123 if (!container) goto error;
1124
1127 memset(container, 0, (i - popen_handles_size) * sizeof(*container));
1129 }
1130 else container = popen_handles + i;
1131
1132 if (!(comspec = msvcrt_get_comspec())) goto error;
1133 len = wcslen(comspec) + wcslen(command) + 5;
1134
1135 if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(wchar_t))))
1136 {
1137 HeapFree(GetProcessHeap(), 0, comspec);
1138 goto error;
1139 }
1140
1141 wcscpy(fullcmd, comspec);
1142 wcscat(fullcmd, L" /c ");
1143 wcscat(fullcmd, command);
1145
1146 memset(&si, 0, sizeof(si));
1147 si.cb = sizeof(si);
1149 if (read_pipe)
1150 {
1152 si.hStdOutput = (HANDLE)_get_osfhandle(fd_child);
1153 }
1154 else
1155 {
1156 si.hStdInput = (HANDLE)_get_osfhandle(fd_child);
1158 }
1160 r = CreateProcessW(fullname, fullcmd, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
1161 HeapFree(GetProcessHeap(), 0, comspec);
1162 HeapFree(GetProcessHeap(), 0, fullcmd);
1163 if (!r)
1164 {
1166 goto error;
1167 }
1168 CloseHandle(pi.hThread);
1169 _close(fd_child);
1170 container->proc = pi.hProcess;
1171 container->f = ret;
1173 return ret;
1174
1175error:
1177 _close(fd_child);
1178 fclose(ret);
1179 return NULL;
1180}
1181
1182/*********************************************************************
1183 * _popen (MSVCRT.@)
1184 */
1185FILE* CDECL _popen(const char* command, const char* mode)
1186{
1187 FILE *ret;
1188 wchar_t *cmdW, *modeW;
1189
1190 TRACE("(command=%s, mode=%s)\n", debugstr_a(command), debugstr_a(mode));
1191
1192 if (!command || !mode)
1193 return NULL;
1194
1195 if (!(cmdW = wstrdupa_utf8(command))) return NULL;
1196 if (!(modeW = msvcrt_wstrdupa(mode)))
1197 {
1198 free(cmdW);
1199 return NULL;
1200 }
1201
1202 ret = _wpopen(cmdW, modeW);
1203
1204 free(cmdW);
1205 free(modeW);
1206 return ret;
1207}
1208
1209/*********************************************************************
1210 * _pclose (MSVCRT.@)
1211 */
1213{
1214 HANDLE h;
1215 DWORD i;
1216
1217 if (!MSVCRT_CHECK_PMT(file != NULL)) return -1;
1218
1220 for(i=0; i<popen_handles_size; i++)
1221 {
1222 if (popen_handles[i].f == file)
1223 break;
1224 }
1225 if(i == popen_handles_size)
1226 {
1228 *_errno() = EBADF;
1229 return -1;
1230 }
1231
1232 h = popen_handles[i].proc;
1233 popen_handles[i].f = NULL;
1235
1236 fclose(file);
1238 {
1240 CloseHandle(h);
1241 return -1;
1242 }
1243
1244 CloseHandle(h);
1245 return i;
1246}
1247
1248#ifndef __REACTOS__
1249/*********************************************************************
1250 * _wsystem (MSVCRT.@)
1251 *
1252 * Unicode version of system
1253 */
1254int CDECL _wsystem(const wchar_t* cmd)
1255{
1256 int res;
1257 wchar_t *comspec, *fullcmd;
1258 unsigned int len;
1259
1260 comspec = msvcrt_get_comspec();
1261
1262 if (cmd == NULL)
1263 {
1264 if (comspec == NULL)
1265 {
1266 *_errno() = ENOENT;
1267 return 0;
1268 }
1269 HeapFree(GetProcessHeap(), 0, comspec);
1270 return 1;
1271 }
1272
1273 if (comspec == NULL)
1274 return -1;
1275
1276 len = wcslen(comspec) + wcslen(cmd) + 5;
1277
1278 if (!(fullcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(wchar_t))))
1279 {
1280 HeapFree(GetProcessHeap(), 0, comspec);
1281 return -1;
1282 }
1283 wcscpy(fullcmd, comspec);
1284 wcscat(fullcmd, L" /c ");
1285 wcscat(fullcmd, cmd);
1286
1287 res = msvcrt_spawn(_P_WAIT, comspec, fullcmd, NULL, 1);
1288
1289 HeapFree(GetProcessHeap(), 0, comspec);
1290 HeapFree(GetProcessHeap(), 0, fullcmd);
1291 return res;
1292}
1293
1294/*********************************************************************
1295 * system (MSVCRT.@)
1296 */
1297int CDECL system(const char* cmd)
1298{
1299 int res = -1;
1300 wchar_t *cmdW;
1301
1302 if (cmd == NULL)
1303 return _wsystem(NULL);
1304
1305 if ((cmdW = wstrdupa_utf8(cmd)))
1306 {
1307 res = _wsystem(cmdW);
1308 free(cmdW);
1309 }
1310 return res;
1311}
1312#endif
1313
1314/*********************************************************************
1315 * _loaddll (MSVCRT.@)
1316 */
1317intptr_t CDECL _loaddll(const char* dllname)
1318{
1319 wchar_t *dllnameW = NULL;
1320 intptr_t ret;
1321
1322 if (dllname && !(dllnameW = wstrdupa_utf8(dllname))) return 0;
1323 ret = (intptr_t)LoadLibraryW(dllnameW);
1324 free(dllnameW);
1325 return ret;
1326}
1327
1328/*********************************************************************
1329 * _unloaddll (MSVCRT.@)
1330 */
1332{
1333 if (FreeLibrary((HMODULE)dll))
1334 return 0;
1335 else
1336 {
1337 int err = GetLastError();
1339 return err;
1340 }
1341}
1342
1343/*********************************************************************
1344 * _getdllprocaddr (MSVCRT.@)
1345 */
1346void * CDECL _getdllprocaddr(intptr_t dll, const char *name, int ordinal)
1347{
1348 if (name)
1349 {
1350 if (ordinal != -1) return NULL;
1351 return GetProcAddress( (HMODULE)dll, name );
1352 }
1353 if (HIWORD(ordinal)) return NULL;
1354 return GetProcAddress( (HMODULE)dll, (LPCSTR)(ULONG_PTR)ordinal );
1355}
1356
1357/*********************************************************************
1358 * _getpid (MSVCRT.@)
1359 */
1361{
1362 return GetCurrentProcessId();
1363}
1364
1365#if _MSVCR_VER>=110
1366/*********************************************************************
1367 * __crtTerminateProcess (MSVCR110.@)
1368 */
1369int CDECL __crtTerminateProcess(UINT exit_code)
1370{
1372}
1373#endif
#define stat
Definition: acwin.h:99
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static const WCHAR nameW[]
Definition: main.c:49
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:171
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define _O_BINARY
Definition: cabinet.h:51
#define _O_NOINHERIT
Definition: cabinet.h:45
#define _O_TEXT
Definition: cabinet.h:50
#define CDECL
Definition: compat.h:29
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define GetCurrentProcess()
Definition: compat.h:759
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define MultiByteToWideChar
Definition: compat.h:110
#define LoadLibraryW(x)
Definition: compat.h:747
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1534
BOOL WINAPI DECLSPEC_HOTPATCH GetExitCodeProcess(HANDLE process, LPDWORD exit_code)
Definition: process.c:788
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(const WCHAR *app_name, WCHAR *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const WCHAR *cur_dir, STARTUPINFOW *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:700
wchar_t * msvcrt_wstrdupa(const char *str)
Definition: data.c:373
int CDECL _get_fmode(int *mode)
Definition: data.c:287
wchar_t *CDECL _wgetenv(const wchar_t *name)
Definition: environ.c:254
__msvcrt_ulong *CDECL __doserrno(void)
Definition: errno.c:223
int *CDECL _errno(void)
Definition: errno.c:215
void CDECL _exit(int exitcode)
Definition: exit.c:187
int CDECL _close(int fd)
Definition: file.c:1219
int CDECL _pipe(int *pfds, unsigned int psize, int textmode)
Definition: file.c:2323
int CDECL fclose(FILE *file)
Definition: file.c:3757
int CDECL _dup(int od)
Definition: file.c:1317
BOOL msvcrt_create_io_inherit_block(WORD *size, BYTE **block)
Definition: file.c:675
intptr_t CDECL _get_osfhandle(int fd)
Definition: file.c:2117
textmode
Definition: file.c:95
FILE *CDECL _wfdopen(int fd, const wchar_t *mode)
Definition: file.c:1863
int intptr_t
Definition: corecrt.h:176
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
#define ENOENT
Definition: errno.h:25
#define EINVAL
Definition: errno.h:44
#define ECHILD
Definition: errno.h:33
#define EBADF
Definition: errno.h:32
#define _P_DETACH
Definition: process.h:19
#define _P_NOWAIT
Definition: process.h:16
#define _P_NOWAITO
Definition: process.h:18
#define _P_WAIT
Definition: process.h:15
#define _P_OVERLAY
Definition: process.h:17
#define va_end(v)
Definition: stdarg.h:28
#define va_arg(v, l)
Definition: stdarg.h:27
#define va_start(v, l)
Definition: stdarg.h:26
#define STDOUT_FILENO
Definition: stdio.h:25
#define STDERR_FILENO
Definition: stdio.h:26
#define STDIN_FILENO
Definition: stdio.h:24
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
char * va_list
Definition: vadefs.h:50
void CDECL _lock(int locknum)
Definition: lock.c:85
void CDECL _unlock(int locknum)
Definition: lock.c:114
static wchar_t * wstrdupa_utf8(const char *str)
Definition: msvcrt.h:440
static int convert_acp_utf8_to_wcs(const char *str, wchar_t *wstr, int len)
Definition: msvcrt.h:430
static UINT get_aw_cp(void)
Definition: msvcrt.h:422
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
#define _POPEN_LOCK
Definition: mtdll.h:40
intptr_t CDECL _wspawnvp(int flags, const wchar_t *name, const wchar_t *const *argv)
Definition: process.c:1023
intptr_t CDECL _spawnvp(int flags, const char *name, const char *const *argv)
Definition: process.c:1013
intptr_t WINAPIV _spawnlpe(int flags, const char *name, const char *arg0,...)
Definition: process.c:867
intptr_t CDECL _wspawnvpe(int flags, const wchar_t *name, const wchar_t *const *argv, const wchar_t *const *envv)
Definition: process.c:991
FILE *CDECL _wpopen(const wchar_t *command, const wchar_t *mode)
Definition: process.c:1044
intptr_t WINAPIV _spawnle(int flags, const char *name, const char *arg0,...)
Definition: process.c:762
static void msvcrt_search_executable(const wchar_t *name, wchar_t *fullname, int use_path)
Definition: process.c:42
int CDECL _pclose(FILE *file)
Definition: process.c:1212
intptr_t WINAPIV _wspawnle(int flags, const wchar_t *name, const wchar_t *arg0,...)
Definition: process.c:735
intptr_t CDECL _wexecvp(const wchar_t *name, const wchar_t *const *argv)
Definition: process.c:668
intptr_t CDECL _spawnve(int flags, const char *name, const char *const *argv, const char *const *envv)
Definition: process.c:900
intptr_t CDECL _wexecve(const wchar_t *name, const wchar_t *const *argv, const wchar_t *const *envv)
Definition: process.c:626
intptr_t WINAPIV _spawnlp(int flags, const char *name, const char *arg0,...)
Definition: process.c:816
intptr_t WINAPIV _wspawnlpe(int flags, const wchar_t *name, const wchar_t *arg0,...)
Definition: process.c:840
intptr_t CDECL _cwait(int *status, intptr_t pid, int action)
Definition: process.c:362
intptr_t CDECL _wspawnv(int flags, const wchar_t *name, const wchar_t *const *argv)
Definition: process.c:956
intptr_t WINAPIV _wspawnlp(int flags, const wchar_t *name, const wchar_t *arg0,...)
Definition: process.c:794
intptr_t CDECL _execvpe(const char *name, const char *const *argv, const char *const *envv)
Definition: process.c:658
int CDECL _unloaddll(intptr_t dll)
Definition: process.c:1331
intptr_t CDECL _spawnvpe(int flags, const char *name, const char *const *argv, const char *const *envv)
Definition: process.c:967
intptr_t CDECL _wspawnve(int flags, const wchar_t *name, const wchar_t *const *argv, const wchar_t *const *envv)
Definition: process.c:924
int CDECL system(const char *cmd)
Definition: process.c:1297
static DWORD popen_handles_size
Definition: process.c:1032
intptr_t WINAPIV _wexeclp(const wchar_t *name, const wchar_t *arg0,...)
Definition: process.c:500
intptr_t CDECL _wexecvpe(const wchar_t *name, const wchar_t *const *argv, const wchar_t *const *envv)
Definition: process.c:647
intptr_t WINAPIV _wexecle(const wchar_t *name, const wchar_t *arg0,...)
Definition: process.c:441
static intptr_t msvcrt_spawn(int flags, const wchar_t *exe, wchar_t *cmdline, wchar_t *env, int use_path)
Definition: process.c:135
intptr_t WINAPIV _execlp(const char *name, const char *arg0,...)
Definition: process.c:522
int CDECL _wsystem(const wchar_t *cmd)
Definition: process.c:1254
intptr_t WINAPIV _wspawnl(int flags, const wchar_t *name, const wchar_t *arg0,...)
Definition: process.c:689
void msvcrt_free_popen_data(void)
Definition: process.c:1034
intptr_t CDECL _execve(const char *name, const char *const *argv, const char *const *envv)
Definition: process.c:637
void *CDECL _getdllprocaddr(intptr_t dll, const char *name, int ordinal)
Definition: process.c:1346
static wchar_t * msvcrt_get_comspec(void)
Definition: process.c:346
intptr_t CDECL _execv(const char *name, const char *const *argv)
Definition: process.c:616
intptr_t WINAPIV _wexeclpe(const wchar_t *name, const wchar_t *arg0,...)
Definition: process.c:546
static wchar_t * msvcrt_valisttos_aw(const char *arg0, va_list alist, wchar_t delim)
Definition: process.c:314
intptr_t WINAPIV _spawnl(int flags, const char *name, const char *arg0,...)
Definition: process.c:711
intptr_t WINAPIV _wexecl(const wchar_t *name, const wchar_t *arg0,...)
Definition: process.c:395
FILE *CDECL _popen(const char *command, const char *mode)
Definition: process.c:1185
intptr_t CDECL _spawnv(int flags, const char *name, const char *const *argv)
Definition: process.c:946
intptr_t WINAPIV _execlpe(const char *name, const char *arg0,...)
Definition: process.c:573
intptr_t CDECL _wexecv(const wchar_t *name, const wchar_t *const *argv)
Definition: process.c:605
intptr_t WINAPIV _execle(const char *name, const char *arg0,...)
Definition: process.c:468
static wchar_t * msvcrt_valisttos(const wchar_t *arg0, va_list alist, wchar_t delim)
Definition: process.c:279
intptr_t CDECL _execvp(const char *name, const char *const *argv)
Definition: process.c:679
int CDECL _getpid(void)
Definition: process.c:1360
intptr_t WINAPIV _execl(const char *name, const char *arg0,...)
Definition: process.c:417
intptr_t CDECL _loaddll(const char *dllname)
Definition: process.c:1317
static wchar_t * msvcrt_argvtos(const wchar_t *const *arg, wchar_t delim)
Definition: process.c:191
static struct popen_handle * popen_handles
static wchar_t * msvcrt_argvtos_aw(const char *const *arg, BOOL env)
Definition: process.c:236
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
return ret
Definition: mutex.c:146
action
Definition: namespace.c:707
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLfloat f
Definition: glext.h:7540
GLenum mode
Definition: glext.h:6217
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define a
Definition: ke_i.h:78
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
POINT cp
Definition: magnifier.c:59
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static DWORD path_len
Definition: batch.c:31
const char * fullname
Definition: shader.c:1766
static UINT exit_code
Definition: process.c:78
static refpint_t pi[]
Definition: server.c:112
DWORD create_flags
Definition: sec_mgr.c:1589
#define argv
Definition: mplay32.c:18
unsigned int UINT
Definition: ndis.h:50
LONG read_pipe(HANDLE hPipe, SOCKET sock)
Definition: pipetunnel.cpp:202
#define err(...)
#define WINAPIV
Definition: sdbpapi.h:64
wcscat
wcscpy
#define msvcrt_set_errno
Definition: heap.c:50
#define memset(x, y, z)
Definition: compat.h:39
#define args
Definition: format.c:66
#define TRACE(s)
Definition: solgame.cpp:4
TCHAR * cmdline
Definition: stretchblt.cpp:32
Definition: match.c:390
Definition: ftp_var.h:139
Definition: fci.c:127
Definition: name.c:39
FILE * f
Definition: process.c:1029
HANDLE proc
Definition: process.c:1030
Definition: stat.h:66
Definition: ps.c:97
#define max(a, b)
Definition: svc.c:63
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
PVOID HANDLE
Definition: typedefs.h:73
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define HIWORD(l)
Definition: typedefs.h:247
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CREATE_UNICODE_ENVIRONMENT
Definition: winbase.h:190
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
#define STARTF_USESTDHANDLES
Definition: winbase.h:476
#define WAIT_FAILED
Definition: winbase.h:390
#define DETACHED_PROCESS
Definition: winbase.h:183
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
void * arg
Definition: msvc.h:10
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
const char * LPCSTR
Definition: xmlstorage.h:183