1 |
/* $Id$ */ |
/* $Id$ */ |
2 |
|
|
3 |
#include <stdlib.h> |
#include <stdlib.h> |
4 |
|
#include <stdio.h> |
5 |
#include <errno.h> |
#include <errno.h> |
6 |
#include <windows.h> |
#include <windows.h> |
7 |
|
|
37 |
&si, |
&si, |
38 |
&pi |
&pi |
39 |
); |
); |
40 |
|
|
41 |
|
if (!background) { |
42 |
|
long status; |
43 |
|
status = WaitForSingleObject(pi.hProcess, INFINITE); |
44 |
|
if (status == WAIT_FAILED) { |
45 |
|
check_alert_error("WaitForSingleObject"); |
46 |
|
} |
47 |
|
} |
48 |
|
|
49 |
|
} |
50 |
|
|
51 |
|
check_alert_error(char *error_source[]) { |
52 |
|
DWORD dwError = GetLastError(); |
53 |
|
|
54 |
|
HLOCAL hlocal = NULL; |
55 |
|
|
56 |
|
BOOL fOk = FormatMessage( |
57 |
|
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, |
58 |
|
NULL, |
59 |
|
dwError, |
60 |
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), |
61 |
|
(PTSTR)&hlocal, |
62 |
|
0, |
63 |
|
NULL |
64 |
|
); |
65 |
|
|
66 |
|
if (hlocal != NULL) { |
67 |
|
fprintf(stderr, "Error with '%s': %s", error_source, hlocal); |
68 |
|
LocalFree(hlocal); |
69 |
|
} |
70 |
|
|
71 |
} |
} |