valinet/Win11DisableRoundedCorners

ARM

Serentty opened this issue · 3 comments

Will this patch work properly on ARM versions of Windows 11? That’s what I’m running on my Mac. I don’t want to try without asking in case it downloads the wrong DLL.

As it currently stands, no, it won't. This patches bytes in the file. Those bytes represent instructions for the specific architecture the file is intended to run on. I have implemented the patch for amd64, because that's what I use and that's what I had access to regarding disassembly tools. Since amd64 and ARM64 instruction sets are completely different, a completely different patch has to be developed for AMD64. This is the only if not the one of the few methods for such a patch, since this part of the OS is completely closed source, so one can't compile their own version.

The principle of this patch probably applies to the ARM64 version of Windows as well, but the actual content has to be different, according to the particular architecture. If we look at uDWM.dll from ARM64 Windows 11, and identify the CTopLevelWindow::GetEffectiveCornerStyle function in there as well based on the symbols, what has to be changed is the actual bytes that we write. I don't know exactly with that at the moment, I know much less ARM assembly than x86, but basically make that function return 0 (on amd64, it's a simple mov rax, 0; ret, or xor rax, rax; ret). That should be it. The rest of the program should be left intact, even not bothering to compile it as native ARM64, as ARM64 Windows emulates amd64 and you run it one time only and it does very few things, so how slow or battery consuming can it be...

Also, I can't test this at all, since I do not have an ARM64 machine.

Patching manually is an option as well. Find the address of CTopLevelWindow::GetEffectiveCornerStyle and write corresponding bytes there to achieve what I said above. You can use PDBDownloader to download the symbol file for uDWM.dll manually, and then pdbdump to search for GetEffectiveCornerStyle in it, as described here: valinet/ExplorerPatcher#183. Substract the base address from that (usually 0x400000, but idk exactly on amd64) and then, in some hex editor, go there and change the bytes to do the equivalent in ARM64 of amd64's mov rax, 0; ret and that should be it.

Making that patch doesn’t seem too hard. I’ve done minor edits like this before. If I find the time I might try at some point.

Yeah, indeed, it’s not that hard, please consider contributing back if you pull it off eventually. It’s hard for me to push something, beside having to research the assembly a bit, also I have absolutely nothing to test it on…