Last active
March 25, 2019 21:11
-
-
Save Carm01/7083c5e4e6b3518b927a3a6442ab3446 to your computer and use it in GitHub Desktop.
AutoIT - Untested as of this post vased off of a few ways to prevent window10 from resetting default apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#RequireAdmin | |
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** | |
#AutoIt3Wrapper_Icon= | |
#AutoIt3Wrapper_Outfile_x64=AntiDefAppHijacker.exe | |
#AutoIt3Wrapper_Compression=4 | |
#AutoIt3Wrapper_UseX64=y | |
#AutoIt3Wrapper_Res_Comment=attempts to prevent Windows 10 from resetting default apps for a few applications | |
#AutoIt3Wrapper_Res_Description=prevent default app reset | |
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1 | |
#AutoIt3Wrapper_Res_ProductVersion=1.0.0.1 | |
#AutoIt3Wrapper_Res_LegalCopyright=carm01@GitHub | |
#AutoIt3Wrapper_Res_Language=1033 | |
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** | |
; https://kolbi.cz/blog/2017/10/25/setuserfta-userchoice-hash-defeated-set-file-type-associations-per-user/ | |
; https://www.winhelponline.com/blog/edge-hijack-pdf-htm-associations/ | |
; https://appuals.com/how-to-disable-edge-pdf-viewer-in-windows-10/ | |
; Place this as a start up script for all users and it will run silently without using hardly any resources. | |
; It will wait 60 seconds and if it does not detect a place holder file, then it will apply the fixes and writes a null file as a placeholder (w data that it set for default apps) to tell it that there is no need for it to run. | |
; If it finds the place holder file then it exists without doing anything | |
#include <array.au3> | |
#include <File.au3> | |
#NoTrayIcon | |
Global $sBase_x32 = "HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages\" | |
Global $browser = 'Microsoft.MicrosoftEdge_', $music = 'Microsoft.ZuneMusic_', $video = 'Microsoft.ZuneVideo_', $photos = 'Microsoft.Windows.Photos_' | |
Local $sCurrent, $sKey | |
Dim $sData[1] | |
Local $BulkFile = 'C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Prevent_App_hijack\placeholder' | |
;Sleep(60000) | |
Call('checkr') | |
Call('u') | |
If Not FileExists($BulkFile) Then | |
_FileCreate($BulkFile) | |
_FileWriteFromArray($BulkFile, $sData, 1) | |
EndIf | |
Exit | |
Func U() | |
$iEval = 1 | |
While 1 | |
$sUninst = "" | |
$sDisplay = "" | |
$sCurrent = RegEnumKey($sBase_x32, $iEval) | |
If @error Then ExitLoop | |
$sKey = $sBase_x32 & $sCurrent | |
$aArray = StringRegExp($sKey, '(?i)' & $browser, $STR_REGEXPARRAYGLOBALMATCH) | |
If @error = 0 Then | |
EDGE() | |
EndIf | |
$aArray = StringRegExp($sKey, '(?i)' & $music, $STR_REGEXPARRAYGLOBALMATCH) | |
If @error = 0 Then | |
music() | |
EndIf | |
$aArray = StringRegExp($sKey, '(?i)' & $video, $STR_REGEXPARRAYGLOBALMATCH) | |
If @error = 0 Then | |
Videos() | |
EndIf | |
$aArray = StringRegExp($sKey, '(?i)' & $photos, $STR_REGEXPARRAYGLOBALMATCH) | |
If @error = 0 Then | |
PHOTOS() | |
EndIf | |
$iEval += 1 | |
WEnd | |
EndFunc ;==>U | |
Func EDGE() | |
$sfullKeyEDGE = $sKey & '\MicrosoftEdge\Capabilities\FileAssociations' | |
$sHTM = RegRead($sfullKeyEDGE, ".htm") | |
_ArrayAdd($sData, $sHTM & ' Microsoft.MicrosoftEdge - .htm and .html files') | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sHTM, 'NoOpenWith', 'REG_SZ', "") | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sHTM, 'NoStaticDefaultVerb ', 'REG_SZ', "") | |
$sPDF = RegRead($sfullKeyEDGE, ".pdf") | |
_ArrayAdd($sData, $sPDF & ' Microsoft.MicrosoftEdge- .pdf files') | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sPDF, 'NoOpenWith', 'REG_SZ', "") | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sPDF, 'NoStaticDefaultVerb ', 'REG_SZ', "") | |
EndFunc ;==>EDGE | |
Func PHOTOS() | |
$sfullKey = $sKey & '\App\Capabilities\FileAssociations' | |
$sValue = RegRead($sfullKey, ".jpeg") | |
_ArrayAdd($sData, $sValue & ' Microsoft.Windows.Photos - .bmp .dib .gif .heic .jfif .jpe .jpeg .jpg .jxr .png .tif .tiff .wdp .ico .thumb') | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sValue, 'NoOpenWith', 'REG_SZ', "") | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sValue, 'NoStaticDefaultVerb ', 'REG_SZ', "") | |
$sValue = "" | |
$sValue = RegRead($sfullKey, ".mp4") | |
_ArrayAdd($sData, $sValue & ' Microsoft.Windows.Photos - .3g2, .3gp, .3gp2, .3gpp, .asf, .avi, .m2t, .m2ts, .m4v, .mkv, .mov, .mp4, .mp4v, .mts, .wm, .wmv') | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sValue, 'NoOpenWith', 'REG_SZ', "") | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sValue, 'NoStaticDefaultVerb ', 'REG_SZ', "") | |
$sValue = "" | |
$sfullKey = "" | |
EndFunc ;==>PHOTOS | |
Func Videos() | |
$sfullKey = $sKey & '\Microsoft.ZuneVideo\Capabilities\FileAssociations' | |
$sValue = RegRead($sfullKey, ".mp4") | |
_ArrayAdd($sData, $sValue & 'Microsoft.ZuneVideo - .3g2, .3gp, .3gp2, .3gpp, .asf, .avi, .divx, .m1v, .m2ts, .m2t, .m2v, .m4v, .mkv, .mod, .mov, .mp2v, .mp4, .mp4v, .mpe, .mpeg, .mpg, .mpv2, .mts, .ogm, .ogv, .ogx, .tod, .ts, .tts, .webm, .wm, .wmv, .xvid') | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sValue, 'NoOpenWith', 'REG_SZ', "") | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sValue, 'NoStaticDefaultVerb ', 'REG_SZ', "") | |
$sValue = "" | |
$sfullKey = "" | |
EndFunc ;==>Videos | |
Func music() | |
$sfullKey = $sKey & '\Microsoft.ZuneMusic\Capabilities\FileAssociations' | |
$sValue = RegRead($sfullKey, ".aac") | |
_ArrayAdd($sData, $sValue & ' Microsoft.ZuneMusic - .aac, .ac3, .adt, .adts, .amr, .ec3, .flac, .m4a, .m4r, .mka, .mp3, .mpa, .wav, .wma, .m3u, .wpl, .zpl') | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sValue, 'NoOpenWith', 'REG_SZ', "") | |
RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\' & $sValue, 'NoStaticDefaultVerb ', 'REG_SZ', "") | |
$sValue = "" | |
$sfullKey = "" | |
EndFunc ;==>music | |
Func checkr() | |
If FileExists($BulkFile) Then | |
Exit | |
ElseIf Not FileExists($BulkFile) Then | |
Return | |
EndIf | |
EndFunc ;==>checkr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: https://www.winhelponline.com/blog/edge-hijack-pdf-htm-associations/ | |
:: https://appuals.com/how-to-disable-edge-pdf-viewer-in-windows-10/ | |
:: prevent Windows10 from hijacking/resetting default browser to EDGE | |
REG ADD "HKCU\SOFTWARE\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9" /v "NoOpenWith" /d "" /t REG_SZ /f | |
REG ADD "HKCU\SOFTWARE\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9" /v "NoStaticDefaultVerb" /d "" /t REG_SZ /f | |
:: prevent Windows10 from hijacking/resetting default pdf to EDGE | |
REG ADD "HKCU\SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723" /v "NoOpenWith" /d "" /t REG_SZ /f | |
REG ADD "HKCU\SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723" /v "NoStaticDefaultVerb" /d "" /t REG_SZ /f | |
:: prevent Windows10 from hijacking/resetting default PhotApp to Microsoft.Windows.Photos - jpg, png, jpeg files , etc | |
REG ADD "HKCU\SOFTWARE\Classes\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc" /v "NoOpenWith" /d "" /t REG_SZ /f | |
REG ADD "HKCU\SOFTWARE\Classes\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc" /v "NoStaticDefaultVerb" /d "" /t REG_SZ /f | |
:: prevent Windows10 from hijacking/resetting default PhotApp to Microsoft.Windows.Photos - mp4 files etc | |
REG ADD "HKCU\SOFTWARE\Classes\AppXk0g4vb8gvt7b93tg50ybcy892pge6jmt" /v "NoOpenWith" /d "" /t REG_SZ /f | |
REG ADD "HKCU\SOFTWARE\Classes\AppXk0g4vb8gvt7b93tg50ybcy892pge6jmt" /v "NoStaticDefaultVerb" /d "" /t REG_SZ /f | |
:: prevent Windows10 from hijacking/resetting default music to Microsoft.ZuneMusic | |
REG ADD "HKCU\SOFTWARE\Classes\AppXqj98qxeaynz6dv4459ayz6bnqxbyaqcs" /v "NoOpenWith" /d "" /t REG_SZ /f | |
REG ADD "HKCU\SOFTWARE\Classes\AppXqj98qxeaynz6dv4459ayz6bnqxbyaqcs" /v "NoStaticDefaultVerb" /d "" /t REG_SZ /f | |
:: prevent Windows10 from hijacking/resetting default music to Microsoft.ZuneVideo | |
REG ADD "HKCU\SOFTWARE\Classes\AppX6eg8h5sxqq90pv53845wmnbewywdqq5h" /v "NoOpenWith" /d "" /t REG_SZ /f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment