📄 makesis.cpp
字号:
break; case ErrFileNotFound: DoErrMsg(_T("file not found")); break; case ErrPackageNotASISFile: DoErrMsg(_T("component is not a SIS file")); break; case ErrBadCondFormat: DoErrMsg(_T("incorrect condition format")); OUT << _T(" Usage : IF condition") << endl; OUT << _T(" ELSEIF condition") << endl; OUT << _T(" ELSE") << endl; OUT << _T(" ENDIF") << endl << endl; OUT << _T(" condition : var op \"string\"") << endl; OUT << _T(" var op number") << endl; OUT << _T(" EXISTS \"filename\"") << endl; OUT << _T(" (condition)AND(condition)") << endl; OUT << _T(" (condition)OR(condition)") << endl; OUT << _T(" NOT(condition)") << endl << endl; OUT << _T(" op : = <> > < >= <=") << endl; break; case ErrReadFailed: DoErrMsg(_T("failed to read file")); break; case ErrBadOption: DoErrMsg(_T("invalid option")); break; case ErrBadString: DoErrMsg(_T("invalid string")); break; case ErrUnexpectedToken: DoErrMsg(_T("unexpected text")); break; case ErrInvalidEscape: DoErrMsg(_T("invalid UNICODE character value")); break; case ErrNumberOutOfRange: DoErrMsg(_T("number out of range")); break; case ErrUnknownVariable: DoErrMsg(_T("unknown variable name")); OUT << _T(" Known variables :") << endl; OUT << _T(" Manufacturer, ManufacturerHardwareRev, ManufacturerSoftwareRev,") << endl; OUT << _T(" ManufacturerSoftwareBuild") << endl; OUT << _T(" Model") << endl; OUT << _T(" MachineUid") << endl; OUT << _T(" DeviceFamily, DeviceFamilyRev") << endl; OUT << _T(" CPU, CPUArch, CPUABI, CPUSpeed") << endl; OUT << _T(" SystemTickPeriod") << endl; OUT << _T(" MemoryRAM, MemoryROM, MemoryPageSize") << endl; OUT << _T(" PowerBackup") << endl; OUT << _T(" Keyboard, KeyboardDeviceKeys, KeyboardAppKeys, KeyboardClick,") << endl; OUT << _T(" KeyboardClickVolumeMax") << endl; OUT << _T(" DisplayXPixels, DisplayYPixels, DisplayXTwips, DisplayYTwips,") << endl; OUT << _T(" DisplayColors, DisplayContrastMax") << endl; OUT << _T(" Backlight") << endl; OUT << _T(" Pen, PenX, PenY, PenDisplayOn, PenClick, PenClickVolumeMax") << endl; OUT << _T(" Mouse, MouseX, MouseY, MouseButtons") << endl; OUT << _T(" CaseSwitch") << endl; OUT << _T(" LEDs") << endl; OUT << _T(" IntegratedPhone") << endl; OUT << _T(" NumHalAttributes") << endl; OUT << _T(" Language") << endl; OUT << _T(" RemoteInstall") << endl; break; case ErrUninstallNeedsWaitEnd: DoErrMsg(_T("RW/RUNWAITEND option required with RR/RUNREMOVE or RB/RUNBOTH options")); break; case ErrUIDMismatch: DoErrMsg(_T("UID in the embedded SIS file is not the same as the UID given in the package file.")); break; case ErrCannotGetFullPath: DoErrMsg(_T("Cannot get full path of embedded SIS file.")); break; case ErrBadDestinationPath: DoErrMsg(_T("Bad destination path for file.")); break; default: DoErrMsg(_T("syntax error")); break; } }void CMakeSIS::ShowGeneratorError(TGeneratorException err)// Purpose : Write message for any error which occured whilst generating the output SIS file (or // stub)(to STDOUT (cout/wcout) - naturally)// Inputs : err - the error ID { switch(err) { case ErrFailedToWriteHeader: DoErrMsg(_T("failed whilst writing HEADER block")); break; case ErrFailedToWriteLanguages: DoErrMsg(_T("failed whilst writing LANGUAGE block")); break; case ErrFailedToWriteFilesBlock: DoErrMsg(_T("failed whilst writing FILES block")); break; case ErrFailedToWriteConditionBlock: DoErrMsg(_T("failed whilst writing CONDITIONS block")); break; case ErrFailedToWriteOptionsBlock: DoErrMsg(_T("failed whilst writing OPTIONS block")); break; case ErrFailedToWriteDependencyBlock: DoErrMsg(_T("failed whilst writing DEPENDENCY block")); break; case ErrFailedToWriteStringsBlock: DoErrMsg(_T("failed whilst writing STRINGS block")); break; case ErrFailedToWriteCRC: DoErrMsg(_T("failed whilst to write CRC")); break; case ErrFailedToOpenStubTarget: DoErrMsg(_T("cannot Open Destination Stub File")); break; case ErrFailedCompression: DoErrMsg(_T("Failed to compress Files")); break; case ErrCannotOpenFile: DoErrMsg(_T("unable to open file")); break; case ErrCannotReadFile: DoErrMsg(_T("unable to read file")); break; case ErrCannotWriteFile: DoErrMsg(_T("failed whilst writing file")); break; default: DoErrMsg(_T("internal error")); break; } };void CMakeSIS::ShowCommandLineError(TCommandLineException err)// Purpose : Write message for any error which occured whilst processing the command line (to // STDOUT (cout/wcout) - naturally)// Inputs : err - the error ID { switch(err) { case ErrInsufficientArgs: DoErrMsg(_T("wrong number of arguments")); break; case ErrBadCommandFlag: DoErrMsg(_T("unknown flag")); break; case ErrBadSourceFile: DoErrMsg(_T("invalid source file")); break; case ErrNoSourceFile: DoErrMsg(_T("no source file specified")); break; case ErrCannotOpenSourceFile: DoErrMsg(_T("cannot open source file")); break; case ErrBadTargetFile: DoErrMsg(_T("invalid destination file")); break; default: DoErrMsg(_T("bad command line argumants")); break; } }void CMakeSIS::ShowUsage()// Write command line help to STDOUT (cout/wcout) { OUT << _T("Usage : makesis [-h] [-v] [-s] [-d directory] [-p password] pkgfile [sisfile]") << endl << endl; OUT << _T(" Options : -h Show help page") << endl; OUT << _T(" Options : -v Verbose output to screen") << endl; OUT << _T(" Options : -s Create stub SIS file") << endl; OUT << _T(" Options : -d Specify a directory path to search") << endl; OUT << _T(" Options : -p Specify a password to decrypt private key") << endl << endl; OUT << _T(" use -h option to see pkgfile format") << endl; }void CMakeSIS::ShowSyntax()// Writes a PKG syntax summary to STDOUT (cout/wcout) { // Show the title ShowBanner(); OUT << _T("MakeSIS PKG File format help") << endl; OUT << _T("============================") << endl << endl; OUT << _T("&aa,bb,...,zz Define languages used in installation. Choose from:-") << endl; OUT << _T(" AF - Afrikaans, SQ - Albanian, AH - Amharic") << endl; OUT << _T(" AR - Arabic, HY - Armenian, AU - Australian") << endl; OUT << _T(" AS - Austrian, BE - Belarussian, BN - Bengali")<< endl; OUT << _T(" BG - Bulgarian, MY - Burmese, CA - Catalan") << endl; OUT << _T(" TC - Taiwan Chinese, HK - Hong Kong Chinese")<< endl; OUT << _T(" ZH - PRC Chinese")<< endl; OUT << _T(" HR - Croatian, CS - Czech, DA - Danish, DU - Dutch") << endl; OUT << _T(" EN - English, AM - American English, CE - Canadian English")<< endl; OUT << _T(" IE - International English, SF - South African English") << endl; OUT << _T(" ET - Estonian, FA - Farsi, FI - Finnish, BL - Belgian Flemish") << endl; OUT << _T(" FR - French, BF - Belgian French, CF - Canadian French")<< endl; OUT << _T(" IF - International French, SF - Swiss French")<< endl; OUT << _T(" GD - Scots Gaelic, KA - Georgian, GE - German") << endl; OUT << _T(" SG - Swiss German, EL - Greek, GU - Gujarati")<< endl; OUT << _T(" HE - Hebrew, HI - Hindi, HU - Hungarian") << endl; OUT << _T(" IC - Icelandic, IN - Indonesian, GA - Irish")<< endl; OUT << _T(" IT - Italian, SZ - Swiss Italian, JA - Japanese, ") << endl; OUT << _T(" KN - Kannada, KK - Kazakh, KM - Khmer")<< endl; OUT << _T(" KO - Korean, LO - Laothian, LV - Latvian") << endl; OUT << _T(" LT - Lithuanian, MK - Macedonian, MS - Malay") << endl; OUT << _T(" ML - Malayalam, MR - Marathi, MO - Moldovian") << endl; OUT << _T(" MN - Mongolian, NZ - New Zealand, NO - Norwegian") << endl; OUT << _T(" NN - Norwegian Nynorsk, PL - Polish, PO - Portuguese")<< endl; OUT << _T(" BP - Brazilian Portuguese, PA - Punjabi, RO - Romanian") << endl; OUT << _T(" RU - Russian, SR - Serbian, SI - Sinhalese") << endl; OUT << _T(" SK - Slovak, SL - Slovenian, SO - Somali")<< endl; OUT << _T(" SP - Spanish, OS - International Spanish") << endl; OUT << _T(" LS - Latin American Spanish")<< endl; OUT << _T(" SH - Swahili, SW - Swedish, FS - Finland Swedish") << endl; OUT << _T(" TL - Tagalog, TA - Tamil, TE - Telugu, TH - Thai") << endl; OUT << _T(" BO - Tibetan, TI - Tigrinya, TU - Turkish")<< endl; OUT << _T(" CT - Cyprus Turkish, TK - Turkmen, UK - Ukrainian") << endl; OUT << _T(" UR - Urdu") << endl; //Put reserved here OUT << _T(" VI - Vietnamese, CY - Welsh, ZU - Zulu") << endl; OUT << _T("#{\"NAMEaa\", ... \"NAMEzz\"},(UID), Major, Minor, Build, Options") << endl; OUT << _T(" Define file header, including name, uid and version") << endl; OUT << _T("*PrivateKeyFile,CertificateChainFile,[KEY=password]") << endl; OUT << _T(" Digitally sign the SIS file") << endl; OUT << _T("\"Source\"-\"Destination\",Options") << endl; OUT << _T(" File to be installed/viewed") << endl; OUT << _T("@\"Component\",(UID)") << endl; OUT << _T(" Sub-component with UID to be installed") << endl; OUT << _T("(UID),Major,Minor,Build,{\"DEPENDaa\", ... \"DEPENDzz\"}") << endl; OUT << _T(" Define a dependency on another component version") << endl; OUT << _T("{ Start of a language block") << endl; OUT << _T("\"Source\" A file to install within a language block") << endl; OUT << _T("@\"Component\" A component to install within a language block") << endl; OUT << _T("}-\"Destination\", Options") << endl; OUT << _T(" End a language block containing files") << endl; OUT << _T("},(UID) End a language block containing components") << endl; OUT << _T("IF condition Start of block which is installed if condition evaluates") << endl; OUT << _T(" to TRUE at install time. Condition format is of the form:-") << endl; OUT << _T(" condition : variable op number") << endl; OUT << _T(" EXISTS \"filename\"") << endl; OUT << _T(" (condition)AND(condition)") << endl; OUT << _T(" (condition)OR(condition)") << endl; OUT << _T(" NOT(condition)") << endl; OUT << _T(" op : = <> > < >= <=") << endl; OUT << _T("ELSEIF condition Block which is installed if a previous condition block") << endl; OUT << _T(" was not evaluated and condition is TRUE") << endl; OUT << _T("ELSE Block which is installed if no previous condition blocks") << endl; OUT << _T(" were evaluated") << endl; OUT << _T("ENDIF Marks end of condition block(s)") << endl; }void CMakeSIS::DoVerbage(const _TCHAR* pszText) const// Purpose : Displays 'verbose' output text - if appropriate// Inputs : pszText - The text to display { if(Verbose()) DoMsg(_T(""),pszText); }void CMakeSIS::DoErrMsg(const _TCHAR* pszText) const { DoMsg(_T("error: "),pszText); }void CMakeSIS::DoMsg(const _TCHAR* pszText1, const _TCHAR* pszText2) const// Purpose : Displays 'verbose' output text - if appropriate// Inputs : pszText - The text to display { if(m_wLineNo > 0) { LPCWSTR fileNameU=m_CmdOptions.SourceFile();#ifdef _UNICODE OUT << fileNameU;#else DWORD len=wcslen(fileNameU); LPSTR fileName=MakeMBCSString(fileNameU,CP_ACP,len); OUT << fileName; delete [] fileName;#endif OUT << _T("(") << m_wLineNo << _T(")") << _T(" : "); } OUT << pszText1 << pszText2 << endl; }// main function - constructs a CMakeSIS object and calls it's run methodextern "C" { int main(int argc, _TCHAR *argv[], _TCHAR *envp[]) { if(sizeof(WCHAR) != 4) { OUT << "WCHAR error. Check your compiler\n"; exit(1); } CMakeSIS app; return app.Run(argc, argv, envp); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -