From dde63b5017514dab97b2bcedddd94cf04e598d70 Mon Sep 17 00:00:00 2001 From: Andrey Nekrasov Date: Tue, 22 Dec 2020 17:15:46 +0300 Subject: [PATCH] Report tool improvements (#8709) * bugreport: move to tools * bugreport: skip packaging installers, format time with seconds, remove monitor-info-report tool * bugreport: move BugReportTool to Tools folder * fix CI * fix CDPX --- .github/actions/spell-check/expect.txt | 47 +++---- .pipelines/build-tools.cmd | 10 ++ .../ci/templates/build-powertoys-steps.yml | 4 +- .pipelines/pipeline.user.windows.yml | 11 ++ installer/PowerToysSetup/Product.wxs | 20 +-- src/common/utils/timeutil.h | 9 ++ .../BugReportTool/BugReportTool.sln | 2 +- .../BugReportTool/BugReportTool.vcxproj | 17 ++- .../BugReportTool.vcxproj.filters | 20 +-- .../BugReportTool/BugReportTool/Main.cpp | 58 ++++----- .../BugReportTool/ReportMonitorInfo.cpp} | 4 +- .../BugReportTool/ReportMonitorInfo.h} | 0 .../BugReportTool/ZipTools/zipfolder.cpp | 4 +- .../BugReportTool/ZipTools/zipfolder.h | 0 .../BugReportTool/packages.config | 0 tools/monitor_info_report/main.vcxproj | 118 ------------------ .../monitor-report-info.cpp | 40 ------ .../monitor_info_report.sln | 20 --- .../print_wmi_monitor_info.ps1 | 6 - 19 files changed, 108 insertions(+), 282 deletions(-) create mode 100644 .pipelines/build-tools.cmd rename {src/bug-report => tools}/BugReportTool/BugReportTool.sln (93%) rename {src/bug-report => tools}/BugReportTool/BugReportTool/BugReportTool.vcxproj (82%) rename {src/bug-report => tools}/BugReportTool/BugReportTool/BugReportTool.vcxproj.filters (57%) rename {src/bug-report => tools}/BugReportTool/BugReportTool/Main.cpp (86%) rename tools/{monitor_info_report/report-monitor-info.cpp => BugReportTool/BugReportTool/ReportMonitorInfo.cpp} (96%) rename tools/{monitor_info_report/report-monitor-info.h => BugReportTool/BugReportTool/ReportMonitorInfo.h} (100%) rename {src/bug-report => tools}/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp (88%) rename {src/bug-report => tools}/BugReportTool/BugReportTool/ZipTools/zipfolder.h (100%) rename {src/bug-report => tools}/BugReportTool/BugReportTool/packages.config (100%) delete mode 100644 tools/monitor_info_report/main.vcxproj delete mode 100644 tools/monitor_info_report/monitor-report-info.cpp delete mode 100644 tools/monitor_info_report/monitor_info_report.sln delete mode 100644 tools/monitor_info_report/print_wmi_monitor_info.ps1 diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 1b6e3b5b82..ec48a595e1 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -22,7 +22,6 @@ acos acrt Actioncenter Actionkeyword -actionrunner activatable ACTIVATEAPP activationaction @@ -33,7 +32,6 @@ ADifferent adopsinsider advapi advfirewall -aeed AFeature AFX AGGREGATABLE @@ -174,7 +172,6 @@ bmi bmp bms Bokm -Bokmal BOKMAL bootstrapper BOTTOMALIGN @@ -190,7 +187,6 @@ BSODs bstr BText bti -btn Btn BTNFACE Bto @@ -222,8 +218,8 @@ CDeclaration cdpx cdpxwin CENTERALIGN -cfg Cfg +cfg changecursor Changemove charset @@ -302,7 +298,6 @@ commandline commctrl Commdlg commondataservicecds -commonmdflag Compat COMPOSITIONFULL comsupp @@ -317,7 +312,6 @@ constexpr contentdialog contentfiles CONTEXTHELP -contextmenu CONTEXTMENU CONTEXTMENUHANDLER CONTROLL @@ -656,14 +650,15 @@ ENU enum ENUMITEMS EOAC -eol EOL +eol epicgames +eport ERASEBKGND EREOF EResize -errorlevel ERRORLEVEL +errorlevel ERRORMESSAGE ERRORTITLE esize @@ -715,7 +710,6 @@ FANCYZONESEDITOR Farbraum FARPROC Favicon -fbdc fcharset fd fda @@ -1081,8 +1075,8 @@ ISavable isbi ISearch IService -isetting ISetting +isetting isfinite IShell ISingle @@ -1158,8 +1152,8 @@ keyremaps keystokes Keystool Keytool -keyup KEYUP +keyup Kf KILLFOCUS Knownfolders @@ -1285,7 +1279,6 @@ Mainwindow makeappx MAKEINTRESOURCE MAKEINTRESOURCEW -MAKELANGID MAKELPARAM makepri malloc @@ -1393,7 +1386,6 @@ msrc mst msvc msvcp -msvs MTND Mul multiline @@ -1405,8 +1397,8 @@ multizone mutex mutexes muxc -mvvm Mvvm +mvvm MYICON myuri NAMECHANGE @@ -1495,7 +1487,6 @@ NOSIZE notafter notfound nothrow -notificationsdll NOTIFICATIONSDLL NOTIFYICONDATAW NOTIMPL @@ -1705,8 +1696,8 @@ propkey propvarutil Prt prui -prvpane PRVPANE +prvpane psapi PSECURITY psfgao @@ -1904,8 +1895,8 @@ serializer serizalization serverside SETCONTEXT -setcursor SETCURSOR +setcursor SETFOCUS SETFOREGROUND SETICON @@ -1936,8 +1927,8 @@ SHELLDLL shellex SHELLEXECUTEINFO SHELLEXECUTEINFOW -shellscalingapi Shellscalingapi +shellscalingapi Shelveset SHFILEINFO SHGFI @@ -1999,7 +1990,6 @@ sln SLogo SMALLICON SMTO -SNAPED snd somil SORTDOWN @@ -2056,8 +2046,8 @@ stdin stdlib STDMETHODCALLTYPE STDMETHODIMP -stdout Stdout +stdout STEPIT stgm STGMEDIUM @@ -2076,8 +2066,8 @@ stringtable stringval strsafe strutil -sttngs STTNGS +sttngs Stubless STYLECHANGED STYLECHANGING @@ -2115,8 +2105,8 @@ SYSDEADCHAR SYSICONINDEX SYSKEY syskeydown -syskeyup SYSKEYUP +syskeyup syslog SYSMENU systemd @@ -2264,7 +2254,6 @@ uninstalling uninstantiated Uniq uniquifier -uniquifies Uniquifies unittests unk @@ -2365,7 +2354,6 @@ Wca wcautil WCE wcex -WCF wchar WClass wcout @@ -2376,8 +2364,8 @@ wcslen wcsncmp wcsnicmp wdp -wds WDS +wds wdupenv weakme webapp @@ -2394,14 +2382,13 @@ Whichdoes whitespaces WIC Wifi -wifstream wih wiki wikipedia wil wildcards -winapi WINAPI +winapi winauto wincolor windef @@ -2514,7 +2501,7 @@ xml xmlns XNamespace XOffset -XPath +xpath XResource xsd xsi @@ -2523,8 +2510,8 @@ XStr XToolset xunit XY -yaml YAML +yaml YAngle YDiff YESNO diff --git a/.pipelines/build-tools.cmd b/.pipelines/build-tools.cmd new file mode 100644 index 0000000000..47da7a5c96 --- /dev/null +++ b/.pipelines/build-tools.cmd @@ -0,0 +1,10 @@ +cd /D "%~dp0" + +call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 -winsdk=10.0.18362.0 +pushd . +cd .. +set SolutionDir=%cd% +popd +SET IsPipeline=1 +call msbuild ../tools/BugReportTool/BugReportTool.sln /p:Configuration=Release /p:Platform=x64 /p:CIBuild=true || exit /b 1 + diff --git a/.pipelines/ci/templates/build-powertoys-steps.yml b/.pipelines/ci/templates/build-powertoys-steps.yml index 68a599245e..b7783e3108 100644 --- a/.pipelines/ci/templates/build-powertoys-steps.yml +++ b/.pipelines/ci/templates/build-powertoys-steps.yml @@ -42,8 +42,8 @@ steps: command: restore feedsToUse: config configPath: NuGet.config - restoreSolution: src\bug-report\BugReportTool\BugReportTool.sln - restoreDirectory: '$(Build.SourcesDirectory)\src\bug-report\BugReportTool\packages' + restoreSolution: tools\BugReportTool\BugReportTool.sln + restoreDirectory: '$(Build.SourcesDirectory)\tools\BugReportTool\packages' - task: VSBuild@1 displayName: 'Build BugReportTool.sln' diff --git a/.pipelines/pipeline.user.windows.yml b/.pipelines/pipeline.user.windows.yml index ef6bfbbd02..5008914ed5 100644 --- a/.pipelines/pipeline.user.windows.yml +++ b/.pipelines/pipeline.user.windows.yml @@ -63,6 +63,7 @@ build: to: 'Build_Output' include: - 'action_runner.exe' + - 'BugReportTool\BugReportTool.exe' - 'modules\ColorPicker\ColorPicker.dll' - 'modules\ColorPicker\ColorPickerUI.dll' - 'modules\ColorPicker\ColorPickerUI.exe' @@ -146,6 +147,16 @@ build: - 'SettingsUIRunner\ManagedCommon.dll' signing_options: sign_inline: true # This does signing a soon as this command completes + - !!buildcommand + name: 'Build Power Toys Tools' + command: '.pipelines\build-tools.cmd' + artifacts: + - from: 'x64\Release' + to: 'Build_Output' + include: + - 'BugReportTool\BugReportTool.exe' + signing_options: + sign_inline: true # This does signing a soon as this command completes - !!buildcommand name: 'Build Power Toys Installer' command: '.pipelines\build-installer.cmd' diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs index d3b65ffe06..c7e0fb268e 100644 --- a/installer/PowerToysSetup/Product.wxs +++ b/installer/PowerToysSetup/Product.wxs @@ -12,7 +12,6 @@ - - + @@ -208,7 +207,7 @@ - + @@ -315,6 +314,7 @@ + @@ -340,11 +340,6 @@ - - - - - @@ -378,6 +373,12 @@ + + + + + + @@ -775,6 +776,9 @@ + + + diff --git a/src/common/utils/timeutil.h b/src/common/utils/timeutil.h index e6d1fa1177..8242cef9d0 100644 --- a/src/common/utils/timeutil.h +++ b/src/common/utils/timeutil.h @@ -9,6 +9,15 @@ namespace timeutil { + inline std::string format_as_local(const char* format_string, const time_t time) + { + char timeBuf[256] = {}; + tm localtime{}; + localtime_s(&localtime, &time); + std::strftime(timeBuf, sizeof(timeBuf), format_string, &localtime); + return timeBuf; + } + inline std::wstring to_string(const time_t time) { return std::to_wstring(static_cast(time)); diff --git a/src/bug-report/BugReportTool/BugReportTool.sln b/tools/BugReportTool/BugReportTool.sln similarity index 93% rename from src/bug-report/BugReportTool/BugReportTool.sln rename to tools/BugReportTool/BugReportTool.sln index ffc2c59965..961744da35 100644 --- a/src/bug-report/BugReportTool/BugReportTool.sln +++ b/tools/BugReportTool/BugReportTool.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.30611.23 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BugReportTool", "BugReportTool\BugReportTool.vcxproj", "{99126840-5C30-4E9E-AC6C-E73DDED5C3BD}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SetttingsAPI", "..\..\common\SettingsAPI\SetttingsAPI.vcxproj", "{6955446D-23F7-4023-9BB3-8657F904AF99}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SetttingsAPI", "..\..\src\common\SettingsAPI\SetttingsAPI.vcxproj", "{6955446D-23F7-4023-9BB3-8657F904AF99}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/bug-report/BugReportTool/BugReportTool/BugReportTool.vcxproj b/tools/BugReportTool/BugReportTool/BugReportTool.vcxproj similarity index 82% rename from src/bug-report/BugReportTool/BugReportTool/BugReportTool.vcxproj rename to tools/BugReportTool/BugReportTool/BugReportTool.vcxproj index 24159e772a..394fa29790 100644 --- a/src/bug-report/BugReportTool/BugReportTool/BugReportTool.vcxproj +++ b/tools/BugReportTool/BugReportTool/BugReportTool.vcxproj @@ -11,6 +11,8 @@ Application + $(SolutionDir)..\..\$(Platform)\$(Configuration)\obj\$(ProjectName)\ + $(SolutionDir)..\..\$(Platform)\$(Configuration)\$(ProjectName)\ @@ -24,14 +26,17 @@ NotUsing + ../../../src/ Console - - + + TurnOffAllWarnings + + @@ -39,14 +44,14 @@ - + {6955446d-23f7-4023-9bb3-8657f904af99} - - - + + + diff --git a/src/bug-report/BugReportTool/BugReportTool/BugReportTool.vcxproj.filters b/tools/BugReportTool/BugReportTool/BugReportTool.vcxproj.filters similarity index 57% rename from src/bug-report/BugReportTool/BugReportTool/BugReportTool.vcxproj.filters rename to tools/BugReportTool/BugReportTool/BugReportTool.vcxproj.filters index 4b60e93b1d..e06c45fb28 100644 --- a/src/bug-report/BugReportTool/BugReportTool/BugReportTool.vcxproj.filters +++ b/tools/BugReportTool/BugReportTool/BugReportTool.vcxproj.filters @@ -5,15 +5,11 @@ - - ZipTools - ZipTools - - MonitorReportTool - + + @@ -24,18 +20,12 @@ - - ZipTools - - - ZipTools - ZipTools - - MonitorReportTool - + + + \ No newline at end of file diff --git a/src/bug-report/BugReportTool/BugReportTool/Main.cpp b/tools/BugReportTool/BugReportTool/Main.cpp similarity index 86% rename from src/bug-report/BugReportTool/BugReportTool/Main.cpp rename to tools/BugReportTool/BugReportTool/Main.cpp index b268bf7fe3..434824e0a5 100644 --- a/src/bug-report/BugReportTool/BugReportTool/Main.cpp +++ b/tools/BugReportTool/BugReportTool/Main.cpp @@ -7,9 +7,11 @@ #include #include "ZipTools/ZipFolder.h" -#include "../../../common/SettingsAPI/settings_helpers.h" -#include "../../../common/utils/json.h" -#include "../../../../tools/monitor_info_report/report-monitor-info.h" +#include +#include +#include + +#include "ReportMonitorInfo.h" using namespace std; using namespace std::filesystem; @@ -57,7 +59,7 @@ void hideByXPath(IJsonValue& val, vector& xpathArray, int p) { for (auto it : val.GetArray()) { - hideByXPath(it, xpathArray, p); + hideByXPath(it, xpathArray, p); } return; @@ -74,7 +76,7 @@ void hideByXPath(IJsonValue& val, vector& xpathArray, int p) obj.SetNamedValue(xpathArray[p], privateDatavalue); } } - + return; } @@ -89,8 +91,8 @@ void hideByXPath(IJsonValue& val, vector& xpathArray, int p) { return; } - - hideByXPath(newVal, xpathArray, p + 1); + + hideByXPath(newVal, xpathArray, p + 1); } } @@ -102,7 +104,7 @@ void hideForFile(const path& dir, const wstring& relativePath) if (!jObject.has_value()) { wprintf(L"Can not parse file %s\n", jsonPath.c_str()); - return; + return; } JsonValue jValue = json::value(jObject.value()); @@ -128,7 +130,7 @@ bool del(wstring path) return true; } -void hideUserPrivateInfo(const filesystem::path& dir) +void hideUserPrivateInfo(const filesystem::path& dir) { // Replace data in json files for (auto& it : escapeInfo) @@ -145,26 +147,11 @@ void hideUserPrivateInfo(const filesystem::path& dir) } } -string getCurrentDate() -{ - time_t now = time(0); - tm localTime; - if (localtime_s(&localTime, &now) != 0) - { - return ""; - } - - int year = 1900 + localTime.tm_year; - int month = 1 + localTime.tm_mon; - int day = localTime.tm_mday; - return to_string(year) + "-" + to_string(month) + "-" + to_string(day); -} - void reportMonitorInfo(const filesystem::path& tmpDir) { auto monitorReportPath = tmpDir; monitorReportPath.append("monitor-report-info.txt"); - + try { wofstream monitorReport(monitorReportPath); @@ -189,9 +176,10 @@ void reportWindowsVersion(const filesystem::path& tmpDir) try { - NTSTATUS(WINAPI * RtlGetVersion)(LPOSVERSIONINFOEXW); + NTSTATUS(WINAPI * RtlGetVersion) + (LPOSVERSIONINFOEXW) = nullptr; *(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion"); - if (NULL != RtlGetVersion) + if (RtlGetVersion) { osInfo.dwOSVersionInfoSize = sizeof(osInfo); RtlGetVersion(&osInfo); @@ -238,7 +226,7 @@ int wmain(int argc, wchar_t* argv[], wchar_t*) } auto powerToys = PTSettingsHelper::get_root_save_folder_location(); - + // Copy to a temp folder auto tmpDir = temp_directory_path(); tmpDir = tmpDir.append("PowerToys\\"); @@ -251,14 +239,16 @@ int wmain(int argc, wchar_t* argv[], wchar_t*) try { copy(powerToys, tmpDir, copy_options::recursive); + // Remove updates folder contents + del(tmpDir / "Updates"); } catch (...) { printf("Copy PowerToys directory failed"); return 1; } - - // Hide sensative information + + // Hide sensitive information hideUserPrivateInfo(tmpDir); // Write monitors info to the temporary folder @@ -269,7 +259,11 @@ int wmain(int argc, wchar_t* argv[], wchar_t*) // Zip folder auto zipPath = path::path(saveZipPath); - zipPath = zipPath.append("PowerToysReport_" + getCurrentDate() + ".zip"); + std::string reportFilename{"PowerToysReport_"}; + reportFilename += timeutil::format_as_local("%F-%H-%M-%S", timeutil::now()); + reportFilename += ".zip"; + zipPath /= reportFilename; + try { zipFolder(zipPath, tmpDir); @@ -279,7 +273,7 @@ int wmain(int argc, wchar_t* argv[], wchar_t*) printf("Zip folder failed"); return 1; } - + del(tmpDir); return 0; } \ No newline at end of file diff --git a/tools/monitor_info_report/report-monitor-info.cpp b/tools/BugReportTool/BugReportTool/ReportMonitorInfo.cpp similarity index 96% rename from tools/monitor_info_report/report-monitor-info.cpp rename to tools/BugReportTool/BugReportTool/ReportMonitorInfo.cpp index 905ca7a4db..3acc49950c 100644 --- a/tools/monitor_info_report/report-monitor-info.cpp +++ b/tools/BugReportTool/BugReportTool/ReportMonitorInfo.cpp @@ -1,7 +1,7 @@ #pragma once -#include "report-monitor-info.h" +#include "ReportMonitorInfo.h" #include -#include "../../src/common/utils/winapi_error.h" +#include "../../../src/common/utils/winapi_error.h" int report(std::wostream& os) { diff --git a/tools/monitor_info_report/report-monitor-info.h b/tools/BugReportTool/BugReportTool/ReportMonitorInfo.h similarity index 100% rename from tools/monitor_info_report/report-monitor-info.h rename to tools/BugReportTool/BugReportTool/ReportMonitorInfo.h diff --git a/src/bug-report/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp b/tools/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp similarity index 88% rename from src/bug-report/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp rename to tools/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp index 5c739dea11..6220fcbdd1 100644 --- a/src/bug-report/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp +++ b/tools/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp @@ -1,5 +1,5 @@ #include "zipfolder.h" -#include "..\..\..\..\..\deps\cziplib\src\zip.h" +#include "..\..\..\..\deps\cziplib\src\zip.h" void zipFolder(std::filesystem::path zipPath, std::filesystem::path folderPath) { @@ -11,7 +11,7 @@ void zipFolder(std::filesystem::path zipPath, std::filesystem::path folderPath) } using recursive_directory_iterator = std::filesystem::recursive_directory_iterator; - int rootSize = folderPath.wstring().size(); + const size_t rootSize = folderPath.wstring().size(); for (const auto& dirEntry : recursive_directory_iterator(folderPath)) { if (dirEntry.is_regular_file()) diff --git a/src/bug-report/BugReportTool/BugReportTool/ZipTools/zipfolder.h b/tools/BugReportTool/BugReportTool/ZipTools/zipfolder.h similarity index 100% rename from src/bug-report/BugReportTool/BugReportTool/ZipTools/zipfolder.h rename to tools/BugReportTool/BugReportTool/ZipTools/zipfolder.h diff --git a/src/bug-report/BugReportTool/BugReportTool/packages.config b/tools/BugReportTool/BugReportTool/packages.config similarity index 100% rename from src/bug-report/BugReportTool/BugReportTool/packages.config rename to tools/BugReportTool/BugReportTool/packages.config diff --git a/tools/monitor_info_report/main.vcxproj b/tools/monitor_info_report/main.vcxproj deleted file mode 100644 index cd50da7026..0000000000 --- a/tools/monitor_info_report/main.vcxproj +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - {6A7F9A7C-56B6-9B0D-FFA2-8110EBB8170F} - true - Win32Proj - main - 10.0 - - - - Application - true - Unicode - v142 - - - Application - false - Unicode - v142 - - - - - - - - - - - - - bin\ - obj\Debug\ - monitor_info_reportd - .exe - - - bin\ - obj\Release\ - monitor_info_report - .exe - - - - NotUsing - Level4 - true - 4127;4275;5054;4201;4100;%(DisableSpecificWarnings) - NOMINMAX;_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions) - ..\src;%(AdditionalIncludeDirectories) - EditAndContinue - Disabled - false - MultiThreadedDebugDLL - true - /permissive- /await /Zc:__cplusplus %(AdditionalOptions) - stdcpplatest - - - Console - true - DebugFastLink - - - true - - - - - NotUsing - Level4 - true - 4127;4275;5054;4201;%(DisableSpecificWarnings) - NOMINMAX;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) - ..\src;%(AdditionalIncludeDirectories) - Full - true - true - false - true - MultiThreadedDLL - true - /permissive- /await /Zc:__cplusplus %(AdditionalOptions) - stdcpplatest - - - Console - true - true - - - true - - - - - - \ No newline at end of file diff --git a/tools/monitor_info_report/monitor-report-info.cpp b/tools/monitor_info_report/monitor-report-info.cpp deleted file mode 100644 index ab8b84b341..0000000000 --- a/tools/monitor_info_report/monitor-report-info.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "report-monitor-info.h" -#include -#include -#include -#include -#include -#include "../../src/common/utils/winapi_error.h" - -int main() -{ - time_t rawtime; - struct tm* timeinfo; - char buffer[1024]; - - time(&rawtime); - timeinfo = localtime(&rawtime); - - strftime(buffer, sizeof(buffer), "monitor-info-report-%d-%m-%Y-%H-%M-%S.txt", timeinfo); - std::string str(buffer); - - std::wofstream of{ str }; - std::wostringstream oss; - try - { - oss << "GetSystemMetrics = " << GetSystemMetrics(SM_CMONITORS) << '\n'; - report(oss); - } - catch (std::exception& ex) - { - oss << "exception: " << ex.what() << '\n'; - } - catch (...) - { - auto message = get_last_error_message(GetLastError()); - oss << "unknown exception: " << (message.has_value() ? message.value() : L"") << '\n'; - } - of << oss.str(); - std::wcout << oss.str() << '\n'; - return 0; -} \ No newline at end of file diff --git a/tools/monitor_info_report/monitor_info_report.sln b/tools/monitor_info_report/monitor_info_report.sln deleted file mode 100644 index 62203d2208..0000000000 --- a/tools/monitor_info_report/monitor_info_report.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "main", "main.vcxproj", "{6A7F9A7C-56B6-9B0D-FFA2-8110EBB8170F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6A7F9A7C-56B6-9B0D-FFA2-8110EBB8170F}.Debug|x64.ActiveCfg = Debug|x64 - {6A7F9A7C-56B6-9B0D-FFA2-8110EBB8170F}.Debug|x64.Build.0 = Debug|x64 - {6A7F9A7C-56B6-9B0D-FFA2-8110EBB8170F}.Release|x64.ActiveCfg = Release|x64 - {6A7F9A7C-56B6-9B0D-FFA2-8110EBB8170F}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tools/monitor_info_report/print_wmi_monitor_info.ps1 b/tools/monitor_info_report/print_wmi_monitor_info.ps1 deleted file mode 100644 index 2d040f398a..0000000000 --- a/tools/monitor_info_report/print_wmi_monitor_info.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -$output = gwmi WmiMonitorID -Namespace root\wmi | ForEach-Object { ($_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join ""; ($_.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join ""; $_.InstanceName + "`n" } | Out-String -Write-Host $output -$LogTime = Get-Date -Format "MM-dd-yyyy_hh-mm-ss" -$LogFile = 'wmi_monitor_info-' + $LogTime + ".log" -Write-Output $output | Out-File $LogFile -