diff options
author | bitraid <bitraid@protonmail.ch> | 2018-10-11 13:32:26 +0300 |
---|---|---|
committer | bitraid <bitraid@protonmail.ch> | 2018-10-11 19:59:08 +0300 |
commit | 3e9a2399117c0f8c56b446aa64df32ca979ceebb (patch) | |
tree | 5791ad2d9a7f2f45f63e29ec7da6907eadc23755 /misc/nsis | |
parent | 2cd71b5382a02b214d885bc60583e9a9046cc8d1 (diff) | |
download | qutebrowser-3e9a2399117c0f8c56b446aa64df32ca979ceebb.tar.gz qutebrowser-3e9a2399117c0f8c56b446aa64df32ca979ceebb.zip |
NSIS: use correct HKCU when using another account for elevation.
Diffstat (limited to 'misc/nsis')
-rwxr-xr-x | misc/nsis/install.nsh | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/misc/nsis/install.nsh b/misc/nsis/install.nsh index 779c29c6b..9e1463128 100755 --- a/misc/nsis/install.nsh +++ b/misc/nsis/install.nsh @@ -147,6 +147,31 @@ var KeepReg ${endif} !macroend +; Functions +Function Get_Default_Browser + ReadRegStr $0 HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId" + ReadRegStr $1 HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" "ProgId" + ReadRegStr $2 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\UserChoice" "ProgId" + ReadRegStr $3 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" "ProgId" +FunctionEnd + +Function Set_Default_Browser + StrCmp $0 "${PRODUCT_NAME}URL" +2 0 + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" \ + "ProgId" "${PRODUCT_NAME}URL" + StrCmp $1 "${PRODUCT_NAME}URL" +2 0 + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" \ + "ProgId" "${PRODUCT_NAME}URL" + StrCmp $2 "${PRODUCT_NAME}HTML" +3 0 + DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\UserChoice" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\UserChoice" \ + "ProgId" "${PRODUCT_NAME}HTML" + StrCmp $3 "${PRODUCT_NAME}HTML" +3 0 + DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" \ + "ProgId" "${PRODUCT_NAME}HTML" +FunctionEnd + ; Sections InstType "Full" InstType "Typical" @@ -324,10 +349,7 @@ SectionEnd Section /o "Set as default browser" SectionDefaultBrowser SectionIn 1 - ReadRegStr $0 HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId" - ReadRegStr $1 HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" "ProgId" - ReadRegStr $2 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\UserChoice" "ProgId" - ReadRegStr $3 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" "ProgId" + !insertmacro UAC_AsUser_Call Function Get_Default_Browser $UAC_SYNCREGISTERS ${ifnot} $0 == "${PRODUCT_NAME}URL" ${orifnot} $1 == "${PRODUCT_NAME}URL" ${orifnot} $2 == "${PRODUCT_NAME}HTML" @@ -338,20 +360,7 @@ Section /o "Set as default browser" SectionDefaultBrowser ExecShell "open" "control.exe" "/name Microsoft.DefaultPrograms /page \ pageDefaultProgram\pageAdvancedSettings?pszAppName=${PRODUCT_NAME}" ${else} - StrCmp $0 "${PRODUCT_NAME}URL" +2 0 - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" \ - "ProgId" "${PRODUCT_NAME}URL" - StrCmp $1 "${PRODUCT_NAME}URL" +2 0 - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" \ - "ProgId" "${PRODUCT_NAME}URL" - StrCmp $2 "${PRODUCT_NAME}HTML" +3 0 - DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\UserChoice" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\UserChoice" \ - "ProgId" "${PRODUCT_NAME}HTML" - StrCmp $3 "${PRODUCT_NAME}HTML" +3 0 - DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" \ - "ProgId" "${PRODUCT_NAME}HTML" + !insertmacro UAC_AsUser_Call Function Set_Default_Browser $UAC_SYNCREGISTERS ${endif} ${endif} SectionEnd @@ -506,8 +515,11 @@ Function PageInstallModeChangeMode !insertmacro SelectSection ${SectionWindowsRegister} ; Select 'Default browser' if already set in registry - ReadRegStr $0 HKCU "SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId" + !insertmacro UAC_AsUser_Call Function Get_Default_Browser $UAC_SYNCREGISTERS ${if} $0 == "${PRODUCT_NAME}URL" + ${orif} $1 == "${PRODUCT_NAME}URL" + ${orif} $2 == "${PRODUCT_NAME}HTML" + ${orif} $3 == "${PRODUCT_NAME}HTML" !insertmacro SetSectionFlag ${SectionWindowsRegister} ${SF_RO} !insertmacro SelectSection ${SectionDefaultBrowser} ${else} |