// // Common Utility Routines Library // bool ScriptLib_Flag = true; void LogF( str Text ) { Log("LOG--> " + Text + "
" ); SysLog ( Text ); } str md5file( str File ) { var binmd5 = MD5Create(); var binfil = LoadFile( File ); MD5Update( binmd5, binfil, 0, sizeof( binfil ) ); var md5 = MD5Finish( binmd5 ); str hexmd5 = BinToHex( md5 ); return hexmd5; } // Rotate files (to save history...) void RotateFile(str File, int Rotation) { int Rotation_1; while ( Rotation > 1 ) { if (FileExists(File+".saved."+(str)Rotation)) RemoveFile(File+".saved."+(str)Rotation); Rotation_1 = Rotation - 1; if (FileExists(File+".saved."+(str)Rotation_1)) RenameFile(File+".saved."+(str)Rotation_1,File+".saved."+(str)Rotation); Rotation--; } if (FileExists(File+".saved.1")) RemoveFile(File+".saved.1"); if (FileExists(File)) RenameFile(File,File+".saved.1"); } bool diff( str File1, str File2 ) { if ( md5file( File1 ) != md5file( File2 ) ) return true; else return false; } void cp( str Source, str Destin ) { if ( FileExists( Source ) ) { if ( FileExists( Destin ) ) { if ( diff( Source, Destin ) ) { RotateFile( Destin, SavedVersions ); } else { return; } } FileCopy( Source, Destin ); } else { ShowConsole(); LogF( "Error during file copy (cp):
Source File "+Source+" not found
" ); delay(600); } } void mv( str Source, str Destin ) { cp ( Source, Destin ); if ( FileExists( Source ) ) RemoveFile( Source ); } str WOComma(str Text) { var TextArray = StrParse( Text, "," ); str Out = ""; for (int i=0;iPatch Registry File: " + RegPatch + " not found" ); return -1; } NTDetect(); str NewRegContent; str BaseRegister; str RegPath = "DISK://" + (str)WinDisk + ":" + (str)WinPart + "/" + NTSystemRoot + "/system32/config/"; str RegFile; str RegName; str RegTypeValue; str RegType; str RegValue; str FilArray[]; str PrevReg = ""; int NAR; int Pos; int Pun2; int ACapo; bool RegOpen_Flag = false; var BinValue; NewRegContent = LoadTextFile( RegPatch ); FilArray = StrParse(NewRegContent,"\r\n"); NAR = sizeof(FilArray); if ( FilArray[0] != "REGEDIT4" ) { LogF( RegPatch + ": Not a REGEDIT4 File" ); return -1; } else { for ( int i=1; i 2 ) { int mu = 0; for ( int i=0; i