MSFN Forum: Aero Glass for Win8 RC1 - MSFN Forum

Jump to content


  • 91 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Aero Glass for Win8 RC1 !!! for experienced beta testers only !!!

#1 User is offline   bigmuscle 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 320
  • Joined: 18-August 12
  • OS:none specified
  • Country: Country Flag

Posted 22 January 2013 - 03:09 PM

Aero Glass for Win8 RC1
Hello,

maybe somebody will be interested in my small project. Therefore, I am sharing the first information about it. I have managed to reimplement Aero Glass function into Windows 8 Desktop Window Manager.

How does it work?
I have developed DLL library in C++ which is injected into dwm.exe process (no system files replacement is required). Then, the functions used for window border drawing are hooked with my own implementation. This ensures that anytime DWM wants to draw the window border, the code is redirected into my library where I change the drawing parameters and redirect back to the original drawing function. Transparent window border wih blur effect is drawn!

Is it completely new implementation?
Just a partially. Since a lot of Aero Glass resources is still present in Win8, I'm trying to reuse them as much as possible. The blur effect is implemented completely in Direct3D with using of native shaders a system settings. With some small exceptions, I just call the same commands as they would be called by Windows itself (e.g. in Win7 or Win8 RP).

Are there any drawbacks?
There is a main problem that DWM implements occlusion regions management which ensures that only visible regions of the screen are redrawn. This simply does not draw the content which is obscured by other windows. And, unfortunately, it pays for the content under window border too. Thus, it requires to force DWM draw content under transparent borders. This can be implemented on low-level only - it means calling or hooking the internal DWM object methods which requires to know their exact memory locations (or relative offsets). This is relatively simple but the offsets can change with new version of DWM component.

The other problem lies in loading library into memory, because - for correct function - it has to be loaded together with DWM process but before creation of its internal objects. Currently, the method of DLL injection via AppInit_DLLs registry key is used but it is not supported when UEFI secure boot is enabled.

Link for downloading:
https://developer.be...?group_id=13124

--> installer will be available with final release, now only manual script available
--> registry script is attached in the archive but you must manually edit the file to point to the location where you extract DLL file
--> the glass will automatically load at Windows startup
--> if your computer won't boot up for some reason (glass failure), hold CTRL key during DWM loading and no procedure will be installed into memory
--> since Win8 default color schemes are not prepared for glass feature, the transparency effect can be very low. In such case, you must modify color settings in Windows Control Panel.
--> if you use custom theme which has hardcoded fully opaque borders, the effect won't be visible

If there is any bug and DWM crashes, it will generate crash log (using attached PDB files) in the folder where you extracted DLL to.

I hope you will like it :-)

Attached File(s)


This post has been edited by bigmuscle: 17 May 2013 - 08:23 AM



#2 User is online   vinifera 

  • <°)))><
  • PipPipPipPip
  • Group: Members
  • Posts: 583
  • Joined: 27-August 09
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 22 January 2013 - 05:53 PM

go for it
many people using w8 will surely be thankfull

#3 User is offline   xpclient 

  • XP was my idea. I had to fight Windows 7 to make it my idea
  • PipPip
  • Group: Members
  • Posts: 233
  • Joined: 30-July 05
  • OS:XP Pro x64
  • Country: Country Flag

Posted 22 January 2013 - 10:40 PM

The blur effect looks nice!! What about the Taskbar and Windows Explorer title bars? :)

This post has been edited by xpclient: 22 January 2013 - 10:41 PM


#4 User is offline   MagicAndre1981 

  • after Windows 7 GA still Vista lover :)
  • Group: Patrons
  • Posts: 4,972
  • Joined: 28-August 05
  • OS:Vista Ultimate x86
  • Country: Country Flag

Posted 22 January 2013 - 11:08 PM

awesome. Can I test it? Send me a PM, please :)

#5 User is offline   Tihiy 

  • the creator
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,609
  • Joined: 19-November 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 23 January 2013 - 06:13 AM

Totally awesome. I will help you with this if i can :rolleyes:

#6 User is offline   bigmuscle 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 320
  • Joined: 18-August 12
  • OS:none specified
  • Country: Country Flag

Posted 23 January 2013 - 10:10 AM

View Postxpclient, on 22 January 2013 - 10:40 PM, said:

The blur effect looks nice!! What about the Taskbar and Windows Explorer title bars? :)


I have not played with the taskbar yet. But since the taskbar texture is easily identifiable it should not be so hard to add blur effect beneath the taskbar. To Explorer, Win8 Explorer has standard titlebar (unlike Win7) so it works as any other window. Maybe we could try to call DwmExtendFrameIntoClientArea on WinExplorer windows to see what happens :-)

Currently, I have two serious bugs to solve now then I will provide a test version:

1) To hook drawing functions properly, Direct3D device pointer must identified. It is easily possible by hooking D3D11CreateDevice (which provides pointer to D3D 11 device) and then device->QueryInterface (which provides pointer to D3D 10.1 device which is used for desktop composition). The problem is that DWM calls these two functions only on startup or when video adapter is restarted (e.g. via Device manager). I have not found a correct way to do it automatically. In Windows 7, this was possible by calling DwmEnableComposition(DISABLE...) and DwmEnableComposition(ENABLE...) but this has no effect on Windows 8.

2) Blur algorithm works by averaging the neighboring pixels. The problem is that pixels on the edge have no neighboring pixels on one side and therefore blurred pixel is computed from some random value. This is no problem for window edge because it won't be so noticeable there (you can notice it at my preview picture, upper edge of "O produktu Windows" window). The problem is when DWM wants to repaint only a part of window border. Then you will see these "edge pixels" at the edge of the clipped region (which can be e.g. in the middle of the titlebar).

#7 User is offline   hb860 

  • Group: Members
  • Posts: 8
  • Joined: 23-January 13
  • OS:ME
  • Country: Country Flag

Posted 23 January 2013 - 10:40 AM

This looks very promising :)

This post has been edited by hb860: 23 January 2013 - 10:40 AM


#8 User is offline   MagicAndre1981 

  • after Windows 7 GA still Vista lover :)
  • Group: Patrons
  • Posts: 4,972
  • Joined: 28-August 05
  • OS:Vista Ultimate x86
  • Country: Country Flag

Posted 23 January 2013 - 01:37 PM

View Postbigmuscle, on 23 January 2013 - 10:10 AM, said:

I have not found a correct way to do it automatically. In Windows 7, this was possible by calling DwmEnableComposition(DISABLE...) and DwmEnableComposition(ENABLE...) but this has no effect on Windows 8.


this is "by design". Composition is always active in Windows 8:

http://msdn.microsof...v=vs.85%29.aspx

Quote

Note This function is deprecated as of Windows 8. DWM can no longer be programmatically disabled.


The service was removed and the DWM.exe started by the WinLongon.exe. If you kill the exe, the suer is logged off :(

#9 User is offline   bigmuscle 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 320
  • Joined: 18-August 12
  • OS:none specified
  • Country: Country Flag

Posted 23 January 2013 - 02:49 PM

No no, killing dwm.exe works here but it automatically restarts the process. I currently use this method but it's a little race whether it manages to hook Direct3D device creation function before DWM tries to do it.

#10 User is offline   MagicAndre1981 

  • after Windows 7 GA still Vista lover :)
  • Group: Patrons
  • Posts: 4,972
  • Joined: 28-August 05
  • OS:Vista Ultimate x86
  • Country: Country Flag

Posted 23 January 2013 - 11:00 PM

hm, when I tested termination of the DWM.exe I'm back at login screen. :blink:

#11 User is offline   bigmuscle 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 320
  • Joined: 18-August 12
  • OS:none specified
  • Country: Country Flag

Posted 24 January 2013 - 08:33 AM

Could you try running cmd.exe with admin privileges and command "taskkill /f /im dwm.exe" ?

The other possibility to restart Direct3D device is to open Device Manager, find videoadapter, select Disable for it and then re-enable. But I do not know how to easily automate this procedure in C++.
The correct solution would be getting existing pointer to ID3D11Device instance and hook it. But this is very complicated because you need also get all pointers to all pixel+vertex shaders and input layouts which are created with D3D device.

Or... the last solution which I want to avoid... to modify dwmcore.dll to load my library instead of D3D11.dll

#12 User is offline   MagicAndre1981 

  • after Windows 7 GA still Vista lover :)
  • Group: Patrons
  • Posts: 4,972
  • Joined: 28-August 05
  • OS:Vista Ultimate x86
  • Country: Country Flag

Posted 24 January 2013 - 11:54 AM

hmm, wired. Now DWM.exe is restarted. Last time I've checked it, it didn't worked.

#13 User is offline   xpclient 

  • XP was my idea. I had to fight Windows 7 to make it my idea
  • PipPip
  • Group: Members
  • Posts: 233
  • Joined: 30-July 05
  • OS:XP Pro x64
  • Country: Country Flag

Posted 24 January 2013 - 12:33 PM

Couldn't you use the console version of Device Manager, devcon.exe to disable and re-enable it? The W7 WDK has it, even source access. Here's is the stance on its licensing: http://social.msdn.m...9-6cbb4819730f/

This post has been edited by xpclient: 24 January 2013 - 12:34 PM


#14 User is offline   MagicAndre1981 

  • after Windows 7 GA still Vista lover :)
  • Group: Patrons
  • Posts: 4,972
  • Joined: 28-August 05
  • OS:Vista Ultimate x86
  • Country: Country Flag

Posted 24 January 2013 - 01:30 PM

there is also a API to do this

SetupAPI.h

http://read.pudn.com...yqywk.cpp__.htm

#15 User is offline   KNARZ 

  • Junior
  • Pip
  • Group: Members
  • Posts: 88
  • Joined: 20-August 04

Posted 24 January 2013 - 09:12 PM

great work!

and Tihiy may can also implement it in SiB ^^ ;)

#16 User is offline   hb860 

  • Group: Members
  • Posts: 8
  • Joined: 23-January 13
  • OS:ME
  • Country: Country Flag

Posted 24 January 2013 - 11:57 PM

As well as Ivo Beltchev in Classic Shell

#17 User is offline   bigmuscle 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 320
  • Joined: 18-August 12
  • OS:none specified
  • Country: Country Flag

Posted 25 January 2013 - 02:53 AM

I don't think this can be implemented in any application, because it is just a DLL which is loaded into dwm.exe process ;-)

I will also try whether AppInit_DLL thing works on Windows 8 for dwm.exe, this would be the best solution!

#18 User is offline   vladdsp 

  • Group: Members
  • Posts: 4
  • Joined: 23-January 13
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 25 January 2013 - 05:18 AM

View Postbigmuscle, on 25 January 2013 - 02:53 AM, said:



I will also try whether AppInit_DLL

Look here or here

This post has been edited by vladdsp: 25 January 2013 - 05:23 AM


#19 User is offline   Tihiy 

  • the creator
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,609
  • Joined: 19-November 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 25 January 2013 - 05:29 AM

You may try as well injecting into winlogon and catching dwm.exe starting, injecting your DLL by the way. Or hijack some system CLSIDs which dwm uses, but that won't be much better than system file patching.

Also, when writing AppInit_DLL, make sure it does not link directly to user32.dll or libraries using it, otherwise it may fail to initialize (that was true in 2000 times).

This post has been edited by Tihiy: 25 January 2013 - 05:30 AM


#20 User is offline   bigmuscle 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 320
  • Joined: 18-August 12
  • OS:none specified
  • Country: Country Flag

Posted 25 January 2013 - 06:33 AM

It brings one main advantage. New fuctionality is added just by loading DLL and removed by its unloading. If you replace system file, then the only possibility is restoring the original file which does not have to be so easy to do it on-the-fly. Also, if you create some bug (e.g. crash) then injecting method only causes the restart of the process but file-patching method can kill whole system (and it took me really long time to force system to go into recovery options at boot).

Share this topic:


  • 91 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

48 User(s) are reading this topic
3 members, 44 guests, 1 anonymous users

  1. drakenabarion,
  2. dazl,
  3. matt3138


All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy