int main(int argc, char **argv) { bool installMode; #ifdef TESTMODE bool testMode = false; #endif if (argc != 2) { displayHelpAndExit(argv[0]); } if (strcmp(argv[1], "install") == 0) { installMode = true; } else if (strcmp(argv[1], "uninstall") == 0) { installMode = false; } else #ifdef TESTMODE if (strcmp(argv[1], "test") == 0) { testMode = true; } else #endif { displayHelpAndExit(argv[0]); } int rc; #ifdef TESTMODE if (testMode) { rc = performTest(); } else #endif if (installMode) { rc = installDriver(); } else { rc = uninstallDriver(); } if (rc == 0) { printf("operation completed successfully!\n"); } else { printf("error: operation failed with status code %d\n", rc); } return rc; }
int main(int argc, char **argv) { BOOL rc=FALSE; TCHAR szInstallDir[MAX_PATH]; HMODULE hExe = GetModuleHandle(NULL); /** @todo r=bird: * And by the way, we're only missing the coding style dmik uses now * and this file would contain the complete set. */ if(2!=argc || (stricmp(argv[1], "/i") && stricmp(argv[1], "/u"))) displayHelpAndExit(argv[0]); /* This program is only for installing drivers on NT4 */ if(!isNT4()){ printf("This program only runs on NT4\n"); return -1; } if (!GetModuleFileName(hExe, &szInstallDir[0], sizeof(szInstallDir))) { printf("GetModuleFileName failed! rc = %d\n", GetLastError()); return -1; } TCHAR *lastBackslash = wcsrchr(szInstallDir, L'\\'); if (!lastBackslash) { printf("Invalid path name!\n"); return -1; } *lastBackslash=L'\0'; /* Install video driver. Mouse driver installation is done by overwriting the image path in the setup script. */ if(!stricmp(argv[1], "/i")){ rc=installVideoDriver(szInstallDir); } else{ /* No video driver uninstallation yet. Do we need it? */ } if(FALSE==rc) printf("Some failure occurred during driver installation.\n"); return !rc; /* Return != 0 on failure. */ }