Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
TK50P authored Jun 13, 2024
1 parent 97bf0bd commit 62704bf
Show file tree
Hide file tree
Showing 28 changed files with 1,032 additions and 0 deletions.
25 changes: 25 additions & 0 deletions NoMoreDWM.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.34931.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoMoreDWM", "NoMoreDWM\NoMoreDWM.csproj", "{4DA82524-D71B-4045-BD26-6740262DADF7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4DA82524-D71B-4045-BD26-6740262DADF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DA82524-D71B-4045-BD26-6740262DADF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DA82524-D71B-4045-BD26-6740262DADF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DA82524-D71B-4045-BD26-6740262DADF7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3F37ED43-FAFD-4832-90E6-CD50D24D3D9D}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions NoMoreDWM/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="NoMoreDWM.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:NoMoreDWM"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
16 changes: 16 additions & 0 deletions NoMoreDWM/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace NoMoreDWM
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
50 changes: 50 additions & 0 deletions NoMoreDWM/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Window x:Class="NoMoreDWM.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="NoMoreDWM" Height="576" Width="1024">
<Grid>
<TextBlock Text="NoMoreDWM – A simple program to disable Desktop Window Manager"
FontSize="16" FontWeight="Bold"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,20,0,0" />

<Button x:Name="btnDisableDWM"
Content="Disable DWM"
FontSize="20"
FontWeight="Bold"
Width="300"
Height="50"
Background="Black"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0,-50,0,0"
Click="DisableDWM_Click"/>

<Button x:Name="btnEnableDWM"
Content="Enable DWM"
FontSize="20"
FontWeight="Bold"
Width="300"
Height="50"
Background="Black"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0,50,0,0"
Click="EnableDWM_Click"/>

<TextBlock Text="Version 0.1 Beta"
FontSize="12"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Margin="10,0,0,10" />

<TextBlock Text="Programmed by TK50P"
FontSize="12"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="0,0,10,10" />
</Grid>
</Window>
147 changes: 147 additions & 0 deletions NoMoreDWM/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;

namespace NoMoreDWM
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

// Check OS version on startup
if (IsWindows7())
{
MessageBox.Show("This program cannot be run on Windows 7 and earlier. This program requires Windows 8 and later.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
Application.Current.Shutdown();
}
}

private void DisableDWM_Click(object sender, RoutedEventArgs e)
{
if (IsDwmRunning())
{
try
{
string script = @"
if exist %systemroot%\ImmersiveControlPanel takeown /F %systemroot%\ImmersiveControlPanel /R /A & icacls %systemroot%\ImmersiveControlPanel /grant Administrators:(F) /T
if exist %systemroot%\System32\UIRibbon.dll takeown /F %systemroot%\System32\UIRibbon.dll /A & icacls %systemroot%\System32\UIRibbon.dll /grant Administrators:(F)
if exist %systemroot%\System32\UIRibbonRes.dll takeown /F %systemroot%\System32\UIRibbonRes.dll /A & icacls %systemroot%\System32\UIRibbonRes.dll /grant Administrators:(F)
if exist %systemroot%\System32\dwm.exe takeown /F %systemroot%\System32\dwm.exe /A & icacls %systemroot%\System32\dwm.exe /grant Administrators:(F)
if exist %systemroot%\System32\UiRibbon.dll takeown /F %systemroot%\System32\UiRibbon.dll /A & icacls %systemroot%\System32\UiRibbon.dll /grant Administrators:(F)
if exist %systemroot%\System32\UiRibbonRes.dll takeown /F %systemroot%\System32\UiRibbonRes.dll /A & icacls %systemroot%\System32\UiRibbonRes.dll /grant Administrators:(F)
if exist %systemroot%\System32\windows.immersiveshell.serviceprovider.dll takeown /F %systemroot%\System32\windows.immersiveshell.serviceprovider.dll /A & icacls %systemroot%\System32\windows.immersiveshell.serviceprovider.dll /grant Administrators:(F)
if exist %systemroot%\SystemResources takeown /F %systemroot%\SystemResources /R /A & icacls %systemroot%\SystemResources /grant Administrators:(F) /T
taskkill /F /IM ApplicationFrameHost.exe
taskkill /F /IM RuntimeBroker.exe
taskkill /F /IM ShellExperienceHost.exe
taskkill /F /IM SystemSettings.exe
if not exist %systemroot%\System32\UiRibbon.dll.old if exist %systemroot%\System32\UiRibbon.dll ren %systemroot%\System32\UiRibbon.dll UiRibbon.dll.old
if exist %systemroot%\System32\UiRibbon.dll.old if exist %systemroot%\System32\UiRibbon.dll del /q %systemroot%\System32\UiRibbon.dll
if not exist %systemroot%\System32\UiRibbonRes.dll.old if exist %systemroot%\System32\UiRibbonRes.dll ren %systemroot%\System32\UiRibbonRes.dll UiRibbonRes.dll.old
if exist %systemroot%\System32\UiRibbonRes.dll.old if exist %systemroot%\System32\UiRibbonRes.dll del /q %systemroot%\System32\UiRibbonRes.dll
if not exist %systemroot%\SystemResources.old if exist %systemroot%\SystemResources ren %systemroot%\SystemResources SystemResources.old
if exist %systemroot%\SystemResources.old if exist %systemroot%\SystemResources rmdir /S /Q %systemroot%\SystemResources
reg add ""HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer"" /v ""AltTabSettings"" /t REG_DWORD /d ""0"" /f
reg add ""HKCU\Software\Microsoft\Windows\DWM"" /v ""CompositionPolicy"" /t REG_DWORD /d ""0"" /f
reg add ""HKLM\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\TestHooks"" /v ""ConsoleMode"" /t REG_DWORD /d ""1"" /f
reg add ""HKLM\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\TestHooks"" /v ""XamlCredUIAvailable"" /t REG_DWORD /d ""0"" /f
reg add ""HKLM\System\CurrentControlSet\Services\Themes"" /v ""Start"" /t REG_DWORD /d ""4"" /f
if exist %systemroot%\System32\dwm.exe takeown /F %systemroot%\System32\dwm.exe /A & icacls %systemroot%\System32\dwm.exe /grant Administrators:(F)
if not exist %systemroot%\System32\dwm.exe.old if exist %systemroot%\System32\dwm.exe ren %systemroot%\System32\dwm.exe dwm.exe.old
if exist %systemroot%\System32\dwm.exe.old if exist %systemroot%\System32\dwm.exe del /q %systemroot%\System32\dwm.exe
echo N| copy/-Y ""%systemroot%\System32\rundll32.exe"" ""%systemroot%\System32\dwm.exe""
";

string batFilePath = Path.Combine(Path.GetTempPath(), "DisableDWM.bat");
File.WriteAllText(batFilePath, script);

ProcessStartInfo psi = new ProcessStartInfo
{
FileName = batFilePath,
UseShellExecute = true,
Verb = "runas",
WindowStyle = ProcessWindowStyle.Hidden
};

Process.Start(psi);

MessageBox.Show("DWM disable script executed.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch (Exception ex)
{
MessageBox.Show("An error occurred: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
else
{
MessageBox.Show("DWM is already disabled.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}

private void EnableDWM_Click(object sender, RoutedEventArgs e)
{
if (!IsDwmRunning())
{
try
{
string script = @"
if not exist %systemroot%\System32\UiRibbon.dll if exist %systemroot%\System32\UiRibbon.dll.old ren %systemroot%\System32\UiRibbon.dll.old UiRibbon.dll
if exist %systemroot%\System32\UiRibbon.dll if exist %systemroot%\System32\UiRibbon.dll.old del /q %systemroot%\System32\UiRibbon.dll.old
if not exist %systemroot%\System32\UiRibbonRes.dll if exist %systemroot%\System32\UiRibbonRes.dll.old ren %systemroot%\System32\UiRibbonRes.dll.old UiRibbonRes.dll
if exist %systemroot%\System32\UiRibbonRes.dll if exist %systemroot%\System32\UiRibbonRes.dll.old del /q %systemroot%\System32\UiRibbonRes.dll.old
if not exist %systemroot%\System32\Windows.UI.Logon.dll if exist %systemroot%\System32\Windows.UI.Logon.dll.old ren %systemroot%\System32\Windows.UI.Logon.dll.old Windows.UI.Logon.dll
if exist %systemroot%\System32\Windows.UI.Logon.dll if exist %systemroot%\System32\Windows.UI.Logon.dll.old del /q %systemroot%\System32\Windows.UI.Logon.dll.old
if not exist %systemroot%\SystemResources if exist %systemroot%\SystemResources.old ren %systemroot%\SystemResources.old SystemResources
if exist %systemroot%\ShellExperienceHost_cw5n1h2txyewy if exist %systemroot%\SystemResources.old rmdir /S /Q %systemroot%\SystemResources.old
reg delete ""HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer"" /v ""AltTabSettings"" /f
reg delete ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\TestHooks"" /v ""ConsoleMode"" /f
reg delete ""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\TestHooks"" /v ""XamlCredUIAvailable"" /f
reg add ""HKCU\Software\Microsoft\Windows\DWM"" /v ""CompositionPolicy"" /t REG_DWORD /d ""1"" /f
reg add ""HKLM\SYSTEM\CurrentControlSet\Services\Themes"" /v ""Start"" /t REG_DWORD /d ""2"" /f
del %systemroot%\System32\dwm.exe
if exist %systemroot%\System32\dwm.exe.old takeown /F %systemroot%\System32\dwm.exe.old /A & icacls %systemroot%\System32\dwm.exe.old /grant Administrators:(F)
if not exist %systemroot%\System32\dwm.exe if exist %systemroot%\System32\dwm.exe.old ren %systemroot%\System32\dwm.exe.old dwm.exe
";

string batFilePath = Path.Combine(Path.GetTempPath(), "EnableDWM.bat");
File.WriteAllText(batFilePath, script);

ProcessStartInfo psi = new ProcessStartInfo
{
FileName = batFilePath,
UseShellExecute = true,
Verb = "runas",
WindowStyle = ProcessWindowStyle.Hidden
};

Process.Start(psi);

MessageBox.Show("DWM enable script executed.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch (Exception ex)
{
MessageBox.Show("An error occurred: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
else
{
MessageBox.Show("DWM is already running.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}

private bool IsDwmRunning()
{
return Process.GetProcessesByName("dwm").Any();
}

private bool IsWindows7()
{
var os = Environment.OSVersion;
return os.Platform == PlatformID.Win32NT && os.Version.Major <= 6 && os.Version.Minor <= 1;
}
}
}
89 changes: 89 additions & 0 deletions NoMoreDWM/NoMoreDWM.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4DA82524-D71B-4045-BD26-6740262DADF7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>NoMoreDWM</RootNamespace>
<AssemblyName>NoMoreDWM</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
55 changes: 55 additions & 0 deletions NoMoreDWM/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

// 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("NoMoreDWM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoMoreDWM")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]


// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading

0 comments on commit 62704bf

Please sign in to comment.