├── .gitignore ├── LICENSE ├── demo ├── Mobile.png └── PC.png ├── readme.md └── src ├── MobSDes ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png ├── MainPage.xaml ├── MainPage.xaml.cs ├── MobSDes.csproj ├── Package.appxmanifest └── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml ├── MobileCoreServer ├── MobileCoreServer.vcxproj ├── MobileCoreServer.vcxproj.filters ├── PropertySheet.props ├── main.cpp ├── packages.config ├── pch.cpp └── pch.h ├── MobileShellExtLauncher ├── MobileShellExtLauncher.vcxproj ├── MobileShellExtLauncher.vcxproj.filters ├── PropertySheet.props ├── main.cpp ├── packages.config ├── pch.cpp └── pch.h ├── MobileShellExtPackaging ├── Images │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png ├── MobileShellExtLauncher │ ├── MiniBroker.exe │ └── MobileShellExtension.dll ├── MobileShellExtPackaging.wapproj └── Package.appxmanifest ├── MobileShellExtension ├── BaseWindow.cpp ├── BaseWindow.h ├── MobileShellExtension.vcxproj ├── MobileShellExtension.vcxproj.filters ├── PropertySheet.props ├── TrashWindow.cpp ├── TrashWindow.h ├── Utils.cpp ├── Utils.h ├── main.cpp ├── packages.config ├── pch.cpp ├── pch.h └── readme.txt ├── MobileShellPackaging ├── Images │ ├── LargeTile.scale-100.png │ ├── LargeTile.scale-125.png │ ├── LargeTile.scale-150.png │ ├── LargeTile.scale-200.png │ ├── LargeTile.scale-400.png │ ├── LockScreenLogo.scale-200.png │ ├── SmallTile.scale-100.png │ ├── SmallTile.scale-125.png │ ├── SmallTile.scale-150.png │ ├── SmallTile.scale-200.png │ ├── SmallTile.scale-400.png │ ├── SplashScreen.scale-100.png │ ├── SplashScreen.scale-125.png │ ├── SplashScreen.scale-150.png │ ├── SplashScreen.scale-200.png │ ├── SplashScreen.scale-400.png │ ├── Square150x150Logo.scale-100.png │ ├── Square150x150Logo.scale-125.png │ ├── Square150x150Logo.scale-150.png │ ├── Square150x150Logo.scale-200.png │ ├── Square150x150Logo.scale-400.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-16.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-24.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-256.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-32.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-48.png │ ├── Square44x44Logo.altform-unplated_targetsize-16.png │ ├── Square44x44Logo.altform-unplated_targetsize-256.png │ ├── Square44x44Logo.altform-unplated_targetsize-32.png │ ├── Square44x44Logo.altform-unplated_targetsize-48.png │ ├── Square44x44Logo.scale-100.png │ ├── Square44x44Logo.scale-125.png │ ├── Square44x44Logo.scale-150.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.scale-400.png │ ├── Square44x44Logo.targetsize-16.png │ ├── Square44x44Logo.targetsize-24.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── Square44x44Logo.targetsize-256.png │ ├── Square44x44Logo.targetsize-32.png │ ├── Square44x44Logo.targetsize-48.png │ ├── StoreLogo.backup.png │ ├── StoreLogo.scale-100.png │ ├── StoreLogo.scale-125.png │ ├── StoreLogo.scale-150.png │ ├── StoreLogo.scale-200.png │ ├── StoreLogo.scale-400.png │ ├── Wide310x150Logo.scale-100.png │ ├── Wide310x150Logo.scale-125.png │ ├── Wide310x150Logo.scale-150.png │ ├── Wide310x150Logo.scale-200.png │ └── Wide310x150Logo.scale-400.png ├── MobileShellPackaging.wapproj └── Package.appxmanifest ├── MobileShellPlus.sln └── MobileShellPlus ├── Application.manifest ├── BaseWindow.cpp ├── BaseWindow.h ├── LayoutTransformControl.cpp ├── LayoutTransformControl.h ├── MatrixExt.cpp ├── MatrixExt.h ├── MobileShellPlus.vcxproj ├── MobileShellPlus.vcxproj.filters ├── NavBarWindow.cpp ├── NavBarWindow.h ├── NotificationWindow.cpp ├── NotificationWindow.h ├── PropertySheet.props ├── StatusBarWindow.cpp ├── StatusBarWindow.h ├── TopPadWindow.cpp ├── TopPadWindow.h ├── Utils.cpp ├── Utils.h ├── WindowEnumeration.h ├── Wnf.cpp ├── Wnf.h ├── main.cpp ├── packages.config ├── pch.cpp ├── pch.h ├── readme.txt ├── resource.h └── version.rc /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 ADeltaX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo/Mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/demo/Mobile.png -------------------------------------------------------------------------------- /demo/PC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/demo/PC.png -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # MobileShell - A custom shell for Windows 10 Desktop/ARM64 (18362+) 2 | # Currently on hold (for now) 3 | # Made using C++ and Xaml Island 4 | 5 | ### Running on a PC: 6 | ![pcMobileShell](demo/PC.png "MobileShell running on a PC") 7 | 8 | ### Running on a phone: 9 | ![phoneMobileShell](demo/Mobile.png "MobileShell running on a phone") 10 | 11 | ## What's supported: 12 | 13 | - Battery status (charging, normal, saving) 14 | - Detects (like w10m): 15 | - Focus Assist 16 | - Bluetooth 17 | - Location usage 18 | - WiFi 19 | - Cellular (+ dual sim) 20 | - Double tap to sleep 21 | - Rotation - DPI - display changes 22 | - Follows theme colors (currently at launch only) 23 | - Follows dark/light theme changes in real time 24 | - Faster (?) 25 | - Tablet/Desktop mode changes detection 26 | 27 | ## Issues: 28 | - It's an alpha, expect some issues. 29 | 30 | ## Tasks 31 | 32 | - [ ] Bug fixes (I have listed a lot of bugs to fix / unimplemented checks / unwanted features) 33 | 34 | ## License 35 | 36 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details 37 | -------------------------------------------------------------------------------- /src/MobSDes/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | -------------------------------------------------------------------------------- /src/MobSDes/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.ApplicationModel; 7 | using Windows.ApplicationModel.Activation; 8 | using Windows.Foundation; 9 | using Windows.Foundation.Collections; 10 | using Windows.UI.Xaml; 11 | using Windows.UI.Xaml.Controls; 12 | using Windows.UI.Xaml.Controls.Primitives; 13 | using Windows.UI.Xaml.Data; 14 | using Windows.UI.Xaml.Input; 15 | using Windows.UI.Xaml.Media; 16 | using Windows.UI.Xaml.Navigation; 17 | 18 | namespace MobSDes 19 | { 20 | /// 21 | /// Provides application-specific behavior to supplement the default Application class. 22 | /// 23 | sealed partial class App : Application 24 | { 25 | /// 26 | /// Initializes the singleton application object. This is the first line of authored code 27 | /// executed, and as such is the logical equivalent of main() or WinMain(). 28 | /// 29 | public App() 30 | { 31 | this.InitializeComponent(); 32 | this.Suspending += OnSuspending; 33 | } 34 | 35 | /// 36 | /// Invoked when the application is launched normally by the end user. Other entry points 37 | /// will be used such as when the application is launched to open a specific file. 38 | /// 39 | /// Details about the launch request and process. 40 | protected override void OnLaunched(LaunchActivatedEventArgs e) 41 | { 42 | Frame rootFrame = Window.Current.Content as Frame; 43 | 44 | // Do not repeat app initialization when the Window already has content, 45 | // just ensure that the window is active 46 | if (rootFrame == null) 47 | { 48 | // Create a Frame to act as the navigation context and navigate to the first page 49 | rootFrame = new Frame(); 50 | 51 | rootFrame.NavigationFailed += OnNavigationFailed; 52 | 53 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 54 | { 55 | //TODO: Load state from previously suspended application 56 | } 57 | 58 | // Place the frame in the current Window 59 | Window.Current.Content = rootFrame; 60 | } 61 | 62 | if (e.PrelaunchActivated == false) 63 | { 64 | if (rootFrame.Content == null) 65 | { 66 | // When the navigation stack isn't restored navigate to the first page, 67 | // configuring the new page by passing required information as a navigation 68 | // parameter 69 | rootFrame.Navigate(typeof(MainPage), e.Arguments); 70 | } 71 | // Ensure the current window is active 72 | Window.Current.Activate(); 73 | } 74 | } 75 | 76 | /// 77 | /// Invoked when Navigation to a certain page fails 78 | /// 79 | /// The Frame which failed navigation 80 | /// Details about the navigation failure 81 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 82 | { 83 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 84 | } 85 | 86 | /// 87 | /// Invoked when application execution is being suspended. Application state is saved 88 | /// without knowing whether the application will be terminated or resumed with the contents 89 | /// of memory still intact. 90 | /// 91 | /// The source of the suspend request. 92 | /// Details about the suspend request. 93 | private void OnSuspending(object sender, SuspendingEventArgs e) 94 | { 95 | var deferral = e.SuspendingOperation.GetDeferral(); 96 | //TODO: Save application state and stop any background activity 97 | deferral.Complete(); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/MobSDes/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobSDes/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/MobSDes/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobSDes/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/MobSDes/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobSDes/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobSDes/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobSDes/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobSDes/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobSDes/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/MobSDes/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobSDes/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/MobSDes/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobSDes/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobSDes/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/MobSDes/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 17 | 18 | namespace MobSDes 19 | { 20 | /// 21 | /// An empty page that can be used on its own or navigated to within a Frame. 22 | /// 23 | public sealed partial class MainPage : Page 24 | { 25 | public MainPage() 26 | { 27 | this.InitializeComponent(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MobSDes/MobSDes.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x86 7 | {8B91C758-C271-4483-B0F6-51FCEE9636C8} 8 | AppContainerExe 9 | Properties 10 | MobSDes 11 | MobSDes 12 | en-US 13 | UAP 14 | 10.0.18362.0 15 | 10.0.18362.0 16 | 14 17 | 512 18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 19 | true 20 | false 21 | 22 | 23 | true 24 | bin\x86\Debug\ 25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 26 | ;2008 27 | full 28 | x86 29 | false 30 | prompt 31 | true 32 | 33 | 34 | bin\x86\Release\ 35 | TRACE;NETFX_CORE;WINDOWS_UWP 36 | true 37 | ;2008 38 | pdbonly 39 | x86 40 | false 41 | prompt 42 | true 43 | true 44 | 45 | 46 | true 47 | bin\ARM\Debug\ 48 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 49 | ;2008 50 | full 51 | ARM 52 | false 53 | prompt 54 | true 55 | 56 | 57 | bin\ARM\Release\ 58 | TRACE;NETFX_CORE;WINDOWS_UWP 59 | true 60 | ;2008 61 | pdbonly 62 | ARM 63 | false 64 | prompt 65 | true 66 | true 67 | 68 | 69 | true 70 | bin\ARM64\Debug\ 71 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 72 | ;2008 73 | full 74 | ARM64 75 | false 76 | prompt 77 | true 78 | true 79 | 80 | 81 | bin\ARM64\Release\ 82 | TRACE;NETFX_CORE;WINDOWS_UWP 83 | true 84 | ;2008 85 | pdbonly 86 | ARM64 87 | false 88 | prompt 89 | true 90 | true 91 | 92 | 93 | true 94 | bin\x64\Debug\ 95 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 96 | ;2008 97 | full 98 | x64 99 | false 100 | prompt 101 | true 102 | 103 | 104 | bin\x64\Release\ 105 | TRACE;NETFX_CORE;WINDOWS_UWP 106 | true 107 | ;2008 108 | pdbonly 109 | x64 110 | false 111 | prompt 112 | true 113 | true 114 | 115 | 116 | PackageReference 117 | 118 | 119 | 120 | App.xaml 121 | 122 | 123 | MainPage.xaml 124 | 125 | 126 | 127 | 128 | 129 | Designer 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | MSBuild:Compile 145 | Designer 146 | 147 | 148 | MSBuild:Compile 149 | Designer 150 | 151 | 152 | 153 | 154 | 6.2.9 155 | 156 | 157 | 158 | 14.0 159 | 160 | 161 | 168 | -------------------------------------------------------------------------------- /src/MobSDes/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | MobSDes 18 | ADelt 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/MobSDes/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MobSDes")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MobSDes")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/MobSDes/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/MobileCoreServer/MobileCoreServer.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | true 7 | true 8 | 15.0 9 | {614f0fb6-cd99-4f21-baed-7536ac5d58b4} 10 | Win32Proj 11 | MobileCoreServer 12 | 10.0.18362.0 13 | 10.0.17134.0 14 | 15 | 16 | 17 | 18 | Debug 19 | ARM 20 | 21 | 22 | Debug 23 | Win32 24 | 25 | 26 | Release 27 | ARM 28 | 29 | 30 | Release 31 | Win32 32 | 33 | 34 | Debug 35 | x64 36 | 37 | 38 | Release 39 | x64 40 | 41 | 42 | 43 | Application 44 | v140 45 | v141 46 | v142 47 | Unicode 48 | 49 | 50 | true 51 | true 52 | 53 | 54 | false 55 | true 56 | false 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | Use 73 | pch.h 74 | $(IntDir)pch.pch 75 | _CONSOLE;%(PreprocessorDefinitions) 76 | Level4 77 | %(AdditionalOptions) /permissive- /bigobj 78 | 79 | 80 | 81 | 82 | Disabled 83 | _DEBUG;%(PreprocessorDefinitions) 84 | 85 | 86 | Console 87 | false 88 | 89 | 90 | 91 | 92 | WIN32;%(PreprocessorDefinitions) 93 | 94 | 95 | 96 | 97 | WIN32;%(PreprocessorDefinitions) 98 | 99 | 100 | 101 | 102 | MaxSpeed 103 | true 104 | true 105 | NDEBUG;%(PreprocessorDefinitions) 106 | 107 | 108 | Console 109 | true 110 | true 111 | false 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Create 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}. 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /src/MobileCoreServer/MobileCoreServer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/MobileCoreServer/PropertySheet.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/MobileCoreServer/main.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | int main() 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/MobileCoreServer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/MobileCoreServer/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /src/MobileCoreServer/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | -------------------------------------------------------------------------------- /src/MobileShellExtLauncher/MobileShellExtLauncher.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | true 7 | true 8 | 15.0 9 | {fe1bf701-602d-417e-b7e8-4491420b6fd2} 10 | Win32Proj 11 | MobileShellExtLauncher 12 | 10.0.18362.0 13 | 10.0.17134.0 14 | 15 | 16 | 17 | 18 | Debug 19 | Win32 20 | 21 | 22 | Release 23 | Win32 24 | 25 | 26 | Debug 27 | x64 28 | 29 | 30 | Release 31 | x64 32 | 33 | 34 | 35 | Application 36 | v140 37 | v141 38 | v142 39 | Unicode 40 | 41 | 42 | true 43 | true 44 | 45 | 46 | false 47 | true 48 | false 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Use 65 | pch.h 66 | $(IntDir)pch.pch 67 | _CONSOLE;%(PreprocessorDefinitions) 68 | Level4 69 | %(AdditionalOptions) /permissive- /bigobj 70 | 71 | 72 | 73 | 74 | Disabled 75 | _DEBUG;%(PreprocessorDefinitions) 76 | 77 | 78 | Windows 79 | false 80 | 81 | 82 | 83 | 84 | WIN32;%(PreprocessorDefinitions) 85 | 86 | 87 | 88 | 89 | MaxSpeed 90 | true 91 | true 92 | NDEBUG;%(PreprocessorDefinitions) 93 | 94 | 95 | Windows 96 | true 97 | true 98 | false 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | Create 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /src/MobileShellExtLauncher/MobileShellExtLauncher.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/MobileShellExtLauncher/PropertySheet.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/MobileShellExtLauncher/main.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #pragma comment(lib, "shlwapi.lib") 7 | 8 | typedef WINBASEAPI BOOL(WINAPI* CreateProcessHid)( 9 | _In_opt_ LPCWSTR lpApplicationName, 10 | _Inout_opt_ LPWSTR lpCommandLine, 11 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, 12 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, 13 | _In_ BOOL bInheritHandles, 14 | _In_ DWORD dwCreationFlags, 15 | _In_opt_ LPVOID lpEnvironment, 16 | _In_opt_ LPCWSTR lpCurrentDirectory, 17 | _In_ LPSTARTUPINFOW lpStartupInfo, 18 | _Out_ LPPROCESS_INFORMATION lpProcessInformation 19 | ); 20 | 21 | void InjectDll(HANDLE hProcess, HANDLE hThread, const std::wstring& path) 22 | { 23 | size_t strSize = (path.size() + 1) * sizeof(WCHAR); 24 | LPVOID pBuf = VirtualAllocEx(hProcess, 0, strSize, MEM_COMMIT, PAGE_READWRITE); 25 | if (pBuf == NULL) 26 | return; 27 | 28 | SIZE_T written; 29 | if (!WriteProcessMemory(hProcess, pBuf, path.c_str(), strSize, &written)) 30 | return; 31 | 32 | LPVOID pLoadLibraryW = GetProcAddress(GetModuleHandle(L"kernel32"), "LoadLibraryW"); 33 | QueueUserAPC((PAPCFUNC)pLoadLibraryW, hThread, (ULONG_PTR)pBuf); 34 | } 35 | 36 | std::wstring GetExecutableDir() 37 | { 38 | WCHAR buf[MAX_PATH]; 39 | GetModuleFileName(nullptr, buf, MAX_PATH); 40 | PathRemoveFileSpec(buf); 41 | return buf; 42 | } 43 | 44 | typedef BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand); 45 | 46 | int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) 47 | { 48 | std::wstring path = GetExecutableDir(); 49 | path += L"\\MobileShellExtension.dll"; 50 | 51 | STARTUPINFO startInfo = { 0 }; 52 | PROCESS_INFORMATION procInfo = { 0 }; 53 | WCHAR cmdline[] = L"MiniBroker.exe"; 54 | 55 | startInfo.cb = sizeof(startInfo); 56 | 57 | const auto createprocess = CreateProcessHid(GetProcAddressNew(L"kernel32.dll", L"CreateProcessW")); 58 | 59 | if (createprocess(nullptr, cmdline, nullptr, nullptr, FALSE, CREATE_SUSPENDED, nullptr, nullptr, &startInfo, &procInfo)) 60 | { 61 | InjectDll(procInfo.hProcess, procInfo.hThread, path); 62 | ResumeThread(procInfo.hThread); 63 | } 64 | 65 | return 0; 66 | } -------------------------------------------------------------------------------- /src/MobileShellExtLauncher/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/MobileShellExtLauncher/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /src/MobileShellExtLauncher/pch.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2019 Gustave Monce - @gus33000 - gus33000.me 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | Readapted from: https://raw.githubusercontent.com/gus33000/RegistryRT/master/pch.h 26 | 27 | */ 28 | 29 | #pragma once 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | 38 | using namespace winrt; 39 | 40 | typedef struct _UNICODE_STRING { 41 | USHORT Length; 42 | USHORT MaximumLength; 43 | PWSTR Buffer; 44 | } UNICODE_STRING; 45 | 46 | typedef struct _PEB_LDR_DATA { 47 | BYTE Reserved1[8]; 48 | PVOID Reserved2[3]; 49 | LIST_ENTRY InMemoryOrderModuleList; 50 | } PEB_LDR_DATA, * PPEB_LDR_DATA; 51 | 52 | typedef struct _RTL_USER_PROCESS_PARAMETERS { 53 | BYTE Reserved1[16]; 54 | PVOID Reserved2[10]; 55 | UNICODE_STRING ImagePathName; 56 | UNICODE_STRING CommandLine; 57 | } RTL_USER_PROCESS_PARAMETERS, * PRTL_USER_PROCESS_PARAMETERS; 58 | 59 | typedef struct _PEB { 60 | BYTE Reserved1[2]; 61 | BYTE BeingDebugged; 62 | BYTE Reserved2[1]; 63 | PVOID Reserved3[2]; 64 | PPEB_LDR_DATA Ldr; 65 | PRTL_USER_PROCESS_PARAMETERS ProcessParameters; 66 | PVOID Reserved4[3]; 67 | PVOID AtlThunkSListPtr; 68 | PVOID Reserved5; 69 | ULONG Reserved6; 70 | PVOID Reserved7; 71 | ULONG Reserved8; 72 | ULONG AtlThunkSListPtr32; 73 | PVOID Reserved9[45]; 74 | BYTE Reserved10[96]; 75 | PVOID PostProcessInitRoutine; 76 | BYTE Reserved11[128]; 77 | PVOID Reserved12[1]; 78 | ULONG SessionId; 79 | } PEB, * PPEB; 80 | 81 | typedef struct _MY_PEB_LDR_DATA { 82 | ULONG Length; 83 | BOOL Initialized; 84 | PVOID SsHandle; 85 | LIST_ENTRY InLoadOrderModuleList; 86 | LIST_ENTRY InMemoryOrderModuleList; 87 | LIST_ENTRY InInitializationOrderModuleList; 88 | } MY_PEB_LDR_DATA, * PMY_PEB_LDR_DATA; 89 | 90 | typedef struct _MY_LDR_DATA_TABLE_ENTRY 91 | { 92 | LIST_ENTRY InLoadOrderLinks; 93 | LIST_ENTRY InMemoryOrderLinks; 94 | LIST_ENTRY InInitializationOrderLinks; 95 | PVOID DllBase; 96 | PVOID EntryPoint; 97 | ULONG SizeOfImage; 98 | UNICODE_STRING FullDllName; 99 | UNICODE_STRING BaseDllName; 100 | } MY_LDR_DATA_TABLE_ENTRY, * PMY_LDR_DATA_TABLE_ENTRY; 101 | 102 | inline winrt::hstring Str(UNICODE_STRING US) { 103 | wchar_t* str = (wchar_t*)malloc(US.Length + sizeof(wchar_t)); 104 | memcpy(str, US.Buffer, US.Length); 105 | str[US.Length / sizeof(wchar_t)] = 0; 106 | winrt::hstring ret(str); 107 | free(str); 108 | return ret; 109 | } 110 | 111 | inline winrt::hstring Str(const char* char_array) { 112 | std::string s_str = std::string(char_array); 113 | std::wstring wid_str = std::wstring(s_str.begin(), s_str.end()); 114 | const wchar_t* w_char = wid_str.c_str(); 115 | return winrt::hstring(w_char); 116 | } 117 | 118 | inline winrt::hstring ToLower(winrt::hstring str) { 119 | std::wstring wid_str = str.data(); 120 | std::transform(wid_str.begin(), wid_str.end(), wid_str.begin(), ::tolower); 121 | return winrt::hstring(wid_str.c_str()); 122 | } 123 | 124 | inline PEB* NtCurrentPeb() { 125 | #ifdef _M_X64 126 | return (PEB*)(__readgsqword(0x60)); 127 | #elif _M_IX86 128 | return (PEB*)(__readfsdword(0x30)); 129 | #elif _M_ARM 130 | return *(PEB**)(_MoveFromCoprocessor(15, 0, 13, 0, 2) + 0x30); 131 | #elif _M_ARM64 132 | return *(PEB**)(__getReg(18) + 0x60); // TEB in x18 133 | #elif _M_IA64 134 | return *(PEB**)(_rdteb() + 0x60); 135 | #elif _M_ALPHA 136 | return *(PEB**)(_rdteb() + 0x30); 137 | #elif _M_MIPS 138 | return *(PEB**)((*(char**)(0x7ffff030)) + 0x30); 139 | #elif _M_PPC 140 | // winnt.h of the period uses __builtin_get_gpr13() or __gregister_get(13) depending on _MSC_VER 141 | return *(PEB**)(__gregister_get(13) + 0x30); 142 | #else 143 | #error "This architecture is currently unsupported" 144 | #endif 145 | }; 146 | 147 | #define IMAGE_DIRECTORY_ENTRY_EXPORT 0 148 | 149 | inline FARPROC GetProcAddressNew(winrt::hstring dll, winrt::hstring func) { 150 | dll = ToLower(dll); 151 | func = ToLower(func); 152 | auto Ldr = (PMY_PEB_LDR_DATA)(NtCurrentPeb()->Ldr); 153 | auto NextModule = Ldr->InLoadOrderModuleList.Flink; 154 | auto TableEntry = (PMY_LDR_DATA_TABLE_ENTRY)NextModule; 155 | while (TableEntry->DllBase != NULL) { 156 | PVOID base = TableEntry->DllBase; 157 | winrt::hstring dllName = ToLower(Str(TableEntry->BaseDllName)); 158 | auto PE = (PIMAGE_NT_HEADERS)((ULONG_PTR)base + ((PIMAGE_DOS_HEADER)base)->e_lfanew); 159 | auto exportdirRVA = PE->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; 160 | TableEntry = (PMY_LDR_DATA_TABLE_ENTRY)TableEntry->InLoadOrderLinks.Flink; 161 | 162 | if (exportdirRVA == 0) continue; 163 | if (dllName != dll) continue; 164 | 165 | auto Exports = (PIMAGE_EXPORT_DIRECTORY)((ULONG_PTR)base + exportdirRVA); 166 | auto Names = (PDWORD)((PCHAR)base + Exports->AddressOfNames); 167 | auto Ordinals = (PUSHORT)((ULONG_PTR)base + Exports->AddressOfNameOrdinals); 168 | auto Functions = (PDWORD)((ULONG_PTR)base + Exports->AddressOfFunctions); 169 | 170 | for (UINT32 iterator = 0; iterator < Exports->NumberOfNames; iterator++) { 171 | winrt::hstring funcName = ToLower(Str((PCSTR)(Names[iterator] + (ULONG_PTR)base))); 172 | 173 | if (funcName != func) continue; 174 | 175 | USHORT ordTblIndex = Ordinals[iterator]; 176 | return (FARPROC)((ULONG_PTR)base + Functions[ordTblIndex]); 177 | } 178 | } 179 | return NULL; 180 | } -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/Images/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/Images/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/Images/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/Images/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/Images/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/Images/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/Images/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/Images/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/Images/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/Images/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/Images/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/Images/StoreLogo.png -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/Images/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/Images/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/MobileShellExtLauncher/MiniBroker.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/MobileShellExtLauncher/MiniBroker.exe -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/MobileShellExtLauncher/MobileShellExtension.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellExtPackaging/MobileShellExtLauncher/MobileShellExtension.dll -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/MobileShellExtPackaging.wapproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15.0 5 | 6 | 7 | 8 | Debug 9 | x86 10 | 11 | 12 | Release 13 | x86 14 | 15 | 16 | Debug 17 | x64 18 | 19 | 20 | Release 21 | x64 22 | 23 | 24 | Debug 25 | ARM 26 | 27 | 28 | Release 29 | ARM 30 | 31 | 32 | Debug 33 | ARM64 34 | 35 | 36 | Release 37 | ARM64 38 | 39 | 40 | Debug 41 | AnyCPU 42 | 43 | 44 | Release 45 | AnyCPU 46 | 47 | 48 | 49 | $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\ 50 | 51 | 52 | 53 | dae20fd6-9c2c-427e-b695-a68e390ae3d9 54 | 10.0.18362.0 55 | 10.0.17763.0 56 | en-US 57 | True 58 | ..\MobileShellExtLauncher\MobileShellExtLauncher.vcxproj 59 | False 60 | 08E959E7AD6617DAC6D421E2C0072B78591BE5D0 61 | SHA256 62 | True 63 | False 64 | True 65 | x64 66 | 0 67 | 68 | 69 | Always 70 | 71 | 72 | Always 73 | 74 | 75 | Always 76 | 77 | 78 | Always 79 | 80 | 81 | Always 82 | 83 | 84 | Always 85 | 86 | 87 | Always 88 | 89 | 90 | Always 91 | 92 | 93 | Always 94 | 95 | 96 | Always 97 | 98 | 99 | 100 | Designer 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /src/MobileShellExtPackaging/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | MobileShell Extension 16 | ADelt 17 | Images\StoreLogo.png 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/MobileShellExtension/BaseWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "BaseWindow.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "Utils.h" 9 | 10 | #pragma comment(lib, "SHCore") 11 | #pragma comment(lib, "shell32") 12 | #pragma comment(lib, "cfgmgr32") 13 | 14 | using namespace winrt; 15 | using namespace Windows::Foundation::Numerics; 16 | using namespace Windows::Foundation; 17 | using namespace Windows::UI::Xaml::Data; 18 | using namespace Windows::UI::Xaml::Markup; 19 | using namespace Windows::UI::Xaml::Hosting; 20 | using namespace Windows::UI::Xaml::Controls; 21 | using namespace Windows::UI::Xaml::Media; 22 | using namespace Windows::UI::Xaml; 23 | using namespace Windows::UI::Composition; 24 | using namespace Windows::UI; 25 | 26 | typedef HWND(WINAPI* CreateWindowInBand)(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam, DWORD band); 27 | typedef BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand); 28 | typedef BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand); 29 | 30 | BaseWindow::BaseWindow(_In_ HINSTANCE hInstance, LPCWSTR str, ZBID zbid) 31 | { 32 | InitWindow(hInstance, str, zbid); 33 | } 34 | 35 | bool BaseWindow::InitWindow(HINSTANCE hInstance, LPCWSTR str, ZBID zbid) 36 | { 37 | hwndChild = CreateWindowInternal(hInstance, str, zbid); 38 | 39 | if (hwndChild == NULL) 40 | { 41 | isCreateWindowFailed = true; 42 | return false; 43 | } 44 | 45 | SetWindowPos(hwndParent, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER); 46 | SetWindowPos(hwndChild, nullptr, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOZORDER); 47 | 48 | return true; 49 | } 50 | 51 | void BaseWindow::SetXamlContent(const UIElement& element) 52 | { 53 | _xamlSource.Content(element); //default 54 | baseElement = element; 55 | } 56 | 57 | UIElement BaseWindow::GetXamlContent() 58 | { 59 | return baseElement; 60 | } 61 | 62 | void BaseWindow::SetSize(int width, int height, double dpi) 63 | { 64 | SetWindowPos(hwndChild, nullptr, 0, 0, width, height, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSENDCHANGING); 65 | SetWindowPos(hwndParent, nullptr, 0, 0, width, height, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSENDCHANGING); 66 | this->width = width; 67 | this->height = height; 68 | this->effectiveDpi = dpi; 69 | } 70 | 71 | void BaseWindow::SetPosition(int x, int y) 72 | { 73 | SetWindowPos(hwndParent, nullptr, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOSENDCHANGING); 74 | this->x = x; 75 | this->y = y; 76 | } 77 | 78 | void BaseWindow::PreBuild() 79 | { 80 | if (baseElement == nullptr) 81 | SetXamlContent(BuildUIElement()); 82 | } 83 | 84 | void BaseWindow::Hide() 85 | { 86 | ShowWindow(hwndParent, SW_HIDE); 87 | UpdateWindow(hwndParent); 88 | } 89 | 90 | void BaseWindow::Show() 91 | { 92 | ShowWindow(hwndParent, SW_SHOW); 93 | UpdateWindow(hwndParent); 94 | } 95 | 96 | LRESULT CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 97 | { 98 | BaseWindow* wthis; 99 | 100 | if (message == WM_NCCREATE) 101 | { 102 | wthis = static_cast(reinterpret_cast(lParam)->lpCreateParams); 103 | 104 | SetLastError(0); 105 | if (!SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(wthis))) 106 | { 107 | if (GetLastError() != 0) 108 | return FALSE; 109 | } 110 | } 111 | else 112 | { 113 | wthis = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); 114 | } 115 | 116 | switch (message) 117 | { 118 | case WM_DESTROY: 119 | PostQuitMessage(0); 120 | break; 121 | 122 | case WM_WINDOWPOSCHANGING: 123 | return 0; 124 | 125 | case WM_DISPLAYCHANGE: 126 | if (wthis) 127 | wthis->OnDisplayChange(); 128 | break; 129 | 130 | //!!! WORKAROUND FOR STARTMENU/TASKVIEW FOCUS ISSUE 131 | case WM_MOUSEACTIVATE: 132 | return MA_NOACTIVATE; 133 | 134 | //this is useless and not working 135 | case WM_TABLET_QUERYSYSTEMGESTURESTATUS: 136 | return TABLET_DISABLE_PRESSANDHOLD; 137 | 138 | case WM_RBUTTONDOWN: 139 | return -1; 140 | //!!! END OF WORKAROUND FOR STARTMENU/TASKVIEW FOCUS ISSUE 141 | 142 | 143 | //!!! WORKAROUND FOR THEME NOT CHANGING AUTOMATICALLY 144 | case WM_DWMCOLORIZATIONCOLORCHANGED: 145 | case WM_DWMCOMPOSITIONCHANGED: 146 | case WM_THEMECHANGED: 147 | //uwu 148 | if (wthis) 149 | wthis->OnThemeChanged(); 150 | break; 151 | 152 | case WM_SETTINGCHANGE: 153 | if (lParam) 154 | { 155 | auto lParamString = reinterpret_cast(lParam); 156 | if (wcscmp(lParamString, L"ImmersiveColorSet") || wcscmp(lParamString, L"WindowsThemeElement")) 157 | { 158 | if (wthis) 159 | wthis->OnThemeChanged(); 160 | } 161 | } 162 | 163 | break; 164 | //!!! END OF WORKAROUND FOR THEME NOT CHANGING AUTOMATICALLY 165 | 166 | case WM_DPICHANGED: 167 | if (wthis) 168 | { 169 | const auto dpi = LOWORD(wParam) / 96.0; 170 | wthis->OnDpiChanged(dpi); 171 | } 172 | break; 173 | default: 174 | return DefWindowProc(hwnd, message, wParam, lParam); 175 | } 176 | 177 | return DefWindowProc(hwnd, message, wParam, lParam); 178 | } 179 | 180 | void BaseWindow::OnThemeChanged() 181 | { 182 | auto xamlroot = GetXamlContent(); 183 | 184 | if (xamlroot != nullptr) 185 | { 186 | if (FrameworkElement g = xamlroot.as()) 187 | { 188 | if (Utils::SystemUsesLightTheme()) 189 | g.RequestedTheme(ElementTheme::Light); 190 | else 191 | g.RequestedTheme(ElementTheme::Dark); 192 | } 193 | } 194 | } 195 | 196 | BOOL CALLBACK Capra(HWND hwnd, LPARAM lParam) 197 | { 198 | GESTURECONFIG config; 199 | config.dwID = 0; 200 | config.dwWant = GC_ALLGESTURES; 201 | config.dwBlock = 0; 202 | auto res = SetGestureConfig(hwnd, 0, 1, &config, sizeof(config)); 203 | 204 | RegisterTouchWindow(hwnd, TWF_WANTPALM); 205 | 206 | return true; 207 | } 208 | 209 | HWND BaseWindow::CreateWindowInternal(HINSTANCE hInstance, LPCWSTR str, ZBID zbid) 210 | { 211 | auto lpszClassName = str; 212 | 213 | WNDCLASS wndParentClass; 214 | 215 | wndParentClass.style = CS_HREDRAW | CS_VREDRAW; 216 | wndParentClass.lpfnWndProc = ParentWndProc; 217 | wndParentClass.cbClsExtra = 0; 218 | wndParentClass.cbWndExtra = sizeof(BaseWindow); 219 | wndParentClass.hInstance = hInstance; 220 | wndParentClass.hIcon = LoadIcon(hInstance, IDI_APPLICATION); 221 | wndParentClass.hCursor = LoadCursor(hInstance, IDC_ARROW); 222 | wndParentClass.hbrBackground = static_cast(GetStockObject(WHITE_BRUSH)); 223 | wndParentClass.lpszMenuName = nullptr; 224 | wndParentClass.lpszClassName = lpszClassName; 225 | 226 | if (!RegisterClass(&wndParentClass)) 227 | { 228 | DWORD Error = GetLastError(); 229 | //MessageBox(nullptr, TEXT("Error registering window class."), lpszClassName, MB_ICONERROR); 230 | return NULL; 231 | } 232 | 233 | const auto hpath = LoadLibrary(L"user32.dll"); 234 | const auto proc_add = CreateWindowInBand(GetProcAddress(hpath, "CreateWindowInBand")); 235 | 236 | hwndParent = proc_add(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOREDIRECTIONBITMAP | WS_EX_NOACTIVATE, lpszClassName, 237 | TEXT("MobShell"), 238 | 0L, 239 | CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 240 | nullptr, 241 | nullptr, 242 | wndParentClass.hInstance, 243 | this, 244 | zbid); 245 | 246 | if (!hwndParent) 247 | { 248 | //return NULL; 249 | 250 | const auto err = GetLastError(); 251 | const auto test1 = std::to_string(err); 252 | MessageBoxA(hwndParent, test1.c_str(), "NO", 0); 253 | 254 | exit(0); 255 | } 256 | 257 | SetWindowLong(hwndParent, GWL_STYLE, 0); 258 | SetWindowLong(hwndParent, GWL_EXSTYLE, 0); 259 | ShowWindow(hwndParent, 0); 260 | UpdateWindow(hwndParent); 261 | 262 | auto interop_detail = _xamlSource.as(); 263 | check_hresult(interop_detail->AttachToWindow(hwndParent)); 264 | 265 | HWND int_hw; 266 | 267 | interop_detail->get_WindowHandle(&int_hw); 268 | 269 | SetWindowLong(hwndParent, GWL_EXSTYLE, WS_EX_NOACTIVATE); 270 | 271 | GESTURECONFIG config; 272 | config.dwID = 0; 273 | config.dwWant = GC_ALLGESTURES; 274 | config.dwBlock = 0; 275 | auto res = SetGestureConfig(int_hw, 0, 1, &config, sizeof(config)); 276 | auto res1 = SetGestureConfig(hwndParent, 0, 1, &config, sizeof(config)); 277 | 278 | RegisterTouchWindow(int_hw, TWF_WANTPALM); 279 | RegisterTouchWindow(hwndParent, TWF_WANTPALM); 280 | 281 | EnumChildWindows(int_hw, Capra, NULL); 282 | EnumChildWindows(hwndParent, Capra, NULL); 283 | 284 | //workaround for "white rectangle" touch 285 | //ToDo: sub-classing will cause an epic crash. Find another workaround. 286 | 287 | return int_hw; 288 | } 289 | 290 | UIElement BaseWindow::BuildUIElement() 291 | { 292 | return Grid(); 293 | } -------------------------------------------------------------------------------- /src/MobileShellExtension/BaseWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | using namespace winrt::Windows::UI::Xaml; 5 | using namespace winrt::Windows::UI::Xaml::Hosting; 6 | 7 | enum ZBID 8 | { 9 | ZBID_DEFAULT = 0, 10 | ZBID_DESKTOP = 1, 11 | ZBID_UIACCESS = 2, 12 | ZBID_IMMERSIVE_IHM = 3, 13 | ZBID_IMMERSIVE_NOTIFICATION = 4, 14 | ZBID_IMMERSIVE_APPCHROME = 5, 15 | ZBID_IMMERSIVE_MOGO = 6, 16 | ZBID_IMMERSIVE_EDGY = 7, 17 | ZBID_IMMERSIVE_INACTIVEMOBODY = 8, 18 | ZBID_IMMERSIVE_INACTIVEDOCK = 9, 19 | ZBID_IMMERSIVE_ACTIVEMOBODY = 10, 20 | ZBID_IMMERSIVE_ACTIVEDOCK = 11, 21 | ZBID_IMMERSIVE_BACKGROUND = 12, 22 | ZBID_IMMERSIVE_SEARCH = 13, 23 | ZBID_GENUINE_WINDOWS = 14, 24 | ZBID_IMMERSIVE_RESTRICTED = 15, 25 | ZBID_SYSTEM_TOOLS = 16, 26 | ZBID_LOCK = 17, 27 | ZBID_ABOVELOCK_UX = 18, 28 | }; 29 | 30 | #pragma once 31 | class BaseWindow 32 | { 33 | 34 | public: 35 | virtual ~BaseWindow() = default; 36 | explicit BaseWindow(_In_ HINSTANCE, LPCWSTR str = L"DEF", ZBID zbid = ZBID_DESKTOP); 37 | void PreBuild(); 38 | void Hide(); 39 | void Show(); 40 | void SetSize(int width, int height, double dpi); 41 | void SetPosition(int x, int y); 42 | 43 | bool GetIsCreateWindowFailed() const 44 | { 45 | return isCreateWindowFailed; 46 | } 47 | 48 | //abstracts (for wndproc) 49 | void OnThemeChanged(); 50 | virtual void OnDisplayChange() = 0; 51 | virtual void OnDpiChanged(const double& dpi) = 0; 52 | 53 | private: 54 | bool InitWindow(HINSTANCE, LPCWSTR str, ZBID zbid); 55 | HWND CreateWindowInternal(const HINSTANCE hInstance, LPCWSTR str, ZBID zbid); 56 | UIElement baseElement = nullptr; 57 | 58 | 59 | protected: 60 | void SetXamlContent(const UIElement& element); 61 | UIElement GetXamlContent(); 62 | virtual UIElement BuildUIElement(); 63 | DesktopWindowXamlSource _xamlSource; 64 | HWND hwndParent; 65 | HWND hwndChild; //xamlhost 66 | int monitorHeight = 0; 67 | int monitorWidth = 0; 68 | int height = 0; 69 | int width = 0; 70 | int x = 0; 71 | int y = 0; 72 | double effectiveDpi = 1; 73 | bool isCreateWindowFailed = false; 74 | }; -------------------------------------------------------------------------------- /src/MobileShellExtension/MobileShellExtension.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | true 7 | true 8 | 15.0 9 | {433ccdba-47f7-4c46-9fa2-793df7d7d83b} 10 | Win32Proj 11 | MobileShellExtension 12 | 10.0.18362.0 13 | 10.0.17134.0 14 | 15 | 16 | 17 | 18 | Debug 19 | Win32 20 | 21 | 22 | Release 23 | Win32 24 | 25 | 26 | Debug 27 | x64 28 | 29 | 30 | Release 31 | x64 32 | 33 | 34 | 35 | Application 36 | v140 37 | v141 38 | v142 39 | Unicode 40 | 41 | 42 | DynamicLibrary 43 | true 44 | true 45 | 46 | 47 | DynamicLibrary 48 | false 49 | true 50 | false 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Use 67 | pch.h 68 | $(IntDir)pch.pch 69 | _CONSOLE;%(PreprocessorDefinitions) 70 | Level4 71 | %(AdditionalOptions) /permissive- /bigobj 72 | 73 | 74 | 75 | 76 | Disabled 77 | _DEBUG;%(PreprocessorDefinitions) 78 | 79 | 80 | Console 81 | false 82 | 83 | 84 | 85 | 86 | WIN32;_WINDOWS;_USRDLL;DLLMAIN_EXPORTS;%(PreprocessorDefinitions) 87 | 88 | 89 | 90 | 91 | MaxSpeed 92 | true 93 | true 94 | NDEBUG;%(PreprocessorDefinitions) 95 | 96 | 97 | Console 98 | true 99 | true 100 | false 101 | Comctl32.lib;ntdll.lib;gdi32.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | Create 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | false 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /src/MobileShellExtension/MobileShellExtension.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {0c60b2a1-cc33-4e1d-87e1-a8ab3df3b5a6} 18 | 19 | 20 | {d8bc3c23-3430-439e-993c-8077f80205a3} 21 | 22 | 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files\Windows 32 | 33 | 34 | Header Files 35 | 36 | 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files\Windows 49 | 50 | 51 | Source Files 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/MobileShellExtension/PropertySheet.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/MobileShellExtension/TrashWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "TrashWindow.h" 3 | 4 | using namespace winrt; 5 | using namespace Windows::Foundation::Numerics; 6 | using namespace Windows::Foundation; 7 | using namespace Windows::UI::Xaml::Data; 8 | using namespace Windows::UI::Xaml::Markup; 9 | using namespace Windows::UI::Xaml::Hosting; 10 | using namespace Windows::UI::Xaml::Controls; 11 | using namespace Windows::UI::Xaml::Media; 12 | using namespace Windows::UI::Xaml; 13 | using namespace Windows::UI::Composition; 14 | using namespace Windows::UI; 15 | 16 | 17 | UIElement TrashWindow::BuildUIElement() 18 | { 19 | Grid xamlContainer; 20 | 21 | Border compBeh; 22 | 23 | AcrylicBrush aBrush; 24 | aBrush.BackgroundSource(AcrylicBackgroundSource::HostBackdrop); 25 | aBrush.TintOpacity(0.5); 26 | aBrush.TintLuminosityOpacity(0.5); 27 | 28 | compBeh.Background(aBrush); 29 | 30 | /*auto _compositor = ElementCompositionPreview::GetElementVisual(compBeh).Compositor(); 31 | auto _hostSprite = _compositor.CreateSpriteVisual(); 32 | _hostSprite.Size(float2(width, height)); 33 | ElementCompositionPreview::SetElementChildVisual(compBeh, _hostSprite); 34 | _hostSprite.Brush(_compositor.CreateHostBackdropBrush()); */ 35 | 36 | xamlContainer.Children().Append(compBeh); 37 | 38 | xamlContainer.CornerRadius(CornerRadius{ 2, 2, 2, 2 }); 39 | xamlContainer.UpdateLayout(); 40 | 41 | return xamlContainer; 42 | } -------------------------------------------------------------------------------- /src/MobileShellExtension/TrashWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | #include "BaseWindow.h" 4 | #include "Utils.h" 5 | 6 | class TrashWindow : 7 | public BaseWindow 8 | { 9 | //const 10 | //int const notificationWindowMaxWidth = 384; 11 | 12 | public: 13 | explicit TrashWindow(HINSTANCE hInstance) : BaseWindow(hInstance, L"TrashWindow", ZBID_DESKTOP) 14 | { 15 | SetDpi(); 16 | } 17 | 18 | UIElement BuildUIElement() override; 19 | 20 | private: 21 | void OnDisplayChange() override 22 | { 23 | const auto orientation = Utils::GetCurrentOrientation(); 24 | 25 | if (orientation == DMDO_DEFAULT || orientation == DMDO_270) 26 | { 27 | 28 | } 29 | 30 | SetDpi(); 31 | } 32 | 33 | void OnDpiChanged(const double& dpi) override 34 | { 35 | SetDpi(); 36 | } 37 | 38 | void SetDpi() 39 | { 40 | Utils::GetMonitorSizeAndDpiFromWindow(this->hwndParent, 41 | &this->effectiveDpi, 42 | &this->monitorHeight, 43 | &this->monitorWidth); 44 | 45 | SetSize(400, monitorHeight - ((48L + 24) * effectiveDpi), effectiveDpi); 46 | SetPosition(0, 24 * effectiveDpi); 47 | } 48 | }; -------------------------------------------------------------------------------- /src/MobileShellExtension/Utils.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | #include 4 | #include "Utils.h" 5 | #include 6 | #include 7 | 8 | #pragma comment(lib, "shell32") 9 | 10 | MONITORINFO Utils::GetMonitorInfoFromWindow(HWND hWnd) 11 | { 12 | const HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST); 13 | MONITORINFO info; 14 | info.cbSize = sizeof(MONITORINFO); 15 | GetMonitorInfo(monitor, &info); 16 | 17 | return info; 18 | } 19 | 20 | void Utils::GetMonitorSizeAndDpiFromWindow(HWND window, double* dpi, int* height, int* width) 21 | { 22 | HMONITOR monitor = MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST); 23 | MONITORINFO info; 24 | info.cbSize = sizeof(MONITORINFO); 25 | GetMonitorInfo(monitor, &info); 26 | *width = info.rcMonitor.right - info.rcMonitor.left; 27 | *height = info.rcMonitor.bottom - info.rcMonitor.top; 28 | 29 | //Get DPI 30 | unsigned int dpiX = 0; 31 | unsigned int dpiY = 0; 32 | GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY); 33 | 34 | *dpi = dpiX / double(96); 35 | } 36 | 37 | DWORD Utils::GetCurrentOrientation() 38 | { 39 | DEVMODE devmode = {}; 40 | devmode.dmSize = sizeof(DEVMODE); 41 | devmode.dmFields = DM_DISPLAYORIENTATION; 42 | 43 | //Check display orientation 44 | EnumDisplaySettingsEx(NULL, ENUM_CURRENT_SETTINGS, &devmode, EDS_RAWMODE); 45 | 46 | return devmode.dmDisplayOrientation; 47 | } 48 | 49 | bool Utils::SystemUsesLightTheme() 50 | { 51 | unsigned long dwData = 0; 52 | unsigned long cbData = sizeof(unsigned long); 53 | 54 | HKEY hThemeKey; 55 | 56 | long error = RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", NULL, KEY_READ, &hThemeKey); 57 | if (error == ERROR_SUCCESS) 58 | { 59 | long errKey = RegQueryValueEx(hThemeKey, L"SystemUsesLightTheme", 0, 0, LPBYTE(&dwData), &cbData); 60 | 61 | if (error == ERROR_SUCCESS) 62 | { 63 | return (bool)dwData; 64 | } 65 | else 66 | { 67 | RegCloseKey(hThemeKey); 68 | return true; 69 | } 70 | } 71 | else 72 | { 73 | return true; 74 | } 75 | } -------------------------------------------------------------------------------- /src/MobileShellExtension/Utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | class Utils 5 | { 6 | public: 7 | static MONITORINFO GetMonitorInfoFromWindow(HWND hWnd); 8 | static void GetMonitorSizeAndDpiFromWindow(HWND window, double* dpi, int* height, int* width); 9 | static DWORD GetCurrentOrientation(); 10 | static bool SystemUsesLightTheme(); 11 | }; 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/MobileShellExtension/main.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | using namespace winrt; 4 | 5 | #pragma comment(lib, "gdi32.lib") 6 | 7 | enum ZBID 8 | { 9 | ZBID_DEFAULT = 0, 10 | ZBID_DESKTOP = 1, 11 | ZBID_UIACCESS = 2, 12 | ZBID_IMMERSIVE_IHM = 3, 13 | ZBID_IMMERSIVE_NOTIFICATION = 4, 14 | ZBID_IMMERSIVE_APPCHROME = 5, 15 | ZBID_IMMERSIVE_MOGO = 6, 16 | ZBID_IMMERSIVE_EDGY = 7, 17 | ZBID_IMMERSIVE_INACTIVEMOBODY = 8, 18 | ZBID_IMMERSIVE_INACTIVEDOCK = 9, 19 | ZBID_IMMERSIVE_ACTIVEMOBODY = 10, 20 | ZBID_IMMERSIVE_ACTIVEDOCK = 11, 21 | ZBID_IMMERSIVE_BACKGROUND = 12, 22 | ZBID_IMMERSIVE_SEARCH = 13, 23 | ZBID_GENUINE_WINDOWS = 14, 24 | ZBID_IMMERSIVE_RESTRICTED = 15, 25 | ZBID_SYSTEM_TOOLS = 16, 26 | ZBID_LOCK = 17, 27 | ZBID_ABOVELOCK_UX = 18, 28 | }; 29 | 30 | LRESULT CALLBACK TrashParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 31 | { 32 | switch (message) 33 | { 34 | case WM_CREATE: 35 | break; 36 | 37 | case WM_DESTROY: 38 | PostQuitMessage(0); 39 | break; 40 | 41 | case WM_WINDOWPOSCHANGING: 42 | return 0; 43 | case WM_CLOSE: 44 | HANDLE myself; 45 | myself = OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessId()); 46 | TerminateProcess(myself, 0); 47 | 48 | return true; 49 | 50 | break; 51 | 52 | default: 53 | break; 54 | } 55 | 56 | return DefWindowProc(hwnd, message, wParam, lParam); 57 | } 58 | 59 | HWND hwnd = NULL; 60 | 61 | typedef HWND(WINAPI* CreateWindowInBand)(_In_ DWORD dwExStyle, _In_opt_ ATOM atom, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam, DWORD band); 62 | typedef BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand); 63 | typedef BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand); 64 | typedef HDWP (WINAPI* DeferWindowPosAndBand)(_In_ HDWP hWinPosInfo, _In_ HWND hWnd, _In_opt_ HWND hWndInsertAfter, _In_ int x, _In_ int y, _In_ int cx, _In_ int cy, _In_ UINT uFlags, DWORD band, DWORD pls); 65 | 66 | typedef BOOL(WINAPI* SetBrokeredForeground)(HWND hWnd); 67 | #define __imp_SetBrokeredForeground 2522 68 | 69 | void CreateWin(HMODULE hModule, UINT zbid, const wchar_t* title, const wchar_t* classname) 70 | { 71 | { 72 | HINSTANCE hInstance = hModule; 73 | 74 | WNDCLASSEX wndParentClass; 75 | 76 | wndParentClass.cbSize = 80; 77 | wndParentClass.cbClsExtra = 0; 78 | wndParentClass.hIcon = NULL; 79 | wndParentClass.lpszMenuName = NULL; 80 | wndParentClass.hIconSm = NULL; 81 | wndParentClass.lpfnWndProc = TrashParentWndProc; 82 | wndParentClass.hInstance = hInstance; 83 | wndParentClass.style = CS_HREDRAW | CS_VREDRAW; 84 | wndParentClass.hCursor = LoadCursor(0, IDC_ARROW); 85 | wndParentClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); 86 | wndParentClass.lpszClassName = classname; 87 | 88 | auto res = RegisterClassEx(&wndParentClass); 89 | 90 | const auto hpath = LoadLibrary(L"user32.dll"); 91 | const auto pCreateWindowInBand = CreateWindowInBand(GetProcAddress(hpath, "CreateWindowInBand")); 92 | const auto pSetWindowBand = SetWindowBand(GetProcAddress(hpath, "SetWindowBand")); 93 | const auto pSetBrokeredForeground = SetBrokeredForeground(GetProcAddress(hpath, MAKEINTRESOURCEA(__imp_SetBrokeredForeground))); 94 | 95 | auto hwndParent = pCreateWindowInBand(WS_EX_TOPMOST | WS_EX_NOACTIVATE, 96 | res, 97 | NULL, 98 | 0x80000000, 99 | 0, 0, 0, 0, 100 | NULL, 101 | NULL, 102 | wndParentClass.hInstance, 103 | LPVOID(res), 104 | zbid); 105 | 106 | HRGN hrg = CreateRoundRectRgn(0, 0, 600, 600, 8, 8); 107 | SetWindowRgn(hwndParent, hrg, true); 108 | 109 | //pSetBrokeredForeground(hwndParent); //Works only if the window is created in ZBID_GENUINE_WINDOWS band. 110 | //pSetWindowBand(hwndParent, HWND_TOPMOST, ZBID_ABOVELOCK_UX); //This still doesn't in any case. 111 | 112 | 113 | SetWindowLong(hwndParent, GWL_STYLE, 0); 114 | SetWindowLong(hwndParent, GWL_EXSTYLE, 0); 115 | 116 | SetWindowPos(hwndParent, nullptr, 40, 40, 600, 600, SWP_SHOWWINDOW | SWP_NOZORDER); 117 | ShowWindow(hwndParent, SW_SHOW); 118 | UpdateWindow(hwndParent); 119 | 120 | if (hwndParent != nullptr) 121 | hwnd = hwndParent; 122 | } 123 | } 124 | 125 | DWORD WINAPI UwU(LPVOID lpParam) 126 | { 127 | init_apartment(); 128 | 129 | //MessageBox(NULL, L"NOT RIP", L"OK", 0); 130 | //auto windows_xaml_manager = WindowsXamlManager::InitializeForCurrentThread(); 131 | //MessageBox(NULL, L"RIP", L"OK", 0); 132 | 133 | CreateWin(NULL, ZBID_SYSTEM_TOOLS, L"Really Genuine Window++", L"TestPlus"); 134 | 135 | auto res = BeginDeferWindowPos(1); 136 | 137 | if (!res) 138 | { 139 | MessageBox(NULL, L"RIP1", L"OK", 0); 140 | } 141 | 142 | const auto hpath = LoadLibrary(L"user32.dll"); 143 | const auto pDeferWindowPosAndBand = DeferWindowPosAndBand(GetProcAddress(hpath, "DeferWindowPosAndBand")); 144 | 145 | res = pDeferWindowPosAndBand(res, hwnd, HWND_TOPMOST, 20, 20, 600, 600, 0, ZBID_DESKTOP, 1); 146 | 147 | if (!res) 148 | { 149 | wchar_t buf[256]; 150 | FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 151 | NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 152 | buf, (sizeof(buf) / sizeof(wchar_t)), NULL); 153 | 154 | MessageBox(NULL, buf, L"RIP_DeferWindowPosAndBand", 0); 155 | } 156 | else 157 | EndDeferWindowPos(res); 158 | 159 | MSG msg; 160 | while (GetMessage(&msg, nullptr, 0, 0)) 161 | { 162 | TranslateMessage(&msg); 163 | DispatchMessage(&msg); 164 | } 165 | 166 | return 0; 167 | } 168 | 169 | BOOL APIENTRY DllMain(HMODULE hModule, 170 | DWORD ul_reason_for_call, 171 | LPVOID lpReserved 172 | ) 173 | { 174 | switch (ul_reason_for_call) 175 | { 176 | case DLL_PROCESS_ATTACH: 177 | CreateThread(nullptr, 0, UwU, hModule, NULL, NULL); 178 | break; 179 | case DLL_THREAD_ATTACH: 180 | case DLL_THREAD_DETACH: 181 | case DLL_PROCESS_DETACH: 182 | break; 183 | } 184 | 185 | return TRUE; 186 | } 187 | 188 | -------------------------------------------------------------------------------- /src/MobileShellExtension/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/MobileShellExtension/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /src/MobileShellExtension/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include -------------------------------------------------------------------------------- /src/MobileShellExtension/readme.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | C++/WinRT MobileShellExtension Project Overview 3 | ======================================================================== 4 | 5 | This project demonstrates how to get started consuming Windows Runtime 6 | classes directly from standard C++, using platform projection headers 7 | generated from Windows SDK metadata files. 8 | 9 | Steps to generate and consume SDK platform projection: 10 | 1. Build project initally to generate platform projection headers into 11 | your Generated Files folder. 12 | 2. Include a projection namespace header in your pch.h, such as 13 | . 14 | 3. Consume winrt namespace and any Windows Runtime namespaces, such as 15 | winrt::Windows::Foundation, from source code. 16 | 4. Initialize apartment via init_apartment() and consume winrt classes. 17 | 18 | Steps to generate and consume a projection from third party metadata: 19 | 1. Add a WinMD reference by right-clicking the References project node 20 | and selecting "Add Reference...". In the Add References dialog, 21 | browse to the component WinMD you want to consume and add it. 22 | 2. Build the project once to generate projection headers for the 23 | referenced WinMD file under the "Generated Files" subfolder. 24 | 3. As above, include projection headers in pch or source code 25 | to consume projected Windows Runtime classes. 26 | 27 | ======================================================================== 28 | Learn more about C++/WinRT here: 29 | http://aka.ms/cppwinrt/ 30 | ======================================================================== 31 | -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/LargeTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/LargeTile.scale-100.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/LargeTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/LargeTile.scale-125.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/LargeTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/LargeTile.scale-150.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/LargeTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/LargeTile.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/LargeTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/LargeTile.scale-400.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SmallTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SmallTile.scale-100.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SmallTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SmallTile.scale-125.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SmallTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SmallTile.scale-150.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SmallTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SmallTile.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SmallTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SmallTile.scale-400.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SplashScreen.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SplashScreen.scale-125.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SplashScreen.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SplashScreen.scale-150.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/SplashScreen.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/SplashScreen.scale-400.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square150x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square150x150Logo.scale-100.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square150x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square150x150Logo.scale-125.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square150x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square150x150Logo.scale-150.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square150x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square150x150Logo.scale-400.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-24.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-32.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-unplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-unplated_targetsize-16.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-unplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-unplated_targetsize-256.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-unplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-unplated_targetsize-32.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.altform-unplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.altform-unplated_targetsize-48.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.scale-100.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.scale-125.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.scale-150.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.scale-400.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.targetsize-16.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.targetsize-24.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.targetsize-256.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.targetsize-32.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Square44x44Logo.targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Square44x44Logo.targetsize-48.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/StoreLogo.backup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/StoreLogo.backup.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/StoreLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/StoreLogo.scale-125.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/StoreLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/StoreLogo.scale-150.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/StoreLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/StoreLogo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/StoreLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/StoreLogo.scale-400.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Wide310x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Wide310x150Logo.scale-100.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Wide310x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Wide310x150Logo.scale-125.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Wide310x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Wide310x150Logo.scale-150.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/Images/Wide310x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPackaging/Images/Wide310x150Logo.scale-400.png -------------------------------------------------------------------------------- /src/MobileShellPackaging/MobileShellPackaging.wapproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 15.0 5 | 6 | 7 | 8 | Debug 9 | x86 10 | 11 | 12 | Release 13 | x86 14 | 15 | 16 | Debug 17 | x64 18 | 19 | 20 | Release 21 | x64 22 | 23 | 24 | Debug 25 | ARM 26 | 27 | 28 | Release 29 | ARM 30 | 31 | 32 | Debug 33 | ARM64 34 | 35 | 36 | Release 37 | ARM64 38 | 39 | 40 | Debug 41 | AnyCPU 42 | 43 | 44 | Release 45 | AnyCPU 46 | 47 | 48 | 49 | $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\ 50 | 51 | 52 | 53 | 1d0cc079-1e79-4042-8ae4-fb4dd1a6f572 54 | 10.0.18362.0 55 | 10.0.18362.0 56 | en-US 57 | True 58 | ..\MobileShellPlus\MobileShellPlus.vcxproj 59 | False 60 | 08E959E7AD6617DAC6D421E2C0072B78591BE5D0 61 | SHA512 62 | True 63 | False 64 | False 65 | x86|x64|arm64 66 | 0 67 | 68 | 69 | Always 70 | 71 | 72 | Always 73 | 74 | 75 | Always 76 | 77 | 78 | Always 79 | 80 | 81 | Always 82 | 83 | 84 | Always 85 | 86 | 87 | Always 88 | 89 | 90 | Always 91 | 92 | 93 | Always 94 | 95 | 96 | Always 97 | 98 | 99 | 100 | Designer 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /src/MobileShellPackaging/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 9 | 10 | 14 | 15 | 16 | MobileShell Alpha 17 | ADeltaX 18 | Images\StoreLogo.png 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/MobileShellPlus/Application.manifest: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | MobileShell 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | true/PM 27 | PerMonitorV2, PerMonitor 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/MobileShellPlus/BaseWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "BaseWindow.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "Utils.h" 9 | 10 | #pragma comment(lib, "SHCore") 11 | #pragma comment(lib, "shell32") 12 | #pragma comment(lib, "cfgmgr32") 13 | 14 | using namespace winrt; 15 | using namespace Windows::Foundation::Numerics; 16 | using namespace Windows::Foundation; 17 | using namespace Windows::UI::Xaml::Data; 18 | using namespace Windows::UI::Xaml::Markup; 19 | using namespace Windows::UI::Xaml::Hosting; 20 | using namespace Windows::UI::Xaml::Controls; 21 | using namespace Windows::UI::Xaml::Media; 22 | using namespace Windows::UI::Xaml; 23 | using namespace Windows::UI::Composition; 24 | using namespace Windows::UI; 25 | 26 | typedef HWND(WINAPI* CreateWindowInBand)(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam, DWORD band); 27 | typedef BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand); 28 | typedef BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand); 29 | 30 | BaseWindow::BaseWindow(_In_ HINSTANCE hInstance, LPCWSTR str, ZBID zbid) 31 | { 32 | InitWindow(hInstance, str, zbid); 33 | } 34 | 35 | bool BaseWindow::InitWindow(HINSTANCE hInstance, LPCWSTR str, ZBID zbid) 36 | { 37 | hwndChild = CreateWindowInternal(hInstance, str, zbid); 38 | 39 | if (hwndChild == NULL) 40 | { 41 | isCreateWindowFailed = true; 42 | return false; 43 | } 44 | 45 | SetWindowPos(hwndParent, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER); 46 | SetWindowPos(hwndChild, nullptr, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOZORDER); 47 | 48 | return true; 49 | } 50 | 51 | void BaseWindow::SetXamlContent(const UIElement& element) 52 | { 53 | _xamlSource.Content(element); //default 54 | baseElement = element; 55 | } 56 | 57 | UIElement BaseWindow::GetXamlContent() 58 | { 59 | return baseElement; 60 | } 61 | 62 | void BaseWindow::SetSize(int width, int height, double dpi) 63 | { 64 | SetWindowPos(hwndChild, nullptr, 0, 0, width, height, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSENDCHANGING); 65 | SetWindowPos(hwndParent, nullptr, 0, 0, width, height, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSENDCHANGING); 66 | this->width = width; 67 | this->height = height; 68 | this->effectiveDpi = dpi; 69 | } 70 | 71 | void BaseWindow::SetPosition(int x, int y) 72 | { 73 | SetWindowPos(hwndParent, nullptr, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOSENDCHANGING); 74 | this->x = x; 75 | this->y = y; 76 | } 77 | 78 | void BaseWindow::PreBuild() 79 | { 80 | if (baseElement == nullptr) 81 | SetXamlContent(BuildUIElement()); 82 | } 83 | 84 | void BaseWindow::Hide() 85 | { 86 | ShowWindow(hwndParent, SW_HIDE); 87 | UpdateWindow(hwndParent); 88 | } 89 | 90 | void BaseWindow::Show() 91 | { 92 | ShowWindow(hwndParent, SW_SHOW); 93 | UpdateWindow(hwndParent); 94 | } 95 | 96 | LRESULT CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 97 | { 98 | BaseWindow* wthis; 99 | 100 | if (message == WM_NCCREATE) 101 | { 102 | wthis = static_cast(reinterpret_cast(lParam)->lpCreateParams); 103 | 104 | SetLastError(0); 105 | if (!SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(wthis))) 106 | { 107 | if (GetLastError() != 0) 108 | return FALSE; 109 | } 110 | } 111 | else 112 | { 113 | wthis = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); 114 | } 115 | 116 | switch (message) 117 | { 118 | case WM_DESTROY: 119 | PostQuitMessage(0); 120 | break; 121 | 122 | case WM_WINDOWPOSCHANGING: 123 | return 0; 124 | 125 | case WM_DISPLAYCHANGE: 126 | if (wthis) 127 | wthis->OnDisplayChange(); 128 | break; 129 | 130 | //!!! WORKAROUND FOR STARTMENU/TASKVIEW FOCUS ISSUE 131 | case WM_MOUSEACTIVATE: 132 | return MA_NOACTIVATE; 133 | 134 | //this is useless and not working 135 | case WM_TABLET_QUERYSYSTEMGESTURESTATUS: 136 | return TABLET_DISABLE_PRESSANDHOLD; 137 | 138 | case WM_RBUTTONDOWN: 139 | return -1; 140 | //!!! END OF WORKAROUND FOR STARTMENU/TASKVIEW FOCUS ISSUE 141 | 142 | 143 | //!!! WORKAROUND FOR THEME NOT CHANGING AUTOMATICALLY 144 | case WM_DWMCOLORIZATIONCOLORCHANGED: 145 | case WM_DWMCOMPOSITIONCHANGED: 146 | case WM_THEMECHANGED: 147 | //uwu 148 | if (wthis) 149 | wthis->OnThemeChanged(); 150 | break; 151 | 152 | case WM_SETTINGCHANGE: 153 | if (lParam) 154 | { 155 | auto lParamString = reinterpret_cast(lParam); 156 | if (wcscmp(lParamString, L"ImmersiveColorSet") || wcscmp(lParamString, L"WindowsThemeElement")) 157 | { 158 | if (wthis) 159 | wthis->OnThemeChanged(); 160 | } 161 | } 162 | 163 | break; 164 | //!!! END OF WORKAROUND FOR THEME NOT CHANGING AUTOMATICALLY 165 | 166 | case WM_DPICHANGED: 167 | if (wthis) 168 | { 169 | const auto dpi = LOWORD(wParam) / 96.0; 170 | wthis->OnDpiChanged(dpi); 171 | } 172 | break; 173 | default: 174 | return DefWindowProc(hwnd, message, wParam, lParam); 175 | } 176 | 177 | return DefWindowProc(hwnd, message, wParam, lParam); 178 | } 179 | 180 | void BaseWindow::OnThemeChanged() 181 | { 182 | auto xamlroot = GetXamlContent(); 183 | 184 | if (xamlroot != nullptr) 185 | { 186 | if (FrameworkElement g = xamlroot.as()) 187 | { 188 | if (Utils::SystemUsesLightTheme()) 189 | g.RequestedTheme(ElementTheme::Light); 190 | else 191 | g.RequestedTheme(ElementTheme::Dark); 192 | } 193 | } 194 | } 195 | 196 | BOOL CALLBACK Capra(HWND hwnd, LPARAM lParam) 197 | { 198 | GESTURECONFIG config; 199 | config.dwID = 0; 200 | config.dwWant = GC_ALLGESTURES; 201 | config.dwBlock = 0; 202 | auto res = SetGestureConfig(hwnd, 0, 1, &config, sizeof(config)); 203 | 204 | RegisterTouchWindow(hwnd, TWF_WANTPALM); 205 | 206 | return true; 207 | } 208 | 209 | HWND BaseWindow::CreateWindowInternal(HINSTANCE hInstance, LPCWSTR str, ZBID zbid) 210 | { 211 | auto lpszClassName = str; 212 | 213 | WNDCLASS wndParentClass; 214 | 215 | wndParentClass.style = CS_HREDRAW | CS_VREDRAW; 216 | wndParentClass.lpfnWndProc = ParentWndProc; 217 | wndParentClass.cbClsExtra = 0; 218 | wndParentClass.cbWndExtra = sizeof(BaseWindow); 219 | wndParentClass.hInstance = hInstance; 220 | wndParentClass.hIcon = LoadIcon(hInstance, IDI_APPLICATION); 221 | wndParentClass.hCursor = LoadCursor(hInstance, IDC_ARROW); 222 | wndParentClass.hbrBackground = static_cast(GetStockObject(WHITE_BRUSH)); 223 | wndParentClass.lpszMenuName = nullptr; 224 | wndParentClass.lpszClassName = lpszClassName; 225 | 226 | if (!RegisterClass(&wndParentClass)) 227 | { 228 | DWORD Error = GetLastError(); 229 | //MessageBox(nullptr, TEXT("Error registering window class."), lpszClassName, MB_ICONERROR); 230 | return NULL; 231 | } 232 | 233 | const auto hpath = LoadLibrary(L"user32.dll"); 234 | const auto proc_add = CreateWindowInBand(GetProcAddress(hpath, "CreateWindowInBand")); 235 | 236 | hwndParent = proc_add(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOREDIRECTIONBITMAP | WS_EX_NOACTIVATE, lpszClassName, 237 | TEXT("MobShell"), 238 | 0L, 239 | CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 240 | nullptr, 241 | nullptr, 242 | wndParentClass.hInstance, 243 | this, 244 | zbid); 245 | 246 | if (!hwndParent) 247 | { 248 | return NULL; 249 | 250 | const auto err = GetLastError(); 251 | const auto test1 = std::to_string(err); 252 | MessageBoxA(hwndParent, test1.c_str(), "NO", 0); 253 | 254 | exit(0); 255 | } 256 | 257 | SetWindowLong(hwndParent, GWL_STYLE, 0); 258 | SetWindowLong(hwndParent, GWL_EXSTYLE, 0); 259 | ShowWindow(hwndParent, 0); 260 | UpdateWindow(hwndParent); 261 | 262 | auto interop_detail = _xamlSource.as(); 263 | check_hresult(interop_detail->AttachToWindow(hwndParent)); 264 | 265 | HWND int_hw; 266 | 267 | interop_detail->get_WindowHandle(&int_hw); 268 | 269 | SetWindowLong(hwndParent, GWL_EXSTYLE, WS_EX_NOACTIVATE); 270 | 271 | GESTURECONFIG config; 272 | config.dwID = 0; 273 | config.dwWant = GC_ALLGESTURES; 274 | config.dwBlock = 0; 275 | auto res = SetGestureConfig(int_hw, 0, 1, &config, sizeof(config)); 276 | auto res1 = SetGestureConfig(hwndParent, 0, 1, &config, sizeof(config)); 277 | 278 | RegisterTouchWindow(int_hw, TWF_WANTPALM); 279 | RegisterTouchWindow(hwndParent, TWF_WANTPALM); 280 | 281 | EnumChildWindows(int_hw, Capra, NULL); 282 | EnumChildWindows(hwndParent, Capra, NULL); 283 | 284 | //workaround for "white rectangle" touch 285 | //ToDo: sub-classing will cause an epic crash. Find another workaround. 286 | 287 | return int_hw; 288 | } 289 | 290 | UIElement BaseWindow::BuildUIElement() 291 | { 292 | return Grid(); 293 | } -------------------------------------------------------------------------------- /src/MobileShellPlus/BaseWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | using namespace winrt::Windows::UI::Xaml; 5 | using namespace winrt::Windows::UI::Xaml::Hosting; 6 | 7 | enum ZBID 8 | { 9 | ZBID_DEFAULT = 0, 10 | ZBID_DESKTOP = 1, 11 | ZBID_UIACCESS = 2, 12 | ZBID_IMMERSIVE_IHM = 3, 13 | ZBID_IMMERSIVE_NOTIFICATION = 4, 14 | ZBID_IMMERSIVE_APPCHROME = 5, 15 | ZBID_IMMERSIVE_MOGO = 6, 16 | ZBID_IMMERSIVE_EDGY = 7, 17 | ZBID_IMMERSIVE_INACTIVEMOBODY = 8, 18 | ZBID_IMMERSIVE_INACTIVEDOCK = 9, 19 | ZBID_IMMERSIVE_ACTIVEMOBODY = 10, 20 | ZBID_IMMERSIVE_ACTIVEDOCK = 11, 21 | ZBID_IMMERSIVE_BACKGROUND = 12, 22 | ZBID_IMMERSIVE_SEARCH = 13, 23 | ZBID_GENUINE_WINDOWS = 14, 24 | ZBID_IMMERSIVE_RESTRICTED = 15, 25 | ZBID_SYSTEM_TOOLS = 16, 26 | ZBID_LOCK = 17, 27 | ZBID_ABOVELOCK_UX = 18, 28 | }; 29 | 30 | #pragma once 31 | class BaseWindow 32 | { 33 | 34 | public: 35 | virtual ~BaseWindow() = default; 36 | explicit BaseWindow(_In_ HINSTANCE, LPCWSTR str = L"DEF", ZBID zbid = ZBID_DEFAULT); 37 | void PreBuild(); 38 | void Hide(); 39 | void Show(); 40 | void SetSize(int width, int height, double dpi); 41 | void SetPosition(int x, int y); 42 | 43 | bool GetIsCreateWindowFailed() const 44 | { 45 | return isCreateWindowFailed; 46 | } 47 | 48 | //abstracts (for wndproc) 49 | void OnThemeChanged(); 50 | virtual void OnDisplayChange() = 0; 51 | virtual void OnDpiChanged(const double& dpi) = 0; 52 | 53 | private: 54 | bool InitWindow(HINSTANCE, LPCWSTR str, ZBID zbid); 55 | HWND CreateWindowInternal(const HINSTANCE hInstance, LPCWSTR str, ZBID zbid); 56 | UIElement baseElement = nullptr; 57 | 58 | 59 | protected: 60 | void SetXamlContent(const UIElement& element); 61 | UIElement GetXamlContent(); 62 | virtual UIElement BuildUIElement(); 63 | DesktopWindowXamlSource _xamlSource; 64 | HWND hwndParent; 65 | HWND hwndChild; //xamlhost 66 | int monitorHeight = 0; 67 | int monitorWidth = 0; 68 | int height = 0; 69 | int width = 0; 70 | int x = 0; 71 | int y = 0; 72 | double effectiveDpi = 1; 73 | bool isCreateWindowFailed = false; 74 | }; -------------------------------------------------------------------------------- /src/MobileShellPlus/LayoutTransformControl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class LayoutTransformControl : public winrt::Windows::UI::Xaml::Controls::ContentControl 4 | { 5 | public: 6 | winrt::Windows::UI::Xaml::Media::Transform Transform(); 7 | void Transform(winrt::Windows::UI::Xaml::Media::Transform const& transform); 8 | void MatrixTransform(winrt::Windows::UI::Xaml::Media::MatrixTransform const& matrixTransform); 9 | winrt::Windows::UI::Xaml::Media::MatrixTransform MatrixTransform(); 10 | LayoutTransformControl(); 11 | void TransformUpdated(); 12 | static bool IsSizeSmaller(winrt::Windows::Foundation::Size a, winrt::Windows::Foundation::Size b); 13 | void ProcessTransform(); 14 | winrt::Windows::UI::Xaml::Media::Matrix GetTransformMatrix(winrt::Windows::UI::Xaml::Media::Transform transform); 15 | static winrt::Windows::UI::Xaml::Media::Matrix GetMatrix(winrt::Windows::UI::Xaml::Media::RotateTransform transform); 16 | static winrt::Windows::UI::Xaml::Media::Matrix GetMatrix(const winrt::Windows::UI::Xaml::Media::ScaleTransform transform); 17 | static winrt::Windows::UI::Xaml::Media::Matrix GetMatrix(const winrt::Windows::UI::Xaml::Media::SkewTransform transform); 18 | static winrt::Windows::UI::Xaml::Media::Matrix GetMatrix(const winrt::Windows::UI::Xaml::Media::TranslateTransform transform); 19 | static winrt::Windows::Foundation::Rect RectTransform(winrt::Windows::Foundation::Rect rectangle, winrt::Windows::UI::Xaml::Media::Matrix matrix); 20 | static winrt::Windows::Foundation::Size ComputeLargestTransformedSize(winrt::Windows::Foundation::Size arrangeBounds); 21 | protected: 22 | winrt::Windows::Foundation::Size MeasureOverride(winrt::Windows::Foundation::Size const& availableSize) const; 23 | winrt::Windows::Foundation::Size ArrangeOverride(winrt::Windows::Foundation::Size const& finalSize) const; 24 | void OnContentChanged(IInspectable const& oldContent, IInspectable const& newContent) const; 25 | 26 | }; 27 | 28 | -------------------------------------------------------------------------------- /src/MobileShellPlus/MatrixExt.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "MatrixExt.h" 3 | 4 | #define _USE_MATH_DEFINES 5 | #include 6 | 7 | using namespace winrt::Windows::Foundation; 8 | using namespace winrt::Windows::UI::Xaml; 9 | using namespace winrt::Windows::UI::Xaml::Controls; 10 | using namespace winrt::Windows::UI::Xaml::Media; 11 | using namespace winrt::Windows::UI::Xaml::Markup; 12 | 13 | bool MatrixExt::HasInverse(const Matrix& matrix) 14 | { 15 | return ((matrix.M11 * matrix.M22) - (matrix.M12 * matrix.M21)) != 0; 16 | } 17 | 18 | Matrix MatrixExt::Multiply(const Matrix& matrix1, const Matrix& matrix2) 19 | { 20 | return Matrix{ 21 | (matrix1.M11 * matrix2.M11) + (matrix1.M12 * matrix2.M21), 22 | (matrix1.M11 * matrix2.M12) + (matrix1.M12 * matrix2.M22), 23 | (matrix1.M21 * matrix2.M11) + (matrix1.M22 * matrix2.M21), 24 | (matrix1.M21 * matrix2.M12) + (matrix1.M22 * matrix2.M22), 25 | ((matrix1.OffsetX * matrix2.M11) + (matrix1.OffsetY * matrix2.M21)) + matrix2.OffsetX, 26 | ((matrix1.OffsetX * matrix2.M12) + (matrix1.OffsetY * matrix2.M22)) + matrix2.OffsetY }; 27 | } 28 | 29 | Matrix MatrixExt::Rotate(const Matrix& matrix, const double& angle) 30 | { 31 | return Multiply(matrix, CreateRotationRadians((std::fmod(angle, 360)) * (M_PI / 180.0))); 32 | } 33 | 34 | Matrix MatrixExt::RotateAt(const Matrix& matrix, const double& angle, const double& centerX, const double& centerY) 35 | { 36 | return Multiply(matrix, CreateRotationRadians((std::fmod(angle, 360)) * (M_PI / 180.0), centerX, centerY)); 37 | } 38 | 39 | Matrix MatrixExt::Scale(const Matrix& matrix, const double& scaleX, const double& scaleY) 40 | { 41 | return Multiply(matrix, CreateScaling(scaleX, scaleY)); 42 | } 43 | 44 | Matrix MatrixExt::ScaleAt(const Matrix& matrix, const double& scaleX, const double& scaleY, const double& centerX, const double& centerY) 45 | { 46 | return Multiply(matrix, CreateScaling(scaleX, scaleY, centerX, centerY)); 47 | } 48 | 49 | Matrix MatrixExt::Skew(const Matrix& matrix, const double& skewX, const double& skewY) 50 | { 51 | return Multiply(matrix, CreateSkewRadians(std::fmod(skewX, 360) * (M_PI / 180.0), std::fmod(skewY, 360) * (M_PI / 180.0))); 52 | } 53 | 54 | Matrix MatrixExt::Translate(const Matrix& matrix, const double& offsetX, const double& offsetY) 55 | { 56 | return Matrix{matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.OffsetX + offsetX, matrix.OffsetY + offsetY }; 57 | } 58 | 59 | Matrix MatrixExt::Round(const Matrix& matrix, const int& decimalsAfterRound) 60 | { 61 | const auto pow_num = std::pow(10, decimalsAfterRound); 62 | 63 | return Matrix{ 64 | std::round(matrix.M11 * pow_num) / pow_num, 65 | std::round(matrix.M12 * pow_num) / pow_num, 66 | std::round(matrix.M21 * pow_num) / pow_num, 67 | std::round(matrix.M22 * pow_num) / pow_num, 68 | matrix.OffsetX, 69 | matrix.OffsetY }; 70 | } 71 | 72 | Matrix MatrixExt::CreateRotationRadians(const double& angle) 73 | { 74 | return CreateRotationRadians(angle, 0, 0); 75 | } 76 | 77 | Matrix MatrixExt::CreateRotationRadians(const double& angle, const double& centerX, const double& centerY) 78 | { 79 | const auto sin = std::sin(angle); 80 | const auto cos = std::cos(angle); 81 | const auto dx = (centerX * (1.0 - cos)) + (centerY * sin); 82 | const auto dy = (centerY * (1.0 - cos)) - (centerX * sin); 83 | 84 | return Matrix{cos, sin, -sin, cos, dx, dy}; 85 | } 86 | 87 | Matrix MatrixExt::CreateScaling(const double& scaleX, const double& scaleY) 88 | { 89 | return Matrix{ scaleX, 0, 0, scaleY, 0, 0 }; 90 | } 91 | 92 | Matrix MatrixExt::CreateScaling(const double& scaleX, const double& scaleY, const double& centerX, const double& centerY) 93 | { 94 | return Matrix{ scaleX, 0, 0, scaleY, centerX - (scaleX * centerX), centerY - (scaleY * centerY) }; 95 | } 96 | 97 | Matrix MatrixExt::CreateSkewRadians(const double& skewX, const double& skewY) 98 | { 99 | return Matrix{ 1.0, std::tan(skewY), std::tan(skewX), 1.0, 0.0, 0.0 }; 100 | } 101 | -------------------------------------------------------------------------------- /src/MobileShellPlus/MatrixExt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | using namespace winrt::Windows::Foundation; 4 | using namespace winrt::Windows::UI::Xaml; 5 | using namespace winrt::Windows::UI::Xaml::Controls; 6 | using namespace winrt::Windows::UI::Xaml::Media; 7 | using namespace winrt::Windows::UI::Xaml::Markup; 8 | 9 | class MatrixExt 10 | { 11 | public: 12 | static bool HasInverse(const Matrix& matrix); 13 | static Matrix Multiply(const Matrix& matrix1, const Matrix& matrix2); 14 | static Matrix Rotate(const Matrix& matrix, const double& angle); 15 | static Matrix RotateAt(const Matrix& matrix, const double& angle, const double& centerX, const double& centerY); 16 | static Matrix Scale(const Matrix& matrix, const double& scaleX, const double& scaleY); 17 | static Matrix ScaleAt(const Matrix& matrix, const double& scaleX, const double& scaleY, const double& centerX, const double& centerY); 18 | static Matrix Skew(const Matrix& matrix, const double& skewX, const double& skewY); 19 | static Matrix Translate(const Matrix& matrix, const double& offsetX, const double& offsetY); 20 | static Matrix Round(const Matrix& matrix, const int& decimalsAfterRound); 21 | 22 | private: 23 | static Matrix CreateRotationRadians(const double& angle); 24 | static Matrix CreateRotationRadians(const double& angle, const double& centerX, const double& centerY); 25 | static Matrix CreateScaling(const double& scaleX, const double& scaleY); 26 | static Matrix CreateScaling(const double& scaleX, const double& scaleY, const double& centerX, const double& centerY); 27 | static Matrix CreateSkewRadians(const double& skewX, const double& skewY); 28 | }; 29 | -------------------------------------------------------------------------------- /src/MobileShellPlus/MobileShellPlus.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | true 7 | true 8 | 15.0 9 | {3fc7bbb1-922f-4d87-bb5e-2d33ce2cfbc7} 10 | Win32Proj 11 | MobileShellPlus 12 | 10.0.18362.0 13 | 10.0.17763.0 14 | C++/WinRT 15 | true 16 | true 17 | 18 | 19 | 20 | 21 | Debug 22 | ARM 23 | 24 | 25 | Debug 26 | ARM64 27 | 28 | 29 | Debug 30 | Win32 31 | 32 | 33 | Release 34 | ARM 35 | 36 | 37 | Release 38 | ARM64 39 | 40 | 41 | Release 42 | Win32 43 | 44 | 45 | Debug 46 | x64 47 | 48 | 49 | Release 50 | x64 51 | 52 | 53 | 54 | Application 55 | v140 56 | v141 57 | v142 58 | Unicode 59 | 60 | 61 | true 62 | true 63 | 64 | 65 | false 66 | true 67 | false 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | Use 84 | pch.h 85 | $(IntDir)pch.pch 86 | _CONSOLE;%(PreprocessorDefinitions) 87 | Level3 88 | %(AdditionalOptions) /permissive- /bigobj 89 | 90 | 91 | PerMonitorHighDPIAware 92 | 93 | 94 | 95 | 96 | Disabled 97 | _DEBUG;%(PreprocessorDefinitions) 98 | 99 | 100 | Windows 101 | false 102 | Comctl32.lib;ntdll.lib;gdi32.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 103 | Comctl32.lib;ntdll.lib;gdi32.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 104 | Comctl32.lib;ntdll.lib;gdi32.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | copy /Y "$(TargetDir)$(ProjectName).exe" "Z:\$(ProjectName).exe" 120 | 121 | 122 | 123 | 124 | WIN32;%(PreprocessorDefinitions) 125 | 126 | 127 | Comctl32.lib;ntdll.lib;gdi32.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | MaxSpeed 137 | true 138 | true 139 | NDEBUG;%(PreprocessorDefinitions) 140 | MultiThreaded 141 | MultiThreaded 142 | MultiThreaded 143 | MultiThreaded 144 | true 145 | 146 | 147 | Windows 148 | true 149 | true 150 | false 151 | Comctl32.lib;gdi32.lib;ntdll.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 152 | Comctl32.lib;ntdll.lib;gdi32.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 153 | Comctl32.lib;ntdll.lib;gdi32.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 154 | Comctl32.lib;ntdll.lib;gdi32.lib;kernel32.lib;user32.lib;dwmapi.lib;%(AdditionalDependencies) 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | copy /Y "$(TargetDir)$(ProjectName).exe" "Z:\$(ProjectName).exe" 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | Create 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | false 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}. 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /src/MobileShellPlus/MobileShellPlus.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {03b87eb1-7728-4b02-8f12-f44fb32e7e41} 18 | 19 | 20 | {9da4361a-6585-4db4-8e5f-a2337f3ab0a1} 21 | 22 | 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files\Windows 32 | 33 | 34 | Header Files\Windows 35 | 36 | 37 | Header Files\Windows 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files\Windows 55 | 56 | 57 | Source Files\Windows 58 | 59 | 60 | Source Files\Windows 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | Resource Files 82 | 83 | 84 | -------------------------------------------------------------------------------- /src/MobileShellPlus/NavBarWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | #include "BaseWindow.h" 4 | #include "Utils.h" 5 | #include "Wnf.h" 6 | 7 | #pragma once 8 | class NavBarWindow : public BaseWindow 9 | { 10 | //const 11 | int const navBarHeight = 48; 12 | UINT appbarMessageId = -1; 13 | FrameworkElement base = nullptr; 14 | FrameworkElement child = nullptr; 15 | 16 | winrt::Windows::UI::Core::CoreDispatcher xamlDispatcher = nullptr; 17 | 18 | public: 19 | explicit NavBarWindow(const HINSTANCE hInstance) : BaseWindow(hInstance) 20 | { 21 | Configure(); 22 | } 23 | 24 | UIElement BuildUIElement() override; 25 | void HandleRotation(const FrameworkElement& base, const FrameworkElement& child); 26 | void SendHapticFeedback(); 27 | void SetupHaptics(); 28 | void SetupAppBar(bool istabletmode); 29 | 30 | private: 31 | void OnDisplayChange() override 32 | { 33 | Configure(); 34 | 35 | if (Wnf::IsTabletMode()) 36 | SetupAppBar(true); 37 | } 38 | 39 | void OnDpiChanged(const double& dpi) override 40 | { 41 | Configure(); 42 | 43 | if (Wnf::IsTabletMode()) 44 | SetupAppBar(true); 45 | } 46 | 47 | void Configure() 48 | { 49 | Utils::GetMonitorSizeAndDpiFromWindow(this->hwndParent, 50 | &this->effectiveDpi, 51 | &this->monitorHeight, 52 | &this->monitorWidth); 53 | 54 | const auto orientation = Utils::GetCurrentOrientation(); 55 | 56 | if (orientation == DMDO_DEFAULT || orientation == DMDO_180) 57 | { 58 | SetSize(monitorWidth, std::ceil(navBarHeight * effectiveDpi), effectiveDpi); 59 | SetPosition(0, std::ceil(monitorHeight - (navBarHeight * effectiveDpi))); 60 | } 61 | else if (orientation == DMDO_90) 62 | { 63 | SetSize(std::ceil(navBarHeight * effectiveDpi), monitorHeight, effectiveDpi); 64 | SetPosition(0, 0); 65 | } 66 | else if (orientation == DMDO_270) 67 | { 68 | SetSize(std::ceil(navBarHeight * effectiveDpi), monitorHeight, effectiveDpi); 69 | SetPosition(monitorWidth - (navBarHeight * effectiveDpi), 0); 70 | } 71 | } 72 | }; 73 | 74 | -------------------------------------------------------------------------------- /src/MobileShellPlus/NotificationWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "NotificationWindow.h" 3 | 4 | using namespace winrt; 5 | using namespace Windows::Foundation::Numerics; 6 | using namespace Windows::Foundation; 7 | using namespace Windows::UI::Xaml::Data; 8 | using namespace Windows::UI::Xaml::Markup; 9 | using namespace Windows::UI::Xaml::Hosting; 10 | using namespace Windows::UI::Xaml::Controls; 11 | using namespace Windows::UI::Xaml::Media; 12 | using namespace Windows::UI::Xaml; 13 | using namespace Windows::UI::Composition; 14 | using namespace Windows::UI; 15 | 16 | UIElement NotificationWindow::BuildUIElement() 17 | { 18 | Grid xamlContainer; 19 | 20 | Border compBeh; 21 | 22 | AcrylicBrush aBrush; 23 | aBrush.BackgroundSource(AcrylicBackgroundSource::HostBackdrop); 24 | aBrush.TintOpacity(0.5); 25 | aBrush.TintLuminosityOpacity(0.5); 26 | 27 | compBeh.Background(aBrush); 28 | 29 | /*auto _compositor = ElementCompositionPreview::GetElementVisual(compBeh).Compositor(); 30 | auto _hostSprite = _compositor.CreateSpriteVisual(); 31 | 32 | _hostSprite.Size(float2(width, height)); 33 | ElementCompositionPreview::SetElementChildVisual(compBeh, _hostSprite); 34 | 35 | _hostSprite.Brush(_compositor.CreateHostBackdropBrush()); */ 36 | 37 | xamlContainer.Children().Append(compBeh); 38 | 39 | xamlContainer.CornerRadius(CornerRadius{ 2, 2, 2, 2 }); 40 | xamlContainer.UpdateLayout(); 41 | 42 | return xamlContainer; 43 | } 44 | -------------------------------------------------------------------------------- /src/MobileShellPlus/NotificationWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BaseWindow.h" 3 | #include "Utils.h" 4 | 5 | #pragma once 6 | class NotificationWindow : public BaseWindow 7 | { 8 | //const 9 | //int const notificationWindowMaxWidth = 384; 10 | 11 | public: 12 | explicit NotificationWindow(HINSTANCE hInstance) : BaseWindow(hInstance, L"NotificationWindow") 13 | { 14 | SetDpi(); 15 | } 16 | 17 | UIElement BuildUIElement() override; 18 | 19 | private: 20 | void OnDisplayChange() override 21 | { 22 | const auto orientation = Utils::GetCurrentOrientation(); 23 | 24 | if (orientation == DMDO_DEFAULT || orientation == DMDO_270) 25 | { 26 | 27 | } 28 | 29 | SetDpi(); 30 | } 31 | 32 | void OnDpiChanged(const double& dpi) override 33 | { 34 | SetDpi(); 35 | } 36 | 37 | void SetDpi() 38 | { 39 | Utils::GetMonitorSizeAndDpiFromWindow(this->hwndParent, 40 | &this->effectiveDpi, 41 | &this->monitorHeight, 42 | &this->monitorWidth); 43 | 44 | SetSize(400, monitorHeight - ((48L + 24) * effectiveDpi), effectiveDpi); 45 | SetPosition(0, 24 * effectiveDpi); 46 | } 47 | }; 48 | 49 | -------------------------------------------------------------------------------- /src/MobileShellPlus/PropertySheet.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/MobileShellPlus/StatusBarWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | #include "BaseWindow.h" 4 | #include "Utils.h" 5 | #include "Wnf.h" 6 | #include "winrt/Windows.ApplicationModel.Calls.h" 7 | 8 | class StatusBarWindow : public BaseWindow 9 | { 10 | //const 11 | int const statusBarHeight = 24; 12 | UINT appbarMessageId = -1; 13 | FrameworkElement base = nullptr; 14 | FrameworkElement child = nullptr; 15 | 16 | winrt::Windows::UI::Core::CoreDispatcher xamlDispatcher = nullptr; 17 | 18 | public: 19 | explicit StatusBarWindow(const HINSTANCE hInstance) : BaseWindow(hInstance, L"StatusBar") 20 | { 21 | Configure(); 22 | } 23 | 24 | UIElement BuildUIElement() override; 25 | void HandleRotation(const FrameworkElement& base, const FrameworkElement& child); 26 | void SetWiFiSignal(unsigned char value); 27 | void SetVPN(bool enabled); 28 | void SetLocation(bool inUse); 29 | void SetWiFi(bool enabled); 30 | void SetBluetooth(bool enabled); 31 | void SetAirplaneMode(bool enabled); 32 | void SetNotifications(int num); 33 | void SetFocusAssist(FocusAssistStatus status); 34 | void UpdateBatteryPercentage(); 35 | void UpdateSim1(winrt::Windows::ApplicationModel::Calls::PhoneLine phone_line); 36 | void UpdateSim2(winrt::Windows::ApplicationModel::Calls::PhoneLine phone_line); 37 | void SetDualSim(); 38 | void SetSim1Signal(unsigned char value); 39 | void SetSim2Signal(unsigned char value); 40 | void SetupAppBar(bool istabletmode); 41 | winrt::hstring GetBatteryStatusGlyph(int current_battery, bool charging, bool energy_saving_mode); 42 | 43 | private: 44 | void OnDisplayChange() override 45 | { 46 | Configure(); 47 | 48 | if (Wnf::IsTabletMode()) 49 | SetupAppBar(true); 50 | } 51 | 52 | void OnDpiChanged(const double& dpi) override 53 | { 54 | Configure(); 55 | 56 | if (Wnf::IsTabletMode()) 57 | SetupAppBar(true); 58 | } 59 | 60 | void Configure() 61 | { 62 | Utils::GetMonitorSizeAndDpiFromWindow(this->hwndParent, 63 | &this->effectiveDpi, 64 | &this->monitorHeight, 65 | &this->monitorWidth); 66 | 67 | const auto orientation = Utils::GetCurrentOrientation(); 68 | 69 | if (orientation == DMDO_DEFAULT || orientation == DMDO_180) 70 | { 71 | SetSize(monitorWidth, std::ceil(statusBarHeight * effectiveDpi), effectiveDpi); 72 | SetPosition(0, 0); 73 | } 74 | else if (orientation == DMDO_90) 75 | { 76 | SetSize(std::ceil(statusBarHeight * 2.0 * effectiveDpi), monitorHeight, effectiveDpi); 77 | SetPosition(monitorWidth - (statusBarHeight * 2.0 * effectiveDpi), 0); 78 | } 79 | else if (orientation == DMDO_270) 80 | { 81 | SetSize(std::ceil(statusBarHeight * 2.0 * effectiveDpi), monitorHeight, effectiveDpi); 82 | SetPosition(0, 0); 83 | } 84 | } 85 | }; 86 | 87 | 88 | -------------------------------------------------------------------------------- /src/MobileShellPlus/TopPadWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "TopPadWindow.h" 3 | 4 | UIElement TopPadWindow::BuildUIElement() 5 | { 6 | Controls::Grid grid{}; 7 | Media::AcrylicBrush bruh; 8 | 9 | bruh.BackgroundSource(Media::AcrylicBackgroundSource::HostBackdrop); 10 | 11 | grid.Background(bruh); 12 | 13 | return grid; 14 | } 15 | 16 | void TopPadWindow::SetupAppBar() 17 | { 18 | const auto orientation = Utils::GetCurrentOrientation(); 19 | 20 | if (orientation == DMDO_DEFAULT || orientation == DMDO_180) 21 | { 22 | if (appbarMessageId != -1u) 23 | Utils::ABSetPos(hwndParent, width * effectiveDpi, height, effectiveDpi, ABE_TOP); 24 | else 25 | appbarMessageId = Utils::RegisterAppBar(hwndParent, width * effectiveDpi, height, effectiveDpi, ABE_TOP); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MobileShellPlus/TopPadWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "pch.h" 4 | #include "BaseWindow.h" 5 | #include "Utils.h" 6 | 7 | class TopPadWindow : public BaseWindow 8 | { 9 | //const 10 | int const navBarHeight = 48; 11 | UINT appbarMessageId = -1; 12 | FrameworkElement base = nullptr; 13 | FrameworkElement child = nullptr; 14 | 15 | public: 16 | explicit TopPadWindow(const HINSTANCE hInstance) : BaseWindow(hInstance, L"Padding") 17 | { 18 | Configure(); 19 | } 20 | 21 | UIElement BuildUIElement() override; 22 | void SetupAppBar(); 23 | void ShowTimed() 24 | { 25 | Show(); 26 | SetupAppBar(); 27 | 28 | Sleep(4000); 29 | 30 | } 31 | 32 | private: 33 | void OnDisplayChange() override 34 | { 35 | Configure(); 36 | 37 | //TODO: IF tablet mode huh 38 | SetupAppBar(); 39 | } 40 | 41 | void OnDpiChanged(const double& dpi) override 42 | { 43 | Configure(); 44 | 45 | //TODO: IF tablet mode huh 46 | SetupAppBar(); 47 | } 48 | 49 | void Configure() 50 | { 51 | Utils::GetMonitorSizeAndDpiFromWindow(this->hwndParent, 52 | &this->effectiveDpi, 53 | &this->monitorHeight, 54 | &this->monitorWidth); 55 | 56 | const auto orientation = Utils::GetCurrentOrientation(); 57 | 58 | if (orientation == DMDO_DEFAULT || orientation == DMDO_180) 59 | { 60 | SetSize(monitorWidth, std::ceil(monitorHeight / 2.25), effectiveDpi); 61 | SetPosition(0, 0); 62 | } 63 | } 64 | }; -------------------------------------------------------------------------------- /src/MobileShellPlus/Utils.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPlus/Utils.cpp -------------------------------------------------------------------------------- /src/MobileShellPlus/Utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | enum WinTaskbarState 5 | { 6 | AutoHide = 1, 7 | OnTop = 0 8 | }; 9 | 10 | enum WinTaskbarPosition 11 | { 12 | TSB_LEFT = 0, 13 | TSB_TOP = 1, 14 | TSB_RIGHT = 2, 15 | TSB_BOTTOM = 3, 16 | }; 17 | 18 | enum WinTaskbarIconSize 19 | { 20 | TSB_SMALL = 1, 21 | TSB_NORMAL = 0, 22 | }; 23 | 24 | class Utils 25 | { 26 | public: 27 | static void SendKeyStroke(WORD key); 28 | static void SendKeyStrokes(WORD key1, WORD key2); 29 | static UINT RegisterAppBar(HWND hWnd, double width, double height, double dpi, int abedge); 30 | static UINT UnregisterAppBar(HWND hwnd); 31 | static void ABSetPos(HWND hWnd, double width, double height, double dpi, int abedge); 32 | static void ClickTaskView(); 33 | static void ClickBack(); 34 | static void ClickStartMenu(); 35 | static void ClickSearch(); 36 | static void RemoveWinGestures(); 37 | static MONITORINFO GetMonitorInfoFromWindow(HWND hWnd); 38 | static void GetMonitorSizeAndDpiFromWindow(HWND window, double* dpi, int* height, int* width); 39 | static DWORD GetCurrentOrientation(); 40 | static bool SystemUsesLightTheme(); 41 | static void SetEdgeSwipeStatus(bool enabled); 42 | static void SetWinTaskbarState(WinTaskbarState state); 43 | static void SetWinTaskbarVisible(bool visible); 44 | static void SetWinTaskbarPosition(WinTaskbarPosition pos); 45 | static void SetWinTaskbarIcons(WinTaskbarIconSize size); 46 | static void SetWinTaskbarSize(int area, int size); 47 | }; 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/MobileShellPlus/WindowEnumeration.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | #include 4 | 5 | struct Window32 6 | { 7 | public: 8 | Window32(nullptr_t) {} 9 | Window32(HWND hwnd, std::wstring const& title, std::wstring& className) 10 | { 11 | m_hwnd = hwnd; 12 | m_title = title; 13 | m_className = className; 14 | } 15 | 16 | HWND Hwnd() const noexcept { return m_hwnd; } 17 | std::wstring Title() const noexcept { return m_title; } 18 | std::wstring ClassName() const noexcept { return m_className; } 19 | 20 | private: 21 | HWND m_hwnd; 22 | std::wstring m_title; 23 | std::wstring m_className; 24 | }; 25 | 26 | std::wstring GetClassName(HWND hwnd) 27 | { 28 | std::array className; 29 | 30 | ::GetClassName(hwnd, className.data(), (int)className.size()); 31 | 32 | std::wstring title(className.data()); 33 | return title; 34 | } 35 | 36 | std::wstring GetWindowText(HWND hwnd) 37 | { 38 | std::array windowText; 39 | 40 | ::GetWindowText(hwnd, windowText.data(), (int)windowText.size()); 41 | 42 | std::wstring title(windowText.data()); 43 | return title; 44 | } 45 | 46 | bool IsAltTabWindow(Window32 const& window) 47 | { 48 | HWND hwnd = window.Hwnd(); 49 | HWND shellWindow = GetShellWindow(); 50 | 51 | auto title = window.Title(); 52 | auto className = window.ClassName(); 53 | 54 | if (hwnd == shellWindow) 55 | { 56 | return false; 57 | } 58 | 59 | if (title.length() == 0) 60 | { 61 | return false; 62 | } 63 | 64 | if (!IsWindowVisible(hwnd)) 65 | { 66 | return false; 67 | } 68 | 69 | if (GetAncestor(hwnd, GA_ROOT) != hwnd) 70 | { 71 | return false; 72 | } 73 | 74 | LONG style = GetWindowLong(hwnd, GWL_STYLE); 75 | if (!((style & WS_DISABLED) != WS_DISABLED)) 76 | { 77 | return false; 78 | } 79 | 80 | LONG exstyle = GetWindowLong(hwnd, GWL_EXSTYLE); 81 | if (!((exstyle & WS_EX_TOOLWINDOW) != WS_EX_TOOLWINDOW)) 82 | { 83 | return false; 84 | } 85 | 86 | DWORD cloaked = FALSE; 87 | HRESULT hrTemp = DwmGetWindowAttribute(hwnd, DWMWA_CLOAKED, &cloaked, sizeof(cloaked)); 88 | if (SUCCEEDED(hrTemp) && 89 | cloaked == DWM_CLOAKED_SHELL) 90 | { 91 | if (className.compare(L"ApplicationFrameWindow")) 92 | return false; 93 | } 94 | 95 | return true; 96 | } 97 | 98 | BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) 99 | { 100 | auto class_name = GetClassName(hwnd); 101 | auto title = GetWindowText(hwnd); 102 | 103 | auto window = Window32(hwnd, title, class_name); 104 | 105 | if (!IsAltTabWindow(window)) 106 | { 107 | return TRUE; 108 | } 109 | 110 | std::vector& windows = *reinterpret_cast*>(lParam); 111 | windows.push_back(window); 112 | 113 | return TRUE; 114 | } 115 | 116 | const std::vector EnumerateWindows() 117 | { 118 | std::vector windows; 119 | EnumWindows(EnumWindowsProc, reinterpret_cast(&windows)); 120 | 121 | if (!windows.empty()) 122 | { 123 | 124 | } 125 | 126 | return windows; 127 | } -------------------------------------------------------------------------------- /src/MobileShellPlus/Wnf.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Wnf.h" 3 | 4 | 5 | void Wnf::SubscribeWnf(ULONG64 state_name, decltype(WnfCallback) callback, intptr_t callback_param) 6 | { 7 | uint32_t buf1{}; 8 | size_t buf2{}; 9 | 10 | #ifdef _X86_ 11 | //Not really the best way btw 12 | const auto hpath = LoadLibrary(L"ntdll.dll"); 13 | const auto RtlSubscribeWnfStateChangeNotification = (x86_RtlSubscribeWnfStateChangeNotification)(GetProcAddress(hpath, "RtlSubscribeWnfStateChangeNotification")); 14 | #endif // _X86_ 15 | 16 | NTSTATUS result = RtlSubscribeWnfStateChangeNotification(&buf2, state_name, buf1, WnfCallback, callback_param, 0, 0, 1); 17 | } 18 | 19 | FocusAssistStatus Wnf::GetFocusAssistStatus() 20 | { 21 | auto vector = QueryWnf(WNF_SHEL_QUIETHOURS_ACTIVE_PROFILE_CHANGED); 22 | 23 | if (vector[0] == 0x0) 24 | return FocusAssistStatus::Off; 25 | if (vector[0] == 0x1) 26 | return FocusAssistStatus::PriorityOnly; 27 | if (vector[0] == 0x2) 28 | return FocusAssistStatus::AlarmsOnly; 29 | 30 | return FocusAssistStatus::Off; //illegal 31 | } 32 | 33 | bool Wnf::IsTabletMode() 34 | { 35 | auto vector = QueryWnf(WNF_TMCN_ISTABLETMODE); 36 | return ToBool(vector.data()); 37 | } 38 | 39 | bool Wnf::IsLocationInUse() 40 | { 41 | auto vector = QueryWnf(WNF_LFS_STATE); 42 | return ToBool(vector.data()); 43 | } 44 | 45 | int Wnf::QueryUnreadNotifications() 46 | { 47 | auto vector = QueryWnf(WNF_SHEL_NOTIFICATIONS); 48 | return ToInt32(vector.data()); 49 | } 50 | 51 | std::vector Wnf::QueryWnf(ULONG64 state_name) 52 | { 53 | std::vector wnf_state_buffer(8192); 54 | unsigned long state_buffer_size = 8192; 55 | WNF_CHANGE_STAMP wnf_change_stamp; 56 | 57 | NtQueryWnfStateData(&state_name, nullptr, nullptr, &wnf_change_stamp, 58 | wnf_state_buffer.data(), &state_buffer_size); 59 | 60 | return wnf_state_buffer; 61 | } -------------------------------------------------------------------------------- /src/MobileShellPlus/Wnf.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | NTSTATUS NTAPI WnfCallback(ULONG64, void*, void*, void*, void*, ULONG); 4 | 5 | const ULONG64 WNF_SHEL_NOTIFICATIONS = 0xD83063EA3BC1035; 6 | const ULONG64 WNF_TMCN_ISTABLETMODE = 0xf850339a3bc0835; 7 | const ULONG64 WNF_LFS_STATE = 0x41950821A3BC0875; 8 | const ULONG64 WNF_SHEL_QUIETHOURS_ACTIVE_PROFILE_CHANGED = 0xD83063EA3BF1C75; 9 | const ULONG64 WNF_SHEL_TOAST_PUBLISHED = 0xD83063EA3BD0035; 10 | const ULONG64 WNF_VPN_CLIENT_CONNECTIVITY_STATUS = 0x41881E3BA3BC0875; 11 | const ULONG64 WNF_WIFI_CONNECTION_SCORE = 0x880073AA3BC5875; 12 | const ULONG64 WNF_WIFI_AVERAGE_TRANSMIT = 0x880073AA3BC6875; 13 | const ULONG64 WNF_CNET_WIFI_ACTIVITY = 0x1583002EA3BC8075; 14 | const ULONG64 WNF_CELL_SIGNAL_STRENGTH_BARS_CAN0 = 0xD8A0B2EA3BC1075; 15 | const ULONG64 WNF_CELL_SIGNAL_STRENGTH_BARS_CAN1 = 0xD8A0B2EA3BD1075; 16 | const ULONG64 WNF_IMSN_LAUNCHERVISIBILITY = 0xF950324A3BC1035; 17 | 18 | extern "C" { 19 | 20 | typedef struct _WNF_TYPE_ID 21 | { 22 | GUID TypeId; 23 | } WNF_TYPE_ID, * PWNF_TYPE_ID; 24 | typedef const WNF_TYPE_ID* PCWNF_TYPE_ID; 25 | 26 | typedef ULONG WNF_CHANGE_STAMP, * PWNF_CHANGE_STAMP; 27 | 28 | #ifndef _X86_ 29 | 30 | NTSTATUS 31 | RtlSubscribeWnfStateChangeNotification( 32 | _Outptr_ VOID* Subscription, 33 | _In_ ULONG64 StateName, 34 | _In_ WNF_CHANGE_STAMP ChangeStamp, 35 | _In_ decltype(WnfCallback) Callback, 36 | _In_opt_ size_t CallbackContext, 37 | _In_opt_ PCWNF_TYPE_ID TypeId, 38 | _In_opt_ ULONG SerializationGroup, 39 | _In_opt_ ULONG Unknown); 40 | 41 | #endif // !_X86_ 42 | 43 | NTSTATUS NTAPI 44 | RtlUnsubscribeWnfStateChangeNotification(decltype(WnfCallback)); 45 | 46 | NTSTATUS NTAPI 47 | NtQueryWnfStateData( 48 | _In_ PULONG64 StateName, 49 | _In_opt_ PWNF_TYPE_ID TypeId, 50 | _In_opt_ const VOID* ExplicitScope, 51 | _Out_ PWNF_CHANGE_STAMP ChangeStamp, 52 | _Out_writes_bytes_to_opt_(*BufferSize, *BufferSize) PVOID Buffer, 53 | _Inout_ PULONG BufferSize); 54 | 55 | NTSTATUS NTAPI 56 | NtUpdateWnfStateData( 57 | _In_ PULONG64 StateName, 58 | _In_reads_bytes_opt_(Length) const VOID* Buffer, 59 | _In_opt_ ULONG Length, 60 | _In_opt_ PCWNF_TYPE_ID TypeId, 61 | _In_opt_ const PVOID ExplicitScope, 62 | _In_ WNF_CHANGE_STAMP MatchingChangeStamp, 63 | _In_ ULONG CheckStamp); 64 | } 65 | 66 | #ifdef _X86_ 67 | 68 | typedef NTSTATUS(__stdcall *x86_RtlSubscribeWnfStateChangeNotification) 69 | (_Outptr_ VOID* Subscription, 70 | _In_ ULONG64 StateName, 71 | _In_ WNF_CHANGE_STAMP ChangeStamp, 72 | _In_ decltype(WnfCallback) Callback, 73 | _In_opt_ size_t CallbackContext, 74 | _In_opt_ PCWNF_TYPE_ID TypeId, 75 | _In_opt_ ULONG SerializationGroup, 76 | _In_opt_ ULONG Unknown); 77 | 78 | #endif // _X86_ 79 | 80 | enum FocusAssistStatus { 81 | Off, 82 | PriorityOnly, 83 | AlarmsOnly 84 | }; 85 | 86 | class Wnf 87 | { 88 | public: 89 | static void SubscribeWnf(ULONG64 state_name, decltype(WnfCallback) callback, intptr_t callback_param); 90 | static FocusAssistStatus GetFocusAssistStatus(); 91 | static bool IsTabletMode(); 92 | static bool IsLocationInUse(); 93 | static int QueryUnreadNotifications(); 94 | 95 | static int ToInt32(const byte buffer[]) 96 | { 97 | return int((buffer[0]) | (buffer[1]) << 8 | (buffer[2]) << 16 | (buffer[3]) << 24); 98 | } 99 | 100 | static int ToBool(const byte buffer[]) 101 | { 102 | return bool(buffer[0]); 103 | } 104 | 105 | private: 106 | static std::vector QueryWnf(ULONG64 state_name); 107 | }; -------------------------------------------------------------------------------- /src/MobileShellPlus/main.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Wnf.h" 3 | #include "Utils.h" 4 | #include "BaseWindow.h" 5 | #include "NavBarWindow.h" 6 | #include "StatusBarWindow.h" 7 | #include "winrt/Windows.Networking.Connectivity.h" 8 | #include "winrt/Windows.System.Power.h" 9 | #include "winrt/Windows.Devices.Radios.h" 10 | #include "winrt/Windows.Devices.Bluetooth.h" 11 | #include "winrt/Windows.Devices.Enumeration.h" 12 | #include "winrt/Windows.Devices.WiFi.h" 13 | #include "winrt/Windows.ApplicationModel.Calls.h" 14 | #include 15 | #include 16 | #include 17 | #include "NotificationWindow.h" 18 | #include "dxgi.h" 19 | #include "dxgi1_6.h" 20 | 21 | #pragma comment(lib, "dxgi.lib") 22 | 23 | using namespace winrt; 24 | using namespace Windows::Foundation; 25 | using namespace Windows::UI::Xaml::Hosting; 26 | using namespace Windows::System::Power; 27 | using namespace Windows::Media::Playback; 28 | using namespace Windows::Devices::Radios; 29 | using namespace Windows::Networking::Connectivity; 30 | using namespace Windows::ApplicationModel::Calls; 31 | 32 | NavBarWindow* wind; 33 | StatusBarWindow* statusBarW; 34 | std::vector radios; 35 | std::vector phoneLines; 36 | 37 | std::vector GetPhoneLines(); 38 | void HandlePhoneLines(std::vector phone_lines); 39 | void NetworkStatusChange(); 40 | void GetWifiSignal(); 41 | void SetupPowerManager(); 42 | void SetupRadios(); 43 | void SetRadioStatus(Radio radio); 44 | void MoveNotificationsOnTop(); 45 | void OnTabletModeChanged(bool istabletmode); 46 | void GlobalSetupAppBar(); 47 | void ForceFullCoverStartScreen(); 48 | 49 | 50 | // .imrsiv also REQUIRES IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY, MEANING IT SHOULD BE SIGNED (also, Windows certificate) --> no window(s) on other ZBIDs 51 | // Or we can cheat by launching a new (suspended) RuntimeBroker process and then inject a dll 52 | 53 | int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) 54 | { 55 | //Useful to change on-the-fly dpi 56 | //SystemParametersInfo(SPI_SETLOGICALDPIOVERRIDE, 0, LPVOID(nullptr), 1); 57 | 58 | const auto m_singleInstanceMutex = CreateMutex(NULL, TRUE, L"MobileShellPlus"); 59 | 60 | if (m_singleInstanceMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS) { 61 | MessageBox(NULL, L"MobileShell is already open, switch to tablet mode to see it!", L"uWu", 0); 62 | return 0; 63 | } 64 | 65 | DXGIDeclareAdapterRemovalSupport(); 66 | auto res = SetProcessShutdownParameters(1, SHUTDOWN_NORETRY); 67 | 68 | init_apartment(); 69 | 70 | auto windows_xaml_manager = WindowsXamlManager::InitializeForCurrentThread(); 71 | 72 | wind = new NavBarWindow(hInstance); 73 | statusBarW = new StatusBarWindow(hInstance); 74 | 75 | statusBarW->PreBuild(); 76 | wind->PreBuild(); 77 | 78 | if (Wnf::IsTabletMode()) 79 | OnTabletModeChanged(true); 80 | 81 | Wnf::SubscribeWnf(WNF_TMCN_ISTABLETMODE, WnfCallback, NULL); 82 | Wnf::SubscribeWnf(WNF_SHEL_NOTIFICATIONS, WnfCallback, NULL); 83 | Wnf::SubscribeWnf(WNF_SHEL_QUIETHOURS_ACTIVE_PROFILE_CHANGED, WnfCallback, NULL); 84 | Wnf::SubscribeWnf(WNF_CELL_SIGNAL_STRENGTH_BARS_CAN0, WnfCallback, NULL); 85 | Wnf::SubscribeWnf(WNF_CELL_SIGNAL_STRENGTH_BARS_CAN1, WnfCallback, NULL); 86 | 87 | phoneLines = GetPhoneLines(); 88 | HandlePhoneLines(phoneLines); 89 | NetworkStatusChange(); 90 | SetupPowerManager(); 91 | SetupRadios(); 92 | wind->SetupHaptics(); 93 | 94 | std::thread TA(MoveNotificationsOnTop); 95 | std::thread TWifi(GetWifiSignal); 96 | std::thread TCapra(GlobalSetupAppBar); 97 | 98 | MSG msg; 99 | while (GetMessage(&msg, nullptr, 0, 0)) 100 | { 101 | TranslateMessage(&msg); 102 | DispatchMessage(&msg); 103 | } 104 | 105 | return int(msg.wParam); 106 | } 107 | 108 | void GlobalSetupAppBar() 109 | { 110 | while (true) 111 | { 112 | if (Wnf::IsTabletMode()) 113 | { 114 | OnTabletModeChanged(true); 115 | //ForceFullCoverStartScreen(); 116 | } 117 | 118 | Sleep(5000); 119 | } 120 | } 121 | 122 | void ForceFullCoverStartScreen() 123 | { 124 | RECT rect = { 0 }; 125 | SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); 126 | 127 | const auto hwnd = FindWindowEx(nullptr, nullptr, L"Windows.UI.Core.CoreWindow", L"Start"); 128 | if (hwnd) 129 | { 130 | SetWindowPos(hwnd, nullptr, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOSENDCHANGING); 131 | } 132 | } 133 | 134 | void HandlePhoneLines(std::vector phone_lines) 135 | { 136 | if (phone_lines.size() > 1) 137 | statusBarW->SetDualSim(); 138 | 139 | for (const auto& phone_line : phone_lines) 140 | { 141 | if (phone_line.CellularDetails().SimSlotIndex() == 0) 142 | statusBarW->UpdateSim1(phone_line); 143 | else if (phone_line.CellularDetails().SimSlotIndex() == 1) 144 | statusBarW->UpdateSim2(phone_line); 145 | 146 | /*int index = static_cast(phone_line.NetworkState()); 147 | MessageBoxA(NULL, std::to_string(index).c_str(), "OWO", 0);*/ 148 | 149 | phone_line.LineChanged([](PhoneLine const& o, IInspectable const&) 150 | { 151 | if (o.CellularDetails().SimSlotIndex() == 0) 152 | statusBarW->UpdateSim1(o); 153 | else if (o.CellularDetails().SimSlotIndex() == 1) 154 | statusBarW->UpdateSim2(o); 155 | }); 156 | } 157 | } 158 | 159 | void SetupPowerManager() 160 | { 161 | statusBarW->UpdateBatteryPercentage(); 162 | 163 | PowerManager::BatteryStatusChanged([](IInspectable const&, IInspectable const&) 164 | { 165 | statusBarW->UpdateBatteryPercentage(); 166 | }); 167 | 168 | PowerManager::EnergySaverStatusChanged([](IInspectable const&, IInspectable const&) 169 | { 170 | statusBarW->UpdateBatteryPercentage(); 171 | }); 172 | 173 | PowerManager::RemainingChargePercentChanged([](IInspectable const&, IInspectable const&) 174 | { 175 | statusBarW->UpdateBatteryPercentage(); 176 | }); 177 | } 178 | 179 | void SetupRadios() 180 | { 181 | auto wew = Windows::Devices::Radios::Radio::GetRadiosAsync().get(); 182 | 183 | const auto radio_state_changed = [](Radio const& radio, IInspectable const& args) 184 | { 185 | SetRadioStatus(radio); 186 | }; 187 | 188 | for (const auto& item : wew) 189 | { 190 | item.StateChanged(radio_state_changed); 191 | radios.push_back(item); 192 | SetRadioStatus(item); 193 | } 194 | 195 | /*const hstring filter = Windows::Devices::Bluetooth::BluetoothDevice::GetDeviceSelector(); 196 | auto test = Windows::Devices::Enumeration::DeviceInformation::FindAllAsync(filter).get();*/ 197 | } 198 | 199 | void SetRadioStatus(Radio radio) 200 | { 201 | if (radio.Kind() == RadioKind::MobileBroadband) 202 | { 203 | //99%, not exactly sure --> Airplane mode 204 | if (radio.State() != RadioState::On) 205 | { 206 | statusBarW->SetAirplaneMode(true); 207 | } 208 | else 209 | { 210 | statusBarW->SetAirplaneMode(false); 211 | } 212 | } 213 | else if (radio.Kind() == RadioKind::Bluetooth) 214 | { 215 | if (radio.State() != RadioState::On) 216 | { 217 | statusBarW->SetBluetooth(false); 218 | } 219 | else 220 | { 221 | statusBarW->SetBluetooth(true); 222 | } 223 | } 224 | else if (radio.Kind() == RadioKind::WiFi) 225 | { 226 | if (radio.State() != RadioState::On) 227 | { 228 | statusBarW->SetWiFi(false); 229 | } 230 | else 231 | { 232 | statusBarW->SetWiFi(true); 233 | } 234 | } 235 | } 236 | 237 | void MoveNotificationsOnTop() 238 | { 239 | while (true) 240 | { 241 | const auto hwnd = FindWindowEx(nullptr, nullptr, L"Windows.UI.Core.CoreWindow", L"New Notification"); 242 | if (hwnd) 243 | { 244 | double mon_dpi; 245 | int mon_height; 246 | int mon_width; 247 | Utils::GetMonitorSizeAndDpiFromWindow(hwnd, &mon_dpi, &mon_height, &mon_width); 248 | 249 | RECT rect = {}; 250 | GetWindowRect(hwnd, &rect); 251 | 252 | const int notification_width = rect.right - rect.left; 253 | 254 | SetWindowPos(hwnd, nullptr, ((double(mon_width) - notification_width) / 2.0), -70 * mon_dpi + 24.0 * mon_dpi, 0, 0, SWP_NOSIZE); 255 | } 256 | 257 | Sleep(10); 258 | } 259 | } 260 | 261 | std::vector GetPhoneLines() 262 | { 263 | PhoneCallStore store = PhoneCallManager::RequestStoreAsync().get(); 264 | auto watcher = store.RequestLineWatcher(); 265 | std::vector phone_lines; 266 | bool wait = true; 267 | 268 | watcher.LineAdded([&](IInspectable const&, PhoneLineWatcherEventArgs const& args) 269 | { 270 | const auto line = PhoneLine::FromIdAsync(args.LineId()).get(); 271 | phone_lines.push_back(line); 272 | }); 273 | 274 | watcher.EnumerationCompleted([&](IInspectable const&, IInspectable const&) 275 | { 276 | wait = false; 277 | }); 278 | 279 | watcher.Stopped([&](IInspectable const&, IInspectable const&) 280 | { 281 | wait = false; 282 | }); 283 | 284 | watcher.Start(); 285 | 286 | //Surely not the best way. 287 | while (wait) 288 | { 289 | Sleep(1); 290 | } 291 | 292 | watcher.Stop(); 293 | 294 | std::vector returned_lines; 295 | 296 | for (auto phone_line : phone_lines) 297 | if (phone_line != nullptr && phone_line.Transport() == PhoneLineTransport::Cellular) 298 | returned_lines.push_back(phone_line); 299 | 300 | return returned_lines; 301 | } 302 | 303 | void NetworkStatusChange() 304 | { 305 | NetworkInformation::NetworkStatusChanged([](IInspectable const& object) 306 | { 307 | const auto profile = NetworkInformation::GetInternetConnectionProfile(); 308 | if (profile != nullptr) 309 | { 310 | if (profile.IsWlanConnectionProfile()) 311 | { 312 | //GET WIFI STRENGTH - from 0 to 5 313 | auto strength = profile.GetSignalBars().Value(); 314 | statusBarW->SetWiFiSignal(strength); 315 | } 316 | else 317 | { 318 | //Probably not connected, set wifi strength to 0 319 | statusBarW->SetWiFiSignal(0); 320 | } 321 | 322 | if (profile.IsWwanConnectionProfile()) 323 | { 324 | //Things becomes more interesting 325 | } 326 | } 327 | else 328 | { 329 | //No connectivity. Reset wifi signal. 330 | statusBarW->SetWiFiSignal(0); 331 | } 332 | }); 333 | } 334 | 335 | void GetWifiSignal() 336 | { 337 | while (true) 338 | { 339 | //I'm sure there is a better way. 340 | const auto profile = NetworkInformation::GetInternetConnectionProfile(); 341 | 342 | if (profile != nullptr) 343 | { 344 | if (profile.IsWlanConnectionProfile()) 345 | { 346 | //GET WIFI STRENGTH - from 0 to 5 347 | auto strength = profile.GetSignalBars().Value(); 348 | statusBarW->SetWiFiSignal(strength); 349 | } 350 | else 351 | { 352 | //Probably not connected, set wifi strength to 0 353 | statusBarW->SetWiFiSignal(0); 354 | } 355 | } 356 | else 357 | { 358 | //No connectivity. Reset wifi signal. 359 | statusBarW->SetWiFiSignal(0); 360 | } 361 | 362 | 363 | Sleep(2000); 364 | } 365 | } 366 | 367 | void OnTabletModeChanged(bool istabletmode) 368 | { 369 | if (istabletmode) 370 | { 371 | //Utils::RemoveWinGestures(); 372 | //Utils::SetWinTaskbarIcons(WinTaskbarIconSize::TSB_SMALL); 373 | Utils::SetWinTaskbarState(WinTaskbarState::AutoHide); 374 | Utils::SetWinTaskbarVisible(false); 375 | 376 | statusBarW->SetupAppBar(true); 377 | wind->SetupAppBar(true); 378 | 379 | statusBarW->Show(); 380 | wind->Show(); 381 | } 382 | else 383 | { 384 | //Utils::SetWinTaskbarIcons(WinTaskbarIconSize::TSB_NORMAL); 385 | Utils::SetWinTaskbarState(WinTaskbarState::OnTop); 386 | Utils::SetWinTaskbarVisible(true); 387 | 388 | statusBarW->SetupAppBar(false); 389 | wind->SetupAppBar(false); 390 | 391 | statusBarW->Hide(); 392 | wind->Hide(); 393 | } 394 | } 395 | 396 | NTSTATUS NTAPI WnfCallback(const ULONG64 state_name, void* p2, void* p3, void* callbackContext, void* buffer, ULONG bufferSize) 397 | { 398 | const auto p = static_cast(buffer); 399 | std::vector wnf_state_buffer(bufferSize); 400 | memcpy(wnf_state_buffer.data(), p, bufferSize); 401 | 402 | if (state_name == WNF_TMCN_ISTABLETMODE) 403 | { 404 | const auto is_tablet_mode = Wnf::ToBool(wnf_state_buffer.data()); 405 | OnTabletModeChanged(is_tablet_mode); 406 | } 407 | else if (state_name == WNF_SHEL_NOTIFICATIONS) 408 | { 409 | const auto num_notif = Wnf::ToInt32(wnf_state_buffer.data()); 410 | statusBarW->SetNotifications(num_notif); 411 | } 412 | else if (state_name == WNF_SHEL_QUIETHOURS_ACTIVE_PROFILE_CHANGED) 413 | { 414 | const auto profile_state = *static_cast(buffer); 415 | 416 | FocusAssistStatus fas = FocusAssistStatus::Off; 417 | 418 | if (profile_state == 0x0) 419 | fas = FocusAssistStatus::Off; 420 | else if (profile_state == 0x1) 421 | fas = FocusAssistStatus::PriorityOnly; 422 | else if (profile_state == 0x2) 423 | fas = FocusAssistStatus::AlarmsOnly; 424 | 425 | statusBarW->SetFocusAssist(fas); 426 | } 427 | else if (state_name == WNF_LFS_STATE) 428 | { 429 | const auto is_location_in_use = Wnf::ToBool(wnf_state_buffer.data()); 430 | statusBarW->SetLocation(is_location_in_use); 431 | } 432 | else if (state_name == WNF_CNET_WIFI_ACTIVITY) 433 | { 434 | const auto wifi_activity = Wnf::ToBool(wnf_state_buffer.data()); 435 | MessageBox(nullptr, L"UPDATE", L"UWU", 0); 436 | //statusBarW->SetVPN(wifi_activity); 437 | } 438 | else if (state_name == WNF_VPN_CLIENT_CONNECTIVITY_STATUS) 439 | { 440 | //TODO: it's more than bool. It's a structure. Needs RE 441 | /*const auto is_vpn_connection_established = Wnf::ToBool(wnf_state_buffer.data()); 442 | statusBarW->SetVPN(is_vpn_connection_established);*/ 443 | } 444 | else if (state_name == WNF_CELL_SIGNAL_STRENGTH_BARS_CAN0) 445 | { 446 | const auto signal_strength = *static_cast(buffer); 447 | statusBarW->SetSim1Signal(signal_strength); 448 | } 449 | else if (state_name == WNF_CELL_SIGNAL_STRENGTH_BARS_CAN1) 450 | { 451 | const auto signal_strength = *static_cast(buffer); 452 | statusBarW->SetSim2Signal(signal_strength); 453 | } 454 | else if (state_name == WNF_WIFI_CONNECTION_SCORE) 455 | { 456 | //lol, useless. 457 | } 458 | else if (state_name == WNF_SHEL_TOAST_PUBLISHED) 459 | { 460 | //Move notification window on top (experimental) | untested outside EN_* Windows locale 461 | 462 | //not working. lol. 463 | } 464 | 465 | return 0; 466 | } 467 | -------------------------------------------------------------------------------- /src/MobileShellPlus/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/MobileShellPlus/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /src/MobileShellPlus/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include -------------------------------------------------------------------------------- /src/MobileShellPlus/readme.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | C++/WinRT MobileShellPlus Project Overview 3 | ======================================================================== 4 | 5 | This project demonstrates how to get started consuming Windows Runtime 6 | classes directly from standard C++, using platform projection headers 7 | generated from Windows SDK metadata files. 8 | 9 | Steps to generate and consume SDK platform projection: 10 | 1. Build project initally to generate platform projection headers into 11 | your Generated Files folder. 12 | 2. Include a projection namespace header in your pch.h, such as 13 | . 14 | 3. Consume winrt namespace and any Windows Runtime namespaces, such as 15 | winrt::Windows::Foundation, from source code. 16 | 4. Initialize apartment via init_apartment() and consume winrt classes. 17 | 18 | Steps to generate and consume a projection from third party metadata: 19 | 1. Add a WinMD reference by right-clicking the References project node 20 | and selecting "Add Reference...". In the Add References dialog, 21 | browse to the component WinMD you want to consume and add it. 22 | 2. Build the project once to generate projection headers for the 23 | referenced WinMD file under the "Generated Files" subfolder. 24 | 3. As above, include projection headers in pch or source code 25 | to consume projected Windows Runtime classes. 26 | 27 | ======================================================================== 28 | Learn more about C++/WinRT here: 29 | http://aka.ms/cppwinrt/ 30 | ======================================================================== 31 | -------------------------------------------------------------------------------- /src/MobileShellPlus/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by version.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /src/MobileShellPlus/version.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADeltaX/MobileShell/74892d7beec7df24671ed2e3d12ac03465da174c/src/MobileShellPlus/version.rc --------------------------------------------------------------------------------