/** * Checks for help command line options such as --help or --version. * If one is found, print the corresponding text. * \return true if a command line options caused some help message to be * printed, false otherwise. */ bool config_PrintHelp (vlc_object_t *obj) { char *str; /* Check for short help option */ if (var_InheritBool (obj, "help")) { Help (obj, "help"); return true; } /* Check for version option */ if (var_InheritBool (obj, "version")) { Version(); return true; } /* Check for help on modules */ str = var_InheritString (obj, "module"); if (str != NULL) { Help (obj, str); free (str); return true; } /* Check for full help option */ if (var_InheritBool (obj, "full-help")) { var_Create (obj, "advanced", VLC_VAR_BOOL); var_SetBool (obj, "advanced", true); var_Create (obj, "help-verbose", VLC_VAR_BOOL); var_SetBool (obj, "help-verbose", true); Help (obj, "full-help"); return true; } /* Check for long help option */ if (var_InheritBool (obj, "longhelp")) { Help (obj, "longhelp"); return true; } /* Check for module list option */ if (var_InheritBool (obj, "list")) { ListModules (obj, false ); return true; } if (var_InheritBool (obj, "list-verbose")) { ListModules (obj, true); return true; } return false; }
VOID lm( HANDLE CurrentProcess, HANDLE CurrentThread, DWORD CurrentPc, PWINDBG_EXTENSION_APIS ExtensionApis, LPSTR ArgumentString ) /*++ Routine Description: Arguments: CurrentProcess -- Supplies a handle to the current process CurrentThread -- Supplies a handle to the current thread CurrentPc -- Supplies the current program counter. (may be meaningless) ExtensionApis -- Supplies pointers to ntsd support routines ArgumentString -- Supplies the arguments passed to the command Return Value: None. --*/ { UNREFERENCED_PARAMETER(CurrentPc); hCurrentProcess = CurrentProcess; hCurrentThread = CurrentThread; lpArgumentString = ArgumentString; SETUP_WINDBG_POINTERS(ExtensionApis); if (!CheckGlobalHeap()) { return; } ListModules(); }
/************************************************************************* * * m a i n */ int main(int argc, char* argv[]) { int errcode = SUCCESS; PRBool createdb, readOnly; #define STDINBUF_SIZE 80 char stdinbuf[STDINBUF_SIZE]; progName = strrchr(argv[0], '/'); progName = progName ? progName + 1 : argv[0]; PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); if (parse_args(argc, argv) != SUCCESS) { usage(); errcode = INVALID_USAGE_ERR; goto loser; } if (verify_params() != SUCCESS) { usage(); errcode = INVALID_USAGE_ERR; goto loser; } if (command == NO_COMMAND) { PR_fprintf(PR_STDERR, errStrings[NO_COMMAND_ERR]); usage(); errcode = INVALID_USAGE_ERR; goto loser; } /* Set up crypto stuff */ createdb = command == CREATE_COMMAND; readOnly = ((command == LIST_COMMAND) || (command == CHKFIPS_COMMAND) || (command == RAW_LIST_COMMAND)); /* Make sure browser is not running if we're writing to a database */ /* Do this before initializing crypto */ if (!readOnly && !force) { char* response; PR_fprintf(PR_STDOUT, msgStrings[BROWSER_RUNNING_MSG]); if (!PR_fgets(stdinbuf, STDINBUF_SIZE, PR_STDIN)) { PR_fprintf(PR_STDERR, errStrings[STDIN_READ_ERR]); errcode = STDIN_READ_ERR; goto loser; } if ((response = strtok(stdinbuf, " \r\n\t"))) { if (!PL_strcasecmp(response, "q")) { PR_fprintf(PR_STDOUT, msgStrings[ABORTING_MSG]); errcode = SUCCESS; goto loser; } } PR_fprintf(PR_STDOUT, "\n"); } errcode = check_crypto(createdb, readOnly); if (errcode != SUCCESS) { goto loser; } if ((command == RAW_LIST_COMMAND) || (command == RAW_ADD_COMMAND)) { if (!moduleName) { char *readOnlyStr, *noCertDBStr, *sep; if (!secmodName) secmodName = "secmod.db"; if (!dbprefix) dbprefix = ""; sep = ((command == RAW_LIST_COMMAND) && nocertdb) ? "," : " "; readOnlyStr = (command == RAW_LIST_COMMAND) ? "readOnly" : ""; noCertDBStr = nocertdb ? "noCertDB" : ""; SECU_ConfigDirectory(dbdir); moduleName = PR_smprintf( "name=\"NSS default Module DB\" parameters=\"configdir=%s certPrefix=%s " "keyPrefix=%s secmod=%s flags=%s%s%s\" NSS=\"flags=internal,moduleDB," "moduleDBOnly,critical\"", SECU_ConfigDirectory(NULL), dbprefix, dbprefix, secmodName, readOnlyStr, sep, noCertDBStr); } if (command == RAW_LIST_COMMAND) { errcode = RawListModule(moduleName); } else { PORT_Assert(moduleSpec); errcode = RawAddModule(moduleName, moduleSpec); } goto loser; } errcode = init_crypto(createdb, readOnly); if (errcode != SUCCESS) { goto loser; } errcode = LoadMechanismList(); if (errcode != SUCCESS) { goto loser; } /* Execute the command */ switch (command) { case ADD_COMMAND: errcode = AddModule(moduleName, libFile, ciphers, mechanisms, secmodString); break; case CHANGEPW_COMMAND: errcode = ChangePW(tokenName, pwFile, newpwFile); break; case CREATE_COMMAND: /* The work was already done in init_crypto() */ break; case DEFAULT_COMMAND: errcode = SetDefaultModule(moduleName, slotName, mechanisms); break; case DELETE_COMMAND: errcode = DeleteModule(moduleName); break; case DISABLE_COMMAND: errcode = EnableModule(moduleName, slotName, PR_FALSE); break; case ENABLE_COMMAND: errcode = EnableModule(moduleName, slotName, PR_TRUE); break; case FIPS_COMMAND: errcode = FipsMode(fipsArg); break; case CHKFIPS_COMMAND: errcode = ChkFipsMode(fipsArg); break; case JAR_COMMAND: Pk11Install_SetErrorHandler(install_error); errcode = Pk11Install_DoInstall(jarFile, installDir, tempDir, PR_STDOUT, force, nocertdb); break; case LIST_COMMAND: if (moduleName) { errcode = ListModule(moduleName); } else { errcode = ListModules(); } break; case UNDEFAULT_COMMAND: errcode = UnsetDefaultModule(moduleName, slotName, mechanisms); break; default: PR_fprintf(PR_STDERR, "This command is not supported yet.\n"); errcode = INVALID_USAGE_ERR; break; } if (NSS_Shutdown() != SECSuccess) { exit(1); } loser: PR_Cleanup(); return errcode; }