mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
## Summary of the Pull Request ModuleLoader tool, a stand-alone Win32 executable for testing of PowerToy modules without needing branch builds. sample output from running the tool is below: .\ModuleLoader.exe .\powertoys.cursorwrap.dll PowerToys Module Loader v1.0 ============================= Loading module: .\powertoys.cursorwrap.dll Detected module name: cursorwrap Loading settings... Trying settings path: C:\Users\mikehall\AppData\Local\Microsoft\PowerToys\cursorwrap\settings.json Settings file loaded (315 characters) Settings loaded successfully. Loading module DLL... Module instance created successfully Module DLL loaded successfully. Module key: CursorWrap Module name: CursorWrap Applying settings to module... Settings applied. Registering module hotkeys... Module reports 1 legacy hotkey(s) Registering hotkey 0: Win+Alt+U - OK Hotkeys registered: 1 Enabling module... Module enabled. ============================= Module is now running! ============================= Module Status: - Name: CursorWrap - Key: CursorWrap - Enabled: Yes - Hotkeys: 1 registered Registered Hotkeys: Win+Alt+U Press Ctrl+C to exit. You can press the module's hotkey to toggle its functionality. Note that this doesn't integrate with Powertoys settings UI - this is purely to test Powertoys module functionality. ## PR Checklist - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments See details above. ## Validation Steps Performed ModuleLoader tested on Windows 11, Surface Laptop 7 Pro.
48 lines
1.6 KiB
C++
48 lines
1.6 KiB
C++
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
#pragma once
|
|
|
|
#include <Windows.h>
|
|
#include <string>
|
|
|
|
/// <summary>
|
|
/// Utility class for discovering and loading PowerToy module settings
|
|
/// </summary>
|
|
class SettingsLoader
|
|
{
|
|
public:
|
|
SettingsLoader();
|
|
~SettingsLoader();
|
|
|
|
/// <summary>
|
|
/// Load settings for a PowerToy module
|
|
/// </summary>
|
|
/// <param name="moduleName">Name of the module (e.g., "CursorWrap")</param>
|
|
/// <param name="moduleDllPath">Full path to the module DLL (for checking local settings.json)</param>
|
|
/// <returns>JSON settings string, or empty string if not found</returns>
|
|
std::wstring LoadSettings(const std::wstring& moduleName, const std::wstring& moduleDllPath);
|
|
|
|
/// <summary>
|
|
/// Get the settings file path for a module
|
|
/// </summary>
|
|
/// <param name="moduleName">Name of the module</param>
|
|
/// <returns>Full path to the settings.json file</returns>
|
|
std::wstring GetSettingsPath(const std::wstring& moduleName) const;
|
|
|
|
private:
|
|
/// <summary>
|
|
/// Get the PowerToys root settings directory
|
|
/// </summary>
|
|
/// <returns>Path to %LOCALAPPDATA%\Microsoft\PowerToys</returns>
|
|
std::wstring GetPowerToysSettingsRoot() const;
|
|
|
|
/// <summary>
|
|
/// Read a text file into a string
|
|
/// </summary>
|
|
/// <param name="filePath">Path to the file</param>
|
|
/// <returns>File contents as a string</returns>
|
|
std::wstring ReadFileContents(const std::wstring& filePath) const;
|
|
};
|