3

I want to ask which WinApi methods being used to draw shadows under flyouts on UWΡ. enter image description here

What I know:

  1. This shаdοw disappearing when hiding flyout (via SW_HIDE), but it stays if we one hide it using SetWindowLong&GWL_EXSTYLE and SetLayeredWindowattributes then to set LWA_ALPHA to 0.
  2. In addiction to this, if you know how UWP works at all, the main form is being created not at the main executable's process, but at ApplicationFrameHost.exe. Flyouts (their windows) is being created exactly at the main executable, not at ApplicationFrameHost.exe.
  3. One can turn off 'Shοw trаnsparenсу in Windοws' setting (Settings -> Ease of access -> Display). And I know that this can be performed using registry key, but its system-wide setting and I cant be sure that any other application rather than UWΡ will not ignore this registry key and just draw this shаdοw :(

p.s. How do I inspect the flyout if its being hidden when window is unfocused? One can set WS_EXSTYLE with WS_EX_NOACTIVATE to the main form (ApplicationFrameHost.exe -> ApplicationFrameWindow -> Windows.UI.CoreWindow). Then, if one will cause this flyout to appear and then click somewhere outside the window, flyout will not close so one can inspect it with WinSpy++ or something else.

What I've tried:

I created a testing form on UWΡ, where were two flyouts with all the same properties, where only difference was that the first one has shаdοw, the second one don't. After this, I performed that trick with NOACTIVATE to inspect two flyouts' attributes. And I don't see any difference. Like not class flags or window flags, they are all the same.

Talking about reversing, I tried to use

  1. WinAPIOverride64
  2. API Monitor v2 (Alpha) 64-bit
  3. Injecting DLL, which overrides some chosen functions from WinApi (I know about injection techniques in UWΡ, injection does work, but I can't find exact method, which is drawing this shadow)

As for documentation, I can only see that one can add this kind of shаdοws using XAML attributes, but this doesnt make it clear which WinApi methods is used for this.

What I want to do exactly? I want to remove this shadow from any window during runtime via DLL Injection. But, as I can't find which API method is being used, I can't override it.

I've already spent about a month on this puzzle, but I can't solve it. Maybe somebody can help me :)
Thanks!

7
  • Well, if we're talking XAML the question is whether this even exists in Win32 (or rather user32/win32u). If you look at XAML windows, the controls are not individual windows in the Win32 sense. There's one huge window and the drawing happens by the application itself, not Win32 (similar to how browsers draw controls). I think in case of XAML you can also expect an involvement of Direct2D. For Win32 I only know of the system-wide setting you mentioned and CS_DROPSHADOW. On the other hand the styling features of the Shell API since XP and more so Vista may also have something ...
    – 0xC0000022L
    Dec 6, 2021 at 7:57
  • Welcome to RE.SE, by the way. In summary: I think it's a fallacy to think that there's a single mechanism governing the drop shadow for context menus (you call it "flyout") in Win32, XAML and whatever custom-drawn system you may be dealing with. So having a single DLL achieve this feat may not work at all.
    – 0xC0000022L
    Dec 6, 2021 at 7:59
  • @0xC0000022L, thanks for your feedback! Yea, in Win32 apps we know window class flag CS_DROPSHADOW. And those Flyouts (Context menus in this example) are new windows too (checked via debuggers mentioned in the post). I'm not talking about shаdοws on 'controls' of XAML form, but I'm just curious how can the same shаdοws be inserted under newly created windows (and those shаdοws not being drawn on form for sure as they can be drawn even outside of any forms controlled by app) Dec 6, 2021 at 18:50
  • I dont have a lot of knowledge in this section to be honest (XAML especially), but, from things I saw before, I believe everything in Windows must (in the end) point to some WinAPI methods. And, if this guess is right, there have to be something that is drawing this shаdοw... Dec 6, 2021 at 18:51
  • 1
    As for ShellAPI, I believe I haven't found anything similar to graphics function or something there and I don't remember testing it. I've checked window's properties, and yea, those windows have one, which will cause crash of whole app when removed. Its value is some sort of address and I haven't looked deeper, because it's not a root cause of those shаdοws I believe (like it's even not a native window's styles/flags). Dec 7, 2021 at 10:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.