2020-12-22 12:27:28 +02:00
|
|
|
#include <filesystem>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <Shlobj.h>
|
|
|
|
|
#include <winrt/Windows.Data.Json.h>
|
|
|
|
|
#include <winrt/Windows.Foundation.Collections.h>
|
2021-05-06 16:17:57 +03:00
|
|
|
#include <winrt/Windows.System.UserProfile.h>
|
|
|
|
|
#include <winrt/Windows.Globalization.h>
|
2020-12-22 12:27:28 +02:00
|
|
|
|
|
|
|
|
#include "ZipTools/ZipFolder.h"
|
2020-12-22 17:15:46 +03:00
|
|
|
#include <common/SettingsAPI/settings_helpers.h>
|
|
|
|
|
#include <common/utils/json.h>
|
|
|
|
|
#include <common/utils/timeutil.h>
|
2021-01-12 20:48:55 +02:00
|
|
|
#include <common/utils/exec.h>
|
2020-12-22 17:15:46 +03:00
|
|
|
|
2022-06-30 22:10:14 +02:00
|
|
|
#include "Package.h"
|
2020-12-22 17:15:46 +03:00
|
|
|
#include "ReportMonitorInfo.h"
|
2021-05-20 18:41:12 +03:00
|
|
|
#include "RegistryUtils.h"
|
2021-05-26 16:23:49 +03:00
|
|
|
#include "EventViewer.h"
|
2021-07-20 10:33:00 +03:00
|
|
|
#include "InstallationFolder.h"
|
2022-10-26 14:02:31 +01:00
|
|
|
#include "ReportGPOValues.h"
|
2021-05-26 16:23:49 +03:00
|
|
|
|
2020-12-22 12:27:28 +02:00
|
|
|
using namespace std;
|
|
|
|
|
using namespace std::filesystem;
|
|
|
|
|
using namespace winrt::Windows::Data::Json;
|
|
|
|
|
|
|
|
|
|
map<wstring, vector<wstring>> escapeInfo = {
|
|
|
|
|
{ L"FancyZones\\app-zone-history.json", { L"app-zone-history/app-path" } },
|
2023-11-23 11:46:07 +01:00
|
|
|
{ L"FancyZones\\settings.json", { L"properties/fancyzones_excluded_apps" } },
|
|
|
|
|
{ L"MouseWithoutBorders\\settings.json", { L"properties/SecurityKey" } }, // avoid leaking connection key
|
[KBM]Launch apps / URI with keyboard shortcuts, support chords (#30121)
* Working UI update with just runProgram Path and isRunProgram
* First working, basic. no args or path, or setting change detections.
* Revert and fixed.
* Some clean up, working with config file monitor
* Args and Start-in should be working.
* File monitor, quotes, xaml screens one
* Fixed enable/disable toogle from XAML
* Code cleanup.
* Betting logging.
* Cleanup, start of RunProgramDescriptor and usage of run_non_elevated/run_elevated
* Code moved to KeyboardEventHandlers, but not enabled since it won't build as is, needs elevation.h. Other testing..
* Key chords working, pretty much
* Added gui for elevation level, need to refresh on change...
* f: include shellapi.h and reference wil in KBMEL
* run_elevated/run_non_elevated sorted out. Working!
* Removed lots of old temp code.
* Fix some speling errors.
* Cleanup before trying to add a UI for the chord
* Added "DifferentUser" option
* Closer on UI for chords.
* Better UI, lots working.
* Clean up
* Text for “Allow chords” – needs to look better…
* Bugs and clean-up
* Cleanup
* Refactor and clean up.
* More clean up
* Some localization.
* Don’t show “Allow chords“ to the “to” shortcut
* Maybe better foreground after opening new app
* Better chord matching.
* Runprogram fix for stealing existing shortcut.
* Better runProgram stuff
* Temp commit
* Working well
* Toast test
* More toast
* Added File and Folder picker UI
* Pre-check on run program file exists.
* Refactor to SetupRunProgramControls
* Open URI UI is going.
* Open URI working well
* Open URI stuff working well
* Allowed AppSpecific shortcut and fixed backup/restore shortcut dups
* Fixed settings screen
* Start of code to find by name...
* UI fixed
* Small fixes
* Some single edit code working.
* UI getting better.
* Fixes
* Fixed and merge from main
* UI updates
* UI updates.
* UI stuff
* Fixed crash from move ui item locations.
* Fixed crash from move ui item locations.
* Added delete confirm
* Basic sound working.
* Localized some stuff
* Added sounds
* Better experiance when shortcut is in use.
* UI tweaks
* Fixed KBM ui for unicode shortcut not having ","
* Some clean up
* Cleanup
* Cleanup
* Fixed applyXamlStyling
* Added back stuff lost in merge
* applyXamlStyling, again
* Fixed crash on change from non shortcut to shortcut
* Update src/modules/keyboardmanager/KeyboardManagerEngineTest/KeyboardManagerEngineTest.vcxproj
* Fixed some spelling type issues.
* ImplementationLibrary 231216
* Comment bump to see if the Microsoft.Windows.ImplementationLibrary version thing gets picked up
* Correct, Microsoft.Windows.ImplementationLibrary, finally?
* Fixed two test that failed because we now allow key-chords.
* Removed shortcut sounds.
* use original behavior when "allow chords" is off in shortcut window
* fix crash when editing a shortcut that has apps specified for it
* split KBM chords with comma on dashboard page
* Fix some spelling items.
* More "spelling"
* Fix XAML styling
* align TextBlock and ToggleSwitch
* fix cutoff issue at the top
* increase ComboBox width
* Added *Unsupported* for backwards compat on config of KBM
* fix spellcheck
* Fix crash on Remap key screen
* Fixed Remap Keys ComboBox width too short.
* Removed KBM Single Edit mode, fixed crash.
* Fix Xaml with xaml cops
* Fix crash on setting "target app" for some types of shortcuts.
* Space to toggle chord, combobox back
* fix spellcheck
* fix some code nits
* Code review updates.
* Add exclusions to the bug report tool
* Code review and kill CloseAndEndTask
* Fix alignment / 3 comboboxes per row
* Fix daily telemetry events to exclude start app and open URI
* Add chords and remove app start and open uri from config telemetry
* comma instead of plus in human readable shortcut telemetry data
* Code review, restore default-old state when new row added in KBM
* Code review, restore default-old state when new row added in KBM, part 2
* Still show target app on Settings
* Only allow enabling chords for origin shortcuts
---------
Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
2024-02-27 18:12:05 -05:00
|
|
|
{ L"Keyboard Manager\\default.json", {
|
|
|
|
|
L"remapKeysToText",
|
|
|
|
|
L"remapShortcutsToText",
|
|
|
|
|
L"remapShortcuts/global/runProgramFilePath",
|
|
|
|
|
L"remapShortcuts/global/runProgramArgs",
|
|
|
|
|
L"remapShortcuts/global/runProgramStartInDir",
|
|
|
|
|
L"remapShortcuts/global/openUri",
|
|
|
|
|
L"remapShortcuts/appSpecific/runProgramFilePath",
|
|
|
|
|
L"remapShortcuts/appSpecific/runProgramArgs",
|
|
|
|
|
L"remapShortcuts/appSpecific/runProgramStartInDir",
|
|
|
|
|
L"remapShortcuts/appSpecific/openUri",
|
|
|
|
|
} }, // avoid leaking personal information from text, URI or application mappings
|
2020-12-22 12:27:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
vector<wstring> filesToDelete = {
|
2024-05-09 10:32:03 -04:00
|
|
|
L"AdvancedPaste\\lastQuery.json",
|
2020-12-24 17:05:32 +01:00
|
|
|
L"PowerToys Run\\Cache",
|
|
|
|
|
L"PowerRename\\replace-mru.json",
|
2021-01-19 18:43:28 +02:00
|
|
|
L"PowerRename\\search-mru.json",
|
|
|
|
|
L"PowerToys Run\\Settings\\UserSelectedRecord.json",
|
|
|
|
|
L"PowerToys Run\\Settings\\QueryHistory.json"
|
2020-12-22 12:27:28 +02:00
|
|
|
};
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
vector<wstring> GetXpathArray(wstring xpath)
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
|
|
|
|
vector<wstring> result;
|
|
|
|
|
wstring cur = L"";
|
|
|
|
|
for (auto ch : xpath)
|
|
|
|
|
{
|
|
|
|
|
if (ch == L'/')
|
|
|
|
|
{
|
|
|
|
|
result.push_back(cur);
|
|
|
|
|
cur = L"";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cur += ch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!cur.empty())
|
|
|
|
|
{
|
|
|
|
|
result.push_back(cur);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
void HideByXPath(IJsonValue& val, vector<wstring>& xpathArray, int p)
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
|
|
|
|
if (val.ValueType() == JsonValueType::Array)
|
|
|
|
|
{
|
|
|
|
|
for (auto it : val.GetArray())
|
|
|
|
|
{
|
2021-05-20 18:41:12 +03:00
|
|
|
HideByXPath(it, xpathArray, p);
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (p == xpathArray.size() - 1)
|
|
|
|
|
{
|
|
|
|
|
if (val.ValueType() == JsonValueType::Object)
|
|
|
|
|
{
|
|
|
|
|
auto obj = val.GetObjectW();
|
|
|
|
|
if (obj.HasKey(xpathArray[p]))
|
|
|
|
|
{
|
|
|
|
|
auto privateDatavalue = JsonValue::CreateStringValue(L"<private_data>");
|
|
|
|
|
obj.SetNamedValue(xpathArray[p], privateDatavalue);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-22 17:15:46 +03:00
|
|
|
|
2020-12-22 12:27:28 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (val.ValueType() == JsonValueType::Object)
|
|
|
|
|
{
|
|
|
|
|
IJsonValue newVal;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
newVal = val.GetObjectW().GetNamedValue(xpathArray[p]);
|
|
|
|
|
}
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-12-22 17:15:46 +03:00
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
HideByXPath(newVal, xpathArray, p + 1);
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
void HideForFile(const path& dir, const wstring& relativePath)
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
|
|
|
|
path jsonPath = dir;
|
|
|
|
|
jsonPath.append(relativePath);
|
|
|
|
|
auto jObject = json::from_file(jsonPath.wstring());
|
|
|
|
|
if (!jObject.has_value())
|
|
|
|
|
{
|
2020-12-24 12:27:49 +01:00
|
|
|
wprintf(L"Failed to parse file %s\n", jsonPath.c_str());
|
2020-12-22 17:15:46 +03:00
|
|
|
return;
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JsonValue jValue = json::value(jObject.value());
|
|
|
|
|
for (auto xpath : escapeInfo[relativePath])
|
|
|
|
|
{
|
2021-05-20 18:41:12 +03:00
|
|
|
vector<wstring> xpathArray = GetXpathArray(xpath);
|
|
|
|
|
HideByXPath(jValue, xpathArray, 0);
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
json::to_file(jsonPath.wstring(), jObject.value());
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
bool DeleteFolder(wstring path)
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
|
|
|
|
error_code err;
|
|
|
|
|
remove_all(path, err);
|
|
|
|
|
if (err.value() != 0)
|
|
|
|
|
{
|
2020-12-24 12:27:49 +01:00
|
|
|
wprintf_s(L"Failed to delete %s. Error code: %d\n", path.c_str(), err.value());
|
2020-12-22 12:27:28 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
void HideUserPrivateInfo(const filesystem::path& dir)
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
|
|
|
|
// Replace data in json files
|
|
|
|
|
for (auto& it : escapeInfo)
|
|
|
|
|
{
|
2021-05-20 18:41:12 +03:00
|
|
|
HideForFile(dir, it.first);
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
|
2021-05-21 13:32:34 +03:00
|
|
|
// Delete files
|
2020-12-22 12:27:28 +02:00
|
|
|
for (auto it : filesToDelete)
|
|
|
|
|
{
|
|
|
|
|
auto path = dir;
|
|
|
|
|
path = path.append(it);
|
2021-05-20 18:41:12 +03:00
|
|
|
DeleteFolder(path);
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
void ReportWindowsVersion(const filesystem::path& tmpDir)
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
|
|
|
|
auto versionReportPath = tmpDir;
|
|
|
|
|
versionReportPath = versionReportPath.append("windows-version.txt");
|
2022-11-22 20:02:40 +00:00
|
|
|
OSVERSIONINFOEXW osInfo{};
|
2020-12-22 12:27:28 +02:00
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-12-22 17:15:46 +03:00
|
|
|
NTSTATUS(WINAPI * RtlGetVersion)
|
|
|
|
|
(LPOSVERSIONINFOEXW) = nullptr;
|
2023-02-08 14:01:40 +00:00
|
|
|
*reinterpret_cast<FARPROC*>(& RtlGetVersion) = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
|
2020-12-22 17:15:46 +03:00
|
|
|
if (RtlGetVersion)
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
|
|
|
|
osInfo.dwOSVersionInfoSize = sizeof(osInfo);
|
|
|
|
|
RtlGetVersion(&osInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
2020-12-24 12:27:49 +01:00
|
|
|
printf("Failed to get windows version info\n");
|
2020-12-22 12:27:28 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
wofstream versionReport(versionReportPath);
|
|
|
|
|
versionReport << "MajorVersion: " << osInfo.dwMajorVersion << endl;
|
|
|
|
|
versionReport << "MinorVersion: " << osInfo.dwMinorVersion << endl;
|
|
|
|
|
versionReport << "BuildNumber: " << osInfo.dwBuildNumber << endl;
|
|
|
|
|
}
|
2022-03-16 14:39:00 +03:00
|
|
|
catch (...)
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
2020-12-24 12:27:49 +01:00
|
|
|
printf("Failed to write to %s\n", versionReportPath.string().c_str());
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
void ReportWindowsSettings(const filesystem::path& tmpDir)
|
2021-05-06 16:17:57 +03:00
|
|
|
{
|
|
|
|
|
std::wstring userLanguage;
|
|
|
|
|
std::wstring userLocale;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
const auto lang = winrt::Windows::System::UserProfile::GlobalizationPreferences::Languages().GetAt(0);
|
2022-03-16 14:39:00 +03:00
|
|
|
userLanguage = winrt::Windows::Globalization::Language{ lang }.DisplayName().c_str();
|
2021-05-06 16:17:57 +03:00
|
|
|
wchar_t localeName[LOCALE_NAME_MAX_LENGTH]{};
|
|
|
|
|
if (!LCIDToLocaleName(GetThreadLocale(), localeName, LOCALE_NAME_MAX_LENGTH, 0))
|
|
|
|
|
{
|
|
|
|
|
throw -1;
|
|
|
|
|
}
|
|
|
|
|
userLocale = localeName;
|
|
|
|
|
}
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
printf("Failed to get windows settings\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
wofstream settingsReport(tmpDir / "windows-settings.txt");
|
|
|
|
|
settingsReport << "Preferred user language: " << userLanguage << endl;
|
|
|
|
|
settingsReport << "User locale: " << userLocale << endl;
|
|
|
|
|
}
|
2022-03-16 14:39:00 +03:00
|
|
|
catch (...)
|
2021-05-06 16:17:57 +03:00
|
|
|
{
|
|
|
|
|
printf("Failed to write windows settings\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
void ReportDotNetInstallationInfo(const filesystem::path& tmpDir)
|
2021-01-12 20:48:55 +02:00
|
|
|
{
|
|
|
|
|
auto dotnetInfoPath = tmpDir;
|
|
|
|
|
dotnetInfoPath.append("dotnet-installation-info.txt");
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
wofstream dotnetReport(dotnetInfoPath);
|
|
|
|
|
auto dotnetInfo = exec_and_read_output(LR"(dotnet --list-runtimes)");
|
|
|
|
|
if (!dotnetInfo.has_value())
|
|
|
|
|
{
|
|
|
|
|
printf("Failed to get dotnet installation information\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dotnetReport << dotnetInfo.value().c_str();
|
|
|
|
|
}
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
printf("Failed to report dotnet installation information");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-29 13:06:12 +03:00
|
|
|
void ReportVCMLogs(const filesystem::path& tmpDir, const filesystem::path& reportDir)
|
|
|
|
|
{
|
|
|
|
|
error_code ec;
|
|
|
|
|
copy(tmpDir / "PowerToysVideoConference_x86.log", reportDir, ec);
|
|
|
|
|
copy(tmpDir / "PowerToysVideoConference_x64.log", reportDir, ec);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-16 14:39:00 +03:00
|
|
|
void ReportInstallerLogs(const filesystem::path& tmpDir, const filesystem::path& reportDir)
|
|
|
|
|
{
|
2023-02-22 10:06:59 +01:00
|
|
|
const char* bootstrapperLogFilePrefix = "powertoys-bootstrapper-msi-";
|
|
|
|
|
const char* PTLogFilePrefix = "PowerToysMSIInstaller_";
|
2022-03-16 14:39:00 +03:00
|
|
|
|
|
|
|
|
for (auto& entry : directory_iterator{ tmpDir })
|
|
|
|
|
{
|
|
|
|
|
std::error_code ec;
|
|
|
|
|
if (entry.is_directory(ec) || !entry.path().has_filename())
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto fileName = entry.path().filename().string();
|
2023-02-22 10:06:59 +01:00
|
|
|
if (!fileName.starts_with(bootstrapperLogFilePrefix) && !fileName.starts_with(PTLogFilePrefix))
|
2022-03-16 14:39:00 +03:00
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
copy(entry.path(), reportDir / fileName, ec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-22 12:27:28 +02:00
|
|
|
int wmain(int argc, wchar_t* argv[], wchar_t*)
|
|
|
|
|
{
|
|
|
|
|
// Get path to save zip
|
|
|
|
|
wstring saveZipPath;
|
|
|
|
|
if (argc > 1)
|
|
|
|
|
{
|
|
|
|
|
saveZipPath = argv[1];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wchar_t buffer[MAX_PATH];
|
|
|
|
|
if (SHGetSpecialFolderPath(HWND_DESKTOP, buffer, CSIDL_DESKTOP, FALSE))
|
|
|
|
|
{
|
|
|
|
|
saveZipPath = buffer;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-12-24 12:27:49 +01:00
|
|
|
printf("Failed to retrieve the desktop path. Error code: %d\n", GetLastError());
|
|
|
|
|
return 1;
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-24 12:27:49 +01:00
|
|
|
auto settingsRootPath = PTSettingsHelper::get_root_save_folder_location();
|
2022-08-16 19:32:49 +02:00
|
|
|
settingsRootPath += L"\\";
|
|
|
|
|
|
|
|
|
|
auto localLowPath = PTSettingsHelper::get_local_low_folder_location();
|
|
|
|
|
localLowPath += L"\\logs\\";
|
2020-12-22 17:15:46 +03:00
|
|
|
|
2021-06-29 13:06:12 +03:00
|
|
|
const auto tempDir = temp_directory_path();
|
|
|
|
|
auto reportDir = temp_directory_path() / "PowerToys\\";
|
|
|
|
|
if (!DeleteFolder(reportDir))
|
2020-12-22 12:27:28 +02:00
|
|
|
{
|
2020-12-24 12:27:49 +01:00
|
|
|
printf("Failed to delete temp folder\n");
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2021-06-29 13:06:12 +03:00
|
|
|
copy(settingsRootPath, reportDir, copy_options::recursive);
|
2022-03-16 14:39:00 +03:00
|
|
|
|
2020-12-22 17:15:46 +03:00
|
|
|
// Remove updates folder contents
|
2021-06-29 13:06:12 +03:00
|
|
|
DeleteFolder(reportDir / "Updates");
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
2022-08-16 19:32:49 +02:00
|
|
|
|
2020-12-22 12:27:28 +02:00
|
|
|
catch (...)
|
|
|
|
|
{
|
2020-12-24 12:27:49 +01:00
|
|
|
printf("Failed to copy PowerToys folder\n");
|
2020-12-22 12:27:28 +02:00
|
|
|
return 1;
|
|
|
|
|
}
|
2020-12-22 17:15:46 +03:00
|
|
|
|
2022-08-16 19:32:49 +02:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
copy(localLowPath, reportDir, copy_options::recursive);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
printf("Failed to copy logs saved in LocalLow\n");
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-01 18:12:28 +03:00
|
|
|
#ifndef _DEBUG
|
2021-07-20 10:33:00 +03:00
|
|
|
InstallationFolder::ReportStructure(reportDir);
|
2021-09-01 18:12:28 +03:00
|
|
|
#endif
|
2021-07-20 10:33:00 +03:00
|
|
|
|
2020-12-22 17:15:46 +03:00
|
|
|
// Hide sensitive information
|
2021-06-29 13:06:12 +03:00
|
|
|
HideUserPrivateInfo(reportDir);
|
2020-12-22 12:27:28 +02:00
|
|
|
|
2021-05-06 16:17:57 +03:00
|
|
|
// Write windows settings to the temporary folder
|
2021-06-29 13:06:12 +03:00
|
|
|
ReportWindowsSettings(reportDir);
|
2021-05-06 16:17:57 +03:00
|
|
|
|
2020-12-22 12:27:28 +02:00
|
|
|
// Write monitors info to the temporary folder
|
2021-06-29 13:06:12 +03:00
|
|
|
ReportMonitorInfo(reportDir);
|
2020-12-22 12:27:28 +02:00
|
|
|
|
|
|
|
|
// Write windows version info to the temporary folder
|
2021-06-29 13:06:12 +03:00
|
|
|
ReportWindowsVersion(reportDir);
|
2020-12-22 12:27:28 +02:00
|
|
|
|
2021-01-12 20:48:55 +02:00
|
|
|
// Write dotnet installation info to the temporary folder
|
2021-06-29 13:06:12 +03:00
|
|
|
ReportDotNetInstallationInfo(reportDir);
|
2021-01-12 20:48:55 +02:00
|
|
|
|
2021-01-21 17:01:28 +01:00
|
|
|
// Write registry to the temporary folder
|
2021-06-29 13:06:12 +03:00
|
|
|
ReportRegistry(reportDir);
|
2021-05-20 18:41:12 +03:00
|
|
|
|
2022-10-26 14:02:31 +01:00
|
|
|
// Write gpo policies to the temporary folder
|
|
|
|
|
ReportGPOValues(reportDir);
|
|
|
|
|
|
2021-05-20 18:41:12 +03:00
|
|
|
// Write compatibility tab info to the temporary folder
|
2021-06-29 13:06:12 +03:00
|
|
|
ReportCompatibilityTab(reportDir);
|
2021-01-21 17:01:28 +01:00
|
|
|
|
2021-05-26 16:23:49 +03:00
|
|
|
// Write event viewer logs info to the temporary folder
|
2021-06-29 13:06:12 +03:00
|
|
|
EventViewer::ReportEventViewerInfo(reportDir);
|
|
|
|
|
|
|
|
|
|
ReportVCMLogs(tempDir, reportDir);
|
2022-03-16 14:39:00 +03:00
|
|
|
|
|
|
|
|
ReportInstallerLogs(tempDir, reportDir);
|
2021-05-26 16:23:49 +03:00
|
|
|
|
2022-06-30 22:10:14 +02:00
|
|
|
ReportInstalledContextMenuPackages(reportDir);
|
|
|
|
|
|
2020-12-22 12:27:28 +02:00
|
|
|
// Zip folder
|
|
|
|
|
auto zipPath = path::path(saveZipPath);
|
2020-12-22 17:15:46 +03:00
|
|
|
|
2020-12-22 12:27:28 +02:00
|
|
|
try
|
|
|
|
|
{
|
2021-06-29 13:06:12 +03:00
|
|
|
ZipFolder(zipPath, reportDir);
|
2020-12-22 12:27:28 +02:00
|
|
|
}
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
2020-12-24 12:27:49 +01:00
|
|
|
printf("Failed to zip folder\n");
|
2020-12-22 12:27:28 +02:00
|
|
|
return 1;
|
|
|
|
|
}
|
2020-12-22 17:15:46 +03:00
|
|
|
|
2021-06-29 13:06:12 +03:00
|
|
|
DeleteFolder(reportDir);
|
2020-12-22 12:27:28 +02:00
|
|
|
return 0;
|
2021-01-21 17:01:28 +01:00
|
|
|
}
|