X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=InstallShield%2Frunexe.c;fp=InstallShield%2Frunexe.c;h=0000000000000000000000000000000000000000;hp=c1becfbcaa7db5ce5b71641e27cf6a7829c64980;hb=b4e88b1999b29c14668df90564fc0d3c89d94120;hpb=961e2f0abe026258a25006f08e9bbaad25b1519a diff --git a/InstallShield/runexe.c b/InstallShield/runexe.c deleted file mode 100644 index c1becfb..0000000 --- a/InstallShield/runexe.c +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include - -const char *prog = "runexe"; - -#define BUFLEN 65537 - -void die(char *fmt, ...) -{ - va_list ap = va_start(ap, fmt); - - fprintf(stderr, "%s: ", prog); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - va_end(ap); - exit(1); -} - -void warn(char *fmt, ...) -{ - va_list ap = va_start(ap, fmt); - - fprintf(stderr, "%s: ", prog); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - va_end(ap); -} - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) -{ - STARTUPINFO sInfo; - PROCESS_INFORMATION pInfo; - TCHAR buf[BUFLEN]; - DWORD retCode; - - sInfo.cb = sizeof(STARTUPINFO); - sInfo.lpReserved = NULL; - sInfo.lpReserved2 = NULL; - sInfo.cbReserved2 = 0; - sInfo.lpDesktop = NULL; - sInfo.lpTitle = NULL; - sInfo.dwFlags = 0; - - if (GetCurrentDirectory(BUFLEN, buf) == 0) die("couldn't get current directory"); - if (strlen(lpszCmdParam) == 0) die("no parameters given"); - warn("cwd: %s\n", buf); - warn("runexing >>>%s<<<\n", lpszCmdParam); - if (!CreateProcess(NULL, lpszCmdParam, NULL, NULL, TRUE, 0, NULL, NULL, &sInfo, &pInfo)) - die("could not create process"); - - WaitForSingleObject(pInfo.hProcess, INFINITE); - if (GetExitCodeProcess(pInfo.hProcess, &retCode) == 0) retCode = -1; - CloseHandle(pInfo.hProcess); - CloseHandle(pInfo.hThread); - printf("return code %ld\n", retCode); - - return retCode; -}