5 const char *prog = "runexe";
9 void die(char *fmt, ...)
11 va_list ap = va_start(ap, fmt);
13 fprintf(stderr, "%s: ", prog);
14 vfprintf(stderr, fmt, ap);
15 fprintf(stderr, "\n");
20 void warn(char *fmt, ...)
22 va_list ap = va_start(ap, fmt);
24 fprintf(stderr, "%s: ", prog);
25 vfprintf(stderr, fmt, ap);
26 fprintf(stderr, "\n");
30 int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)
33 PROCESS_INFORMATION pInfo;
36 sInfo.cb = sizeof(STARTUPINFO);
37 sInfo.lpReserved = NULL;
38 sInfo.lpReserved2 = NULL;
39 sInfo.cbReserved2 = 0;
40 sInfo.lpDesktop = NULL;
44 if (GetCurrentDirectory(BUFLEN, buf) == 0) die("no parameters given");
45 if (strlen(lpszCmdParam) == 0) warn("couldn't get current directory");
46 warn("cwd: %s\n", buf);
47 warn("runexing >>>%s<<<\n", lpszCmdParam);
48 CreateProcess(NULL, lpszCmdParam, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);