Skip to content

Commit

Permalink
Windows GUI: Fix shell extension registries
Browse files Browse the repository at this point in the history
  • Loading branch information
cjee21 committed Nov 18, 2024
1 parent d63fa05 commit e1af400
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Source/Common/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,10 @@ int Preferences::ExplorerShell()
}
}
}
ExplorerShell_Edit("SystemFileAssociations\\audio", 0, IsChanged);
ExplorerShell_Edit("SystemFileAssociations\\Directory.Audio", 0, IsChanged);
ExplorerShell_Edit("SystemFileAssociations\\Directory.Video", 0, IsChanged);
ExplorerShell_Edit("SystemFileAssociations\\video", 0, IsChanged);
ExplorerShell_Edit("Software\\Classes\\SystemFileAssociations\\audio", 0, IsChanged);
ExplorerShell_Edit("Software\\Classes\\SystemFileAssociations\\Directory.Audio", 0, IsChanged);
ExplorerShell_Edit("Software\\Classes\\SystemFileAssociations\\Directory.Video", 0, IsChanged);
ExplorerShell_Edit("Software\\Classes\\SystemFileAssociations\\video", 0, IsChanged);

//Adding/removing to SystemFileAssociations
int32s ShellExtension=Config.Read(__T("ShellExtension")).To_int32s();
Expand Down
22 changes: 15 additions & 7 deletions Source/Install/MediaInfo_Extensions.nsh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
!ifndef SHCNE_ASSOCCHANGED
!define SHCNE_ASSOCCHANGED 0x08000000
!endif
!ifndef SHCNF_IDLIST
!define SHCNF_IDLIST 0x0000
!endif

!macro MediaInfo_Extensions_Install_I Extension
; Old InfoTip
DeleteRegKey HKCR "${Extension}\shellex\{00021500-0000-0000-C000-000000000046}"
Expand Down Expand Up @@ -37,10 +44,13 @@
; Removing unwanted entries
!insertmacro MediaInfo_Extensions_Uninstall_I "Directory.Audio"
!insertmacro MediaInfo_Extensions_Uninstall_I "Directory.Video"
!insertmacro MediaInfo_Extensions_Uninstall_I "audio"
!insertmacro MediaInfo_Extensions_Uninstall_I "Folder"
!insertmacro MediaInfo_Extensions_Uninstall_I "video"

; directories
WriteRegStr HKCU "Software\Classes\Directory\Shell\MediaInfo" "Icon" "$INSTDIR\MediaInfo.exe"
WriteRegStr HKCU "Software\Classes\Directory\\Shell\MediaInfo\Command" "" "$\"$INSTDIR\MediaInfo.exe$\" $\"%1$\""
WriteRegStr HKCU "Software\Classes\Directory\Shell\MediaInfo\Command" "" "$\"$INSTDIR\MediaInfo.exe$\" $\"%1$\""

; Per item
!insertmacro MediaInfo_Extensions_Install_I ".264"
Expand Down Expand Up @@ -198,9 +208,8 @@
!insertmacro MediaInfo_Extensions_Install_I ".wvc"
!insertmacro MediaInfo_Extensions_Install_I ".y4m"

!insertmacro MediaInfo_Extensions_Install_I "audio"
!insertmacro MediaInfo_Extensions_Install_I "Folder"
!insertmacro MediaInfo_Extensions_Install_I "video"
; Notify Windows Shell to refresh
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
!macroend

!macro MediaInfo_Extensions_Uninstall
Expand Down Expand Up @@ -371,7 +380,6 @@
!insertmacro MediaInfo_Extensions_Uninstall_I ".wvc"
!insertmacro MediaInfo_Extensions_Uninstall_I ".y4m"

!insertmacro MediaInfo_Extensions_Uninstall_I "audio"
!insertmacro MediaInfo_Extensions_Uninstall_I "Folder"
!insertmacro MediaInfo_Extensions_Uninstall_I "video"
; Notify Windows Shell to refresh
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
!macroend

0 comments on commit e1af400

Please sign in to comment.