Repository: lx-s/WinMute Branch: main Commit: 7c5a8b4a5f66 Files: 108 Total size: 1.4 MB Directory structure: gitextract_si3e3_3t/ ├── .editorconfig ├── .gitattributes ├── .github/ │ ├── FUNDING.yml │ └── ISSUE_TEMPLATE/ │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── CONTRIBUTING.md ├── CURRENT_VERSION ├── Dist/ │ ├── InnoSetup/ │ │ ├── translations/ │ │ │ ├── info-before.de.txt │ │ │ ├── info-before.en.txt │ │ │ ├── info-before.es.txt │ │ │ ├── info-before.fr.txt │ │ │ ├── info-before.it.txt │ │ │ ├── info-before.ko.txt │ │ │ ├── info-before.lv.txt │ │ │ ├── info-before.nl.txt │ │ │ ├── info-before.ro.txt │ │ │ ├── info-before.ru.txt │ │ │ └── info-before.zh_Hans.txt │ │ ├── winmute-setup-languages.iss │ │ └── winmute-setup.iss │ ├── bin/ │ │ ├── changelog.txt │ │ ├── license.rtf │ │ ├── license.txt │ │ └── update-check.disabled │ ├── chocolatey/ │ │ ├── WinMute.nuspec │ │ ├── howto.txt │ │ └── tools/ │ │ ├── VERIFICATION.txt │ │ ├── chocolateybeforemodify.ps1 │ │ ├── chocolateyinstall.ps1 │ │ └── chocolateyuninstall.ps1 │ ├── winget/ │ │ └── manifests/ │ │ └── l/ │ │ └── LX-Systems/ │ │ └── WinMute/ │ │ ├── 2.5.0.0/ │ │ │ ├── LX-Systems.WinMute.installer.yaml │ │ │ ├── LX-Systems.WinMute.locale.en-US.yaml │ │ │ └── LX-Systems.WinMute.yaml │ │ ├── 2.5.1.0/ │ │ │ ├── LX-Systems.WinMute.installer.yaml │ │ │ ├── LX-Systems.WinMute.locale.en-US.yaml │ │ │ └── LX-Systems.WinMute.yaml │ │ ├── 2.5.2.0/ │ │ │ ├── LX-Systems.WinMute.installer.yaml │ │ │ ├── LX-Systems.WinMute.locale.en-US.yaml │ │ │ └── LX-Systems.WinMute.yaml │ │ └── 2.5.3.0/ │ │ ├── LX-Systems.WinMute.installer.yaml │ │ ├── LX-Systems.WinMute.locale.en-US.yaml │ │ └── LX-Systems.WinMute.yaml │ └── winget.txt ├── LICENSE ├── README.md ├── Translations/ │ ├── lang-de.json │ ├── lang-en.json │ ├── lang-es.json │ ├── lang-fr.json │ ├── lang-it.json │ ├── lang-ko.json │ ├── lang-lv.json │ ├── lang-nl.json │ ├── lang-ro.json │ ├── lang-ru.json │ └── lang-zh_Hans.json ├── WinMute/ │ ├── AboutDlg.cpp │ ├── BluetoothDetector.cpp │ ├── BluetoothDetector.h │ ├── LogDialog.cpp │ ├── MMNotificationClient.cpp │ ├── MMNotificationClient.h │ ├── MuteControl.cpp │ ├── MuteControl.h │ ├── QuietHoursTimer.cpp │ ├── QuietHoursTimer.h │ ├── SettingsDlg.cpp │ ├── Settings_BluetoothDlg.cpp │ ├── Settings_GeneralDlg.cpp │ ├── Settings_ManageEndpointsDlg.cpp │ ├── Settings_MuteDlg.cpp │ ├── Settings_QuietHoursDlg.cpp │ ├── Settings_WifiDlg.cpp │ ├── TrayIcon.cpp │ ├── TrayIcon.h │ ├── UpdateChecker.cpp │ ├── UpdateChecker.h │ ├── Utility.cpp │ ├── Utility.h │ ├── VersionHelper.h │ ├── VistaAudio.cpp │ ├── VistaAudioSessionEvents.cpp │ ├── VistaAudioSessionEvents.h │ ├── WMLog.cpp │ ├── WMLog.h │ ├── WMSettings.cpp │ ├── WMSettings.h │ ├── WMi18n.cpp │ ├── WMi18n.h │ ├── WiFiDetector.h │ ├── WifiDetector.cpp │ ├── WinAudio.h │ ├── WinMain.cpp │ ├── WinMute.cpp │ ├── WinMute.h │ ├── WinMute.rc │ ├── WinMute.vcxproj │ ├── WinMute.vcxproj.filters │ ├── WinMute.vcxproj.user │ ├── common.cpp │ ├── common.h │ ├── libs/ │ │ └── json.hpp │ └── resource.h ├── WinMute.props ├── WinMute.slnx ├── cppcgl-nativerecommended.ruleset └── winmute.cppcheck ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ [*.{c,c++,cc,cpp,cxx,h,h++,hh,hpp,hxx,inl,ipp,tlh,tli}] vc_generate_documentation_comments = doxygen_triple_slash end_of_line = lf insert_final_newline = true charset = utf-8 indent_style = space indent_size = 3 insert_final_newline = true trim_trailing_whitespace = true ================================================ FILE: .gitattributes ================================================ # Set the default behavior, in case people don't have core.autolf set. * text=auto eol=lf # *.gitignore text eol=lf # *.gitattributes text eol=lf # *.c text eol=lf # *.h text eol=lf # *.cpp text eol=lf # *.hpp text eol=lf # *.mk text eol=lf # *.xml text eol=lf # *.json text eol=lf # *.html text eol=lf # *.css text eol=lf # *.txt text eol=lf # Declare files that will always have CRLF line endings on checkout. *.sln text eol=crlf *.vcxproj text eol=crlf *.vcxproj.filters text eol=crlf *.vcxproj.users text eol=crlf *.rc text eol=lf *.props eol=crlf resource.h text eol=crlf # Denote all files that are truly binary and should not be modified. *.png binary *.jpg binary *.ico binary *.docx binary *.pdf binary ================================================ FILE: .github/FUNDING.yml ================================================ github: lx-s custom: ["https://paypal.me/AlexSteinhoefer"] ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Version [e.g. 22] **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .gitignore ================================================ # Compilation temporaries and binaries Release/ Debug/ *.ipdb *.iobj *.ipdb *.aps *.opensdf *.sdf *.suo *.exp *.pdb *.lib *.ods# *.dll *.exe *.nupkg # Visual Studio temporaries ipch/ *.VC.opendb *.VC.db *.lastcodeanalysissucceeded .vs/ Bin/ # Cpp Check winmute-cppcheck-build-dir/ ================================================ FILE: CONTRIBUTING.md ================================================ # How To Contribute ## New Features If you have the next great idea for this little tool, you are welcome to open an issues with your idea. This is how WiFi- and Bluetooth-based muting came to life 🙂 If your idea is too big for the scope of this tool or I don't have the time to implement it, I'll let you know and you are free to provide a PR with the code, if you have the time to provide the code yourself. ## Bug fixes You're welcome at any time to provide pull requests with fixes for bugs you discovered. Try to keep it in the current coding style as much as possible. Apart from that I won't dictate any strict rules. ## Art Since my artistic competence is hovering right around the skill level of "programmer art", a new program icon suitable for Windows' light and dark theme (or GitHubs README) would be greatly appreciated 🙂 ## Translations You are invited to provide translations for the app. But there are some rules. 1. Please only translate if you are fluid with the language you provide the translation and also if you are familiar with the nomenclature of the Android system. If in doubt about a specific string, check out other Apps of big companies, like WhatsApp, Facebook, Google, etc., and see how they did it. 2. Only contribute, if you are committed to translate the majority of strings. No one wants an app, which is a mix of English and the native language. I might remove translations again, if they won't receive updates on new string resources. [![Translation Status](https://translate.codeberg.org/widget/winmute/winmute/multi-auto.svg)](https://translate.codeberg.org/engage/winmute/) Translations can be provided via [Weblate](https://translate.codeberg.org/engage/winmute/). ================================================ FILE: CURRENT_VERSION ================================================ { "version": 1, "stable": { "version": "2.5.4.0", "downloadUrl": "https://github.com/lx-s/WinMute/releases/tag/2.5.4.0" }, "beta": { "version": "2.4.9.0", "downloadUrl": "https://github.com/lx-s/WinMute/releases/tag/2.4.9.0" } } ================================================ FILE: Dist/InnoSetup/translations/info-before.de.txt ================================================ WinMute benötigt eine installierte Microsoft Visual C++ Laufzeitumgebung. Diese kann hier unter den folgenden Links heruntergeladen werden: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.en.txt ================================================ Please make sure that the latest Microsoft Visual C++ runtime is installed on your system. To run WinMute only the x64 runtime files are needed. You can download it here: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.es.txt ================================================ Por favor, asegúrese de que la última versión de Microsoft Visual C++ está instalada en su sistema. Para ejecutar WinMute sólo se necesitan los archivos de ejecución x64. Puedes descargarlo aquí: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.fr.txt ================================================ Assurez-vous que la dernière version du runtime Microsoft Visual C++ est installée sur votre système. Pour exécuter WinMute, seuls les fichiers d'exécution x64 sont nécessaires. Vous pouvez le télécharger ici : * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.it.txt ================================================ Assicurati che nel sistema sia installata lasione più recente di Microsoft Visual C++. Per eseguire WinMute sono necessari solo i file runtime x64. Puoi scaricarlo qui: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.ko.txt ================================================ 시스템에 최신 Microsoft Visual C++ 런타임이 설치되어 있는지 확인해 주세요. WinMute를 실행하기 위해서는 x64 런타임 파일만 필요합니다. 여기에서 다운로드할 수 있습니다: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.lv.txt ================================================ Lūdzu, pārliecinieties, ka jūsu sistēmā ir uzstādīta jaunākā Microsoft Visual C++ x64 izpilde. Jūs variet to lejupielādēt šeit: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.nl.txt ================================================ WinMute vereist een geïnstalleerde Microsoft Visual C++-runtimeomgeving. Deze kan hier via de volgende links worden gedownload: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.ro.txt ================================================ Vă rugăm să vă asigurați că cel mai recent Microsoft Visual C++ runtime este instalat pe sistemul dvs. Pentru a rula WinMute sunt necesare doar fișierele x64 runtime. Îl poți descărca de aici: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.ru.txt ================================================ WinMute требует установленной среды выполнения Microsoft Visual C++. Ее можно скачать по следующим ссылкам: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/translations/info-before.zh_Hans.txt ================================================ 请确保您的系统上安装了最新的Microsoft Visual C++。 运行WinMute,需要x64支持。 您可以在此处下载: * https://docs.microsoft.com/cpp/windows/latest-supported-vc-redist * https://aka.ms/vs/17/release/vc_redist.x64.exe ================================================ FILE: Dist/InnoSetup/winmute-setup-languages.iss ================================================ [CustomMessages] de.StartpAppLogon=WinMute mit Windows starten en.StartpAppLogon=Start WinMute when you log on es.StartpAppLogon=Inicie WinMute cuando inicie sesión fr.StartpAppLogon=Démarrez WinMute lorsque vous vous connectez it.StartpAppLogon=Esegui WinMute all'accesso ko.StartpAppLogon=로그온 시 WinMute 시작 lv.StartpAppLogon=Start WinMute when you log on nl.StartpAppLogon=WinMute starten wanneer deze gebruiker aanmeldt ch_s.StartpAppLogon=开机启动WinMute ru.StartpAppLogon=Запускать WinMute при входе этого пользователя в систему de.CheckForUpdates=Automatisch nach Updates suchen en.CheckForUpdates=Automatically check for updates es.CheckForUpdates=Comprueba automáticamente si hay actualizaciones. fr.CheckForUpdates=Vérifier automatiquement les mises à jour it.CheckForUpdates=Verifica automaticamente la disponibilità di aggiornamenti. ko.CheckForUpdates=업데이트를 자동으로 확인합니다 lv.CheckForUpdates=Automatically check for updates nl.CheckForUpdates=Nieuwe updates zoeken bij opstarten ru.CheckForUpdates=Проверять наличие новых обновлений при запуске ch_s.CheckForUpdates=启动时检查新更新 [Languages] Name: "de"; MessagesFile: "compiler:Languages\German.isl"; InfoBeforeFile: "translations/info-before.de.txt"; Name: "en"; MessagesFile: "compiler:Default.isl"; InfoBeforeFile: "translations/info-before.en.txt"; Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl"; InfoBeforeFile: "translations/info-before.es.txt"; Name: "fr"; MessagesFile: "compiler:Languages\French.isl"; InfoBeforeFile: "translations/info-before.fr.txt"; Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"; InfoBeforeFile: "translations/info-before.it.txt"; Name: "ko"; MessagesFile: "compiler:Languages\Korean.isl"; InfoBeforeFile: "translations/info-before.ko.txt"; Name: "lv"; MessagesFile: "compiler:Languages\Latvian.isl"; InfoBeforeFile: "translations/info-before.lv.txt"; Name: "nl"; MessagesFile: "compiler:Languages\dutch.isl"; InfoBeforeFile: "translations/info-before.nl.txt"; Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl"; InfoBeforeFile: "translations/info-before.ru.txt"; Name: "ch_s"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"; InfoBeforeFile: "translations/info-before.zh_Hans.txt"; ================================================ FILE: Dist/InnoSetup/winmute-setup.iss ================================================ #include ".\winmute-setup-languages.iss" #define MyAppName "WinMute" #define MyAppExeName "..\bin\" + MyAppName + ".exe" #define MyAppVersion GetVersionNumbersString(MyAppExeName) #define MyAppPublisher "LX-Systems" #define MyAppURL "https://www.lx-s.de/winmute" #define MyAppExeName "WinMute.exe" #define MyAppMutex "LxSystemsWinMuteRunning" #define CurrentYear GetDateTimeString('yyyy','','') [Setup] AppId={{D2E8F9EF-11E7-418B-B9B7-A35A69A30490} AppName={#MyAppName} AppVersion={#MyAppVersion} AppVerName={#MyAppName} {#MyAppVersion} AppCopyright=(c) {#CurrentYear} {#MyAppPublisher} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} VersionInfoDescription={#MyAppName} installer VersionInfoProductName={#MyAppName} VersionInfoVersion={#MyAppVersion} UninstallDisplayName={#MyAppName} UninstallDisplayIcon={app}\{#MyAppExeName} WizardStyle=modern ShowLanguageDialog=yes UsePreviousLanguage=no LanguageDetectionMethod=uilanguage DefaultDirName={autopf}\{#MyAppPublisher}\{#MyAppName} DisableProgramGroupPage=yes LicenseFile=..\bin\license.rtf AppMutex={#MyAppMutex} SetupMutex={#MyAppMutex}Setup PrivilegesRequiredOverridesAllowed=dialog PrivilegesRequired=lowest OutputDir=..\bin\ OutputBaseFilename=WinMuteSetup SetupIconFile=..\..\WinMute\icons\app.ico ArchitecturesInstallIn64BitMode=x64os Compression=lzma SolidCompression=yes [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "autostart" ; Description: "{cm:StartpAppLogon}" ; GroupDescription: "Autostart"; Flags: unchecked Name: "updates"; Description: "{cm:CheckForUpdates}"; GroupDescription: "Updates"; Flags: unchecked [Files] Source: "..\bin\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion Source: "..\bin\changelog.txt"; DestDir: "{app}"; Flags: ignoreversion Source: "..\bin\license.txt"; DestDir: "{app}"; Flags: ignoreversion Source: "..\bin\lang\lang-de.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-en.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-es.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-fr.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-it.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-ko.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-lv.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-nl.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-ro.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-ru.json"; DestDir: "{app}\lang"; Flags: ignoreversion Source: "..\bin\lang\lang-zh_Hans.json"; DestDir: "{app}\lang"; Flags: ignoreversion [Icons] Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon [Registry] Root: HKCU; Subkey: "Software\lx-systems"; Flags: uninsdeletekeyifempty Root: HKCU; Subkey: "Software\lx-systems\WinMute"; Flags: uninsdeletekey Root: HKCU; Subkey: "Software\lx-systems\WinMute"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}" Root: HKCU; Subkey: "Software\lx-systems\WinMute"; ValueType: dword; ValueName: "CheckForUpdate"; ValueData: "1"; Tasks: updates; Root: HKCU; Subkey: "Software\lx-systems\WinMute\BluetoothDevices"; Flags: uninsdeletekey Root: HKCU; Subkey: "Software\lx-systems\WinMute\WifiNetworks"; Flags: uninsdeletekey Root: HKCU; Subkey: "Software\lx-systems\WinMute\ManagedAudioEndpoints"; Flags: uninsdeletekey Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "LX-Systems WinMute"; ValueData: "{app}\{#MyAppExeName}"; Tasks: autostart; Flags: uninsdeletevalue [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent runasoriginaluser ================================================ FILE: Dist/bin/changelog.txt ================================================ Version 2.5.4 (2025-11-12) * Fixed: "Save" Button not enabling, when adding a new WiFi SSID Version 2.5.3 (2025-10-24) * Added new language: Korean (thanks to https://translate.codeberg.org/user/jseo/) * Added new language: Latvian (thanks to https://github.com/Coool) * Added new language: Russian (thanks to https://translate.codeberg.org/user/yurtpage/) * Added new logging Dialog, so the protocol can be viewed easily without having to store it to disk Version 2.5.2 (2025-02-17) * Added new language: French (thanks to https://translate.codeberg.org/user/avalondrey/) * Fixed dialog when adding new devices to mute list (#38) * Fixed uninstall icon in add/remove programs control panel Version 2.5.1 (2024-05-03) * Added new language: Simplified Chinese (thanks to https://translate.codeberg.org/user/richzhl/) * Updated translations (thanks to all contributors!) Version 2.5.0.1 (2024-02-26) * Fixed update-check file for chocolatey package manager Version 2.5.0 (2024-02-06) * WinMute now supports multiple languages! If your language is missing, and you want to contribute, please check the WinMute GitHub project. Thanks goes out for @bovirus for suggesting this feature, helping out with the italian language version and providing help and feedback throughout the implementation. * The following languages are available - German - English - Spanish - Italian - Dutch (partially) * Optional update notification (disabled for installations via package manager) * Some small bugfixes Version 2.4.9-Pre (2023-12-19) * Pre-Release for 2.5.0 Version 2.4.1 (2023-09-29) * Fixes crash on signout and shutdown Version 2.4.0 (2023-09-22) * Added the option to delay muting by a configurable amount of seconds. Version 2.3.1 (2023-07-27) * Fixed annoying error message when the Windows registry key "SystemUsesLightTheme" is not present. Version 2.3.0 (2023-04-25) * Added function to only mute specific endpoints * As is good tradition, also added a switch to NOT mute specific endpoints * Fixed a problem that WinMute never unmutes, when the PC bootet during quiet hours. * Fixed bluetooth muting description * Changed SetCoalescableTimer to SetTimer, so WinMute can run under Windows 7. Please note that Windows 7 is nevertheless not supported any more. Version 2.2.0 (2022-11-28) * Removed screensaver detection as it caused problems with anti-cheat software of current games (e.g. Overwatch 2, Darktide). Version 2.1.2 (2022-08-25) * Changed bluetooth detection logic, so that muting the workstation doesn't happen, when scanning for new devices. * Fixed crash when connectiong via remote desktop * Show log-file path in settings UI * Enhanced logging Version 2.1.1 (2022-08-03) * Improved UI when WLAN or Bluetooth is not available * Added a 5 second delay before unmuting the workstation, when a bluetooth device reconnects. This should prevent music blasting out of your pc, when the device is connected, but the audio endpoint has not been changed yet. * Integrated Bluetooth muting into overall mute logic, so that the workstation is not unmuted, when it is locked but an audio Bluetooth device reconnects. Version 2.1.0 (2022-08-02) * Added new feature to mute workstation when an bluetooth audio device disconnects (and re-enable audio if it reconnects) * Fixed saving of SSID-lists * Fixed some spelling errors Version 2.0.0 (2022-05-01) * WinMute now mutes all audio endpoints and not just the default endpoint. It also stores all endpoint states and restores them if the appropriate option is set. * Reworked mute detection logic. This should fix timing errors, e.g. when screensaver with screenlock is active. * WinMute can now mute your computer when it is connected (alternatively when it is _not_ connected) to a particular wireless network. * Added detection for display standby * Added detection for RDP sessions * Added autostart option (no more fiddling with the Startup-folder) * Added Hi-DPI awareness * Added tray icon for bright system theme * UI Rework (New settings and about dialogue) * Various fixes and improvements * Updated project to VS 2022 Version 1.6.0 (2020-12-18) * Added "Quiet Hours": A time frame where WinMute automatically mutes and afterwards unmutes your workstation. * Added proxy process to recognize screensaver startup when the current foreground application is a 32-bit application * Removed 32-bit build. Version 1.5.0 (2020-06-29) * Added support for mute on suspend, shutdown and logout Automatic audio-restore is disabled for these events. Version 1.4.6 (2020-04-24) * Compiled with spectre migitations... just 'cause * Added "Support"-Link to About dialog * Small menu redesign. Version 1.4.5 (2019-09-04) * Fixed crash when all audio endpoints are removed while the program is running (might happen, when connecting to your PC via RDP). * Upgraded compiler toolset to VS2019 Version 1.4.4 (2017-08-14) * New, simpler icon * System notification area icon is now white, to fit better with with windows' default icons * Upgraded compiler toolset to VS2017 Version 1.4.3 (2016-08-11) * Maintenance release, no new features * Upgraded to new compiler toolset * Removed Windows XP as I can also no longer test it and as Visual Studio 2015 no longer supports this platform. * Use more modern UI elements Version 1.4.1/1.4.2 (2014-07-17) * Fixed screensaver muting: It sometimes happened that WinMute muted Windows Audio for no apparent reason and "forgot" to unmute. This is now fixed. Version 1.4 (2014-07-10) * WinMute can now also mute if the screensaver starts Due to windows restrictions, unmuting the audio can take up to one second after the screensaver resumes. * Added a toggle switch to configure if WinMute should unmute at all after a workstation lock or a screensaver run Version 1.3 (2012-02-23) * Right-click menu is now correctly dismissed if the user clicks somewhere outside of the menu. * Embedded Visual C++ 2010 DLLs. This increases file size by about 100kb, but enables the usage of this tool in workplaces that do not have deployed the Visual C++ 2010 Runtime Environment yet. * Vista/7/8: Correctly mute the new device, if the default audio endpoint changes. * XP: Greatly improved hardware detection code. WinMute now mutes all devices, instead of just setting the volume of the first device it finds to zero. If the Mute-Button is locked via Group Policies, WinMute will try to use the Volume Slider to "emulate" sound muting. * XP: Actively tries to prevent other programs from unmuting the system. Version 1.2 (2011-05-30) * Fixed a bug where WinMute could malfunction if the audio device was changed or disconnected during a windows session. Version 0.0 - 1.1 * These documents have been lost forever... ================================================ FILE: Dist/bin/license.rtf ================================================ {\rtf1\ansi\deff3\adeflang1025 {\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New Roman};}{\f4\fswiss\fprq2\fcharset0 Liberation Sans{\*\falt Arial};}{\f5\fnil\fprq2\fcharset0 Calibri;}{\f6\fnil\fprq2\fcharset0 Arial;}{\f7\fnil\fprq2\fcharset0 Symbol;}{\f8\fnil\fprq2\fcharset0 Microsoft YaHei;}{\f9\fnil\fprq2\fcharset0 Lucida Sans;}{\f10\fswiss\fprq0\fcharset128 Lucida Sans;}} {\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} {\stylesheet{\s0\snext0\rtlch\af9\afs24\alang1081 \ltrch\lang1031\langfe2052\hich\af3\loch\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af11\langfe2052 Normal;} {\*\cs15\snext15\hich\af7\loch\f7 ListLabel 1;} {\s16\sbasedon0\snext17\rtlch\af9\afs28 \ltrch\hich\af4\loch\sb240\sa120\keepn\f4\fs28\dbch\af8 \u220\'dcberschrift;} {\s17\sbasedon0\snext17\loch\sl276\slmult1\sb0\sa140 Body Text;} {\s18\sbasedon17\snext18\rtlch\af10 \ltrch\loch\sl276\slmult1\sb0\sa140 List;} {\s19\sbasedon0\snext19\rtlch\af10\afs24\ai \ltrch\loch\sb120\sa120\noline\fs24\i caption;} {\s20\sbasedon0\snext20\rtlch\af10 \ltrch\loch\noline Verzeichnis;} }{\*\listtable{\list\listtemplateid1 {\listlevel\levelnfc23\leveljc0\levelstartat0\levelfollow0{\leveltext \'01\u183 ?;}{\levelnumbers;}\f1\fi0\li0} {\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'01.;}{\levelnumbers\'01;}\fi-360\li1080} {\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'02.;}{\levelnumbers\'01;}\fi-360\li1440} {\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'03.;}{\levelnumbers\'01;}\fi-360\li1800} {\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'04.;}{\levelnumbers\'01;}\fi-360\li2160} {\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'05.;}{\levelnumbers\'01;}\fi-360\li2520} {\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'06.;}{\levelnumbers\'01;}\fi-360\li2880} {\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'07.;}{\levelnumbers\'01;}\fi-360\li3240} {\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'08.;}{\levelnumbers\'01;}\fi-360\li3600}\listid1} {\list\listtemplateid2 {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0} {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0} {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0} {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0} {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0} {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0} {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0} {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0} {\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}\listid2} }{\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}}{\*\generator LibreOffice/24.8.4.2$Windows_X86_64 LibreOffice_project/bb3cfa12c7b1bf994ecc5649a80400d06cd71002}{\info{\creatim\yr0\mo0\dy0\hr0\min0}{\revtim\yr2025\mo2\dy17\hr17\min32}{\printim\yr0\mo0\dy0\hr0\min0}}{\*\userprops}\deftab708 \hyphauto1\viewscale100\formshade\paperh15840\paperw12240\margl1440\margr1440\margt1440\margb1440\sectd\sbknone\sftnnar\saftnnrlc\sectunlocked1\pgwsxn12240\pghsxn15840\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440\ftnbj\ftnstart1\ftnrstcont\ftnnar\fet\aftnrstcont\aftnstart1\aftnnrlc {\*\ftnsep\chftnsep}\pgndec\pard\plain \s0\rtlch\af9\afs24\alang1081 \ltrch\lang1031\langfe2052\hich\af3\loch\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af11\langfe2052\sl276\slmult1\ql\widctlpar\sb0\sa200\ltrpar{\hich\af6\loch\fs22\lang1031\b\f6\loch Copyright (C) 2011-202}{\hich\af6\loch\fs22\lang1031\b\f6\loch 5}{\hich\af6\loch\fs22\lang1031\b\f6\loch , Alexander Steinh\u246\'f6fer\line }{\hich\af6\loch\fs22\lang1031\b0\f6\loch All rights reserved.} \par \pard\plain \s0\rtlch\af9\afs24\alang1081 \ltrch\lang1031\langfe2052\hich\af3\loch\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af11\langfe2052\sl276\slmult1\ql\widctlpar\sb0\sa200\ltrpar{\hich\af6\loch\fs22\lang1031\b0\f6\loch Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:} \par \pard\plain \s0\rtlch\af9\afs24\alang1081 \ltrch\lang1031\langfe2052\hich\af3\loch\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af11\langfe2052{\listtext\pard\plain \hich\af7\loch\f7 \u183\'b7\tab}\ilvl0\ls1 \fi0\li720\lin720\sl276\slmult1\ql\widctlpar\fi-360\li720\lin720\sb0\sa200\ltrpar{\hich\af6\loch\fs22\lang1031\b0\f6\loch Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.} \par \pard\plain \s0\rtlch\af9\afs24\alang1081 \ltrch\lang1031\langfe2052\hich\af3\loch\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af11\langfe2052{\listtext\pard\plain \hich\af7\loch\f7 \u183\'b7\tab}\ilvl0\ls1 \fi0\li720\lin720\sl276\slmult1\ql\widctlpar\fi-360\li720\lin720\sb0\sa200\ltrpar{\hich\af6\loch\fs22\lang1031\b0\f6\loch Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.} \par \pard\plain \s0\rtlch\af9\afs24\alang1081 \ltrch\lang1031\langfe2052\hich\af3\loch\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af11\langfe2052{\listtext\pard\plain \hich\af7\loch\f7 \u183\'b7\tab}\ilvl0\ls1 \fi0\li720\lin720\sl276\slmult1\ql\widctlpar\fi-360\li720\lin720\sb0\sa200\ltrpar{\hich\af6\loch\fs22\lang1031\b0\f6\loch Neither the name of the \{organization\} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.} \par \pard\plain \s0\rtlch\af9\afs24\alang1081 \ltrch\lang1031\langfe2052\hich\af3\loch\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af11\langfe2052\sl276\slmult1\ql\widctlpar\sb0\sa200\ltrpar{\hich\af6\loch\fs22\lang1031\b0\f6\loch THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.} \par } ================================================ FILE: Dist/bin/license.txt ================================================ WinMute Copyright (C) 2025 Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE ================================================ FILE: Dist/bin/update-check.disabled ================================================ This file should be used, when WinMute is installed via a package manager. If this file is present, WinMute does not display update-check options. ================================================ FILE: Dist/chocolatey/WinMute.nuspec ================================================ winmute 2.5.4.0 WinMute Alexander Steinhöfer Alexander Steinhöfer https://github.com/lx-s/WinMute/releases https://github.com/lx-s/WinMute/issues https://github.com/lx-s/WinMute https://github.com/lx-s/WinMute/ https://cdn.statically.io/gh/lx-s/WinMute/main/WinMute/icons/app-512.png winmute windows utility audio Automatic sound muter WinMute automatically mutes your PC volume if you lock your screen or the screensaver is running. © 2024 Alexander Steinhöfer https://github.com/lx-s/WinMute/releases/tag/2.5.2.0 https://raw.githubusercontent.com/lx-s/WinMute/main/LICENSE ================================================ FILE: Dist/chocolatey/howto.txt ================================================ choco pack choco push --source https://push.chocolatey.org/ Get API-Key from: https://push.chocolatey.org/account choco apikey add -k -s https://push.chocolatey.org/ ================================================ FILE: Dist/chocolatey/tools/VERIFICATION.txt ================================================ VERIFICATION Powershell> Get-ChildItem | Get-FileHash -Algorithm SHA256 | Format-List ---------------------------------------------------------------------------- Algorithm : SHA256 Hash : 9D7577D389808853947ECA83BA08D6D46A206859AD0ED28F95D38F6F8F4C850E Path : changelog.txt Algorithm : SHA256 Hash : 9CCE14785CE3BE2620072AB6460CF727A5684809781CC9A11A24301E0E87B574 Path : license.txt Algorithm : SHA256 Hash : FC28DCBC89FD451D439FEE3171E4705E7EF3327DDE716E72A55F3B2299FC056F Path : liesmich.html Algorithm : SHA256 Hash : 6B0B9149FF44EC42499CDCEFD762270CCB913D4D3413A61441B00F53B1656B7C Path : readme.html Algorithm : SHA256 Hash : A4211BF558937DEFB0B9BF7820C8538A583B8CF48AD3A1FB7FAB585979F4093E Path : ScreensaverNotify.dll Algorithm : SHA256 Hash : D0BFB57B3371BB8164D65D10EC3E85B5939A8FD321CE42B875FE7D453B81DBFC Path : ScreensaverNotify32.dll Algorithm : SHA256 Hash : 130BF27A204A14E4923E619CDDA7900D02F21EBDB6D9B0FE57730942D8B1884D Path : ScreensaverProxy32.exe Algorithm : SHA256 Hash : BC020A4675F2A05F602329AAD93C7FCF95F2BFB178177E7C44536C08BDE1BBD2 Path : WinMute.exe Algorithm : SHA256 Hash : E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855 Path : WinMute.exe.gui ================================================ FILE: Dist/chocolatey/tools/chocolateybeforemodify.ps1 ================================================ Stop-Process -Name WinMute ================================================ FILE: Dist/chocolatey/tools/chocolateyinstall.ps1 ================================================  ================================================ FILE: Dist/chocolatey/tools/chocolateyuninstall.ps1 ================================================ Stop-Process -Name WinMute Remove-Item "HKCU:\SOFTWARE\lx-systems\WinMute" Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "LX-Systems WinMute" ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.0.0/LX-Systems.WinMute.installer.yaml ================================================ # Created using wingetcreate 1.6.1.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.6.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.0.0 InstallerType: inno InstallerSwitches: Custom: /SILENT /CURRENTUSER ReleaseDate: 2024-02-06 Dependencies: PackageDependencies: - PackageIdentifier: Microsoft.VCRedist.2015+.x64 Installers: - Architecture: x64 InstallerUrl: https://github.com/lx-s/WinMute/releases/download/2.5.0.0/WinMute-2.5.0-Setup.exe InstallerSha256: 2159122473D4B5B5931098AC527272502FC137D3F34D1487318DE93C7211C34D ManifestType: installer ManifestVersion: 1.6.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.0.0/LX-Systems.WinMute.locale.en-US.yaml ================================================ # Created using wingetcreate 1.6.1.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.6.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.0.0 PackageLocale: en-US Publisher: LX-Systems PublisherUrl: https://www.lx-s.de PublisherSupportUrl: https://github.com/lx-s/WinMute/issues PackageName: WinMute PackageUrl: https://github.com/lx-s/WinMute License: BSD-3-CLAUSE LicenseUrl: https://github.com/lx-s/WinMute/blob/main/LICENSE ShortDescription: WinMute lets you automatically mute your PC volume on certain events. ManifestType: defaultLocale ManifestVersion: 1.6.0 ReleaseNotes: |- - WinMute now supports multiple languages! The following languages are available: German, English, Spanish, Italian - Optional update notification (disabled for installations via package manager) - Some small bugfixes and UI improvements ReleaseNotesUrl: https://github.com/lx-s/WinMute/releases/tag/2.5.0.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.0.0/LX-Systems.WinMute.yaml ================================================ # Created using wingetcreate 1.6.1.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.6.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.0.0 DefaultLocale: en-US ManifestType: version ManifestVersion: 1.6.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.1.0/LX-Systems.WinMute.installer.yaml ================================================ # Created using wingetcreate 1.6.1.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.6.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.1.0 InstallerType: inno InstallerSwitches: Custom: /SILENT /CURRENTUSER Dependencies: PackageDependencies: - PackageIdentifier: Microsoft.VCRedist.2015+.x64 Installers: - Architecture: x64 InstallerUrl: https://github.com/lx-s/WinMute/releases/download/2.5.1.0/WinMute-2.5.1-Setup.exe InstallerSha256: 0F4A31D3354022388F96500DCD35F490D44A73AABC3527A667EBEB57EF40E37F ManifestType: installer ManifestVersion: 1.6.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.1.0/LX-Systems.WinMute.locale.en-US.yaml ================================================ # Created using wingetcreate 1.6.1.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.6.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.1.0 PackageLocale: en-US Publisher: LX-Systems PublisherUrl: https://www.lx-s.de PublisherSupportUrl: https://github.com/lx-s/WinMute/issues PackageName: WinMute PackageUrl: https://github.com/lx-s/WinMute License: BSD-3-CLAUSE LicenseUrl: https://github.com/lx-s/WinMute/blob/main/LICENSE ShortDescription: WinMute lets you automatically mute your PC volume on certain events. ManifestType: defaultLocale ManifestVersion: 1.6.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.1.0/LX-Systems.WinMute.yaml ================================================ # Created using wingetcreate 1.6.1.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.6.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.1.0 DefaultLocale: en-US ManifestType: version ManifestVersion: 1.6.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.2.0/LX-Systems.WinMute.installer.yaml ================================================ # Created using wingetcreate 1.9.2.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.9.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.2.0 InstallerType: inno InstallerSwitches: Custom: /SILENT /CURRENTUSER Dependencies: PackageDependencies: - PackageIdentifier: Microsoft.VCRedist.2015+.x64 Installers: - Architecture: x64 InstallerUrl: https://github.com/lx-s/WinMute/releases/download/2.5.2.0/WinMute-2.5.2-Setup.exe InstallerSha256: 75446D98D267856FE888DC206130BEDAD992007A1311B65DE1389175CE087760 ManifestType: installer ManifestVersion: 1.9.0 ReleaseDate: 2025-02-17 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.2.0/LX-Systems.WinMute.locale.en-US.yaml ================================================ # Created using wingetcreate 1.9.2.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.9.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.2.0 PackageLocale: en-US Publisher: LX-Systems PublisherUrl: https://www.lx-s.de PublisherSupportUrl: https://github.com/lx-s/WinMute/issues PackageName: WinMute PackageUrl: https://github.com/lx-s/WinMute License: BSD-3-CLAUSE LicenseUrl: https://github.com/lx-s/WinMute/blob/main/LICENSE ShortDescription: WinMute lets you automatically mute your PC volume on certain events. Tags: - lock - pc-volume - screensaver - tools - windows ReleaseNotesUrl: https://github.com/lx-s/WinMute/releases/tag/2.5.2.0 ManifestType: defaultLocale ManifestVersion: 1.9.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.2.0/LX-Systems.WinMute.yaml ================================================ # Created using wingetcreate 1.9.2.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.9.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.2.0 DefaultLocale: en-US ManifestType: version ManifestVersion: 1.9.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.3.0/LX-Systems.WinMute.installer.yaml ================================================ # Created using wingetcreate 1.10.3.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.10.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.3.0 InstallerType: inno InstallerSwitches: Custom: /SILENT /CURRENTUSER Dependencies: PackageDependencies: - PackageIdentifier: Microsoft.VCRedist.2015+.x64 Installers: - Architecture: x64 InstallerUrl: https://github.com/lx-s/WinMute/releases/download/2.5.3.0/WinMute-2.5.3-Setup.exe InstallerSha256: D0C36127902851CFFDF4089C28B12C1EC57F510B47D58EBA98E2EE8D27B92877 ManifestType: installer ManifestVersion: 1.10.0 ReleaseDate: 2025-10-24 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.3.0/LX-Systems.WinMute.locale.en-US.yaml ================================================ # Created using wingetcreate 1.10.3.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.10.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.3.0 PackageLocale: en-US Publisher: LX-Systems PublisherUrl: https://www.lx-s.de PublisherSupportUrl: https://github.com/lx-s/WinMute/issues PackageName: WinMute PackageUrl: https://github.com/lx-s/WinMute License: BSD-3-CLAUSE LicenseUrl: https://github.com/lx-s/WinMute/blob/main/LICENSE ShortDescription: WinMute lets you automatically mute your PC volume on certain events. Tags: - lock - pc-volume - screensaver - tools - windows ReleaseNotesUrl: https://github.com/lx-s/WinMute/releases/tag/2.5.3.0 ManifestType: defaultLocale ManifestVersion: 1.10.0 ================================================ FILE: Dist/winget/manifests/l/LX-Systems/WinMute/2.5.3.0/LX-Systems.WinMute.yaml ================================================ # Created using wingetcreate 1.10.3.0 # yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.10.0.schema.json PackageIdentifier: LX-Systems.WinMute PackageVersion: 2.5.3.0 DefaultLocale: en-US ManifestType: version ManifestVersion: 1.10.0 ================================================ FILE: Dist/winget.txt ================================================ # Update wingetcreate update --submit --urls "https://github.com/lx-s/WinMute/releases/download//WinMute--Setup.exe|x64" --version LX-Systems.WinMute # Token wingetcreate.exe token --store --token ================================================ FILE: LICENSE ================================================ Copyright (C) 2025, Alexander Steinhoefer All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the {organization} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: README.md ================================================ # WinMute
WinMute's logo
**WinMute** is a small and simple tool, that automatically mutes (and unmutes) your workstation based on triggers, e.g. the screensaver starts, or your bluetooth headphone disconnects. It was created to not repeatedly annoy my co-workers with random sounds or music from my computer whenever I left the room and forgot to mute my computer. ## Features * WinMute can automatically mute all sound devices on your workstation when: * you lock your workstation. * the display turns off. * you log off or switch user. * your workstation shuts down, goes into hibernate or goes to sleep. * your bluetooth headset/headphones disconnect. * your workstation is connected to a particular wireless network. * alternatively: your Workstation is _not_ connected to particular wireless network * WinMute is small and only needs a few kilobytes of disk space * WinMute is ad-free, telemetry-free and generally does not send any data whatsoever ## Screenshots ![Screenshot of WinMute](Dist/screenshots/app.png? "Screenshot of WinMute") ![Screenshot of the Settings](Dist/screenshots/settings.gif? "Settings dialog") ## Languages WinMute is currently available in the following languages: [![Translation Status](https://translate.codeberg.org/widget/winmute/winmute/multi-auto.svg)](https://translate.codeberg.org/engage/winmute/) ## Contributions If you are fluent in another language, want to fix some bugs or pitch some new ideas, please take a look at [CONTRIBUTING.md](CONTRIBUTING.md). ## Usage ### Requirements * Windows 7 or any newer version of Windows. * [Visual Studio 2015-2022 Redistributable](https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads) ### Installation Either unzip it to your favourite directory or run the Setup.exe and you are all set up! ### Uninstalling WinMute If you've installed it with the setup, uninstall it from the Windows programs control panel). If you've installed it without the setup, just delete it. If you want to also remove your personal WinMute settings, open the registry via `regedit.exe` and delete the Folder located in `HKEY_CURRENT_USER\Software\lx-systems\WinMute`. ### How to (un)mute Just start it and you are good to go! Whenever you lock your screen from now on or the screensaver starts, WinMute will automatically mute your windows volume, and unmute it right away when you come back to your pc. If you want to change the behaviour or explore all the other options, right-click on the taskbar notification icon and explore! ================================================ FILE: Translations/lang-de.json ================================================ { "meta.lang.name": "Deutsch (German)", "meta.lang.mode": "ltr", "init.error.settings.title": "Fehler beim Initialisieren", "init.error.settings.text": "Kritischer Fehler beim Initialisieren von WinMute", "init.error.already-running.title": "WinMute läuft bereits", "init.error.already-running.text": "Bitte halten Sie ausschau nach einem weißen Lautsprechersymbol im Symbolbereich der Taskleiste.", "init.error.winmute.title": "Fehler beim Starten von WinMute.", "init.error.winmute.text": "Ein kritischer Fehler trat beim starten von WinMute auf. Das Programm muss beendet werden.", "init.error.winmute.platform-support.title": "Nur Windows Vista and neuer werden unterstützt", "init.error.winmute.platform-support.text": "Für Windows XP Unterstützung, kann WinMute in der Version 1.4.2 oder älter installiert werden.", "general.error.winapi.text": "{} fehlgeschlagen mit Fehler {}: {}", "general.error.audio-service-shutdown.title": "Der Audioservice wurde beendet.", "general.error.audio-service-shutdown.text": "WinMute kann diese Situation nicht Beheben. Bitte starten Sie das Programm neu.", "popup.remote-session-detected.title": "Remote Session festgestellt", "popup.remote-session-detected.text": "Alle Audiogeräte wurden stumm geschaltet", "popup.bluetooth-muting-disabled.title": "Bluetooth-Stummschalten deaktiviert", "popup.bluetooth-muting-disabled.text": "Bluetooth ist nicht verfügbar oder deaktiviert.\nDas Bluetooth-abhängige Stummschalten wurde deaktiviert.", "popup.wlan-muting-disabled.title": "WLAN-Stummschalten deaktiviert", "popup.wlan-muting-disabled.text": "WLAN ist nicht verfügbar oder deaktiviert.\nDas WLAN-abhängige Stummschalten wurde deaktiviert.", "popup.quiet-hours-started.title": "Die Ruhezeit hat begonnen", "popup.quiet-hours-started.text": "Der Computer wird stumm geschaltet.", "popup.quiet-hours-ended.title": "Ruhezeit vorbei", "popup.quiet-hours-ended.text": "Audiopegel wurden wiederhergestellt.", "popup.workstation-muted.title": "Computer stummgeschaltet", "popup.wlan-not-on-mute-list.text": "WLAN-Netzwerk \"{}\" ist nicht auf der Erlaubt-Liste.", "popup.wlan-is-on-mute-list.text": "WLAN-Netzwerknetwork \"{}\" wurde für das automatische Stummschalten konfiguriert.", "popup.muting-workstation-after-delay.title": "Verzögertes Stummschalten des Computers", "popup.muting-workstation-after-delay.text": "Alle Audiogeräte wurden stummgeschaltet", "popup.volume-restored.title": "Lautstärke wiederhergestellt", "popup.volume-restored.text": "Die Lautstärkepegel aller Audiogeräte wurden wiederhergestellt", "popup.muting-workstation.title": "Stummschalten des Computers", "popup.muting-workstation.text": "Alle Audiogeräte wurden stumm geschaltet", "popup.error.quiet-hours-start.title": "Beginn der Ruhzeit", "popup.error.quiet-hours-start.text": "Fehler beim Registrieren des Windows-Timers für den Ruhezeit-Beginn", "popup.error.quiet-hours-stop.title": "Ende der Ruhezeit", "popup.error.quiet-hours-stop.text": "Fehler beim Registrieren des Windows-Timers für das Ruhezeit-Ende", "traymenu.info": "Info", "traymenu.mute-when": "Stummschalten sobald...", "traymenu.mute-on-lock": "... PC gesperrt wird", "traymenu.mute-on-screen-suspend": "... der Bildschirm sich ausschaltet", "traymenu.restore-volume": "Lautstärke wiederherstellen", "traymenu.mute-no-restore": "Stummschalten ohne Wiederherstellung...", "traymenu.mute-on-shutdown": "... Herunterfahren", "traymenu.mute-on-sleep": "... Standby", "traymenu.mute-on-logout": "... Ausloggen", "traymenu.mute-all-devices": "Alle Geräte jetzt stummschalten", "traymenu.settings": "Einstellungen...", "traymenu.exit": "Beenden", "settings.title": "Einstellungen", "settings.btn-save": "Speichern", "settings.btn-cancel": "Abbrechen", "settings.btn-add": "Hinzufügen", "settings.btn-edit": "Bearbeiten", "settings.btn-remove": "Entfernen", "settings.btn-remove-all": "Alle entfernen", "settings.tab.general": "Allgemein", "settings.tab.mute": "Stummschalten", "settings.tab.quiet-hours": "Ruhezeit", "settings.tab.bluetooth": "Bluetooth", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "Bluetooth-Gerät hinzufügen", "settings.bluetooth.add-edit.edit-title": "Bluetooth-Gerät bearbeiten", "settings.bluetooth.add-edit.device-name-label": "Bluetooth Gerätename:", "settings.general.run-on-startup": "WinMute mit Windows starten", "settings.general.enable-logging": "Protokoll in Datei speichern", "settings.general.btn-open-log-file": "Protokolldatei öffnen...", "settings.general.btn-open-log-window": "Protokoll anzeigen...", "settings.general.select-language-label": "Sprache", "settings.bluetooth.add-edit.enter-device-name-placeholder": "Bitte geben Sie einen Gerätenamen an", "settings.bluetooth.description": "\"Bluetooth Muting\" aktiviert das Stummschalten des PCs sobald ein Bluetooth-Audiogerät vom PC getrennt wird und hebt die Stummschaltung auf, sobald es wieder verbunden wird.\n\nDieses Verhalten kann für alle oder nur bestimmte Bluetooth-Geräte aktiviert werden.", "settings.bluetooth.enable-muting": "\"Bluetooth Stummschalten\" aktivieren", "settings.bluetooth.enable-muting-filter": "Nur für die folgenden Geräte aktivieren:", "settings.bluetooth-disabled-info": "Info: Bluetooth ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", "settings.mute.general-title": "Allgemein", "settings.mute.show-mute-event-notifications": "Zeige Benachrichtigungen an", "settings.mute.manage-endpoints-individually": "Verwalte Audiogeräte individuell", "settings.mute.btn-manage-endpoints": "Audiogeräte verwalten...", "settings.mute.mute-with-restore.title": "Stummschalten mit Lautstärkewiederherstellung, wenn...", "settings.mute.mute-with-restore.when-workstation-is-locked": "... der PC gesperrt wird", "settings.mute.mute-with-restore.when-screen-turns-off": "... der Bildschirm in Standby geht", "settings.mute.mute-with-restore.restore-volume": "Lautstärke danach wiederherstellen", "settings.mute.mute-with-restore.restore-volume-delay-label": "Sekunden Verzögerung vor dem Stummschalten.", "settings.mute.mute-without-restore.title": "Stummschalten ohne Lautstärkenwiederherstellung, wenn...", "settings.mute.mute-without-restore.when-computer-shuts-down": "... der Computer heruntegefahren wird", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... der Computer in den Schlaf-/Ruhemodus geht", "settings.mute.mute-without-restore.when-user-logs-out": "... sich der Benutzer abmeldet", "settings.mute.mute-without-restore.when-rdp-session-starts": "... eine RDP Session erkannt wird", "settings.quiet-hours.intro": "Während der Ruhezeit schaltet WinMute alle Audiogeräte auf Stumm und stellt anschließend die Lautstärke wieder her.", "settings.quiet-hours.enable": "Ruhzeit aktivieren", "settings.quiet-hours.start-time-label": "Beginn:", "settings.quiet-hours.end-time-label": "Ende:", "settings.quiet-hours.force-unmute": "Lautstärkewiederherstellung erzwingen", "settings.quiet-hours.force-unmute-description": "Die Lautstärke wird von allen Audiogeräten wiederhergestellt, unabhängig davon ob diese vor der Ruhezeit stumm geschaltet waren, oder nicht.", "settings.quiet-hours.show-notifications": "Benachrichtigungen zur Ruhezeit anzeigen", "settings.quiet-hours.error.invalid-time-range.title": "Fehlerhafter Zeitraum", "settings.quiet-hours.error.invalid-time-range.text": "Beginn und Ende müssen unterschiedliche Zeiten sein.", "settings.quiet-hours.error.error-while-saving.title": "Fehler beim Speichern der Einstellungen", "settings.quiet-hours.error.error-while-saving.text": "Während dem Speichern der Ruhezeiteinstellungen trat ein Fehler auf", "settings.wifi.intro": "Das WLAN basiert Stummschalten ermöglicht es die PC-Lautstärke abhängig von dem Namen des verbundenen WLAN Netzwerks zu steuern.", "settings.wifi.enable": "Aktiviere WLAN-basiertes Stummschalten", "settings.wifi.mute-when-not-in-list": "Stummschalten, wenn das WLAN nicht in der Liste ist", "settings.wifi.wifi-disabled-info": "Info: WLAN ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", "settings.wifi.add-edit.add-title": "WLAN Netzwerk hinzufügen", "settings.wifi.add-edit.edit-title": "WLAN Netzwerk bearbeiten", "settings.wifi.add-edit.ssid-name-label": "SSID/WLAN-Name:", "settings.wifi.add-edit.enter-device-name-placeholder": "Bitte geben sie einen WLAN Netzwerknamen ein", "settings.mute.manage-endpoints.title": "Audiogeräte verwalten", "settings.mute.manage-endpoints.list-behaviour.title": "Allgemein", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "Nur gespeicherte Audiogeräte stummschalten", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "Alle bis auf die gespeicherten Audiogeräte stummschalten", "settings.mute.manage-endpoints.endpoints.title": "Audiogeräte", "settings.mute.manage-endpoints.add-edit.add-title": "Gerät hinzufügen", "settings.mute.manage-endpoints.add-edit.edit-title": "Gerät bearbeiten", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "Bitte ein Audiogerät angeben", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Audiogerät:", "about.title": "Über WinMute", "about.general.author-site-label": "Entwickler: www.lx-s.de", "about.general.project-site-label": "Projektseite && Code", "about.general.support-label": "Hilfe/Unterstützung", "about.general.description": "WinMute wird von Alexander Steinhöfer in seiner Freizeit entwickelt. Der Quelltext sowie neue Programmversionen können auf GitHub heruntergeladen werden. Beiträge in Form von Code, Tickets oder Featurewünsche werden gerne gesehen! Vielen Dank dass Sie dieses kleine Tool verwenden!", "about.tab.winmute": "WinMute", "about.tab.license": "Lizenz", "about.btn-close": "OK", "settings.wifi.mute-when-in-list": "Stummschalten, wenn das WLAN in der Liste ist", "settings.general.check-for-updates-on-start": "Bei Programmstart nach Updates suchen", "popup.update-available.text": "Die installierte Version ist {}.\nKlicken sie auf diese Nachricht zum Öffnen der Downloadseite.", "popup.update-available-beta.title": "WinMute Beta {} ist verfügbar!", "popup.update-available-beta.text": "Die installierte Version ist {}.\nKlicken sie auf diese Nachricht zum Öffnen der Beta-Downloadseite.", "settings.bluetooth.bluetooth-disabled-info": "Info: Bluetooth ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", "popup.error.update-check-failed.title": "Updateprüfung fehlgeschlagen.", "popup.update-available.title": "WinMute {} ist verfügbar!", "pupup.error.update-check-failed.text": "Fehler beim Prüfen auf eine neue Version.\nBitte prüfen Sie die Protokolldateien.", "settings.general.check-for-beta-updates-on-start": "Auf Vorabversionen überprüfen", "settings.general.updates-handled-externally": "Optionen deaktiviert: Updates werden extern durchgeführt", "settings.general.help-translating": "Hilf beim Übersetzen", "log.title": "WinMute Protokolldatei" } ================================================ FILE: Translations/lang-en.json ================================================ { "meta.lang.name": "English", "meta.lang.mode": "ltr", "init.error.settings.title": "Failed to initialize settings", "init.error.settings.text": "Critical error while initializing WinMute", "init.error.already-running.title": "WinMute is already running", "init.error.already-running.text": "Please look for a winmutes application icon in the Windows taskbar notification area.", "init.error.winmute.title": "Failed to start WinMute.", "init.error.winmute.text": "WinMute encountered a critical error while initializing and must shut down.", "init.error.winmute.platform-support.title": "Only Windows Vista and newer is supported", "init.error.winmute.platform-support.text": "If Windows XP support is needed, please download WinMute version 1.4.2 or lower.", "general.error.winapi.text": "{} failed with error {}: {}", "general.error.audio-service-shutdown.title": "The audio service has been shut down.", "general.error.audio-service-shutdown.text": "WinMute is not able to recover from that condition.\nPlease try to restart the program.", "popup.update-available.title": "WinMute {} is available!", "popup.update-available.text": "The installed version is {}.\nClick on this message to open the download page.", "popup.update-available-beta.title": "WinMute Beta {} is available!", "popup.update-available-beta.text": "Your current version is {}.\nClick on this message to open the beta-download page.", "popup.error.update-check-failed.title": "Update check failed.", "pupup.error.update-check-failed.text": "Unable to check for a new version.\nPlease check/enable logging for further details.", "popup.remote-session-detected.title": "Remote Session detected", "popup.remote-session-detected.text": "All audio devices have been muted", "popup.bluetooth-muting-disabled.title": "Bluetooth muting disabled", "popup.bluetooth-muting-disabled.text": "Bluetooth is not available or disabled.\nBluetooth muting will be disabled on this computer.", "popup.wlan-muting-disabled.title": "WLAN muting disabled", "popup.wlan-muting-disabled.text": "WLAN is not available or disabled.\nWLAN muting will be disabled on this computer.", "popup.quiet-hours-started.title": "Quiet hours started", "popup.quiet-hours-started.text": "Computer audio will now be muted.", "popup.quiet-hours-ended.title": "Quiet Hours ended", "popup.quiet-hours-ended.text": "Computer audio has been restored.", "popup.workstation-muted.title": "Audio muted", "popup.wlan-not-on-mute-list.text": "WLAN network \"{}\" is not on allowed list.", "popup.wlan-is-on-mute-list.text": "WLAN network \"{}\" is configured for AutoMute.", "popup.muting-workstation-after-delay.title": "Muting computer after delay", "popup.muting-workstation-after-delay.text": "All devices have been muted", "popup.volume-restored.title": "Volume restored", "popup.volume-restored.text": "All devices have been restored to their previous configuration", "popup.muting-workstation.title": "Muting computer", "popup.muting-workstation.text": "All devices have been muted", "popup.error.quiet-hours-start.title": "Quiet Hours Start", "popup.error.quiet-hours-start.text": "Failed to register quiet hours start with windows timer system", "popup.error.quiet-hours-stop.title": "Quiet Hours Stop", "popup.error.quiet-hours-stop.text": "Failed to register end of quiet hours with windows timer system", "traymenu.info": "About", "traymenu.mute-when": "Mute when...", "traymenu.mute-on-lock": "... computer is locked", "traymenu.mute-on-screen-suspend": "... screen turns off", "traymenu.restore-volume": "Restore volume afterwards", "traymenu.mute-no-restore": "Mute on (no volume restore)...", "traymenu.mute-on-shutdown": "... shutdown", "traymenu.mute-on-sleep": "... sleep", "traymenu.mute-on-logout": "... logout", "traymenu.mute-all-devices": "Mute all devices now", "traymenu.settings": "Settings...", "traymenu.exit": "Exit", "settings.title": "Settings", "settings.btn-save": "Save", "settings.btn-cancel": "Cancel", "settings.btn-add": "Add", "settings.btn-edit": "Edit", "settings.btn-remove": "Remove", "settings.btn-remove-all": "Remove all", "settings.tab.general": "General", "settings.tab.mute": "Mute", "settings.tab.quiet-hours": "Quiet Hours", "settings.tab.bluetooth": "Bluetooth", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "Add Bluetooth device", "settings.bluetooth.add-edit.edit-title": "Edit Bluetooth device", "settings.bluetooth.add-edit.device-name-label": "Bluetooth device name:", "settings.general.run-on-startup": "Run WinMute when this user logs on", "settings.general.check-for-updates-on-start": "Check for new updates on startup", "settings.general.check-for-beta-updates-on-start": "Also check for new beta versions", "settings.general.updates-handled-externally": "Options disabled: Updates are handled externally", "settings.general.enable-logging": "Save log to file", "settings.general.btn-open-log-file": "Open log file...", "settings.general.btn-open-log-window": "Show log...", "settings.general.select-language-label": "Language", "settings.general.help-translating": "Help translating", "settings.bluetooth.add-edit.enter-device-name-placeholder": "Please enter a Bluetooth device name", "settings.bluetooth.description": "\"Bluetooth Muting\" allows disabling the audio if an audio-class bluetooth device is disconnected, and re-enables it if a device is reconnected to the computer.\n\nThis behaviour can be enabled for all bluetooth audio-devices or only for a specific set.", "settings.bluetooth.enable-muting": "Enable Bluetooth-based muting", "settings.bluetooth.enable-muting-filter": "Enable only for these devices:", "settings.bluetooth.bluetooth-disabled-info": "Note: Bluetooth is not available on this device.\nSome options have been disabled.", "settings.mute.general-title": "General", "settings.mute.show-mute-event-notifications": "Show mute event notifications", "settings.mute.manage-endpoints-individually": "Manage audio devices individually", "settings.mute.btn-manage-endpoints": "Manage devices...", "settings.mute.mute-with-restore.title": "Mute with volume restore, when...", "settings.mute.mute-with-restore.when-workstation-is-locked": "... the computer is locked", "settings.mute.mute-with-restore.when-screen-turns-off": "... the screen turns off", "settings.mute.mute-with-restore.restore-volume": "Restore volume afterwards", "settings.mute.mute-with-restore.restore-volume-delay-label": "seconds delay before muting.", "settings.mute.mute-without-restore.title": "Mute without volume restore, when...", "settings.mute.mute-without-restore.when-computer-shuts-down": "... the computer shuts down", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... the computer goes into sleep/hibernate", "settings.mute.mute-without-restore.when-user-logs-out": "... the user logs out", "settings.mute.mute-without-restore.when-rdp-session-starts": "... WinMute is started within a RDP session", "settings.quiet-hours.intro": "During Quiet Hours WinMute automatically mutes the computers audio devices and unmutes them afterwards.", "settings.quiet-hours.enable": "Enable Quiet Hours", "settings.quiet-hours.start-time-label": "Start time:", "settings.quiet-hours.end-time-label": "End time:", "settings.quiet-hours.force-unmute": "Force unmute", "settings.quiet-hours.force-unmute-description": "If force unmute is enabled, WinMute will unmute the computers audio devices when quiet hours end and not take into account if they were already muted before quiet hours started.", "settings.quiet-hours.show-notifications": "Show Quiet Hours notifications", "settings.quiet-hours.error.invalid-time-range.title": "Invalid time range", "settings.quiet-hours.error.invalid-time-range.text": "Start and stop must not be the same time.", "settings.quiet-hours.error.error-while-saving.title": "Failed to save quiet hours settings", "settings.quiet-hours.error.error-while-saving.text": "Something went wrong while saving the settings", "settings.wifi.intro": "\"WLAN Mute\" mutes the computer based on the name of the connected wireless network.", "settings.wifi.enable": "Enable WLAN based muting", "settings.wifi.mute-when-in-list": "Mute if connected WLAN is in list", "settings.wifi.mute-when-not-in-list": "Mute if connected WLAN is not in list", "settings.wifi.wifi-disabled-info": "Note: WLAN is not available on this device.\nSome options have been disabled.", "settings.wifi.add-edit.add-title": "Add WiFi network", "settings.wifi.add-edit.edit-title": "Edit WiFi network", "settings.wifi.add-edit.ssid-name-label": "SSID/WiFi Name:", "settings.wifi.add-edit.enter-device-name-placeholder": "Please enter a SSID/WiFi name", "settings.mute.manage-endpoints.title": "Manage audio devices", "settings.mute.manage-endpoints.list-behaviour.title": "General", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "Mute only listed devices", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "Mute all but listed devices", "settings.mute.manage-endpoints.endpoints.title": "Devices", "settings.mute.manage-endpoints.add-edit.add-title": "Add Device", "settings.mute.manage-endpoints.add-edit.edit-title": "Edit Device", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "Please enter a device name", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Device name:", "about.title": "About WinMute", "about.general.author-site-label": "Author: www.lx-s.de", "about.general.project-site-label": "Project Site && Code", "about.general.support-label": "Support", "about.general.description": "WinMute is developed by Alexander Steinhoefer his spare time. The code as well as new releases for this tool can be found on GitHub. Contributions in the form of code, tickets or feature requests are very welcome. Thanks for using this little tool!", "about.tab.winmute": "WinMute", "about.tab.license": "License", "about.btn-close": "OK", "log.title": "WinMute Log-File" } ================================================ FILE: Translations/lang-es.json ================================================ { "meta.lang.name": "Español (Spanish)", "meta.lang.mode": "ltr", "init.error.settings.title": "No se pudo inicializar la configuración", "init.error.settings.text": "Error crítico al inicializar WinMute", "init.error.already-running.title": "WinMute ya se está ejecutando", "init.error.already-running.text": "Por favor busque el ícono de la aplicación WinMute en el área de notificación de la barra de tareas de Windows.", "init.error.winmute.title": "No se pudo iniciar WinMute.", "init.error.winmute.text": "WinMute encontró un error crítico durante la inicialización y debe cerrarse.", "init.error.winmute.platform-support.title": "Solo se soporta Windows Vista y versiones más recientes", "init.error.winmute.platform-support.text": "Si requiere soporte para Windows XP, por favor descargue WinMute 1.4.2 o inferior.", "general.error.winapi.text": "{} falló con error {}: {}", "general.error.audio-service-shutdown.title": "El servicio de audio ha sido terminado.", "general.error.audio-service-shutdown.text": "WinMute no puede recuperarse de esta condición.\nPor favor intente reiniciar el programa.", "popup.remote-session-detected.title": "Sesión remota detectada", "popup.remote-session-detected.text": "Se han silenciado todos los dispositivos de audio", "popup.bluetooth-muting-disabled.title": "Silenciamiento de Bluetooth deshabilitado", "popup.bluetooth-muting-disabled.text": "Bluetooth no está disponible o está deshabilitado.\nEl silenciamiento de Bluetooth será deshabilitado en esta computadora.", "popup.wlan-muting-disabled.title": "Silenciamiento de WiFi desactivado", "popup.wlan-muting-disabled.text": "WiFi no está disponible o está deactivado.\nEl silenciamiento de WiFi será deshabilitado en esta computadora.", "popup.quiet-hours-started.title": "Horas de silencio activadas", "popup.quiet-hours-started.text": "El audio de la computadora será silenciado ahora.", "popup.quiet-hours-ended.title": "Horas de silencio terminadas", "popup.quiet-hours-ended.text": "El audio de la computadora ha sido restaurado.", "popup.workstation-muted.title": "Audio silenciado", "popup.wlan-not-on-mute-list.text": "La red de WiFi \"{}\" no esta en la lista de redes permitidas.", "popup.wlan-is-on-mute-list.text": "La red WiFi \"{}\" está configurada para AutoMute.", "popup.muting-workstation-after-delay.title": "Silenciando la computadora después de demora", "popup.muting-workstation-after-delay.text": "Todos los dispositivos han sido silenciados", "popup.volume-restored.title": "Volumen restaurado", "popup.volume-restored.text": "Todos los dispositivos han sido restaurados a su configuración anterior", "popup.muting-workstation.title": "Silenciando computadora", "popup.muting-workstation.text": "Todos los dispositivos han sido silenciados", "popup.error.quiet-hours-start.title": "Empezar Horas de Silencio", "popup.error.quiet-hours-start.text": "Fallo al registrar el inicio de las horas de silencio con el sistema de temporizador de Windows", "popup.error.quiet-hours-stop.title": "Fin de las horas de silencio", "popup.error.quiet-hours-stop.text": "Fallo al registrar el final de las horas de silencio con el sistema de temporizador de Windows", "traymenu.info": "Acerca de", "traymenu.mute-when": "Silenciar cuando...", "traymenu.mute-on-lock": "... la computadora está bloqueada", "traymenu.mute-on-screen-suspend": "... la pantalla se apaga", "traymenu.restore-volume": "Restaurar el volumen después", "traymenu.mute-no-restore": "Silencio activado (no se restablece el volumen)...", "traymenu.mute-on-shutdown": "... apagado", "traymenu.mute-on-sleep": "... suspender", "traymenu.mute-on-logout": "... cerrar sesión", "traymenu.mute-all-devices": "Silenciar todos los dispositivos ahora", "traymenu.settings": "Configuración...", "traymenu.exit": "Salir", "settings.title": "Configuración", "settings.btn-save": "Guardar", "settings.btn-cancel": "Cancelar", "settings.btn-add": "Añadir", "settings.btn-edit": "Editar", "settings.btn-remove": "Quitar", "settings.btn-remove-all": "Quitar todo", "settings.tab.general": "General", "settings.tab.mute": "Silencio", "settings.tab.quiet-hours": "Horas de silencio", "settings.tab.bluetooth": "Bluetooth", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "Añade un dispositivo Bluetooth", "settings.bluetooth.add-edit.edit-title": "Editar dispositivo Bluetooth", "settings.bluetooth.add-edit.device-name-label": "Nombre del dispositivo Bluetooth:", "settings.general.run-on-startup": "Ejecutar WinMute cuando este usuario se conecte", "settings.general.enable-logging": "Guardar registro en archivo", "settings.general.btn-open-log-file": "Abrir el archivo de registro...", "settings.general.select-language-label": "Idioma", "settings.bluetooth.add-edit.enter-device-name-placeholder": "Por favor, introduzca un nombre para el dispositivo Bluetooth", "settings.bluetooth.description": "\"Silenciar Bluetooth\" permite desactivar el audio si se desconecta un dispositivo bluetooth de clase audio, y volver a activarlo si se vuelve a conectar al ordenador.\n\nEste comportamiento se puede activar para todos los dispositivos de audio bluetooth o sólo para un conjunto específico.", "settings.bluetooth.enable-muting": "Activar el silenciamiento basado en Bluetooth", "settings.bluetooth.enable-muting-filter": "Activar sólo para estos dispositivos:", "settings.bluetooth-disabled-info": "", "settings.mute.general-title": "General", "settings.mute.show-mute-event-notifications": "Mostrar notificaciones de eventos silenciados", "settings.mute.manage-endpoints-individually": "Gestiona individualmente los dispositivos de audio", "settings.mute.btn-manage-endpoints": "Gestiona los dispositivos...", "settings.mute.mute-with-restore.title": "Silencio con restauración del volumen, cuando...", "settings.mute.mute-with-restore.when-workstation-is-locked": "... el ordenador está bloqueado", "settings.mute.mute-with-restore.when-screen-turns-off": "... la pantalla se apaga", "settings.mute.mute-with-restore.restore-volume": "Restaurar el volumen después", "settings.mute.mute-with-restore.restore-volume-delay-label": "segundos de retardo antes de silenciar.", "settings.mute.mute-without-restore.title": "Silenciar sin restaurar el volumen, cuando...", "settings.mute.mute-without-restore.when-computer-shuts-down": "... el ordenador se apaga", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... el ordenador entra en reposo/hibernación", "settings.mute.mute-without-restore.when-user-logs-out": "... el usuario se desconecta", "settings.mute.mute-without-restore.when-rdp-session-starts": "... WinMute se inicia dentro de una sesión RDP", "settings.quiet-hours.intro": "Durante las horas de silencio, WinMute silencia automáticamente los dispositivos de audio del ordenador y los vuelve a silenciar después.", "settings.quiet-hours.enable": "Activar las horas de silencio", "settings.quiet-hours.start-time-label": "Hora de inicio:", "settings.quiet-hours.end-time-label": "Hora de finalización:", "settings.quiet-hours.force-unmute": "Forzar el silencio", "settings.quiet-hours.force-unmute-description": "Si la opción de forzar el silencio está activada, WinMute anulará el silencio de los dispositivos de audio del ordenador cuando finalicen las horas de silencio y no tendrá en cuenta si ya estaban silenciados antes de que comenzaran las horas de silencio.", "settings.quiet-hours.show-notifications": "Mostrar notificaciones de horas de silencio", "settings.quiet-hours.error.invalid-time-range.title": "Intervalo de tiempo no válido", "settings.quiet-hours.error.invalid-time-range.text": "El inicio y el final deben ser tiempos diferentes.", "settings.quiet-hours.error.error-while-saving.title": "No se ha podido guardar la configuración de las horas de silencio", "settings.quiet-hours.error.error-while-saving.text": "Algo ha ido mal al guardar la configuración", "settings.wifi.intro": "\"WLAN Mute\" silencia la computadora según el nombre de la red inalámbrica conectada.", "settings.wifi.enable": "Habilitar el silenciamiento basado en WLAN", "settings.wifi.mute-when-in-list": "Silenciar si la WLAN conectada está en la lista", "settings.wifi.mute-when-not-in-list": "Silenciar si la WLAN conectada no está en la lista", "settings.wifi.wifi-disabled-info": "Nota: WLAN no está disponible en este dispositivo.\nAlgunas opciones han sido deshabilitadas.", "settings.wifi.add-edit.add-title": "Añadir red WiFi", "settings.wifi.add-edit.edit-title": "Editar red WiFi", "settings.wifi.add-edit.ssid-name-label": "Nombre SSID/WiFi:", "settings.wifi.add-edit.enter-device-name-placeholder": "Por favor proporcione un nombre de SSID/WiFi", "settings.mute.manage-endpoints.title": "Administrar dispositivos de audio", "settings.mute.manage-endpoints.list-behaviour.title": "General", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "Silenciar solo los dispositivos listados", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "Silenciar todo excepto los dispositivos listados", "settings.mute.manage-endpoints.endpoints.title": "Dispositivos", "settings.mute.manage-endpoints.add-edit.add-title": "Añadir dispositivo", "settings.mute.manage-endpoints.add-edit.edit-title": "Editar dispositivo", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "Por favor proporcione un nombre de dispositivo", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Nombre de dispositivo:", "about.title": "Acerca de WinMute", "about.general.author-site-label": "Autor: www.lx-s.de", "about.general.project-site-label": "Sitio del proyecto && Código", "about.general.support-label": "Soporte", "about.general.description": "WinMute es desarrollado por Alexander Steinhoefer en su tiempo libre. El código, así como los nuevos lanzamientos de esta herramienta, pueden encontrarse en Github. Las contribuciones en forma de código, tickets o solicitudes de características son muy bienvenidas. Gracias por usar esta pequeña herramienta!", "about.tab.winmute": "WinMute", "about.tab.license": "Licencia", "about.btn-close": "OK", "popup.update-available.text": "La versión instalada es {}.\nHaga clic en este mensaje para abrir la página de descarga.", "popup.update-available-beta.title": "¡WinMute Beta {} ya está disponible!", "settings.general.check-for-updates-on-start": "Buscar nuevas actualizaciones al iniciar", "popup.update-available-beta.text": "Tu versión actual es {}.\nHaga clic en este mensaje para abrir la página de descarga de la versión beta.", "settings.bluetooth.bluetooth-disabled-info": "Nota: el bluetooth no está disponible en este dispositivo.\nAlgunas opciones se han desactivado.", "popup.error.update-check-failed.title": "Error en la comprobación de la actualización.", "settings.general.updates-handled-externally": "Opciones desactivadas: Las actualizaciones se gestionan externamente", "popup.update-available.title": "¡WinMute {} está disponible!", "pupup.error.update-check-failed.text": "No se ha podido comprobar si hay una nueva versión.\nPor favor compruebe/habilite el registro para obtener más detalles.", "settings.general.check-for-beta-updates-on-start": "Compruebe también si hay nuevas versiones beta", "settings.general.help-translating": "Ayuda a la traducción", "log.title": "WinMute Archivo de registro", "settings.general.btn-open-log-window": "Mostrar registro..." } ================================================ FILE: Translations/lang-fr.json ================================================ { "meta.lang.name": "French (Français)", "meta.lang.mode": "ltr", "init.error.settings.title": "Échec de l'initialisation des paramètres", "init.error.settings.text": "Erreur critique lors de l'initialisation de WinMute", "init.error.already-running.title": "WinMute est déjà en cours d'exécution", "init.error.already-running.text": "Veuillez rechercher une icône d’application winmutes dans la zone de notification de la barre des tâches Windows.", "init.error.winmute.title": "Échec du démarrage de WinMute.", "init.error.winmute.text": "WinMute a rencontré une erreur critique lors de l'initialisation et doit s'arrêter.", "init.error.winmute.platform-support.title": "Seuls Windows Vista et les versions plus récentes sont pris en charge", "init.error.winmute.platform-support.text": "Si la prise en charge de Windows XP est nécessaire, veuillez télécharger WinMute version 1.4.2 ou inférieure.", "general.error.winapi.text": "{} a échoué avec l'erreur {} : {}", "general.error.audio-service-shutdown.title": "Le service audio a été fermé.", "general.error.audio-service-shutdown.text": "WinMute n'est pas en mesure de se remettre de cette situation.\nVeuillez essayer de redémarrer le programme.", "popup.update-available.title": "WinMute {} est disponible !", "popup.update-available.text": "La version installée est {}.\nCliquez sur ce message pour ouvrir la page de téléchargement.", "popup.update-available-beta.title": "WinMute Beta {} est disponible !", "popup.update-available-beta.text": "Votre version actuelle est {}.\nCliquez sur ce message pour ouvrir la page de téléchargement de la version bêta.", "popup.error.update-check-failed.title": "La mise à jour a échoué.", "pupup.error.update-check-failed.text": "Impossible de vérifier la présence d'une nouvelle version.\nVeuillez vérifier/activer la journalisation pour plus de détails.", "popup.remote-session-detected.title": "Session à distance détectée", "popup.remote-session-detected.text": "Tous les applications audio ont été coupés", "popup.bluetooth-muting-disabled.title": "Coupure Bluetooth désactivée", "popup.bluetooth-muting-disabled.text": "Le Bluetooth n'est pas disponible ou est désactivé.\nLa désactivation du Bluetooth sera désactivée sur cet ordinateur.", "popup.wlan-muting-disabled.title": "Désactivation du mode muet WLAN", "popup.wlan-muting-disabled.text": "Le WLAN n'est pas disponible ou est désactivé.\nLa désactivation du WLAN sera désactivée sur cet ordinateur.", "popup.quiet-hours-started.title": "Les coupure de sons ont commencé", "popup.quiet-hours-started.text": "Le son de l'ordinateur sera désormais coupé.", "popup.quiet-hours-ended.title": "Fin des coupures de sons", "popup.quiet-hours-ended.text": "le sons de l'ordinateur a été restauré.", "popup.workstation-muted.title": "Audio muter", "popup.wlan-not-on-mute-list.text": "Le réseau WLAN «{}» n'est pas sur la liste autorisée.", "popup.wlan-is-on-mute-list.text": "Le réseau WLAN «{}» est configuré pour AutoMute.", "popup.muting-workstation-after-delay.title": "Coupure du sons de l'ordinateur après un délai", "popup.muting-workstation-after-delay.text": "Tous les applications ont été mis en sourdine", "popup.volume-restored.title": "Sons restauré", "popup.volume-restored.text": "Tous les applications ont été restaurés à leur configuration précédente", "popup.muting-workstation.title": "Couper le sons du pc", "popup.muting-workstation.text": "Tous les applications ont été mis en sourdine", "popup.error.quiet-hours-start.title": "Début des heures de coupure", "popup.error.quiet-hours-start.text": "Impossible d'enregistrer les heures de coupure avec le système de minuterie Windows", "popup.error.quiet-hours-stop.title": "Impossible d'enregistrer les heures de coupure avec le système de minuterie Windows", "popup.error.quiet-hours-stop.text": "Impossible d'enregistrer la fin des heures de coupure avec le système de minuterie Windows", "traymenu.info": "À propos", "traymenu.mute-when": "Muet quand...", "traymenu.mute-on-lock": "... l'ordinateur est verrouillé", "traymenu.mute-on-screen-suspend": "... l'écran s'éteint", "traymenu.restore-volume": "Restaurer le sons après", "traymenu.mute-no-restore": "Sons activé (pas de restauration du volume)...", "traymenu.mute-on-shutdown": "... fermer", "traymenu.mute-on-sleep": "... dormir", "traymenu.mute-on-logout": "... déconnexion", "traymenu.mute-all-devices": "Couper le son de tous les applications maintenant", "traymenu.settings": "Paramètres...", "traymenu.exit": "Sortie", "settings.title": "Paramètres", "settings.btn-save": "Sauvegarder", "settings.btn-cancel": "Annuler", "settings.btn-add": "Ajouter", "settings.btn-edit": "Modifier", "settings.btn-remove": "Retirer", "settings.btn-remove-all": "Supprimer tout", "settings.tab.general": "Menu Général", "settings.tab.mute": "Muet", "settings.tab.quiet-hours": "Réglages pendant la coupure", "settings.tab.bluetooth": "Bluetooth", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "Ajouter un appareil Bluetooth", "settings.bluetooth.add-edit.edit-title": "Modifier l'appareil Bluetooth", "settings.bluetooth.add-edit.device-name-label": "Nom de l'appareil Bluetooth :", "settings.general.run-on-startup": "Exécutez WinMute lorsque l'ordinateur se connecte", "settings.general.check-for-updates-on-start": "Rechercher de nouvelles mises à jour au démarrage", "settings.general.check-for-beta-updates-on-start": "Vérifiez également les nouvelles versions bêta", "settings.general.updates-handled-externally": "Options désactivées : les mises à jour sont gérées en externe", "settings.general.enable-logging": "Enregistrer le journal dans un fichier", "settings.general.btn-open-log-file": "Ouvrir le fichier journal...", "settings.general.select-language-label": "Langue", "settings.general.help-translating": "Aide à la traduction", "settings.bluetooth.add-edit.enter-device-name-placeholder": "Veuillez saisir un appareil Bluetooth", "settings.bluetooth.description": "« Bluetooth Muting » permet de désactiver l'audio si un périphérique Bluetooth de classe audio est déconnecté, et de le réactiver si un périphérique est reconnecté à l'ordinateur.\n\nPeut être actif pour tous les périphériques audio Bluetooth ou uniquement pour un appareil spécifique.", "settings.bluetooth.enable-muting": "Activer la coupure de sons via Bluetooth", "settings.bluetooth.enable-muting-filter": "Activer uniquement pour ces appareils :", "settings.bluetooth.bluetooth-disabled-info": "Remarque : le Bluetooth n'est pas disponible sur cet appareil.\nCertaines options ont été désactivées.", "settings.mute.general-title": "Général", "settings.mute.show-mute-event-notifications": "Afficher les notifications d'événements en sourdine", "settings.mute.manage-endpoints-individually": "Gérer les périphériques audio individuellement", "settings.mute.btn-manage-endpoints": "Gérer les appareils...", "settings.mute.mute-with-restore.title": "Couper le son avec restauration du volume, lorsque...", "settings.mute.mute-with-restore.when-workstation-is-locked": "... l'ordinateur est verrouillé", "settings.mute.mute-with-restore.when-screen-turns-off": "... l'écran s'éteint", "settings.mute.mute-with-restore.restore-volume": "Restaurer le volume par la suite", "settings.mute.mute-with-restore.restore-volume-delay-label": "secondes de délai avant la coupure de sons.", "settings.mute.mute-without-restore.title": "Couper le son sans restaurer le sons, lorsque...", "settings.mute.mute-without-restore.when-computer-shuts-down": "... l'ordinateur s'éteint", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... l'ordinateur passe en veille/hibernation", "settings.mute.mute-without-restore.when-user-logs-out": "... l'utilisateur se déconnecte", "settings.mute.mute-without-restore.when-rdp-session-starts": "... WinMute est démarré dans une session RDP", "settings.quiet-hours.intro": "Pendant les heures calmes, WinMute coupe automatiquement le son des périphériques audio de l'ordinateur et les réactive ensuite.", "settings.quiet-hours.enable": "Activer les heures de silence", "settings.quiet-hours.start-time-label": "Heure de début :", "settings.quiet-hours.end-time-label": "Heure de fin :", "settings.quiet-hours.force-unmute": "Forcer la désactivation du son", "settings.quiet-hours.force-unmute-description": "Si la fonction de désactivation forcée du son est activée, WinMute désactivera le son des périphériques audio des ordinateurs à la fin des heures de coupure et ne tiendra pas compte s'ils étaient déjà désactivés avant le début des heures de coupure.", "settings.quiet-hours.show-notifications": "Afficher les notifications d'heures de coupure", "settings.quiet-hours.error.invalid-time-range.title": "Plage horaire non valide", "settings.quiet-hours.error.invalid-time-range.text": "Le démarrage et l'arrêt ne doivent pas être simultanés.", "settings.quiet-hours.error.error-while-saving.title": "Impossible d'enregistrer les paramètres des heures de coupure", "settings.quiet-hours.error.error-while-saving.text": "Une erreur s'est produite lors de l'enregistrement des paramètres", "settings.wifi.intro": "«WLAN Mute» coupe le son de l'ordinateur en fonction du nom du réseau sans fil connecté.", "settings.wifi.enable": "Activer la mise en sourdine basée sur le WLAN", "settings.wifi.mute-when-in-list": "Couper le son si le réseau Wi-Fi connecté est dans la liste", "settings.wifi.mute-when-not-in-list": "Désactiver si le réseau Wi-Fi connecté n'est pas dans la liste", "settings.wifi.wifi-disabled-info": "Remarque : le Wi-Fi n'est pas disponible sur cet appareil.\nCertaines options ont été désactivées.", "settings.wifi.add-edit.add-title": "Ajouter un réseau WiFi", "settings.wifi.add-edit.edit-title": "Modifier le réseau WiFi", "settings.wifi.add-edit.ssid-name-label": "SSID/Nom Wi-Fi :", "settings.wifi.add-edit.enter-device-name-placeholder": "Veuillez saisir un nom SSID/WiFi", "settings.mute.manage-endpoints.title": "Gérer les périphériques audio", "settings.mute.manage-endpoints.list-behaviour.title": "Général", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "Couper le son uniquement des appareils répertoriés", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "Couper le son de tous les appareils sauf ceux répertoriés", "settings.mute.manage-endpoints.endpoints.title": "Appareils", "settings.mute.manage-endpoints.add-edit.add-title": "Ajouter un appareil", "settings.mute.manage-endpoints.add-edit.edit-title": "Modifier l'appareil", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "Veuillez saisir un nom d'appareil", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Nom de l'appareil :", "about.title": "À propos de WinMute", "about.general.author-site-label": "Auteur : www.lx-s.de", "about.general.project-site-label": "Site et code du projet", "about.general.support-label": "Aide", "about.general.description": "WinMute est développé par Alexander Steinhoefer pendant son temps libre. Le code ainsi que les nouvelles versions de cet outil sont disponibles sur GitHub. Les contributions sous forme de code, de tickets ou de demandes de fonctionnalités sont les bienvenues. Merci d'utiliser ce petit outil !", "about.tab.winmute": "WinMute", "about.tab.license": "Licence", "about.btn-close": "OK" } ================================================ FILE: Translations/lang-it.json ================================================ { "meta.lang.name": "Italiano (Italian)", "meta.lang.mode": "ltr", "init.error.settings.title": "Impossibile inizializzare le impostazioni", "init.error.settings.text": "Errore critico durante l'inizializzazione di WinMute", "init.error.already-running.title": "WinMute è già in esecuzione", "init.error.already-running.text": "Cerca l'icona dell'applicazione WinMutes nell'area di notifica della barra delle applicazioni di Windows.", "init.error.winmute.title": "Impossibile avviare WinMute.", "init.error.winmute.text": "WinMute durante l'inizializzazione ha riscontrato un errore critico ed è necessario chiudere l'applicazione.", "init.error.winmute.platform-support.title": "È supportato solo Windows Vista e versioni successive", "init.error.winmute.platform-support.text": "Se hai bisogno del supporto per Windows XP, scarica WinMute versione 1.4.2 o precedente.", "general.error.winapi.text": "{} non riuscito con errore {}: {}", "general.error.audio-service-shutdown.title": "Il servizio audio è stato chiuso.", "general.error.audio-service-shutdown.text": "WinMute non è in grado di recuperare da tale condizione.\nProva a riavviare il programma.", "popup.remote-session-detected.title": "Rilevata sessione remota", "popup.remote-session-detected.text": "Tutti i dispositivi audio sono stati disattivati", "popup.bluetooth-muting-disabled.title": "Disabilitazione audio Bluetooth disattivata", "popup.bluetooth-muting-disabled.text": "Il Bluetooth non è disponibile o è disabilitato.\nIn questo computer la disabilitazione dell'audio Bluetooth verrà disattivata.", "popup.wlan-muting-disabled.title": "Disabilitazione audio WLAN disattivata", "popup.wlan-muting-disabled.text": "La WLAN non è disponibile o è disabilitata. \nIn questo computer la disabilitazione dell'audio WLAN verrà disattivata.", "popup.quiet-hours-started.title": "Cominciano le ore tranquille", "popup.quiet-hours-started.text": "L'audio del computer verrà ora disattivato.", "popup.quiet-hours-ended.title": "Ore tranquille terminate", "popup.quiet-hours-ended.text": "L'audio del computer è stato riattivato.", "popup.workstation-muted.title": "Audio computer OFF", "popup.wlan-not-on-mute-list.text": "La rete WLAN \"{}\" non è nell'elenco consentito.", "popup.wlan-is-on-mute-list.text": "La rete WLAN \"{}\" è configurata per la disabilitazione audio automatica.", "popup.muting-workstation-after-delay.title": "Ritardo disattivazione audio computer", "popup.muting-workstation-after-delay.text": "Tutti i dispositivi audio sono stati disattivati", "popup.volume-restored.title": "Volume ripristinato", "popup.volume-restored.text": "Tutti i dispositivi audio sono stati ripristinati alla loro configurazione precedente", "popup.muting-workstation.title": "Audio OFF computer", "popup.muting-workstation.text": "Tutti i dispositivi audio sono stati disattivati", "popup.error.quiet-hours-start.title": "Avvio ore tranquille", "popup.error.quiet-hours-start.text": "Impossibile registrare l'inizio delle ore di silenzio con il timer di sistema di Windows", "popup.error.quiet-hours-stop.title": "Fine ore silenzio", "popup.error.quiet-hours-stop.text": "Impossibile registrare la fine delle ore di silenzio con il timer di sistema di Windows", "traymenu.info": "Info programma", "traymenu.mute-when": "Audio OFF quando...", "traymenu.mute-on-lock": "... il computer viene bloccato", "traymenu.mute-on-screen-suspend": "... lo schermo verrà spento", "traymenu.restore-volume": "Ripristina il volume in seguito", "traymenu.mute-no-restore": "Disattiva audio (nessun ripristino volume) quando...", "traymenu.mute-on-shutdown": "... il computer viene spento", "traymenu.mute-on-sleep": "... il computer va in sospensione", "traymenu.mute-on-logout": "... l'utente si scollega", "traymenu.mute-all-devices": "Disattiva audio per tutti i dispositivi", "traymenu.settings": "Impostazioni...", "traymenu.exit": "Esci", "settings.title": "Impostazioni", "settings.btn-save": "Salva", "settings.btn-cancel": "Annulla", "settings.btn-add": "Aggiungi", "settings.btn-edit": "Modifica", "settings.btn-remove": "Rimuovi", "settings.btn-remove-all": "Rimuovi tutto", "settings.tab.general": "Generale", "settings.tab.mute": "Disattiva audio", "settings.tab.quiet-hours": "Ore silenzio", "settings.tab.bluetooth": "Bluetooth", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "Aggiungi dispositivo Bluetooth", "settings.bluetooth.add-edit.edit-title": "Modifica dispositivo Bluetooth", "settings.bluetooth.add-edit.device-name-label": "Nome dispositivo Bluetooth:", "settings.general.run-on-startup": "Esegui WinMute all'accesso dell'utente", "settings.general.enable-logging": "Salva il registro in un file", "settings.general.btn-open-log-file": "Apri file registro eventi...", "settings.general.select-language-label": "Lingua", "settings.bluetooth.add-edit.enter-device-name-placeholder": "Inserisci il nome di un dispositivo Bluetooth", "settings.bluetooth.description": "\"Audio OFF Bluetooth\" consente di disattivare l'audio se un dispositivo Bluetooth di classe audio viene disconnesso e di riattivare l'audio se un dispositivo Bluetooth viene ricollegato al computer.\n\nPuoi abilitare questo comportamento per tutti i dispositivi audio Bluetooth o solo per un set specifico di dispositivi.", "settings.bluetooth.enable-muting": "Abilita disabilitazione audio basata su hardware Bluetooth", "settings.bluetooth.enable-muting-filter": "Abilita solo per questi dispositivi:", "settings.bluetooth.bluetooth-disabled-info": "Nota: il Bluetooth non è disponibile nel dispositivo, quindi alcune opzioni sono state disabilitate.", "settings.mute.general-title": "Generale", "settings.mute.show-mute-event-notifications": "Visualizza notifiche eventi disattivazione", "settings.mute.manage-endpoints-individually": "Gestisci i dispositivi audio individualmente", "settings.mute.btn-manage-endpoints": "Gestisci dispositivi audio...", "settings.mute.mute-with-restore.title": "Disattiva audio con ripristino del volume, quando...", "settings.mute.mute-with-restore.when-workstation-is-locked": "... il computer viene bloccato", "settings.mute.mute-with-restore.when-screen-turns-off": "... lo schermo viene spento", "settings.mute.mute-with-restore.restore-volume": "Ripristina il volume in seguito", "settings.mute.mute-with-restore.restore-volume-delay-label": "secondi di ritardo prima della disattivazione dell'audio.", "settings.mute.mute-without-restore.title": "Disattiva l'audio senza ripristinare il volume, quando...", "settings.mute.mute-without-restore.when-computer-shuts-down": "... il computer viene spento", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... il computer entra in modalità sospensione/ibernazione", "settings.mute.mute-without-restore.when-user-logs-out": "... l'utente si scollega", "settings.mute.mute-without-restore.when-rdp-session-starts": "... WinMute è avviato all'interno di una sessione RDP", "settings.quiet-hours.intro": "Durante le ore di silenzio WinMute disattiva automaticamente i dispositivi audio del computer e li riattiverà successivamente.", "settings.quiet-hours.enable": "Abilita ore di silenzio", "settings.quiet-hours.start-time-label": "Orario inizio:", "settings.quiet-hours.end-time-label": "Orario fine:", "settings.quiet-hours.force-unmute": "Forza audio ON", "settings.quiet-hours.force-unmute-description": "Se è attivato 'Forza audio ON', WinMute riattiverà i dispositivi audio durante le ore di silenzio e non prenderà in considerazione se erano già disattivati prima dell'inizio delle ore di silenzio.", "settings.quiet-hours.show-notifications": "Visualizza notifiche ore di silenzio", "settings.quiet-hours.error.invalid-time-range.title": "Intervallo temporale non valido", "settings.quiet-hours.error.invalid-time-range.text": "Non è possibile avviare e arrestare allo stesso orario.\nCorreggi l'intervallo di tempo.", "settings.quiet-hours.error.error-while-saving.title": "Impossibile salvare le impostazioni delle ore di silenzio", "settings.quiet-hours.error.error-while-saving.text": "Si è verificato un errore durante il salvataggio delle impostazioni", "settings.wifi.intro": "'Audio OFF in base a nome rete WLAN' consente di disattivare l'audio del computer in base al nome della rete wireless connessa.", "settings.wifi.enable": "Abilita disabilitazione audio basata su nome rete WLAN", "settings.wifi.mute-when-not-in-list": "Disattiva audio se la rete WLAN NON è in elenco", "settings.wifi.wifi-disabled-info": "Nota: la WLAN non è disponibile nel dispositivo, quindi alcune opzioni sono state disabilitate.", "settings.wifi.add-edit.add-title": "Aggiungi rete WiFi", "settings.wifi.add-edit.edit-title": "Modifica rete WiFi", "settings.wifi.add-edit.ssid-name-label": "Nome SSID/WiFi:", "settings.wifi.add-edit.enter-device-name-placeholder": "Inserisci un nome SSID/WiFi", "settings.mute.manage-endpoints.title": "Gestisci dispositivi audio", "settings.mute.manage-endpoints.list-behaviour.title": "Generale", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "Disattiva solo i dispositivi audio elencati", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "Disattiva tutti i dispositivi audio tranne quelli elencati", "settings.mute.manage-endpoints.endpoints.title": "Dispositivi audio", "settings.mute.manage-endpoints.add-edit.add-title": "Aggiungi dispositivi audio", "settings.mute.manage-endpoints.add-edit.edit-title": "Modifica dispositivi audio", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "Inserisci un nome per il dispositivo audio", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Nome dispositivo audio:", "about.title": "Info su WinMute", "about.general.author-site-label": "Autore: www.lx-s.de", "about.general.project-site-label": "Sito e codice del progetto", "about.general.support-label": "Supporto", "about.general.description": "WinMute è sviluppato da Alexander Steinhoefer nel suo tempo libero.\nIl codice e le nuove versioni di questo strumento sono disponibili su GitHub.\nI contributi sotto forma di codice, ticket o richieste di funzionalità sono molto graditi.\nGrazie per l'uso di questo piccolo strumento!", "about.tab.winmute": "WinMute", "about.tab.license": "Licenza", "about.btn-close": "OK", "settings.wifi.mute-when-in-list": "Disattiva audio se la rete WLAN è in elenco", "popup.update-available.text": "La versione installata è {}.\nFai clic su questo messaggio per aprire la pagina di download.", "popup.update-available-beta.title": "È disponibile WinMute Beta {}!", "settings.general.check-for-updates-on-start": "All'avvio verifica la presenza di nuovi aggiornamenti", "popup.update-available-beta.text": "La versione attuale è {}.\nFai clic su questo messaggio per aprire la pagina di download della versione beta.", "popup.error.update-check-failed.title": "Controllo aggiornamenti non riuscito.", "popup.update-available.title": "È disponibile WinMute {}!", "pupup.error.update-check-failed.text": "Impossibile verificare la disponibilità di una nuova versione.\nPer ulteriori dettagli controlla/abilita la registrazione eventi.", "settings.general.check-for-beta-updates-on-start": "Controlla anche disponibilità nuove versioni beta", "settings.general.help-translating": "Aiuta nella traduzione", "settings.general.updates-handled-externally": "Opzioni disabilitate: aggiornamenti gestiti esternamente", "log.title": "WinMute Registro Eventi" } ================================================ FILE: Translations/lang-ko.json ================================================ { "meta.lang.name": "한글 (Korean)", "meta.lang.mode": "ltr", "init.error.settings.title": "설정을 초기화하지 못했습니다", "init.error.settings.text": "WinMute 초기화 중 심각한 오류가 발생했습니다", "init.error.already-running.title": "WinMute가 이미 실행중입니다", "init.error.already-running.text": "Windows 작업 표시줄 알림 영역에서 WinMute 애플리케이션 아이콘을 확인해주세요.", "init.error.winmute.title": "WinMute를 시작하지 못했습니다.", "init.error.winmute.text": "WinMute를 초기화하는 동안 심각한 오류가 발생하여 종료해야 합니다.", "init.error.winmute.platform-support.title": "Windows Vista 이상만 지원됩니다", "init.error.winmute.platform-support.text": "Windows XP 지원이 필요한 경우 WinMute 버전 1.4.2 이하를 다운로드하세요.", "general.error.winapi.text": "{} 실패, 오류 코드 {}: {}", "general.error.audio-service-shutdown.title": "오디오 서비스가 종료되었습니다.", "general.error.audio-service-shutdown.text": "WinMute를 해당 상태에서 복구할 수 없습니다.\n프로그램을 다시 시작해주세요.", "popup.update-available.title": "WinMute {} 버전을 사용할 수 있습니다!", "popup.update-available.text": "설치된 버전은 {}입니다.\n이 메시지를 클릭하여 다운로드 페이지를 엽니다.", "popup.update-available-beta.title": "WinMute Beta {} 버전을 사용할 수 있습니다!", "popup.update-available-beta.text": "현재 버전은 {}입니다.\n이 메시지를 클릭하여 베타 다운로드 페이지를 엽니다.", "popup.error.update-check-failed.title": "업데이트 확인을 실패했습니다.", "pupup.error.update-check-failed.text": "새버전을 확인할 수 없습니다.\n자세한 내용은 로그 확인/로그 활성화를 해주세요.", "popup.remote-session-detected.title": "원격 세션이 감지되었습니다", "popup.remote-session-detected.text": "모든 오디오 장치가 음소거되었습니다", "popup.bluetooth-muting-disabled.title": "블루투스 음소거가 비활성화되었습니다", "popup.bluetooth-muting-disabled.text": "블루투스를 사용할 수 없거나 비활성화되어 있습니다.\n이 컴퓨터에서 블루투스 음소거 기능이 비활성화됩니다.", "popup.wlan-muting-disabled.title": "WLAN 음소거 해제됨", "popup.wlan-muting-disabled.text": "WLAN을 사용할 수 없거나 비활성화되어 있습니다.\n이 컴퓨터에서 WLAN 음소거가 비활성화됩니다.", "popup.quiet-hours-started.title": "무음 시간 시작됨", "popup.quiet-hours-started.text": "이제 컴퓨터 오디오가 음소거됩니다.", "popup.quiet-hours-ended.title": "무음 시간 종료됨", "popup.quiet-hours-ended.text": "컴퓨터 오디오가 복원되었습니다.", "popup.workstation-muted.title": "오디오 음소거되었습니다", "popup.wlan-not-on-mute-list.text": "WLAN 네트워크 \"{}\"이 허용 목록에 없습니다.", "popup.wlan-is-on-mute-list.text": "WLAN 네트워크 \"{}\"는 자동 음소거용으로 구성되어 있습니다.", "popup.muting-workstation-after-delay.title": "지연 시간 후 컴퓨터 음소거", "popup.muting-workstation-after-delay.text": "모든 장치가 음소거되었습니다", "popup.volume-restored.title": "볼륨을 원래대로 복원합니다", "popup.volume-restored.text": "모든 장치가 이전 설정으로 복원되었습니다", "popup.muting-workstation.title": "컴퓨터 음소거", "popup.muting-workstation.text": "모든 장치가 음소거되었습니다", "popup.error.quiet-hours-start.title": "무음 시간 시작", "popup.error.quiet-hours-start.text": "윈도우 타이머 시스템에 무음 시간 시작 등록을 실패했습니다", "popup.error.quiet-hours-stop.title": "무음 시간 중지", "popup.error.quiet-hours-stop.text": "윈도우 타이머 시스템에 무음 시간 중지 등록을 실패했습니다", "traymenu.info": "정보", "traymenu.mute-when": "다음 상황에서 음소거 실행...", "traymenu.mute-on-lock": "... 컴퓨터가 잠김", "traymenu.mute-on-screen-suspend": "... 화면이 꺼짐", "traymenu.restore-volume": "다시 켜질 때 볼륨 복원", "traymenu.mute-no-restore": "음소거 실행 (볼륨 복구 없음)...", "traymenu.mute-on-shutdown": "... 컴퓨터 종료", "traymenu.mute-on-sleep": "... 절전 모드", "traymenu.mute-on-logout": "... 로그아웃", "traymenu.mute-all-devices": "지금 모든 장치 음소거", "traymenu.settings": "설정...", "traymenu.exit": "종료", "settings.title": "설정", "settings.btn-save": "저장", "settings.btn-cancel": "취소", "settings.btn-add": "추가", "settings.btn-edit": "편집", "settings.btn-remove": "삭제", "settings.btn-remove-all": "모두 삭제", "settings.tab.general": "일반", "settings.tab.mute": "음소거", "settings.tab.quiet-hours": "무음 시간", "settings.tab.bluetooth": "블루투스", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "블루투스 장치 추가", "settings.bluetooth.add-edit.edit-title": "블루투스 장치 편집", "settings.bluetooth.add-edit.device-name-label": "블루투스 장치명:", "settings.general.run-on-startup": "이 사용자가 로그인할 때 WinMute 실행", "settings.general.check-for-updates-on-start": "시작 시 신규 업데이트 확인", "settings.general.check-for-beta-updates-on-start": "신규 베타 버전도 확인", "settings.general.updates-handled-externally": "옵션 비활성화: 업데이트는 외부에서 처리됩니다", "settings.general.enable-logging": "로그를 파일에 저장", "settings.general.btn-open-log-file": "로그 파일 열기...", "settings.general.btn-open-log-window": "로그 표시...", "settings.general.select-language-label": "언어", "settings.general.help-translating": "번역에 참여하기", "settings.bluetooth.add-edit.enter-device-name-placeholder": "블루투스 장치명을 입력해주세요", "settings.bluetooth.description": "Bluetooth 음소거 기능은 오디오 클래스 블루투스 장치가 연결 해제될 경우 자동으로 오디오를 음소거하고, 장치가 다시 연결되면 오디오를 재활성화합니다.\n\n이 동작은 모든 블루투스 오디오 장치에 적용할 수도 있고, 특정 장치 집합에만 적용하도록 설정할 수도 있습니다.", "settings.bluetooth.enable-muting": "블루투스 기반 음소거 활성화", "settings.bluetooth.enable-muting-filter": "이 장치들에만 활성화:", "settings.bluetooth.bluetooth-disabled-info": "참고: 이 기기에서는 블루투스를 사용할 수 없습니다.\n일부 옵션이 비활성화되었습니다.", "settings.mute.general-title": "일반", "settings.mute.show-mute-event-notifications": "음소거 이벤트 알림 표시", "settings.mute.manage-endpoints-individually": "오디오 장치를 개별적으로 관리", "settings.mute.btn-manage-endpoints": "장치 관리...", "settings.mute.mute-with-restore.title": "음소거 및 음소거 해제 설정...", "settings.mute.mute-with-restore.when-workstation-is-locked": "... 컴퓨터가 잠길때 음소거", "settings.mute.mute-with-restore.when-screen-turns-off": "... 화면 꺼질 때 음소거", "settings.mute.mute-with-restore.restore-volume": "다시 켜질때 음소거 해제", "settings.mute.mute-with-restore.restore-volume-delay-label": "초 지연 후 음소거를 실행합니다.", "settings.mute.mute-without-restore.title": "기타 음소거 설정...", "settings.mute.mute-without-restore.when-computer-shuts-down": "... 컴퓨터 종료 시 음소거", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... 컴퓨터가 절전 모드/초절전모드에 진입할 때 음소거", "settings.mute.mute-without-restore.when-user-logs-out": "... 유저 로그아웃 시 음소거", "settings.mute.mute-without-restore.when-rdp-session-starts": "... 원격데스크탑(RDP) 세션에서 WinMute가 실행될 때 음소거", "settings.quiet-hours.intro": "무음 시간 동안 WinMute는 컴퓨터 오디오 장치를 자동으로 음소거하고 종료 후 음소거를 해제합니다.", "settings.quiet-hours.enable": "무음 시간 활성화", "settings.quiet-hours.start-time-label": "시작 시간:", "settings.quiet-hours.end-time-label": "종료 시간:", "settings.quiet-hours.force-unmute": "강제 음소거 해제", "settings.quiet-hours.force-unmute-description": "강제 음소거 해제 기능이 활성화되면, 무음 시간이 종료될 때 WinMute가 컴퓨터의 오디오 장치를 자동으로 음소거 해제하며, 무음 시간이 시작되기 전 이미 음소거 상태였는지는 고려하지 않습니다.", "settings.quiet-hours.show-notifications": "무음 시간 알림 표시", "settings.quiet-hours.error.invalid-time-range.title": "잘못된 시간 범위", "settings.quiet-hours.error.invalid-time-range.text": "시작과 중지가 같은 시간이어서는 안 됩니다.", "settings.quiet-hours.error.error-while-saving.title": "무음 시간 설정 저장 실패", "settings.quiet-hours.error.error-while-saving.text": "설정을 저장하는 동안 문제가 발생했습니다", "settings.wifi.intro": "\"WLAN 음소거\"는 연결된 무선 네트워크의 이름에 따라 컴퓨터를 음소거합니다.", "settings.wifi.enable": "WLAN 기반 음소거 활성화", "settings.wifi.mute-when-in-list": "목록에 있는 WLAN에 연결되면 음소거", "settings.wifi.mute-when-not-in-list": "목록에 없는 WLAN에 연결되면 음소거", "settings.wifi.wifi-disabled-info": "참고: 이 장치에서는 WLAN을 사용할 수 없습니다.\n일부 옵션이 비활성화되었습니다.", "settings.wifi.add-edit.add-title": "WiFi 네트워크 추가", "settings.wifi.add-edit.edit-title": "WiFi 네트워크 편집", "settings.wifi.add-edit.ssid-name-label": "SSID/WiFi 이름:", "settings.wifi.add-edit.enter-device-name-placeholder": "SSID/WiFi 이름을 입력해주세요", "settings.mute.manage-endpoints.title": "오디오 장치 관리", "settings.mute.manage-endpoints.list-behaviour.title": "일반", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "목록의 장치만 음소거", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "목록에 있는 장치만 전체 음소거", "settings.mute.manage-endpoints.endpoints.title": "장치 목록", "settings.mute.manage-endpoints.add-edit.add-title": "장치 추가", "settings.mute.manage-endpoints.add-edit.edit-title": "장치 편집", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "장치명을 입력해주세요", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "장치 이름:", "about.title": "WinMute 정보", "about.general.author-site-label": "제작자: www.lx-s.de", "about.general.project-site-label": "프로젝트 사이트 && 코드", "about.general.support-label": "지원", "about.general.description": "WinMute는 Alexander Steinhoefer가 개인 시간에 개발한 오픈소스 도구입니다. 이 프로그램의 소스 코드와 최신 버전은 GitHub에서 확인할 수 있습니다. 코드 기여, 이슈 등록, 기능 제안 등 다양한 형태의 참여를 환영합니다. 이 작은 도구를 사용해 주셔서 감사합니다!", "about.tab.winmute": "WinMute", "about.tab.license": "라이선스", "about.btn-close": "확인", "log.title": "WinMute 로그 파일" } ================================================ FILE: Translations/lang-lv.json ================================================ { "meta.lang.name": "Latviešu (Latvian)", "meta.lang.mode": "ltr", "init.error.settings.title": "", "init.error.settings.text": "", "init.error.already-running.title": "", "init.error.already-running.text": "", "init.error.winmute.title": "", "init.error.winmute.text": "", "init.error.winmute.platform-support.title": "", "init.error.winmute.platform-support.text": "", "general.error.winapi.text": "", "general.error.audio-service-shutdown.title": "", "general.error.audio-service-shutdown.text": "", "popup.update-available.title": "", "popup.update-available.text": "", "popup.update-available-beta.title": "", "popup.update-available-beta.text": "", "popup.error.update-check-failed.title": "", "pupup.error.update-check-failed.text": "", "popup.remote-session-detected.title": "", "popup.remote-session-detected.text": "", "popup.bluetooth-muting-disabled.title": "", "popup.bluetooth-muting-disabled.text": "", "popup.wlan-muting-disabled.title": "", "popup.wlan-muting-disabled.text": "", "popup.quiet-hours-started.title": "", "popup.quiet-hours-started.text": "", "popup.quiet-hours-ended.title": "", "popup.quiet-hours-ended.text": "", "popup.workstation-muted.title": "", "popup.wlan-not-on-mute-list.text": "", "popup.wlan-is-on-mute-list.text": "", "popup.muting-workstation-after-delay.title": "", "popup.muting-workstation-after-delay.text": "", "popup.volume-restored.title": "", "popup.volume-restored.text": "", "popup.muting-workstation.title": "", "popup.muting-workstation.text": "", "popup.error.quiet-hours-start.title": "", "popup.error.quiet-hours-start.text": "", "popup.error.quiet-hours-stop.title": "", "popup.error.quiet-hours-stop.text": "", "traymenu.info": "Par", "traymenu.mute-when": "", "traymenu.mute-on-lock": "", "traymenu.mute-on-screen-suspend": "", "traymenu.restore-volume": "", "traymenu.mute-no-restore": "", "traymenu.mute-on-shutdown": "", "traymenu.mute-on-sleep": "", "traymenu.mute-on-logout": "", "traymenu.mute-all-devices": "", "traymenu.settings": "Iestatījumi…", "traymenu.exit": "Iziet", "settings.title": "Iestatījumi", "settings.btn-save": "Saglabāt", "settings.btn-cancel": "Atcelt", "settings.btn-add": "Pievienot", "settings.btn-edit": "Labot", "settings.btn-remove": "Noņemt", "settings.btn-remove-all": "", "settings.tab.general": "Vispārīgie", "settings.tab.mute": "", "settings.tab.quiet-hours": "", "settings.tab.bluetooth": "", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "Pievienot Bluetooth ierīci", "settings.bluetooth.add-edit.edit-title": "", "settings.bluetooth.add-edit.device-name-label": "Bluetooth ierīces nosaukums:", "settings.general.run-on-startup": "", "settings.general.check-for-updates-on-start": "", "settings.general.check-for-beta-updates-on-start": "", "settings.general.updates-handled-externally": "", "settings.general.enable-logging": "Saglabāt žurnālu failā", "settings.general.btn-open-log-file": "", "settings.general.select-language-label": "Valoda", "settings.general.help-translating": "Palīdziet iztulkot", "settings.bluetooth.add-edit.enter-device-name-placeholder": "", "settings.bluetooth.description": "", "settings.bluetooth.enable-muting": "", "settings.bluetooth.enable-muting-filter": "", "settings.bluetooth.bluetooth-disabled-info": "", "settings.mute.general-title": "", "settings.mute.show-mute-event-notifications": "", "settings.mute.manage-endpoints-individually": "", "settings.mute.btn-manage-endpoints": "", "settings.mute.mute-with-restore.title": "", "settings.mute.mute-with-restore.when-workstation-is-locked": "", "settings.mute.mute-with-restore.when-screen-turns-off": "", "settings.mute.mute-with-restore.restore-volume": "", "settings.mute.mute-with-restore.restore-volume-delay-label": "", "settings.mute.mute-without-restore.title": "", "settings.mute.mute-without-restore.when-computer-shuts-down": "", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "", "settings.mute.mute-without-restore.when-user-logs-out": "", "settings.mute.mute-without-restore.when-rdp-session-starts": "", "settings.quiet-hours.intro": "", "settings.quiet-hours.enable": "", "settings.quiet-hours.start-time-label": "", "settings.quiet-hours.end-time-label": "", "settings.quiet-hours.force-unmute": "", "settings.quiet-hours.force-unmute-description": "", "settings.quiet-hours.show-notifications": "", "settings.quiet-hours.error.invalid-time-range.title": "", "settings.quiet-hours.error.invalid-time-range.text": "", "settings.quiet-hours.error.error-while-saving.title": "", "settings.quiet-hours.error.error-while-saving.text": "", "settings.wifi.intro": "", "settings.wifi.enable": "", "settings.wifi.mute-when-in-list": "", "settings.wifi.mute-when-not-in-list": "", "settings.wifi.wifi-disabled-info": "", "settings.wifi.add-edit.add-title": "", "settings.wifi.add-edit.edit-title": "", "settings.wifi.add-edit.ssid-name-label": "SSID/Wi-Fi nosaukums:", "settings.wifi.add-edit.enter-device-name-placeholder": "", "settings.mute.manage-endpoints.title": "", "settings.mute.manage-endpoints.list-behaviour.title": "", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "", "settings.mute.manage-endpoints.endpoints.title": "Audio ierīces", "settings.mute.manage-endpoints.add-edit.add-title": "Pievienot ierīci", "settings.mute.manage-endpoints.add-edit.edit-title": "", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Audio ierīces nosaukums:", "about.title": "Par WinMute", "about.general.author-site-label": "Izstrādātājs: www.lx-s.de", "about.general.project-site-label": "", "about.general.support-label": "", "about.general.description": "", "about.tab.winmute": "WinMute", "about.tab.license": "Licence", "about.btn-close": "Labi" } ================================================ FILE: Translations/lang-nl.json ================================================ { "meta.lang.name": "Nederlands (Dutch)", "meta.lang.mode": "ltr", "init.error.settings.title": "De instellingen kunnen niet worden geladen", "init.error.settings.text": "Er is een kritieke fout opgetreden tijdens het starten", "init.error.already-running.title": "WinMute is al actief", "init.error.already-running.text": "Zoek naar het WinMute-pictogram in het systeemvak van de Windows-taakbalk.", "init.error.winmute.title": "WinMute kan niet worden gestart.", "init.error.winmute.text": "Er is een kritieke fout opgetreden waardoor WinMute dient te worden afgesloten.", "init.error.winmute.platform-support.title": "Windows Vista of nieuwer vereist", "init.error.winmute.platform-support.text": "Als u Windows XP-ondersteuning wilt, download dan WinMute 1.4.2 of ouder.", "general.error.winapi.text": "{} mislukt met foutmelding {}: {}", "general.error.audio-service-shutdown.title": "De audiodienst is afgesloten.", "general.error.audio-service-shutdown.text": "WinMute kan niet worden hersteld.\nHerstart het programma.", "popup.remote-session-detected.title": "Externe sessie aangetroffen", "popup.remote-session-detected.text": "Alle audio-apparaten zijn gedempt", "popup.bluetooth-muting-disabled.title": "Bluetoothdemping is uitgeschakeld", "popup.bluetooth-muting-disabled.text": "Bluetooth is uitgeschakeld of niet beschikbaar.\nBluetoothdemping wordt daarom uitgeschakeld.", "popup.wlan-muting-disabled.title": "WLAN-demping is uitgeschakeld", "popup.wlan-muting-disabled.text": "WLAN is niet beschikbaar of uitgeschakeld.\nWLAN muting wordt uitgeschakeld op deze computer.", "popup.quiet-hours-started.title": "Stille uren gestart", "popup.quiet-hours-started.text": "Computergeluid wordt nu gedempt.", "popup.quiet-hours-ended.title": "Stille uren beëindigd", "popup.quiet-hours-ended.text": "Computer audio is hersteld.", "popup.workstation-muted.title": "Audio gedempt", "popup.wlan-not-on-mute-list.text": "WLAN network \"{}\" staat niet in de lijst van toegestane.", "popup.wlan-is-on-mute-list.text": "WLAN network \"{}\" is geconfigureerd voor AutoMute.", "popup.muting-workstation-after-delay.title": "Computer stil na wachttijd", "popup.muting-workstation-after-delay.text": "Alle apparaten werden gedempt", "popup.volume-restored.title": "Volume hersteld", "popup.volume-restored.text": "Alle apparaten werden teruggezet naar hun vorige configuratie", "popup.muting-workstation.title": "Computer dempen", "popup.muting-workstation.text": "Alle apparaten werden gedempt", "popup.error.quiet-hours-start.title": "Stille uren start", "popup.error.quiet-hours-start.text": "Registratie van stille uren starttijd met windows timer systeem mislukt", "popup.error.quiet-hours-stop.title": "Stille uren stop", "popup.error.quiet-hours-stop.text": "Registratie van stille uren eindtijd met windows timer systeem mislukt", "traymenu.info": "Over", "traymenu.mute-when": "Dempen wanneer…", "traymenu.mute-on-lock": "… computer vergrendeld is", "traymenu.mute-on-screen-suspend": "… scherm uitschakelt", "traymenu.restore-volume": "Nadien volume herstellen", "traymenu.mute-no-restore": "Dempen bij (geen volume herstellen)…", "traymenu.mute-on-shutdown": "… uitschakelen", "traymenu.mute-on-sleep": "… slaapstand", "traymenu.mute-on-logout": "… afmelden", "traymenu.mute-all-devices": "Nu alle apparaten dempen", "traymenu.settings": "Instellingen…", "traymenu.exit": "Verlaat", "settings.title": "Instellingen", "settings.btn-save": "Opslaan", "settings.btn-cancel": "Annuleren", "settings.btn-add": "Toevoegen", "settings.btn-edit": "Wijzigen", "settings.btn-remove": "Verwijderen", "settings.btn-remove-all": "Verwijder alles", "settings.tab.general": "Algemeen", "settings.tab.mute": "Dempen", "settings.tab.quiet-hours": "Stille uren", "settings.tab.bluetooth": "Bluetooth", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "Bluetoothapparaat toevoegen", "settings.bluetooth.add-edit.edit-title": "Bluetoothapparaat wijzigen", "settings.bluetooth.add-edit.device-name-label": "Naam Bluetoothapparaat:", "settings.general.run-on-startup": "WinMute starten wanneer deze gebruiker aanmeldt", "settings.general.enable-logging": "Logboek opslaan in bestand", "settings.general.btn-open-log-file": "Logbestand openen…", "settings.general.select-language-label": "Taal", "settings.bluetooth.add-edit.enter-device-name-placeholder": "Geef de naam van een Bluetoothapparaat op", "settings.bluetooth.description": "", "settings.bluetooth.enable-muting": "", "settings.bluetooth.enable-muting-filter": "", "settings.bluetooth.bluetooth-disabled-info": "", "settings.mute.general-title": "", "settings.mute.show-mute-event-notifications": "", "settings.mute.manage-endpoints-individually": "", "settings.mute.btn-manage-endpoints": "", "settings.mute.mute-with-restore.title": "", "settings.mute.mute-with-restore.when-workstation-is-locked": "", "settings.mute.mute-with-restore.when-screen-turns-off": "", "settings.mute.mute-with-restore.restore-volume": "", "settings.mute.mute-with-restore.restore-volume-delay-label": "", "settings.mute.mute-without-restore.title": "", "settings.mute.mute-without-restore.when-computer-shuts-down": "", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "", "settings.mute.mute-without-restore.when-user-logs-out": "", "settings.mute.mute-without-restore.when-rdp-session-starts": "", "settings.quiet-hours.intro": "", "settings.quiet-hours.enable": "", "settings.quiet-hours.start-time-label": "", "settings.quiet-hours.end-time-label": "", "settings.quiet-hours.force-unmute": "", "settings.quiet-hours.force-unmute-description": "", "settings.quiet-hours.show-notifications": "", "settings.quiet-hours.error.invalid-time-range.title": "", "settings.quiet-hours.error.invalid-time-range.text": "", "settings.quiet-hours.error.error-while-saving.title": "", "settings.quiet-hours.error.error-while-saving.text": "", "settings.wifi.intro": "", "settings.wifi.enable": "", "settings.wifi.mute-when-not-in-list": "", "settings.wifi.wifi-disabled-info": "", "settings.wifi.add-edit.add-title": "", "settings.wifi.add-edit.edit-title": "", "settings.wifi.add-edit.ssid-name-label": "", "settings.wifi.add-edit.enter-device-name-placeholder": "", "settings.mute.manage-endpoints.title": "", "settings.mute.manage-endpoints.list-behaviour.title": "", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "", "settings.mute.manage-endpoints.endpoints.title": "", "settings.mute.manage-endpoints.add-edit.add-title": "", "settings.mute.manage-endpoints.add-edit.edit-title": "", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "", "about.title": "", "about.general.author-site-label": "", "about.general.project-site-label": "", "about.general.support-label": "", "about.general.description": "", "about.tab.winmute": "", "about.tab.license": "", "about.btn-close": "", "settings.general.help-translating": "Help met vertalen", "settings.general.check-for-updates-on-start": "Nieuwe updates zoeken bij opstarten", "popup.update-available.title": "WinMute {} is beschikbaar!", "popup.update-available-beta.title": "WinMute Beta {} is beschikbaar!", "popup.update-available-beta.text": "Uw huidige versie is {}\nKlik op dit bericht om de beta-downloadpagina te openen.", "popup.error.update-check-failed.title": "Update check mislukt.", "pupup.error.update-check-failed.text": "Kon niet controleren of er een nieuwe versie is.\nKijk de logs na of schakel logging in voor meer details.", "settings.general.check-for-beta-updates-on-start": "Ook zoeken naar betaversies", "settings.general.updates-handled-externally": "Opties uitgeschakeld: updates worden extern afgehandeld", "popup.update-available.text": "De geïnstalleerde versie is {}.\nKlik op dit bericht om de downloadpagina te openen.", "log.title": "WinMute Notulen" } ================================================ FILE: Translations/lang-ro.json ================================================ { "meta.lang.name": "Română (Romanian)", "meta.lang.mode": "ltr", "init.error.settings.title": "", "init.error.settings.text": "", "init.error.already-running.title": "", "init.error.already-running.text": "", "init.error.winmute.title": "", "init.error.winmute.text": "", "init.error.winmute.platform-support.title": "", "init.error.winmute.platform-support.text": "", "general.error.winapi.text": "", "general.error.audio-service-shutdown.title": "", "general.error.audio-service-shutdown.text": "", "popup.update-available.title": "", "popup.update-available.text": "", "popup.update-available-beta.title": "", "popup.update-available-beta.text": "", "popup.error.update-check-failed.title": "", "pupup.error.update-check-failed.text": "", "popup.remote-session-detected.title": "", "popup.remote-session-detected.text": "", "popup.bluetooth-muting-disabled.title": "", "popup.bluetooth-muting-disabled.text": "", "popup.wlan-muting-disabled.title": "", "popup.wlan-muting-disabled.text": "", "popup.quiet-hours-started.title": "", "popup.quiet-hours-started.text": "", "popup.quiet-hours-ended.title": "", "popup.quiet-hours-ended.text": "", "popup.workstation-muted.title": "", "popup.wlan-not-on-mute-list.text": "", "popup.wlan-is-on-mute-list.text": "", "popup.muting-workstation-after-delay.title": "", "popup.muting-workstation-after-delay.text": "", "popup.volume-restored.title": "", "popup.volume-restored.text": "", "popup.muting-workstation.title": "", "popup.muting-workstation.text": "", "popup.error.quiet-hours-start.title": "", "popup.error.quiet-hours-start.text": "", "popup.error.quiet-hours-stop.title": "", "popup.error.quiet-hours-stop.text": "", "traymenu.info": "", "traymenu.mute-when": "", "traymenu.mute-on-lock": "", "traymenu.mute-on-screen-suspend": "", "traymenu.restore-volume": "", "traymenu.mute-no-restore": "", "traymenu.mute-on-shutdown": "", "traymenu.mute-on-sleep": "", "traymenu.mute-on-logout": "", "traymenu.mute-all-devices": "", "traymenu.settings": "", "traymenu.exit": "", "settings.title": "", "settings.btn-save": "", "settings.btn-cancel": "", "settings.btn-add": "", "settings.btn-edit": "", "settings.btn-remove": "", "settings.btn-remove-all": "", "settings.tab.general": "", "settings.tab.mute": "", "settings.tab.quiet-hours": "", "settings.tab.bluetooth": "", "settings.tab.wifi": "", "settings.bluetooth.add-edit.add-title": "", "settings.bluetooth.add-edit.edit-title": "", "settings.bluetooth.add-edit.device-name-label": "", "settings.general.run-on-startup": "", "settings.general.check-for-updates-on-start": "", "settings.general.check-for-beta-updates-on-start": "", "settings.general.updates-handled-externally": "", "settings.general.enable-logging": "", "settings.general.btn-open-log-file": "", "settings.general.select-language-label": "", "settings.general.help-translating": "", "settings.bluetooth.add-edit.enter-device-name-placeholder": "", "settings.bluetooth.description": "", "settings.bluetooth.enable-muting": "", "settings.bluetooth.enable-muting-filter": "", "settings.bluetooth.bluetooth-disabled-info": "", "settings.mute.general-title": "", "settings.mute.show-mute-event-notifications": "", "settings.mute.manage-endpoints-individually": "", "settings.mute.btn-manage-endpoints": "", "settings.mute.mute-with-restore.title": "", "settings.mute.mute-with-restore.when-workstation-is-locked": "", "settings.mute.mute-with-restore.when-screen-turns-off": "", "settings.mute.mute-with-restore.restore-volume": "", "settings.mute.mute-with-restore.restore-volume-delay-label": "", "settings.mute.mute-without-restore.title": "", "settings.mute.mute-without-restore.when-computer-shuts-down": "", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "", "settings.mute.mute-without-restore.when-user-logs-out": "", "settings.mute.mute-without-restore.when-rdp-session-starts": "", "settings.quiet-hours.intro": "", "settings.quiet-hours.enable": "", "settings.quiet-hours.start-time-label": "", "settings.quiet-hours.end-time-label": "", "settings.quiet-hours.force-unmute": "", "settings.quiet-hours.force-unmute-description": "", "settings.quiet-hours.show-notifications": "", "settings.quiet-hours.error.invalid-time-range.title": "", "settings.quiet-hours.error.invalid-time-range.text": "", "settings.quiet-hours.error.error-while-saving.title": "", "settings.quiet-hours.error.error-while-saving.text": "", "settings.wifi.intro": "", "settings.wifi.enable": "", "settings.wifi.mute-when-in-list": "", "settings.wifi.mute-when-not-in-list": "", "settings.wifi.wifi-disabled-info": "", "settings.wifi.add-edit.add-title": "", "settings.wifi.add-edit.edit-title": "", "settings.wifi.add-edit.ssid-name-label": "", "settings.wifi.add-edit.enter-device-name-placeholder": "", "settings.mute.manage-endpoints.title": "", "settings.mute.manage-endpoints.list-behaviour.title": "", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "", "settings.mute.manage-endpoints.endpoints.title": "", "settings.mute.manage-endpoints.add-edit.add-title": "", "settings.mute.manage-endpoints.add-edit.edit-title": "", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "", "about.title": "", "about.general.author-site-label": "", "about.general.project-site-label": "", "about.general.support-label": "", "about.general.description": "", "about.tab.winmute": "", "about.tab.license": "", "about.btn-close": "" } ================================================ FILE: Translations/lang-ru.json ================================================ { "meta.lang.name": "Руский (Russian)", "meta.lang.mode": "ltr", "init.error.settings.title": "Не удалось инициализировать настройки", "init.error.settings.text": "Критическая ошибка при инициализации WinMute", "init.error.already-running.title": "WinMute уже запущен", "init.error.already-running.text": "Поищите значок приложения WinMute в области уведомлений панели задач Windows.", "init.error.winmute.title": "Не удалось запустить WinMute.", "init.error.winmute.text": "В WinMute произошла критическая ошибка при инициализации, и программу нужно закрыть.", "init.error.winmute.platform-support.title": "Поддерживаются только Windows Vista и более новые версии", "init.error.winmute.platform-support.text": "Если требуется поддержка Windows XP, загрузите WinMute версии 1.4.2 или ниже.", "general.error.winapi.text": "{} завершился с ошибкой {}: {}", "general.error.audio-service-shutdown.title": "Аудиослужба была выключена.", "general.error.audio-service-shutdown.text": "WinMute не может восстановиться из этого состояния. Попробуйте перезапустить программу.", "popup.update-available.title": "WinMute {} доступен!", "popup.update-available.text": "Установленная версия — {}. Щёлкните на это сообщение, чтобы открыть страницу скачивания.", "popup.update-available-beta.title": "WinMute Beta {} доступен!", "popup.update-available-beta.text": "Ваша текущая версия — {}. Щёлкните это сообщение, чтобы открыть страницу скачивания бета-версии.", "popup.error.update-check-failed.title": "Проверка обновлений не удалась.", "pupup.error.update-check-failed.text": "Не удалось проверить наличие новой версии. Проверьте/включите ведение журнала для получения дополнительных сведений.", "popup.remote-session-detected.title": "Обнаружен отдалённый сеанс", "popup.remote-session-detected.text": "Все аудиоустройства отключены", "popup.bluetooth-muting-disabled.title": "Выключение звука по Bluetooth отключено", "popup.bluetooth-muting-disabled.text": "Bluetooth недоступен или отключён. Выключение звука по Bluetooth будет отключено на этом компьютере.", "popup.wlan-muting-disabled.title": "Выключение звука по WLAN отключено", "popup.wlan-muting-disabled.text": "Сеть WLAN недоступна или отключена. Выключение звука по WLAN будет отключено на этом компьютере.", "popup.quiet-hours-started.title": "Начался режим тишины", "popup.quiet-hours-started.text": "Звук компьютера будет выключен.", "popup.quiet-hours-ended.title": "Завершение режима тишины", "popup.quiet-hours-ended.text": "Звук компьютера восстановлен.", "popup.workstation-muted.title": "Звук выключен", "popup.wlan-not-on-mute-list.text": "Сеть WLAN \"{}\" не находится в списке разрешённых.", "popup.wlan-is-on-mute-list.text": "Сеть WLAN \"{}\" настроена для AutoMute.", "popup.muting-workstation-after-delay.title": "Выключение звука компьютера после задержки", "popup.muting-workstation-after-delay.text": "Выключение звука всех устройств", "popup.volume-restored.title": "Громкость восстановлена", "popup.volume-restored.text": "Все устройства восстановлены до предыдущей конфигурации", "popup.muting-workstation.title": "Выключение звука компьютера", "popup.muting-workstation.text": "Выключение звука всех устройств", "popup.error.quiet-hours-start.title": "Начало режима тишины", "popup.error.quiet-hours-start.text": "Не удалось зарегистрировать начало режима тишины в системе таймера Windows", "popup.error.quiet-hours-stop.title": "Остановка режима тишины", "popup.error.quiet-hours-stop.text": "Не удалось зарегистрировать окончание режима тишины в системе таймера Windows", "traymenu.info": "О программе", "traymenu.mute-when": "Выключить звук, когда...", "traymenu.mute-on-lock": "... компьютер заблокирован", "traymenu.mute-on-screen-suspend": "... экран выключен", "traymenu.restore-volume": "Восстановить громкость после", "traymenu.mute-no-restore": "Выключить звук (без восстановления громкости)...", "traymenu.mute-on-shutdown": "... выключение", "traymenu.mute-on-sleep": "... спящий режим", "traymenu.mute-on-logout": "... выход из системы", "traymenu.mute-all-devices": "Выключить звук на всех устройствах сейчас", "traymenu.settings": "Настройки...", "traymenu.exit": "Выйти", "settings.title": "Настройки", "settings.btn-save": "Сохранить", "settings.btn-cancel": "Отмена", "settings.btn-add": "Добавить", "settings.btn-edit": "Изменить", "settings.btn-remove": "Удалить", "settings.btn-remove-all": "Удалить все", "settings.tab.general": "Основные", "settings.tab.mute": "Выключить звук", "settings.tab.quiet-hours": "Тихие часы", "settings.tab.bluetooth": "Bluetooth", "settings.tab.wifi": "WLAN", "settings.bluetooth.add-edit.add-title": "Добавить устройство Bluetooth", "settings.bluetooth.add-edit.edit-title": "Изменить устройство Bluetooth", "settings.bluetooth.add-edit.device-name-label": "Название устройства Bluetooth:", "settings.general.run-on-startup": "Запускать WinMute при входе этого пользователя в систему", "settings.general.check-for-updates-on-start": "Проверять наличие новых обновлений при запуске", "settings.general.check-for-beta-updates-on-start": "Также проверять наличие новых бета-версий", "settings.general.updates-handled-externally": "Параметры отключены: обновления обрабатываются извне", "settings.general.enable-logging": "Сохранить журнал в файл", "settings.general.btn-open-log-file": "Открыть файл журнала...", "settings.general.select-language-label": "Язык", "settings.general.help-translating": "Помочь с переводом", "settings.bluetooth.add-edit.enter-device-name-placeholder": "Введите название устройства Bluetooth", "settings.bluetooth.description": "«Выключение звука по Bluetooth» позволяет выключить звук, если звуковое устройство Bluetooth отключено, и снова включить его, если устройство повторно подключено к компьютеру. Это поведение можно включить для всех аудиоустройств Bluetooth или только для определённого набора.", "settings.bluetooth.enable-muting": "Включить выключение звука на основе Bluetooth", "settings.bluetooth.enable-muting-filter": "Включить только для этих устройств:", "settings.bluetooth.bluetooth-disabled-info": "Примечание: Bluetooth недоступен на этом устройстве.\nНекоторые параметры отсутствуют.", "settings.mute.general-title": "Общие", "settings.mute.show-mute-event-notifications": "Показывать уведомления о событиях отключения звука", "settings.mute.manage-endpoints-individually": "Управление аудиоустройствами по отдельности", "settings.mute.btn-manage-endpoints": "Управление устройствами...", "settings.mute.mute-with-restore.title": "Выключение звука с восстановлением громкости, когда...", "settings.mute.mute-with-restore.when-workstation-is-locked": "... компьютер заблокирован", "settings.mute.mute-with-restore.when-screen-turns-off": "... экран выключается", "settings.mute.mute-with-restore.restore-volume": "Восстановление громкости через", "settings.mute.mute-with-restore.restore-volume-delay-label": "секундная задержка перед отключением звука.", "settings.mute.mute-without-restore.title": "Выключение звука без восстановления громкости, когда...", "settings.mute.mute-without-restore.when-computer-shuts-down": "... компьютер выключается", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... компьютер переходит в спящий режим или гибернации", "settings.mute.mute-without-restore.when-user-logs-out": "... пользователь выходит из системы", "settings.mute.mute-without-restore.when-rdp-session-starts": "... WinMute запускается в сеансе RDP", "settings.quiet-hours.intro": "Во время тихих часов WinMute автоматически выключает звук на аудиоустройствах компьютера и включает их после этого.", "settings.quiet-hours.enable": "Включить тихие часы", "settings.quiet-hours.start-time-label": "Время начала:", "settings.quiet-hours.end-time-label": "Время окончания:", "settings.quiet-hours.force-unmute": "Принудительное отключение звука", "settings.quiet-hours.force-unmute-description": "Если включено принудительное выключение звука, WinMute включит звук на аудиоустройствах компьютера по окончании тихих часов и не будет учитывать, были ли они уже выключены до начала тихих часов.", "settings.quiet-hours.show-notifications": "Показывать уведомления о тихих часах", "settings.quiet-hours.error.invalid-time-range.title": "Недопустимый временной диапазон", "settings.quiet-hours.error.invalid-time-range.text": "Начало и остановка не должны совпадать по времени.", "settings.quiet-hours.error.error-while-saving.title": "Не удалось сохранить настройки тихих часов", "settings.quiet-hours.error.error-while-saving.text": "Что-то пошло не так при сохранении настроек", "settings.wifi.intro": "«WLAN Mute» выключает звук на компьютере в зависимости от названия подключённой беспроводной сети.", "settings.wifi.enable": "Включить выключение звука на основе WLAN", "settings.wifi.mute-when-in-list": "Выключить звук, если подключённая сеть WLAN есть в списке", "settings.wifi.mute-when-not-in-list": "Выключить звук, если подключённая сеть WLAN отсутствует в списке", "settings.wifi.wifi-disabled-info": "Примечание: WLAN недоступна на этом устройстве.\nНекоторые параметры отсутствуют.", "settings.wifi.add-edit.add-title": "Добавить сеть WiFi", "settings.wifi.add-edit.edit-title": "Изменить сеть WiFi", "settings.wifi.add-edit.ssid-name-label": "Название SSID/WiFi:", "settings.wifi.add-edit.enter-device-name-placeholder": "Введите название SSID/WiFi", "settings.mute.manage-endpoints.title": "Управление аудиоустройствами", "settings.mute.manage-endpoints.list-behaviour.title": "Общие", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "Выключить звук только для перечисленных устройств", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "Выключить звук для всех, кроме перечисленных устройств", "settings.mute.manage-endpoints.endpoints.title": "Устройства", "settings.mute.manage-endpoints.add-edit.add-title": "Добавить устройство", "settings.mute.manage-endpoints.add-edit.edit-title": "Изменить устройство", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "Введите название устройства", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Название устройства:", "about.title": "О WinMute", "about.general.author-site-label": "Автор: www.lx-s.de", "about.general.project-site-label": "Сайт проекта и код", "about.general.support-label": "Поддержка", "about.general.description": "WinMute разрабатывается Александром Штайнхёфером (Alexander Steinhoefer) в свободное время. Код, а также новые версии этого инструмента можно найти на GitHub. Участие в виде кода, отчётов об ошибках или предложений очень приветствуется. Спасибо за использование этого маленького инструмента!", "about.tab.winmute": "WinMute", "about.tab.license": "Лицензия", "about.btn-close": "Хорошо" } ================================================ FILE: Translations/lang-zh_Hans.json ================================================ { "meta.lang.name": "简体中文[囍]", "meta.lang.mode": "ltr", "init.error.settings.title": "未能初始化设置", "init.error.settings.text": "初始化WinMute时出现严重错误", "init.error.already-running.title": "WinMute已在运行", "init.error.already-running.text": "请在Windows任务栏通知区域中查找winmutes应用程序图标.", "init.error.winmute.title": "无法启动WinMute.", "init.error.winmute.text": "WinMute在初始化时遇到严重错误,自动关闭.", "init.error.winmute.platform-support.title": "仅支持Windows Vista及更新版本", "init.error.winmute.platform-support.text": "如果需要Windows XP支持,请下载WinMute 1.4.2或更低版本.", "general.error.winapi.text": "{} 失败,出现错误 {}: {}", "general.error.audio-service-shutdown.title": "音频服务已关闭.", "general.error.audio-service-shutdown.text": "WinMute无法从这种情况下恢复.\n请尝试重新启动程序.", "popup.update-available.title": "WinMute {} 可用!", "popup.update-available.text": "安装的版本为{}.\n点击本消息打开下载页面.", "popup.update-available-beta.title": "WinMute Beta {} 可用!", "popup.update-available-beta.text": "您的当前版本是 {}.\n单击本消息打开测试版下载页面.", "popup.error.update-check-failed.title": "更新检查失败.", "pupup.error.update-check-failed.text": "无法检查新版本.\n请检查/启用日志记录以了解更多详细信息.", "popup.remote-session-detected.title": "检测到远程会话", "popup.remote-session-detected.text": "所有音频设备都已静音", "popup.bluetooth-muting-disabled.title": "蓝牙静音已禁用", "popup.bluetooth-muting-disabled.text": "蓝牙不可用或已禁用.\n将在此电脑上禁用蓝牙静音.", "popup.wlan-muting-disabled.title": "WLAN静音已禁用", "popup.wlan-muting-disabled.text": "WLAN不可用或已禁用.\n将在此电脑上禁用WLAN静音.", "popup.quiet-hours-started.title": "静音计划任务开启", "popup.quiet-hours-started.text": "电脑音频立即静音.", "popup.quiet-hours-ended.title": "静音计划任务结束", "popup.quiet-hours-ended.text": "电脑声音已恢复.", "popup.workstation-muted.title": "静音", "popup.wlan-not-on-mute-list.text": "WLAN网络 \"{}\" 不在允许的列表中.", "popup.wlan-is-on-mute-list.text": "WLAN 网格 \"{}\" 配置为“自动静音”.", "popup.muting-workstation-after-delay.title": "延迟后使电脑静音", "popup.muting-workstation-after-delay.text": "所有设备都已静音", "popup.volume-restored.title": "音量恢复", "popup.volume-restored.text": "所有设备都已恢复到以前的配置", "popup.muting-workstation.title": "电脑静音", "popup.muting-workstation.text": "所有设备都已静音", "popup.error.quiet-hours-start.title": "静音计划任务开启", "popup.error.quiet-hours-start.text": "无法使用Windows计时器系统注册静音时间启动", "popup.error.quiet-hours-stop.title": "静音计划任务停止", "popup.error.quiet-hours-stop.text": "无法使用Windows计时器系统注册静音时间停止", "traymenu.info": "=关于=", "traymenu.mute-when": "触发静音条件...", "traymenu.mute-on-lock": "系统锁定后 静音", "traymenu.mute-on-screen-suspend": "显示器关闭后 静音", "traymenu.restore-volume": "自动恢复音量", "traymenu.mute-no-restore": "静音后(执行)...", "traymenu.mute-on-shutdown": "=关机=", "traymenu.mute-on-sleep": "=休眠=", "traymenu.mute-on-logout": "=注销=", "traymenu.mute-all-devices": "立即将所有设备静音", "traymenu.settings": "=设置=", "traymenu.exit": "=退出=", "settings.title": "=设置=", "settings.btn-save": "保存", "settings.btn-cancel": "取消", "settings.btn-add": "增加", "settings.btn-edit": "编辑", "settings.btn-remove": "清除", "settings.btn-remove-all": "全清", "settings.tab.general": "通用", "settings.tab.mute": "静音前后", "settings.tab.quiet-hours": "计划任务", "settings.tab.bluetooth": "蓝牙控制", "settings.tab.wifi": "WLAN控制", "settings.bluetooth.add-edit.add-title": "添加蓝牙设备", "settings.bluetooth.add-edit.edit-title": "编辑蓝牙设备", "settings.bluetooth.add-edit.device-name-label": "蓝牙设备名称:", "settings.general.run-on-startup": "开机启动WinMute", "settings.general.check-for-updates-on-start": "启动时检查新更新", "settings.general.check-for-beta-updates-on-start": "同时检查新的测试版", "settings.general.updates-handled-externally": "禁用选项:外部处理更新", "settings.general.enable-logging": "将日志保存到文件", "settings.general.btn-open-log-file": "打开日志记录...", "settings.general.select-language-label": "语言:", "settings.general.help-translating": "帮助翻译", "settings.bluetooth.add-edit.enter-device-name-placeholder": "请输入蓝牙设备名称", "settings.bluetooth.description": "“蓝牙静音”允许在音频类蓝牙设备断开连接时禁用音频,并在设备重新连接到电脑时重新启用音频.\n\n此行为可以为所有蓝牙音频设备启用,也可以仅为特定的一组启用.", "settings.bluetooth.enable-muting": "开启蓝牙静音功能", "settings.bluetooth.enable-muting-filter": "仅对以下设备启用:", "settings.bluetooth.bluetooth-disabled-info": "注意:此设备不支持蓝牙.\n某些选项已被禁用.", "settings.mute.general-title": "通用", "settings.mute.show-mute-event-notifications": "显示静音事件通知", "settings.mute.manage-endpoints-individually": "单独管理音频设备", "settings.mute.btn-manage-endpoints": "设备管理...", "settings.mute.mute-with-restore.title": "启动静音条件...", "settings.mute.mute-with-restore.when-workstation-is-locked": "系统锁定后启动 静音", "settings.mute.mute-with-restore.when-screen-turns-off": "显示器关闭时启动 静音", "settings.mute.mute-with-restore.restore-volume": "自动恢复音量", "settings.mute.mute-with-restore.restore-volume-delay-label": "秒后静音.(\"0\"值为立即静音)", "settings.mute.mute-without-restore.title": "静音后执行下列操作...", "settings.mute.mute-without-restore.when-computer-shuts-down": "=关机=", "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "=休眠=", "settings.mute.mute-without-restore.when-user-logs-out": "=注销=", "settings.mute.mute-without-restore.when-rdp-session-starts": "WinMute在远程桌面会话 (RDP) 中启动", "settings.quiet-hours.intro": "在指定时间内,WinMute自动进入静音,然后自动恢复.", "settings.quiet-hours.enable": "启用静音计划任务", "settings.quiet-hours.start-time-label": "开始时间:", "settings.quiet-hours.end-time-label": "结束时间:", "settings.quiet-hours.force-unmute": "强制取消静音", "settings.quiet-hours.force-unmute-description": "如果启动强制取消静音,WinMute将在静单时间结束时取消电脑音频设备的静音,而不考虑它们在静单时间开始前是否已经静音.", "settings.quiet-hours.show-notifications": "显示静音时间通知", "settings.quiet-hours.error.invalid-time-range.title": "无效的时间范围", "settings.quiet-hours.error.invalid-time-range.text": "启动和停止时间不能相同.", "settings.quiet-hours.error.error-while-saving.title": "无法保存安静时间设置", "settings.quiet-hours.error.error-while-saving.text": "保存设置时出错", "settings.wifi.intro": "“WLAN静音”根据连接的无线网络的名称使电脑静音。", "settings.wifi.enable": "启用基于WLAN的静音", "settings.wifi.mute-when-in-list": "如果已连接的WLAN在列表中,则静音", "settings.wifi.mute-when-not-in-list": "如果已连接的WLAN不在列表中,则静音", "settings.wifi.wifi-disabled-info": "注意:WLAN在此设备上不可用.\n某些选项已被禁用.", "settings.wifi.add-edit.add-title": "添加WiFi网络", "settings.wifi.add-edit.edit-title": "编辑WiFi网络", "settings.wifi.add-edit.ssid-name-label": "SSID/WiFi 名称:", "settings.wifi.add-edit.enter-device-name-placeholder": "请输入SSID/WiFi名称", "settings.mute.manage-endpoints.title": "管理音频设备", "settings.mute.manage-endpoints.list-behaviour.title": "通用", "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "仅对列出的设备静音", "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "将列出的设备以外的所有设备静音", "settings.mute.manage-endpoints.endpoints.title": "设备", "settings.mute.manage-endpoints.add-edit.add-title": "添加设备", "settings.mute.manage-endpoints.add-edit.edit-title": "编辑设备", "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "请输入设备名称", "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "设备名称:", "about.title": "关于WinMute", "about.general.author-site-label": "官网: www.lx-s.de", "about.general.project-site-label": "项目GitHub && 代码", "about.general.support-label": "建议与改进支持", "about.general.description": "WinMute是由Alexander Steinhoefer在业余时间开发的。该工具的代码和新版本可以在GitHub上找到。非常欢迎以代码、门票或功能请求的形式进行贡献。感谢您使用这个小工具!\n 中文汉化by richzhl-1382232", "about.tab.winmute": "关于WinMute", "about.tab.license": "许可证明", "about.btn-close": "确定", "log.title": "WinMute日志记录", "settings.general.btn-open-log-window": "显示日志…" } ================================================ FILE: WinMute/AboutDlg.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" static const std::wstring licenseText = L"\ WinMute\r\n\ Copyright(c) 2025, Alexander Steinhoefer\r\n\ \r\n\ -----------------------------------------------------------------------------\r\n\ Redistribution and use in source and binary forms, with or without\r\n\ modification, are permitted provided that the following conditions are met:\r\n\ \r\n\ * Redistributions of source code must retain the above copyright notice,\r\n\ this list of conditions and the following disclaimer.\r\n\ \r\n\ * Redistributions in binary form must reproduce the above copyright\r\n\ notice, this list of conditions and the following disclaimer in the\r\n\ documentation and /or other materials provided with the distribution.\r\n\ \r\n\ * Neither the name of the author nor the names of its contributors may\r\n\ be used to endorse or promote products derived from this software\r\n\ without specific prior written permission.\r\n\ \r\n\ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n\ \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n\ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r\n\ FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE\r\n\ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r\n\ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,\r\n\ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n\ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r\n\ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n\ LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY\r\n\ WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n\ POSSIBILITY OF SUCH DAMAGE.\r\n\ "; enum AboutTabsIDs { ABOUT_TAB_GENERAL = 0, ABOUT_TAB_LICENSE, ABOUT_TAB_COUNT }; struct AboutDlgData { HWND hTabCtrl = nullptr; std::array hTabs{nullptr}; HWND hActiveTab = nullptr; HFONT hTitleFont = nullptr; }; static void InsertTabItem(HWND hTabCtrl, UINT id, const std::wstring& itemName) { constexpr int bufSize = 50; wchar_t buf[bufSize] = { L'\0' }; TC_ITEM tcItem; ZeroMemory(&tcItem, sizeof(tcItem)); tcItem.mask |= TCIF_TEXT; StringCchCopyW(buf, bufSize, itemName.c_str()); tcItem.pszText = buf; tcItem.cchTextMax = bufSize; TabCtrl_InsertItem(hTabCtrl, id, &tcItem); } static void SwitchTab(AboutDlgData* dlgData, HWND hNewTab) noexcept { if (dlgData->hActiveTab != nullptr) { ShowWindow(dlgData->hActiveTab, SW_HIDE); } dlgData->hActiveTab = hNewTab; ShowWindow(dlgData->hActiveTab, SW_SHOW); } static void ResizeTabs(HWND hTabCtrl, std::span tabs) { RECT tabCtrlRect = { 0 }; GetWindowRect(hTabCtrl, &tabCtrlRect); POINT tabCtrlPos = { 0 }; tabCtrlPos.x = tabCtrlRect.left; tabCtrlPos.y = tabCtrlRect.top; ScreenToClient(GetParent(hTabCtrl), &tabCtrlPos); GetClientRect(hTabCtrl, &tabCtrlRect); TabCtrl_AdjustRect(hTabCtrl, FALSE, &tabCtrlRect); tabCtrlRect.left += tabCtrlPos.x; tabCtrlRect.top += tabCtrlPos.y; HDWP hdwp = BeginDeferWindowPos(static_cast(tabs.size())); if (hdwp == nullptr) { ShowWindowsError(L"BeginDeferWindowPos", GetLastError()); } else { for (auto hTab : tabs) { HDWP newHdwp = DeferWindowPos( hdwp, hTab, HWND_TOP, tabCtrlRect.left, tabCtrlRect.top, tabCtrlRect.right - tabCtrlRect.left, tabCtrlRect.bottom - tabCtrlRect.top, 0); if (newHdwp == nullptr) { ShowWindowsError(L"DeferWindowPos", GetLastError()); break; } else { hdwp = newHdwp; } } EndDeferWindowPos(hdwp); } } static void TranslateAboutGeneralDlgProc(HWND hDlg) { WMi18n &i18n = WMi18n::GetInstance(); const auto hpLink = std::vformat( std::wstring_view(L"{}"), std::make_wformat_args(i18n.GetTranslationW("about.general.author-site-label"))); const auto projLink = std::vformat( L"{}", std::make_wformat_args(i18n.GetTranslationW("about.general.project-site-label"))); const auto supportLink = std::vformat( L"{}", std::make_wformat_args(i18n.GetTranslationW("about.general.support-label"))); SetDlgItemTextW(hDlg, IDC_LINK_HOMEPAGE, hpLink.c_str()); SetDlgItemTextW(hDlg, IDC_LINK_PROJECT, projLink.c_str()); SetDlgItemTextW(hDlg, IDC_LINK_TICKETS, supportLink.c_str()); i18n.SetItemText(hDlg, IDC_ABOUTTEXT, "about.general.description"); } static INT_PTR CALLBACK About_GeneralDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM lParam) noexcept { switch (msg) { case WM_INITDIALOG: if (IsAppThemed()) { EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB); } TranslateAboutGeneralDlgProc(hDlg); return TRUE; case WM_NOTIFY: { const PNMLINK pNmLink = reinterpret_cast(lParam); #pragma warning(push) #pragma warning(disable : 26454) // Disable arithmetic overflow warning for NM_CLICK and NM_RETURN if (pNmLink->hdr.code == NM_CLICK || pNmLink->hdr.code == NM_RETURN) { #pragma warning(pop) const UINT_PTR ctrlId = pNmLink->hdr.idFrom; const LITEM item = pNmLink->item; if ((ctrlId == IDC_LINK_HOMEPAGE || ctrlId == IDC_LINK_TICKETS || ctrlId == IDC_LINK_PROJECT) && item.iLink == 0) { LaunchBrowser(hDlg, item.szUrl); } } return TRUE; } default: break; } return FALSE; } static INT_PTR CALLBACK About_LicenseDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM) noexcept { switch (msg) { case WM_INITDIALOG: if (IsAppThemed()) { EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB); } Edit_SetText(GetDlgItem(hDlg, IDC_LICENSETEXT), licenseText.c_str()); return TRUE; default: break; } return FALSE; } static void TranslateAboutDlgProc(HWND hDlg) { WMi18n &i18n = WMi18n::GetInstance(); SetWindowText(hDlg, i18n.GetTranslationW("about.title").c_str()); i18n.SetItemText(hDlg, IDOK, "about.btn-close"); } INT_PTR CALLBACK AboutDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { AboutDlgData* dlgData = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); switch (msg) { case WM_INITDIALOG: { dlgData = new AboutDlgData(); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(dlgData)); dlgData->hTabCtrl = GetDlgItem(hDlg, IDC_ABOUT_TAB); WMi18n &i18n = WMi18n::GetInstance(); InsertTabItem(dlgData->hTabCtrl, ABOUT_TAB_GENERAL, i18n.GetTranslationW("about.tab.winmute")); InsertTabItem(dlgData->hTabCtrl, ABOUT_TAB_LICENSE, i18n.GetTranslationW("about.tab.license")); TranslateAboutDlgProc(hDlg); dlgData->hTabs[ABOUT_TAB_GENERAL] = CreateDialog( nullptr, MAKEINTRESOURCE(IDD_ABOUT_WINMUTE), hDlg, About_GeneralDlgProc); dlgData->hTabs[ABOUT_TAB_LICENSE] = CreateDialog( nullptr, MAKEINTRESOURCE(IDD_ABOUT_LICENSE), hDlg, About_LicenseDlgProc); // Init tab pages ResizeTabs(dlgData->hTabCtrl, std::span{dlgData->hTabs}); for (auto hTab : dlgData->hTabs) { ShowWindow(hTab, SW_HIDE); } SwitchTab(dlgData, dlgData->hTabs[ABOUT_TAB_GENERAL]); HWND hTitle = GetDlgItem(hDlg, IDC_ABOUT_TITLE); std::wstring progVers; if (GetWinMuteVersion(progVers)) { std::wstring progName = std::wstring{ L"WinMute " } + progVers; Static_SetText(hTitle, progName.c_str()); } // Set title font LOGFONT font; font.lfHeight = 32; font.lfWidth = 0; font.lfEscapement = 0; font.lfOrientation = 0; font.lfWeight = FW_BOLD; font.lfItalic = false; font.lfUnderline = false; font.lfStrikeOut = false; font.lfEscapement = 0; font.lfOrientation = 0; font.lfOutPrecision = OUT_DEFAULT_PRECIS; font.lfClipPrecision = CLIP_STROKE_PRECIS | CLIP_MASK | CLIP_TT_ALWAYS | CLIP_LH_ANGLES; font.lfQuality = CLEARTYPE_QUALITY; font.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN; wcscpy_s(font.lfFaceName, L"Segoe UI"); dlgData->hTitleFont = CreateFontIndirect(&font); SendMessage( hTitle, WM_SETFONT, reinterpret_cast(dlgData->hTitleFont), TRUE); HICON hIcon = LoadIcon( GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_TRAY_DARK)); SendMessageW(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast(hIcon)); return TRUE; } case WM_NOTIFY: { const LPNMHDR lpnmhdr = reinterpret_cast(lParam); #pragma warning(push) #pragma warning(disable : 26454) // Disable arithmetic overflow for TCN_SELCHANGE if (lpnmhdr->code == TCN_SELCHANGE && lpnmhdr->hwndFrom == dlgData->hTabCtrl) { #pragma warning(pop) const int curSel = TabCtrl_GetCurSel(dlgData->hTabCtrl); if (curSel >= 0 && curSel < ABOUT_TAB_COUNT) { SwitchTab(dlgData, dlgData->hTabs[curSel]); } } return 0; } case WM_COMMAND: if (LOWORD(wParam) == IDOK) { EndDialog(hDlg, 0); } return 0; case WM_DESTROY: DeleteObject(dlgData->hTitleFont); delete dlgData; SetWindowLongPtrW(hDlg, GWLP_USERDATA, 0); return 0; case WM_CLOSE: EndDialog(hDlg, 0); return TRUE; default: break; } return FALSE; } ================================================ FILE: WinMute/BluetoothDetector.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" BluetoothDetector::BluetoothDetector() : hNotifyWnd_(nullptr), hBluetoothNotify_(nullptr), initialized_(false), useDeviceList_(false) { } BluetoothDetector::~BluetoothDetector() { if (initialized_) { UnloadRadioNotifications(); } } void BluetoothDetector::UnloadRadioNotifications() noexcept { for (auto hDevNotify : notificationHandles_) { UnregisterDeviceNotification(hDevNotify); } notificationHandles_.clear(); } bool BluetoothDetector::LoadRadioNotifications() { bool success = false; auto& log = WMLog::GetInstance(); notificationHandles_.clear(); HANDLE btHandle = nullptr; const BLUETOOTH_FIND_RADIO_PARAMS bfrp = { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) }; HBLUETOOTH_RADIO_FIND hRadiosFind = BluetoothFindFirstRadio(&bfrp, &btHandle); if (hRadiosFind == nullptr) { log.LogWinError(L"BluetoothFindFirstRadio", GetLastError()); return false; } DEV_BROADCAST_HANDLE dbh = { 0 }; dbh.dbch_devicetype = DBT_DEVTYP_HANDLE; dbh.dbch_size = sizeof(dbh); dbh.dbch_eventguid = GUID_BLUETOOTH_RADIO_IN_RANGE; do { dbh.dbch_handle = btHandle; HDEVNOTIFY devNotify = RegisterDeviceNotification( hNotifyWnd_, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE); CloseHandle(btHandle); if (devNotify == nullptr) { log.LogWinError(L"RegisterDeviceNotification", GetLastError()); } else { notificationHandles_.push_back(devNotify); } } while (BluetoothFindNextRadio(hRadiosFind, &btHandle)); const DWORD dwLastError = GetLastError(); if (dwLastError != ERROR_NO_MORE_ITEMS) { log.LogWinError(L"BluetoothFindNextRadio", GetLastError()); UnloadRadioNotifications(); } else { success = true; } BluetoothFindRadioClose(hRadiosFind); return success; } bool BluetoothDetector::Init(HWND hNotifyWnd) { if (!initialized_) { hNotifyWnd_ = hNotifyWnd; if (LoadRadioNotifications()) { initialized_ = true; } } return initialized_; } void BluetoothDetector::Unload() { UnloadRadioNotifications(); hNotifyWnd_ = nullptr; initialized_ = false; } void BluetoothDetector::SetDeviceList( const std::vector& devices, bool useDeviceList) { deviceNames_ = devices; useDeviceList_ = useDeviceList; } BluetoothDetector::BluetoothStatus BluetoothDetector::GetBluetoothStatus( const UINT message, const WPARAM wParam, const LPARAM lParam) { if (message != WM_DEVICECHANGE || wParam != DBT_CUSTOMEVENT || lParam == 0) { return BluetoothStatus::Unknown; } const DEV_BROADCAST_HDR *header = reinterpret_cast(lParam); if (header->dbch_devicetype != DBT_DEVTYP_HANDLE) { return BluetoothStatus::Unknown; } const DEV_BROADCAST_HANDLE* handle = reinterpret_cast(header); if (!IsEqualGUID(handle->dbch_eventguid, GUID_BLUETOOTH_RADIO_IN_RANGE)) { return BluetoothStatus::Unknown; } const BTH_RADIO_IN_RANGE *inRangeInfo = reinterpret_cast(handle->dbch_data); if (inRangeInfo == nullptr) { return BluetoothStatus::Unknown; } // only react to audio devices and not (e. g.) game controllers if ((inRangeInfo->deviceInfo.flags & BDIF_COD) && GET_COD_MAJOR(inRangeInfo->deviceInfo.classOfDevice) != COD_MAJOR_AUDIO) { return BluetoothStatus::Unknown; } auto& log = WMLog::GetInstance(); if (useDeviceList_) { auto pos = std::find(begin(deviceNames_), end(deviceNames_), inRangeInfo->deviceInfo.name); if (pos == end(deviceNames_)) { log.LogInfo(L"Bluetooth device \"%S\" not in list.", inRangeInfo->deviceInfo.name); return BluetoothStatus::Unknown; } } if ((inRangeInfo->deviceInfo.flags & BDIF_CONNECTED) && !(inRangeInfo->previousDeviceFlags & BDIF_CONNECTED)) { log.LogInfo(L"Bluetooth Audio device \"%S\" connected.", inRangeInfo->deviceInfo.name); return BluetoothStatus::Connected; } else if (!(inRangeInfo->deviceInfo.flags & BDIF_CONNECTED) && (inRangeInfo->previousDeviceFlags & BDIF_CONNECTED)) { log.LogInfo(L"Bluetooth Audio device \"%S\" disconnected.", inRangeInfo->deviceInfo.name); return BluetoothStatus::Disconnected; } return BluetoothStatus::Unknown; } ================================================ FILE: WinMute/BluetoothDetector.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" /* wParam = Connected = 1 | Disconnected = 0. lParam = Pointer to Device Name */ constexpr int WM_BTSTATUSCHANGED = WM_USER + 500; class BluetoothDetector { public: enum class BluetoothStatus { Unknown, Connected, Disconnected }; BluetoothDetector(); ~BluetoothDetector(); BluetoothDetector(const WifiDetector&) = delete; BluetoothDetector(WifiDetector&&) = delete; BluetoothDetector& operator=(const WifiDetector&) = delete; BluetoothDetector& operator=(WifiDetector&&) = delete; void SetDeviceList(const std::vector& devices, bool useDeviceList); bool Init(HWND hNotifyWnd); void Unload(); BluetoothStatus GetBluetoothStatus( const UINT message, const WPARAM wParam, const LPARAM lParam); private: HWND hNotifyWnd_; HDEVNOTIFY hBluetoothNotify_; std::vector notificationHandles_; bool LoadRadioNotifications(); void UnloadRadioNotifications() noexcept; bool initialized_; bool useDeviceList_; std::vector deviceNames_; }; ================================================ FILE: WinMute/LogDialog.cpp ================================================ /* WinMute Copyright (c) 2024, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" struct LogDlgData { HWND hLogContent; }; INT_PTR CALLBACK LogDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { auto *dlgData = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); switch (msg) { case WM_INITDIALOG: { dlgData = new LogDlgData(); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(dlgData)); WMi18n &i18n = WMi18n::GetInstance(); SetWindowText(hDlg, i18n.GetTranslationW("log.title").c_str()); HICON hIcon = LoadIcon( GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_TRAY_DARK)); SendMessageW(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast(hIcon)); auto& wmLog = WMLog::GetInstance(); const auto logMessages = wmLog.GetLogMessages(); std::wstring logText; logText.reserve(logMessages.size() * 30); for (auto &lm : logMessages) { logText.append(wmLog.FormatLogMessage(lm, true)); } dlgData->hLogContent = GetDlgItem(hDlg, IDC_LOG_CONTENT); Edit_SetText(dlgData->hLogContent, logText.c_str()); wmLog.RegisterForLogUpdates(hDlg); // Initial sizing RECT rcClient; GetClientRect(hDlg, &rcClient); SetWindowPos( dlgData->hLogContent, nullptr, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_NOZORDER); return TRUE; } case WM_COMMAND: return 0; case WM_SIZE: { RECT rcClient; GetClientRect(hDlg, &rcClient); SetWindowPos( dlgData->hLogContent, nullptr, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_NOZORDER); return 0; } case WM_LOG_UPDATED: { const WMLog &wmLog = WMLog::GetInstance(); auto logMsg = reinterpret_cast(lParam); if (logMsg == nullptr) { return FALSE; } const auto formattedMsg = wmLog.FormatLogMessage(*logMsg, true); const auto textLen = Edit_GetTextLength(dlgData->hLogContent); Edit_SetSel(dlgData->hLogContent, textLen, textLen); Edit_ReplaceSel(dlgData->hLogContent, formattedMsg.c_str()); return TRUE; } case WM_DESTROY: delete dlgData; SetWindowLongPtrW(hDlg, GWLP_USERDATA, 0); WMLog::GetInstance().UnregisterForLogUpdates(hDlg); return 0; case WM_CLOSE: //EndDialog(hDlg, 0); DestroyWindow(hDlg); return TRUE; default: break; } return FALSE; } ================================================ FILE: WinMute/MMNotificationClient.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" #include "WinAudio.h" #include "MMNotificationClient.h" #include class WinAudio; MMNotificationClient::MMNotificationClient(WinAudio* notifyParent) : ref_count_(1), pEnumerator_(nullptr), notifyParent_(notifyParent) { } MMNotificationClient::~MMNotificationClient() { SafeRelease(&pEnumerator_); } STDMETHODIMP_(ULONG) MMNotificationClient::AddRef() { return ++ref_count_; } STDMETHODIMP_(ULONG) MMNotificationClient::Release() { const ULONG ref = --ref_count_; if (ref == 0) { delete this; } return ref; } STDMETHODIMP_(HRESULT) MMNotificationClient::QueryInterface( REFIID riid, VOID** ppvInterface) { if (IID_IUnknown == riid) { AddRef(); *ppvInterface = reinterpret_cast(this); } else if (__uuidof(IMMNotificationClient) == riid) { AddRef(); *ppvInterface = reinterpret_cast(this); } else { *ppvInterface = nullptr; return E_NOINTERFACE; } return S_OK; } STDMETHODIMP_(HRESULT) MMNotificationClient::OnDefaultDeviceChanged( EDataFlow, ERole, LPCWSTR) { return S_OK; } STDMETHODIMP_(HRESULT) MMNotificationClient::OnDeviceAdded(LPCWSTR pwstrDeviceId) { if (notifyParent_ && pwstrDeviceId != nullptr) { const auto deviceName = GetFriendlyDeviceName(pwstrDeviceId); WMLog::GetInstance().GetInstance().LogInfo(L"Device \"%s\" added", deviceName.c_str()); notifyParent_->ShouldReInit(); } return S_OK; } STDMETHODIMP_(HRESULT) MMNotificationClient::OnDeviceRemoved(LPCWSTR pwstrDeviceId) { if (notifyParent_ && pwstrDeviceId != nullptr) { const auto deviceName = GetFriendlyDeviceName(pwstrDeviceId); WMLog::GetInstance().GetInstance().LogInfo(L"Device \"%s\" removed", deviceName.c_str()); notifyParent_->ShouldReInit(); } return S_OK; } STDMETHODIMP_(HRESULT) MMNotificationClient::OnDeviceStateChanged( LPCWSTR pwstrDeviceId, DWORD dwNewState) { bool notify = true; std::wstring what; if (pwstrDeviceId == nullptr) { return S_OK; } if (dwNewState == DEVICE_STATE_NOTPRESENT) { what = L"Not present"; } else if (dwNewState == DEVICE_STATE_UNPLUGGED) { what = L"Unplugged"; } else if (dwNewState == DEVICE_STATE_ACTIVE) { what = L"Active"; } else { notify = false; } if (notify && notifyParent_) { // TODO: Check if output device const auto deviceName = GetFriendlyDeviceName(pwstrDeviceId); WMLog::GetInstance().GetInstance().LogInfo( L"Device \"%s\" status changed to %s", deviceName.c_str(), what.c_str()); notifyParent_->ShouldReInit(); } return S_OK; } STDMETHODIMP_(HRESULT) MMNotificationClient::OnPropertyValueChanged( LPCWSTR, const PROPERTYKEY) { return S_OK; } std::wstring MMNotificationClient:: GetFriendlyDeviceName(LPCWSTR pwstrDeviceId) { HRESULT hr = S_OK; IMMDevice *pDevice = nullptr; IPropertyStore *pProps = nullptr; PROPVARIANT varString; PropVariantInit(&varString); if (pEnumerator_ == nullptr) { // Get enumerator for audio endpoint devices. hr = CoCreateInstance( __uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER, __uuidof(IMMDeviceEnumerator), reinterpret_cast(&pEnumerator_)); } if (hr == S_OK) { hr = pEnumerator_->GetDevice(pwstrDeviceId, &pDevice); } if (hr == S_OK) { hr = pDevice->OpenPropertyStore(STGM_READ, &pProps); } if (hr == S_OK){ // Get the endpoint device's friendly-name property. hr = pProps->GetValue(PKEY_Device_FriendlyName, &varString); } std::wstring deviceName = L"Unknown device"; if (hr == S_OK) { deviceName = varString.pwszVal; } PropVariantClear(&varString); SafeRelease(&pProps); SafeRelease(&pDevice); return deviceName; } ================================================ FILE: WinMute/MMNotificationClient.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "Common.h" class WinAudio; class MMNotificationClient : public IMMNotificationClient { public: explicit MMNotificationClient(WinAudio* notifyParent); ~MMNotificationClient(); STDMETHODIMP_(ULONG) AddRef(); STDMETHODIMP_(ULONG) Release(); STDMETHODIMP_(HRESULT) QueryInterface(REFIID riid, VOID** ppvInterface); STDMETHODIMP_(HRESULT) OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId); STDMETHODIMP_(HRESULT) OnDeviceAdded(LPCWSTR pwstrDeviceId); STDMETHODIMP_(HRESULT) OnDeviceRemoved(LPCWSTR pwstrDeviceId); STDMETHODIMP_(HRESULT) OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState); STDMETHODIMP_(HRESULT) OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key); private: std::atomic ref_count_; IMMDeviceEnumerator* pEnumerator_; WinAudio* notifyParent_; std::wstring GetFriendlyDeviceName(LPCWSTR pwstrDeviceId); }; ================================================ FILE: WinMute/MuteControl.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" extern HINSTANCE hglobInstance; static const int BLUETOOTH_RECONNECT_UNMUTE_DELAY = 5000; // Milliseconds static const int MUTE_DELAY_MAGIC_VALUE = 0x198604; static const wchar_t* MUTECONTROL_CLASS_NAME = L"WinMuteMuteControl"; enum MuteType { // With restore MuteTypeWorkstationLock = 0, MuteTypeRemoteSession, MuteTypeDisplayStandby, MuteTypeBluetoothDisconnect, // Without restore MuteTypeLogout, MuteTypeSuspend, MuteTypeShutdown, MuteTypeCount // Meta }; void DelayedMuteTimerProc(HWND hWnd, UINT, UINT_PTR, DWORD) { MuteControl *muteCtrl = reinterpret_cast(GetWindowLongPtrW(hWnd, GWLP_USERDATA)); if (muteCtrl != nullptr) { muteCtrl->MuteDelayed(MUTE_DELAY_MAGIC_VALUE); } } static LRESULT CALLBACK MuteControlWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { auto wm = reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA)); switch (msg) { case WM_NCCREATE: { LPCREATESTRUCTW cs = reinterpret_cast(lParam); SetWindowLongPtrW(hWnd, GWLP_USERDATA, reinterpret_cast(cs->lpCreateParams)); return TRUE; } default: break; } return (wm) ? wm->WindowProc(hWnd, msg, wParam, lParam) : DefWindowProcW(hWnd, msg, wParam, lParam); } MuteControl::MuteControl() { MuteConfig initMuteConf; initMuteConf.active = false; initMuteConf.shouldMute = false; for (int i = 0; i < MuteTypeCount; ++i) { muteConfig_.push_back(initMuteConf); } } MuteControl::~MuteControl() { UnregisterClassW(MUTECONTROL_CLASS_NAME, hglobInstance); DestroyWindow(hMuteCtrlWnd_); } bool MuteControl::Init(HWND hParent, const TrayIcon *trayIcon) { WNDCLASSEXW wndClass{ 0 }; wndClass.cbSize = sizeof(wndClass); wndClass.lpfnWndProc = MuteControlWndProc; wndClass.hInstance = hglobInstance; wndClass.lpszClassName = MUTECONTROL_CLASS_NAME; if (!RegisterClassExW(&wndClass)) { WMLog::GetInstance().LogWinError(L"RegisterClassEx"); return false; } hMuteCtrlWnd_ = CreateWindowEx( WS_EX_TOOLWINDOW, MUTECONTROL_CLASS_NAME, L"", 0, 0, 0, 0, 0, nullptr, nullptr, hglobInstance, this); if (hMuteCtrlWnd_ == nullptr) { WMLog::GetInstance().LogWinError(L"CreateWindowEx"); UnregisterClassW(MUTECONTROL_CLASS_NAME, hglobInstance); return false; } winAudio_ = std::make_unique(); if (!winAudio_->Init(hParent)) { DestroyWindow(hMuteCtrlWnd_); UnregisterClassW(MUTECONTROL_CLASS_NAME, hglobInstance); return false; } trayIcon_ = trayIcon; return true; } LRESULT CALLBACK MuteControl::WindowProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hWnd, msg, wParam, lParam); } void MuteControl::SetMute(bool mute) { WMLog::GetInstance().LogInfo(L"Manual muting: %s", mute ? L"on" : L"off"); winAudio_->SetMute(mute); } void MuteControl::SaveMuteStatus() { const bool alreadySaved = std::any_of( muteConfig_.begin(), muteConfig_.end(), [](const MuteConfig &conf) { return conf.shouldMute && conf.active; } ); if (alreadySaved) { WMLog::GetInstance().LogInfo(L"Muting event already active. Skipping status save"); } else { WMLog::GetInstance().LogInfo(L"Saving mute status"); winAudio_->SaveMuteStatus(); } } void MuteControl::ShowNotification(const std::wstring& title, const std::wstring& text) { if (notificationsEnabled_ && trayIcon_ != nullptr) { trayIcon_->ShowPopup(title, text); } } void MuteControl::SetNotifications(bool enable) { notificationsEnabled_ = enable; } void MuteControl::MuteDelayed(int magic) { if (magic != MUTE_DELAY_MAGIC_VALUE || delayedMuteTimerId_ == 0) { return; } WMLog::GetInstance().LogInfo(L"Muting workstation after delay"); ShowNotification( WMi18n::GetInstance().GetTranslationW("popup.muting-workstation-after-delay.title"), WMi18n::GetInstance().GetTranslationW("popup.muting-workstation-after-delay.text")); winAudio_->SetMute(true); KillTimer(hMuteCtrlWnd_, delayedMuteTimerId_); delayedMuteTimerId_ = 0; } bool MuteControl::StartDelayedMute() { delayedMuteTimerId_ = SetTimer( hMuteCtrlWnd_, delayedMuteTimerId_, muteDelaySeconds_ * 1000, DelayedMuteTimerProc); if (delayedMuteTimerId_ == 0) { WMLog::GetInstance().LogWinError(L"SetTimer", GetLastError()); } return delayedMuteTimerId_ != 0; } void MuteControl::RestoreVolume(bool withDelay) { WMLog& log = WMLog::GetInstance(); if (!restoreVolume_) { log.LogInfo(L"Volume Restore has been disabled"); return; } const bool restore = !std::any_of( muteConfig_.begin(), muteConfig_.end(), [](const MuteConfig &conf) { return conf.shouldMute && conf.active; } ); if (!restore) { log.LogInfo(L"Skipping restore since other mute event is currently active"); } else if (delayedMuteTimerId_ != 0) { KillTimer(hMuteCtrlWnd_, delayedMuteTimerId_); delayedMuteTimerId_ = 0; log.LogInfo(L"Skipping restore, since delayed mute was not triggered yet"); } else { log.LogInfo(L"Restoring previous mute state"); ShowNotification( WMi18n::GetInstance().GetTranslationW("popup.volume-restored.title"), WMi18n::GetInstance().GetTranslationW("popup.volume-restored.text")); if (withDelay) { Sleep(BLUETOOTH_RECONNECT_UNMUTE_DELAY); } winAudio_->RestoreMuteStatus(); } } void MuteControl::SetRestoreVolume(bool enable) { restoreVolume_ = enable; } void MuteControl::SetMuteDelay(int delaySeconds) { muteDelaySeconds_ = delaySeconds; } void MuteControl::SetMuteOnWorkstationLock(bool enable) { muteConfig_[MuteTypeWorkstationLock].shouldMute = enable; } void MuteControl::SetMuteOnLogout(bool enable) { muteConfig_[MuteTypeLogout].shouldMute = enable; } void MuteControl::SetMuteOnSuspend(bool enable) { muteConfig_[MuteTypeSuspend].shouldMute = enable; } void MuteControl::SetMuteOnShutdown(bool enable) { muteConfig_[MuteTypeShutdown].shouldMute = enable; } void MuteControl::SetMuteOnRemoteSession(bool enable) { muteConfig_[MuteTypeRemoteSession].shouldMute = enable; } void MuteControl::SetMuteOnDisplayStandby(bool enable) { muteConfig_[MuteTypeDisplayStandby].shouldMute = enable; } void MuteControl::SetMuteOnBluetoothDisconnect(bool enable) { muteConfig_[MuteTypeBluetoothDisconnect].shouldMute = enable; } bool MuteControl::GetRestoreVolume() { return restoreVolume_; } bool MuteControl::GetMuteOnWorkstationLock() const { return muteConfig_[MuteTypeWorkstationLock].shouldMute; } bool MuteControl::GetMuteOnRemoteSession() const { return muteConfig_[MuteTypeRemoteSession].shouldMute; } bool MuteControl::GetMuteOnDisplayStandby() const { return muteConfig_[MuteTypeDisplayStandby].shouldMute; } bool MuteControl::GetMuteOnBluetoothDisconnect() const { return muteConfig_[MuteTypeBluetoothDisconnect].shouldMute; } bool MuteControl::GetMuteOnLogout() const { return muteConfig_[MuteTypeLogout].shouldMute; } bool MuteControl::GetMuteOnSuspend() const { return muteConfig_[MuteTypeSuspend].shouldMute; } bool MuteControl::GetMuteOnShutdown() const { return muteConfig_[MuteTypeShutdown].shouldMute; } void MuteControl::NotifyRestoreCondition(int type, bool active, bool withDelay) { if (active) { SaveMuteStatus(); muteConfig_[type].active = active; if (muteConfig_[type].shouldMute) { if (muteDelaySeconds_ == 0) { WMLog::GetInstance().LogInfo(L"Muting workstation"); ShowNotification( WMi18n::GetInstance().GetTranslationW("popup.muting-workstation.title"), WMi18n::GetInstance().GetTranslationW("popup.muting-workstation.text")); winAudio_->SetMute(true); } else { WMLog::GetInstance().LogInfo(L"Starting delayed mute timer..."); StartDelayedMute(); } } } else { if (muteConfig_[type].active) { muteConfig_[type].active = false; if (muteConfig_[type].shouldMute) { RestoreVolume(withDelay); } } } } void MuteControl::NotifyWorkstationLock(bool active) { WMLog::GetInstance().LogInfo(L"Mute Event: Workstation Lock %s", active ? L"start" : L"stop"); NotifyRestoreCondition(MuteTypeWorkstationLock, active); } void MuteControl::NotifyRemoteSession(bool active) { WMLog::GetInstance().LogInfo(L"Mute Event: Remote Session %s", active ? L"start" : L"stop"); NotifyRestoreCondition(MuteTypeRemoteSession, active); } void MuteControl::NotifyDisplayStandby(bool active) { if (displayWasOffOnce_ || active) { WMLog::GetInstance().LogInfo(L"Mute Event: Display Standby %s", active ? L"start" : L"stop"); NotifyRestoreCondition(MuteTypeDisplayStandby, active); displayWasOffOnce_ = true; } } void MuteControl::NotifyBluetoothConnected(bool connected) { WMLog::GetInstance().LogInfo( L"Mute Event: Bluetooth audio device %s", connected ? L"connected" : L"disconnected"); NotifyRestoreCondition(MuteTypeBluetoothDisconnect, !connected, true); } void MuteControl::NotifyLogout() { WMLog::GetInstance().LogInfo(L"Mute Event: Logout start"); if (muteConfig_[MuteTypeLogout].shouldMute) { winAudio_->SetMute(true); } } void MuteControl::NotifySuspend(bool /*active*/) { WMLog::GetInstance().LogInfo(L"Mute Event: Suspend start"); if (muteConfig_[MuteTypeSuspend].shouldMute) { winAudio_->SetMute(true); } } void MuteControl::NotifyShutdown() { WMLog::GetInstance().LogInfo(L"Mute Event: Shutdown start"); if (muteConfig_[MuteTypeShutdown].shouldMute) { winAudio_->SetMute(true); } } void MuteControl::NotifyQuietHours(bool active) { if (active) { SaveMuteStatus(); WMLog::GetInstance().LogInfo(L"Mute Event: Quiet Hours startet"); winAudio_->SaveMuteStatus(); winAudio_->SetMute(true); } else { WMLog::GetInstance().LogInfo(L"Mute Event: Quiet Hours ended"); RestoreVolume(); } } void MuteControl::SetManagedEndpoints( const std::vector& endpoints, bool isAllowList) { winAudio_->MuteSpecificEndpoints(true); winAudio_->SetManagedEndpoints(endpoints, isAllowList); } void MuteControl::ClearManagedEndpoints() { winAudio_->MuteSpecificEndpoints(false); } ================================================ FILE: WinMute/MuteControl.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" class MuteControl { public: MuteControl(); ~MuteControl(); MuteControl(const MuteControl&) = delete; MuteControl& operator=(const MuteControl&) = delete; bool Init(HWND hParent, const TrayIcon* trayIcon); void SetNotifications(bool enable); void SetMute(bool mute); void SetRestoreVolume(bool enable); void SetMuteDelay(int delaySeconds); void SetMuteOnWorkstationLock(bool enable); void SetMuteOnRemoteSession(bool enable); void SetMuteOnDisplayStandby(bool enable); void SetMuteOnBluetoothDisconnect(bool enable); void SetMuteOnLogout(bool enable); void SetMuteOnSuspend(bool enable); void SetMuteOnShutdown(bool enable); bool GetRestoreVolume(); bool GetMuteOnWorkstationLock() const; bool GetMuteOnRemoteSession() const; bool GetMuteOnDisplayStandby() const; bool GetMuteOnBluetoothDisconnect() const; bool GetMuteOnLogout() const; bool GetMuteOnSuspend() const; bool GetMuteOnShutdown() const; void NotifyWorkstationLock(bool active); void NotifyRemoteSession(bool active); void NotifyDisplayStandby(bool active); void NotifyBluetoothConnected(bool connected); void NotifyLogout(); void NotifySuspend(bool active); void NotifyShutdown(); void NotifyQuietHours(bool active); void SetManagedEndpoints( const std::vector& endpoints, bool isAllowList); void ClearManagedEndpoints(); LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); // Should only be called internally void MuteDelayed(int magic); private: struct MuteConfig { bool shouldMute; bool active; }; std::vector muteConfig_; bool restoreVolume_ = false; bool notificationsEnabled_ = false; int muteDelaySeconds_ = 0; UINT_PTR delayedMuteTimerId_ = 0; std::unique_ptr winAudio_; HWND hMuteCtrlWnd_ = nullptr; // Since a power message is sent right after registering // We skip the first "was on" message bool displayWasOffOnce_ = false; const TrayIcon* trayIcon_ = nullptr; void NotifyRestoreCondition(int type, bool active, bool withDelay = false); void SaveMuteStatus(); void RestoreVolume(bool withDelay = false); void ShowNotification(const std::wstring& title, const std::wstring& text); bool StartDelayedMute(); }; ================================================ FILE: WinMute/QuietHoursTimer.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" extern HINSTANCE hglobInstance; static constexpr int QUIETHOURS_TIMER_START_ID = 271020; static constexpr int QUIETHOURS_TIMER_END_ID = 271021; static std::int64_t ConvertSystemTimeTo100NS(const LPSYSTEMTIME sysTime) noexcept { FILETIME ft; SystemTimeToFileTime(sysTime, &ft); ULARGE_INTEGER ulInt; ulInt.HighPart = ft.dwHighDateTime; ulInt.LowPart = ft.dwLowDateTime; return static_cast(ulInt.QuadPart); } static bool IsQuietHours( const LPSYSTEMTIME now, const LPSYSTEMTIME qhStart, const LPSYSTEMTIME qhEnd) { const std::int64_t iStart = ConvertSystemTimeTo100NS(qhStart); std::int64_t iEnd = ConvertSystemTimeTo100NS(qhEnd); const std::int64_t iNow = ConvertSystemTimeTo100NS(now); if (iEnd < iStart) { // Add one day iEnd += 864000000000ll; } if (iEnd - iNow > 0 && iStart - iNow < 0) { return true; } return false; } /** * Gets the number of milliseconds that t2 would have to add, to reach t1. * Takes day wrap around into consideration. */ static int GetDiffMillseconds(const LPSYSTEMTIME t1, const LPSYSTEMTIME t2) { __int64 it1 = ConvertSystemTimeTo100NS(t1); __int64 it2 = ConvertSystemTimeTo100NS(t2); // 100NS to Milliseconds; it1 /= 10000; it2 /= 10000; if (it1 < it2) { // add one day wrap around it1 += 24 * 60 * 60 * 1000; } __int64 res = it1 - it2; return static_cast(res); } static VOID CALLBACK QuietHoursTimerProc(HWND hWnd, UINT msg, UINT_PTR id, DWORD msSinceSysStart) noexcept { UNREFERENCED_PARAMETER(msg); UNREFERENCED_PARAMETER(msSinceSysStart); if (id == QUIETHOURS_TIMER_START_ID) { KillTimer(hWnd, id); SendMessageW(hWnd, WM_WINMUTE_QUIETHOURS_START, 0, 0); } else if (id == QUIETHOURS_TIMER_END_ID) { KillTimer(hWnd, id); SendMessageW(hWnd, WM_WINMUTE_QUIETHOURS_END, 0, 0); } } QuietHoursTimer::QuietHoursTimer() : initialized_{ false }, enabled_{ false }, hParent_{ nullptr }, qhStart_{0}, qhEnd_{ 0 } { } QuietHoursTimer::~QuietHoursTimer() { if (initialized_ && enabled_) { KillTimer(hParent_, QUIETHOURS_TIMER_START_ID); KillTimer(hParent_, QUIETHOURS_TIMER_END_ID); } } bool QuietHoursTimer::LoadFromSettings(const WMSettings& settings) { KillTimer(hParent_, QUIETHOURS_TIMER_START_ID); KillTimer(hParent_, QUIETHOURS_TIMER_END_ID); if (!settings.QueryValue(SettingsKey::QUIETHOURS_ENABLE)) { enabled_ = false; return true; } qhStart_ = settings.QueryValue(SettingsKey::QUIETHOURS_START); qhEnd_ = settings.QueryValue(SettingsKey::QUIETHOURS_END); SYSTEMTIME now; SYSTEMTIME start; SYSTEMTIME end; GetLocalTime(&now); GetLocalTime(&start); GetLocalTime(&end); start.wSecond = static_cast(qhStart_ % 60); start.wMinute = static_cast(((qhStart_ - start.wSecond) / 60) % 60); start.wHour = static_cast((qhStart_ - start.wMinute - start.wSecond) / 3600); end.wSecond = static_cast(qhEnd_ % 60); end.wMinute = static_cast(((qhEnd_ - end.wSecond) / 60) % 60); end.wHour = static_cast((qhEnd_ - end.wMinute - end.wSecond) / 3600); if (IsQuietHours(&now, &start, &end)) { WMLog::GetInstance().LogInfo(L"Mute: On | Quiet hours have already started"); SendMessage(hParent_, WM_WINMUTE_QUIETHOURS_START, 0, 0); } else { int timerQhStart = GetDiffMillseconds(&start, &now); if (SetTimer( hParent_, QUIETHOURS_TIMER_START_ID, timerQhStart, QuietHoursTimerProc) == 0) { TaskDialog( hParent_, hglobInstance, PROGRAM_NAME, WMi18n::GetInstance().GetTranslationW("popup.error.quiet-hours-start.title").c_str(), WMi18n::GetInstance().GetTranslationW("popup.error.quiet-hours-start.text").c_str(), TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); return false; } } return true; } bool QuietHoursTimer::SetStart() { SYSTEMTIME now; SYSTEMTIME start; GetLocalTime(&now); GetLocalTime(&start); start.wSecond = static_cast(qhStart_ % 60); start.wMinute = static_cast(((qhStart_ - start.wSecond) / 60) % 60); start.wHour = static_cast((qhStart_ - start.wMinute - start.wSecond) / 3600); const int timerQhStart = GetDiffMillseconds(&start, &now); if (SetTimer( hParent_, QUIETHOURS_TIMER_START_ID, timerQhStart, QuietHoursTimerProc) == 0) { TaskDialog( hParent_, hglobInstance, PROGRAM_NAME, WMi18n::GetInstance().GetTranslationW("popup.error.quiet-hours-start.title").c_str(), WMi18n::GetInstance().GetTranslationW("popup.error.quiet-hours-start.text").c_str(), TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); return false; } return true; } bool QuietHoursTimer::SetEnd() { SYSTEMTIME now; SYSTEMTIME end; GetLocalTime(&now); GetLocalTime(&end); end.wSecond = static_cast(qhEnd_ % 60); end.wMinute = static_cast(((qhEnd_ - end.wSecond) / 60) % 60); end.wHour = static_cast((qhEnd_ - end.wMinute - end.wSecond) / 3600); int timerQhEnd = GetDiffMillseconds(&end, &now); if (timerQhEnd <= 0) { SendMessage(hParent_, WM_WINMUTE_QUIETHOURS_END, 0, 0); } else if (SetTimer( hParent_, QUIETHOURS_TIMER_END_ID, timerQhEnd, QuietHoursTimerProc) == 0) { TaskDialog( hParent_, hglobInstance, PROGRAM_NAME, WMi18n::GetInstance().GetTranslationW("popup.error.quiet-hours-start.title").c_str(), WMi18n::GetInstance().GetTranslationW("popup.error.quiet-hours-start.text").c_str(), TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); return false; } return true; } bool QuietHoursTimer::Init(HWND hParent, const WMSettings& settings) { if (initialized_) { return true; } hParent_ = hParent; initialized_ = true; return LoadFromSettings(settings); } bool QuietHoursTimer::IsQuietTime() { SYSTEMTIME now; SYSTEMTIME start; SYSTEMTIME end; GetLocalTime(&now); GetLocalTime(&start); GetLocalTime(&end); return IsQuietHours(&now, &start, &end); } bool QuietHoursTimer::Reset(const WMSettings& settings) { return LoadFromSettings(settings); } ================================================ FILE: WinMute/QuietHoursTimer.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" static constexpr int WM_WINMUTE_QUIETHOURS_START = WM_APP + 202; static constexpr int WM_WINMUTE_QUIETHOURS_END = WM_APP + 203; class QuietHoursTimer { public: QuietHoursTimer(); ~QuietHoursTimer(); QuietHoursTimer(const QuietHoursTimer&) = delete; QuietHoursTimer& operator=(const QuietHoursTimer&) = delete; bool Init(HWND hParent, const WMSettings& settings); bool IsQuietTime(); bool SetStart(); bool SetEnd(); bool Reset(const WMSettings& settings); private: HWND hParent_; bool initialized_; bool enabled_; time_t qhStart_; time_t qhEnd_; bool LoadFromSettings(const WMSettings& settings); }; ================================================ FILE: WinMute/SettingsDlg.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" enum SettingsTabsIDs { SETTINGS_TAB_GENERAL = 0, SETTINGS_TAB_MUTE, SETTINGS_TAB_QUIETHOURS, SETTINGS_TAB_BLUETOOTH, SETTINGS_TAB_WIFI, SETTINGS_TAB_COUNT }; struct SettingsDlgData { HWND hTabCtrl; HWND hTabs[SETTINGS_TAB_COUNT]; HWND hActiveTab; WMSettings* settings; explicit SettingsDlgData(WMSettings* settings) : settings(settings), hTabCtrl(nullptr), hActiveTab(nullptr) { ZeroMemory(hTabs, sizeof(hTabs)); } }; extern INT_PTR CALLBACK Settings_QuietHoursDlgProc(HWND, UINT, WPARAM, LPARAM); extern INT_PTR CALLBACK Settings_GeneralDlgProc(HWND, UINT, WPARAM, LPARAM); extern INT_PTR CALLBACK Settings_MuteDlgProc(HWND, UINT, WPARAM, LPARAM); extern INT_PTR CALLBACK Settings_BluetoothDlgProc(HWND, UINT, WPARAM, LPARAM); extern INT_PTR CALLBACK Settings_WifiDlgProc(HWND, UINT, WPARAM, LPARAM); extern HINSTANCE hglobInstance; static void InsertTabItem(HWND hTabCtrl, UINT id, const wchar_t *itemName) { constexpr int bufSize = 50; wchar_t buf[bufSize]; TC_ITEM tcItem; ZeroMemory(&tcItem, sizeof(tcItem)); tcItem.mask |= TCIF_TEXT; StringCchCopyW(buf, bufSize, itemName); tcItem.pszText = buf; tcItem.cchTextMax = bufSize; TabCtrl_InsertItem(hTabCtrl, id, &tcItem); } static void SwitchTab(SettingsDlgData* dlgData, HWND hNewTab) { if (dlgData->hActiveTab != nullptr) { ShowWindow(dlgData->hActiveTab, SW_HIDE); } dlgData->hActiveTab = hNewTab; ShowWindow(dlgData->hActiveTab, SW_SHOW); //SetFocus(dlgData->hActiveTab); } static void ResizeTabs(HWND hTabCtrl, HWND* hTabs, int tabCount) { RECT tabCtrlRect = { 0 }; GetWindowRect(hTabCtrl, &tabCtrlRect); POINT tabCtrlPos = { 0 }; tabCtrlPos.x = tabCtrlRect.left; tabCtrlPos.y = tabCtrlRect.top; ScreenToClient(GetParent(hTabCtrl), &tabCtrlPos); GetClientRect(hTabCtrl, &tabCtrlRect); TabCtrl_AdjustRect(hTabCtrl, FALSE, &tabCtrlRect); tabCtrlRect.left += tabCtrlPos.x; tabCtrlRect.top += tabCtrlPos.y; HDWP hdwp = BeginDeferWindowPos(tabCount); if (hdwp == nullptr) { ShowWindowsError(L"BeginDeferWindowPos", GetLastError()); } else { for (int i = 0; i < tabCount; ++i) { HDWP newHdwp = DeferWindowPos( hdwp, hTabs[i], HWND_TOP, tabCtrlRect.left, tabCtrlRect.top, tabCtrlRect.right - tabCtrlRect.left, tabCtrlRect.bottom - tabCtrlRect.top, 0); if (newHdwp == nullptr) { ShowWindowsError(L"DeferWindowPos", GetLastError()); break; } else { hdwp = newHdwp; } } EndDeferWindowPos(hdwp); } } INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { SettingsDlgData* dlgData = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); switch (msg) { case WM_INITDIALOG: { WMi18n &i18n = WMi18n::GetInstance(); assert(dlgData == nullptr); WMSettings* settings = reinterpret_cast(lParam); dlgData = new SettingsDlgData(settings); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(dlgData)); dlgData->hTabCtrl = GetDlgItem(hDlg, IDC_SETTINGS_TAB); SetWindowText(hDlg, i18n.GetTranslationW("settings.title").c_str()); i18n.SetItemText(hDlg, IDOK, "settings.btn-save"); i18n.SetItemText(hDlg, IDCANCEL, "settings.btn-cancel"); InsertTabItem(dlgData->hTabCtrl, SETTINGS_TAB_GENERAL, i18n.GetTranslationW("settings.tab.general").c_str()); InsertTabItem(dlgData->hTabCtrl, SETTINGS_TAB_MUTE, i18n.GetTranslationW("settings.tab.mute").c_str()); InsertTabItem(dlgData->hTabCtrl, SETTINGS_TAB_QUIETHOURS, i18n.GetTranslationW("settings.tab.quiet-hours").c_str()); InsertTabItem(dlgData->hTabCtrl, SETTINGS_TAB_BLUETOOTH, i18n.GetTranslationW("settings.tab.bluetooth").c_str()); InsertTabItem(dlgData->hTabCtrl, SETTINGS_TAB_WIFI, i18n.GetTranslationW("settings.tab.wifi").c_str()); dlgData->hTabs[SETTINGS_TAB_GENERAL] = CreateDialogParam( hglobInstance, MAKEINTRESOURCE(IDD_SETTINGS_GENERAL), hDlg, Settings_GeneralDlgProc, reinterpret_cast(settings)); dlgData->hTabs[SETTINGS_TAB_MUTE] = CreateDialogParam( hglobInstance, MAKEINTRESOURCE(IDD_SETTINGS_MUTE), hDlg, Settings_MuteDlgProc, reinterpret_cast(settings)); dlgData->hTabs[SETTINGS_TAB_QUIETHOURS] = CreateDialogParam( hglobInstance, MAKEINTRESOURCE(IDD_SETTINGS_QUIETHOURS), hDlg, Settings_QuietHoursDlgProc, reinterpret_cast(settings)); dlgData->hTabs[SETTINGS_TAB_WIFI] = CreateDialogParam( hglobInstance, MAKEINTRESOURCE(IDD_SETTINGS_WIFI), hDlg, Settings_WifiDlgProc, reinterpret_cast(settings)); dlgData->hTabs[SETTINGS_TAB_BLUETOOTH] = CreateDialogParam( hglobInstance, MAKEINTRESOURCE(IDD_SETTINGS_BLUETOOTH), hDlg, Settings_BluetoothDlgProc, reinterpret_cast(settings)); // Init tab pages ResizeTabs(dlgData->hTabCtrl, dlgData->hTabs, SETTINGS_TAB_COUNT); for (int i = 0; i < SETTINGS_TAB_COUNT; ++i) { HWND hCurTab = dlgData->hTabs[i]; ShowWindow(hCurTab, SW_HIDE); } HICON hIcon = LoadIcon( GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_SETTINGS)); SendMessageW(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast(hIcon)); SwitchTab(dlgData, dlgData->hTabs[SETTINGS_TAB_GENERAL]); return TRUE; } case WM_COMMAND: if (LOWORD(wParam) == IDOK) { for (int i = 0; i < SETTINGS_TAB_COUNT; ++i) { SendMessage(dlgData->hTabs[i], WM_SAVESETTINGS, 0, 0); EndDialog(dlgData->hTabs[i], 0); } EndDialog(hDlg, 0); } else if (LOWORD(wParam) == IDCANCEL) { for (int i = 0; i < SETTINGS_TAB_COUNT; ++i) { EndDialog(dlgData->hTabs[i], 0); } EndDialog(hDlg, 1); } return 0; case WM_NOTIFY: { const LPNMHDR lpnmhdr = reinterpret_cast(lParam); #pragma warning(push) #pragma warning(disable : 26454) // Disable arithmetic overflow warning for TCN_SELCHANGE if (lpnmhdr->code == TCN_SELCHANGE && lpnmhdr->hwndFrom == dlgData->hTabCtrl) { #pragma warning(pop) const int curSel = TabCtrl_GetCurSel(dlgData->hTabCtrl); if (curSel >= 0 && curSel < SETTINGS_TAB_COUNT) { SwitchTab(dlgData, dlgData->hTabs[curSel]); } } return 0; } case WM_CLOSE: EndDialog(hDlg, 1); return TRUE; case WM_DESTROY: delete dlgData; SetWindowLongPtrW(hDlg, GWLP_USERDATA, 0); return 0; default: break; } return FALSE; } ================================================ FILE: WinMute/Settings_BluetoothDlg.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" static constexpr int BT_DEV_NAME_MAX_LEN = 100; struct BtDeviceData { std::wstring devName; }; static bool GetPairedBtAudioDevices(std::vector& devices) { auto& log = WMLog::GetInstance(); BLUETOOTH_DEVICE_SEARCH_PARAMS bfrp; ZeroMemory(&bfrp, sizeof(bfrp)); bfrp.dwSize = sizeof(bfrp); bfrp.fReturnRemembered = 1; BLUETOOTH_DEVICE_INFO btdi; ZeroMemory(&btdi, sizeof(btdi)); btdi.dwSize = sizeof(btdi); HBLUETOOTH_DEVICE_FIND hBtDevFind = BluetoothFindFirstDevice(&bfrp, &btdi); if (hBtDevFind == nullptr) { log.LogWinError(L"BluetoothFindFirstDevice", GetLastError()); } else { do { if (GET_COD_MAJOR(btdi.ulClassofDevice) == COD_MAJOR_AUDIO) { devices.push_back(btdi.szName); } } while (BluetoothFindNextDevice(hBtDevFind, &btdi)); BluetoothFindDeviceClose(hBtDevFind); return true; } return false; } static void LoadBluetoothAddDlgTranslation(HWND hDlg, bool isEdit) { WMi18n &i18n = WMi18n::GetInstance(); if (isEdit) { i18n.SetItemText(hDlg, "settings.bluetooth.add-edit.edit-title"); } else { i18n.SetItemText(hDlg, "settings.bluetooth.add-edit.add-title"); } i18n.SetItemText(hDlg, IDC_LABEL_BT_DEVICE_NAME, "settings.bluetooth.add-edit.device-name-label"); i18n.SetItemText(hDlg, IDOK, "settings.btn-save"); i18n.SetItemText(hDlg, IDCANCEL, "settings.btn-cancel"); const auto placeholder = i18n.GetTranslationW("settings.bluetooth.add-edit.enter-device-name-placeholder"); ComboBox_SetCueBannerText( GetDlgItem(hDlg, IDC_BT_DEVICE_NAME), placeholder.c_str()); } static INT_PTR CALLBACK Settings_BluetoothAddDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { HWND hBtDevName = GetDlgItem(hDlg, IDC_BT_DEVICE_NAME); BtDeviceData* btDeviceData = reinterpret_cast(lParam); if (btDeviceData == nullptr) { return FALSE; } SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(btDeviceData)); LoadBluetoothAddDlgTranslation(hDlg, btDeviceData->devName.length() != 0); if (btDeviceData->devName.length() != 0) { SetWindowTextW(GetDlgItem(hDlg, IDC_BT_DEVICE_NAME), btDeviceData->devName.c_str()); } // Disable save button until at least one string change is made EnableWindow(GetDlgItem(hDlg, IDOK), FALSE); // Fill Combobox std::vector registeredBtDevices; if (GetPairedBtAudioDevices(registeredBtDevices)) { for (const auto& devName : registeredBtDevices) { ComboBox_AddString(hBtDevName, devName.c_str()); } } ComboBox_SetExtendedUI(hBtDevName, TRUE); Edit_LimitText(hBtDevName, BT_DEV_NAME_MAX_LEN); if (GetDlgCtrlID(reinterpret_cast(wParam)) != IDC_BT_DEVICE_NAME) { SetFocus(hBtDevName); return FALSE; } return TRUE; } case WM_COMMAND: { if (LOWORD(wParam) == IDC_BT_DEVICE_NAME) { HWND hDevName = GetDlgItem(hDlg, IDC_BT_DEVICE_NAME); if (HIWORD(wParam) == CBN_EDITUPDATE) { const int textLen = Edit_GetTextLength(hDevName); EnableWindow(GetDlgItem(hDlg, IDOK), textLen > 0); } else if (HIWORD(wParam) == CBN_SELCHANGE) { const auto curSelIdx = SendMessage(hDevName, CB_GETCURSEL, 0, 0); EnableWindow(GetDlgItem(hDlg, IDOK), curSelIdx != CB_ERR); } } else if (LOWORD(wParam) == IDOK) { HWND hDevName = GetDlgItem(hDlg, IDC_BT_DEVICE_NAME); const int textLen = Edit_GetTextLength(hDevName); if (textLen != 0) { wchar_t devNameBuf[BT_DEV_NAME_MAX_LEN + 1] = { 'L\0' }; BtDeviceData* btDevName = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); if (btDevName != nullptr) { Edit_GetText(hDevName, devNameBuf, ARRAY_SIZE(devNameBuf)); btDevName->devName = devNameBuf; EndDialog(hDlg, 0); } else { EndDialog(hDlg, 1); } } } else if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, 1); } return FALSE; } case WM_CLOSE: EndDialog(hDlg, 1); return TRUE; default: break; } return FALSE; } static std::vector ExportBluetoothDeviceList(HWND hList) { std::vector items; DWORD itemCount = ListBox_GetCount(hList); for (DWORD i = 0; i < itemCount; ++i) { wchar_t textBuf[BT_DEV_NAME_MAX_LEN + 1] = { 0 }; DWORD textLen = ListBox_GetTextLen(hList, i); if (textLen < ARRAY_SIZE(textBuf)) { ListBox_GetText(hList, i, textBuf); items.push_back(textBuf); } } return items; } static bool IsBluetoothAvailable() noexcept { HANDLE btHandle; BLUETOOTH_FIND_RADIO_PARAMS bfrp = { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) }; HBLUETOOTH_RADIO_FIND hRadiosFind = BluetoothFindFirstRadio(&bfrp, &btHandle); if (hRadiosFind == nullptr) { return false; } BluetoothFindRadioClose(hRadiosFind); return true; } static BOOL CALLBACK ShowChildWindow(HWND hWnd, LPARAM lParam) noexcept { ShowWindow(hWnd, static_cast(lParam)); return TRUE; } static void LoadBluetoothDlgTranslation(HWND hDlg) { WMi18n &i18n = WMi18n::GetInstance(); i18n.SetItemText(hDlg, IDC_BLUETOOTH_DESCRIPTION_LABEL, "settings.bluetooth.description"); i18n.SetItemText(hDlg, IDC_ENABLE_BLUETOOTH_MUTE, "settings.bluetooth.enable-muting"); i18n.SetItemText(hDlg, IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST, "settings.bluetooth.enable-muting-filter"); i18n.SetItemText(hDlg, IDC_BLUETOOTH_ADD, "settings.btn-add"); i18n.SetItemText(hDlg, IDC_BLUETOOTH_EDIT, "settings.btn-edit"); i18n.SetItemText(hDlg, IDC_BLUETOOTH_REMOVE, "settings.btn-remove"); i18n.SetItemText(hDlg, IDC_BLUETOOTH_REMOVEALL, "settings.btn-remove-all"); } INT_PTR CALLBACK Settings_BluetoothDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { if (IsAppThemed()) { EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB); } LoadBluetoothDlgTranslation(hDlg); WMSettings* settings = reinterpret_cast(lParam); assert(settings != nullptr); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(settings)); DWORD enabled = settings->QueryValue(SettingsKey::MUTE_ON_BLUETOOTH); Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE), enabled ? BST_CHECKED : BST_UNCHECKED); Button_Enable(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST), enabled); enabled = settings->QueryValue(SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST); Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST), enabled ? BST_CHECKED : BST_UNCHECKED); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_EDIT), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVE), FALSE); HWND hList = GetDlgItem(hDlg, IDC_BLUETOOTH_LIST); const auto devices = settings->GetBluetoothDevicesW(); for (const auto& dev : devices) { ListBox_AddString(hList, dev.c_str()); } Button_Enable( GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVEALL), ListBox_GetCount(hList) > 0); if (!IsBluetoothAvailable()) { // Set defaults Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE), BST_UNCHECKED); Button_Enable(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE), FALSE); Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST), BST_UNCHECKED); Button_Enable(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST), FALSE); // Hide all child windows, except the notice EnumChildWindows(hDlg, ShowChildWindow, SW_HIDE); HWND hDescription = GetDlgItem(hDlg, IDC_BLUETOOTH_DESCRIPTION_LABEL); WMi18n::GetInstance().SetItemText(hDescription, "settings.bluetooth.bluetooth-disabled-info"); RECT r; GetClientRect(hDescription, &r); constexpr int margin = 20; SetWindowPos( hDescription, HWND_TOP, margin, margin, r.right, r.bottom, SWP_SHOWWINDOW); } return TRUE; } case WM_COMMAND: { if (LOWORD(wParam) == IDC_ENABLE_BLUETOOTH_MUTE) { const DWORD checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE)); Button_Enable(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST), checked == BST_CHECKED); } else if (LOWORD(wParam) == IDC_BLUETOOTH_LIST) { HWND hList = GetDlgItem(hDlg, IDC_BLUETOOTH_LIST); if (HIWORD(wParam) == LBN_SELCHANGE || HIWORD(wParam) == LBN_SELCANCEL) { const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_EDIT), entrySelected); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVE), entrySelected); } else if (HIWORD(wParam) == LBN_KILLFOCUS) { const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_EDIT), entrySelected); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVE), entrySelected); } } else if (LOWORD(wParam) == IDC_BLUETOOTH_ADD) { BtDeviceData btDeviceName; if (DialogBoxParam( nullptr, MAKEINTRESOURCE(IDD_SETTINGS_BLUETOOTH_ADD), hDlg, Settings_BluetoothAddDlgProc, reinterpret_cast(&btDeviceName)) == 0) { std::vector devices = ExportBluetoothDeviceList(GetDlgItem(hDlg, IDC_BLUETOOTH_LIST)); if (std::find(begin(devices), end(devices), btDeviceName.devName) == end(devices)) { ListBox_AddString( GetDlgItem(hDlg, IDC_BLUETOOTH_LIST), btDeviceName.devName.c_str()); HWND hRemoveAll = GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVEALL); if (!IsWindowEnabled(hRemoveAll)) { Button_Enable(hRemoveAll, TRUE); } } } } else if (LOWORD(wParam) == IDC_BLUETOOTH_EDIT) { HWND hList = GetDlgItem(hDlg, IDC_BLUETOOTH_LIST); const WPARAM sel = ListBox_GetCurSel(hList); if (sel != LB_ERR) { const int len = ListBox_GetTextLen(hList, sel); wchar_t* textBuf = nullptr; if (len != LB_ERR) { if ((textBuf = new wchar_t[static_cast(len) + 1]) != nullptr) { ListBox_GetText(hList, sel, textBuf); BtDeviceData btDevName; btDevName.devName = textBuf; delete[] textBuf; if (DialogBoxParam( nullptr, MAKEINTRESOURCE(IDD_SETTINGS_BLUETOOTH_ADD), hDlg, Settings_BluetoothAddDlgProc, reinterpret_cast(&btDevName)) == 0) { std::vector networks = ExportBluetoothDeviceList(GetDlgItem(hDlg, IDC_WIFI_LIST)); if (std::find(begin(networks), end(networks), btDevName.devName) == end(networks)) { ListBox_InsertString(hList, sel, btDevName.devName.c_str()); ListBox_DeleteString(hList, sel + 1); } else { ListBox_DeleteString(hList, sel); } } } } } } else if (LOWORD(wParam) == IDC_BLUETOOTH_REMOVE) { HWND hList = GetDlgItem(hDlg, IDC_BLUETOOTH_LIST); const WPARAM sel = ListBox_GetCurSel(hList); if (sel != LB_ERR) { ListBox_DeleteString(hList, sel); if (ListBox_GetCount(hList) == 0) { Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_EDIT), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVE), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVEALL), FALSE); } } } else if (LOWORD(wParam) == IDC_BLUETOOTH_REMOVEALL) { ListBox_ResetContent(GetDlgItem(hDlg, IDC_BLUETOOTH_LIST)); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_EDIT), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVE), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVEALL), FALSE); } return 0; } case WM_SAVESETTINGS: { WMSettings* settings = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); std::vector devices = ExportBluetoothDeviceList(GetDlgItem(hDlg, IDC_BLUETOOTH_LIST)); settings->StoreBluetoothDevices(devices); DWORD checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE)); settings->SetValue(SettingsKey::MUTE_ON_BLUETOOTH, checked == BST_CHECKED); checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST)); settings->SetValue(SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST, checked == BST_CHECKED); return 0; } default: break; } return FALSE; } ================================================ FILE: WinMute/Settings_GeneralDlg.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" namespace fs = std::filesystem; extern INT_PTR CALLBACK LogDlgProc(HWND, UINT, WPARAM, LPARAM); extern HINSTANCE hglobInstance; struct SettingsGeneralData { WMSettings *settings = nullptr; std::vector langModules; }; static void FillLanguageList(HWND hLanguageList, const SettingsGeneralData& dlgData) { SendMessage(hLanguageList, CB_INITSTORAGE, static_cast(dlgData.langModules.size() + 1), (MAX_PATH + 1) * sizeof(wchar_t)); for (const auto &lang : dlgData.langModules) { const auto itemId = SendMessage(hLanguageList, CB_ADDSTRING, 0, reinterpret_cast(lang.langName.c_str())); if (itemId == CB_ERR || itemId == CB_ERRSPACE) { WMLog::GetInstance().LogError(L"Failed to add language %ls to language selector", lang.langName.c_str()); } else { ComboBox_SetItemData(hLanguageList, itemId, lang.fileName.c_str()); } } ComboBox_SelectString(hLanguageList, 0, WMi18n::GetInstance().GetCurrentLanguageName().c_str()); } static void LoadSettingsGeneralDlgTranslation(HWND hDlg) { WMi18n &i18n = WMi18n::GetInstance(); const auto helpTranslateLink = std::vformat( L"{}", std::make_wformat_args(i18n.GetTranslationW("settings.general.help-translating"))); SetDlgItemText(hDlg, IDC_LINK_HELP_TRANSLATING, helpTranslateLink.c_str()); i18n.SetItemText(hDlg, IDC_SELECT_LANGUAGE_LABEL, "settings.general.select-language-label"); i18n.SetItemText(hDlg, IDC_RUNONSTARTUP, "settings.general.run-on-startup"); i18n.SetItemText(hDlg, IDC_CHECK_FOR_UPDATES_ON_STARTUP, "settings.general.check-for-updates-on-start"); i18n.SetItemText(hDlg, IDC_CHECK_FOR_BETA_UPDATES, "settings.general.check-for-beta-updates-on-start"); i18n.SetItemText(hDlg, IDC_ENABLELOGGING, "settings.general.enable-logging"); i18n.SetItemText(hDlg, IDC_OPENLOG, "settings.general.btn-open-log-file"); i18n.SetItemText(hDlg, IDC_UPDATE_OPTIONS_DISABLED, "settings.general.updates-handled-externally"); i18n.SetItemText(hDlg, IDC_OPENLOGDLG, "settings.general.btn-open-log-window"); } INT_PTR CALLBACK Settings_GeneralDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { HWND hAutostart = GetDlgItem(hDlg, IDC_RUNONSTARTUP); HWND hUpdateCheck = GetDlgItem(hDlg, IDC_CHECK_FOR_UPDATES_ON_STARTUP); HWND hBetaUpdateCheck = GetDlgItem(hDlg, IDC_CHECK_FOR_BETA_UPDATES); HWND hLogging = GetDlgItem(hDlg, IDC_ENABLELOGGING); HWND hOpenLog = GetDlgItem(hDlg, IDC_OPENLOG); HWND hUpdatesDisabledNotice = GetDlgItem(hDlg, IDC_UPDATE_OPTIONS_DISABLED); if (IsAppThemed()) { EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB); } LoadSettingsGeneralDlgTranslation(hDlg); SettingsGeneralData *dlgData = new SettingsGeneralData; memset(dlgData, 0, sizeof(*dlgData)); dlgData->langModules = WMi18n::GetInstance().GetAvailableLanguages(); dlgData->settings = reinterpret_cast(lParam); assert(dlgData->settings != nullptr); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(dlgData)); FillLanguageList(GetDlgItem(hDlg, IDC_LANGUAGE), *dlgData); DWORD enabled = dlgData->settings->IsAutostartEnabled(); Button_SetCheck(hAutostart, enabled ? BST_CHECKED : BST_UNCHECKED); enabled = !!dlgData->settings->QueryValue(SettingsKey::CHECK_FOR_UPDATE); Button_SetCheck(hUpdateCheck, enabled ? BST_CHECKED : BST_UNCHECKED); EnableWindow(hBetaUpdateCheck, enabled); enabled = !!dlgData->settings->QueryValue(SettingsKey::CHECK_FOR_BETA_UPDATE); Button_SetCheck(hBetaUpdateCheck, enabled ? BST_CHECKED : BST_UNCHECKED); // If the disable-update file is present, then also hide all options UpdateChecker updateChecker; if (updateChecker.IsUpdateCheckDisabledViaFile()) { EnableWindow(hUpdateCheck, FALSE); EnableWindow(hBetaUpdateCheck, FALSE); Button_SetCheck(hUpdateCheck, BST_UNCHECKED); Button_SetCheck(hBetaUpdateCheck, BST_UNCHECKED); ShowWindow(hUpdatesDisabledNotice, SW_SHOW); } else { ShowWindow(hUpdatesDisabledNotice, SW_HIDE); } enabled = !!dlgData->settings->QueryValue(SettingsKey::LOGGING_ENABLED); Button_SetCheck(hLogging, enabled ? BST_CHECKED : BST_UNCHECKED); Button_Enable(hOpenLog, enabled); if (enabled) { WMLog& log = WMLog::GetInstance(); const std::wstring filePath = log.GetLogFilePath().c_str(); SendMessageW(GetDlgItem(hDlg, IDC_LOGFILEPATH), WM_SETTEXT, 0, reinterpret_cast(filePath.c_str())); } else { SendMessageW(GetDlgItem(hDlg, IDC_LOGFILEPATH), WM_SETTEXT, 0, reinterpret_cast(L"")); } return TRUE; } case WM_DESTROY: { SettingsGeneralData *dlgData = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); if (dlgData != nullptr) { delete dlgData; SetWindowLongPtr(hDlg, GWLP_USERDATA, 0); } return FALSE; } case WM_NOTIFY: { const PNMLINK pNmLink = reinterpret_cast(lParam); #pragma warning(push) #pragma warning(disable : 26454) // Disable arithmetic overflow warning for NM_CLICK and NM_RETURN if (pNmLink->hdr.code == NM_CLICK || pNmLink->hdr.code == NM_RETURN) { #pragma warning(pop) const UINT_PTR ctrlId = pNmLink->hdr.idFrom; const LITEM item = pNmLink->item; if ((ctrlId == IDC_LINK_HELP_TRANSLATING) && item.iLink == 0) { LaunchBrowser(hDlg, item.szUrl); } } return TRUE; } case WM_COMMAND: { if (LOWORD(wParam) == IDC_ENABLELOGGING) { DWORD checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLELOGGING)); Button_Enable(GetDlgItem(hDlg, IDC_OPENLOG), checked == BST_CHECKED); if (checked == BST_CHECKED) { WMLog& log = WMLog::GetInstance(); const std::wstring filePath = log.GetLogFilePath().c_str(); SendMessageW(GetDlgItem(hDlg, IDC_LOGFILEPATH), WM_SETTEXT, 0, reinterpret_cast(filePath.c_str())); } else { SendMessageW(GetDlgItem(hDlg, IDC_LOGFILEPATH), WM_SETTEXT, 0, reinterpret_cast(L"")); } } else if (LOWORD(wParam) == IDC_OPENLOGDLG) { auto hLogDlg = CreateDialogW( hglobInstance, MAKEINTRESOURCEW(IDD_LOG), hDlg, LogDlgProc); ShowWindow(hLogDlg, SW_SHOW); } else if (LOWORD(wParam) == IDC_CHECK_FOR_UPDATES_ON_STARTUP) { const int enabled = Button_GetCheck(GetDlgItem(hDlg, IDC_CHECK_FOR_UPDATES_ON_STARTUP)); EnableWindow(GetDlgItem(hDlg, IDC_CHECK_FOR_BETA_UPDATES), enabled); } else if (LOWORD(wParam) == IDC_OPENLOG) { WMLog& log = WMLog::GetInstance(); const std::wstring filePath = log.GetLogFilePath().c_str(); ShellExecuteW(nullptr, L"open", filePath.c_str(), nullptr, nullptr, SW_SHOW); } return 0; } case WM_SAVESETTINGS: { SettingsGeneralData *dlgData = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); assert(dlgData != nullptr); HWND hAutostart = GetDlgItem(hDlg, IDC_RUNONSTARTUP); HWND hLogging = GetDlgItem(hDlg, IDC_ENABLELOGGING); HWND hUpdateCheck = GetDlgItem(hDlg, IDC_CHECK_FOR_UPDATES_ON_STARTUP); HWND hBetaUpdateCheck = GetDlgItem(hDlg, IDC_CHECK_FOR_BETA_UPDATES); const int enableLog = Button_GetCheck(hLogging) == BST_CHECKED; dlgData->settings->SetValue(SettingsKey::LOGGING_ENABLED, enableLog); WMLog::GetInstance().EnableLogFile(enableLog); HWND hLanguageSelector = GetDlgItem(hDlg, IDC_LANGUAGE); const auto curLangSel = ComboBox_GetCurSel(hLanguageSelector); if (curLangSel != CB_ERR) { const wchar_t *selectedLang = reinterpret_cast(ComboBox_GetItemData(hLanguageSelector, curLangSel)); if (selectedLang != nullptr) { if (!WMi18n::GetInstance().LoadLanguage(selectedLang)) { TaskDialog( hDlg, hglobInstance, PROGRAM_NAME, L"Failed to load selected language.", L"Please report this error to the WinMute issue tracker.", TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); } else { dlgData->settings->SetValue(SettingsKey::APP_LANGUAGE, selectedLang); } } } const int enableUpdateCheck = Button_GetCheck(hUpdateCheck) == BST_CHECKED; dlgData->settings->SetValue(SettingsKey::CHECK_FOR_UPDATE, enableUpdateCheck); const int enableBetaUpdateCheck = Button_GetCheck(hBetaUpdateCheck) == BST_CHECKED; dlgData->settings->SetValue(SettingsKey::CHECK_FOR_BETA_UPDATE, enableBetaUpdateCheck); if (Button_GetCheck(hAutostart) == BST_CHECKED) { dlgData->settings->EnableAutostart(true); } else { dlgData->settings->EnableAutostart(false); } return 0; } default: break; } return FALSE; } ================================================ FILE: WinMute/Settings_ManageEndpointsDlg.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" #include #include static constexpr int ENDPOINT_NAME_MAX_LEN = 200; struct EndpointData { std::wstring name; }; _COM_SMARTPTR_TYPEDEF(IPropertyStore, __uuidof(IPropertyStore)); _COM_SMARTPTR_TYPEDEF(IMMDevice, __uuidof(IMMDevice)); _COM_SMARTPTR_TYPEDEF(IMMDeviceEnumerator, __uuidof(IMMDeviceEnumerator)); _COM_SMARTPTR_TYPEDEF(IMMDeviceCollection, __uuidof(IMMDeviceCollection)); static bool GetAudioEndpoints(std::vector& endpoints) { WMLog &log = WMLog::GetInstance(); IMMDeviceEnumeratorPtr deviceEnumerator; if (FAILED(deviceEnumerator.CreateInstance( __uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER))) { return false; } IMMDeviceCollectionPtr audioEndpoints; if (FAILED(deviceEnumerator->EnumAudioEndpoints( eRender, DEVICE_STATE_ACTIVE, &audioEndpoints))) { return false; } UINT epCount = 0; if (FAILED(audioEndpoints->GetCount(&epCount))) { return false; } for (UINT i = 0; i < epCount; ++i) { IMMDevicePtr device = nullptr; if (FAILED(audioEndpoints->Item(i, &device))) { log.LogError(L"Failed to get audio endpoint #%d", i); continue; } IPropertyStorePtr propStore = nullptr; if (FAILED(device->OpenPropertyStore(STGM_READ, &propStore))) { log.LogError(L"Failed to open property store for audio endpoint #%d", i); continue; } PROPVARIANT value; PropVariantInit(&value); if (FAILED(propStore->GetValue(PKEY_Device_FriendlyName, &value))) { log.LogError(L"Failed to get device name for audio endpoint #%d", i); continue; } wchar_t deviceName[100]; StringCchCopy(deviceName, sizeof(deviceName) / sizeof(deviceName[0]), value.pwszVal); PropVariantClear(&value); endpoints.push_back(deviceName); } return true; } static void LoadManageEndpointsAddDlgTranslation(HWND hDlg, bool isEdit) { WMi18n &i18n = WMi18n::GetInstance(); if (isEdit) { i18n.SetItemText(hDlg, "settings.mute.manage-endpoints.add-edit.edit-title"); } else { i18n.SetItemText(hDlg, "settings.mute.manage-endpoints.add-edit.add-title"); } i18n.SetItemText(hDlg, IDC_ENDPOINT_NAME_LABEL, "settings.bluetooth.add-edit.device-name-label"); i18n.SetItemText(hDlg, IDOK, "settings.btn-save"); i18n.SetItemText(hDlg, IDCANCEL, "settings.btn-cancel"); const auto placeholder = i18n.GetTranslationW("settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder"); ComboBox_SetCueBannerText( GetDlgItem(hDlg, IDC_ENDPOINT_NAME), placeholder.c_str()); } static INT_PTR CALLBACK Settings_EndpointAddDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { HWND hEndpointName = GetDlgItem(hDlg, IDC_ENDPOINT_NAME); EndpointData *endpointData = reinterpret_cast(lParam); if (endpointData == nullptr) { return FALSE; } SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(endpointData)); LoadManageEndpointsAddDlgTranslation(hDlg, endpointData->name.length() != 0); if (endpointData->name.length() != 0) { SetWindowTextW(GetDlgItem(hDlg, IDC_ENDPOINT_NAME), endpointData->name.c_str()); } // Disable save button until at least one string change is made EnableWindow(GetDlgItem(hDlg, IDOK), FALSE); // Fill Combobox std::vector audioEndpoints; if (GetAudioEndpoints(audioEndpoints)) { for (const auto &devName : audioEndpoints) { ComboBox_AddString(hEndpointName, devName.c_str()); } } Edit_LimitText(hEndpointName, ENDPOINT_NAME_MAX_LEN); if (GetDlgCtrlID(reinterpret_cast(wParam)) != IDC_ENDPOINT_NAME) { SetFocus(hEndpointName); return FALSE; } return TRUE; } case WM_COMMAND: if (LOWORD(wParam) == IDC_ENDPOINT_NAME) { HWND hDevName = GetDlgItem(hDlg, IDC_ENDPOINT_NAME); if (HIWORD(wParam) == CBN_EDITUPDATE) { const int textLen = Edit_GetTextLength(hDevName); EnableWindow(GetDlgItem(hDlg, IDOK), textLen > 0); } else if (HIWORD(wParam) == CBN_SELCHANGE) { const auto curSelIdx = SendMessage(hDevName, CB_GETCURSEL, 0, 0); EnableWindow(GetDlgItem(hDlg, IDOK), curSelIdx != CB_ERR); } } else if (LOWORD(wParam) == IDOK) { HWND hEpName = GetDlgItem(hDlg, IDC_ENDPOINT_NAME); const int textLen = Edit_GetTextLength(hEpName); if (textLen != 0) { wchar_t epNameBuf[ENDPOINT_NAME_MAX_LEN + 1] = { 'L\0' }; EndpointData *epData = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); if (epData != nullptr) { Edit_GetText(hEpName, epNameBuf, ARRAY_SIZE(epNameBuf)); epData->name = epNameBuf; EndDialog(hDlg, 0); } else { EndDialog(hDlg, 1); } } } else if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, 1); } return FALSE; case WM_CLOSE: EndDialog(hDlg, 1); return TRUE; default: break; } return FALSE; } static std::vector ExportEndpointNameList(HWND hList) { std::vector items; DWORD itemCount = ListBox_GetCount(hList); for (DWORD i = 0; i < itemCount; ++i) { wchar_t textBuf[ENDPOINT_NAME_MAX_LEN + 1] = { 0 }; DWORD textLen = ListBox_GetTextLen(hList, i); if (textLen < ARRAY_SIZE(textBuf)) { ListBox_GetText(hList, i, textBuf); items.push_back(textBuf); } } return items; } static void LoadManageEndpointsDlgTranslation(HWND hDlg) { WMi18n &i18n = WMi18n::GetInstance(); SetWindowText(hDlg, i18n.GetTranslationW("settings.mute.manage-endpoints.title").c_str()); i18n.SetItemText(hDlg, IDC_GROUP_LIST_BEHAVIOUR, "settings.mute.manage-endpoints.list-behaviour.title"); i18n.SetItemText(hDlg, IDC_ENDPOINT_LIST_IS_ALLOWLIST, "settings.mute.manage-endpoints.list-behaviour.mute-only-listed"); i18n.SetItemText(hDlg, IDC_ENDPOINT_LIST_IS_BLOCKLIST, "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed"); i18n.SetItemText(hDlg, IDC_GROUP_ENDPOINTS, "settings.mute.manage-endpoints.endpoints.title"); i18n.SetItemText(hDlg, IDC_ENDPOINT_ADD, "settings.btn-add"); i18n.SetItemText(hDlg, IDC_ENDPOINT_EDIT, "settings.btn-edit"); i18n.SetItemText(hDlg, IDC_ENDPOINT_REMOVE, "settings.btn-remove"); i18n.SetItemText(hDlg, IDC_ENDPOINT_REMOVEALL, "settings.btn-remove-all"); i18n.SetItemText(hDlg, IDOK, "settings.btn-save"); i18n.SetItemText(hDlg, IDCANCEL, "settings.btn-cancel"); } INT_PTR CALLBACK Settings_ManageEndpointsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { if (IsAppThemed()) { EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB); } LoadManageEndpointsDlgTranslation(hDlg); WMSettings *settings = reinterpret_cast(lParam); assert(settings != nullptr); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(settings)); DWORD endpointMode = settings->QueryValue(SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS_MODE); if (endpointMode == MUTE_ENDPOINT_MODE_INDIVIDUAL_ALLOW_LIST) { Button_SetCheck(GetDlgItem(hDlg, IDC_ENDPOINT_LIST_IS_ALLOWLIST), BST_CHECKED); Button_SetCheck(GetDlgItem(hDlg, IDC_ENDPOINT_LIST_IS_BLOCKLIST), BST_UNCHECKED); } else if (endpointMode == MUTE_ENDPOINT_MODE_INDIVIDUAL_BLOCK_LIST) { Button_SetCheck(GetDlgItem(hDlg, IDC_ENDPOINT_LIST_IS_ALLOWLIST), BST_UNCHECKED); Button_SetCheck(GetDlgItem(hDlg, IDC_ENDPOINT_LIST_IS_BLOCKLIST), BST_CHECKED); } HWND hList = GetDlgItem(hDlg, IDC_ENDPOINT_LIST); const auto devices = settings->GetManagedAudioEndpoints(); for (const auto &dev : devices) { ListBox_AddString(hList, dev.c_str()); } Button_Enable( GetDlgItem(hDlg, IDC_ENDPOINT_REMOVEALL), ListBox_GetCount(hList) > 0); return TRUE; } case WM_COMMAND: { if (LOWORD(wParam) == IDC_ENDPOINT_LIST) { HWND hList = GetDlgItem(hDlg, IDC_ENDPOINT_LIST); if (HIWORD(wParam) == LBN_SELCHANGE || HIWORD(wParam) == LBN_SELCANCEL) { const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_EDIT), entrySelected); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_REMOVE), entrySelected); } else if (HIWORD(wParam) == LBN_KILLFOCUS) { const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_EDIT), entrySelected); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_REMOVE), entrySelected); } } else if (LOWORD(wParam) == IDC_ENDPOINT_ADD) { EndpointData epData; if (DialogBoxParam( nullptr, MAKEINTRESOURCE(IDD_MANAGE_ENDPOINTS_ADD), hDlg, Settings_EndpointAddDlgProc, reinterpret_cast(&epData)) == 0) { std::vector devices = ExportEndpointNameList(GetDlgItem(hDlg, IDC_ENDPOINT_LIST)); if (std::find(begin(devices), end(devices), epData.name) == end(devices)) { ListBox_AddString( GetDlgItem(hDlg, IDC_ENDPOINT_LIST), epData.name.c_str()); HWND hRemoveAll = GetDlgItem(hDlg, IDC_ENDPOINT_REMOVEALL); if (!IsWindowEnabled(hRemoveAll)) { Button_Enable(hRemoveAll, TRUE); } } } } else if (LOWORD(wParam) == IDC_ENDPOINT_EDIT) { HWND hList = GetDlgItem(hDlg, IDC_ENDPOINT_LIST); const WPARAM sel = ListBox_GetCurSel(hList); if (sel != LB_ERR) { const int len = ListBox_GetTextLen(hList, sel); wchar_t *textBuf = nullptr; if (len != LB_ERR) { if ((textBuf = new wchar_t[static_cast(len) + 1]) != nullptr) { ListBox_GetText(hList, sel, textBuf); EndpointData epData; epData.name = textBuf; delete[] textBuf; if (DialogBoxParam( nullptr, MAKEINTRESOURCE(IDD_MANAGE_ENDPOINTS_ADD), hDlg, Settings_EndpointAddDlgProc, reinterpret_cast(&epData)) == 0) { std::vector networks = ExportEndpointNameList(GetDlgItem(hDlg, IDC_WIFI_LIST)); if (std::find(begin(networks), end(networks), epData.name) == end(networks)) { ListBox_InsertString(hList, sel, epData.name.c_str()); ListBox_DeleteString(hList, sel + 1); } else { ListBox_DeleteString(hList, sel); } } } } } } else if (LOWORD(wParam) == IDC_ENDPOINT_REMOVE) { HWND hList = GetDlgItem(hDlg, IDC_ENDPOINT_LIST); const WPARAM sel = ListBox_GetCurSel(hList); if (sel != LB_ERR) { ListBox_DeleteString(hList, sel); if (ListBox_GetCount(hList) == 0) { Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_EDIT), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_REMOVE), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_REMOVEALL), FALSE); } } } else if (LOWORD(wParam) == IDC_ENDPOINT_REMOVEALL) { ListBox_ResetContent(GetDlgItem(hDlg, IDC_ENDPOINT_LIST)); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_EDIT), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_REMOVE), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_REMOVEALL), FALSE); } else if (LOWORD(wParam) == IDOK) { WMSettings *settings = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); std::vector devices = ExportEndpointNameList(GetDlgItem(hDlg, IDC_ENDPOINT_LIST)); settings->StoreManagedAudioEndpoints(devices); if (Button_GetCheck(GetDlgItem(hDlg, IDC_ENDPOINT_LIST_IS_ALLOWLIST))) { settings->SetValue(SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS_MODE, MUTE_ENDPOINT_MODE_INDIVIDUAL_ALLOW_LIST); } else if (Button_GetCheck(GetDlgItem(hDlg, IDC_ENDPOINT_LIST_IS_BLOCKLIST))) { settings->SetValue(SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS_MODE, MUTE_ENDPOINT_MODE_INDIVIDUAL_BLOCK_LIST); } EndDialog(hDlg, 0); } else if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, 0); } return 0; } default: break; } return FALSE; } ================================================ FILE: WinMute/Settings_MuteDlg.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" extern INT_PTR CALLBACK Settings_ManageEndpointsDlgProc(HWND, UINT, WPARAM, LPARAM); static void SetCheckButton(HWND hBtn, const WMSettings& settings, SettingsKey key) { const DWORD enabled = !!settings.QueryValue(key); Button_SetCheck(hBtn, enabled ? BST_CHECKED : BST_UNCHECKED); } static void SetOption(HWND hBtn, WMSettings& settings, SettingsKey key) { const int enable = Button_GetCheck(hBtn) == BST_CHECKED; settings.SetValue(key, enable); } static void LoadMuteDlgTranslation(HWND hDlg) { WMi18n &i18n = WMi18n::GetInstance(); i18n.SetItemText(hDlg, IDC_GROUP_GENERAL, "settings.mute.general-title"); i18n.SetItemText(hDlg, IDC_SHOWNOTIFICATIONS, "settings.mute.show-mute-event-notifications"); i18n.SetItemText(hDlg, IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY, "settings.mute.manage-endpoints-individually"); i18n.SetItemText(hDlg, IDC_MANAGE_ENDPOINTS, "settings.mute.btn-manage-endpoints"); i18n.SetItemText(hDlg, IDC_GROUP_MUTE_WITH_RESTORE, "settings.mute.mute-with-restore.title"); i18n.SetItemText(hDlg, IDC_MUTE_WHEN_WS_LOCKED, "settings.mute.mute-with-restore.when-workstation-is-locked"); i18n.SetItemText(hDlg, IDC_MUTE_WHEN_SCREEN_OFF, "settings.mute.mute-with-restore.when-screen-turns-off"); i18n.SetItemText(hDlg, IDC_RESTOREVOLUME, "settings.mute.mute-with-restore.restore-volume"); i18n.SetItemText(hDlg, IDC_DELAY_MUTING_LABEL, "settings.mute.mute-with-restore.restore-volume-delay-label"); i18n.SetItemText(hDlg, IDC_GROUP_MUTE_WITHOUT_RESTORE, "settings.mute.mute-without-restore.title"); i18n.SetItemText(hDlg, IDC_MUTE_WHEN_SHUTDOWN, "settings.mute.mute-without-restore.when-computer-shuts-down"); i18n.SetItemText(hDlg, IDC_MUTE_WHEN_SLEEP, "settings.mute.mute-without-restore.when-computer-goes-to-sleep"); i18n.SetItemText(hDlg, IDC_MUTE_WHEN_LOGOUT, "settings.mute.mute-without-restore.when-user-logs-out"); i18n.SetItemText(hDlg, IDC_MUTE_WHEN_RDP_SESSION, "settings.mute.mute-without-restore.when-rdp-session-starts"); } INT_PTR CALLBACK Settings_MuteDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); switch (msg) { case WM_INITDIALOG: { if (IsAppThemed()) { EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB); } LoadMuteDlgTranslation(hDlg); HWND hNotify = GetDlgItem(hDlg, IDC_SHOWNOTIFICATIONS); HWND hManageEndpoints = GetDlgItem(hDlg, IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY); HWND hMuteOnLock = GetDlgItem(hDlg, IDC_MUTE_WHEN_WS_LOCKED); HWND hMuteOnScreenOff = GetDlgItem(hDlg, IDC_MUTE_WHEN_SCREEN_OFF); HWND hMuteOnRDP = GetDlgItem(hDlg, IDC_MUTE_WHEN_RDP_SESSION); HWND hRestoreVolume = GetDlgItem(hDlg, IDC_RESTOREVOLUME); HWND hMuteOnShutdown = GetDlgItem(hDlg, IDC_MUTE_WHEN_SHUTDOWN); HWND hMuteOnSleep = GetDlgItem(hDlg, IDC_MUTE_WHEN_SLEEP); HWND hMuteOnLogout = GetDlgItem(hDlg, IDC_MUTE_WHEN_LOGOUT); WMSettings* settings = reinterpret_cast(lParam); assert(settings != nullptr); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(settings)); // General SetCheckButton(hNotify, *settings, SettingsKey::NOTIFICATIONS_ENABLED); SetCheckButton(hManageEndpoints, *settings, SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS); Button_Enable(GetDlgItem(hDlg, IDC_MANAGE_ENDPOINTS), Button_GetCheck(hManageEndpoints) == BST_CHECKED); const DWORD muteDelay = settings->QueryValue(SettingsKey::MUTE_DELAY); SetDlgItemInt(hDlg, IDC_MUTEDELAY, (muteDelay < 0) ? 0 : muteDelay, false); // With restore SetCheckButton(hMuteOnLock, *settings, SettingsKey::MUTE_ON_LOCK); SetCheckButton(hMuteOnScreenOff, *settings, SettingsKey::MUTE_ON_DISPLAYSTANDBY); SetCheckButton(hMuteOnRDP, *settings, SettingsKey::MUTE_ON_RDP); SetCheckButton(hRestoreVolume, *settings, SettingsKey::RESTORE_AUDIO); // Without restore SetCheckButton(hMuteOnShutdown, *settings, SettingsKey::MUTE_ON_SHUTDOWN); SetCheckButton(hMuteOnSleep, *settings, SettingsKey::MUTE_ON_SUSPEND); SetCheckButton(hMuteOnLogout, *settings, SettingsKey::MUTE_ON_LOGOUT); return TRUE; } case WM_COMMAND: if (LOWORD(wParam) == IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY) { int isEnabled = Button_GetCheck(GetDlgItem(hDlg, IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY)); Button_Enable(GetDlgItem(hDlg, IDC_MANAGE_ENDPOINTS), isEnabled); } else if (LOWORD(wParam) == IDC_MANAGE_ENDPOINTS) { WMSettings *settings = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); if (!DialogBoxParam( nullptr, MAKEINTRESOURCE(IDD_MANAGE_ENDPOINTS), hDlg, Settings_ManageEndpointsDlgProc, reinterpret_cast(settings)) == 0) { ShowWindowsError(L"DialogBoxParam", GetLastError()); } } return 0; case WM_SAVESETTINGS: { WMSettings* settings = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); HWND hNotify = GetDlgItem(hDlg, IDC_SHOWNOTIFICATIONS); HWND hManageEndpoints = GetDlgItem(hDlg, IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY); HWND hMuteOnLock = GetDlgItem(hDlg, IDC_MUTE_WHEN_WS_LOCKED); HWND hMuteOnScreenOff = GetDlgItem(hDlg, IDC_MUTE_WHEN_SCREEN_OFF); HWND hMuteOnRDP = GetDlgItem(hDlg, IDC_MUTE_WHEN_RDP_SESSION); HWND hRestoreVolume = GetDlgItem(hDlg, IDC_RESTOREVOLUME); HWND hMuteOnShutdown = GetDlgItem(hDlg, IDC_MUTE_WHEN_SHUTDOWN); HWND hMuteOnSleep = GetDlgItem(hDlg, IDC_MUTE_WHEN_SLEEP); HWND hMuteOnLogout = GetDlgItem(hDlg, IDC_MUTE_WHEN_LOGOUT); // General SetOption(hNotify, *settings, SettingsKey::NOTIFICATIONS_ENABLED); SetOption(hManageEndpoints, *settings, SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS); const DWORD muteDelay = GetDlgItemInt(hDlg, IDC_MUTEDELAY, nullptr, TRUE); settings->SetValue(SettingsKey::MUTE_DELAY, (muteDelay < 0) ? 0 : muteDelay); // With restore SetOption(hMuteOnLock, *settings, SettingsKey::MUTE_ON_LOCK); SetOption(hMuteOnScreenOff, *settings, SettingsKey::MUTE_ON_DISPLAYSTANDBY); SetOption(hMuteOnRDP, *settings, SettingsKey::MUTE_ON_RDP); SetOption(hRestoreVolume, *settings, SettingsKey::RESTORE_AUDIO); // Without restore SetOption(hMuteOnShutdown, *settings, SettingsKey::MUTE_ON_SHUTDOWN); SetOption(hMuteOnSleep, *settings, SettingsKey::MUTE_ON_SUSPEND); SetOption(hMuteOnLogout, *settings, SettingsKey::MUTE_ON_LOGOUT); return 0; } default: break; } return FALSE; } ================================================ FILE: WinMute/Settings_QuietHoursDlg.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" static bool IsValidTimeRange( const LPSYSTEMTIME start, const LPSYSTEMTIME end) { bool isValid = true; if (start->wHour == end->wHour && start->wMinute == end->wMinute && start->wSecond == end->wSecond) { isValid = false; } return isValid; } static bool SaveQuietHours( WMSettings* settings, const int enabled, const int forceUnmute, const int showNotifications, const LPSYSTEMTIME start, const LPSYSTEMTIME end) { if (enabled) { if (!IsValidTimeRange(start, end)) { WMi18n &i18n = WMi18n::GetInstance(); TaskDialog( nullptr, nullptr, PROGRAM_NAME, i18n.GetTranslationW("settings.quiet-hours.error.invalid-time-range.title").c_str(), i18n.GetTranslationW("settings.quiet-hours.error.invalid-time-range.text").c_str(), TDCBF_OK_BUTTON, TD_WARNING_ICON, nullptr); return false; } } int setStart = start->wHour * 3600 + start->wMinute * 60 + start->wSecond; int setEnd = end->wHour * 3600 + end->wMinute * 60 + end->wSecond; if (!settings->SetValue(SettingsKey::QUIETHOURS_ENABLE, enabled) || !settings->SetValue(SettingsKey::QUIETHOURS_FORCEUNMUTE, forceUnmute) || !settings->SetValue(SettingsKey::QUIETHOURS_NOTIFICATIONS, showNotifications) || !settings->SetValue(SettingsKey::QUIETHOURS_START, setStart) || !settings->SetValue(SettingsKey::QUIETHOURS_END, setEnd)) { WMi18n &i18n = WMi18n::GetInstance(); TaskDialog( nullptr, nullptr, PROGRAM_NAME, i18n.GetTranslationW("settings.quiet-hours.error.error-while-saving.title").c_str(), i18n.GetTranslationW("settings.quiet-hours.error.error-while-saving.text").c_str(), TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); return false; } return true; } static void LoadQuietHoursDlgTranslation(HWND hDlg) { WMi18n &i18n = WMi18n::GetInstance(); i18n.SetItemText(hDlg, IDC_QUIET_HOURS_DESCRIPTION, "settings.quiet-hours.intro"); i18n.SetItemText(hDlg, IDC_ENABLEQUIETHOURS, "settings.quiet-hours.enable"); i18n.SetItemText(hDlg, IDC_QUIET_HOURS_START_LABEL, "settings.quiet-hours.start-time-label"); i18n.SetItemText(hDlg, IDC_QUIET_HOURS_END_LABEL, "settings.quiet-hours.end-time-label"); i18n.SetItemText(hDlg, IDC_FORCEUNMUTE, "settings.quiet-hours.force-unmute"); i18n.SetItemText(hDlg, IDC_QUIET_HOURS_FORCE_UNMUTE_DESCRIPTION, "settings.quiet-hours.force-unmute-description"); i18n.SetItemText(hDlg, IDC_SHOWNOTIFICATIONS, "settings.quiet-hours.show-notifications"); } INT_PTR CALLBACK Settings_QuietHoursDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (msg) { case WM_INITDIALOG: { HWND hEnable = GetDlgItem(hDlg, IDC_ENABLEQUIETHOURS); HWND hForce = GetDlgItem(hDlg, IDC_FORCEUNMUTE); HWND hNotify = GetDlgItem(hDlg, IDC_SHOWNOTIFICATIONS); HWND hStart = GetDlgItem(hDlg, IDC_QUIETHOURS_START); HWND hEnd = GetDlgItem(hDlg, IDC_QUIETHOURS_END); WMSettings* settings = reinterpret_cast(lParam); assert(settings != nullptr); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(settings)); if (IsAppThemed()) { EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB); } LoadQuietHoursDlgTranslation(hDlg); DWORD qhEnabled = !!settings->QueryValue(SettingsKey::QUIETHOURS_ENABLE); Button_SetCheck(hEnable, qhEnabled ? BST_CHECKED : BST_UNCHECKED); DWORD qhForceUnmute = !!settings->QueryValue(SettingsKey::QUIETHOURS_FORCEUNMUTE); Button_SetCheck(hForce, qhForceUnmute ? BST_CHECKED : BST_UNCHECKED); DWORD qhNotifications = !!settings->QueryValue(SettingsKey::QUIETHOURS_NOTIFICATIONS); Button_SetCheck(hNotify, qhNotifications ? BST_CHECKED : BST_UNCHECKED); EnableWindow(hForce, qhEnabled); EnableWindow(hNotify, qhEnabled); EnableWindow(hStart, qhEnabled); EnableWindow(hEnd, qhEnabled); int setStart = settings->QueryValue(SettingsKey::QUIETHOURS_START); int setEnd = settings->QueryValue(SettingsKey::QUIETHOURS_END); SYSTEMTIME start; GetLocalTime(&start); if (setStart > 0) { start.wSecond = static_cast(setStart % 60); start.wMinute = static_cast(((setStart - start.wSecond) / 60) % 60); start.wHour = static_cast((setStart - start.wMinute - start.wSecond) / 3600); } DateTime_SetSystemtime(hStart, GDT_VALID, &start); SYSTEMTIME end; GetLocalTime(&end); if (setEnd > 0) { end.wSecond = static_cast(setEnd % 60); end.wMinute = static_cast(((setEnd - end.wSecond) / 60) % 60); end.wHour = static_cast((setEnd - end.wMinute - end.wSecond) / 3600); } DateTime_SetSystemtime(hEnd, GDT_VALID, &end); return TRUE; } case WM_SAVESETTINGS: { SYSTEMTIME start; SYSTEMTIME end; HWND hEnable = GetDlgItem(hDlg, IDC_ENABLEQUIETHOURS); HWND hForce = GetDlgItem(hDlg, IDC_FORCEUNMUTE); HWND hNotify = GetDlgItem(hDlg, IDC_SHOWNOTIFICATIONS); HWND hStart = GetDlgItem(hDlg, IDC_QUIETHOURS_START); HWND hEnd = GetDlgItem(hDlg, IDC_QUIETHOURS_END); WMSettings* settings = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); int qhEnabled = Button_GetCheck(hEnable) == BST_CHECKED; int qhForceUnmute = Button_GetCheck(hForce) == BST_CHECKED; int qhNotifications = Button_GetCheck(hNotify) == BST_CHECKED; DateTime_GetSystemtime(hStart, &start); DateTime_GetSystemtime(hEnd, &end); settings->SetValue(SettingsKey::QUIETHOURS_ENABLE, qhEnabled); if (SaveQuietHours(settings, qhEnabled, qhForceUnmute, qhNotifications, &start, &end)) { EndDialog(hDlg, 0); } return 0; } case WM_COMMAND: { HWND hEnable = GetDlgItem(hDlg, IDC_ENABLEQUIETHOURS); HWND hForce = GetDlgItem(hDlg, IDC_FORCEUNMUTE); HWND hNotify = GetDlgItem(hDlg, IDC_SHOWNOTIFICATIONS); HWND hStart = GetDlgItem(hDlg, IDC_QUIETHOURS_START); HWND hEnd = GetDlgItem(hDlg, IDC_QUIETHOURS_END); if (LOWORD(wParam) == IDC_ENABLEQUIETHOURS) { int qhEnabled = Button_GetCheck(hEnable) == BST_CHECKED; EnableWindow(hStart, qhEnabled); EnableWindow(hEnd, qhEnabled); EnableWindow(hNotify, qhEnabled); EnableWindow(hForce, qhEnabled); } return 0; } case WM_CLOSE: EndDialog(hDlg, 0); return TRUE; default: break; } return FALSE; } ================================================ FILE: WinMute/Settings_WifiDlg.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" static constexpr int SSID_MAX_LEN = 32; struct WiFiData { std::wstring ssidName; }; static void LoadWifiAddDlgTranslation(HWND hDlg, bool isEdit) { WMi18n &i18n = WMi18n::GetInstance(); if (isEdit) { i18n.SetItemText(hDlg, "settings.wifi.add-edit.edit-title"); } else { i18n.SetItemText(hDlg, "settings.wifi.add-edit.add-title"); } i18n.SetItemText(hDlg, IDC_WIFI_NAME_LABEL, "settings.wifi.add-edit.ssid-name-label"); i18n.SetItemText(hDlg, IDOK, "settings.btn-save"); i18n.SetItemText(hDlg, IDCANCEL, "settings.btn-cancel"); const auto placeholder = i18n.GetTranslationW("settings.wifi.add-edit.enter-device-name-placeholder"); Edit_SetCueBannerText( GetDlgItem(hDlg, IDC_WIFI_NAME), placeholder.c_str()); } INT_PTR CALLBACK Settings_WifiAddDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { HWND hSsid = GetDlgItem(hDlg, IDC_WIFI_NAME); WiFiData* wifiData = reinterpret_cast(lParam); if (wifiData == nullptr) { return FALSE; } SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(wifiData)); LoadWifiAddDlgTranslation(hDlg, wifiData->ssidName.length() != 0); if (wifiData->ssidName.length() != 0) { SetWindowTextW(GetDlgItem(hDlg, IDC_WIFI_NAME), wifiData->ssidName.c_str()); } // Disable save button until at least one string change is made EnableWindow(GetDlgItem(hDlg, IDOK), FALSE); Edit_LimitText(hSsid, SSID_MAX_LEN); if (GetDlgCtrlID(reinterpret_cast(wParam)) != IDC_WIFI_NAME) { SetFocus(hSsid); return FALSE; } return TRUE; } case WM_COMMAND: if (LOWORD(wParam) == IDC_WIFI_NAME) { HWND hSsid = GetDlgItem(hDlg, IDC_WIFI_NAME); if (HIWORD(wParam) == EN_UPDATE) { const int textLen = Edit_GetTextLength(hSsid); EnableWindow(GetDlgItem(hDlg, IDOK), textLen > 0); } } else if (LOWORD(wParam) == IDOK) { HWND hSsid = GetDlgItem(hDlg, IDC_WIFI_NAME); const int textLen = Edit_GetTextLength(hSsid); if (textLen != 0) { wchar_t ssidBuf[SSID_MAX_LEN + 1]; WiFiData* wifiData = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); if (wifiData != nullptr) { Edit_GetText(hSsid, ssidBuf, ARRAY_SIZE(ssidBuf)); wifiData->ssidName = ssidBuf; EndDialog(hDlg, 0); } else { EndDialog(hDlg, 1); } } } else if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, 1); } return FALSE; case WM_CLOSE: EndDialog(hDlg, 1); return TRUE; default: break; } return FALSE; } static std::vector ExportSsidListItems(HWND hList) { std::vector items; DWORD itemCount = ListBox_GetCount(hList); for (DWORD i = 0; i < itemCount; ++i) { wchar_t textBuf[SSID_MAX_LEN + 1] = { 0 }; DWORD textLen = ListBox_GetTextLen(hList, i); if (textLen < ARRAY_SIZE(textBuf)) { ListBox_GetText(hList, i, textBuf); items.push_back(textBuf); } } return items; } static bool IsWlanAvailable() noexcept { HANDLE wlanHandle; DWORD vers = 2; if (WlanOpenHandle(vers, nullptr, &vers, &wlanHandle) != ERROR_SUCCESS) { return false; } WlanCloseHandle(wlanHandle, nullptr); return true; } static BOOL CALLBACK ShowChildWindow(HWND hWnd, LPARAM lParam) { ShowWindow(hWnd, static_cast(lParam)); return TRUE; } static void LoadWifiDlgTranslation(HWND hDlg) { WMi18n &i18n = WMi18n::GetInstance(); i18n.SetItemText(hDlg, IDC_WIFI_INTRO, "settings.wifi.intro"); i18n.SetItemText(hDlg, IDC_ENABLE_WIFI_MUTE, "settings.wifi.enable"); i18n.SetItemText(hDlg, IDC_WIFI_ADD, "settings.btn-add"); i18n.SetItemText(hDlg, IDC_WIFI_EDIT, "settings.btn-edit"); i18n.SetItemText(hDlg, IDC_WIFI_REMOVE, "settings.btn-remove"); i18n.SetItemText(hDlg, IDC_WIFI_REMOVEALL, "settings.btn-remove-all"); i18n.SetItemText(hDlg, IDC_WLAN_LIST_IS_ALLOWLIST, "settings.wifi.mute-when-in-list"); i18n.SetItemText(hDlg, IDC_WLAN_LIST_IS_BLOCKLIST, "settings.wifi.mute-when-not-in-list"); } INT_PTR CALLBACK Settings_WifiDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { if (IsAppThemed()) { EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB); } LoadWifiDlgTranslation(hDlg); WMSettings* settings = reinterpret_cast(lParam); assert(settings != nullptr); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(settings)); DWORD enabled = settings->QueryValue(SettingsKey::MUTE_ON_WLAN); Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_WIFI_MUTE), enabled ? BST_CHECKED : BST_UNCHECKED); Button_Enable(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_ALLOWLIST), enabled == BST_CHECKED); Button_Enable(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_BLOCKLIST), enabled == BST_CHECKED); enabled = settings->QueryValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST); Button_SetCheck(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_ALLOWLIST), enabled ? BST_CHECKED : BST_UNCHECKED); Button_SetCheck(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_BLOCKLIST), !enabled ? BST_CHECKED : BST_UNCHECKED); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_EDIT), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVE), FALSE); HWND hList = GetDlgItem(hDlg, IDC_WIFI_LIST); const auto networks = settings->GetWifiNetworks(); for (const auto& n : networks) { ListBox_AddString(hList, n.c_str()); } Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVEALL), ListBox_GetCount(hList) > 0); if (!IsWlanAvailable()) { // Set defaults Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_WIFI_MUTE), BST_UNCHECKED); Button_Enable(GetDlgItem(hDlg, IDC_ENABLE_WIFI_MUTE), FALSE); Button_SetCheck(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_ALLOWLIST), BST_CHECKED); Button_Enable(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_ALLOWLIST), FALSE); Button_SetCheck(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_BLOCKLIST), BST_UNCHECKED); Button_Enable(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_BLOCKLIST), FALSE); // Hide all child windows, except the notice EnumChildWindows(hDlg, ShowChildWindow, SW_HIDE); HWND hDescription = GetDlgItem(hDlg, IDC_WIFI_INTRO); WMi18n::GetInstance().SetItemText(hDescription, "settings.wifi.wifi-disabled-info"); RECT r; GetClientRect(hDescription, &r); const int margin = 20; SetWindowPos( hDescription, HWND_TOP, margin, margin, r.right, r.bottom, SWP_SHOWWINDOW); } return TRUE; } case WM_COMMAND: { if (LOWORD(wParam) == IDC_ENABLE_WIFI_MUTE) { const DWORD wlanEnabled = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_WIFI_MUTE)); Button_Enable(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_ALLOWLIST), wlanEnabled == BST_CHECKED); Button_Enable(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_BLOCKLIST), wlanEnabled == BST_CHECKED); } else if (LOWORD(wParam) == IDC_WIFI_LIST) { HWND hList = GetDlgItem(hDlg, IDC_WIFI_LIST); if (HIWORD(wParam) == LBN_SELCHANGE || HIWORD(wParam) == LBN_SELCANCEL) { const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_EDIT), entrySelected); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVE), entrySelected); } else if (HIWORD(wParam) == LBN_KILLFOCUS) { const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_EDIT), entrySelected); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVE), entrySelected); } } else if (LOWORD(wParam) == IDC_WIFI_ADD) { WiFiData wifiData; if (DialogBoxParam( nullptr, MAKEINTRESOURCE(IDD_SETTINGS_WIFI_ADD), hDlg, Settings_WifiAddDlgProc, reinterpret_cast(&wifiData)) == 0) { std::vector networks = ExportSsidListItems(GetDlgItem(hDlg, IDC_WIFI_LIST)); if (std::find(begin(networks), end(networks), wifiData.ssidName) == end(networks)) { ListBox_AddString( GetDlgItem(hDlg, IDC_WIFI_LIST), wifiData.ssidName.c_str()); HWND hRemoveAll = GetDlgItem(hDlg, IDC_WIFI_REMOVEALL); if (!IsWindowEnabled(hRemoveAll)) { Button_Enable(hRemoveAll, TRUE); } } } } else if (LOWORD(wParam) == IDC_WIFI_EDIT) { HWND hList = GetDlgItem(hDlg, IDC_WIFI_LIST); const WPARAM sel = ListBox_GetCurSel(hList); if (sel != LB_ERR) { const int len = ListBox_GetTextLen(hList, sel); wchar_t *textBuf = nullptr; if (len != LB_ERR) { if ((textBuf = new wchar_t[static_cast(len) + 1]) != nullptr) { ListBox_GetText(hList, sel, textBuf); WiFiData wifiData; wifiData.ssidName = textBuf; delete[] textBuf; if (DialogBoxParam( nullptr, MAKEINTRESOURCE(IDD_SETTINGS_WIFI_ADD), hDlg, Settings_WifiAddDlgProc, reinterpret_cast(&wifiData)) == 0) { std::vector networks = ExportSsidListItems(GetDlgItem(hDlg, IDC_WIFI_LIST)); if (std::find(begin(networks), end(networks), wifiData.ssidName) == end(networks)) { ListBox_InsertString(hList, sel, wifiData.ssidName.c_str()); ListBox_DeleteString(hList, sel + 1); } else { ListBox_DeleteString(hList, sel); } } } } } } else if (LOWORD(wParam) == IDC_WIFI_REMOVE) { HWND hList = GetDlgItem(hDlg, IDC_WIFI_LIST); WPARAM sel = ListBox_GetCurSel(hList); if (sel != LB_ERR) { ListBox_DeleteString(hList, sel); if (ListBox_GetCount(hList) == 0) { Button_Enable(GetDlgItem(hDlg, IDC_WIFI_EDIT), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVE), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVEALL), FALSE); } } } else if (LOWORD(wParam) == IDC_WIFI_REMOVEALL) { ListBox_ResetContent(GetDlgItem(hDlg, IDC_WIFI_LIST)); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_EDIT), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVE), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVEALL), FALSE); } return 0; } case WM_SAVESETTINGS: { WMSettings* settings = reinterpret_cast(GetWindowLongPtr(hDlg, GWLP_USERDATA)); std::vector networks = ExportSsidListItems(GetDlgItem(hDlg, IDC_WIFI_LIST)); settings->StoreWifiNetworks(networks); DWORD checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_WIFI_MUTE)); settings->SetValue(SettingsKey::MUTE_ON_WLAN, checked == BST_CHECKED); checked = Button_GetCheck(GetDlgItem(hDlg, IDC_WLAN_LIST_IS_ALLOWLIST)); settings->SetValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST, checked == BST_CHECKED); return 0; } default: break; } return FALSE; } ================================================ FILE: WinMute/TrayIcon.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" TrayIcon::TrayIcon() { } TrayIcon::TrayIcon( HWND hWnd, UINT trayID, HICON hIcon, const std::wstring& tooltip, bool show, int callbackId) : callbackId_(callbackId) { Init(hWnd, trayID, hIcon, tooltip, show); } void TrayIcon::Init( HWND hWnd, UINT trayID, HICON hIcon, const std::wstring& tooltip, bool show, int callbackId) { callbackId_ = callbackId; if (!hIcon) { hIcon_ = LoadIcon(0, IDI_APPLICATION); } else { hIcon_ = hIcon; } tooltip_ = tooltip; trayID_ = trayID; hWnd_ = hWnd; if (show) { Show(); } initialized_ = true; if (popupQueue_.size() > 0) { for (const auto& p : popupQueue_) { ShowPopup(p.title, p.text); } popupQueue_.clear(); } } TrayIcon::~TrayIcon() { Hide(); DestroyTrayIcon(); } void TrayIcon::Hide() { if (iconVisible_) { if (RemoveNotifyIcon()) { iconVisible_ = false; } } } void TrayIcon::Show() { if (!iconVisible_) { if (AddNotifyIcon()) { iconVisible_ = true; } } } void TrayIcon::ChangeIcon(HICON hNewIcon) { if (!hNewIcon) { return; } bool oldIconVisible = iconVisible_; DestroyTrayIcon(); hIcon_ = hNewIcon; if (oldIconVisible) { NOTIFYICONDATA tnid{0}; tnid.cbSize = sizeof(NOTIFYICONDATA); tnid.uVersion = NOTIFYICON_VERSION_4; tnid.hWnd = hWnd_; tnid.uID = trayID_; tnid.hIcon = hIcon_; tnid.uFlags = NIF_ICON; if (!Shell_NotifyIcon(NIM_MODIFY, &tnid)) return; iconVisible_ = true; } return; } void TrayIcon::ChangeText(const std::wstring& tooltip) { tooltip_ = tooltip; if (iconVisible_) ChangeText(); } void TrayIcon::ShowPopup( const std::wstring& title, const std::wstring& text) const { if (!initialized_) { TrayIconPopup popup; popup.title = title; popup.text = text; popupQueue_.push_back(popup); return; } NOTIFYICONDATAW tnid{0}; tnid.cbSize = sizeof(tnid); tnid.uVersion = NOTIFYICON_VERSION_4; tnid.hWnd = hWnd_; tnid.uID = trayID_; tnid.uFlags = NIF_INFO | NIF_SHOWTIP; tnid.dwInfoFlags = NIIF_INFO | NIIF_NOSOUND | NIIF_LARGE_ICON | NIIF_RESPECT_QUIET_TIME; tnid.uTimeout = 10 * 1000; StringCchCopy(tnid.szInfoTitle, ARRAY_SIZE(tnid.szInfoTitle), title.c_str()); StringCchCopy(tnid.szInfo, ARRAY_SIZE(tnid.szInfo), text.c_str()); Shell_NotifyIcon(NIM_MODIFY, &tnid); } void TrayIcon::DestroyTrayIcon() { if (hIcon_) { DestroyIcon(hIcon_); hIcon_ = 0; } } bool TrayIcon::AddNotifyIcon() { NOTIFYICONDATAW tnid{ 0 }; tnid.cbSize = sizeof(tnid); tnid.uVersion = NOTIFYICON_VERSION_4; tnid.hWnd = hWnd_; tnid.uID = trayID_; tnid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE | NIF_SHOWTIP; tnid.hIcon = hIcon_; tnid.uCallbackMessage = callbackId_; if (SUCCEEDED(StringCchCopy(tnid.szTip, ARRAY_SIZE(tnid.szTip), tooltip_.c_str()))) { return Shell_NotifyIconW(NIM_ADD, &tnid) != 0; } return false; } bool TrayIcon::RemoveNotifyIcon() { NOTIFYICONDATAW tnid{0}; tnid.cbSize = sizeof(tnid); tnid.uVersion = NOTIFYICON_VERSION_4; tnid.hWnd = hWnd_; tnid.uID = trayID_; return Shell_NotifyIcon(NIM_DELETE, &tnid) != 0; } bool TrayIcon::ChangeText() { NOTIFYICONDATAW tnid{0}; tnid.cbSize = sizeof(tnid); tnid.uVersion = NOTIFYICON_VERSION_4; tnid.hWnd = hWnd_; tnid.uID = trayID_; tnid.uFlags = NIF_TIP; if (SUCCEEDED(StringCchCopy(tnid.szTip, ARRAY_SIZE(tnid.szTip), tooltip_.c_str()))) { return Shell_NotifyIcon(NIM_MODIFY, &tnid) != 0; } return false; } ================================================ FILE: WinMute/TrayIcon.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" constexpr int WM_TRAYICON = WM_APP + 700; struct TrayIconPopup { std::wstring title; std::wstring text; }; class TrayIcon { public: TrayIcon(); TrayIcon(HWND hWnd, UINT trayID, HICON hIcon, const std::wstring& tooltip, bool show, int callbackId = WM_TRAYICON); ~TrayIcon(); void Init(HWND hWnd, UINT trayID, HICON hIcon, const std::wstring& tooltip, bool show, int callbackId = WM_TRAYICON); void Hide(); void Show(); bool IsShown() const noexcept { return iconVisible_; } void ChangeIcon(HICON hNewIcon); void ChangeText(const std::wstring& tooltip); void ShowPopup( const std::wstring& title, const std::wstring& text) const; private: void DestroyTrayIcon(); bool AddNotifyIcon(); bool RemoveNotifyIcon(); bool ChangeText(); mutable std::vector popupQueue_; int callbackId_ = WM_TRAYICON; bool initialized_ = false; bool iconVisible_ = false; UINT trayID_ = 0; HICON hIcon_ = 0; HWND hWnd_ = 0; std::wstring tooltip_; }; ================================================ FILE: WinMute/UpdateChecker.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" #ifdef _DEBUG const wchar_t *UPDATE_FILE_URL = L"https://raw.githubusercontent.com/lx-s/WinMute/dev/CURRENT_VERSION"; #else const wchar_t *UPDATE_FILE_URL = L"https://raw.githubusercontent.com/lx-s/WinMute/main/CURRENT_VERSION"; #endif class HInternetHolder { public: HInternetHolder(HINTERNET hInternet) : hInternet_(hInternet) {} ~HInternetHolder() { if (hInternet_ != nullptr) { WinHttpCloseHandle(hInternet_); } } operator HINTERNET() { return hInternet_; } private: HINTERNET hInternet_; }; UpdateChecker::UpdateChecker() { } UpdateChecker::~UpdateChecker() { } bool UpdateChecker::ParseVersionInfo(const nlohmann::json &json, UpdateVersionInfo &versInfo) const { WMLog &log = WMLog::GetInstance(); if (!json.contains("version") && !json.contains("downloadUrl")) { log.LogError(L"Missing json fields in update file"); return false; } versInfo.version = ConvertStringToWideString(json["version"]);; versInfo.downloadUrl = ConvertStringToWideString(json["downloadUrl"]); return true; } bool UpdateChecker::ParseVersionFile( const std::string &fileContents, UpdateInfo &updateInfo) const { // Structure // { // "version": 1, // "stable" : { // "version": "2.4.1.0", // "download_page" : "https://github.com/lx-s/WinMute/releases/" // }, // "beta" : { // "version": "2.4.1.0", // "download_page" : "https://github.com/lx-s/WinMute/releases/" // } // } WMLog &log = WMLog::GetInstance(); try { auto json = nlohmann::json::parse(fileContents); if (!json.contains("version")) { log.LogError(L"Missing update-file version"); return false; } int version = json["version"].get(); if (version != 1) { log.LogError(L"Update file has incompatible version number"); return false; } if (!json.contains("stable") || !json.contains("beta")) { log.LogError(L"Missing stable and/or beta fields"); return false; } const auto stableInfo = json["stable"]; const auto betaInfo = json["beta"]; if (!stableInfo.is_structured() || !betaInfo.is_structured()) { log.LogError(L"Missing stable and/or beta fields"); return false; } if (!ParseVersionInfo(stableInfo, updateInfo.stable) || !ParseVersionInfo(betaInfo, updateInfo.beta)) { log.LogError(L"Failed to parse stable and/or beta fields"); return false; } } catch (const nlohmann::json::parse_error &pe) { log.LogError(L"Failed to parse update: %S", pe.what()); return false; } return true; } bool UpdateChecker::ParseVersion(const std::wstring &vers, std::vector& parsedVers) const { size_t lastVersionPos = 0; size_t curPos = 0; for (; curPos <= vers.length(); ++curPos) { if (vers[curPos] == L'.' || vers[curPos] == L'\0') { try { const std::wstring versPart = vers.substr(lastVersionPos, curPos - lastVersionPos); parsedVers.push_back(std::stoi(versPart)); } catch (...) { return false; } lastVersionPos = curPos + 1; } } return true; } std::optional UpdateChecker::IsVersionGreater(const std::wstring &newVers, const std::wstring &curVers) const { std::vector newVersParsed; std::vector curVersParsed; WMLog &log = WMLog::GetInstance(); if (!ParseVersion(newVers, newVersParsed)) { log.LogError(L"Failed to parse new version string \"%s\"", newVers.c_str()); return std::nullopt; } else if (!ParseVersion(curVers, curVersParsed)) { log.LogError(L"Failed to parse current version string \"%s\"", curVers.c_str()); return std::nullopt; } else if (newVersParsed.size() != curVersParsed.size()) { log.LogError(L"Version format mismatch \"%s\" / \"%s\"", curVers.c_str(), newVers.c_str()); return std::nullopt; } for (size_t i = 0; i < newVersParsed.size(); ++i) { if (curVersParsed[i] < newVersParsed[i]) { return true; } } return false; } bool UpdateChecker::GetUpdateInfo(UpdateInfo &updateInfo) const { if (!GetWinMuteVersion(updateInfo.currentVersion)) { return false; } std::string versionFile; if (!GetVersionFile(versionFile)) { return false; } if (!ParseVersionFile(versionFile, updateInfo)) { return false; } const auto shouldUpdateStable = IsVersionGreater(updateInfo.stable.version, updateInfo.currentVersion); const auto shouldUpdateBeta = IsVersionGreater(updateInfo.beta.version, updateInfo.currentVersion); if (!shouldUpdateStable || !shouldUpdateBeta) { return false; } updateInfo.stable.shouldUpdate = *shouldUpdateStable; updateInfo.beta.shouldUpdate = *shouldUpdateBeta; return true; } bool UpdateChecker::GetVersionFile(std::string &fileContents) const { WMLog &log = WMLog::GetInstance(); URL_COMPONENTS updateUrl{0}; updateUrl.dwStructSize = sizeof(updateUrl); updateUrl.dwSchemeLength = (DWORD)-1; updateUrl.dwHostNameLength = (DWORD)-1; updateUrl.dwUrlPathLength = (DWORD)-1; if (!WinHttpCrackUrl(UPDATE_FILE_URL, 0, 0, &updateUrl)) { log.LogWinError(L"WinHttpCrackUrl", GetLastError()); return false; } HInternetHolder hSession = WinHttpOpen( L"WinMute", WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, WINHTTP_FLAG_SECURE_DEFAULTS); if (hSession == nullptr) { log.LogWinError(L"WinHttpOpen", GetLastError()); return false; } const std::wstring updateHost( updateUrl.lpszHostName, updateUrl.lpszHostName + updateUrl.dwHostNameLength); HInternetHolder hConnect = WinHttpConnect( hSession, updateHost.c_str(), (updateUrl.nScheme == INTERNET_SCHEME_HTTPS) ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT, 0); if (hConnect == nullptr) { log.LogWinError(L"WinHttpConnect", GetLastError()); return false; } const std::wstring updateFilePath( updateUrl.lpszUrlPath, updateUrl.lpszUrlPath + updateUrl.dwUrlPathLength); HInternetHolder hRequest = WinHttpOpenRequest( hConnect, L"GET", updateFilePath.c_str(), nullptr, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE); if (hRequest == nullptr) { log.LogWinError(L"WinHttpConnect", GetLastError()); return false; } bool result = WinHttpSendRequest( hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0); if (!result) { log.LogWinError(L"WinHttpSendRequest", GetLastError()); return false; } result = WinHttpReceiveResponse(hRequest, nullptr); if (!result) { log.LogWinError(L"WinHttpReceiveResponse", GetLastError()); return false; } DWORD statusCode = 0; DWORD statusCodeSize = static_cast(sizeof(statusCode)); result = WinHttpQueryHeaders( hRequest, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, WINHTTP_HEADER_NAME_BY_INDEX, reinterpret_cast(&statusCode), &statusCodeSize, WINHTTP_NO_HEADER_INDEX); if (!result) { log.LogWinError(L"WinHttpQueryHeaders(WINHTTP_QUERY_STATUS_CODE)", GetLastError()); return false; } else if (statusCode != HTTP_STATUS_OK) { log.LogError(L"Update-Server returned HTTP %d", HTTP_STATUS_OK); return false; } fileContents.clear(); for (;;) { DWORD availBytes = 0; if (!WinHttpQueryDataAvailable(hRequest, &availBytes)) { log.LogWinError(L"WinHttpQueryDataAvailable", GetLastError()); return false; } if (availBytes == 0) { break; } std::string chunk(availBytes, ' '); DWORD byRead = 0; if (!WinHttpReadData(hRequest, reinterpret_cast(&chunk[0]), availBytes, &byRead)) { log.LogWinError(L"WinHttpReadData", GetLastError()); return false; } fileContents.append(chunk.begin(), chunk.begin() + byRead); } return true; } bool UpdateChecker::IsUpdateCheckDisabledViaFile() const { wchar_t thisExePath[MAX_PATH * 2]; const DWORD thisExePathSize = ARRAY_SIZE(thisExePath); const DWORD thisPathLen = GetModuleFileNameW(nullptr, thisExePath, thisExePathSize); if (thisPathLen == 0 || (thisPathLen == thisExePathSize && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) { WMLog::GetInstance().LogWinError(L"GetModuleFileNameW", ERROR_INSUFFICIENT_BUFFER); return false; } fs::path updateDisableFile{ thisExePath }; updateDisableFile.replace_filename(L"update-check.disabled"); if (!fs::exists(updateDisableFile)) { return false; } return true; } bool UpdateChecker::IsUpdateCheckEnabled(const WMSettings &settings) const { const auto updateCheckSetting = settings.QueryValue(SettingsKey::CHECK_FOR_UPDATE); if (updateCheckSetting == static_cast(UpdateCheckInterval::DISABLED)) { return false; } if (IsUpdateCheckDisabledViaFile()) { return false; } return true; } ================================================ FILE: WinMute/UpdateChecker.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "WMSettings.h" enum class UpdateCheckInterval : int { DISABLED = 0, ON_STARTUP = 1, }; struct UpdateVersionInfo { std::wstring version; std::wstring downloadUrl; bool shouldUpdate = false; }; struct UpdateInfo { std::wstring currentVersion; UpdateVersionInfo stable; UpdateVersionInfo beta; }; class UpdateChecker { public: UpdateChecker(); ~UpdateChecker(); bool IsUpdateCheckDisabledViaFile() const; bool IsUpdateCheckEnabled(const WMSettings &settings) const; bool GetUpdateInfo(UpdateInfo& updateInfo) const; private: UpdateChecker(const UpdateChecker &) = delete; UpdateChecker &operator=(const UpdateChecker &) = delete; UpdateChecker(const UpdateChecker &&) = delete; UpdateChecker &operator=(const UpdateChecker &&) = delete; bool GetVersionFile(std::string &fileContents) const; bool ParseVersionFile(const std::string &fileContents, UpdateInfo& updateInfo) const; std::optional IsVersionGreater(const std::wstring &newVers, const std::wstring &curVers) const; bool ParseVersion(const std::wstring &vers, std::vector& parsedVers) const; bool ParseVersionInfo(const nlohmann::json &json, UpdateVersionInfo &versInfo) const; }; ================================================ FILE: WinMute/Utility.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "Common.h" // ========================================================================= // Types // ========================================================================= struct WINDOWPROCESSINFO { DWORD pid; HWND hWnd; }; // ========================================================================= // ShowWindowsError // ========================================================================= void ShowWindowsError(const wchar_t *functionName, DWORD lastError) { // Retrieve the system error message for the last-error code if (lastError == -1) { lastError = GetLastError(); } LPVOID lpMsgBuf; if (FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, lastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast(&lpMsgBuf), 0, nullptr) == 0) { return; } // Display the error message and exit the process const std::wstring errorMsgText{ reinterpret_cast(lpMsgBuf) }; const std::wstring errorMsg = std::vformat( WMi18n::GetInstance().GetTranslationW("general.error.winapi.text"), std::make_wformat_args( functionName, lastError, errorMsgText)); TaskDialog( nullptr, nullptr, PROGRAM_NAME, errorMsg.c_str(), nullptr, TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); LocalFree(lpMsgBuf); } // ========================================================================= // GetWinMuteversion // ========================================================================= bool GetWinMuteVersion(std::wstring &versNumber) { DWORD unused; wchar_t fileName[MAX_PATH]; if (GetModuleFileNameW(nullptr, fileName, sizeof(fileName) / sizeof(fileName[0])) == 0) { return false; } const DWORD versSize = GetFileVersionInfoSizeEx(FILE_VER_GET_NEUTRAL, fileName, &unused); std::vector versData(versSize); if (!GetFileVersionInfoExW(FILE_VER_GET_NEUTRAL, fileName, 0, versSize, versData.data())) { return false; } VS_FIXEDFILEINFO *pvi = nullptr; UINT pviLen = sizeof(*pvi); if (!VerQueryValueW(versData.data(), L"\\", reinterpret_cast(&pvi), &pviLen)) { return false; } versNumber = std::format( L"{}.{}.{}.{}", pvi->dwProductVersionMS >> 16, pvi->dwFileVersionMS & 0xFFFF, pvi->dwFileVersionLS >> 16, pvi->dwFileVersionLS & 0xFFFF); return true; } // ========================================================================= // String Conversion // ========================================================================= std::wstring ConvertStringToWideString(const std::string &ansiString) { std::wstring unicodeString; auto wideCharSize = MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, ansiString.c_str(), -1, nullptr, 0); if (wideCharSize == 0) { return L""; } unicodeString.reserve(wideCharSize); unicodeString.resize(wideCharSize - 1); wideCharSize = MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, ansiString.c_str(), -1, &unicodeString[0], wideCharSize); return unicodeString; } std::string ConvertWideStringToString(const std::wstring &wideString) { std::string ansiString; auto ansiStringSize = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wideString.c_str(), -1, nullptr, 0, "?", nullptr); if (ansiStringSize == 0) { return ""; } ansiString.reserve(ansiStringSize); ansiString.resize(ansiStringSize - 1); ansiStringSize = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wideString.c_str(), -1, &ansiString[0], ansiStringSize, "?", nullptr); return ansiString; } // ========================================================================= // Launch Browser // ========================================================================= bool LaunchBrowser(HWND hParent, const std::wstring &url) { SHELLEXECUTEINFOW sxi = { 0 }; sxi.cbSize = sizeof(sxi); sxi.nShow = SW_SHOWNORMAL; sxi.hwnd = hParent; sxi.lpVerb = L"open"; sxi.lpFile = url.c_str(); if (!ShellExecuteExW(&sxi)) { WMLog::GetInstance().LogWinError(L"ShellExecuteEx", GetLastError()); return false; } return true; } ================================================ FILE: WinMute/Utility.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include #include // ============================================================================= // Utility void ShowWindowsError(const wchar_t *functionName, DWORD lastError = -1); bool GetWinMuteVersion(std::wstring &versNumber); std::wstring ConvertStringToWideString(const std::string &ansiString); std::string ConvertWideStringToString(const std::wstring &wideString); bool LaunchBrowser(HWND hParent, const std::wstring &url); // ============================================================================= // COM Helper template inline void SafeRelease(Interface **ppInterfaceToRelease) { if (*ppInterfaceToRelease) { (*ppInterfaceToRelease)->Release(); (*ppInterfaceToRelease) = nullptr; } } ================================================ FILE: WinMute/VersionHelper.h ================================================ /* WinMute Copyright (c) 2021, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" #ifndef _versionhelpers_H_INCLUDED_ // avoid conflict with MS versionhelpers inline bool IsWindowsVersionOrGreater( WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) noexcept { OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, { 0 }, 0, 0 }; DWORDLONG const dwlConditionMask = VerSetConditionMask( VerSetConditionMask( VerSetConditionMask( 0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_MINORVERSION, VER_GREATER_EQUAL), VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); osvi.dwMajorVersion = wMajorVersion; osvi.dwMinorVersion = wMinorVersion; osvi.wServicePackMajor = wServicePackMajor; return VerifyVersionInfoW( &osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; } inline bool IsWindowsXPOrGreater() { return IsWindowsVersionOrGreater( HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0); } inline bool IsWindowsVistaOrGreater() { return IsWindowsVersionOrGreater( HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0); } #endif ================================================ FILE: WinMute/VistaAudio.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" #include #include #include "WinAudio.h" #define IF_FAILED_JUMP(hResult, ExitLabel) if (FAILED(hr)) { goto ExitLabel; } _COM_SMARTPTR_TYPEDEF(IPropertyStore, __uuidof(IPropertyStore)); _COM_SMARTPTR_TYPEDEF(IMMDevice, __uuidof(IMMDevice)); _COM_SMARTPTR_TYPEDEF(IMMDeviceCollection, __uuidof(IMMDeviceCollection)); _COM_SMARTPTR_TYPEDEF(IAudioSessionManager2, __uuidof(IAudioSessionManager2)); Endpoint::Endpoint() : endpointVolume(nullptr), wasapiAudioEvents(nullptr), wasMuted(false) { deviceName[0] = _T('\0'); } Endpoint::~Endpoint() { if (sessionCtrl && wasapiAudioEvents != nullptr) { sessionCtrl->UnregisterAudioSessionNotification(wasapiAudioEvents.get()); } } VistaAudio::VistaAudio() : deviceEnumerator_(nullptr), mmnAudioEvents_(nullptr), reInit_(false), muteSpecificEndpoints_(false), muteSpecificEndpointsAllowList_(false), hParent_(nullptr) { if (FAILED(CoInitialize(nullptr))) { throw std::exception("Failed to initialize COM Library"); } } VistaAudio::~VistaAudio() { Uninit(); CoUninitialize(); } bool VistaAudio::LoadAllEndpoints() { WMLog& log = WMLog::GetInstance(); assert(deviceEnumerator_ != nullptr); IMMDeviceCollectionPtr audioEndpoints; HRESULT hr = deviceEnumerator_->EnumAudioEndpoints( eRender, DEVICE_STATE_ACTIVE, &audioEndpoints); IF_FAILED_JUMP(hr, exit_error); UINT epCount; hr = audioEndpoints->GetCount(&epCount); IF_FAILED_JUMP(hr, exit_error); for (UINT i = 0; i < epCount; ++i) { std::unique_ptr ep = std::make_unique(); IMMDevicePtr device = nullptr; IPropertyStorePtr propStore; hr = audioEndpoints->Item(i, &device); if (FAILED(hr)) { log.LogError(L"Failed to get audio endpoint #%d", i); continue; } hr = device->OpenPropertyStore(STGM_READ, &propStore); if (FAILED(hr)) { log.LogError(L"Failed to open property store for audio endpoint #%d", i); continue; } PROPVARIANT value; PropVariantInit(&value); hr = propStore->GetValue(PKEY_Device_FriendlyName, &value); if (FAILED(hr)) { log.LogError(L"Failed to get device name for audio endpoint #%d", i); continue; } log.LogInfo(L"Found audio endpoint \"%s\"", value.pwszVal); StringCchCopy(ep->deviceName, sizeof(ep->deviceName)/sizeof(ep->deviceName[0]), value.pwszVal); PropVariantClear(&value); IAudioSessionManager2Ptr sessionManager2; if (FAILED(device->Activate( __uuidof(IAudioSessionManager2), CLSCTX_INPROC_SERVER, nullptr, reinterpret_cast(&sessionManager2)))) { log.LogError(L"Failed to retrieve audio session manager for \"%s\"", ep->deviceName); continue; } hr = sessionManager2->GetAudioSessionControl(nullptr, 0, &ep->sessionCtrl); if (FAILED(hr)) { log.LogError(L"Failed to retrieve audio session manager for \"%s\"", ep->deviceName); continue; } ep->wasapiAudioEvents = std::make_unique(this); if (ep->wasapiAudioEvents) { ep->sessionCtrl->RegisterAudioSessionNotification( ep->wasapiAudioEvents.get()); } hr = device->Activate( __uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, nullptr, reinterpret_cast(&ep->endpointVolume)); if (FAILED(hr)) { log.LogError(L"Failed to active endpoint volume for device \"%s\"", ep->deviceName); continue; } endpoints_.push_back(std::move(ep)); } exit_error: return true; } bool VistaAudio::Init(HWND hParent) { WMLog& log = WMLog::GetInstance(); hParent_ = hParent; reInit_ = false; if (FAILED(deviceEnumerator_.CreateInstance( __uuidof(MMDeviceEnumerator), nullptr, CLSCTX_INPROC_SERVER))) { log.LogError(L"Failed to create instance of MMDeviceEnumerator"); return false; } LoadAllEndpoints(); mmnAudioEvents_ = new MMNotificationClient(this); if (mmnAudioEvents_) { deviceEnumerator_->RegisterEndpointNotificationCallback(mmnAudioEvents_); } return true; } void VistaAudio::Uninit() { if (deviceEnumerator_ && mmnAudioEvents_) { deviceEnumerator_->UnregisterEndpointNotificationCallback(mmnAudioEvents_); } deviceEnumerator_.Release(); SafeRelease(&mmnAudioEvents_); endpoints_.clear(); } void VistaAudio::ShouldReInit() { reInit_ = true; } bool VistaAudio::CheckForReInit() { bool ok = true; if (reInit_) { Uninit(); ok = Init(hParent_); } return ok; } bool VistaAudio::AllEndpointsMuted() { bool allMuted = true; WMLog& log = WMLog::GetInstance(); if (CheckForReInit()) { for (auto& e : endpoints_) { BOOL isMuted = FALSE; if (FAILED(e->endpointVolume->GetMute(&isMuted))) { log.LogError( L"Failed to get mute status for \"%s\"", e->deviceName); allMuted = false; break; } else if (isMuted == FALSE) { allMuted = false; break; } } } return allMuted; } bool VistaAudio::SaveMuteStatus() { bool success = true; WMLog& log = WMLog::GetInstance(); if (CheckForReInit()) { for (auto& e : endpoints_) { BOOL isMuted = FALSE; if (FAILED(e->endpointVolume->GetMute(&isMuted))) { log.LogError( L"Failed to get mute status for \"%s\"", e->deviceName); success = false; } else { e->wasMuted = isMuted; } } } return success; } bool VistaAudio::RestoreMuteStatus() { bool success = true; WMLog& log = WMLog::GetInstance(); if (!CheckForReInit()) { return false; } for (auto& e : endpoints_) { if (!IsEndpointManaged(e->deviceName)) { log.LogInfo(L"Skipping Endpoint %s", e->deviceName); continue; } log.LogInfo(L"Restoring: Mute %s for \"%s\"", (e->wasMuted) ? L"true" : L"false", e->deviceName); if (e->wasMuted != true) { if (FAILED(e->endpointVolume->SetMute(false, nullptr))) { log.LogError(_T("Failed to restore mute status to %s for \"%s\""), (e->wasMuted) ? L"true" : L"false", e->deviceName); success = false; } } } return success; } void VistaAudio::SetMute(bool mute) { WMLog& log = WMLog::GetInstance(); if (CheckForReInit()) { for (auto& e : endpoints_) { BOOL isMuted = !mute; if (!IsEndpointManaged(e->deviceName)) { log.LogInfo(L"Skipping Endpoint %s", e->deviceName); continue; } if (FAILED(e->endpointVolume->GetMute(&isMuted))) { log.LogError( L"Failed to get mute status for \"%s\"", e->deviceName); } if (!!isMuted != mute) { if (FAILED(e->endpointVolume->SetMute(mute, nullptr))) { log.LogError( L"Failed to set mute status to %s for \"%s\"", (e->wasMuted) ? L"true" : L"false", e->deviceName); } } } } } bool VistaAudio::IsEndpointManaged(const std::wstring &endpointName) const { if (!muteSpecificEndpoints_) { return true; } const bool inManagedEndpoints = std::find( std::begin(managedEndpointNames_), std::end(managedEndpointNames_), endpointName) != std::end(managedEndpointNames_); // ------------+----------+-------------+ // | In List | Not in List | // ------------+----------+-------------+ // Allow List | Mute | Not mute | // Block List | Not mute | Mute | return inManagedEndpoints ? muteSpecificEndpointsAllowList_ : !muteSpecificEndpointsAllowList_; } void VistaAudio::MuteSpecificEndpoints(bool muteSpecific) { muteSpecificEndpoints_ = muteSpecific; } void VistaAudio::SetManagedEndpoints( const std::vector &endpoints, bool isAllowList) { managedEndpointNames_ = endpoints; muteSpecificEndpointsAllowList_ = isAllowList; } ================================================ FILE: WinMute/VistaAudioSessionEvents.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" #include "WinAudio.h" #include "VistaAudioSessionEvents.h" VistaAudioSessionEvents::VistaAudioSessionEvents(WinAudio* notifyParent) : ref_(1) { notifyParent_ = notifyParent; } VistaAudioSessionEvents::~VistaAudioSessionEvents() { } ULONG STDMETHODCALLTYPE VistaAudioSessionEvents::AddRef() { return InterlockedIncrement(&ref_); } ULONG STDMETHODCALLTYPE VistaAudioSessionEvents::Release() { ULONG ref = InterlockedDecrement(&ref_); if (ref == 0) { delete this; } return ref; } HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::QueryInterface( REFIID riid, VOID** ppvInterface) { if (riid == IID_IUnknown) { AddRef(); *ppvInterface = reinterpret_cast(this); } else if (riid == __uuidof(IAudioSessionEvents)) { AddRef(); *ppvInterface = reinterpret_cast(this); } else { *ppvInterface = nullptr; return E_NOINTERFACE; } return S_OK; } HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnDisplayNameChanged( LPCWSTR /*newDisplayName*/, LPCGUID /*eventContext*/) noexcept { return S_OK; } HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnIconPathChanged( LPCWSTR /*newIconPath*/, LPCGUID /*eventContext*/) noexcept { return S_OK; } HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnSimpleVolumeChanged( float /*newVolume*/, BOOL /*newMute*/, LPCGUID /*eventContext*/) noexcept { return S_OK; } HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnChannelVolumeChanged( DWORD /*channelCount*/, float* /*newChannelVolumeArray[]*/, DWORD /*changedChannel*/, LPCGUID /*eventContext*/) noexcept { return S_OK; } HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnGroupingParamChanged( LPCGUID /*newGroupingParam*/, LPCGUID /*eventContext*/) noexcept { return S_OK; } HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnStateChanged( AudioSessionState /*newState*/) noexcept { return S_OK; } /* See * http://blogs.msdn.com/b/larryosterman/archive/2007/10/31/what-happens-when-audio-rendering-fails.aspx * for detailed information about each of these entries */ HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnSessionDisconnected( AudioSessionDisconnectReason disconnectReason) noexcept { switch (disconnectReason) { case DisconnectReasonDeviceRemoval: case DisconnectReasonFormatChanged: case DisconnectReasonSessionDisconnected: notifyParent_->ShouldReInit(); break; case DisconnectReasonServerShutdown: { WMi18n &i18n = WMi18n::GetInstance(); TaskDialog(nullptr, nullptr, PROGRAM_NAME, i18n.GetTranslationW("general.error.audio-service-shutdown.title").c_str(), i18n.GetTranslationW("general.error.audio-service-shutdown.text").c_str(), TDCBF_OK_BUTTON, TD_WARNING_ICON, nullptr); break; } case DisconnectReasonSessionLogoff: break; case DisconnectReasonExclusiveModeOverride: break; } return S_OK; } ================================================ FILE: WinMute/VistaAudioSessionEvents.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" #include class WinAudio; class VistaAudioSessionEvents : public IAudioSessionEvents { public: explicit VistaAudioSessionEvents(WinAudio* notifyParent); ~VistaAudioSessionEvents(); // IUnknown methods -- AddRef, Release, and QueryInterface ULONG STDMETHODCALLTYPE AddRef(); ULONG STDMETHODCALLTYPE Release(); HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID** ppvInterface); // Notification methods for audio session events HRESULT STDMETHODCALLTYPE OnDisplayNameChanged( LPCWSTR newDisplayName, LPCGUID eventContext) noexcept override; HRESULT STDMETHODCALLTYPE OnIconPathChanged( LPCWSTR newIconPath, LPCGUID eventContext) noexcept override; HRESULT STDMETHODCALLTYPE OnSimpleVolumeChanged( float newVolume, BOOL newMute, LPCGUID eventContext) noexcept override; HRESULT STDMETHODCALLTYPE OnChannelVolumeChanged( DWORD channelCount, float newChannelVolumeArray[], DWORD changedChannel, LPCGUID eventContext) noexcept override; HRESULT STDMETHODCALLTYPE OnGroupingParamChanged( LPCGUID newGroupingParam, LPCGUID eventContext) noexcept override; HRESULT STDMETHODCALLTYPE OnStateChanged( AudioSessionState newState) noexcept override; HRESULT STDMETHODCALLTYPE OnSessionDisconnected( AudioSessionDisconnectReason disconnectReason) noexcept override; private: LONG ref_; WinAudio* notifyParent_; }; ================================================ FILE: WinMute/WMLog.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" #include "WMLog.h" static const wchar_t* LogLevelToString(LogLevel level) { switch (level) { case LogLevel::Debug: return L"DEBUG"; case LogLevel::Info: return L"INFO"; case LogLevel::Error: return L"ERROR"; default: return L"UNKNOWN"; } } static bool OpenLogFile(const std::wstring& filePath, std::wofstream& logFile) { logFile.open(filePath, std::ios::out | std::ios::app | std::ios::binary); return logFile.is_open(); } WMLog& WMLog::GetInstance() { static WMLog log; return log; } WMLog::WMLog(): enabled_(false) { } WMLog::~WMLog() { if (logFile_.is_open()) { logFile_.close(); } } std::wstring WMLog::GetLogFilePath() { wchar_t tempPath[MAX_PATH + 1]; if (GetTempPathW(ARRAY_SIZE(tempPath), tempPath)) { std::wstring path{ tempPath }; path += LOG_FILE_NAME; return path; } return std::wstring(); } void WMLog::DeleteLogFile() { const auto logFilePath = GetLogFilePath(); if (logFile_.is_open()) { logFile_.close(); } DeleteFileW(logFilePath.c_str()); } void WMLog::EnableLogFile(bool enable) { const std::lock_guard lock(logMutex_); if (enable == enabled_) { if (!enable) { DeleteLogFile(); } return; } if (enable) { if (OpenLogFile(GetLogFilePath(), logFile_)) { enabled_ = true; } } else { if (logFile_.is_open()) { logFile_.close(); } DeleteLogFile(); enabled_ = false; } } bool WMLog::IsLogFileEnabled() const { return enabled_; } std::wstring WMLog::FormatLogMessage(const LogMessage &logMsg, bool new_line) const { auto msg = std::format( L"{:%F %T%Ez} {}: {}{}", logMsg.time, LogLevelToString(logMsg.level), logMsg.message, new_line ? L"\r\n" : L""); return msg; } void WMLog::StoreMessage(LogLevel level, const wchar_t* msg) { namespace ch = std::chrono; LogMessage lm; lm.level = level; lm.message = msg; lm.time = ch::zoned_time{ ch::current_zone(), ch::floor(ch::system_clock::now()) }; if (enabled_ && logFile_.is_open()) { const auto logMsg = FormatLogMessage(lm, true); logFile_.write(logMsg.c_str(), logMsg.length()); logFile_.flush(); } { const std::scoped_lock lock(wndMutex_); for (const auto hWnd : registeredWindows_) { if (IsWindow(hWnd)) { SendMessageW(hWnd, WM_LOG_UPDATED, 0, reinterpret_cast(&lm)); } } } { const std::scoped_lock lock(logMutex_); logMessages_.push_back(std::move(lm)); if (logMessages_.size() >= kMaxLogEntries_) { logMessages_.erase( logMessages_.begin(), logMessages_.begin() + (logMessages_.size() - kMaxLogEntries_ / 2)); } } } std::vector WMLog::GetLogMessages() const { const std::scoped_lock lock(logMutex_); return logMessages_; } void WMLog::RegisterForLogUpdates(HWND hWnd) { const std::scoped_lock lock(wndMutex_); if (std::find(registeredWindows_.begin(), registeredWindows_.end(), hWnd) == registeredWindows_.end()) { registeredWindows_.push_back(hWnd); } } void WMLog::UnregisterForLogUpdates(HWND hWnd) { const std::scoped_lock lock(wndMutex_); if (const auto it = std::find(registeredWindows_.begin(), registeredWindows_.end(), hWnd); it != registeredWindows_.end()) { registeredWindows_.erase(it); } } void WMLog::LogDebug(_In_z_ _Printf_format_string_ const wchar_t *fmt, ...) { wchar_t buf[1024]; va_list ap; va_start(ap, fmt); vswprintf_s(buf, fmt, ap); StoreMessage(LogLevel::Debug, buf); va_end(ap); } void WMLog::LogInfo(_In_z_ _Printf_format_string_ const wchar_t *fmt, ...) { wchar_t buf[1024]; va_list ap; va_start(ap, fmt); vswprintf_s(buf, fmt, ap); StoreMessage(LogLevel::Info, buf); va_end(ap); } void WMLog::LogError(_In_z_ _Printf_format_string_ const wchar_t *fmt, ...) { wchar_t buf[1024]; va_list ap; va_start(ap, fmt); vswprintf_s(buf, fmt, ap); StoreMessage(LogLevel::Error, buf); va_end(ap); } void WMLog::LogWinError(const wchar_t *functionName, DWORD lastError) { // Retrieve the system error message for the last-error code if (lastError == -1) { lastError = GetLastError(); } LPVOID lpMsgBuf; if (FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, lastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast(&lpMsgBuf), 0, nullptr) == 0) { return; } const std::wstring errorMsgText{ reinterpret_cast(lpMsgBuf) }; const std::wstring errorMsg = std::vformat( WMi18n::GetInstance().GetTranslationW("general.error.winapi.text"), std::make_wformat_args( functionName, lastError, errorMsgText)); StoreMessage(LogLevel::Error, static_cast(lpMsgBuf)); LocalFree(lpMsgBuf); } ================================================ FILE: WinMute/WMLog.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" enum class LogLevel { Debug, Info, Error, }; struct LogMessage { LogLevel level = LogLevel::Info; std::chrono::zoned_time time; std::wstring message; }; class WMLog { public: static WMLog& GetInstance(); void LogDebug(_In_z_ _Printf_format_string_ const wchar_t *fmt, ...); void LogInfo(_In_z_ _Printf_format_string_ const wchar_t* fmt, ...); void LogError(_In_z_ _Printf_format_string_ const wchar_t *fmt, ...); void LogWinError(const wchar_t *functionName, DWORD errorCode = -1); void EnableLogFile(bool enable); bool IsLogFileEnabled() const; std::wstring GetLogFilePath(); std::vector GetLogMessages() const; void RegisterForLogUpdates(HWND hWnd); void UnregisterForLogUpdates(HWND hWnd); std::wstring FormatLogMessage(const LogMessage &logMsg, bool new_line=false) const; private: WMLog(); ~WMLog(); WMLog(const WMLog&) = delete; WMLog& operator=(const WMLog&) = delete; const int kMaxLogEntries_ = 500; void StoreMessage(LogLevel level, const wchar_t *msg); void DeleteLogFile(); mutable std::mutex logMutex_; mutable std::mutex wndMutex_; bool enabled_; std::wofstream logFile_; std::vector logMessages_; std::vector registeredWindows_; }; ================================================ FILE: WinMute/WMSettings.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" static constexpr int CURRENT_SETTINGS_VERSION = 0; static const wchar_t *LX_SYSTEMS_SUBKEY = L"SOFTWARE\\lx-systems\\WinMute"; static const wchar_t* LX_SYSTEMS_WIFI_SUBKEY = L"SOFTWARE\\lx-systems\\WinMute\\WifiNetworks"; static const wchar_t* LX_SYSTEMS_BLUETOOTH_SUBKEY = L"SOFTWARE\\lx-systems\\WinMute\\BluetoothDevices"; static const wchar_t *LX_SYSTEMS_AUDIO_ENDPOINTS_SUBKEY = L"SOFTWARE\\lx-systems\\WinMute\\ManagedAudioEndpoints"; static const wchar_t* LX_SYSTEMS_AUTOSTART_KEY = L"LX-Systems WinMute"; extern HINSTANCE hglobInstance; static const wchar_t* KeyToStr(SettingsKey key) { const wchar_t* keyStr = nullptr; switch (key) { case SettingsKey::SETTINGS_VERSION: keyStr = L"SettingsVersion"; break; case SettingsKey::MUTE_ON_LOCK: keyStr = L"MuteOnLock"; break; case SettingsKey::MUTE_ON_DISPLAYSTANDBY: keyStr = L"MuteOnDisplayStandby"; break; case SettingsKey::MUTE_ON_RDP: keyStr = L"MuteOnRDP"; break; case SettingsKey::RESTORE_AUDIO: keyStr = L"RestoreAudio"; break; case SettingsKey::MUTE_ON_SUSPEND: keyStr = L"MuteOnSuspend"; break; case SettingsKey::MUTE_ON_SHUTDOWN: keyStr = L"MuteOnShutdown"; break; case SettingsKey::MUTE_ON_LOGOUT: keyStr = L"MuteOnLogout"; break; case SettingsKey::MUTE_ON_BLUETOOTH: keyStr = L"MuteOnBluetooth"; break; case SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST: keyStr = L"MuteOnBluetoothDeviceList"; break; case SettingsKey::MUTE_ON_WLAN: keyStr = L"MuteOnWlan"; break; case SettingsKey::MUTE_ON_WLAN_ALLOWLIST: keyStr = L"MuteOnWlanAllowList"; break; case SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS: keyStr = L"MuteIndividualEndpoints"; break; case SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS_MODE: keyStr = L"MuteIndividualEndpointsMode"; break; case SettingsKey::MUTE_DELAY: keyStr = L"MuteDelay"; break; case SettingsKey::QUIETHOURS_ENABLE: keyStr = L"QuietHoursEnabled"; break; case SettingsKey::QUIETHOURS_FORCEUNMUTE: keyStr = L"QuietHoursForceUnmute"; break; case SettingsKey::QUIETHOURS_NOTIFICATIONS: keyStr = L"QuietHoursNotifications"; break; case SettingsKey::QUIETHOURS_START: keyStr = L"QuietHoursStart"; break; case SettingsKey::QUIETHOURS_END: keyStr = L"QuietHoursEnd"; break; case SettingsKey::LOGGING_ENABLED: keyStr = L"Logging"; break; case SettingsKey::NOTIFICATIONS_ENABLED: keyStr = L"ShowNotifications"; break; case SettingsKey::APP_LANGUAGE: keyStr = L"AppLanguage"; break; case SettingsKey::CHECK_FOR_UPDATE: keyStr = L"CheckForUpdate"; break; case SettingsKey::CHECK_FOR_BETA_UPDATE: keyStr = L"CheckForBetaUpdate"; break; } return keyStr; } static DWORD GetDefaultSetting(SettingsKey key) { switch (key) { case SettingsKey::SETTINGS_VERSION: return 0; case SettingsKey::MUTE_ON_LOCK: return 1; case SettingsKey::MUTE_ON_DISPLAYSTANDBY: return 1; case SettingsKey::MUTE_ON_RDP: return 0; case SettingsKey::RESTORE_AUDIO: return 1; case SettingsKey::MUTE_ON_SUSPEND: return 0; case SettingsKey::MUTE_ON_SHUTDOWN: return 0; case SettingsKey::MUTE_ON_LOGOUT: return 0; case SettingsKey::MUTE_ON_WLAN: return 0; case SettingsKey::MUTE_ON_WLAN_ALLOWLIST: return 0; case SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS: return 0; case SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS_MODE: return MUTE_ENDPOINT_MODE_INDIVIDUAL_ALLOW_LIST; case SettingsKey::MUTE_DELAY: return 0; case SettingsKey::QUIETHOURS_ENABLE: return 0; case SettingsKey::QUIETHOURS_FORCEUNMUTE: return 0; case SettingsKey::QUIETHOURS_NOTIFICATIONS: return 0; case SettingsKey::QUIETHOURS_START: return 0; case SettingsKey::QUIETHOURS_END: return 0; case SettingsKey::LOGGING_ENABLED: return 0; case SettingsKey::NOTIFICATIONS_ENABLED: return 0; case SettingsKey::APP_LANGUAGE: return 0; case SettingsKey::CHECK_FOR_UPDATE: return 0; case SettingsKey::CHECK_FOR_BETA_UPDATE: return 0; } return 0; } template static void NormalizeStringList(std::vector> &items) { if (items.size() > 1) { std::sort(std::begin(items), std::end(items)); auto it = std::unique(std::begin(items), std::end(items)); items.resize(std::distance(std::begin(items), it)); } } static bool ReadStringFromRegistry(HKEY hKey, const wchar_t *subKey, std::wstring& val) { bool success = false; DWORD regError = 0; DWORD bufSize = 0; WMLog &log = WMLog::GetInstance(); regError = RegQueryValueExW(hKey, subKey, nullptr, nullptr, nullptr, &bufSize); if (regError != ERROR_SUCCESS) { if (regError != ERROR_FILE_NOT_FOUND) { ShowWindowsError(L"RegQueryValueExW", regError); log.LogError(L"[Registry] Failed to read key \"%s\".", subKey); } } else { bufSize += 1; // Trailing '\0' wchar_t *buf = new wchar_t[bufSize]; regError = RegQueryValueExW(hKey, subKey, nullptr, nullptr, reinterpret_cast(buf), &bufSize); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegQueryValueExW", regError); log.LogError(L"[Registry] Failed to query value for key \"%s\".", subKey); } else { success = true; val = buf; } delete [] buf; } return success; } WMSettings::WMSettings() : hSettingsKey_(nullptr), hWifiKey_(nullptr), hBluetoothKey_(nullptr), hAudioEndpointsKey_(nullptr) { } WMSettings::~WMSettings() { Unload(); } bool WMSettings::MigrateSettings() { DWORD version = QueryValue(SettingsKey::SETTINGS_VERSION); if (version != CURRENT_SETTINGS_VERSION) { WMLog::GetInstance().LogError(L"Unexpected settings version: %d", version); } return true; } bool WMSettings::Init() { if (hSettingsKey_ == nullptr) { DWORD regError = RegCreateKeyExW( HKEY_CURRENT_USER, LX_SYSTEMS_SUBKEY, 0, nullptr, 0, KEY_READ | KEY_WRITE, nullptr, &hSettingsKey_, nullptr); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegCreateKeyEx", regError); return false; } } if (hWifiKey_ == nullptr) { DWORD regError = RegCreateKeyExW( HKEY_CURRENT_USER, LX_SYSTEMS_WIFI_SUBKEY, 0, nullptr, 0, KEY_READ | KEY_WRITE, nullptr, &hWifiKey_, nullptr); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegCreateKeyEx", regError); RegCloseKey(hSettingsKey_); hSettingsKey_ = nullptr; return false; } } if (hBluetoothKey_ == nullptr) { DWORD regError = RegCreateKeyExW( HKEY_CURRENT_USER, LX_SYSTEMS_BLUETOOTH_SUBKEY, 0, nullptr, 0, KEY_READ | KEY_WRITE, nullptr, &hBluetoothKey_, nullptr); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegCreateKeyEx", regError); RegCloseKey(hWifiKey_); RegCloseKey(hSettingsKey_); hSettingsKey_ = nullptr; hWifiKey_ = nullptr; return false; } } if (hAudioEndpointsKey_ == nullptr) { DWORD regError = RegCreateKeyExW( HKEY_CURRENT_USER, LX_SYSTEMS_AUDIO_ENDPOINTS_SUBKEY, 0, nullptr, 0, KEY_READ | KEY_WRITE, nullptr, &hAudioEndpointsKey_, nullptr); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegCreateKeyEx", regError); RegCloseKey(hWifiKey_); RegCloseKey(hSettingsKey_); RegCloseKey(hBluetoothKey_); hSettingsKey_ = nullptr; hWifiKey_ = nullptr; hBluetoothKey_ = nullptr; return false; } } MigrateSettings(); return true; } void WMSettings::Unload() noexcept { RegCloseKey(hSettingsKey_); hSettingsKey_ = nullptr; RegCloseKey(hWifiKey_); hWifiKey_ = nullptr; RegCloseKey(hBluetoothKey_); hBluetoothKey_ = nullptr; } HKEY WMSettings::OpenAutostartKey(REGSAM samDesired) { HKEY hRunKey = nullptr; DWORD regError = RegOpenKeyExW( HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0, samDesired, &hRunKey); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegOpenKeyEx", regError); } return hRunKey; } bool WMSettings::IsAutostartEnabled() { bool isEnabled = false; WMLog& log = WMLog::GetInstance(); wchar_t wmPath[MAX_PATH + 1]; if (GetModuleFileName(nullptr, wmPath, sizeof(wmPath) / sizeof(wmPath[0])) == 0) { log.LogError(L"Failed to get path of winmute"); } else { HKEY hRunKey = OpenAutostartKey(KEY_READ); if (hRunKey != nullptr) { std::wstring path; if (ReadStringFromRegistry(hRunKey, LX_SYSTEMS_AUTOSTART_KEY, path)) { if (path != wmPath) { log.LogInfo(L"Autostart entry has wrong path"); } else { isEnabled = true; } } RegCloseKey(hRunKey); } } return isEnabled; } void WMSettings::EnableAutostart(bool enable) { WMLog& log = WMLog::GetInstance(); HKEY hRunKey = OpenAutostartKey(KEY_WRITE); if (hRunKey != nullptr) { if (enable) { wchar_t wmPath[MAX_PATH + 1]; if (GetModuleFileNameW(nullptr, wmPath, sizeof(wmPath) / sizeof(wmPath[0])) == 0) { log.LogError(L"Failed to get path of winmute"); } else { DWORD regError = RegSetKeyValueW( hRunKey, nullptr, LX_SYSTEMS_AUTOSTART_KEY, REG_SZ, wmPath, (lstrlen(wmPath) + 1) * sizeof(wchar_t)); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegSetKeyValue", regError); } } } else { DWORD regError = RegDeleteKeyValueW(hRunKey, nullptr, LX_SYSTEMS_AUTOSTART_KEY); if (regError != ERROR_SUCCESS && regError != ERROR_FILE_NOT_FOUND) { ShowWindowsError(L"RegDeleteKeyValue", regError); } } RegCloseKey(hRunKey); } } DWORD WMSettings::QueryValue(SettingsKey key) const { auto keyStr = KeyToStr(key); assert(keyStr != nullptr); DWORD value = 0; DWORD size = sizeof(DWORD); DWORD regError = RegQueryValueExW( hSettingsKey_, keyStr, 0, nullptr, reinterpret_cast(&value), &size); if (regError != ERROR_SUCCESS) { if (regError != ERROR_FILE_NOT_FOUND) { ShowWindowsError(L"RegQueryValueExW", regError); WMLog &log = WMLog::GetInstance(); log.LogError(L"[Registry] Failed to query value for key \"%s\"", keyStr); } return GetDefaultSetting(key); } return value; } std::optional WMSettings::QueryStrValue(SettingsKey key) const { std::wstring val; auto keyStr = KeyToStr(key); assert(keyStr != nullptr); if (!ReadStringFromRegistry(hSettingsKey_, keyStr, val)) { return std::nullopt; } return val; } bool WMSettings::SetValue(SettingsKey key, DWORD value) { auto keyStr = KeyToStr(key); assert(keyStr != nullptr); DWORD regError = RegSetValueExW( hSettingsKey_, keyStr, 0, REG_DWORD, reinterpret_cast(&value), sizeof(DWORD)); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegSetValueExW", regError); return false; } return true; } bool WMSettings::SetValue(SettingsKey key, const std::wstring &value) { auto keyStr = KeyToStr(key); assert(keyStr != nullptr); BYTE *strValue = reinterpret_cast(const_cast(value.c_str())); DWORD strLen = static_cast((value.length() + 1) * sizeof(wchar_t)); DWORD regError = RegSetValueExW( hSettingsKey_, keyStr, 0, REG_SZ, strValue, strLen); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegSetValueExW", regError); return false; } return true; } bool WMSettings::StoreWifiNetworks(std::vector& networks) { // Clear all stored keys for (;;) { wchar_t valueName[260] = { 0 }; DWORD valueSize = ARRAY_SIZE(valueName); DWORD regError = RegEnumValueW( hWifiKey_, 0, valueName, &valueSize, nullptr, nullptr, nullptr, nullptr); if (regError == ERROR_NO_MORE_ITEMS) { break; } else if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegEnumValue", regError); return false; } else { regError = RegDeleteValue(hWifiKey_, valueName); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegDeleteValue", regError); return false; } } } NormalizeStringList(networks); for (size_t i = 0; i < networks.size(); ++i) { wchar_t valueName[25]; StringCchPrintfW(valueName, ARRAY_SIZE(valueName), L"WiFi %03lld", i + 1); const std::wstring& v = networks[i]; DWORD regError = RegSetValueExW( hWifiKey_, valueName, 0, REG_SZ, reinterpret_cast(v.c_str()), static_cast(v.length() + 1) * sizeof(wchar_t)); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegSetValueEx", regError); return false; } } return true; } std::vector WMSettings::GetWifiNetworks() const { std::vector networks; for (int valIdx = 0; ; ++valIdx) { wchar_t valueName[260] = { 0 }; wchar_t dataBuf[260] = { 0 }; DWORD valueSize = ARRAY_SIZE(valueName); DWORD valType = 0; DWORD dataLen = ARRAY_SIZE(dataBuf); DWORD regError = RegEnumValueW( hWifiKey_, valIdx, valueName, &valueSize, nullptr, &valType, reinterpret_cast(dataBuf), &dataLen); if (regError == ERROR_NO_MORE_ITEMS) { break; } else if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegEnumValue", regError); return {}; } else { networks.push_back(dataBuf); } } NormalizeStringList(networks); return networks; } bool WMSettings::StoreBluetoothDevices(std::vector& devices) { // Clear all stored keys for (;;) { wchar_t valueName[260] = { 0 }; DWORD valueSize = ARRAY_SIZE(valueName); DWORD regError = RegEnumValueW( hBluetoothKey_, 0, valueName, &valueSize, nullptr, nullptr, nullptr, nullptr); if (regError == ERROR_NO_MORE_ITEMS) { break; } else if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegEnumValue", regError); return false; } else { regError = RegDeleteValue(hBluetoothKey_, valueName); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegDeleteValue", regError); return false; } } } NormalizeStringList(devices); for (size_t i = 0; i < devices.size(); ++i) { wchar_t valueName[25]; StringCchPrintfW( valueName, ARRAY_SIZE(valueName), L"Bluetooth %03lld", i + 1); const std::wstring& v = devices[i]; DWORD regError = RegSetValueEx( hBluetoothKey_, valueName, 0, REG_SZ, reinterpret_cast(v.c_str()), static_cast(v.length() + 1) * sizeof(wchar_t)); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegSetValueEx", regError); return false; } } return true; } std::vector WMSettings::GetBluetoothDevicesA() const { std::vector devices; for (int valIdx = 0; ; ++valIdx) { char valueName[260] = { 0 }; char dataBuf[260] = { 0 }; DWORD valueSize = ARRAY_SIZE(valueName); DWORD valType = 0; DWORD dataLen = ARRAY_SIZE(dataBuf); DWORD regError = RegEnumValueA( hBluetoothKey_, valIdx, valueName, &valueSize, nullptr, &valType, reinterpret_cast(dataBuf), &dataLen); if (regError == ERROR_NO_MORE_ITEMS) { break; } else if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegEnumValue", regError); return {}; } else { devices.push_back(dataBuf); } } NormalizeStringList(devices); return devices; } std::vector WMSettings::GetBluetoothDevicesW() const { std::vector devices; for (int valIdx = 0; ; ++valIdx) { wchar_t valueName[260] = { 0 }; wchar_t dataBuf[260] = { 0 }; DWORD valueSize = ARRAY_SIZE(valueName); DWORD valType = 0; DWORD dataLen = ARRAY_SIZE(dataBuf); DWORD regError = RegEnumValueW( hBluetoothKey_, valIdx, valueName, &valueSize, nullptr, &valType, reinterpret_cast(dataBuf), &dataLen); if (regError == ERROR_NO_MORE_ITEMS) { break; } else if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegEnumValue", regError); return {}; } else { devices.push_back(dataBuf); } } NormalizeStringList(devices); return devices; } bool WMSettings::StoreManagedAudioEndpoints(std::vector &endpoints) { // Clear all stored keys for (;;) { wchar_t valueName[260] = { 0 }; DWORD valueSize = ARRAY_SIZE(valueName); DWORD regError = RegEnumValueW( hAudioEndpointsKey_, 0, valueName, &valueSize, nullptr, nullptr, nullptr, nullptr); if (regError == ERROR_NO_MORE_ITEMS) { break; } else if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegEnumValue", regError); return false; } else { regError = RegDeleteValue(hAudioEndpointsKey_, valueName); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegDeleteValue", regError); return false; } } } NormalizeStringList(endpoints); for (size_t i = 0; i < endpoints.size(); ++i) { wchar_t valueName[25]; StringCchPrintfW( valueName, ARRAY_SIZE(valueName), L"Endpoint %03lld", i + 1); const std::wstring &v = endpoints[i]; DWORD regError = RegSetValueEx( hAudioEndpointsKey_, valueName, 0, REG_SZ, reinterpret_cast(v.c_str()), static_cast(v.length() + 1) * sizeof(wchar_t)); if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegSetValueEx", regError); return false; } } return true; } std::vector WMSettings::GetManagedAudioEndpoints() const { std::vector devices; for (int valIdx = 0; ; ++valIdx) { wchar_t valueName[260] = { 0 }; wchar_t dataBuf[260] = { 0 }; DWORD valueSize = ARRAY_SIZE(valueName); DWORD valType = 0; DWORD dataLen = ARRAY_SIZE(dataBuf); DWORD regError = RegEnumValueW( hAudioEndpointsKey_, valIdx, valueName, &valueSize, nullptr, &valType, reinterpret_cast(dataBuf), &dataLen); if (regError == ERROR_NO_MORE_ITEMS) { break; } else if (regError != ERROR_SUCCESS) { ShowWindowsError(L"RegEnumValue", regError); return {}; } else { devices.push_back(dataBuf); } } NormalizeStringList(devices); return devices; } ================================================ FILE: WinMute/WMSettings.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" enum MuteEndPointMode { MUTE_ENDPOINT_MODE_INDIVIDUAL_ALLOW_LIST = 0, MUTE_ENDPOINT_MODE_INDIVIDUAL_BLOCK_LIST = 1 }; enum class SettingsKey { SETTINGS_VERSION , MUTE_ON_LOCK , MUTE_ON_DISPLAYSTANDBY , MUTE_ON_RDP , RESTORE_AUDIO , MUTE_ON_SUSPEND , MUTE_ON_SHUTDOWN , MUTE_ON_LOGOUT , MUTE_ON_BLUETOOTH , MUTE_ON_BLUETOOTH_DEVICELIST , MUTE_ON_WLAN , MUTE_ON_WLAN_ALLOWLIST , MUTE_INDIVIDUAL_ENDPOINTS // 1 = mute specific (allowlist), 2 = mute specific (blocklist) , MUTE_INDIVIDUAL_ENDPOINTS_MODE , MUTE_DELAY , QUIETHOURS_ENABLE , QUIETHOURS_FORCEUNMUTE , QUIETHOURS_NOTIFICATIONS , QUIETHOURS_START , QUIETHOURS_END , NOTIFICATIONS_ENABLED , LOGGING_ENABLED , APP_LANGUAGE , CHECK_FOR_UPDATE , CHECK_FOR_BETA_UPDATE }; class WMSettings { public: WMSettings(); ~WMSettings(); WMSettings(const WMSettings&) = delete; WMSettings& operator=(const WMSettings&) = delete; bool Init(); void Unload() noexcept; bool IsAutostartEnabled(); void EnableAutostart(bool enable); bool StoreWifiNetworks(std::vector& networks); std::vector GetWifiNetworks() const; bool StoreBluetoothDevices(std::vector& networks); std::vector GetBluetoothDevicesW() const; std::vector GetBluetoothDevicesA() const; bool StoreManagedAudioEndpoints(std::vector &endpoints); std::vector GetManagedAudioEndpoints() const; DWORD QueryValue(SettingsKey key) const; bool SetValue(SettingsKey key, DWORD value); std::optional QueryStrValue(SettingsKey key) const; bool SetValue(SettingsKey key, const std::wstring &value); private: HKEY hSettingsKey_; HKEY hWifiKey_; HKEY hBluetoothKey_; HKEY hAudioEndpointsKey_; bool MigrateSettings(); HKEY OpenAutostartKey(REGSAM samDesired); }; ================================================ FILE: WinMute/WMi18n.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" extern HINSTANCE hglobInstance; WMi18n::WMi18n() noexcept { } WMi18n::~WMi18n() noexcept { } WMi18n& WMi18n::GetInstance() { static WMi18n inst; return inst; } bool WMi18n::Init() { return LoadDefaultLanguage(); } std::optional WMi18n::GetLanguageFilesPath() const { wchar_t wmPath[MAX_PATH + 1]{ 0 }; if (GetModuleFileNameW(nullptr, wmPath, MAX_PATH) <= 0) { WMLog::GetInstance().LogWinError(L"GetModuleFileNameW", GetLastError()); return std::nullopt; } fs::path langPath = wmPath; return langPath.remove_filename() / L"lang"; } std::vector WMi18n::GetAvailableLanguages() const { std::vector langDlls; const auto langPath = GetLanguageFilesPath(); if (langPath.has_value()) { const fs::path searchPath = *langPath / L"*.json"; WIN32_FIND_DATAW wfd{ 0 }; HANDLE hFindFile = FindFirstFileExW( searchPath.c_str(), FindExInfoBasic, &wfd, FindExSearchNameMatch, nullptr, FIND_FIRST_EX_CASE_SENSITIVE); if (hFindFile != INVALID_HANDLE_VALUE) { do { try { const fs::path langFilePath = *langPath / wfd.cFileName; std::ifstream json_file(langFilePath); nlohmann::json file_info = nlohmann::json::parse(json_file); if (file_info.contains("meta.lang.name")) { LanguageModule langMod; langMod.fileName = wfd.cFileName; langMod.langName = ConvertStringToWideString(file_info["meta.lang.name"]); langDlls.push_back(langMod); } } catch (const nlohmann::json::parse_error &pe) { WMLog::GetInstance().LogError(L"Failed to parse language file \"%ls\": %S", wfd.cFileName, pe.what()); } } while (FindNextFileW(hFindFile, &wfd)); } } return langDlls; } std::wstring WMi18n::GetCurrentLanguageName() const { return GetTranslationW("meta.lang.name"); } bool WMi18n::LoadDefaultLanguage() { const std::lock_guard lock(langMutex_); if (!LoadLanguage(defaultLangName_, defaultLang_)) { const std::wstring error = std::format( L"Failed to load default language. Please make sure the langs-Folder exists and contains {}.", defaultLangName_); TaskDialog( nullptr, nullptr, PROGRAM_NAME, L"Failed to initialize translation framework", error.c_str(), TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); return false; } return true; } bool WMi18n::LoadLanguage(const std::wstring &fileName, TranslationMap &strings) { WMLog &log = WMLog::GetInstance(); auto langFilePath = GetLanguageFilesPath(); if (!langFilePath) { return false; } const fs::path loadFilePath{ fileName}; *langFilePath /= loadFilePath.filename(); // Sanitize if (!fs::exists(*langFilePath)) { log.LogError(L"Language module \"%ls\" does not exist", langFilePath->c_str()); return false; } try { std::ifstream json_file(*langFilePath); nlohmann::json json_data = nlohmann::json::parse(json_file); TranslationMap translations_temp; for (auto it = json_data.begin(); it != json_data.end(); ++it) { if (it->is_structured()) { log.LogError(L"Language module \"%ls\" has nested elements", langFilePath->c_str()); return false; } const auto value = ConvertStringToWideString(it.value()); if (value == L"") { log.LogError(L"Unable to convert language element \"%S\"", it.key().c_str()); return false; } if (translations_temp.contains(it.key())) { log.LogError(L"Double entry for language key \"%S\" found.", it.key().c_str()); return false; } translations_temp[it.key()] = value; } strings = std::move(translations_temp); } catch (const nlohmann::json::parse_error &pe) { log.LogError( L"Failed to parse language file \"%ls\": %S", langFilePath->filename().c_str(), pe.what()); return false; } return true; } bool WMi18n::LoadLanguage(const std::wstring &fileName) { const std::lock_guard lock(langMutex_); if (fileName.empty() || fileName == defaultLangName_) { UnloadLanguage(); return true; } TranslationMap new_lang; if (!LoadLanguage(fileName, new_lang)) { WMLog::GetInstance().LogError( L"Failed to load language \"%ls\"", fileName.c_str()); return false; } else { UnloadLanguage(); loadedLang_ = std::move(new_lang); } return true; } void WMi18n::UnloadLanguage() { loadedLang_.clear(); } const std::wstring WMi18n::GetTranslationW(const std::string& textId) const { std::wstring text; const std::lock_guard lock(langMutex_); if (!loadedLang_.empty() && loadedLang_.contains(textId)) { auto it = loadedLang_.find(textId); if (it != loadedLang_.end() && !it->second.empty()) { text = it->second; } } if (text.empty() && defaultLang_.contains(textId)) { auto it = defaultLang_.find(textId); if (it != defaultLang_.cend() && !it->second.empty()) { text = it->second; } } if (text.empty()) { std::wstring err = std::format( L"Translation for {} not found", ConvertStringToWideString(textId)); return text; } return text; } const std::string WMi18n::GetTranslationA(const std::string &textId) const { const std::wstring wtext = GetTranslationW(textId); return ConvertWideStringToString(wtext); } bool WMi18n::SetItemText(HWND hWnd, int dlgItem, const std::string& textId) const { const auto text = GetTranslationW(textId); if (!SetDlgItemTextW(hWnd, dlgItem, text.c_str())) { WMLog::GetInstance().LogWinError(L"SetDlgItemTextW", GetLastError()); return false; } return true; } bool WMi18n::SetItemText(HWND hItem, const std::string &textId) const { const auto text = GetTranslationW(textId); if (!SetWindowTextW(hItem, text.c_str())) { WMLog::GetInstance().LogWinError(L"SetDlgItemTextW", GetLastError()); return false; } return true; } ================================================ FILE: WinMute/WMi18n.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" struct LanguageModule { std::wstring langName; std::wstring fileName; }; using TranslationMap = std::map; class WMi18n { public: static WMi18n& GetInstance(); bool Init(); bool LoadLanguage(const std::wstring &fileName); std::vector GetAvailableLanguages() const; std::optional GetLanguageFilesPath() const; std::wstring GetCurrentLanguageName() const; const std::wstring GetTranslationW(const std::string& textId) const; const std::string GetTranslationA(const std::string& textId) const; bool SetItemText(HWND hWnd, int dlgItem, const std::string &textId) const; bool SetItemText(HWND hItem, const std::string &textId) const; private: WMi18n() noexcept; ~WMi18n() noexcept; WMi18n(const WMi18n &) = delete; WMi18n &operator=(const WMi18n &) = delete; mutable std::mutex langMutex_; const std::wstring defaultLangName_ = L"lang-en.json"; std::wstring curModuleName_; TranslationMap loadedLang_; TranslationMap defaultLang_; void UnloadLanguage(); bool LoadDefaultLanguage(); bool LoadLanguage(const std::wstring &fileName, TranslationMap &strings); }; ================================================ FILE: WinMute/WiFiDetector.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" /* wParam = Connected = 1 | Disconnected = 0. lParam = Pointer to Wifi Name */ constexpr int WM_WIFISTATUSCHANGED = WM_USER + 400; class WifiDetector { public: WifiDetector() noexcept; ~WifiDetector(); WifiDetector(const WifiDetector&) = delete; WifiDetector(WifiDetector&&) = delete; WifiDetector& operator=(const WifiDetector&) = delete; WifiDetector &operator=(WifiDetector&&) = delete; bool Init(HWND hNotifyWnd); void Unload() noexcept; void SetNetworkList(const std::vector& networks, bool isMuteList); void CheckNetwork(); void WlanNotificationCallback(PWLAN_NOTIFICATION_DATA notifyData); private: HWND hNotifyWnd_; HANDLE wlanHandle_; // If "true" then networks_ contains all networks where the workstation should // be muted. If false, then networks_ contains all networks where the ws should // not be muted. bool isMuteList_; bool initialized_; std::vector networks_; }; ================================================ FILE: WinMute/WifiDetector.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" static void WlanNotificationCallback( PWLAN_NOTIFICATION_DATA unnamedParam1, PVOID unnamedParam2) { WifiDetector* wifiDetector = reinterpret_cast(unnamedParam2); if (wifiDetector != nullptr) { wifiDetector->WlanNotificationCallback(unnamedParam1); } } WifiDetector::WifiDetector() noexcept : hNotifyWnd_(nullptr), wlanHandle_(nullptr), isMuteList_(true), initialized_(false) { } WifiDetector::~WifiDetector() { } void WifiDetector::Unload() noexcept { if (initialized_) { WlanRegisterNotification(wlanHandle_, WLAN_NOTIFICATION_SOURCE_NONE, TRUE, nullptr, nullptr, nullptr, nullptr); WlanCloseHandle(wlanHandle_, nullptr); initialized_ = false; hNotifyWnd_ = nullptr; } } bool WifiDetector::Init(HWND hNotifyWnd) { if (!initialized_) { DWORD vers = 2; hNotifyWnd_ = hNotifyWnd; DWORD wlErr = WlanOpenHandle(vers, nullptr, &vers, &wlanHandle_); if (wlErr != ERROR_SUCCESS) { if (wlErr != ERROR_SERVICE_NOT_ACTIVE) { ShowWindowsError(L"WlanOpenHandle", wlErr); } } else { wlErr = WlanRegisterNotification( wlanHandle_, WLAN_NOTIFICATION_SOURCE_ACM, TRUE, ::WlanNotificationCallback, this, nullptr, nullptr); if (wlErr != ERROR_SUCCESS) { ShowWindowsError(L"WlanOpenHandle", wlErr); WlanCloseHandle(wlanHandle_, nullptr); } else { initialized_ = true; } } } return initialized_; } void WifiDetector::SetNetworkList(const std::vector& networks, bool isMuteList) { networks_ = networks; isMuteList_ = isMuteList; } void WifiDetector::CheckNetwork() { PWLAN_INTERFACE_INFO_LIST ifList; DWORD wlanErr = WlanEnumInterfaces(wlanHandle_, nullptr, &ifList); if (wlanErr != ERROR_SUCCESS) { ShowWindowsError(L"WlanEnumInterfaces", wlanErr); } else { for (; ifList->dwIndex < ifList->dwNumberOfItems; ++ifList->dwIndex) { PWLAN_AVAILABLE_NETWORK_LIST availList = nullptr; wlanErr = WlanGetAvailableNetworkList( wlanHandle_, &ifList->InterfaceInfo[ifList->dwIndex].InterfaceGuid, 0, nullptr, &availList); if (wlanErr != ERROR_SUCCESS) { ShowWindowsError(L"WlanGetAvailableNetworkList", wlanErr); } else { for (; availList->dwIndex < availList->dwNumberOfItems; ++availList->dwIndex) { const PWLAN_AVAILABLE_NETWORK net = &availList->Network[availList->dwIndex]; if (net->dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED) { const auto it = std::find(std::begin(networks_), std::end(networks_), net->strProfileName); if (isMuteList_ && it != std::end(networks_) || !isMuteList_ && it == std::end(networks_)) { const size_t profileNameLen = lstrlen(net->strProfileName); wchar_t* wiFiName = new wchar_t[profileNameLen + 1]; StringCchCopy(wiFiName, profileNameLen + 1, net->strProfileName); SendMessage(hNotifyWnd_, WM_WIFISTATUSCHANGED, 1, reinterpret_cast(wiFiName)); break; } } } WlanFreeMemory(availList); } } WlanFreeMemory(ifList); } } void WifiDetector::WlanNotificationCallback(PWLAN_NOTIFICATION_DATA notifyData) { if (notifyData->NotificationSource != WLAN_NOTIFICATION_SOURCE_ACM) { return; } if (notifyData->NotificationCode == wlan_notification_acm_connection_complete || notifyData->NotificationCode == wlan_notification_acm_disconnected) { bool connected = notifyData->NotificationCode == wlan_notification_acm_connection_complete; WLAN_CONNECTION_NOTIFICATION_DATA * wcnd = reinterpret_cast(notifyData->pData); const auto it = std::find(std::begin(networks_), std::end(networks_), wcnd->strProfileName); if (isMuteList_ && it != std::end(networks_) || !isMuteList_ && it == std::end(networks_)) { size_t profileNameLen = lstrlen(wcnd->strProfileName); wchar_t* wiFiName = new wchar_t[profileNameLen + 1]; StringCchCopyW(wiFiName, profileNameLen + 1, wcnd->strProfileName); SendMessageW(hNotifyWnd_, WM_WIFISTATUSCHANGED, connected, reinterpret_cast(wiFiName)); } } } ================================================ FILE: WinMute/WinAudio.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" #include "VistaAudioSessionEvents.h" #include "MMNotificationClient.h" _COM_SMARTPTR_TYPEDEF(IAudioEndpointVolume, __uuidof(IAudioEndpointVolume)); _COM_SMARTPTR_TYPEDEF(IMMDeviceEnumerator, __uuidof(IMMDeviceEnumerator)); _COM_SMARTPTR_TYPEDEF(IAudioSessionControl, __uuidof(IAudioSessionControl)); class WinAudio { public: virtual bool Init(HWND hParent) = 0; virtual void ShouldReInit() = 0; virtual bool AllEndpointsMuted() = 0; virtual bool SaveMuteStatus() = 0; virtual bool RestoreMuteStatus() = 0; virtual void SetMute(bool mute) = 0; virtual void MuteSpecificEndpoints(bool muteSpecific) = 0; virtual void SetManagedEndpoints( const std::vector &endpoints, bool isAllowList) = 0; virtual ~WinAudio() noexcept {}; }; struct Endpoint { wchar_t deviceName[100]; IAudioEndpointVolumePtr endpointVolume; IAudioSessionControlPtr sessionCtrl; std::unique_ptr wasapiAudioEvents; bool wasMuted; Endpoint(); ~Endpoint(); Endpoint(const Endpoint&) = delete; Endpoint& operator=(const Endpoint&) = delete; }; class VistaAudio : public WinAudio { public: VistaAudio(); ~VistaAudio() noexcept; bool Init(HWND hParent) override; void ShouldReInit() override; bool AllEndpointsMuted() override; bool SaveMuteStatus() override; bool RestoreMuteStatus() override; void SetMute(bool mute) override; void MuteSpecificEndpoints(bool muteSpecific) override; void SetManagedEndpoints( const std::vector &endpoints, bool isAllowList) override; private: void Uninit(); bool CheckForReInit(); bool LoadAllEndpoints(); bool IsEndpointManaged(const std::wstring& endpointName) const; std::vector> endpoints_; MMNotificationClient* mmnAudioEvents_; IMMDeviceEnumeratorPtr deviceEnumerator_; bool reInit_; bool muteSpecificEndpoints_; bool muteSpecificEndpointsAllowList_; HWND hParent_; std::vector managedEndpointNames_; // non copy-able VistaAudio(const VistaAudio& other) = delete; VistaAudio& operator=(const VistaAudio& other) = delete; }; ================================================ FILE: WinMute/WinMain.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" HINSTANCE hglobInstance; static bool SetWorkingDirectory() { wchar_t wmFileName[MAX_PATH + 1]; if (GetModuleFileNameW(nullptr, wmFileName, ARRAY_SIZE(wmFileName)) > 0) { wchar_t* p = wcsrchr(wmFileName, L'\\'); if (p != nullptr) { *(p + 1) = L'\0'; SetCurrentDirectoryW(wmFileName); return true; } } return false; } static void LoadLanguage(WMSettings &settings, WMi18n &i18n) { auto langFile = settings.QueryStrValue(SettingsKey::APP_LANGUAGE); if (!langFile || langFile->empty()) { const auto langId = GetUserDefaultUILanguage() & 0xFF; if (langId == LANG_GERMAN) { langFile = L"lang-de.json"; } else if (langId == LANG_ITALIAN) { langFile = L"lang-it.json"; } else if (langId == LANG_DUTCH) { langFile = L"lang-nl.json"; } else if (langId == LANG_SPANISH) { langFile = L"lang-es.json"; } else { langFile = L"lang-en.json"; } settings.SetValue(SettingsKey::APP_LANGUAGE, *langFile); } if (langFile && !langFile->empty()) { i18n.LoadLanguage(*langFile); } } static bool InitWindowsComponents() { INITCOMMONCONTROLSEX initComCtrl; initComCtrl.dwSize = sizeof(INITCOMMONCONTROLSEX); initComCtrl.dwICC = ICC_LINK_CLASS; if (InitCommonControlsEx(&initComCtrl) == FALSE) { WMLog::GetInstance().LogWinError(L"InitCommonControlsEx", GetLastError()); return FALSE; } else if (CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) != S_OK) { WMLog::GetInstance().LogWinError(L"CoInitializeEx", GetLastError()); return FALSE; } return TRUE; } int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE, _In_ PWSTR, _In_ int) { hglobInstance = hInstance; WMSettings settings; WMi18n& i18n = WMi18n::GetInstance(); if (!i18n.Init()) { return FALSE; } if (!settings.Init()) { TaskDialog( nullptr, nullptr, PROGRAM_NAME, i18n.GetTranslationW("init.error.settings.title").c_str(), i18n.GetTranslationW("init.error.settings.text").c_str(), TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); return FALSE; } LoadLanguage(settings, i18n); HANDLE hMutex = CreateMutexW(nullptr, TRUE, L"LxSystemsWinMuteRunning"); if (hMutex == nullptr) { return FALSE; } else if (GetLastError() == ERROR_ALREADY_EXISTS) { ReleaseMutex(hMutex); TaskDialog( nullptr, nullptr, PROGRAM_NAME, i18n.GetTranslationW("init.error.already-running.title").c_str(), i18n.GetTranslationW("init.error.already-running.text").c_str(), TDCBF_OK_BUTTON, TD_INFORMATION_ICON, nullptr); return FALSE; } SetWorkingDirectory(); HeapSetInformation(nullptr, HeapEnableTerminationOnCorruption, nullptr, 0); if (!InitWindowsComponents()) { TaskDialog( nullptr, nullptr, PROGRAM_NAME, i18n.GetTranslationW("init.error.winmute.title").c_str(), i18n.GetTranslationW("init.error.winmute.text").c_str(), TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); ReleaseMutex(hMutex); return FALSE; } MSG msg = { nullptr }; WinMute program(settings); if (program.Init()) { while (GetMessage(&msg, nullptr, 0, 0)) { HWND hwnd = GetForegroundWindow(); if (!IsWindow(hwnd) || !IsDialogMessage(hwnd, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } CoUninitialize(); ReleaseMutex(hMutex); return static_cast(msg.wParam); } ================================================ FILE: WinMute/WinMute.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" #include "WinMute.h" #include "WinAudio.h" extern HINSTANCE hglobInstance; extern INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM); extern INT_PTR CALLBACK SettingsDlgProc(HWND, UINT, WPARAM, LPARAM); static const wchar_t *WINMUTE_CLASS_NAME = L"WinMute"; static const wchar_t *TERMINAL_SERVER_KEY = L"SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\"; static const wchar_t* GLASS_SESSION_ID = L"GlassSessionId"; static LRESULT CALLBACK WinMuteWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { auto wm = reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA)); switch (msg) { case WM_NCCREATE: { LPCREATESTRUCTW cs = reinterpret_cast(lParam); SetWindowLongPtrW(hWnd, GWLP_USERDATA, reinterpret_cast(cs->lpCreateParams)); return TRUE; } default: break; } return (wm) ? wm->WindowProc(hWnd, msg, wParam, lParam) : DefWindowProcW(hWnd, msg, wParam, lParam); } static bool IsCurrentSessionRemoteable() noexcept { bool isRemoteable = false; if (GetSystemMetrics(SM_REMOTESESSION)) { isRemoteable = true; } else { HKEY hRegKey = nullptr; LONG lResult; lResult = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TERMINAL_SERVER_KEY, 0, KEY_READ, &hRegKey); if (lResult == ERROR_SUCCESS) { DWORD dwGlassSessionId = 0; DWORD cbGlassSessionId = sizeof(dwGlassSessionId); DWORD dwType; lResult = RegQueryValueExW(hRegKey, GLASS_SESSION_ID, nullptr, &dwType, reinterpret_cast(&dwGlassSessionId), &cbGlassSessionId); if (lResult == ERROR_SUCCESS) { DWORD dwCurrentSessionId; if (ProcessIdToSessionId(GetCurrentProcessId(), &dwCurrentSessionId)) { isRemoteable = (dwCurrentSessionId != dwGlassSessionId); } } RegCloseKey(hRegKey); } } return isRemoteable; } WinMute::MuteConfig::MuteConfig() : muteOnWlan(false), muteOnBluetooth(false), showNotifications(false) { } WinMute::WinMute(WMSettings& settings) : hWnd_(nullptr), hTrayMenu_(nullptr), hAppIcon_(nullptr), hTrayIcon_(nullptr), hUpdateIcon_(nullptr), settings_(settings), i18n_(WMi18n::GetInstance()) { } WinMute::~WinMute() noexcept { Unload(); } bool WinMute::RegisterWindowClass() { WNDCLASSEX wc = { 0 }; wc.cbSize = sizeof(wc); wc.hIcon = LoadIcon(hglobInstance, MAKEINTRESOURCE(IDI_APP)); wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); wc.hInstance = hglobInstance; wc.lpfnWndProc = WinMuteWndProc; wc.lpszClassName = WINMUTE_CLASS_NAME; if (!RegisterClassExW(&wc)) { ShowWindowsError(L"RegisterClass"); return false; } return true; } bool WinMute::InitWindow() { hWnd_ = CreateWindowExW(WS_EX_TOOLWINDOW, WINMUTE_CLASS_NAME, PROGRAM_NAME, WS_POPUP, 0, 0, 0, 0, nullptr, 0, hglobInstance, this); if (hWnd_ == nullptr) { ShowWindowsError(L"CreateWindowEx"); return false; } return true; } bool WinMute::InitAudio() { if (IsWindowsVistaOrGreater()) { // Nothing to do } else if (IsWindowsXPOrGreater()) { TaskDialog( nullptr, nullptr, PROGRAM_NAME, i18n_.GetTranslationW("init.error.winmute.platform-support.title").c_str(), i18n_.GetTranslationW("init.error.winmute.platform-support.text").c_str(), TDCBF_OK_BUTTON, TD_ERROR_ICON, nullptr); return false; } if (!muteCtrl_.Init(hWnd_, &wmTray_)) { return false; } return true; } #define CHECK_MENU_ITEM(id, cond) \ (CheckMenuItem(hTrayMenu_, ID_TRAYMENU_ ## id, \ (cond) ? MF_CHECKED : MF_UNCHECKED) != -1) bool WinMute::InitTrayMenu() { if (hTrayMenu_ == nullptr) { hTrayMenu_ = LoadMenuW(hglobInstance, MAKEINTRESOURCE(IDR_TRAYMENU)); if (hTrayMenu_ == nullptr) { ShowWindowsError(L"LoadMenu"); return false; } } if (!CHECK_MENU_ITEM(MUTEONLOCK, muteCtrl_.GetMuteOnWorkstationLock()) || !CHECK_MENU_ITEM(RESTOREAUDIO, muteCtrl_.GetRestoreVolume()) || !CHECK_MENU_ITEM(MUTEONSUSPEND, muteCtrl_.GetMuteOnSuspend()) || !CHECK_MENU_ITEM(MUTEONSHUTDOWN, muteCtrl_.GetMuteOnShutdown()) || !CHECK_MENU_ITEM(MUTEONLOGOUT, muteCtrl_.GetMuteOnLogout())) { return false; } LoadMainMenuText(); return true; } #undef CHECK_MENU_ITEM bool WinMute::Init() { WMLog& log = WMLog::GetInstance(); hAppIcon_ = LoadIconW(hglobInstance, MAKEINTRESOURCE(IDI_APP)); #ifdef _DEBUG WMLog::GetInstance().EnableLogFile(true); #else WMLog::GetInstance().EnableLogFile(settings_.QueryValue(SettingsKey::LOGGING_ENABLED)); #endif log.LogInfo(L"Starting new session..."); if (!RegisterWindowClass() || !InitWindow()) { return false; } if (!InitAudio()) { return false; } if (!LoadSettings()) { return false; } if (!InitTrayMenu()) { return false; } if (!WTSRegisterSessionNotification(hWnd_, NOTIFY_FOR_THIS_SESSION)) { const DWORD lastError = GetLastError(); ShowWindowsError(L"WTSRegisterSessionNotification"); log.LogWinError(L"WTSRegisterSessionNotification", lastError); return false; } if (!RegisterPowerSettingNotification(hWnd_, &GUID_CONSOLE_DISPLAY_STATE, DEVICE_NOTIFY_WINDOW_HANDLE)) { const DWORD lastError = GetLastError(); ShowWindowsError(L"RegisterPowerSettingNotification", lastError); log.LogWinError(L"RegisterPowerSettingNotification", lastError); return false; } hTrayIcon_ = LoadIconW(hglobInstance, MAKEINTRESOURCE(IDI_APP)); if (hTrayIcon_ == nullptr) { ShowWindowsError(_T("LoadIcon")); return false; } hUpdateIcon_ = LoadIconW(hglobInstance, MAKEINTRESOURCE(IDI_APPUPDATE)); if (hUpdateIcon_ == nullptr) { ShowWindowsError(_T("LoadIcon")); return false; } wmTray_.Init(hWnd_, 0, hTrayIcon_, L"WinMute", true); updateTray_.Init(hWnd_, 1, hUpdateIcon_, L"WinMute Update", false, WM_WINMUTE_UPDATE_POPUP); quietHours_.Init(hWnd_, settings_); log.LogInfo(L"WinMute initialized"); if (settings_.QueryValue(SettingsKey::MUTE_ON_RDP) && IsCurrentSessionRemoteable()) { wmTray_.ShowPopup( i18n_.GetTranslationW("popup.remote-session-detected.title"), i18n_.GetTranslationW("popup.remote-session-detected.text")); muteCtrl_.SetMute(true); } CheckForUpdates(); return true; } bool WinMute::LoadSettings() { WMLog& log = WMLog::GetInstance(); if (log.IsLogFileEnabled()) { std::wstring versionNumber; GetWinMuteVersion(versionNumber); log.LogInfo(L"Starting WinMute %s", versionNumber.c_str()); log.LogInfo(L"Loading settings:"); log.LogInfo(L"Check for updates: %s", settings_.QueryValue(SettingsKey::CHECK_FOR_UPDATE) ? L"Yes" : L"No"); log.LogInfo(L"\tCheck for beta updates: %s", settings_.QueryValue(SettingsKey::CHECK_FOR_BETA_UPDATE) ? L"Yes" : L"No"); log.LogInfo(L"\tRestore volume: %s", settings_.QueryValue(SettingsKey::RESTORE_AUDIO) ? L"Yes" : L"No"); log.LogInfo(L"\tMute delay: %d", settings_.QueryValue(SettingsKey::MUTE_DELAY)); log.LogInfo(L"\tMute on lock: %s", settings_.QueryValue(SettingsKey::MUTE_ON_LOCK) ? L"Yes" : L"No"); log.LogInfo(L"\tMute on display standby: %s", settings_.QueryValue(SettingsKey::MUTE_ON_DISPLAYSTANDBY) ? L"Yes" : L"No"); log.LogInfo(L"\tMute on logout: %s", settings_.QueryValue(SettingsKey::MUTE_ON_LOGOUT) ? L"Yes" : L"No"); log.LogInfo(L"\tMute on suspend: %s", settings_.QueryValue(SettingsKey::MUTE_ON_SUSPEND) ? L"Yes" : L"No"); log.LogInfo(L"\tMute on shutdown: %s", settings_.QueryValue(SettingsKey::MUTE_ON_SHUTDOWN) ? L"Yes" : L"No"); log.LogInfo(L"\tShow notifications: %s", settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED) ? L"Yes" : L"No"); log.LogInfo(L"\tMute on bluetooth: %s", settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH) ? L"Yes" : L"No"); log.LogInfo(L"\t\tUse devicelist: %s", settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST) ? L"Yes" : L"No"); log.LogInfo(L"\tMute on WLAN: %s", settings_.QueryValue(SettingsKey::MUTE_ON_WLAN) ? L"Yes" : L"No"); log.LogInfo(L"\t\tUse allowlist: %s", settings_.QueryValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST) ? L"Yes" : L"No"); log.LogInfo(L"\tMute specific endpoints only: %s", settings_.QueryValue(SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS) ? L"Yes" : L"No"); } if (!settings_.QueryValue(SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS)) { muteCtrl_.ClearManagedEndpoints(); } else { const auto endpoints = settings_.GetManagedAudioEndpoints(); const bool isAllowList = settings_.QueryValue(SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS_MODE) == MUTE_ENDPOINT_MODE_INDIVIDUAL_ALLOW_LIST; muteCtrl_.SetManagedEndpoints(endpoints, isAllowList); } muteCtrl_.SetMuteDelay(settings_.QueryValue(SettingsKey::MUTE_DELAY)); muteCtrl_.SetRestoreVolume(settings_.QueryValue(SettingsKey::RESTORE_AUDIO)); muteCtrl_.SetMuteOnWorkstationLock(settings_.QueryValue(SettingsKey::MUTE_ON_LOCK)); muteCtrl_.SetMuteOnDisplayStandby(settings_.QueryValue(SettingsKey::MUTE_ON_DISPLAYSTANDBY)); muteCtrl_.SetMuteOnLogout(settings_.QueryValue(SettingsKey::MUTE_ON_LOGOUT)); muteCtrl_.SetMuteOnSuspend(settings_.QueryValue(SettingsKey::MUTE_ON_SUSPEND)); muteCtrl_.SetMuteOnShutdown(settings_.QueryValue(SettingsKey::MUTE_ON_SHUTDOWN)); muteCtrl_.SetNotifications(settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED)); muteConfig_.showNotifications = settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED); muteConfig_.muteOnBluetooth = settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH); if (!muteConfig_.muteOnBluetooth) { muteCtrl_.SetMuteOnBluetoothDisconnect(false); btDetector_.Unload(); } else { if (!btDetector_.Init(hWnd_)) { wmTray_.ShowPopup( i18n_.GetTranslationW("popup.bluetooth-muting-disabled.title"), i18n_.GetTranslationW("popup.bluetooth-muting-disabled.text")); settings_.SetValue(SettingsKey::MUTE_ON_BLUETOOTH, FALSE); } else { muteCtrl_.SetMuteOnBluetoothDisconnect(true); const bool muteOnWithDeviceList = settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST); btDetector_.SetDeviceList(settings_.GetBluetoothDevicesA(), muteOnWithDeviceList); } } muteConfig_.muteOnWlan = settings_.QueryValue(SettingsKey::MUTE_ON_WLAN); if (!muteConfig_.muteOnWlan) { wifiDetector_.Unload(); } else { if (!wifiDetector_.Init(hWnd_)) { wmTray_.ShowPopup( i18n_.GetTranslationW("popup.wlan-muting-disabled.title"), i18n_.GetTranslationW("popup.wlan-muting-disabled.text")); settings_.SetValue(SettingsKey::MUTE_ON_WLAN, FALSE); } else { const bool isMuteList = !settings_.QueryValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST); wifiDetector_.SetNetworkList(settings_.GetWifiNetworks(), isMuteList); wifiDetector_.CheckNetwork(); } } //GUID_MONITOR_POWER_ON return true; } void WinMute::ToggleMenuCheck(UINT item, bool* setting) noexcept { UINT state = GetMenuState(hTrayMenu_, item, MF_BYCOMMAND); if (state & MF_CHECKED) { *setting = false; CheckMenuItem(hTrayMenu_, item, MF_UNCHECKED); } else { *setting = true; CheckMenuItem(hTrayMenu_, item, MF_CHECKED); } } void WinMute::LoadMainMenuText() { std::map menuText; menuText[ID_TRAYMENU_INFO] = i18n_.GetTranslationW("traymenu.info"); menuText[ID_TRAYMENU_LABEL_MUTEWHEN] = i18n_.GetTranslationW("traymenu.mute-when"); menuText[ID_TRAYMENU_MUTEONLOCK] = i18n_.GetTranslationW("traymenu.mute-on-lock"); menuText[ID_TRAYMENU_MUTEONSCREENSUSPEND] = i18n_.GetTranslationW("traymenu.mute-on-screen-suspend"); menuText[ID_TRAYMENU_RESTOREAUDIO] = i18n_.GetTranslationW("traymenu.restore-volume"); menuText[ID_TRAYMENU_LABEL_MUTEON_NO_RESTORE] = i18n_.GetTranslationW("traymenu.mute-no-restore"); menuText[ID_TRAYMENU_MUTEONSHUTDOWN] = i18n_.GetTranslationW("traymenu.mute-on-shutdown"); menuText[ID_TRAYMENU_MUTEONSUSPEND] = i18n_.GetTranslationW("traymenu.mute-on-sleep"); menuText[ID_TRAYMENU_MUTEONLOGOUT] = i18n_.GetTranslationW("traymenu.mute-on-logout"); menuText[ID_TRAYMENU_MUTE] = i18n_.GetTranslationW("traymenu.mute-all-devices"); menuText[ID_TRAYMENU_SETTINGS] = i18n_.GetTranslationW("traymenu.settings"); menuText[ID_TRAYMENU_EXIT] = i18n_.GetTranslationW("traymenu.exit"); for (const auto& mt : menuText) { MENUITEMINFO mii{ sizeof(MENUITEMINFO) }; if (!GetMenuItemInfo(hTrayMenu_, mt.first, false, &mii)) { continue; } mii.fMask = MIIM_TYPE; mii.fType = MFT_STRING; mii.dwTypeData = const_cast(mt.second.c_str()); mii.cch = static_cast(mt.second.length()); if (!SetMenuItemInfo(hTrayMenu_, mt.first, false, &mii)) { continue; } } } void WinMute::CheckForUpdates() { auto updateChecker = std::make_unique(); if (!updateChecker || !updateChecker->IsUpdateCheckEnabled(settings_)) { return; } std::thread updateThread(&WinMute::CheckForUpdatesAsync, this, std::move(updateChecker)); updateThread.detach(); } void WinMute::CheckForUpdatesAsync(std::unique_ptr updateChecker) { const bool betaUpdates = settings_.QueryValue(SettingsKey::CHECK_FOR_BETA_UPDATE) != 0; if (!updateChecker) { return; } if (!updateChecker->GetUpdateInfo(updateInfo_)) { wmTray_.ShowPopup( i18n_.GetTranslationW("popup.error.update-check-failed.title"), i18n_.GetTranslationW("popup.error.update-check-failed.text")); } else if (updateInfo_.beta.shouldUpdate && betaUpdates) { const std::wstring popupTitle = std::vformat( i18n_.GetTranslationW("popup.update-available-beta.title"), std::make_wformat_args(updateInfo_.beta.version)); const std::wstring popupText = std::vformat( i18n_.GetTranslationW("popup.update-available-beta.text"), std::make_wformat_args(updateInfo_.currentVersion)); updateTray_.Show(); updateTray_.ShowPopup(popupTitle, popupText); } else if (updateInfo_.stable.shouldUpdate) { const std::wstring popupTitle = std::vformat( i18n_.GetTranslationW("popup.update-available.title"), std::make_wformat_args(updateInfo_.stable.version)); const std::wstring popupText = std::vformat( i18n_.GetTranslationW("popup.update-available.text"), std::make_wformat_args(updateInfo_.currentVersion)); updateTray_.Show(); updateTray_.ShowPopup(popupTitle, popupText); } } LRESULT WinMute::OnCommand(HWND hWnd, WPARAM wParam, LPARAM) { switch (LOWORD(wParam)) { case ID_TRAYMENU_INFO: { static bool dialogOpen = false; if (!dialogOpen) { dialogOpen = true; DialogBox( hglobInstance, MAKEINTRESOURCE(IDD_ABOUT), hWnd_, AboutDlgProc); dialogOpen = false; } break; } case ID_TRAYMENU_EXIT: SendMessage(hWnd, WM_CLOSE, 0, 0); break; case ID_TRAYMENU_SETTINGS: { static bool dialogOpen = false; if (!dialogOpen) { dialogOpen = true; if (DialogBoxParamW( hglobInstance, MAKEINTRESOURCE(IDD_SETTINGS), hWnd_, SettingsDlgProc, reinterpret_cast(&settings_)) == 0) { LoadSettings(); InitTrayMenu(); quietHours_.Reset(settings_); } dialogOpen = false; } break; } case ID_TRAYMENU_MUTE: { bool state = false; ToggleMenuCheck(ID_TRAYMENU_MUTE, &state); muteCtrl_.SetMute(state); break; } case ID_TRAYMENU_MUTEONLOCK: { bool checked = false; ToggleMenuCheck(ID_TRAYMENU_MUTEONLOCK, &checked); muteCtrl_.SetMuteOnWorkstationLock(checked); settings_.SetValue(SettingsKey::MUTE_ON_LOCK, checked); break; } case ID_TRAYMENU_RESTOREAUDIO: { bool checked = false; ToggleMenuCheck(ID_TRAYMENU_RESTOREAUDIO, &checked); muteCtrl_.SetRestoreVolume(checked); settings_.SetValue(SettingsKey::RESTORE_AUDIO, checked); break; } case ID_TRAYMENU_MUTEONSCREENSUSPEND: { bool checked = false; ToggleMenuCheck(ID_TRAYMENU_SCREENSUSPEND, &checked); muteCtrl_.SetMuteOnDisplayStandby(checked); settings_.SetValue(SettingsKey::MUTE_ON_DISPLAYSTANDBY, checked); break; } case ID_TRAYMENU_MUTEONSHUTDOWN: { bool checked = false; ToggleMenuCheck(ID_TRAYMENU_MUTEONSHUTDOWN, &checked); muteCtrl_.SetMuteOnShutdown(checked); settings_.SetValue(SettingsKey::MUTE_ON_SHUTDOWN, checked); break; } case ID_TRAYMENU_MUTEONSUSPEND: { bool checked = false; ToggleMenuCheck(ID_TRAYMENU_MUTEONSUSPEND, &checked); muteCtrl_.SetMuteOnSuspend(checked); settings_.SetValue(SettingsKey::MUTE_ON_SUSPEND, checked); break; } case ID_TRAYMENU_MUTEONLOGOUT: { bool checked = false; ToggleMenuCheck(ID_TRAYMENU_MUTEONBLUETOOTH, &checked); muteCtrl_.SetMuteOnLogout(checked); settings_.SetValue(SettingsKey::MUTE_ON_LOGOUT, checked); break; } default: break; } return 0; } LRESULT WinMute::OnTrayIcon(HWND hWnd, WPARAM, LPARAM lParam) { if (LOWORD(lParam) == WM_CONTEXTMENU || lParam == WM_LBUTTONUP || lParam == WM_RBUTTONUP) { POINT p = { 0 }; GetCursorPos(&p); SetForegroundWindow(hWnd); TrackPopupMenuEx( GetSubMenu(hTrayMenu_, 0), TPM_NONOTIFY | TPM_TOPALIGN | TPM_LEFTALIGN, p.x, p.y, hWnd_, nullptr); } return TRUE; } LRESULT WinMute::OnUpdatePopup(HWND hWnd, WPARAM, LPARAM lParam) { if (lParam == NIN_BALLOONUSERCLICK) { const bool betaUpdates = settings_.QueryValue(SettingsKey::CHECK_FOR_BETA_UPDATE) != 0; if (betaUpdates && updateInfo_.beta.shouldUpdate) { LaunchBrowser(hWnd, updateInfo_.beta.downloadUrl); } else if (updateInfo_.stable.shouldUpdate) { LaunchBrowser(hWnd, updateInfo_.stable.downloadUrl); } } if (lParam == NIN_BALLOONHIDE || lParam == NIN_BALLOONTIMEOUT || lParam == NIN_BALLOONUSERCLICK) { updateTray_.Hide(); } return 0; } LRESULT WinMute::OnSettingChange(HWND, WPARAM, LPARAM) { return 0; } LRESULT WinMute::OnPowerBroadcast(HWND, WPARAM wParam, LPARAM lParam) { if (wParam == PBT_APMSUSPEND) { muteCtrl_.NotifySuspend(true); } else if (wParam == PBT_POWERSETTINGCHANGE) { const PPOWERBROADCAST_SETTING bs = reinterpret_cast(lParam); if (IsEqualGUID(bs->PowerSetting, GUID_CONSOLE_DISPLAY_STATE)) { const DWORD state = bs->Data[0]; if (state == 0x0) { // Display standby muteCtrl_.NotifyDisplayStandby(true); } else if (state == 0x1) { // Display on muteCtrl_.NotifyDisplayStandby(false); } else if (state == 0x2) { // Display dimmed } } } return TRUE; } LRESULT WinMute::OnQuietHours(HWND, UINT msg, WPARAM, LPARAM) { if (msg == WM_WINMUTE_QUIETHOURS_START) { muteCtrl_.NotifyQuietHours(true); if (settings_.QueryValue(SettingsKey::QUIETHOURS_NOTIFICATIONS)) { wmTray_.ShowPopup( i18n_.GetTranslationW("popup.quiet-hours-started.title"), i18n_.GetTranslationW("popup.quiet-hours-started.text")); } quietHours_.SetEnd(); return 0; } else if (msg == WM_WINMUTE_QUIETHOURS_END) { muteCtrl_.NotifyQuietHours(false); if (settings_.QueryValue(SettingsKey::QUIETHOURS_NOTIFICATIONS)) { wmTray_.ShowPopup( i18n_.GetTranslationW("popup.quiet-hours-ended.title"), i18n_.GetTranslationW("popup.quiet-hours-ended.text")); } if (settings_.QueryValue(SettingsKey::QUIETHOURS_FORCEUNMUTE)) { muteCtrl_.SetMute(false); } quietHours_.SetStart(); } return 0; } LRESULT WinMute::OnDeviceChange(HWND, UINT msg, WPARAM wParam, LPARAM lParam) { if (muteConfig_.muteOnBluetooth) { const auto btStatus = btDetector_.GetBluetoothStatus(msg, wParam, lParam); if (btStatus == BluetoothDetector::BluetoothStatus::Connected) { muteCtrl_.NotifyBluetoothConnected(true); } else if (btStatus == BluetoothDetector::BluetoothStatus::Disconnected) { muteCtrl_.NotifyBluetoothConnected(false); } } return TRUE; } LRESULT WinMute::OnWifiStatusChange(HWND, WPARAM wParam, LPARAM lParam) { if (!muteConfig_.muteOnWlan) { return 0; } if (wParam != 1) { // Not Connected return 0; } if (settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED)) { std::wstring popupMsg; wchar_t *wifiName = reinterpret_cast(lParam); if (settings_.QueryValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST)) { popupMsg = std::vformat( i18n_.GetTranslationW("popup.wlan-not-on-mute-list.text"), std::make_wformat_args(wifiName)); } else { popupMsg = std::vformat( i18n_.GetTranslationW("popup.wlan-is-on-mute-list.text"), std::make_wformat_args(wifiName)); } wmTray_.ShowPopup( i18n_.GetTranslationW("popup.workstation-muted.title"), popupMsg); delete[] wifiName; } muteCtrl_.SetMute(true); return 0; } LRESULT CALLBACK WinMute::WindowProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static UINT uTaskbarRestart = 0; switch (msg) { case WM_CREATE: uTaskbarRestart = RegisterWindowMessageW(L"TaskbarCreated"); return TRUE; case WM_COMMAND: return OnCommand(hWnd, wParam, lParam); case WM_WINMUTE_UPDATE_POPUP: return OnUpdatePopup(hWnd, wParam, lParam); case WM_TRAYICON: return OnTrayIcon(hWnd, wParam, lParam); case WM_CLOSE: Close(); return 0; case WM_WTSSESSION_CHANGE: { if (wParam == WTS_SESSION_LOCK) { muteCtrl_.NotifyWorkstationLock(true); } else if (wParam == WTS_SESSION_UNLOCK) { muteCtrl_.NotifyWorkstationLock(false); } return 0; } case WM_POWERBROADCAST: return OnPowerBroadcast(hWnd, wParam, lParam); case WM_QUERYENDSESSION: return TRUE; case WM_ENDSESSION: if (wParam == TRUE) { if (lParam == 0) { // Shutdown muteCtrl_.NotifyShutdown(); } else if ((lParam & ENDSESSION_LOGOFF)) { muteCtrl_.NotifyLogout(); } } break; case WM_WINMUTE_QUIETHOURS_START: // fall through case WM_WINMUTE_QUIETHOURS_END: return OnQuietHours(hWnd, msg, wParam, lParam); case WM_DEVICECHANGE: return OnDeviceChange(hWnd, msg, wParam, lParam); case WM_WIFISTATUSCHANGED: return OnWifiStatusChange(hWnd, wParam, lParam); case WM_SETTINGCHANGE: return OnSettingChange(hWnd, wParam, lParam); default: if (msg == uTaskbarRestart) { // Restore trayicon if explorer.exe crashes wmTray_.Hide(); wmTray_.Show(); } break; } return DefWindowProc(hWnd, msg, wParam, lParam); } void WinMute::Unload() noexcept { settings_.Unload(); } void WinMute::Close() { Unload(); PostQuitMessage(0); } ================================================ FILE: WinMute/WinMute.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #include "common.h" class WinAudio; class WinMute { public: explicit WinMute(WMSettings& settings); WinMute(const WinMute&) = delete; WinMute(WinMute&&) = delete; WinMute& operator=(const WinMute &) = delete; WinMute& operator=(WinMute&&) = delete; ~WinMute() noexcept; bool Init(); void Close(); // for internal use LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); void CheckForUpdatesAsync(std::unique_ptr updateChecker); private: HWND hWnd_; HMENU hTrayMenu_; HICON hAppIcon_; HICON hTrayIcon_; HICON hUpdateIcon_; struct MuteConfig { MuteConfig(); bool showNotifications; bool muteOnWlan; bool muteOnBluetooth; } muteConfig_; TrayIcon wmTray_; TrayIcon updateTray_; WifiDetector wifiDetector_; WMSettings& settings_; WMi18n &i18n_; MuteControl muteCtrl_; QuietHoursTimer quietHours_; BluetoothDetector btDetector_; UpdateInfo updateInfo_; void CheckForUpdates(); bool RegisterWindowClass(); bool InitWindow(); bool InitAudio(); bool InitTrayMenu(); bool LoadSettings(); void Unload() noexcept; void ToggleMenuCheck(UINT item, bool* setting) noexcept; void LoadMainMenuText(); // Windows Callback LRESULT OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam); LRESULT OnTrayIcon(HWND hWnd, WPARAM wParam, LPARAM lParam); LRESULT OnSettingChange(HWND hWnd, WPARAM wParam, LPARAM lParam); LRESULT OnPowerBroadcast(HWND hWnd, WPARAM wParam, LPARAM lParam); LRESULT OnWifiStatusChange(HWND hWnd, WPARAM wParam, LPARAM lParam); LRESULT OnUpdatePopup(HWND hWnd, WPARAM wParam, LPARAM lParam); LRESULT OnDeviceChange(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT OnQuietHours(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); }; ================================================ FILE: WinMute/WinMute.rc ================================================ // Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "winres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // German (Germany) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) LANGUAGE LANG_GERMAN, SUBLANG_GERMAN #pragma code_page(1252) #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE BEGIN "resource.h\0" END 2 TEXTINCLUDE BEGIN "#include ""winres.h""\r\n" "\0" END 3 TEXTINCLUDE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_ABOUT DIALOGEX 0, 0, 313, 269 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT | WS_EX_APPWINDOW CAPTION "About WinMute" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_APP,IDC_STATIC,13,7,21,20,SS_CENTERIMAGE LTEXT "WinMute ",IDC_ABOUT_TITLE,45,7,193,23 CONTROL "",IDC_ABOUT_TAB,"SysTabControl32",0x0,7,34,299,202 PUSHBUTTON "OK",IDOK,242,246,64,16 END IDD_SETTINGS DIALOGEX 0, 0, 269, 267 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT | WS_EX_APPWINDOW CAPTION "Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "",IDC_SETTINGS_TAB,"SysTabControl32",0x0,7,7,255,238 DEFPUSHBUTTON "OK",IDOK,158,246,50,14 PUSHBUTTON "Cancel",IDCANCEL,212,246,50,14 END IDD_SETTINGS_GENERAL DIALOGEX 0, 0, 233, 205 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Language",IDC_SELECT_LANGUAGE_LABEL,7,14,41,10 COMBOBOX IDC_LANGUAGE,51,12,87,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "Run WinMute when this user logs on",IDC_RUNONSTARTUP, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,34,219,17 CONTROL "Check for updates on startup",IDC_CHECK_FOR_UPDATES_ON_STARTUP, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,50,219,17 CONTROL "Also check for beta-updates",IDC_CHECK_FOR_BETA_UPDATES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,27,65,199,17 LTEXT "Options disabled. Updates are handled externally.\nLine2",IDC_UPDATE_OPTIONS_DISABLED,29,83,204,19 CONTROL "Save log to file",IDC_ENABLELOGGING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,102,219,15 PUSHBUTTON "Open log file...",IDC_OPENLOG,22,118,104,16 LTEXT "[log file path]",IDC_LOGFILEPATH,23,138,203,27 CONTROL "Help translating",IDC_LINK_HELP_TRANSLATING, "SysLink",WS_TABSTOP,143,15,83,14 PUSHBUTTON "Show log...",IDC_OPENLOGDLG,129,118,94,16 END IDD_SETTINGS_QUIETHOURS DIALOGEX 0, 0, 246, 198 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "During Quiet Hours WinMute automatically mutes your PC volumes and unmutes it afterwards.",IDC_QUIET_HOURS_DESCRIPTION,7,9,232,22 CONTROL "Enable Quiet Hours",IDC_ENABLEQUIETHOURS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,31,120,15 LTEXT "Start time:",IDC_QUIET_HOURS_START_LABEL,23,50,64,13 CONTROL "",IDC_QUIETHOURS_START,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,88,47,67,18 LTEXT "End time:",IDC_QUIET_HOURS_END_LABEL,24,73,62,16 CONTROL "",IDC_QUIETHOURS_END,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP | 0x8,87,71,68,19 CONTROL "Force unmute",IDC_FORCEUNMUTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,94,86,16 LTEXT "If force unmute is enabled, WinMute will unmute your workstation when quiet hours end and not take into account if your workstation was already muted before quiet hours started.",IDC_QUIET_HOURS_FORCE_UNMUTE_DESCRIPTION,33,111,204,37 CONTROL "Show quiet hours notifications",IDC_SHOWNOTIFICATIONS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,146,180,21 END IDD_ABOUT_LICENSE DIALOGEX 0, 0, 300, 181 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN EDITTEXT IDC_LICENSETEXT,7,7,286,167,ES_CENTER | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL END IDD_ABOUT_WINMUTE DIALOGEX 0, 0, 298, 176 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "Author Site: www.lx-s.de",IDC_LINK_HOMEPAGE, "SysLink",WS_TABSTOP,197,14,94,14 CONTROL "Project Site && Code",IDC_LINK_PROJECT, "SysLink",WS_TABSTOP,197,32,94,14 CONTROL "Support",IDC_LINK_TICKETS, "SysLink",WS_TABSTOP,197,49,94,14 EDITTEXT IDC_ABOUTTEXT,7,14,182,144,ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | NOT WS_BORDER END IDD_SETTINGS_MUTE DIALOGEX 0, 0, 242, 222 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "General",IDC_GROUP_GENERAL,7,7,228,61 CONTROL "Show mute event notifications",IDC_SHOWNOTIFICATIONS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,15,219,18 CONTROL "Manage audio endpoints individually",IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,28,219,18 PUSHBUTTON "Manage endpoints...",IDC_MANAGE_ENDPOINTS,26,46,97,15 GROUPBOX "Mute with volume restore, when...",IDC_GROUP_MUTE_WITH_RESTORE,7,71,228,71 CONTROL "... the workstation is locked.",IDC_MUTE_WHEN_WS_LOCKED, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,83,207,10 CONTROL "... the screen turns off.",IDC_MUTE_WHEN_SCREEN_OFF, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,97,205,10 CONTROL "Restore volume afterwards.",IDC_RESTOREVOLUME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,112,210,10 EDITTEXT IDC_MUTEDELAY,13,124,30,13,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER LTEXT "seconds delay before muting.",IDC_DELAY_MUTING_LABEL,47,127,169,8 GROUPBOX "Mute without volume restore, when...",IDC_GROUP_MUTE_WITHOUT_RESTORE,7,145,228,67 CONTROL "... the computer shuts down.",IDC_MUTE_WHEN_SHUTDOWN, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,156,207,10 CONTROL "... the computer goes into sleep/hibernate.",IDC_MUTE_WHEN_SLEEP, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,170,206,10 CONTROL "... you log out.",IDC_MUTE_WHEN_LOGOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,184,207,10 CONTROL "... when WinMute is started within a RDP session.",IDC_MUTE_WHEN_RDP_SESSION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,198,208,10 END IDD_SETTINGS_WIFI DIALOGEX 0, 0, 242, 216 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Description\nDescription\nDescription\nDescription",IDC_WIFI_INTRO,7,7,228,37 CONTROL "Enable WLAN based muting",IDC_ENABLE_WIFI_MUTE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,44,228,14 CONTROL "Mute if connected WLAN is in list",IDC_WLAN_LIST_IS_ALLOWLIST, "Button",BS_AUTORADIOBUTTON,17,60,209,10 CONTROL "Mute if connected WLAN is not in list",IDC_WLAN_LIST_IS_BLOCKLIST, "Button",BS_AUTORADIOBUTTON,17,73,207,10 LISTBOX IDC_WIFI_LIST,7,88,166,121,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Add",IDC_WIFI_ADD,179,87,56,16 PUSHBUTTON "Edit",IDC_WIFI_EDIT,179,106,56,16 PUSHBUTTON "Remove",IDC_WIFI_REMOVE,179,125,56,16 PUSHBUTTON "Remove all",IDC_WIFI_REMOVEALL,179,193,56,16 END IDD_SETTINGS_WIFI_ADD DIALOGEX 0, 0, 201, 62 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Add WiFi" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "SSID/WiFi Name:",IDC_WIFI_NAME_LABEL,7,7,62,14 EDITTEXT IDC_WIFI_NAME,7,20,187,16,ES_AUTOHSCROLL DEFPUSHBUTTON "Save",IDOK,91,41,50,14 PUSHBUTTON "Cancel",IDCANCEL,144,41,50,14 END IDD_SETTINGS_BLUETOOTH DIALOGEX 0, 0, 244, 222 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Description\nDescription\nDescription\nDescription\nDescription\nDescription",IDC_BLUETOOTH_DESCRIPTION_LABEL,7,7,230,51 CONTROL "Enable Bluetooth based muting",IDC_ENABLE_BLUETOOTH_MUTE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,62,228,14 CONTROL "Enable only for these devices:",IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST, "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,20,79,215,12 LISTBOX IDC_BLUETOOTH_LIST,7,95,168,120,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Add",IDC_BLUETOOTH_ADD,181,94,56,16 PUSHBUTTON "Edit",IDC_BLUETOOTH_EDIT,181,113,56,16 PUSHBUTTON "Remove",IDC_BLUETOOTH_REMOVE,181,132,56,16 PUSHBUTTON "Remove all",IDC_BLUETOOTH_REMOVEALL,181,199,56,16 END IDD_SETTINGS_BLUETOOTH_ADD DIALOGEX 0, 0, 201, 62 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Add Bluetooth device" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Bluetooth device name:",IDC_LABEL_BT_DEVICE_NAME,7,7,187,14 COMBOBOX IDC_BT_DEVICE_NAME,7,22,187,17,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP DEFPUSHBUTTON "Save",IDOK,91,41,50,14 PUSHBUTTON "Cancel",IDCANCEL,144,41,50,14 END IDD_MANAGE_ENDPOINTS DIALOGEX 0, 0, 241, 200 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Manage Endpoints" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "List behaviour",IDC_GROUP_LIST_BEHAVIOUR,7,7,227,41 CONTROL "Mute only listed endpoints",IDC_ENDPOINT_LIST_IS_ALLOWLIST, "Button",BS_AUTORADIOBUTTON,13,19,209,10 CONTROL "Mute all but the listed endpoints",IDC_ENDPOINT_LIST_IS_BLOCKLIST, "Button",BS_AUTORADIOBUTTON,13,32,207,10 GROUPBOX "Endpoints",IDC_GROUP_ENDPOINTS,7,48,227,128 LISTBOX IDC_ENDPOINT_LIST,13,60,156,110,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Add",IDC_ENDPOINT_ADD,175,60,56,16 PUSHBUTTON "Edit",IDC_ENDPOINT_EDIT,175,78,56,16 PUSHBUTTON "Remove",IDC_ENDPOINT_REMOVE,175,97,56,16 PUSHBUTTON "Remove all",IDC_ENDPOINT_REMOVEALL,178,155,56,16 DEFPUSHBUTTON "Save",IDOK,133,179,50,14 PUSHBUTTON "Cancel",IDCANCEL,184,179,50,14 END IDD_MANAGE_ENDPOINTS_ADD DIALOGEX 0, 0, 201, 62 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Add Endpoint" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Endpoint name:",IDC_ENDPOINT_NAME_LABEL,7,7,187,14 COMBOBOX IDC_ENDPOINT_NAME,7,22,187,17,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP DEFPUSHBUTTON "Save",IDOK,91,41,50,14 PUSHBUTTON "Cancel",IDCANCEL,144,41,50,14 END IDD_LOG DIALOGEX 0, 0, 403, 253 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "WinMute Log" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN EDITTEXT IDC_LOG_CONTENT,7,7,389,238,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL | WS_HSCROLL END ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN IDD_ABOUT, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 306 TOPMARGIN, 7 BOTTOMMARGIN, 262 END IDD_SETTINGS, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 262 TOPMARGIN, 7 BOTTOMMARGIN, 260 END IDD_SETTINGS_GENERAL, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 226 TOPMARGIN, 7 BOTTOMMARGIN, 198 END IDD_SETTINGS_QUIETHOURS, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 239 TOPMARGIN, 7 BOTTOMMARGIN, 191 END IDD_ABOUT_LICENSE, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 293 TOPMARGIN, 7 BOTTOMMARGIN, 174 END IDD_ABOUT_WINMUTE, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 291 TOPMARGIN, 7 BOTTOMMARGIN, 169 END IDD_SETTINGS_MUTE, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 235 TOPMARGIN, 7 BOTTOMMARGIN, 213 END IDD_SETTINGS_WIFI, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 235 TOPMARGIN, 7 BOTTOMMARGIN, 209 END IDD_SETTINGS_WIFI_ADD, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 194 TOPMARGIN, 7 BOTTOMMARGIN, 55 END IDD_SETTINGS_BLUETOOTH, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 237 TOPMARGIN, 7 BOTTOMMARGIN, 215 END IDD_SETTINGS_BLUETOOTH_ADD, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 194 TOPMARGIN, 7 BOTTOMMARGIN, 55 END IDD_MANAGE_ENDPOINTS, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 234 TOPMARGIN, 7 BOTTOMMARGIN, 193 END IDD_MANAGE_ENDPOINTS_ADD, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 194 TOPMARGIN, 7 BOTTOMMARGIN, 55 END IDD_LOG, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 396 TOPMARGIN, 7 BOTTOMMARGIN, 245 END END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // AFX_DIALOG_LAYOUT // IDD_ABOUT AFX_DIALOG_LAYOUT BEGIN 0 END IDD_SETTINGS AFX_DIALOG_LAYOUT BEGIN 0 END IDD_SETTINGS_GENERAL AFX_DIALOG_LAYOUT BEGIN 0 END IDD_SETTINGS_QUIETHOURS AFX_DIALOG_LAYOUT BEGIN 0 END IDD_ABOUT_LICENSE AFX_DIALOG_LAYOUT BEGIN 0, 100, 100, 100, 100 END IDD_ABOUT_WINMUTE AFX_DIALOG_LAYOUT BEGIN 0 END IDD_SETTINGS_MUTE AFX_DIALOG_LAYOUT BEGIN 0 END IDD_SETTINGS_WIFI AFX_DIALOG_LAYOUT BEGIN 0 END IDD_SETTINGS_WIFI_ADD AFX_DIALOG_LAYOUT BEGIN 0 END IDD_SETTINGS_BLUETOOTH AFX_DIALOG_LAYOUT BEGIN 0 END IDD_SETTINGS_BLUETOOTH_ADD AFX_DIALOG_LAYOUT BEGIN 0 END IDD_MANAGE_ENDPOINTS AFX_DIALOG_LAYOUT BEGIN 0 END IDD_MANAGE_ENDPOINTS_ADD AFX_DIALOG_LAYOUT BEGIN 0 END IDD_LOG AFX_DIALOG_LAYOUT BEGIN 0, 0, 0, 100, 100 END ///////////////////////////////////////////////////////////////////////////// // // Icon // // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_APP ICON "icons\\app.ico" IDI_SETTINGS ICON "icons\\settings.ico" IDI_APPUPDATE ICON "icons\\app-update.ico" ///////////////////////////////////////////////////////////////////////////// // // Menu // IDR_TRAYMENU MENU BEGIN POPUP "TrayMenu" BEGIN MENUITEM "About", ID_TRAYMENU_INFO MENUITEM SEPARATOR MENUITEM "Mute when...", ID_TRAYMENU_LABEL_MUTEWHEN, INACTIVE MENUITEM "... Workstation is locked", ID_TRAYMENU_MUTEONLOCK, CHECKED MENUITEM "... Screen turns off", ID_TRAYMENU_MUTEONSCREENSUSPEND, CHECKED MENUITEM SEPARATOR MENUITEM "Restore volume afterwards", ID_TRAYMENU_RESTOREAUDIO, CHECKED MENUITEM SEPARATOR MENUITEM "Mute on (no volume restore)", ID_TRAYMENU_LABEL_MUTEON_NO_RESTORE, INACTIVE MENUITEM "... Shutdown", ID_TRAYMENU_MUTEONSHUTDOWN MENUITEM "... Sleep", ID_TRAYMENU_MUTEONSUSPEND MENUITEM "... Logout", ID_TRAYMENU_MUTEONLOGOUT MENUITEM SEPARATOR MENUITEM "Mute all devices", ID_TRAYMENU_MUTE MENUITEM SEPARATOR MENUITEM "Settings...", ID_TRAYMENU_SETTINGS MENUITEM SEPARATOR MENUITEM "Exit", ID_TRAYMENU_EXIT END END ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 2,5,4,0 PRODUCTVERSION 2,5,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040004b0" BEGIN VALUE "CompanyName", "LX-Systems" VALUE "FileDescription", "WinMute" VALUE "FileVersion", "2.5.4.0" VALUE "InternalName", "WinMute.exe" VALUE "LegalCopyright", "Copyright (C) 2025, Alexander Steinhoefer" VALUE "OriginalFilename", "WinMute.exe" VALUE "ProductName", "WinMute" VALUE "ProductVersion", "2.5.4.0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x400, 1200 END END #endif // German (Germany) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED ================================================ FILE: WinMute/WinMute.vcxproj ================================================ Debug Win32 Release Win32 Debug x64 Release x64 16.0 Win32Proj {479d2958-3ffc-43f8-8217-44d0ff9c11b1} WinMute 10.0 WinMute Application true v143 Unicode Spectre Application false v143 true Unicode Spectre Application true v143 Unicode Spectre Application false v143 true Unicode Spectre true $(SolutionDir)Bin\ $(SolutionDir)Build\$(Configuration)\$(PlatformShortName)\$(ProjectName)\ NativeRecommendedRules.ruleset false $(SolutionDir)Bin\ $(SolutionDir)Build\$(Configuration)\$(PlatformShortName)\$(ProjectName)\ true NativeRecommendedRules.ruleset true $(SolutionDir)Bin\ $(SolutionDir)Build\$(Configuration)\$(PlatformShortName)\$(ProjectName)\ NativeRecommendedRules.ruleset false $(SolutionDir)Bin\ $(SolutionDir)Build\$(Configuration)\$(PlatformShortName)\$(ProjectName)\ true NativeRecommendedRules.ruleset Level4 true WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true stdcpp20 false Caret Use common.h stdc17 Windows true Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) PerMonitorHighDPIAware Level4 true true true WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true stdcpp20 true Caret true Use common.h true MaxSpeed Guard stdc17 Windows true true true Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) UseLinkTimeCodeGeneration true PerMonitorHighDPIAware Level4 true _DEBUG;_WINDOWS;%(PreprocessorDefinitions) true stdcpp20 false Caret Use common.h stdc17 Windows true Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) PerMonitorHighDPIAware Level4 true true true NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true stdcpp20 true Caret true Use common.h true MaxSpeed Guard stdc17 Windows true true true Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) UseLinkTimeCodeGeneration true PerMonitorHighDPIAware Create Create Create Create Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) Document mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang mkdir $(OutputPath)lang >nul 2>&1 copy /Y %(FullPath) $(OutputPath)lang Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory Copy translation "%(Filename)" to build directory $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) $(OutputPath)lang\%(Filename)%(Extension) ================================================ FILE: WinMute/WinMute.vcxproj.filters ================================================  {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms {8054b676-f98f-4a0b-bf41-266bac229306} {8ace85b5-3ff6-415f-91e0-f14665e8392d} {006ee102-2667-484e-91ac-7ace0b94711a} {10644ce7-c96f-4c74-9d5b-a2d66957235b} {8d380999-372a-406c-b3d1-602d609c150c} {0cfb448e-c954-4181-96c8-c89e8d1728aa} {b90f43eb-497c-4b84-b7d9-df7a809e9cab} {5f81f4a6-31a5-4c91-8563-6b63f79478fc} {6fe7a132-28a9-4b7b-aa69-1380069e7ee3} {50123732-775b-41e8-9f2b-fc5925475924} {a30e53a3-8e2a-4955-b138-f2cbc8e92f9f} {4879e951-6a56-461d-adcb-b4fca14928a6} {21b7f94e-74d0-4737-bd72-da855556df2d} {c4de9bea-a833-43ac-8021-6e5cf7d048e8} {a804b525-296b-455b-a1bc-d8fdbf5a9c3d} {5cab523c-1a5a-4429-b495-b630124865d6} {959a5f00-8238-460f-aaba-1b1d9e9ea7ca} {825b7134-b70c-4e13-a95a-0a72645b1ec4} Source Files\Controllers\Muting\Audio Source Files\Controllers\Muting\Audio\VistaAudio Source Files\Controllers\Muting\Audio\VistaAudio Source Files\Base\Log Source Files\Base\Settings Source Files\Base\Helper Source Files\Main Source Files Source Files\UI\TrayIcon Source Files\Controllers\QuietHours Source Files\Controllers\Muting Source Files\Controllers\WiFi Source Files\Controllers\Bluetooth Source Files\Base\Settings Source Files\_External Source Files\Base\Settings Source Files\Base\Helper Resource Files Resource Files Resource Files Resource Files Source Files\Controllers\Muting\Audio Source Files\Controllers\Muting\Audio\VistaAudio Source Files\Controllers\Muting\Audio\VistaAudio Source Files\Base\Helper Source Files\Base\Log Source Files\Base\Settings Source Files\Main Source Files\Main Source Files Source Files\UI\TrayIcon Source Files\Controllers\QuietHours Source Files\Controllers\Muting Source Files\UI\Dialogs\Settings Source Files\UI\Dialogs\Settings Source Files\UI\Dialogs\Settings Source Files\UI\Dialogs\Settings Source Files\UI\Dialogs\Settings Source Files\Controllers\WiFi Source Files\UI\Dialogs\Settings Source Files\Controllers\Bluetooth Source Files\UI\Dialogs\Settings Source Files\Base\Settings Source Files\Base\Settings Source Files\UI\Dialogs\Settings Source Files\UI\Dialogs Translations Translations Translations Translations Translations Translations Translations Translations Translations Translations Translations ================================================ FILE: WinMute/WinMute.vcxproj.user ================================================  $(TargetDir) WindowsLocalDebugger $(TargetDir) WindowsLocalDebugger $(TargetDir) WindowsLocalDebugger $(TargetDir) WindowsLocalDebugger ================================================ FILE: WinMute/common.cpp ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #include "common.h" ================================================ FILE: WinMute/common.h ================================================ /* WinMute Copyright (c) 2025, Alexander Steinhoefer ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ #pragma once #ifndef UNICODE # define UNICODE #endif #ifndef _UNICODE # define _UNICODE #endif #if defined _M_IX86 # pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_IA64 # pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_X64 # pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") #else # pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #endif #define STRICT #define _WIN32_WINNT 0x0601 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace fs = std::filesystem; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #pragma warning(disable : 4201) # include #pragma warning(default : 4201) #include "libs/json.hpp" #include "resource.h" #include "WMi18n.h" #include "WMSettings.h" #include "WMLog.h" #include "UpdateChecker.h" #include "TrayIcon.h" #include "WinAudio.h" #include "MuteControl.h" #include "WiFiDetector.h" #include "BluetoothDetector.h" #include "QuietHoursTimer.h" #include "WinMute.h" #include "Utility.h" #include "VersionHelper.h" // ============================================================================= // Macros #define ARRAY_SIZE(arr) ((sizeof(arr)) / (sizeof(arr[0]))) // ============================================================================= // Constants static const wchar_t *PROGRAM_NAME = L"WinMute"; static const wchar_t *LOG_FILE_NAME = L"WinMute.log"; constexpr int WM_SAVESETTINGS = WM_USER + 300; constexpr int WM_WINMUTE_UPDATE_POPUP = WM_USER + 301; constexpr int WM_LOG_UPDATED = WM_USER + 302; ================================================ FILE: WinMute/libs/json.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT /****************************************************************************\ * Note on documentation: The source files contain links to the online * * documentation of the public API at https://json.nlohmann.me. This URL * * contains the most recent documentation and should also be applicable to * * previous versions; documentation for deprecated functions is not * * removed, but marked deprecated. See "Generate documentation" section in * * file docs/README.md. * \****************************************************************************/ #ifndef INCLUDE_NLOHMANN_JSON_HPP_ #define INCLUDE_NLOHMANN_JSON_HPP_ #include // all_of, find, for_each #include // nullptr_t, ptrdiff_t, size_t #include // hash, less #include // initializer_list #ifndef JSON_NO_IO #include // istream, ostream #endif // JSON_NO_IO #include // random_access_iterator_tag #include // unique_ptr #include // string, stoi, to_string #include // declval, forward, move, pair, swap #include // vector // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // This file contains all macro definitions affecting or depending on the ABI #ifndef JSON_SKIP_LIBRARY_VERSION_CHECK #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3 #warning "Already included a different version of the library!" #endif #endif #endif #define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) #define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) #define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum) #ifndef JSON_DIAGNOSTICS #define JSON_DIAGNOSTICS 0 #endif #ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 #endif #if JSON_DIAGNOSTICS #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag #else #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS #endif #if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp #else #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON #endif #ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 #endif // Construct the namespace ABI tags component #define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b #define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) #define NLOHMANN_JSON_ABI_TAGS \ NLOHMANN_JSON_ABI_TAGS_CONCAT( \ NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) // Construct the namespace version component #define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ _v ## major ## _ ## minor ## _ ## patch #define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) #if NLOHMANN_JSON_NAMESPACE_NO_VERSION #define NLOHMANN_JSON_NAMESPACE_VERSION #else #define NLOHMANN_JSON_NAMESPACE_VERSION \ NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ NLOHMANN_JSON_VERSION_MINOR, \ NLOHMANN_JSON_VERSION_PATCH) #endif // Combine namespace components #define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b #define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) #ifndef NLOHMANN_JSON_NAMESPACE #define NLOHMANN_JSON_NAMESPACE \ nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ NLOHMANN_JSON_ABI_TAGS, \ NLOHMANN_JSON_NAMESPACE_VERSION) #endif #ifndef NLOHMANN_JSON_NAMESPACE_BEGIN #define NLOHMANN_JSON_NAMESPACE_BEGIN \ namespace nlohmann \ { \ inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ NLOHMANN_JSON_ABI_TAGS, \ NLOHMANN_JSON_NAMESPACE_VERSION) \ { #endif #ifndef NLOHMANN_JSON_NAMESPACE_END #define NLOHMANN_JSON_NAMESPACE_END \ } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ } // namespace nlohmann #endif // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // transform #include // array #include // forward_list #include // inserter, front_inserter, end #include // map #include // string #include // tuple, make_tuple #include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible #include // unordered_map #include // pair, declval #include // valarray // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // nullptr_t #include // exception #if JSON_DIAGNOSTICS #include // accumulate #endif #include // runtime_error #include // to_string #include // vector // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // array #include // size_t #include // uint8_t #include // string // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // declval, pair // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template struct make_void { using type = void; }; template using void_t = typename make_void::type; } // namespace detail NLOHMANN_JSON_NAMESPACE_END NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { // https://en.cppreference.com/w/cpp/experimental/is_detected struct nonesuch { nonesuch() = delete; ~nonesuch() = delete; nonesuch(nonesuch const&) = delete; nonesuch(nonesuch const&&) = delete; void operator=(nonesuch const&) = delete; void operator=(nonesuch&&) = delete; }; template class Op, class... Args> struct detector { using value_t = std::false_type; using type = Default; }; template class Op, class... Args> struct detector>, Op, Args...> { using value_t = std::true_type; using type = Op; }; template class Op, class... Args> using is_detected = typename detector::value_t; template class Op, class... Args> struct is_detected_lazy : is_detected { }; template class Op, class... Args> using detected_t = typename detector::type; template class Op, class... Args> using detected_or = detector; template class Op, class... Args> using detected_or_t = typename detected_or::type; template class Op, class... Args> using is_detected_exact = std::is_same>; template class Op, class... Args> using is_detected_convertible = std::is_convertible, To>; } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-FileCopyrightText: 2016-2021 Evan Nemerson // SPDX-License-Identifier: MIT /* Hedley - https://nemequ.github.io/hedley * Created by Evan Nemerson */ #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) #if defined(JSON_HEDLEY_VERSION) #undef JSON_HEDLEY_VERSION #endif #define JSON_HEDLEY_VERSION 15 #if defined(JSON_HEDLEY_STRINGIFY_EX) #undef JSON_HEDLEY_STRINGIFY_EX #endif #define JSON_HEDLEY_STRINGIFY_EX(x) #x #if defined(JSON_HEDLEY_STRINGIFY) #undef JSON_HEDLEY_STRINGIFY #endif #define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) #if defined(JSON_HEDLEY_CONCAT_EX) #undef JSON_HEDLEY_CONCAT_EX #endif #define JSON_HEDLEY_CONCAT_EX(a,b) a##b #if defined(JSON_HEDLEY_CONCAT) #undef JSON_HEDLEY_CONCAT #endif #define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) #if defined(JSON_HEDLEY_CONCAT3_EX) #undef JSON_HEDLEY_CONCAT3_EX #endif #define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c #if defined(JSON_HEDLEY_CONCAT3) #undef JSON_HEDLEY_CONCAT3 #endif #define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) #if defined(JSON_HEDLEY_VERSION_ENCODE) #undef JSON_HEDLEY_VERSION_ENCODE #endif #define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) #undef JSON_HEDLEY_VERSION_DECODE_MAJOR #endif #define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) #if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) #undef JSON_HEDLEY_VERSION_DECODE_MINOR #endif #define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) #if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) #undef JSON_HEDLEY_VERSION_DECODE_REVISION #endif #define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) #if defined(JSON_HEDLEY_GNUC_VERSION) #undef JSON_HEDLEY_GNUC_VERSION #endif #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #elif defined(__GNUC__) #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) #endif #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) #undef JSON_HEDLEY_GNUC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_GNUC_VERSION) #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_MSVC_VERSION) #undef JSON_HEDLEY_MSVC_VERSION #endif #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) #elif defined(_MSC_FULL_VER) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) #elif defined(_MSC_VER) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) #endif #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) #undef JSON_HEDLEY_MSVC_VERSION_CHECK #endif #if !defined(JSON_HEDLEY_MSVC_VERSION) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) #elif defined(_MSC_VER) && (_MSC_VER >= 1400) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) #elif defined(_MSC_VER) && (_MSC_VER >= 1200) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) #else #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) #endif #if defined(JSON_HEDLEY_INTEL_VERSION) #undef JSON_HEDLEY_INTEL_VERSION #endif #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) #elif defined(__INTEL_COMPILER) && !defined(__ICL) #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) #endif #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) #undef JSON_HEDLEY_INTEL_VERSION_CHECK #endif #if defined(JSON_HEDLEY_INTEL_VERSION) #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_INTEL_CL_VERSION) #undef JSON_HEDLEY_INTEL_CL_VERSION #endif #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) #endif #if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK #endif #if defined(JSON_HEDLEY_INTEL_CL_VERSION) #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_PGI_VERSION) #undef JSON_HEDLEY_PGI_VERSION #endif #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) #endif #if defined(JSON_HEDLEY_PGI_VERSION_CHECK) #undef JSON_HEDLEY_PGI_VERSION_CHECK #endif #if defined(JSON_HEDLEY_PGI_VERSION) #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_SUNPRO_VERSION) #undef JSON_HEDLEY_SUNPRO_VERSION #endif #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) #elif defined(__SUNPRO_C) #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) #elif defined(__SUNPRO_CC) #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) #endif #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK #endif #if defined(JSON_HEDLEY_SUNPRO_VERSION) #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) #undef JSON_HEDLEY_EMSCRIPTEN_VERSION #endif #if defined(__EMSCRIPTEN__) #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) #endif #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK #endif #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_ARM_VERSION) #undef JSON_HEDLEY_ARM_VERSION #endif #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) #elif defined(__CC_ARM) && defined(__ARMCC_VERSION) #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) #endif #if defined(JSON_HEDLEY_ARM_VERSION_CHECK) #undef JSON_HEDLEY_ARM_VERSION_CHECK #endif #if defined(JSON_HEDLEY_ARM_VERSION) #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_IBM_VERSION) #undef JSON_HEDLEY_IBM_VERSION #endif #if defined(__ibmxl__) #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) #elif defined(__xlC__) && defined(__xlC_ver__) #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) #elif defined(__xlC__) #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) #endif #if defined(JSON_HEDLEY_IBM_VERSION_CHECK) #undef JSON_HEDLEY_IBM_VERSION_CHECK #endif #if defined(JSON_HEDLEY_IBM_VERSION) #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_VERSION) #undef JSON_HEDLEY_TI_VERSION #endif #if \ defined(__TI_COMPILER_VERSION__) && \ ( \ defined(__TMS470__) || defined(__TI_ARM__) || \ defined(__MSP430__) || \ defined(__TMS320C2000__) \ ) #if (__TI_COMPILER_VERSION__ >= 16000000) #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #endif #if defined(JSON_HEDLEY_TI_VERSION_CHECK) #undef JSON_HEDLEY_TI_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_VERSION) #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CL2000_VERSION) #undef JSON_HEDLEY_TI_CL2000_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CL2000_VERSION) #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CL430_VERSION) #undef JSON_HEDLEY_TI_CL430_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CL430_VERSION) #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) #undef JSON_HEDLEY_TI_ARMCL_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CL6X_VERSION) #undef JSON_HEDLEY_TI_CL6X_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CL6X_VERSION) #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CL7X_VERSION) #undef JSON_HEDLEY_TI_CL7X_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CL7X_VERSION) #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) #undef JSON_HEDLEY_TI_CLPRU_VERSION #endif #if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_CRAY_VERSION) #undef JSON_HEDLEY_CRAY_VERSION #endif #if defined(_CRAYC) #if defined(_RELEASE_PATCHLEVEL) #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) #else #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) #endif #endif #if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) #undef JSON_HEDLEY_CRAY_VERSION_CHECK #endif #if defined(JSON_HEDLEY_CRAY_VERSION) #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_IAR_VERSION) #undef JSON_HEDLEY_IAR_VERSION #endif #if defined(__IAR_SYSTEMS_ICC__) #if __VER__ > 1000 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) #else #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) #endif #endif #if defined(JSON_HEDLEY_IAR_VERSION_CHECK) #undef JSON_HEDLEY_IAR_VERSION_CHECK #endif #if defined(JSON_HEDLEY_IAR_VERSION) #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_TINYC_VERSION) #undef JSON_HEDLEY_TINYC_VERSION #endif #if defined(__TINYC__) #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) #endif #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) #undef JSON_HEDLEY_TINYC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_TINYC_VERSION) #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_DMC_VERSION) #undef JSON_HEDLEY_DMC_VERSION #endif #if defined(__DMC__) #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) #endif #if defined(JSON_HEDLEY_DMC_VERSION_CHECK) #undef JSON_HEDLEY_DMC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_DMC_VERSION) #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_COMPCERT_VERSION) #undef JSON_HEDLEY_COMPCERT_VERSION #endif #if defined(__COMPCERT_VERSION__) #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) #endif #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK #endif #if defined(JSON_HEDLEY_COMPCERT_VERSION) #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_PELLES_VERSION) #undef JSON_HEDLEY_PELLES_VERSION #endif #if defined(__POCC__) #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) #endif #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) #undef JSON_HEDLEY_PELLES_VERSION_CHECK #endif #if defined(JSON_HEDLEY_PELLES_VERSION) #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_MCST_LCC_VERSION) #undef JSON_HEDLEY_MCST_LCC_VERSION #endif #if defined(__LCC__) && defined(__LCC_MINOR__) #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) #endif #if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_MCST_LCC_VERSION) #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_GCC_VERSION) #undef JSON_HEDLEY_GCC_VERSION #endif #if \ defined(JSON_HEDLEY_GNUC_VERSION) && \ !defined(__clang__) && \ !defined(JSON_HEDLEY_INTEL_VERSION) && \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_ARM_VERSION) && \ !defined(JSON_HEDLEY_CRAY_VERSION) && \ !defined(JSON_HEDLEY_TI_VERSION) && \ !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ !defined(__COMPCERT__) && \ !defined(JSON_HEDLEY_MCST_LCC_VERSION) #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION #endif #if defined(JSON_HEDLEY_GCC_VERSION_CHECK) #undef JSON_HEDLEY_GCC_VERSION_CHECK #endif #if defined(JSON_HEDLEY_GCC_VERSION) #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) #endif #if defined(JSON_HEDLEY_HAS_ATTRIBUTE) #undef JSON_HEDLEY_HAS_ATTRIBUTE #endif #if \ defined(__has_attribute) && \ ( \ (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ ) # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) #else # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE #endif #if defined(__has_attribute) #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #else #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE #endif #if defined(__has_attribute) #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #else #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE #endif #if \ defined(__has_cpp_attribute) && \ defined(__cplusplus) && \ (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) #endif #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS #endif #if !defined(__cplusplus) || !defined(__has_cpp_attribute) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) #elif \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_IAR_VERSION) && \ (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) #else #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE #endif #if defined(__has_cpp_attribute) && defined(__cplusplus) #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE #endif #if defined(__has_cpp_attribute) && defined(__cplusplus) #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_BUILTIN) #undef JSON_HEDLEY_HAS_BUILTIN #endif #if defined(__has_builtin) #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) #else #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) #undef JSON_HEDLEY_GNUC_HAS_BUILTIN #endif #if defined(__has_builtin) #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) #else #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) #undef JSON_HEDLEY_GCC_HAS_BUILTIN #endif #if defined(__has_builtin) #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) #else #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_FEATURE) #undef JSON_HEDLEY_HAS_FEATURE #endif #if defined(__has_feature) #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) #else #define JSON_HEDLEY_HAS_FEATURE(feature) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) #undef JSON_HEDLEY_GNUC_HAS_FEATURE #endif #if defined(__has_feature) #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) #else #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_FEATURE) #undef JSON_HEDLEY_GCC_HAS_FEATURE #endif #if defined(__has_feature) #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) #else #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_EXTENSION) #undef JSON_HEDLEY_HAS_EXTENSION #endif #if defined(__has_extension) #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) #else #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) #undef JSON_HEDLEY_GNUC_HAS_EXTENSION #endif #if defined(__has_extension) #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) #else #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) #undef JSON_HEDLEY_GCC_HAS_EXTENSION #endif #if defined(__has_extension) #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) #else #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE #endif #if defined(__has_declspec_attribute) #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE #endif #if defined(__has_declspec_attribute) #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE #endif #if defined(__has_declspec_attribute) #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_HAS_WARNING) #undef JSON_HEDLEY_HAS_WARNING #endif #if defined(__has_warning) #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) #else #define JSON_HEDLEY_HAS_WARNING(warning) (0) #endif #if defined(JSON_HEDLEY_GNUC_HAS_WARNING) #undef JSON_HEDLEY_GNUC_HAS_WARNING #endif #if defined(__has_warning) #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) #else #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_WARNING) #undef JSON_HEDLEY_GCC_HAS_WARNING #endif #if defined(__has_warning) #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) #else #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ defined(__clang__) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) #define JSON_HEDLEY_PRAGMA(value) __pragma(value) #else #define JSON_HEDLEY_PRAGMA(value) #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) #undef JSON_HEDLEY_DIAGNOSTIC_PUSH #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_POP) #undef JSON_HEDLEY_DIAGNOSTIC_POP #endif #if defined(__clang__) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) #elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") #elif \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") #else #define JSON_HEDLEY_DIAGNOSTIC_PUSH #define JSON_HEDLEY_DIAGNOSTIC_POP #endif /* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ #endif #if defined(__cplusplus) # if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") # if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") # if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ xpr \ JSON_HEDLEY_DIAGNOSTIC_POP # else # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ xpr \ JSON_HEDLEY_DIAGNOSTIC_POP # endif # else # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ xpr \ JSON_HEDLEY_DIAGNOSTIC_POP # endif # endif #endif #if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x #endif #if defined(JSON_HEDLEY_CONST_CAST) #undef JSON_HEDLEY_CONST_CAST #endif #if defined(__cplusplus) # define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) #elif \ JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) # define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ ((T) (expr)); \ JSON_HEDLEY_DIAGNOSTIC_POP \ })) #else # define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) #endif #if defined(JSON_HEDLEY_REINTERPRET_CAST) #undef JSON_HEDLEY_REINTERPRET_CAST #endif #if defined(__cplusplus) #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) #else #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) #endif #if defined(JSON_HEDLEY_STATIC_CAST) #undef JSON_HEDLEY_STATIC_CAST #endif #if defined(__cplusplus) #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) #else #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) #endif #if defined(JSON_HEDLEY_CPP_CAST) #undef JSON_HEDLEY_CPP_CAST #endif #if defined(__cplusplus) # if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") # define JSON_HEDLEY_CPP_CAST(T, expr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ ((T) (expr)) \ JSON_HEDLEY_DIAGNOSTIC_POP # elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) # define JSON_HEDLEY_CPP_CAST(T, expr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("diag_suppress=Pe137") \ JSON_HEDLEY_DIAGNOSTIC_POP # else # define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) # endif #else # define JSON_HEDLEY_CPP_CAST(T, expr) (expr) #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED #endif #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") #elif \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) #elif \ JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) #elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") #elif \ JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL #endif #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL #endif #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION #endif #if JSON_HEDLEY_HAS_WARNING("-Wunused-function") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION #endif #if defined(JSON_HEDLEY_DEPRECATED) #undef JSON_HEDLEY_DEPRECATED #endif #if defined(JSON_HEDLEY_DEPRECATED_FOR) #undef JSON_HEDLEY_DEPRECATED_FOR #endif #if \ JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) #elif \ (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) #elif defined(__cplusplus) && (__cplusplus >= 201402L) #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") #else #define JSON_HEDLEY_DEPRECATED(since) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) #endif #if defined(JSON_HEDLEY_UNAVAILABLE) #undef JSON_HEDLEY_UNAVAILABLE #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) #else #define JSON_HEDLEY_UNAVAILABLE(available_since) #endif #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) #undef JSON_HEDLEY_WARN_UNUSED_RESULT #endif #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) #elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) #elif defined(_Check_return_) /* SAL */ #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ #else #define JSON_HEDLEY_WARN_UNUSED_RESULT #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) #endif #if defined(JSON_HEDLEY_SENTINEL) #undef JSON_HEDLEY_SENTINEL #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) #else #define JSON_HEDLEY_SENTINEL(position) #endif #if defined(JSON_HEDLEY_NO_RETURN) #undef JSON_HEDLEY_NO_RETURN #endif #if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_NO_RETURN __noreturn #elif \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define JSON_HEDLEY_NO_RETURN _Noreturn #elif defined(__cplusplus) && (__cplusplus >= 201103L) #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) #else #define JSON_HEDLEY_NO_RETURN #endif #if defined(JSON_HEDLEY_NO_ESCAPE) #undef JSON_HEDLEY_NO_ESCAPE #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) #else #define JSON_HEDLEY_NO_ESCAPE #endif #if defined(JSON_HEDLEY_UNREACHABLE) #undef JSON_HEDLEY_UNREACHABLE #endif #if defined(JSON_HEDLEY_UNREACHABLE_RETURN) #undef JSON_HEDLEY_UNREACHABLE_RETURN #endif #if defined(JSON_HEDLEY_ASSUME) #undef JSON_HEDLEY_ASSUME #endif #if \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_ASSUME(expr) __assume(expr) #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) #elif \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) #if defined(__cplusplus) #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) #else #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) #endif #endif #if \ (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() #elif defined(JSON_HEDLEY_ASSUME) #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) #endif #if !defined(JSON_HEDLEY_ASSUME) #if defined(JSON_HEDLEY_UNREACHABLE) #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) #else #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) #endif #endif #if defined(JSON_HEDLEY_UNREACHABLE) #if \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) #else #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() #endif #else #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) #endif #if !defined(JSON_HEDLEY_UNREACHABLE) #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) #endif JSON_HEDLEY_DIAGNOSTIC_PUSH #if JSON_HEDLEY_HAS_WARNING("-Wpedantic") #pragma clang diagnostic ignored "-Wpedantic" #endif #if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" #endif #if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) #if defined(__clang__) #pragma clang diagnostic ignored "-Wvariadic-macros" #elif defined(JSON_HEDLEY_GCC_VERSION) #pragma GCC diagnostic ignored "-Wvariadic-macros" #endif #endif #if defined(JSON_HEDLEY_NON_NULL) #undef JSON_HEDLEY_NON_NULL #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) #else #define JSON_HEDLEY_NON_NULL(...) #endif JSON_HEDLEY_DIAGNOSTIC_POP #if defined(JSON_HEDLEY_PRINTF_FORMAT) #undef JSON_HEDLEY_PRINTF_FORMAT #endif #if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) #elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) #else #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) #endif #if defined(JSON_HEDLEY_CONSTEXPR) #undef JSON_HEDLEY_CONSTEXPR #endif #if defined(__cplusplus) #if __cplusplus >= 201103L #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) #endif #endif #if !defined(JSON_HEDLEY_CONSTEXPR) #define JSON_HEDLEY_CONSTEXPR #endif #if defined(JSON_HEDLEY_PREDICT) #undef JSON_HEDLEY_PREDICT #endif #if defined(JSON_HEDLEY_LIKELY) #undef JSON_HEDLEY_LIKELY #endif #if defined(JSON_HEDLEY_UNLIKELY) #undef JSON_HEDLEY_UNLIKELY #endif #if defined(JSON_HEDLEY_UNPREDICTABLE) #undef JSON_HEDLEY_UNPREDICTABLE #endif #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) #endif #if \ (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) # define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) #elif \ (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PREDICT(expr, expected, probability) \ (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ (__extension__ ({ \ double hedley_probability_ = (probability); \ ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ })) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ (__extension__ ({ \ double hedley_probability_ = (probability); \ ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ })) # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) #else # define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) # define JSON_HEDLEY_LIKELY(expr) (!!(expr)) # define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) #endif #if !defined(JSON_HEDLEY_UNPREDICTABLE) #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) #endif #if defined(JSON_HEDLEY_MALLOC) #undef JSON_HEDLEY_MALLOC #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_MALLOC __declspec(restrict) #else #define JSON_HEDLEY_MALLOC #endif #if defined(JSON_HEDLEY_PURE) #undef JSON_HEDLEY_PURE #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PURE __attribute__((__pure__)) #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) # define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") #elif defined(__cplusplus) && \ ( \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ ) # define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") #else # define JSON_HEDLEY_PURE #endif #if defined(JSON_HEDLEY_CONST) #undef JSON_HEDLEY_CONST #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_CONST __attribute__((__const__)) #elif \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) #define JSON_HEDLEY_CONST _Pragma("no_side_effect") #else #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE #endif #if defined(JSON_HEDLEY_RESTRICT) #undef JSON_HEDLEY_RESTRICT #endif #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) #define JSON_HEDLEY_RESTRICT restrict #elif \ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ defined(__clang__) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_RESTRICT __restrict #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) #define JSON_HEDLEY_RESTRICT _Restrict #else #define JSON_HEDLEY_RESTRICT #endif #if defined(JSON_HEDLEY_INLINE) #undef JSON_HEDLEY_INLINE #endif #if \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ (defined(__cplusplus) && (__cplusplus >= 199711L)) #define JSON_HEDLEY_INLINE inline #elif \ defined(JSON_HEDLEY_GCC_VERSION) || \ JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) #define JSON_HEDLEY_INLINE __inline__ #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_INLINE __inline #else #define JSON_HEDLEY_INLINE #endif #if defined(JSON_HEDLEY_ALWAYS_INLINE) #undef JSON_HEDLEY_ALWAYS_INLINE #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) # define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) # define JSON_HEDLEY_ALWAYS_INLINE __forceinline #elif defined(__cplusplus) && \ ( \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ ) # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") #else # define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE #endif #if defined(JSON_HEDLEY_NEVER_INLINE) #undef JSON_HEDLEY_NEVER_INLINE #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) #elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) #else #define JSON_HEDLEY_NEVER_INLINE #endif #if defined(JSON_HEDLEY_PRIVATE) #undef JSON_HEDLEY_PRIVATE #endif #if defined(JSON_HEDLEY_PUBLIC) #undef JSON_HEDLEY_PUBLIC #endif #if defined(JSON_HEDLEY_IMPORT) #undef JSON_HEDLEY_IMPORT #endif #if defined(_WIN32) || defined(__CYGWIN__) # define JSON_HEDLEY_PRIVATE # define JSON_HEDLEY_PUBLIC __declspec(dllexport) # define JSON_HEDLEY_IMPORT __declspec(dllimport) #else # if \ JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ ( \ defined(__TI_EABI__) && \ ( \ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ ) \ ) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) # define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) # define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) # else # define JSON_HEDLEY_PRIVATE # define JSON_HEDLEY_PUBLIC # endif # define JSON_HEDLEY_IMPORT extern #endif #if defined(JSON_HEDLEY_NO_THROW) #undef JSON_HEDLEY_NO_THROW #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) #define JSON_HEDLEY_NO_THROW __declspec(nothrow) #else #define JSON_HEDLEY_NO_THROW #endif #if defined(JSON_HEDLEY_FALL_THROUGH) #undef JSON_HEDLEY_FALL_THROUGH #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) #elif defined(__fallthrough) /* SAL */ #define JSON_HEDLEY_FALL_THROUGH __fallthrough #else #define JSON_HEDLEY_FALL_THROUGH #endif #if defined(JSON_HEDLEY_RETURNS_NON_NULL) #undef JSON_HEDLEY_RETURNS_NON_NULL #endif #if \ JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) #elif defined(_Ret_notnull_) /* SAL */ #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ #else #define JSON_HEDLEY_RETURNS_NON_NULL #endif #if defined(JSON_HEDLEY_ARRAY_PARAM) #undef JSON_HEDLEY_ARRAY_PARAM #endif #if \ defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ !defined(__STDC_NO_VLA__) && \ !defined(__cplusplus) && \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_TINYC_VERSION) #define JSON_HEDLEY_ARRAY_PARAM(name) (name) #else #define JSON_HEDLEY_ARRAY_PARAM(name) #endif #if defined(JSON_HEDLEY_IS_CONSTANT) #undef JSON_HEDLEY_IS_CONSTANT #endif #if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) #undef JSON_HEDLEY_REQUIRE_CONSTEXPR #endif /* JSON_HEDLEY_IS_CONSTEXPR_ is for HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ #if defined(JSON_HEDLEY_IS_CONSTEXPR_) #undef JSON_HEDLEY_IS_CONSTEXPR_ #endif #if \ JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) #endif #if !defined(__cplusplus) # if \ JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) #if defined(__INTPTR_TYPE__) #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) #else #include #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) #endif # elif \ ( \ defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_IAR_VERSION)) || \ (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) #if defined(__INTPTR_TYPE__) #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) #else #include #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) #endif # elif \ defined(JSON_HEDLEY_GCC_VERSION) || \ defined(JSON_HEDLEY_INTEL_VERSION) || \ defined(JSON_HEDLEY_TINYC_VERSION) || \ defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ defined(__clang__) # define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ sizeof(void) != \ sizeof(*( \ 1 ? \ ((void*) ((expr) * 0L) ) : \ ((struct { char v[sizeof(void) * 2]; } *) 1) \ ) \ ) \ ) # endif #endif #if defined(JSON_HEDLEY_IS_CONSTEXPR_) #if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) #endif #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) #else #if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_IS_CONSTANT(expr) (0) #endif #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) #endif #if defined(JSON_HEDLEY_BEGIN_C_DECLS) #undef JSON_HEDLEY_BEGIN_C_DECLS #endif #if defined(JSON_HEDLEY_END_C_DECLS) #undef JSON_HEDLEY_END_C_DECLS #endif #if defined(JSON_HEDLEY_C_DECL) #undef JSON_HEDLEY_C_DECL #endif #if defined(__cplusplus) #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { #define JSON_HEDLEY_END_C_DECLS } #define JSON_HEDLEY_C_DECL extern "C" #else #define JSON_HEDLEY_BEGIN_C_DECLS #define JSON_HEDLEY_END_C_DECLS #define JSON_HEDLEY_C_DECL #endif #if defined(JSON_HEDLEY_STATIC_ASSERT) #undef JSON_HEDLEY_STATIC_ASSERT #endif #if \ !defined(__cplusplus) && ( \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ defined(_Static_assert) \ ) # define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) #elif \ (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) # define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) #else # define JSON_HEDLEY_STATIC_ASSERT(expr, message) #endif #if defined(JSON_HEDLEY_NULL) #undef JSON_HEDLEY_NULL #endif #if defined(__cplusplus) #if __cplusplus >= 201103L #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) #elif defined(NULL) #define JSON_HEDLEY_NULL NULL #else #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) #endif #elif defined(NULL) #define JSON_HEDLEY_NULL NULL #else #define JSON_HEDLEY_NULL ((void*) 0) #endif #if defined(JSON_HEDLEY_MESSAGE) #undef JSON_HEDLEY_MESSAGE #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") # define JSON_HEDLEY_MESSAGE(msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ JSON_HEDLEY_PRAGMA(message msg) \ JSON_HEDLEY_DIAGNOSTIC_POP #elif \ JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) #elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) #else # define JSON_HEDLEY_MESSAGE(msg) #endif #if defined(JSON_HEDLEY_WARNING) #undef JSON_HEDLEY_WARNING #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") # define JSON_HEDLEY_WARNING(msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ JSON_HEDLEY_PRAGMA(clang warning msg) \ JSON_HEDLEY_DIAGNOSTIC_POP #elif \ JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) #elif \ JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) #else # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) #endif #if defined(JSON_HEDLEY_REQUIRE) #undef JSON_HEDLEY_REQUIRE #endif #if defined(JSON_HEDLEY_REQUIRE_MSG) #undef JSON_HEDLEY_REQUIRE_MSG #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) # if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") # define JSON_HEDLEY_REQUIRE(expr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ __attribute__((diagnose_if(!(expr), #expr, "error"))) \ JSON_HEDLEY_DIAGNOSTIC_POP # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ __attribute__((diagnose_if(!(expr), msg, "error"))) \ JSON_HEDLEY_DIAGNOSTIC_POP # else # define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) # endif #else # define JSON_HEDLEY_REQUIRE(expr) # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) #endif #if defined(JSON_HEDLEY_FLAGS) #undef JSON_HEDLEY_FLAGS #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) #else #define JSON_HEDLEY_FLAGS #endif #if defined(JSON_HEDLEY_FLAGS_CAST) #undef JSON_HEDLEY_FLAGS_CAST #endif #if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) # define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("warning(disable:188)") \ ((T) (expr)); \ JSON_HEDLEY_DIAGNOSTIC_POP \ })) #else # define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) #endif #if defined(JSON_HEDLEY_EMPTY_BASES) #undef JSON_HEDLEY_EMPTY_BASES #endif #if \ (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) #else #define JSON_HEDLEY_EMPTY_BASES #endif /* Remaining macros are deprecated. */ #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK #endif #if defined(__clang__) #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) #else #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) #endif #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) #undef JSON_HEDLEY_CLANG_HAS_BUILTIN #endif #define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) #if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) #undef JSON_HEDLEY_CLANG_HAS_FEATURE #endif #define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) #if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) #undef JSON_HEDLEY_CLANG_HAS_EXTENSION #endif #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_WARNING) #undef JSON_HEDLEY_CLANG_HAS_WARNING #endif #define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) #endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ // This file contains all internal macro definitions (except those affecting ABI) // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them // #include // exclude unsupported compilers #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) #if defined(__clang__) #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" #endif #endif #endif // C++ language standard detection // if the user manually specified the used c++ version this is skipped #if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) #define JSON_HAS_CPP_20 #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) #define JSON_HAS_CPP_14 #endif // the cpp 11 flag is always specified because it is the minimal required version #define JSON_HAS_CPP_11 #endif #ifdef __has_include #if __has_include() #include #endif #endif #if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) #ifdef JSON_HAS_CPP_17 #if defined(__cpp_lib_filesystem) #define JSON_HAS_FILESYSTEM 1 #elif defined(__cpp_lib_experimental_filesystem) #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #elif !defined(__has_include) #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #elif __has_include() #define JSON_HAS_FILESYSTEM 1 #elif __has_include() #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #endif // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support #if defined(__clang_major__) && __clang_major__ < 7 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support #if defined(_MSC_VER) && _MSC_VER < 1914 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before iOS 13 #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before macOS Catalina #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif #endif #endif #ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 #endif #ifndef JSON_HAS_FILESYSTEM #define JSON_HAS_FILESYSTEM 0 #endif #ifndef JSON_HAS_THREE_WAY_COMPARISON #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L #define JSON_HAS_THREE_WAY_COMPARISON 1 #else #define JSON_HAS_THREE_WAY_COMPARISON 0 #endif #endif #ifndef JSON_HAS_RANGES // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 #define JSON_HAS_RANGES 0 #elif defined(__cpp_lib_ranges) #define JSON_HAS_RANGES 1 #else #define JSON_HAS_RANGES 0 #endif #endif #ifndef JSON_HAS_STATIC_RTTI #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0 #define JSON_HAS_STATIC_RTTI 1 #else #define JSON_HAS_STATIC_RTTI 0 #endif #endif #ifdef JSON_HAS_CPP_17 #define JSON_INLINE_VARIABLE inline #else #define JSON_INLINE_VARIABLE #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] #else #define JSON_NO_UNIQUE_ADDRESS #endif // disable documentation warnings on clang #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdocumentation" #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" #endif // allow disabling exceptions #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) #define JSON_THROW(exception) throw exception #define JSON_TRY try #define JSON_CATCH(exception) catch(exception) #define JSON_INTERNAL_CATCH(exception) catch(exception) #else #include #define JSON_THROW(exception) std::abort() #define JSON_TRY if(true) #define JSON_CATCH(exception) if(false) #define JSON_INTERNAL_CATCH(exception) if(false) #endif // override exception macros #if defined(JSON_THROW_USER) #undef JSON_THROW #define JSON_THROW JSON_THROW_USER #endif #if defined(JSON_TRY_USER) #undef JSON_TRY #define JSON_TRY JSON_TRY_USER #endif #if defined(JSON_CATCH_USER) #undef JSON_CATCH #define JSON_CATCH JSON_CATCH_USER #undef JSON_INTERNAL_CATCH #define JSON_INTERNAL_CATCH JSON_CATCH_USER #endif #if defined(JSON_INTERNAL_CATCH_USER) #undef JSON_INTERNAL_CATCH #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER #endif // allow overriding assert #if !defined(JSON_ASSERT) #include // assert #define JSON_ASSERT(x) assert(x) #endif // allow to access some private functions (needed by the test suite) #if defined(JSON_TESTS_PRIVATE) #define JSON_PRIVATE_UNLESS_TESTED public #else #define JSON_PRIVATE_UNLESS_TESTED private #endif /*! @brief macro to briefly define a mapping between an enum and JSON @def NLOHMANN_JSON_SERIALIZE_ENUM @since version 3.4.0 */ #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ template \ inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ { \ static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ static const std::pair m[] = __VA_ARGS__; \ auto it = std::find_if(std::begin(m), std::end(m), \ [e](const std::pair& ej_pair) -> bool \ { \ return ej_pair.first == e; \ }); \ j = ((it != std::end(m)) ? it : std::begin(m))->second; \ } \ template \ inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ { \ static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ static const std::pair m[] = __VA_ARGS__; \ auto it = std::find_if(std::begin(m), std::end(m), \ [&j](const std::pair& ej_pair) -> bool \ { \ return ej_pair.second == j; \ }); \ e = ((it != std::end(m)) ? it : std::begin(m))->first; \ } // Ugly macros to avoid uglier copy-paste when specializing basic_json. They // may be removed in the future once the class is split. #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ template class ObjectType, \ template class ArrayType, \ class StringType, class BooleanType, class NumberIntegerType, \ class NumberUnsignedType, class NumberFloatType, \ template class AllocatorType, \ template class JSONSerializer, \ class BinaryType, \ class CustomBaseClass> #define NLOHMANN_BASIC_JSON_TPL \ basic_json // Macros to simplify conversion from/to types #define NLOHMANN_JSON_EXPAND( x ) x #define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _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, NAME,...) NAME #define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ NLOHMANN_JSON_PASTE64, \ NLOHMANN_JSON_PASTE63, \ NLOHMANN_JSON_PASTE62, \ NLOHMANN_JSON_PASTE61, \ NLOHMANN_JSON_PASTE60, \ NLOHMANN_JSON_PASTE59, \ NLOHMANN_JSON_PASTE58, \ NLOHMANN_JSON_PASTE57, \ NLOHMANN_JSON_PASTE56, \ NLOHMANN_JSON_PASTE55, \ NLOHMANN_JSON_PASTE54, \ NLOHMANN_JSON_PASTE53, \ NLOHMANN_JSON_PASTE52, \ NLOHMANN_JSON_PASTE51, \ NLOHMANN_JSON_PASTE50, \ NLOHMANN_JSON_PASTE49, \ NLOHMANN_JSON_PASTE48, \ NLOHMANN_JSON_PASTE47, \ NLOHMANN_JSON_PASTE46, \ NLOHMANN_JSON_PASTE45, \ NLOHMANN_JSON_PASTE44, \ NLOHMANN_JSON_PASTE43, \ NLOHMANN_JSON_PASTE42, \ NLOHMANN_JSON_PASTE41, \ NLOHMANN_JSON_PASTE40, \ NLOHMANN_JSON_PASTE39, \ NLOHMANN_JSON_PASTE38, \ NLOHMANN_JSON_PASTE37, \ NLOHMANN_JSON_PASTE36, \ NLOHMANN_JSON_PASTE35, \ NLOHMANN_JSON_PASTE34, \ NLOHMANN_JSON_PASTE33, \ NLOHMANN_JSON_PASTE32, \ NLOHMANN_JSON_PASTE31, \ NLOHMANN_JSON_PASTE30, \ NLOHMANN_JSON_PASTE29, \ NLOHMANN_JSON_PASTE28, \ NLOHMANN_JSON_PASTE27, \ NLOHMANN_JSON_PASTE26, \ NLOHMANN_JSON_PASTE25, \ NLOHMANN_JSON_PASTE24, \ NLOHMANN_JSON_PASTE23, \ NLOHMANN_JSON_PASTE22, \ NLOHMANN_JSON_PASTE21, \ NLOHMANN_JSON_PASTE20, \ NLOHMANN_JSON_PASTE19, \ NLOHMANN_JSON_PASTE18, \ NLOHMANN_JSON_PASTE17, \ NLOHMANN_JSON_PASTE16, \ NLOHMANN_JSON_PASTE15, \ NLOHMANN_JSON_PASTE14, \ NLOHMANN_JSON_PASTE13, \ NLOHMANN_JSON_PASTE12, \ NLOHMANN_JSON_PASTE11, \ NLOHMANN_JSON_PASTE10, \ NLOHMANN_JSON_PASTE9, \ NLOHMANN_JSON_PASTE8, \ NLOHMANN_JSON_PASTE7, \ NLOHMANN_JSON_PASTE6, \ NLOHMANN_JSON_PASTE5, \ NLOHMANN_JSON_PASTE4, \ NLOHMANN_JSON_PASTE3, \ NLOHMANN_JSON_PASTE2, \ NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) #define NLOHMANN_JSON_PASTE2(func, v1) func(v1) #define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) #define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) #define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) #define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) #define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) #define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) #define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) #define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) #define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) #define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) #define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) #define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) #define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) #define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) #define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) #define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) #define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) #define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) #define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) #define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) #define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) #define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) #define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) #define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) #define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) #define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) #define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) #define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) #define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) #define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) #define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) #define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) #define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) #define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) #define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) #define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) #define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) #define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) #define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) #define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) #define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) #define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) #define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) #define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) #define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) #define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) #define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) #define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) #define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) #define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) #define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) #define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) #define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) #define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) #define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) #define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) #define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) #define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) #define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) #define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) #define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) #define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); #define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); /*! @brief macro @def NLOHMANN_DEFINE_TYPE_INTRUSIVE @since version 3.9.0 */ #define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } #define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } #define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } /*! @brief macro @def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE @since version 3.9.0 */ #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } // inspired from https://stackoverflow.com/a/26745591 // allows to call any std function as if (e.g. with begin): // using std::begin; begin(x); // // it allows using the detected idiom to retrieve the return type // of such an expression #define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ namespace detail { \ using std::std_name; \ \ template \ using result_of_##std_name = decltype(std_name(std::declval()...)); \ } \ \ namespace detail2 { \ struct std_name##_tag \ { \ }; \ \ template \ std_name##_tag std_name(T&&...); \ \ template \ using result_of_##std_name = decltype(std_name(std::declval()...)); \ \ template \ struct would_call_std_##std_name \ { \ static constexpr auto const value = ::nlohmann::detail:: \ is_detected_exact::value; \ }; \ } /* namespace detail2 */ \ \ template \ struct would_call_std_##std_name : detail2::would_call_std_##std_name \ { \ } #ifndef JSON_USE_IMPLICIT_CONVERSIONS #define JSON_USE_IMPLICIT_CONVERSIONS 1 #endif #if JSON_USE_IMPLICIT_CONVERSIONS #define JSON_EXPLICIT #else #define JSON_EXPLICIT explicit #endif #ifndef JSON_DISABLE_ENUM_SERIALIZATION #define JSON_DISABLE_ENUM_SERIALIZATION 0 #endif #ifndef JSON_USE_GLOBAL_UDLS #define JSON_USE_GLOBAL_UDLS 1 #endif #if JSON_HAS_THREE_WAY_COMPARISON #include // partial_ordering #endif NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /////////////////////////// // JSON type enumeration // /////////////////////////// /*! @brief the JSON type enumeration This enumeration collects the different JSON types. It is internally used to distinguish the stored values, and the functions @ref basic_json::is_null(), @ref basic_json::is_object(), @ref basic_json::is_array(), @ref basic_json::is_string(), @ref basic_json::is_boolean(), @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and @ref basic_json::is_structured() rely on it. @note There are three enumeration entries (number_integer, number_unsigned, and number_float), because the library distinguishes these three types for numbers: @ref basic_json::number_unsigned_t is used for unsigned integers, @ref basic_json::number_integer_t is used for signed integers, and @ref basic_json::number_float_t is used for floating-point numbers or to approximate integers which do not fit in the limits of their respective type. @sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON value with the default value for a given type @since version 1.0.0 */ enum class value_t : std::uint8_t { null, ///< null value object, ///< object (unordered set of name/value pairs) array, ///< array (ordered collection of values) string, ///< string value boolean, ///< boolean value number_integer, ///< number value (signed integer) number_unsigned, ///< number value (unsigned integer) number_float, ///< number value (floating-point) binary, ///< binary array (ordered collection of bytes) discarded ///< discarded by the parser callback function }; /*! @brief comparison operator for JSON types Returns an ordering that is similar to Python: - order: null < boolean < number < object < array < string < binary - furthermore, each type is not smaller than itself - discarded values are not comparable - binary is represented as a b"" string in python and directly comparable to a string; however, making a binary array directly comparable with a string would be surprising behavior in a JSON file. @since version 1.0.0 */ #if JSON_HAS_THREE_WAY_COMPARISON inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* #else inline bool operator<(const value_t lhs, const value_t rhs) noexcept #endif { static constexpr std::array order = {{ 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, 6 /* binary */ } }; const auto l_index = static_cast(lhs); const auto r_index = static_cast(rhs); #if JSON_HAS_THREE_WAY_COMPARISON if (l_index < order.size() && r_index < order.size()) { return order[l_index] <=> order[r_index]; // *NOPAD* } return std::partial_ordering::unordered; #else return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; #endif } // GCC selects the built-in operator< over an operator rewritten from // a user-defined spaceship operator // Clang, MSVC, and ICC select the rewritten candidate // (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) #if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) inline bool operator<(const value_t lhs, const value_t rhs) noexcept { return std::is_lt(lhs <=> rhs); // *NOPAD* } #endif } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /*! @brief replace all occurrences of a substring by another string @param[in,out] s the string to manipulate; changed so that all occurrences of @a f are replaced with @a t @param[in] f the substring to replace with @a t @param[in] t the string to replace @a f @pre The search string @a f must not be empty. **This precondition is enforced with an assertion.** @since version 2.0.0 */ template inline void replace_substring(StringType& s, const StringType& f, const StringType& t) { JSON_ASSERT(!f.empty()); for (auto pos = s.find(f); // find first occurrence of f pos != StringType::npos; // make sure f was found s.replace(pos, f.size(), t), // replace with t, and pos = s.find(f, pos + t.size())) // find next occurrence of f {} } /*! * @brief string escaping as described in RFC 6901 (Sect. 4) * @param[in] s string to escape * @return escaped string * * Note the order of escaping "~" to "~0" and "/" to "~1" is important. */ template inline StringType escape(StringType s) { replace_substring(s, StringType{"~"}, StringType{"~0"}); replace_substring(s, StringType{"/"}, StringType{"~1"}); return s; } /*! * @brief string unescaping as described in RFC 6901 (Sect. 4) * @param[in] s string to unescape * @return unescaped string * * Note the order of escaping "~1" to "/" and "~0" to "~" is important. */ template static void unescape(StringType& s) { replace_substring(s, StringType{"~1"}, StringType{"/"}); replace_substring(s, StringType{"~0"}, StringType{"~"}); } } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // size_t // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /// struct to capture the start position of the current token struct position_t { /// the total number of characters read std::size_t chars_read_total = 0; /// the number of characters read in the current line std::size_t chars_read_current_line = 0; /// the number of lines read std::size_t lines_read = 0; /// conversion to size_t to preserve SAX interface constexpr operator size_t() const { return chars_read_total; } }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-FileCopyrightText: 2018 The Abseil Authors // SPDX-License-Identifier: MIT #include // array #include // size_t #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type #include // index_sequence, make_index_sequence, index_sequence_for // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template using uncvref_t = typename std::remove_cv::type>::type; #ifdef JSON_HAS_CPP_14 // the following utilities are natively available in C++14 using std::enable_if_t; using std::index_sequence; using std::make_index_sequence; using std::index_sequence_for; #else // alias templates to reduce boilerplate template using enable_if_t = typename std::enable_if::type; // The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h // which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. //// START OF CODE FROM GOOGLE ABSEIL // integer_sequence // // Class template representing a compile-time integer sequence. An instantiation // of `integer_sequence` has a sequence of integers encoded in its // type through its template arguments (which is a common need when // working with C++11 variadic templates). `absl::integer_sequence` is designed // to be a drop-in replacement for C++14's `std::integer_sequence`. // // Example: // // template< class T, T... Ints > // void user_function(integer_sequence); // // int main() // { // // user_function's `T` will be deduced to `int` and `Ints...` // // will be deduced to `0, 1, 2, 3, 4`. // user_function(make_integer_sequence()); // } template struct integer_sequence { using value_type = T; static constexpr std::size_t size() noexcept { return sizeof...(Ints); } }; // index_sequence // // A helper template for an `integer_sequence` of `size_t`, // `absl::index_sequence` is designed to be a drop-in replacement for C++14's // `std::index_sequence`. template using index_sequence = integer_sequence; namespace utility_internal { template struct Extend; // Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. template struct Extend, SeqSize, 0> { using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; }; template struct Extend, SeqSize, 1> { using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; }; // Recursion helper for 'make_integer_sequence'. // 'Gen::type' is an alias for 'integer_sequence'. template struct Gen { using type = typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; }; template struct Gen { using type = integer_sequence; }; } // namespace utility_internal // Compile-time sequences of integers // make_integer_sequence // // This template alias is equivalent to // `integer_sequence`, and is designed to be a drop-in // replacement for C++14's `std::make_integer_sequence`. template using make_integer_sequence = typename utility_internal::Gen::type; // make_index_sequence // // This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, // and is designed to be a drop-in replacement for C++14's // `std::make_index_sequence`. template using make_index_sequence = make_integer_sequence; // index_sequence_for // // Converts a typename pack into an index sequence of the same length, and // is designed to be a drop-in replacement for C++14's // `std::index_sequence_for()` template using index_sequence_for = make_index_sequence; //// END OF CODE FROM GOOGLE ABSEIL #endif // dispatch utility (taken from ranges-v3) template struct priority_tag : priority_tag < N - 1 > {}; template<> struct priority_tag<0> {}; // taken from ranges-v3 template struct static_const { static JSON_INLINE_VARIABLE constexpr T value{}; }; #ifndef JSON_HAS_CPP_17 template constexpr T static_const::value; #endif template inline constexpr std::array make_array(Args&& ... args) { return std::array {{static_cast(std::forward(args))...}}; } } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // numeric_limits #include // false_type, is_constructible, is_integral, is_same, true_type #include // declval #include // tuple #include // char_traits // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #include // random_access_iterator_tag // #include // #include // #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template struct iterator_types {}; template struct iterator_types < It, void_t> { using difference_type = typename It::difference_type; using value_type = typename It::value_type; using pointer = typename It::pointer; using reference = typename It::reference; using iterator_category = typename It::iterator_category; }; // This is required as some compilers implement std::iterator_traits in a way that // doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. template struct iterator_traits { }; template struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> : iterator_types { }; template struct iterator_traits::value>> { using iterator_category = std::random_access_iterator_tag; using value_type = T; using difference_type = ptrdiff_t; using pointer = T*; using reference = T&; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END // #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // #include NLOHMANN_JSON_NAMESPACE_BEGIN NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); NLOHMANN_JSON_NAMESPACE_END // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT // #include NLOHMANN_JSON_NAMESPACE_BEGIN NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); NLOHMANN_JSON_NAMESPACE_END // #include // #include // #include // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann // SPDX-License-Identifier: MIT #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ #include // int64_t, uint64_t #include // map #include // allocator #include // string #include // vector // #include /*! @brief namespace for Niels Lohmann @see https://github.com/nlohmann @since version 1.0.0 */ NLOHMANN_JSON_NAMESPACE_BEGIN /*! @brief default JSONSerializer template argument This serializer ignores the template arguments and uses ADL ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) for serialization. */ template struct adl_serializer; /// a class to store JSON values /// @sa https://json.nlohmann.me/api/basic_json/ template class ObjectType = std::map, template class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template class AllocatorType = std::allocator, template class JSONSerializer = adl_serializer, class BinaryType = std::vector, // cppcheck-suppress syntaxError class CustomBaseClass = void> class basic_json; /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document /// @sa https://json.nlohmann.me/api/json_pointer/ template class json_pointer; /*! @brief default specialization @sa https://json.nlohmann.me/api/json/ */ using json = basic_json<>; /// @brief a minimal map-like container that preserves insertion order /// @sa https://json.nlohmann.me/api/ordered_map/ template struct ordered_map; /// @brief specialization that maintains the insertion order of object keys /// @sa https://json.nlohmann.me/api/ordered_json/ using ordered_json = basic_json; NLOHMANN_JSON_NAMESPACE_END #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ NLOHMANN_JSON_NAMESPACE_BEGIN /*! @brief detail namespace with internal helper functions This namespace collects functions that should not be exposed, implementations of some @ref basic_json methods, and meta-programming helpers. @since version 2.1.0 */ namespace detail { ///////////// // helpers // ///////////// // Note to maintainers: // // Every trait in this file expects a non CV-qualified type. // The only exceptions are in the 'aliases for detected' section // (i.e. those of the form: decltype(T::member_function(std::declval()))) // // In this case, T has to be properly CV-qualified to constraint the function arguments // (e.g. to_json(BasicJsonType&, const T&)) template struct is_basic_json : std::false_type {}; NLOHMANN_BASIC_JSON_TPL_DECLARATION struct is_basic_json : std::true_type {}; // used by exceptions create() member functions // true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t // false_type otherwise template struct is_basic_json_context : std::integral_constant < bool, is_basic_json::type>::type>::value || std::is_same::value > {}; ////////////////////// // json_ref helpers // ////////////////////// template class json_ref; template struct is_json_ref : std::false_type {}; template struct is_json_ref> : std::true_type {}; ////////////////////////// // aliases for detected // ////////////////////////// template using mapped_type_t = typename T::mapped_type; template using key_type_t = typename T::key_type; template using value_type_t = typename T::value_type; template using difference_type_t = typename T::difference_type; template using pointer_t = typename T::pointer; template using reference_t = typename T::reference; template using iterator_category_t = typename T::iterator_category; template using to_json_function = decltype(T::to_json(std::declval()...)); template using from_json_function = decltype(T::from_json(std::declval()...)); template using get_template_function = decltype(std::declval().template get()); // trait checking if JSONSerializer::from_json(json const&, udt&) exists template struct has_from_json : std::false_type {}; // trait checking if j.get is valid // use this trait instead of std::is_constructible or std::is_convertible, // both rely on, or make use of implicit conversions, and thus fail when T // has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) template struct is_getable { static constexpr bool value = is_detected::value; }; template struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; // This trait checks if JSONSerializer::from_json(json const&) exists // this overload is used for non-default-constructible user-defined-types template struct has_non_default_from_json : std::false_type {}; template struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; // This trait checks if BasicJsonType::json_serializer::to_json exists // Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. template struct has_to_json : std::false_type {}; template struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; template using detect_key_compare = typename T::key_compare; template struct has_key_compare : std::integral_constant::value> {}; // obtains the actual object key comparator template struct actual_object_comparator { using object_t = typename BasicJsonType::object_t; using object_comparator_t = typename BasicJsonType::default_object_comparator_t; using type = typename std::conditional < has_key_compare::value, typename object_t::key_compare, object_comparator_t>::type; }; template using actual_object_comparator_t = typename actual_object_comparator::type; ///////////////// // char_traits // ///////////////// // Primary template of char_traits calls std char_traits template struct char_traits : std::char_traits {}; // Explicitly define char traits for unsigned char since it is not standard template<> struct char_traits : std::char_traits { using char_type = unsigned char; using int_type = uint64_t; // Redefine to_int_type function static int_type to_int_type(char_type c) noexcept { return static_cast(c); } static char_type to_char_type(int_type i) noexcept { return static_cast(i); } static constexpr int_type eof() noexcept { return static_cast(EOF); } }; // Explicitly define char traits for signed char since it is not standard template<> struct char_traits : std::char_traits { using char_type = signed char; using int_type = uint64_t; // Redefine to_int_type function static int_type to_int_type(char_type c) noexcept { return static_cast(c); } static char_type to_char_type(int_type i) noexcept { return static_cast(i); } static constexpr int_type eof() noexcept { return static_cast(EOF); } }; /////////////////// // is_ functions // /////////////////// // https://en.cppreference.com/w/cpp/types/conjunction template struct conjunction : std::true_type { }; template struct conjunction : B { }; template struct conjunction : std::conditional(B::value), conjunction, B>::type {}; // https://en.cppreference.com/w/cpp/types/negation template struct negation : std::integral_constant < bool, !B::value > { }; // Reimplementation of is_constructible and is_default_constructible, due to them being broken for // std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). // This causes compile errors in e.g. clang 3.5 or gcc 4.9. template struct is_default_constructible : std::is_default_constructible {}; template struct is_default_constructible> : conjunction, is_default_constructible> {}; template struct is_default_constructible> : conjunction, is_default_constructible> {}; template struct is_default_constructible> : conjunction...> {}; template struct is_default_constructible> : conjunction...> {}; template struct is_constructible : std::is_constructible {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_iterator_traits : std::false_type {}; template struct is_iterator_traits> { private: using traits = iterator_traits; public: static constexpr auto value = is_detected::value && is_detected::value && is_detected::value && is_detected::value && is_detected::value; }; template struct is_range { private: using t_ref = typename std::add_lvalue_reference::type; using iterator = detected_t; using sentinel = detected_t; // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator // and https://en.cppreference.com/w/cpp/iterator/sentinel_for // but reimplementing these would be too much work, as a lot of other concepts are used underneath static constexpr auto is_iterator_begin = is_iterator_traits>::value; public: static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; }; template using iterator_t = enable_if_t::value, result_of_begin())>>; template using range_value_t = value_type_t>>; // The following implementation of is_complete_type is taken from // https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ // and is written by Xiang Fan who agreed to using it in this library. template struct is_complete_type : std::false_type {}; template struct is_complete_type : std::true_type {}; template struct is_compatible_object_type_impl : std::false_type {}; template struct is_compatible_object_type_impl < BasicJsonType, CompatibleObjectType, enable_if_t < is_detected::value&& is_detected::value >> { using object_t = typename BasicJsonType::object_t; // macOS's is_constructible does not play well with nonesuch... static constexpr bool value = is_constructible::value && is_constructible::value; }; template struct is_compatible_object_type : is_compatible_object_type_impl {}; template struct is_constructible_object_type_impl : std::false_type {}; template struct is_constructible_object_type_impl < BasicJsonType, ConstructibleObjectType, enable_if_t < is_detected::value&& is_detected::value >> { using object_t = typename BasicJsonType::object_t; static constexpr bool value = (is_default_constructible::value && (std::is_move_assignable::value || std::is_copy_assignable::value) && (is_constructible::value && std::is_same < typename object_t::mapped_type, typename ConstructibleObjectType::mapped_type >::value)) || (has_from_json::value || has_non_default_from_json < BasicJsonType, typename ConstructibleObjectType::mapped_type >::value); }; template struct is_constructible_object_type : is_constructible_object_type_impl {}; template struct is_compatible_string_type { static constexpr auto value = is_constructible::value; }; template struct is_constructible_string_type { // launder type through decltype() to fix compilation failure on ICPC #ifdef __INTEL_COMPILER using laundered_type = decltype(std::declval()); #else using laundered_type = ConstructibleStringType; #endif static constexpr auto value = conjunction < is_constructible, is_detected_exact>::value; }; template struct is_compatible_array_type_impl : std::false_type {}; template struct is_compatible_array_type_impl < BasicJsonType, CompatibleArrayType, enable_if_t < is_detected::value&& is_iterator_traits>>::value&& // special case for types like std::filesystem::path whose iterator's value_type are themselves // c.f. https://github.com/nlohmann/json/pull/3073 !std::is_same>::value >> { static constexpr bool value = is_constructible>::value; }; template struct is_compatible_array_type : is_compatible_array_type_impl {}; template struct is_constructible_array_type_impl : std::false_type {}; template struct is_constructible_array_type_impl < BasicJsonType, ConstructibleArrayType, enable_if_t::value >> : std::true_type {}; template struct is_constructible_array_type_impl < BasicJsonType, ConstructibleArrayType, enable_if_t < !std::is_same::value&& !is_compatible_string_type::value&& is_default_constructible::value&& (std::is_move_assignable::value || std::is_copy_assignable::value)&& is_detected::value&& is_iterator_traits>>::value&& is_detected::value&& // special case for types like std::filesystem::path whose iterator's value_type are themselves // c.f. https://github.com/nlohmann/json/pull/3073 !std::is_same>::value&& is_complete_type < detected_t>::value >> { using value_type = range_value_t; static constexpr bool value = std::is_same::value || has_from_json::value || has_non_default_from_json < BasicJsonType, value_type >::value; }; template struct is_constructible_array_type : is_constructible_array_type_impl {}; template struct is_compatible_integer_type_impl : std::false_type {}; template struct is_compatible_integer_type_impl < RealIntegerType, CompatibleNumberIntegerType, enable_if_t < std::is_integral::value&& std::is_integral::value&& !std::is_same::value >> { // is there an assert somewhere on overflows? using RealLimits = std::numeric_limits; using CompatibleLimits = std::numeric_limits; static constexpr auto value = is_constructible::value && CompatibleLimits::is_integer && RealLimits::is_signed == CompatibleLimits::is_signed; }; template struct is_compatible_integer_type : is_compatible_integer_type_impl {}; template struct is_compatible_type_impl: std::false_type {}; template struct is_compatible_type_impl < BasicJsonType, CompatibleType, enable_if_t::value >> { static constexpr bool value = has_to_json::value; }; template struct is_compatible_type : is_compatible_type_impl {}; template struct is_constructible_tuple : std::false_type {}; template struct is_constructible_tuple> : conjunction...> {}; template struct is_json_iterator_of : std::false_type {}; template struct is_json_iterator_of : std::true_type {}; template struct is_json_iterator_of : std::true_type {}; // checks if a given type T is a template specialization of Primary template