Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.9 #369

Merged
merged 29 commits into from
Jan 18, 2021
Merged

v0.9 #369

merged 29 commits into from
Jan 18, 2021

Conversation

ShankarBUS
Copy link
Member

@ShankarBUS ShankarBUS commented Jan 18, 2021

🎉🎉🎉🎉🎉🎉🎉🎉🎉🎊🥳🥳🥳🎊🎉🎉🎉🎉🎉🎉🎉🎉🎉

This PR contains a whole month's work. It introduces several new features and many bug fixes!

Release Notes

Bug Fixes

What's New

Known issues

  • Tooltips gets hidden behind the main flyout. I know! I worked 3 weeks with this! I AM fully aware of this

  • Flyout bounces indefinitely (lol XD XD hilarious) on hover sometimes when the topbar is set to auto-hide and the flyout is auto aligned to bottom.

  • Users can't specify how close the flyout can get to the screen bounds (or can't set margin, to be precise) when it's auto placed. The ability has already been added internally but due to time limitations this feature couldn't make it to this release.

Our struggles for v0.9

NowPlayingSessionManager

INowPlayingSessionManager (INPSM) is a private Windows 10 API (since 1511) which is also the core API used by the native flyout and a Windows 10 WinRT API called GSMTC (GlobalSystemMediaTransportControlsSessionManager) (since Windows 10 1809). We were previously using GSMTC for our media controls. But it lead to some dead ends like #29 & #184. In order to overcome the issues laid down by the GSMTC APIs, @ADeltaX suggested to use a private API found in Windows 10 reserved for internal usage called INowPlayingSessionManager. But there were plenty of problems while doing so. Since INPSM is reserved for internal usage by Microsoft, they didn't care about breaking and altering it in every Windows 10 build.

@ADeltaX had to do all the hard work to get it running across all Windows 10 versions properly.
He wrote a wrapper called NPSMLib which will execute OS specific functions and work on all Windows 10 versions from 1511 to the latest insider builds.
He made a standalone Nuget package called NPSMLib so that others could be benefited too.

If you're interested in the NPSMLib, please check out its GitHub repository.

Above Lockscreen & Topmost Flyout

Some users were struggling with the flyout getting hidden behind some full-screen apps, Start Menu, Always-on-top Task Manager & the lock screen. While the native flyout had no problems with being topmost, we had no options other than doing some black magic.

@ADeltaX discovered and documented a private Windows API called CreateWindowInBand which he made use of in his AudioFlyout and MobileShell.

This CreateWindowInBand API is also reserved for internal usage by Microsoft and has plenty of restrictions in order to prevent it from being used by 3rd party applications. The CreateWindowInBand works fine if we target the normal window band but for higher bands MS has laid some serious restrictions.

CreateWindowInBand/Ex works ONLY if you pass ZBID_DEFAULT or ZBID_DESKTOP as dwBand argument. Also ZBID_UIACCESS is permitted only if the process has UIAccess token (obtainable, for example, by setting uiAccess=true in app.manifest, more info here). Any other ZBID will fail with 0x5 (ACCESS DENIED).

For CreateWindowInBand/Ex, to be able to use more ZBIDs, the program must have a special PE header, named ".imrsiv" ( bss_seg), flagged with IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY and be signed with a Microsoft certificate "Microsoft Windows".

Quoted from ADeltaX's blog

So, in order to use the CreateWindowInBand API, we need the executable to be either

  • an UIAccess enabled process which indeed requires it to be signed by a proper certificate (could be obtained but costs a lump amount of money).
  • an immersive process and be signed with a Microsoft certificate "Microsoft Windows".

Both of them won't happen obviously. This is where the black magic kicks in.

So, what we need is a surrogate host which has the ability to be an immersive process and be signed with a Microsoft certificate "Microsoft Windows" and won't do anything other than hosting our application. And guess what? @ADeltaX strikes again! He discovered the proper host for this purpose which is called as the "RuntimeBroker" (an immersive, MS signed surrogate application found inside C:\Windows\System32\). He had to get 4 architecture specific RuntimeBroker executables from 4 different Windows 10 OSes (x86, x64, ARM and ARM64). He renamed it to Bro_(arch).exe for fun.

Using RuntimeBroker to host and execute our application was not a joke. It required us to do dll injection and host the .NET 5 CoreCLR inside of it. For further information see this comment - #32 (comment).

I can assure you this procedure is completely safe and secure. It won't affect your system and infringe your privacy. We guarantee you on that.

Somehow, we made it to work properly. We can't thank @ADeltaX enough for all his help ❤. Attributing him is the only thing we can do in return.

Final Words

I @ShankarBUS, the author and lead developer of this project will be leaving this team and this project in the hands of the other 3 core team members @Samuel12321, @Cyberdroid1 and @ADeltaX.

This will be the last release from myside.

Before leaving, I would like to give huge shout-outs to

  • @ADeltaX, for AudioFlyout and every single help from him.
  • @Samuel12321 (co-owner, publisher and maintainer), for publishing this application to Microsoft Store, WinGet, dealing with users and helping me maintain this repo since its early stages.
  • @Cyberdroid1, for his ideas, suggestions, motivation, help and enthusiasm for this project.
  • And finally all the community members (either on Discord, Telegram or GitHub), for all the contributions, motivations, suggestions, ideas and help and everything!

It means a lot to me.

My final words: Change da world… my final message. Goodb ye.

ShankarBUS and others added 26 commits December 24, 2020 11:27
- BandWindow now inherits ContentControl
- Implemented Open/Close animations for FlyoutWindow
- Implemented expand direction logic
- Modified existing code to work on top of the new class `FlyoutWindow : BandWindow`.
- Most of the existing functionalities are broken and are yet to be fixed.
- This implementation is completely unstable and should be fixed soon.
Please welcome RuntimeBroker, a new fantastic immersive broker exe that we will deliciously inject a dll so we can eat a cake and watch a few APIs (notably CreateWindowInBand) working as it should be.

- Added a Launcher that we will use to inject a dll
- Added a bridge for hosting .NET 5
- Added a IAT hook to add support as packaged (bypass a failure)
- Nice
- Included hostfxr.dll within the package for Debug (x64) configuration and cloned the required header locally.

- Added calls to DestroyWindow so that once the launcher sends the data to the bridge, the no-longer-needed-message-window will get destroyed and prevent crashing while a second instance of launcher is initializing.

- BandWindow's content now get aligned properly while opening.
Fixed an annoying issues where DPI changes weren't being perceived by BandWindow's HwndSource.
- Added new animations to top bar and fixed the bounce glitch.
- Preliminary integration of NPSM.
- We got fixes to BandWindow being retarded after draging it.
- We got fixes to NPSM not removing f******* Spotify after it closes.
- We got SimpleWrapPanel being sent to gulag inorder to prevent me from going to gulag lol. (used ModernWpf Commnuity Toolkit instead)
- And we got a sneaky new feature lolololol UwU.
- Moved timeline controls of SessionControl to the main flyout instead of using a separate flyout.
- Initial implementation of GUI for the Layout settings page.
- Added FlyoutAlignmentPicker control.
- Tried to solve the "app not opening after an update" bug.
- Made SourceAppInfo APIs more inclusive. This will reduce the work burden while adding AudioSession APIs (backed by either NAudio's CoreAudioApi or part of EarTrumpet's source code).
- Made the app fetching procedures more precise.
- Fixed #184 - Bug: Win32 apps' information are not shown in the media session controls
- Refined modern apps' icon fetching. Now, it'll sure fetch atleast any one of the apps' icons
- This is supposed to reduce the stutter while changing the media playback position using the slider.
This fixes 19041 issue where GSMTC/NPSMLib stops working randomly...
Well, when NPSM service crashes and restarts (just try restarting Explorer shell!) the old handles referenced internally in NPSM/GSMTC still remains.
That's why we create a new instance when NPSM is (re)started so we get a new handle.
Resolved #327 - Feature request: Multi-monitor support
- Added app data and localization support for the layout page
- And a smol cleanup
Includes some unnecessary stuffs but #Dil Vid It
@ShankarBUS ShankarBUS marked this pull request as ready for review January 18, 2021 11:54
@ShankarBUS
Copy link
Member Author

@Samuel12321,

I need you to verify whether everything is alright. After that I'll merge this PR (please let me do it for one last time)

@prakharb5
Copy link
Member

Lmao the # number of the PR. Very nice indeed.

@ShankarBUS, You will be missed... ❤

@Samuel12321
Copy link
Member

@ShankarBUS of course.
Starting to review it now.
what happened to #250 ?

@ShankarBUS
Copy link
Member Author

Ummmmmm

@ShankarBUS
Copy link
Member Author

Meow?

@ShankarBUS
Copy link
Member Author

@Samuel12321,

Merge this normally with a merge commit.

DO NOT SQUASH OR REBASE MERGE!

JUST NORMAL MERGE WITH A MERGE COMMIT.

I'll be asleep in a while.

Hit me up after releasing v0.9 to Store.

@Tropix126
Copy link

git moment

@ShankarBUS ShankarBUS merged commit 827fd0c into main Jan 18, 2021
@ShankarBUS ShankarBUS deleted the dev branch January 18, 2021 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment