mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 22:43:31 +08:00
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
This commit is contained in:
parent
0843efd282
commit
dde63b5017
47
.github/actions/spell-check/expect.txt
vendored
47
.github/actions/spell-check/expect.txt
vendored
@ -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
|
||||
|
10
.pipelines/build-tools.cmd
Normal file
10
.pipelines/build-tools.cmd
Normal file
@ -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
|
||||
|
@ -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'
|
||||
|
@ -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'
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
<?define RepoDir="$(var.ProjectDir)..\..\" ?>
|
||||
<?define BinX64Dir="$(var.RepoDir)x64\$(var.Configuration)\" ?>
|
||||
<?define BugReportToolDir="$(var.RepoDir)src\bug-report\BugReportTool\x64\$(var.Configuration)\" ?>
|
||||
|
||||
<Product Id="*"
|
||||
Name="PowerToys (Preview)"
|
||||
@ -48,7 +47,7 @@
|
||||
<ComponentGroupRef Id="CoreComponents" />
|
||||
<ComponentGroupRef Id="ResourcesComponents" />
|
||||
<ComponentGroupRef Id="LauncherComponents" />
|
||||
<ComponentRef Id="BugReportTool"/>
|
||||
<ComponentGroupRef Id="ToolComponents" />
|
||||
</Feature>
|
||||
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLFOLDER]" After="CostFinalize" />
|
||||
|
||||
@ -208,7 +207,7 @@
|
||||
<Directory Id="ProgramFiles64Folder">
|
||||
<Directory Id="INSTALLFOLDER" Name="PowerToys">
|
||||
<Directory Id="SvgsInstallFolder" Name="svgs"/>
|
||||
<Directory Id="BugReportToolFolder" Name="BugReportTool"/>
|
||||
<Directory Id="ToolsFolder" Name="Tools"/>
|
||||
<Directory Id="ModulesInstallFolder" Name="modules">
|
||||
<Directory Id="ImageResizerInstallFolder" Name="$(var.ImageResizerProjectName)" />
|
||||
<Directory Id="PowerRenameInstallFolder" Name="$(var.PowerRenameProjectName)"/>
|
||||
@ -315,6 +314,7 @@
|
||||
|
||||
</Component>
|
||||
|
||||
|
||||
<Component Id="settings_exe" Guid="A5A461A9-7097-4CBA-9D39-3DBBB6B7B80C" Win64="yes">
|
||||
<File Id="PowerToysSettings.exe" KeyPath="yes" Checksum="yes" />
|
||||
</Component>
|
||||
@ -340,11 +340,6 @@
|
||||
<?endforeach?>
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
<DirectoryRef Id="BugReportToolFolder" FileSource="$(var.BugReportToolDir)">
|
||||
<Component Id="BugReportTool" Guid="0F8E3E9F-2E86-4660-A3BF-AE4DD431B93C" Win64="yes">
|
||||
<File Source="$(var.BugReportToolDir)BugReportTool.exe" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
<DirectoryRef Id="SvgsInstallFolder" FileSource="$(var.BinX64Dir)svgs\">
|
||||
<Component Id="PowerToysSvgs" Guid="7C4D4EED-9338-423D-992C-DCE02F3E2D35" Win64="yes">
|
||||
<File Source="$(var.BinX64Dir)svgs\0.svg" />
|
||||
@ -378,6 +373,12 @@
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<DirectoryRef Id="ToolsFolder">
|
||||
<Component Id="BugReportTool_exe" Guid="0F8E3E9F-2E86-4660-A3BF-AE4DD431B93C" Win64="yes">
|
||||
<File Source="$(var.BinX64Dir)BugReportTool\BugReportTool.exe" Id="BugReportTool.exe" KeyPath="yes" Checksum="yes" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<DirectoryRef Id="ModulesInstallFolder" FileSource="$(var.BinX64Dir)modules\">
|
||||
|
||||
<Component Id="Module_PowerPreview_PerUserRegistry" Guid="CD90ADC0-7CD5-4A62-B0AF-23545C1E6DD3" Win64="yes">
|
||||
@ -775,6 +776,9 @@
|
||||
<ComponentRef Id="settings_dark_html" />
|
||||
<ComponentRef Id="settings_js_bundle" />
|
||||
</ComponentGroup>
|
||||
<ComponentGroup Id="ToolComponents" Directory="ToolsFolder">
|
||||
<ComponentRef Id="BugReportTool_exe" />
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
|
||||
<!-- Languages for localization on build farm -->
|
||||
|
@ -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<uint64_t>(time));
|
||||
|
@ -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
|
@ -11,6 +11,8 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<IntDir>$(SolutionDir)..\..\$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
||||
<OutDir>$(SolutionDir)..\..\$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
@ -24,14 +26,17 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>../../../src/</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\deps\cziplib\src\zip.c" />
|
||||
<ClCompile Include="..\..\..\..\tools\monitor_info_report\report-monitor-info.cpp" />
|
||||
<ClCompile Include="..\..\..\deps\cziplib\src\zip.c">
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ReportMonitorInfo.cpp" />
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="ZipTools\zipfolder.cpp" />
|
||||
</ItemGroup>
|
||||
@ -39,14 +44,14 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SetttingsAPI.vcxproj">
|
||||
<ProjectReference Include="..\..\..\src\common\SettingsAPI\SetttingsAPI.vcxproj">
|
||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\deps\cziplib\src\miniz.h" />
|
||||
<ClInclude Include="..\..\..\..\deps\cziplib\src\zip.h" />
|
||||
<ClInclude Include="..\..\..\..\tools\monitor_info_report\report-monitor-info.h" />
|
||||
<ClInclude Include="..\..\..\deps\cziplib\src\miniz.h" />
|
||||
<ClInclude Include="..\..\..\deps\cziplib\src\zip.h" />
|
||||
<ClInclude Include="ReportMonitorInfo.h" />
|
||||
<ClInclude Include="..\..\..\common\utils\json.h" />
|
||||
<ClInclude Include="ZipTools\zipfolder.h" />
|
||||
</ItemGroup>
|
@ -5,15 +5,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="..\..\..\..\deps\cziplib\src\zip.c">
|
||||
<Filter>ZipTools</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ZipTools\zipfolder.cpp">
|
||||
<Filter>ZipTools</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\tools\monitor_info_report\report-monitor-info.cpp">
|
||||
<Filter>MonitorReportTool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\deps\cziplib\src\zip.c" />
|
||||
<ClCompile Include="ReportMonitorInfo.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="ZipTools">
|
||||
@ -24,18 +20,12 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\deps\cziplib\src\miniz.h">
|
||||
<Filter>ZipTools</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\deps\cziplib\src\zip.h">
|
||||
<Filter>ZipTools</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZipTools\zipfolder.h">
|
||||
<Filter>ZipTools</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\common\utils\json.h" />
|
||||
<ClInclude Include="..\..\..\..\tools\monitor_info_report\report-monitor-info.h">
|
||||
<Filter>MonitorReportTool</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\deps\cziplib\src\miniz.h" />
|
||||
<ClInclude Include="..\..\..\deps\cziplib\src\zip.h" />
|
||||
<ClInclude Include="ReportMonitorInfo.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -7,9 +7,11 @@
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
|
||||
#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 <common/SettingsAPI/settings_helpers.h>
|
||||
#include <common/utils/json.h>
|
||||
#include <common/utils/timeutil.h>
|
||||
|
||||
#include "ReportMonitorInfo.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::filesystem;
|
||||
@ -57,7 +59,7 @@ void hideByXPath(IJsonValue& val, vector<wstring>& 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<wstring>& xpathArray, int p)
|
||||
obj.SetNamedValue(xpathArray[p], privateDatavalue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,8 +91,8 @@ void hideByXPath(IJsonValue& val, vector<wstring>& 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;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "report-monitor-info.h"
|
||||
#include "ReportMonitorInfo.h"
|
||||
#include <Windows.h>
|
||||
#include "../../src/common/utils/winapi_error.h"
|
||||
#include "../../../src/common/utils/winapi_error.h"
|
||||
|
||||
int report(std::wostream& os)
|
||||
{
|
@ -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())
|
@ -1,118 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="monitor-report-info.cpp" />
|
||||
<ClCompile Include="report-monitor-info.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\common\utils\winapi_error.h" />
|
||||
<ClInclude Include="report-monitor-info.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{6A7F9A7C-56B6-9B0D-FFA2-8110EBB8170F}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>main</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>bin\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>monitor_info_reportd</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>bin\</OutDir>
|
||||
<IntDir>obj\Release\</IntDir>
|
||||
<TargetName>monitor_info_report</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DisableSpecificWarnings>4127;4275;5054;4201;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalOptions>/permissive- /await /Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<FullProgramDatabaseFile>true</FullProgramDatabaseFile>
|
||||
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DisableSpecificWarnings>4127;4275;5054;4201;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<AdditionalOptions>/permissive- /await /Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Lib>
|
||||
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,40 +0,0 @@
|
||||
#include "report-monitor-info.h"
|
||||
#include <Windows.h>
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#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;
|
||||
}
|
@ -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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user