From 20163d0f54c4dab1d49cd2dab0997ff886b26439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 5 Apr 2025 20:19:39 +0200 Subject: [PATCH] NSIS - remove associating extensions in hope it will fix AVs --- installer.nsi | 259 +------------------------------------------------- 1 file changed, 1 insertion(+), 258 deletions(-) diff --git a/installer.nsi b/installer.nsi index 1542c371d..af650b18a 100644 --- a/installer.nsi +++ b/installer.nsi @@ -362,229 +362,9 @@ var SMDir Exch $R2 !macroend -!define un.StrRep "!insertmacro un.StrRep" -!macro un.StrRep output string old new - Push `${string}` - Push `${old}` - Push `${new}` - Call un.StrRep - - Pop ${output} -!macroend - - -!macro Func_StrRep un - Function ${un}StrRep - Exch $R2 ;new - Exch 1 - Exch $R1 ;old - Exch 2 - Exch $R0 ;string - Push $R3 - Push $R4 - Push $R5 - Push $R6 - Push $R7 - Push $R8 - Push $R9 - - StrCpy $R3 0 - StrLen $R4 $R1 - StrLen $R6 $R0 - StrLen $R9 $R2 - loop: - StrCpy $R5 $R0 $R4 $R3 - StrCmp $R5 $R1 found - StrCmp $R3 $R6 done - IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character - Goto loop - found: - StrCpy $R5 $R0 $R3 - IntOp $R8 $R3 + $R4 - StrCpy $R7 $R0 "" $R8 - StrCpy $R0 $R5$R2$R7 - StrLen $R6 $R0 - IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string - Goto loop - done: - - Pop $R9 - Pop $R8 - Pop $R7 - Pop $R6 - Pop $R5 - Pop $R4 - Pop $R3 - Push $R0 - Push $R1 - Pop $R0 - Pop $R1 - Pop $R0 - Pop $R2 - Exch $R1 - FunctionEnd -!macroend -;!insertmacro Func_StrRep "" -!insertmacro Func_StrRep "un." - -;var AddToContextMenu -/* -Function CUSTOM_PAGE_CONTEXTMENU - StrCpy $AddToContextMenu 1 - nsDialogs::create /NOUNLOAD 1018 - pop $1 - !insertmacro MUI_HEADER_TEXT "Add to Context Menu" "Set up Context menu" - ${NSD_CreateLabel} 0 0 100% 50 "You can add FFDec to right click context menu in Windows Explorer." - pop $1 - ${NSD_CreateCheckbox} 0 50 100% 25 "Add FFDec to context menu of SWF and GFX files" - pop $1 - ${NSD_SetState} $1 ${BST_CHECKED} - ${NSD_OnClick} $1 AddContextClick - nsDialogs::Show -FunctionEnd - -*/ - -/* -Function AddContextClick - pop $1 - ${NSD_GetState} $1 $AddToContextMenu -FunctionEnd -*/ - -Function IndexOf -Exch $R0 -Exch -Exch $R1 -Push $R2 -Push $R3 - - StrCpy $R3 $R0 - StrCpy $R0 -1 - IntOp $R0 $R0 + 1 - StrCpy $R2 $R3 1 $R0 - StrCmp $R2 "" +2 - StrCmp $R2 $R1 +2 -3 - - StrCpy $R0 -1 - -Pop $R3 -Pop $R2 -Pop $R1 -Exch $R0 -FunctionEnd - -!macro IndexOf Var Str Char -Push "${Char}" -Push "${Str}" - Call IndexOf -Pop "${Var}" -!macroend -!define IndexOf "!insertmacro IndexOf" - -var clsname -!define VERB "ffdec" -!define VERBNAME "Open with FFDec" -!define ALPHABET "abcdefghijklmnopqrstuvwxyz" -var ext -var MRUList -var exists - !define REG_CLASSES_HKEY HKLM -Function un.RemoveExtContextMenu - pop $ext - DeleteRegKey ${REG_CLASSES_HKEY} "Software\Classes\Applications\${APP_EXENAME}" - ReadRegStr $clsname ${REG_CLASSES_HKEY} "Software\Classes\.$ext" "" - IfErrors step2 - DeleteRegKey ${REG_CLASSES_HKEY} "Software\Classes\$clsname\shell\${VERB}" - step2: - ReadRegStr $MRUList HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" "MRUList" - IfErrors step3 - StrLen $0 $MRUList - ${For} $R1 0 $0 - StrCpy $2 $MRUList 1 $R1 ;Copy one character - ReadRegStr $3 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" $2 - ${If} $3 == ${APP_EXENAME} - ${un.StrRep} $MRUList $MRUList $2 "" - WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" "MRUList" $MRUList - DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" $2 - ${Break} - ${EndIf} - ${Next} - step3: - DeleteRegKey ${REG_CLASSES_HKEY} "Software\Classes\SystemFileAssociations\.$ext\Shell\${VERB}" -FunctionEnd - - - - -Function AddToExtContextMenu - pop $ext - - - WriteRegStr ${REG_CLASSES_HKEY} "Software\Classes\Applications\${APP_EXENAME}\shell\open" "" ${VERB} - WriteRegStr ${REG_CLASSES_HKEY} "Software\Classes\Applications\${APP_EXENAME}\shell\open\command" "" '"$INSTDIR\${APP_EXENAME}" "%1"' - - !insertmacro IfKeyExists ${REG_CLASSES_HKEY} "Software\Classes" ".$ext" - Pop $R0 - ${If} $R0 == 0 - WriteRegStr ${REG_CLASSES_HKEY} "Software\Classes\.$ext" "" "ShockwaveFlash.ShockwaveFlash" - ${EndIf} - - ReadRegStr $clsname ${REG_CLASSES_HKEY} "Software\Classes\.$ext" "" - !insertmacro IfKeyExists ${REG_CLASSES_HKEY} "Software\Classes" $clsname - Pop $R0 - ${If} $R0 == 0 - WriteRegStr ${REG_CLASSES_HKEY} "Software\Classes\$clsname" "" "Flash Movie" - ${EndIf} - - WriteRegStr ${REG_CLASSES_HKEY} "Software\Classes\$clsname\shell\${VERB}" "" "${VERBNAME}" - WriteRegStr ${REG_CLASSES_HKEY} "Software\Classes\$clsname\shell\${VERB}\command" "" '"$INSTDIR\${APP_EXENAME}" "%1"' - - - - - ReadRegStr $MRUList HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" "MRUList" - IfErrors not_mru - StrLen $0 $MRUList - StrCpy $exists 0 - ${For} $R1 0 $0 - StrCpy $2 $MRUList 1 $R1 ;Copy one character - ReadRegStr $2 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" $2 - ${If} $2 == ${APP_EXENAME} - StrCpy $exists 1 - ${Break} - ${EndIf} - ${Next} - ${If} $exists == 0 - StrLen $0 ${ALPHABET} - ${For} $R1 0 $0 - StrCpy $1 ${ALPHABET} 1 $R1 - ${IndexOf} $R0 $MRUList $1 - ${If} $R0 == -1 - WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" $1 ${APP_EXENAME} - StrCpy $MRUList "$MRUList$1" - WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" "MRUList" $MRUList - ${Break} - ${EndIf} - ${Next} - ${EndIf} - not_mru: - - !insertmacro IfKeyExists ${REG_CLASSES_HKEY} "Software\Classes" "SystemFileAssociations" - Pop $R0 - ${If} $R0 == 1 - !insertmacro IfKeyExists ${REG_CLASSES_HKEY} "Software\Classes\SystemFileAssociations\.$ext\Shell" ${VERB} - Pop $R0 - ${If} $R0 == 0 - WriteRegStr ${REG_CLASSES_HKEY} "Software\Classes\SystemFileAssociations\.$ext\Shell\${VERB}" "" "${VERBNAME}" - WriteRegStr ${REG_CLASSES_HKEY} "Software\Classes\SystemFileAssociations\.$ext\Shell\${VERB}\Command" "" '"$INSTDIR\${APP_EXENAME}" "%1"' - ${EndIf} - ${EndIf} -FunctionEnd - Section "FFDec" SecDummy @@ -663,32 +443,13 @@ Function .onInit SectionSetFlags ${SecDummy} $0 FunctionEnd -Section "$(STRING_ADD_CONTEXT_MENU)" SecContextMenu - SetRegView 64 - Push "swf" - Call AddToExtContextMenu - Push "spl" - Call AddToExtContextMenu - Push "gfx" - Call AddToExtContextMenu - - SetRegView 32 - Push "swf" - Call AddToExtContextMenu - Push "spl" - Call AddToExtContextMenu - Push "gfx" - Call AddToExtContextMenu - -SectionEnd - ;-------------------------------- ;Descriptions ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} "$(STRING_SECTION_APP)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} "$(STRING_SECTION_CONTEXT_MENU)" + ; !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} "$(STRING_SECTION_CONTEXT_MENU)" !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcut} "$(STRING_SECTION_SHORTCUT)" !insertmacro MUI_FUNCTION_DESCRIPTION_END @@ -738,24 +499,6 @@ Section "Uninstall" RmDir "$SMPROGRAMS\$SMDir" - - SetRegView 64 - Push "swf" - Call un.RemoveExtContextMenu - Push "spl" - Call un.RemoveExtContextMenu - Push "gfx" - Call un.RemoveExtContextMenu - - SetRegView 32 - Push "swf" - Call un.RemoveExtContextMenu - Push "spl" - Call un.RemoveExtContextMenu - Push "gfx" - Call un.RemoveExtContextMenu - - StrCmp $uninstlocal 1 0 +5 SetShellVarContext current RmDir /r "$APPDATA\JPEXS\FFDec\*.*"