-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
592 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "libs/libvalinet"] | ||
path = libs/libvalinet | ||
url = https://github.com/valinet/libvalinet |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.31624.102 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Win11DisableRoundedCorners", "Win11DisableRoundedCorners\Win11DisableRoundedCorners.vcxproj", "{C4A6832A-9AE5-4AA5-A424-15CF8179F318}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C4A6832A-9AE5-4AA5-A424-15CF8179F318}.Debug|x64.ActiveCfg = Debug|x64 | ||
{C4A6832A-9AE5-4AA5-A424-15CF8179F318}.Debug|x64.Build.0 = Debug|x64 | ||
{C4A6832A-9AE5-4AA5-A424-15CF8179F318}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{C4A6832A-9AE5-4AA5-A424-15CF8179F318}.Debug|x86.Build.0 = Debug|Win32 | ||
{C4A6832A-9AE5-4AA5-A424-15CF8179F318}.Release|x64.ActiveCfg = Release|x64 | ||
{C4A6832A-9AE5-4AA5-A424-15CF8179F318}.Release|x64.Build.0 = Release|x64 | ||
{C4A6832A-9AE5-4AA5-A424-15CF8179F318}.Release|x86.ActiveCfg = Release|Win32 | ||
{C4A6832A-9AE5-4AA5-A424-15CF8179F318}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {90C55F7D-8015-422B-A5E1-F1DC4F34418A} | ||
EndGlobalSection | ||
EndGlobal |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// Microsoft Visual C++ generated resource script. | ||
// | ||
#include "resource.h" | ||
|
||
#define APSTUDIO_READONLY_SYMBOLS | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 2 resource. | ||
// | ||
#include "winres.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#undef APSTUDIO_READONLY_SYMBOLS | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// English (United States) resources | ||
|
||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) | ||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | ||
#pragma code_page(1252) | ||
|
||
#ifdef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// TEXTINCLUDE | ||
// | ||
|
||
1 TEXTINCLUDE | ||
BEGIN | ||
"resource.h\0" | ||
END | ||
|
||
2 TEXTINCLUDE | ||
BEGIN | ||
"#include ""winres.h""\r\n" | ||
"\0" | ||
END | ||
|
||
3 TEXTINCLUDE | ||
BEGIN | ||
"\r\n" | ||
"\0" | ||
END | ||
|
||
#endif // APSTUDIO_INVOKED | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Version | ||
// | ||
|
||
VS_VERSION_INFO VERSIONINFO | ||
FILEVERSION 1,0,0,1 | ||
PRODUCTVERSION 1,0,0,1 | ||
FILEFLAGSMASK 0x3fL | ||
#ifdef _DEBUG | ||
FILEFLAGS 0x1L | ||
#else | ||
FILEFLAGS 0x0L | ||
#endif | ||
FILEOS 0x40004L | ||
FILETYPE 0x1L | ||
FILESUBTYPE 0x0L | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "040904b0" | ||
BEGIN | ||
VALUE "CompanyName", "VALINET Solutions SRL" | ||
VALUE "FileDescription", "Disables rounded corners in Windows 11" | ||
VALUE "FileVersion", "1.0.0.1" | ||
VALUE "InternalName", "Win11DisableRoundedCorners.exe" | ||
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved." | ||
VALUE "OriginalFilename", "Win11Dis.exe" | ||
VALUE "ProductName", "Win11DisableRoundedCorners" | ||
VALUE "ProductVersion", "1.0.0.1" | ||
END | ||
END | ||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x409, 1200 | ||
END | ||
END | ||
|
||
#endif // English (United States) resources | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
|
||
#ifndef APSTUDIO_INVOKED | ||
///////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Generated from the TEXTINCLUDE 3 resource. | ||
// | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
#endif // not APSTUDIO_INVOKED | ||
|
246 changes: 246 additions & 0 deletions
246
Win11DisableRoundedCorners/Win11DisableRoundedCorners.c
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
#undef UNICODE | ||
#include <Windows.h> | ||
#include <valinet/pdb/pdb.h> | ||
#include <valinet/utility/memmem.h> | ||
#include <valinet/utility/takeown.h> | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
char szTaskkill[MAX_PATH]; | ||
ZeroMemory( | ||
szTaskkill, | ||
(MAX_PATH) * sizeof(char) | ||
); | ||
szTaskkill[0] = '\"'; | ||
GetSystemDirectoryA( | ||
szTaskkill + sizeof(char), | ||
MAX_PATH | ||
); | ||
strcat_s( | ||
szTaskkill, | ||
MAX_PATH, | ||
"\\taskkill.exe\" /f /im dwm.exe" | ||
); | ||
|
||
char szPath[_MAX_PATH]; | ||
ZeroMemory( | ||
szPath, | ||
(_MAX_PATH) * sizeof(char) | ||
); | ||
GetModuleFileNameA( | ||
GetModuleHandle(NULL), | ||
szPath, | ||
_MAX_PATH | ||
); | ||
PathStripPathA(szPath); | ||
|
||
char szOriginalDWM[_MAX_PATH]; | ||
ZeroMemory( | ||
szOriginalDWM, | ||
(_MAX_PATH) * sizeof(char) | ||
); | ||
GetSystemDirectoryA( | ||
szOriginalDWM, | ||
MAX_PATH | ||
); | ||
strcat_s( | ||
szOriginalDWM, | ||
MAX_PATH, | ||
"\\uDWM_win11drc.bak" | ||
); | ||
|
||
char szModifiedDWM[_MAX_PATH]; | ||
ZeroMemory( | ||
szModifiedDWM, | ||
(_MAX_PATH) * sizeof(char) | ||
); | ||
if (!strcmp(szPath, "Win11RestoreRoundedCorners.exe")) | ||
{ | ||
GetSystemDirectoryA( | ||
szModifiedDWM, | ||
MAX_PATH | ||
); | ||
strcat_s( | ||
szModifiedDWM, | ||
MAX_PATH, | ||
"\\uDWMm.dll" | ||
); | ||
} | ||
else | ||
{ | ||
GetModuleFileNameA( | ||
GetModuleHandle(NULL), | ||
szModifiedDWM, | ||
_MAX_PATH | ||
); | ||
PathRemoveFileSpecA(szModifiedDWM); | ||
strcat_s( | ||
szModifiedDWM, | ||
MAX_PATH, | ||
"\\uDWM.dll" | ||
); | ||
} | ||
|
||
char szDWM[MAX_PATH]; | ||
ZeroMemory( | ||
szDWM, | ||
(MAX_PATH) * sizeof(char) | ||
); | ||
GetSystemDirectoryA( | ||
szDWM, | ||
MAX_PATH | ||
); | ||
strcat_s( | ||
szDWM, | ||
MAX_PATH, | ||
"\\uDWM.dll" | ||
); | ||
|
||
if (!strcmp(szPath, "Win11RestoreRoundedCorners.exe")) | ||
{ | ||
DeleteFileA(szModifiedDWM); | ||
if (!MoveFileA(szDWM, szModifiedDWM)) | ||
{ | ||
printf("Unable to restore DWM.\n"); | ||
_getch(); | ||
return 1; | ||
} | ||
if (!MoveFileA(szOriginalDWM, szDWM)) | ||
{ | ||
printf("Unable to restore DWM.\n"); | ||
_getch(); | ||
return 2; | ||
} | ||
} | ||
else | ||
{ | ||
if (!CopyFileA(szDWM, szModifiedDWM, FALSE)) | ||
{ | ||
printf( | ||
"Temporary file copy failed. Make sure the application has write " | ||
"access to the folder it runs from.\n" | ||
); | ||
_getch(); | ||
return 1; | ||
} | ||
if (VnDownloadSymbols( | ||
NULL, | ||
szModifiedDWM, | ||
szModifiedDWM, | ||
_MAX_PATH | ||
)) | ||
{ | ||
printf( | ||
"Unable to download symbols. Make sure you have a working Internet " | ||
"connection.\n" | ||
); | ||
_getch(); | ||
return 2; | ||
} | ||
DWORD addr[1] = { 0 }; | ||
char* name[1] = { "CTopLevelWindow::GetEffectiveCornerStyle" }; | ||
if (VnGetSymbols( | ||
szModifiedDWM, | ||
addr, | ||
name, | ||
1 | ||
)) | ||
{ | ||
printf("Unable to determine function address.\n"); | ||
_getch(); | ||
return 3; | ||
} | ||
printf("Function address is: 0x%x\n", addr[0]); | ||
DeleteFile(szModifiedDWM); | ||
PathRemoveFileSpecA(szModifiedDWM); | ||
strcat_s( | ||
szModifiedDWM, | ||
MAX_PATH, | ||
"\\uDWM.dll" | ||
); | ||
HANDLE hFile = CreateFileA( | ||
szModifiedDWM, | ||
GENERIC_READ | GENERIC_WRITE, | ||
FILE_SHARE_READ, | ||
NULL, | ||
OPEN_EXISTING, | ||
FILE_ATTRIBUTE_NORMAL, | ||
0 | ||
); | ||
if (!hFile) | ||
{ | ||
printf("Unable to open system file.\n"); | ||
_getch(); | ||
return 4; | ||
} | ||
HANDLE hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, NULL); | ||
if (hFileMapping == 0) | ||
{ | ||
printf("Unable to create file mapping.\n"); | ||
_getch(); | ||
return 5; | ||
} | ||
char* lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0); | ||
if (lpFileBase == 0) | ||
{ | ||
printf("Unable to memory map system file.\n"); | ||
_getch(); | ||
return 6; | ||
} | ||
char szPattern[9] = { 0x8B, 0xC1, 0x48, 0x83, 0xC4, 0x20, 0x5B, 0xC3 }; | ||
char szPayload[2] = { 0x31, 0xC0 }; // xor eax, eax | ||
char* off = memmem(lpFileBase + addr[0], 1000, szPattern, 8); | ||
if (!off) | ||
{ | ||
printf("Unable to find pattern in file.\n"); | ||
_getch(); | ||
return 7; | ||
} | ||
memcpy(off, szPayload, sizeof(szPayload)); | ||
UnmapViewOfFile(lpFileBase); | ||
CloseHandle(hFileMapping); | ||
CloseHandle(hFile); | ||
if (!VnTakeOwnership(szDWM)) | ||
{ | ||
printf("Unable to take ownership of system file.\n"); | ||
_getch(); | ||
return 7; | ||
} | ||
DeleteFileA(szOriginalDWM); | ||
if (!MoveFileA(szDWM, szOriginalDWM)) | ||
{ | ||
printf("Unable to backup system file.\n"); | ||
_getch(); | ||
return 7; | ||
} | ||
if (!CopyFileA(szModifiedDWM, szDWM, FALSE)) | ||
{ | ||
printf("Unable to replace system file.\n"); | ||
_getch(); | ||
return 1; | ||
} | ||
DeleteFileA(szModifiedDWM); | ||
} | ||
STARTUPINFO si = { sizeof(si) }; | ||
PROCESS_INFORMATION pi; | ||
BOOL b = CreateProcessA( | ||
NULL, | ||
szTaskkill, | ||
NULL, | ||
NULL, | ||
TRUE, | ||
CREATE_UNICODE_ENVIRONMENT, | ||
NULL, | ||
NULL, | ||
&si, | ||
&pi | ||
); | ||
WaitForSingleObject(pi.hProcess, INFINITE); | ||
Sleep(1000); | ||
if (!strcmp(szPath, "Win11RestoreRoundedCorners.exe")) | ||
{ | ||
DeleteFileA(szModifiedDWM); | ||
} | ||
printf("Operation successful.\n"); | ||
return 0; | ||
} |
Oops, something went wrong.