Comments (10)
Finally, so people can stop using this. Tbh, I never expected this to be such a hit.
In the mean time, I also implemented a run time patch for dwm that restores sharp corners: https://github.com/valinet/ep_dwm. It’s integrated in ExplorerPatcher as well. My approach was to patch the instructions that set the radius of the corners. I found that to be relatively easy to match by pattern.
I personally like your idea more. It occurred to me where the flag for rounded corners is stored as well, by studying the disassembly, but never thought of identifying the address of the desktop manager instance from the exported startup function by matching against a certain mov instruction which corresponds to working with the address of that. Neat patch, I hope it lasts through, and that the compiler doesn’t mess with the specific register on future versions (it shouldn’t). Once you get the g_pdmInstance, it is indeed a piece of cake to go and change the flag in the structure (class) directly.
But anyway, great idea, nice find and work. It’s also a good example of writing modern C++, a nice change from my usual archaic C code. I will look into integrating your mod into ExplorerPatcher as well, it’s easier to maintain and fix going forward I believe, so maybe it’s time to deprecate my second method as well (ep_dwm). As for this repo, yeah, I always recommended ExplorerPatcher since I implemented ep_dwm and integrated it there.
Again, thanks for the heads up and neat code. Looking forward to more of your contributions, maybe in the ExplorerPatcher area as well :D
from win11disableroundedcorners.
One mention: I’d appreciate a less aggressive tone. I know patching files is not a good idea, this was more of a proof of concept rather than a full implementation, developed just as Windows 11 released, like a year ago or so. In the mean time I also developed, as I said, a memory based solution, so yeah, I don’t know if calling this project out indirectly both in your project’s description and in this issue’s title here is that necessary.
from win11disableroundedcorners.
Hi guys, FYI I ported this project to a Windhawk mod due to a user's request, such that no file patching is necessary:
https://windhawk.net/mods/disable-rounded-corners
I thought you might find this interesting.
from win11disableroundedcorners.
Thanks for the feedback, I've toned it down a notch.
I didn't realize you were the guy behind Explorer Patcher, I've seen that repo before.
You've definitely collected a lot of neat little patches there. I'm totally gonna get me a different Window Switcher cause this new rounded thing is obnoxious.
from win11disableroundedcorners.
Thanks. Indeed, and quite a ton of work maintaining it, so as I said, every helping hand is more than welcome. Take a look on https://github.com/valinet/sws if you want, for example, there are definitely things to improve and optimize.
from win11disableroundedcorners.
I took the time to study this more in-depth, since I was looking at integrating your code in the ep_dwm
project as well, as an option.
Basically, this structure of g_pdmInstance
that you describe in the code:
struct desktop_manager_proto
{
void *unknown0[3];
uint8_t unknown1[2];
bool rounded_shadow_enabled;
bool enable_sharp_corners;
bool enable_rounded_corners;
};
I already described it in my blog post here as well, I suggest taking a look at it if you haven't already:
enable_sharp_corners
actually describes todwm
whether the software (WARP) graphics adapter (Microsoft Basic Display Adapter) is used (*((_BYTE *)CDesktopManager::s_pDesktopManagerInstance + 27)
in my write-up)enable_rounded_corners
actually describes whether the rounded corners effect is forced by user setting ofForceEffectMode
to2
inHKLM\Software\Microsoft\Windows\Dwm
(!*((_BYTE *)CDesktopManager::s_pDesktopManagerInstance + 28)
in my write-up) - you can set that registry entry under a Vm/system without graphics drivers installed, which shows sharp corners, to force it to draw rounded corners for windows in software- there is also this:
*((int *)CDesktopManager::s_pDesktopManagerInstance + 8) >= 2
which is a flag which indicates the user is under some remote desktop scenario
All these flags are checked against when determining what corner style to use in CTopLevelWindow::GetEffectiveCornerStyle
.
Also in the blog post, I already experimented with overriding enable_sharp_corners
(having it think the WARP adapter is always in use) or CDesktopManager::s_pDesktopManagerInstance + 8
(same thing, either side of the ||
in the if
from GetEffectiveCornerStyle
). The effect can be seen "naturally" when you do not have display drivers installed as well, and is also indeed achieved by your program: the corners are indeed sharp, yet context menus and some windows (like the UAC prompt, or the Windows Security boxes that appear, for example, when entering a user name for Remote Desktop Connection) lack a drop shadow which may make them look unnatural. This, while context menus do indeed get a solid black or white border depending on their color:
win11-toggle-rounded-corners
on the left, ep_dwm
on the right
I think this is important to note, as it makes some things hard to distinguish under certain scenarios. My ep_dwm
patch is based on the idea of tricking the "rounded corners code path" into using a very small radius for the corners, so small that it looks basically square/sharp. The blog post, again, describes how I achieved that in 22000-based builds, while the code shows the updated patterns for 22621+-based builds.
I don't know, maybe it's worth considering this approach as well, what do you think? It's a completely different logic indeed, but it seems to provide a more robust effect when it comes to all scenarios. In the mean time, I will also think on whether to compile in your code in ep_dwm
as well and have it as an option behind some registry flag. I already have it compiled in on my local machine and it seems to work just fine, with the caveats mentioned above.
But yeah, your approach is nevertheless better than the original "Win11DisableRoundedCorners" project.
from win11disableroundedcorners.
I've looked into the functions you mentioned in your blog post, seems like the best way for proper edges/shadow could be to just modify the floats in .rdata
CTopLevelWindow::UpdateWindowVisuals
FLOAT_4_0 = 0.001, FLOAT_8_0 = 0.001
If we could just write to the CTopLevelWindow fields that would of course be ideal but I'm guessing every window has its own instance of the class and we'd probably have to go through a bunch of internal structures to get to them.
from win11disableroundedcorners.
I have implemented this method on the 'patching' branch in my repo: https://github.com/oberrich/win11-toggle-rounded-corners/blob/patching/main.cpp#L107
from win11disableroundedcorners.
from win11disableroundedcorners.
Almost all of it is related to the window borders:
The only unrelated thing that gets modified is inside CDesktopWindowReplacement::_AddPPIRectangleInstruction
This doesn't have any drawbacks on my machine as the code path only gets executed for machines with product type 0x77
from win11disableroundedcorners.
Related Issues (20)
- Do you think you could find the right function to patch to make window borders thicker?
- Could you by any chance port rounded corners to Windows 10?
- brush on Paint.NET squared HOT 1
- I wrote a small batch file to solve the "Unable to restore DWM" error. HOT 4
- Easiest way to disable rounded corners (no patching/adapter required) HOT 5
- Unable to determine function address. HOT 7
- Uninstallation? HOT 1
- pc bricked HOT 3
- Black main screen on install HOT 1
- Can you get rid of rounded corner on start menu?
- black box filling 1 out of 5 of my screen
- Successfully changed DACL. Unable to prepare for replacing system file. HOT 1
- Black screen while dragging window HOT 1
- `Unable to determine function address.` in 10.0.22621 Build 22621
- Stopped working on the latest windows 11 version :( HOT 8
- Running this program causes exploer to lose dekstop icons and everything in the sidebar in the file explorer.
- Some pop-up dialogs broken
- Logoff after DWM ends
- Grey borders appear when windows are in split screen view
- useless after 26120.770 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from win11disableroundedcorners.