diff --git a/CleanFlashCommon/CleanFlashCommon.csproj b/CleanFlashCommon/CleanFlashCommon.csproj index 7e1affa..8b86f70 100644 --- a/CleanFlashCommon/CleanFlashCommon.csproj +++ b/CleanFlashCommon/CleanFlashCommon.csproj @@ -72,6 +72,7 @@ + diff --git a/CleanFlashCommon/Uninstaller.cs b/CleanFlashCommon/Uninstaller.cs index 0357d20..705d9a2 100644 --- a/CleanFlashCommon/Uninstaller.cs +++ b/CleanFlashCommon/Uninstaller.cs @@ -18,6 +18,10 @@ namespace CleanFlashCommon { "seamonkey", "palemoon", "plugin-container" }; + static Uninstaller() { + WinAPI.AllowModifications(); + } + public static void UninstallRegistry() { if (Environment.Is64BitOperatingSystem) { RegistryManager.ApplyRegistry(Properties.Resources.uninstallRegistry, Properties.Resources.uninstallRegistry64); diff --git a/CleanFlashCommon/UpdateChecker.cs b/CleanFlashCommon/UpdateChecker.cs index 0cbb011..cbf57d4 100644 --- a/CleanFlashCommon/UpdateChecker.cs +++ b/CleanFlashCommon/UpdateChecker.cs @@ -32,8 +32,8 @@ namespace CleanFlashCommon { } public class UpdateChecker { - private static readonly string FLASH_VERSION = "34.0.0.155"; - private static readonly string VERSION = "v34.0.0.155"; + private static readonly string FLASH_VERSION = "34.0.0.164"; + private static readonly string VERSION = "v34.0.0.164"; private static readonly string FLASH_PLAYER_EXECUTABLE = "flashplayer_sa.exe"; private static readonly string AUTHOR = "cleanflash"; private static readonly string REPO = "installer"; diff --git a/CleanFlashCommon/WinAPI.cs b/CleanFlashCommon/WinAPI.cs new file mode 100644 index 0000000..c0cace9 --- /dev/null +++ b/CleanFlashCommon/WinAPI.cs @@ -0,0 +1,108 @@ +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Security.Principal; + +namespace CleanFlashCommon { + public class WinAPI { + + public static void AllowModifications() { + ModifyPrivilege(PrivilegeName.SeRestorePrivilege, true); + ModifyPrivilege(PrivilegeName.SeTakeOwnershipPrivilege, true); + } + + public static bool ModifyPrivilege(PrivilegeName privilege, bool enable) { + LUID luid; + + if (!LookupPrivilegeValue(null, privilege.ToString(), out luid)) { + throw new Win32Exception(); + } + + using (var identity = WindowsIdentity.GetCurrent(TokenAccessLevels.AdjustPrivileges | TokenAccessLevels.Query)) { + var newPriv = new TOKEN_PRIVILEGES(); + newPriv.Privileges = new LUID_AND_ATTRIBUTES[1]; + newPriv.PrivilegeCount = 1; + newPriv.Privileges[0].Luid = luid; + newPriv.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0; + + var prevPriv = new TOKEN_PRIVILEGES(); + prevPriv.Privileges = new LUID_AND_ATTRIBUTES[1]; + prevPriv.PrivilegeCount = 1; + uint returnedBytes; + + if (!AdjustTokenPrivileges(identity.Token, false, ref newPriv, (uint)Marshal.SizeOf(prevPriv), ref prevPriv, out returnedBytes)) { + throw new Win32Exception(); + } + + return prevPriv.PrivilegeCount == 0 ? enable /* didn't make a change */ : ((prevPriv.Privileges[0].Attributes & SE_PRIVILEGE_ENABLED) != 0); + } + } + + const uint SE_PRIVILEGE_ENABLED = 2; + + [DllImport("advapi32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool AdjustTokenPrivileges(IntPtr TokenHandle, [MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, + UInt32 BufferLengthInBytes, ref TOKEN_PRIVILEGES PreviousState, out UInt32 ReturnLengthInBytes); + + [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool LookupPrivilegeValue(string lpSystemName, string lpName, out LUID lpLuid); + + struct TOKEN_PRIVILEGES { + public UInt32 PrivilegeCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1 /*ANYSIZE_ARRAY*/)] + public LUID_AND_ATTRIBUTES[] Privileges; + } + + [StructLayout(LayoutKind.Sequential)] + struct LUID_AND_ATTRIBUTES { + public LUID Luid; + public UInt32 Attributes; + } + + [StructLayout(LayoutKind.Sequential)] + struct LUID { + public uint LowPart; + public int HighPart; + } + } + + public enum PrivilegeName { + SeAssignPrimaryTokenPrivilege, + SeAuditPrivilege, + SeBackupPrivilege, + SeChangeNotifyPrivilege, + SeCreateGlobalPrivilege, + SeCreatePagefilePrivilege, + SeCreatePermanentPrivilege, + SeCreateSymbolicLinkPrivilege, + SeCreateTokenPrivilege, + SeDebugPrivilege, + SeEnableDelegationPrivilege, + SeImpersonatePrivilege, + SeIncreaseBasePriorityPrivilege, + SeIncreaseQuotaPrivilege, + SeIncreaseWorkingSetPrivilege, + SeLoadDriverPrivilege, + SeLockMemoryPrivilege, + SeMachineAccountPrivilege, + SeManageVolumePrivilege, + SeProfileSingleProcessPrivilege, + SeRelabelPrivilege, + SeRemoteShutdownPrivilege, + SeRestorePrivilege, + SeSecurityPrivilege, + SeShutdownPrivilege, + SeSyncAgentPrivilege, + SeSystemEnvironmentPrivilege, + SeSystemProfilePrivilege, + SeSystemtimePrivilege, + SeTakeOwnershipPrivilege, + SeTcbPrivilege, + SeTimeZonePrivilege, + SeTrustedCredManAccessPrivilege, + SeUndockPrivilege, + SeUnsolicitedInputPrivilege, + } +} diff --git a/CleanFlashInstaller/Properties/AssemblyInfo.cs b/CleanFlashInstaller/Properties/AssemblyInfo.cs index c2c2645..132483f 100644 --- a/CleanFlashInstaller/Properties/AssemblyInfo.cs +++ b/CleanFlashInstaller/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Clean Flash Player 34.0.0.155 Installer")] +[assembly: AssemblyTitle("Clean Flash Player 34.0.0.164 Installer")] [assembly: AssemblyDescription("The newest version of Flash Player, patched and ready to go beyond 2021.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("FlashPatch Team")] -[assembly: AssemblyProduct("Clean Flash Player 34.0.0.155 Installer")] +[assembly: AssemblyProduct("Clean Flash Player 34.0.0.164 Installer")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("34.0.0.155")] -[assembly: AssemblyFileVersion("34.0.0.155")] +[assembly: AssemblyVersion("34.0.0.164")] +[assembly: AssemblyFileVersion("34.0.0.164")] diff --git a/CleanFlashInstaller/Properties/Resources.Designer.cs b/CleanFlashInstaller/Properties/Resources.Designer.cs index f8e9d50..76f6e1b 100644 --- a/CleanFlashInstaller/Properties/Resources.Designer.cs +++ b/CleanFlashInstaller/Properties/Resources.Designer.cs @@ -146,23 +146,26 @@ namespace CleanFlashInstaller.Properties { } /// - /// Looks up a localized string similar to [HKEY_LOCAL_MACHINE\Software\Classes\.mfp] - ///"Content Type"="application/x-shockwave-flash" - ///@="MacromediaFlashPaper.MacromediaFlashPaper" - /// - ///[HKEY_LOCAL_MACHINE\Software\Classes\.sol] - ///"Content Type"="text/plain" - /// - ///[HKEY_LOCAL_MACHINE\Software\Classes\.sor] - ///"Content Type"="text/plain" - /// - ///[HKEY_LOCAL_MACHINE\Software\Classes\.spl] - ///"Content Type"="application/futuresplash" - ///@="ShockwaveFlash.ShockwaveFlash" + /// Looks up a localized string similar to [HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayer] + ///"CurrentVersion"="${VERSION_COMMA}" /// - ///[HKEY_LOCAL_MACHINE\Software\Classes\.swf] - ///"Content Type"="application/x-shockwave-flash" - ///@="Sh [rest of string was truncated]";. + ///[HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayer\SafeVersions] + ///"20.0"=dword:ffffffff + ///"21.0"=dword:ffffffff + ///"22.0"=dword:ffffffff + ///"23.0"=dword:ffffffff + ///"24.0"=dword:ffffffff + ///"25.0"=dword:ffffffff + ///"26.0"=dword:ffffffff + ///"27.0"=dword:ffffffff + ///"28.0"=dword:ffffffff + ///"19.0"=dword:ffffffff + ///"30.0"=dword:ffffffff + ///"31.0"=dword:ffffffff + ///"32.0"=dword:ffffffff + ///"33.0"=dword:ffffffff + ///"34.0"=dword:00000089 + ///"16.0"= [rest of string was truncated]";. /// internal static string installOCX { get { diff --git a/CleanFlashInstaller/Properties/Resources.resx b/CleanFlashInstaller/Properties/Resources.resx index 830fc4c..2c3ef01 100644 --- a/CleanFlashInstaller/Properties/Resources.resx +++ b/CleanFlashInstaller/Properties/Resources.resx @@ -1,17 +1,17 @@  - @@ -198,25 +198,7 @@ "DisableExceptionChainValidation"=dword:00000000 - [HKEY_LOCAL_MACHINE\Software\Classes\.mfp] -"Content Type"="application/x-shockwave-flash" -@="MacromediaFlashPaper.MacromediaFlashPaper" - -[HKEY_LOCAL_MACHINE\Software\Classes\.sol] -"Content Type"="text/plain" - -[HKEY_LOCAL_MACHINE\Software\Classes\.sor] -"Content Type"="text/plain" - -[HKEY_LOCAL_MACHINE\Software\Classes\.spl] -"Content Type"="application/futuresplash" -@="ShockwaveFlash.ShockwaveFlash" - -[HKEY_LOCAL_MACHINE\Software\Classes\.swf] -"Content Type"="application/x-shockwave-flash" -@="ShockwaveFlash.ShockwaveFlash" - -[HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayer] + [HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayer] "CurrentVersion"="${VERSION_COMMA}" [HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayer\SafeVersions] @@ -260,17 +242,7 @@ "isESR"=dword:00000000 [HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayerActiveXReleaseType] -"Release"=dword:00000001 - -[HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}] -"Compatibility Flags"=dword:00000000 - -[HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB70-AE6D-11cf-96B8-444553540000}] -"Compatibility Flags"=dword:00010000 - -[HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\NavigatorPluginsList\Shockwave Flash] -"application/futuresplash"="" -"application/x-shockwave-flash"="" +"Release"=dword:00000001 [HKEY_LOCAL_MACHINE\Software\Wow6432Node\Macromedia\FlashPlayer] @@ -317,17 +289,7 @@ "isPartner"=dword:00000001 [HKEY_LOCAL_MACHINE\Software\Wow6432Node\Macromedia\FlashPlayerActiveXReleaseType] -"Release"=dword:00000001 - -[HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}] -"Compatibility Flags"=dword:00000000 - -[HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB70-AE6D-11cf-96B8-444553540000}] -"Compatibility Flags"=dword:00010000 - -[HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Internet Explorer\NavigatorPluginsList\Shockwave Flash] -"application/x-shockwave-flash"="" -"application/futuresplash"="" +"Release"=dword:00000001 [HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayerPepper] @@ -355,4 +317,4 @@ [HKEY_LOCAL_MACHINE\Software\Wow6432Node\Macromedia\FlashPlayerPepperReleaseType] "Release"=dword:00000001 - + \ No newline at end of file diff --git a/CleanFlashUninstaller/Properties/AssemblyInfo.cs b/CleanFlashUninstaller/Properties/AssemblyInfo.cs index 7365197..0f19661 100644 --- a/CleanFlashUninstaller/Properties/AssemblyInfo.cs +++ b/CleanFlashUninstaller/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Clean Flash Player 34.0.0.155 Uninstaller")] +[assembly: AssemblyTitle("Clean Flash Player 34.0.0.164 Uninstaller")] [assembly: AssemblyDescription("The newest version of Flash Player, patched and ready to go beyond 2021.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("FlashPatch Team")] -[assembly: AssemblyProduct("Clean Flash Player 34.0.0.155 Uninstaller")] +[assembly: AssemblyProduct("Clean Flash Player 34.0.0.164 Uninstaller")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("34.0.0.155")] -[assembly: AssemblyFileVersion("34.0.0.155")] +[assembly: AssemblyVersion("34.0.0.164")] +[assembly: AssemblyFileVersion("34.0.0.164")]