Bug report tool for registry (#9213)

* wip

* Improved registry bug reporting

* Don't use macros

* Ignore spelling of NLSTEXT in macro

* Various improvements

* Move functions to separate files
* Rename result file to registry-report-info.txt
* Rename a poorly named function in ReportMonitorInfo.cpp
* Restrict scope of symbols in these .cpp files

Co-authored-by: Davide <davide.giacometti@outlook.it>
This commit is contained in:
Ivan Stošić
2021-01-21 17:01:28 +01:00
committed by GitHub
parent b74afd3a80
commit 0b12798922
8 changed files with 291 additions and 60 deletions

View File

@@ -13,6 +13,7 @@
#include <common/utils/exec.h>
#include "ReportMonitorInfo.h"
#include "ReportRegistry.h"
using namespace std;
using namespace std::filesystem;
using namespace winrt::Windows::Data::Json;
@@ -148,27 +149,6 @@ void hideUserPrivateInfo(const filesystem::path& dir)
}
}
void reportMonitorInfo(const filesystem::path& tmpDir)
{
auto monitorReportPath = tmpDir;
monitorReportPath.append("monitor-report-info.txt");
try
{
wofstream monitorReport(monitorReportPath);
monitorReport << "GetSystemMetrics = " << GetSystemMetrics(SM_CMONITORS) << '\n';
report(monitorReport);
}
catch (std::exception& ex)
{
printf("Failed to report monitor info. %s\n", ex.what());
}
catch (...)
{
printf("Failed to report monitor info\n");
}
}
void reportWindowsVersion(const filesystem::path& tmpDir)
{
auto versionReportPath = tmpDir;
@@ -285,6 +265,9 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
// Write dotnet installation info to the temporary folder
reportDotNetInstallationInfo(tmpDir);
// Write registry to the temporary folder
reportRegistry(tmpDir);
// Zip folder
auto zipPath = path::path(saveZipPath);
std::string reportFilename{"PowerToysReport_"};
@@ -304,4 +287,4 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
deleteFolder(tmpDir);
return 0;
}
}