Advertisement
Guest User

Custom.nsh for CppCheck Portable (by 3D1T0R)

a guest
Sep 19th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ${SegmentFile}
  2.  
  3. !macro _PreExecPrimary_RegReplaceDriveLetter
  4.  
  5.         # Code courtesy of Bart.S, OpenPlatform, and 3D1T0R
  6.     ${Registry::Read} "$RegKey" "$RegValue" $R0 $R1
  7.     ${If} $R0 != ""
  8.         ; Unfortunately the Registry::Read function puts a NewLine ($\n) between every character, this hack removes those while preserving NewLine ($\n) Characters which were supposed to be present
  9.             ; If we could fix Registry::Read we could remove the next 3 lines
  10.         ${WordReplace} $R0 "$\n$\n$\n" "/NEWLINE\" "+" $R2
  11.         ${WordReplace} $R2 "$\n" "" "+" $R2
  12.         ${WordReplace} $R2 "/NEWLINE\" "$\n" "+" $R2
  13.         ${DebugMsg} "Reading from Registry:$\nRegistry Key:$\n$RegKey$\nRegistry Value:$\n$RegValue$\nContents:$\n$R2$\nAnd is Type:$\n$R1"
  14.         ${WordReplace} $R2 "$LastDrive" "$Drive" "+" $R3
  15.         ${DebugMsg} "Replacing the LastDrive letter with the current Drive letter:$\nString begins as:$R2$\nString to find:$\n$LastDrive$\nString to replace with:$\n$Drive$\nResultant String:$\n$R3"
  16.         ${registry::Write} "$RegKey" "$RegValue" $R3 $R1 $R4
  17.         ${DebugMsg} "Writing to Registry:$\nRegistry Key:$RegKey$\nRegistry Value:$\n$RegValue$\nContents:$\n$R5$\nAnd is Type:$\n$R1$\n$\n$R3$\nDid it work (0=Yes -1=Error):$\n$R4"
  18.     ${Else}
  19.         ${DebugMsg} "$RegValue in $RegKey is empty."
  20.     ${EndIf}
  21. !macroend
  22.  
  23. Var Drive
  24. Var RegKey
  25. Var RegValue
  26.  
  27. ${SegmentPreExecPrimary}
  28.  
  29.     ReadEnvStr $LastDrive "PAL:LastDrive"
  30.     ReadEnvStr $Drive "PAL:Drive"
  31.  
  32.     StrCpy $RegKey "HKEY_CURRENT_USER\Software\Cppcheck\Cppcheck-GUI"
  33.     StrCpy $RegValue "Application paths"
  34.     !insertmacro _PreExecPrimary_RegReplaceDriveLetter
  35.  
  36.     StrCpy $RegValue "Check path"
  37.     !insertmacro _PreExecPrimary_RegReplaceDriveLetter
  38.  
  39.     StrCpy $RegValue "Global include paths"
  40.     !insertmacro _PreExecPrimary_RegReplaceDriveLetter
  41. !macroend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement