Visual Styles Engine not so "native" afterall?

In the course of getting IE scrollbars working with WindowBlinds we discovered something rather shocking. Something that we're quite sure that no one outside Microsoft was aware of - visual styles are implemented quite like a hack. Not at all how we thought they were.

On Windows XP, WindowBlinds is able to use the new APIs in uxtheme.dll to skin Windows. We did this because we *thought* that this would make it more compatible and faster.

But we discovered today that the Windows XP visual style engine (drum roll) uses API HOOKS to do its things. Remember how certain advocates of a certain patch have made a big deal that WindowBlinds uses system hooks? And as a result, we're not as "native" as visual styles? Turns out, visual styles are doing the same thing - system hooks. EVERY PROCESS on XP that is skinned by XP has uxtheme.dll tied to it.

Let me be clear: If you run visual styles on Windows XP, every program that is "skinned" by it gets a full copy of uxtheme.dll copied into memory via a system hook (just like if you run WindowBlinds you get a copy of wblind.dll copied into that process's memory).

What this also means is that anyone who criticizes WindowBlinds for using system hooks and uses that as a reason to boost visual styles is either being dishonest or doesn't understand how visual styles actually work. It is, frankly, very surprising that Microsoft, with access to the Windows source code one presumes, would implement it in this way.

Now obviously, since WindowBlinds works much the same way, I'm not going to condemn it. System hooks were designed so that third parties could integrate their software with the system with a minimal impact. It's just that MS isn't a third party. And that anti-WindowBlinds people have used the SetWindowsHookEx (system hooks in general) as a blunt instrument on it when all the time visual styles uses a nearly identical hook and attaches the entire uxtheme.dll to each and every process that it skins.

In short, visual styles are most definitely no more "native" than WindowBlinds. It's just bundled. Any third party could have done (and has done in the form of WB) the same exact thing without access to the source code of Windows.
4,639 views 9 replies
Reply #1 Top
So from a technical point of view is there any advantage to using what amounts to as a MS-wrapper API around system hooking versus using the hooks directly? Is there any value-add that the theming DLL provides?


Just curious.
Reply #2 Top
Probably just more maintainable for the developers. I put wrappers around my stuff all the time so that the poor victim who comes after me has what amoutns to functions that perform a batch of functions.

It's just staggering that Microsoft, who has the source code to Windows (maybe?) would implement their visual styles in this way.

It would not be much of an exageration to say that the only difference between WindowBlinds and MS visual styles are the skin formats they support and hence the advantages and disavantages of each are what matter.

BTW, for any independent third party that wants to look at this, download a program that allows you to look at the modules that are loaded when you start a process. YOu'll see that uxtheme.dll is hooked into every one that is skinned by XP.
Reply #3 Top
Amazing... who would have thought they wouldn't have taken the chance to release XP and build the skinning in natively. I suppose they had their reasons... whatever they were
Reply #4 Top
This is probably why there's still the Classic look. Perhaps they've done it as a consession to those diehards out there that are viciously anti-skins ("skinning sucks up all resources"), maybe they did not have access to the source-code, just the API. Or perhaps it's done for stability reasons, I've already crashed the themes engine and I've only just ran XP a couple of times. Were it integrated more, it might bring the sytem down on a crash (or perhaps it wouldn't, I don't know).
Reply #5 Top
/me decides to play devils advocate

so does this mean that someone can argue that WB is still making a heavier demand than XP skining?

it sounds like XP adds this dll to every skinned process. but WB3 uses this dll, plus its own, so it adds a greater load to every process.

/me gets board of the devil

not having XP, this is basically academic to me, but still very amusing

perhaps microsoft did it this way to encpsulate their skinning, and to keep it away from windows. remember, they are supposed to have admited that it contains "literally hundreds" of bugs. doesnt sound like something i would want to link in to tightly to the OS.
Reply #6 Top
It's all an evil conspiracy to get us poor user to by new machines. Preferably Hewlett Packard or Compaq... and Intel ofcourse...
Reply #7 Top
and thats only the first stage!
later stages are even more terrifying!
Reply #8 Top
No, WB doesn't attach uxtheme.dll to every process, just wblind.dll which is much more lightweight (due to years of optimizing and having to worry about Win98/ME which have a low resource useage threshold of pain).
Reply #9 Top
this pain is very real
for the second time today all my windows title bars and borders, along with half the content, have just disapeared from the screen.

running out of resorces on win98 all the time just isnt healthy!