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:
Andrey Nekrasov 2020-12-22 17:15:46 +03:00 committed by GitHub
parent 0843efd282
commit dde63b5017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 108 additions and 282 deletions

View File

@ -22,7 +22,6 @@ acos
acrt acrt
Actioncenter Actioncenter
Actionkeyword Actionkeyword
actionrunner
activatable activatable
ACTIVATEAPP ACTIVATEAPP
activationaction activationaction
@ -33,7 +32,6 @@ ADifferent
adopsinsider adopsinsider
advapi advapi
advfirewall advfirewall
aeed
AFeature AFeature
AFX AFX
AGGREGATABLE AGGREGATABLE
@ -174,7 +172,6 @@ bmi
bmp bmp
bms bms
Bokm Bokm
Bokmal
BOKMAL BOKMAL
bootstrapper bootstrapper
BOTTOMALIGN BOTTOMALIGN
@ -190,7 +187,6 @@ BSODs
bstr bstr
BText BText
bti bti
btn
Btn Btn
BTNFACE BTNFACE
Bto Bto
@ -222,8 +218,8 @@ CDeclaration
cdpx cdpx
cdpxwin cdpxwin
CENTERALIGN CENTERALIGN
cfg
Cfg Cfg
cfg
changecursor changecursor
Changemove Changemove
charset charset
@ -302,7 +298,6 @@ commandline
commctrl commctrl
Commdlg Commdlg
commondataservicecds commondataservicecds
commonmdflag
Compat Compat
COMPOSITIONFULL COMPOSITIONFULL
comsupp comsupp
@ -317,7 +312,6 @@ constexpr
contentdialog contentdialog
contentfiles contentfiles
CONTEXTHELP CONTEXTHELP
contextmenu
CONTEXTMENU CONTEXTMENU
CONTEXTMENUHANDLER CONTEXTMENUHANDLER
CONTROLL CONTROLL
@ -656,14 +650,15 @@ ENU
enum enum
ENUMITEMS ENUMITEMS
EOAC EOAC
eol
EOL EOL
eol
epicgames epicgames
eport
ERASEBKGND ERASEBKGND
EREOF EREOF
EResize EResize
errorlevel
ERRORLEVEL ERRORLEVEL
errorlevel
ERRORMESSAGE ERRORMESSAGE
ERRORTITLE ERRORTITLE
esize esize
@ -715,7 +710,6 @@ FANCYZONESEDITOR
Farbraum Farbraum
FARPROC FARPROC
Favicon Favicon
fbdc
fcharset fcharset
fd fd
fda fda
@ -1081,8 +1075,8 @@ ISavable
isbi isbi
ISearch ISearch
IService IService
isetting
ISetting ISetting
isetting
isfinite isfinite
IShell IShell
ISingle ISingle
@ -1158,8 +1152,8 @@ keyremaps
keystokes keystokes
Keystool Keystool
Keytool Keytool
keyup
KEYUP KEYUP
keyup
Kf Kf
KILLFOCUS KILLFOCUS
Knownfolders Knownfolders
@ -1285,7 +1279,6 @@ Mainwindow
makeappx makeappx
MAKEINTRESOURCE MAKEINTRESOURCE
MAKEINTRESOURCEW MAKEINTRESOURCEW
MAKELANGID
MAKELPARAM MAKELPARAM
makepri makepri
malloc malloc
@ -1393,7 +1386,6 @@ msrc
mst mst
msvc msvc
msvcp msvcp
msvs
MTND MTND
Mul Mul
multiline multiline
@ -1405,8 +1397,8 @@ multizone
mutex mutex
mutexes mutexes
muxc muxc
mvvm
Mvvm Mvvm
mvvm
MYICON MYICON
myuri myuri
NAMECHANGE NAMECHANGE
@ -1495,7 +1487,6 @@ NOSIZE
notafter notafter
notfound notfound
nothrow nothrow
notificationsdll
NOTIFICATIONSDLL NOTIFICATIONSDLL
NOTIFYICONDATAW NOTIFYICONDATAW
NOTIMPL NOTIMPL
@ -1705,8 +1696,8 @@ propkey
propvarutil propvarutil
Prt Prt
prui prui
prvpane
PRVPANE PRVPANE
prvpane
psapi psapi
PSECURITY PSECURITY
psfgao psfgao
@ -1904,8 +1895,8 @@ serializer
serizalization serizalization
serverside serverside
SETCONTEXT SETCONTEXT
setcursor
SETCURSOR SETCURSOR
setcursor
SETFOCUS SETFOCUS
SETFOREGROUND SETFOREGROUND
SETICON SETICON
@ -1936,8 +1927,8 @@ SHELLDLL
shellex shellex
SHELLEXECUTEINFO SHELLEXECUTEINFO
SHELLEXECUTEINFOW SHELLEXECUTEINFOW
shellscalingapi
Shellscalingapi Shellscalingapi
shellscalingapi
Shelveset Shelveset
SHFILEINFO SHFILEINFO
SHGFI SHGFI
@ -1999,7 +1990,6 @@ sln
SLogo SLogo
SMALLICON SMALLICON
SMTO SMTO
SNAPED
snd snd
somil somil
SORTDOWN SORTDOWN
@ -2056,8 +2046,8 @@ stdin
stdlib stdlib
STDMETHODCALLTYPE STDMETHODCALLTYPE
STDMETHODIMP STDMETHODIMP
stdout
Stdout Stdout
stdout
STEPIT STEPIT
stgm stgm
STGMEDIUM STGMEDIUM
@ -2076,8 +2066,8 @@ stringtable
stringval stringval
strsafe strsafe
strutil strutil
sttngs
STTNGS STTNGS
sttngs
Stubless Stubless
STYLECHANGED STYLECHANGED
STYLECHANGING STYLECHANGING
@ -2115,8 +2105,8 @@ SYSDEADCHAR
SYSICONINDEX SYSICONINDEX
SYSKEY SYSKEY
syskeydown syskeydown
syskeyup
SYSKEYUP SYSKEYUP
syskeyup
syslog syslog
SYSMENU SYSMENU
systemd systemd
@ -2264,7 +2254,6 @@ uninstalling
uninstantiated uninstantiated
Uniq Uniq
uniquifier uniquifier
uniquifies
Uniquifies Uniquifies
unittests unittests
unk unk
@ -2365,7 +2354,6 @@ Wca
wcautil wcautil
WCE WCE
wcex wcex
WCF
wchar wchar
WClass WClass
wcout wcout
@ -2376,8 +2364,8 @@ wcslen
wcsncmp wcsncmp
wcsnicmp wcsnicmp
wdp wdp
wds
WDS WDS
wds
wdupenv wdupenv
weakme weakme
webapp webapp
@ -2394,14 +2382,13 @@ Whichdoes
whitespaces whitespaces
WIC WIC
Wifi Wifi
wifstream
wih wih
wiki wiki
wikipedia wikipedia
wil wil
wildcards wildcards
winapi
WINAPI WINAPI
winapi
winauto winauto
wincolor wincolor
windef windef
@ -2514,7 +2501,7 @@ xml
xmlns xmlns
XNamespace XNamespace
XOffset XOffset
XPath xpath
XResource XResource
xsd xsd
xsi xsi
@ -2523,8 +2510,8 @@ XStr
XToolset XToolset
xunit xunit
XY XY
yaml
YAML YAML
yaml
YAngle YAngle
YDiff YDiff
YESNO YESNO

View 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

View File

@ -42,8 +42,8 @@ steps:
command: restore command: restore
feedsToUse: config feedsToUse: config
configPath: NuGet.config configPath: NuGet.config
restoreSolution: src\bug-report\BugReportTool\BugReportTool.sln restoreSolution: tools\BugReportTool\BugReportTool.sln
restoreDirectory: '$(Build.SourcesDirectory)\src\bug-report\BugReportTool\packages' restoreDirectory: '$(Build.SourcesDirectory)\tools\BugReportTool\packages'
- task: VSBuild@1 - task: VSBuild@1
displayName: 'Build BugReportTool.sln' displayName: 'Build BugReportTool.sln'

View File

@ -63,6 +63,7 @@ build:
to: 'Build_Output' to: 'Build_Output'
include: include:
- 'action_runner.exe' - 'action_runner.exe'
- 'BugReportTool\BugReportTool.exe'
- 'modules\ColorPicker\ColorPicker.dll' - 'modules\ColorPicker\ColorPicker.dll'
- 'modules\ColorPicker\ColorPickerUI.dll' - 'modules\ColorPicker\ColorPickerUI.dll'
- 'modules\ColorPicker\ColorPickerUI.exe' - 'modules\ColorPicker\ColorPickerUI.exe'
@ -146,6 +147,16 @@ build:
- 'SettingsUIRunner\ManagedCommon.dll' - 'SettingsUIRunner\ManagedCommon.dll'
signing_options: signing_options:
sign_inline: true # This does signing a soon as this command completes 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 - !!buildcommand
name: 'Build Power Toys Installer' name: 'Build Power Toys Installer'
command: '.pipelines\build-installer.cmd' command: '.pipelines\build-installer.cmd'

View File

@ -12,7 +12,6 @@
<?define RepoDir="$(var.ProjectDir)..\..\" ?> <?define RepoDir="$(var.ProjectDir)..\..\" ?>
<?define BinX64Dir="$(var.RepoDir)x64\$(var.Configuration)\" ?> <?define BinX64Dir="$(var.RepoDir)x64\$(var.Configuration)\" ?>
<?define BugReportToolDir="$(var.RepoDir)src\bug-report\BugReportTool\x64\$(var.Configuration)\" ?>
<Product Id="*" <Product Id="*"
Name="PowerToys (Preview)" Name="PowerToys (Preview)"
@ -48,7 +47,7 @@
<ComponentGroupRef Id="CoreComponents" /> <ComponentGroupRef Id="CoreComponents" />
<ComponentGroupRef Id="ResourcesComponents" /> <ComponentGroupRef Id="ResourcesComponents" />
<ComponentGroupRef Id="LauncherComponents" /> <ComponentGroupRef Id="LauncherComponents" />
<ComponentRef Id="BugReportTool"/> <ComponentGroupRef Id="ToolComponents" />
</Feature> </Feature>
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLFOLDER]" After="CostFinalize" /> <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLFOLDER]" After="CostFinalize" />
@ -208,7 +207,7 @@
<Directory Id="ProgramFiles64Folder"> <Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="PowerToys"> <Directory Id="INSTALLFOLDER" Name="PowerToys">
<Directory Id="SvgsInstallFolder" Name="svgs"/> <Directory Id="SvgsInstallFolder" Name="svgs"/>
<Directory Id="BugReportToolFolder" Name="BugReportTool"/> <Directory Id="ToolsFolder" Name="Tools"/>
<Directory Id="ModulesInstallFolder" Name="modules"> <Directory Id="ModulesInstallFolder" Name="modules">
<Directory Id="ImageResizerInstallFolder" Name="$(var.ImageResizerProjectName)" /> <Directory Id="ImageResizerInstallFolder" Name="$(var.ImageResizerProjectName)" />
<Directory Id="PowerRenameInstallFolder" Name="$(var.PowerRenameProjectName)"/> <Directory Id="PowerRenameInstallFolder" Name="$(var.PowerRenameProjectName)"/>
@ -315,6 +314,7 @@
</Component> </Component>
<Component Id="settings_exe" Guid="A5A461A9-7097-4CBA-9D39-3DBBB6B7B80C" Win64="yes"> <Component Id="settings_exe" Guid="A5A461A9-7097-4CBA-9D39-3DBBB6B7B80C" Win64="yes">
<File Id="PowerToysSettings.exe" KeyPath="yes" Checksum="yes" /> <File Id="PowerToysSettings.exe" KeyPath="yes" Checksum="yes" />
</Component> </Component>
@ -340,11 +340,6 @@
<?endforeach?> <?endforeach?>
</Component> </Component>
</DirectoryRef> </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\"> <DirectoryRef Id="SvgsInstallFolder" FileSource="$(var.BinX64Dir)svgs\">
<Component Id="PowerToysSvgs" Guid="7C4D4EED-9338-423D-992C-DCE02F3E2D35" Win64="yes"> <Component Id="PowerToysSvgs" Guid="7C4D4EED-9338-423D-992C-DCE02F3E2D35" Win64="yes">
<File Source="$(var.BinX64Dir)svgs\0.svg" /> <File Source="$(var.BinX64Dir)svgs\0.svg" />
@ -378,6 +373,12 @@
</Component> </Component>
</DirectoryRef> </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\"> <DirectoryRef Id="ModulesInstallFolder" FileSource="$(var.BinX64Dir)modules\">
<Component Id="Module_PowerPreview_PerUserRegistry" Guid="CD90ADC0-7CD5-4A62-B0AF-23545C1E6DD3" Win64="yes"> <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_dark_html" />
<ComponentRef Id="settings_js_bundle" /> <ComponentRef Id="settings_js_bundle" />
</ComponentGroup> </ComponentGroup>
<ComponentGroup Id="ToolComponents" Directory="ToolsFolder">
<ComponentRef Id="BugReportTool_exe" />
</ComponentGroup>
</Fragment> </Fragment>
<!-- Languages for localization on build farm --> <!-- Languages for localization on build farm -->

View File

@ -9,6 +9,15 @@
namespace timeutil 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) inline std::wstring to_string(const time_t time)
{ {
return std::to_wstring(static_cast<uint64_t>(time)); return std::to_wstring(static_cast<uint64_t>(time));

View File

@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.30611.23
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BugReportTool", "BugReportTool\BugReportTool.vcxproj", "{99126840-5C30-4E9E-AC6C-E73DDED5C3BD}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BugReportTool", "BugReportTool\BugReportTool.vcxproj", "{99126840-5C30-4E9E-AC6C-E73DDED5C3BD}"
EndProject 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -11,6 +11,8 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup> <PropertyGroup>
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<IntDir>$(SolutionDir)..\..\$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
<OutDir>$(SolutionDir)..\..\$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
@ -24,14 +26,17 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>../../../src/</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\..\..\deps\cziplib\src\zip.c" /> <ClCompile Include="..\..\..\deps\cziplib\src\zip.c">
<ClCompile Include="..\..\..\..\tools\monitor_info_report\report-monitor-info.cpp" /> <WarningLevel>TurnOffAllWarnings</WarningLevel>
</ClCompile>
<ClCompile Include="ReportMonitorInfo.cpp" />
<ClCompile Include="Main.cpp" /> <ClCompile Include="Main.cpp" />
<ClCompile Include="ZipTools\zipfolder.cpp" /> <ClCompile Include="ZipTools\zipfolder.cpp" />
</ItemGroup> </ItemGroup>
@ -39,14 +44,14 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\common\SettingsAPI\SetttingsAPI.vcxproj"> <ProjectReference Include="..\..\..\src\common\SettingsAPI\SetttingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project> <Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\..\..\deps\cziplib\src\miniz.h" /> <ClInclude Include="..\..\..\deps\cziplib\src\miniz.h" />
<ClInclude Include="..\..\..\..\deps\cziplib\src\zip.h" /> <ClInclude Include="..\..\..\deps\cziplib\src\zip.h" />
<ClInclude Include="..\..\..\..\tools\monitor_info_report\report-monitor-info.h" /> <ClInclude Include="ReportMonitorInfo.h" />
<ClInclude Include="..\..\..\common\utils\json.h" /> <ClInclude Include="..\..\..\common\utils\json.h" />
<ClInclude Include="ZipTools\zipfolder.h" /> <ClInclude Include="ZipTools\zipfolder.h" />
</ItemGroup> </ItemGroup>

View File

@ -5,15 +5,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Main.cpp" /> <ClCompile Include="Main.cpp" />
<ClCompile Include="..\..\..\..\deps\cziplib\src\zip.c">
<Filter>ZipTools</Filter>
</ClCompile>
<ClCompile Include="ZipTools\zipfolder.cpp"> <ClCompile Include="ZipTools\zipfolder.cpp">
<Filter>ZipTools</Filter> <Filter>ZipTools</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\..\tools\monitor_info_report\report-monitor-info.cpp"> <ClCompile Include="..\..\..\deps\cziplib\src\zip.c" />
<Filter>MonitorReportTool</Filter> <ClCompile Include="ReportMonitorInfo.cpp" />
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="ZipTools"> <Filter Include="ZipTools">
@ -24,18 +20,12 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<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"> <ClInclude Include="ZipTools\zipfolder.h">
<Filter>ZipTools</Filter> <Filter>ZipTools</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\..\common\utils\json.h" /> <ClInclude Include="..\..\..\common\utils\json.h" />
<ClInclude Include="..\..\..\..\tools\monitor_info_report\report-monitor-info.h"> <ClInclude Include="..\..\..\deps\cziplib\src\miniz.h" />
<Filter>MonitorReportTool</Filter> <ClInclude Include="..\..\..\deps\cziplib\src\zip.h" />
</ClInclude> <ClInclude Include="ReportMonitorInfo.h" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -7,9 +7,11 @@
#include <winrt/Windows.Foundation.Collections.h> #include <winrt/Windows.Foundation.Collections.h>
#include "ZipTools/ZipFolder.h" #include "ZipTools/ZipFolder.h"
#include "../../../common/SettingsAPI/settings_helpers.h" #include <common/SettingsAPI/settings_helpers.h>
#include "../../../common/utils/json.h" #include <common/utils/json.h>
#include "../../../../tools/monitor_info_report/report-monitor-info.h" #include <common/utils/timeutil.h>
#include "ReportMonitorInfo.h"
using namespace std; using namespace std;
using namespace std::filesystem; using namespace std::filesystem;
@ -145,21 +147,6 @@ 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) void reportMonitorInfo(const filesystem::path& tmpDir)
{ {
auto monitorReportPath = tmpDir; auto monitorReportPath = tmpDir;
@ -189,9 +176,10 @@ void reportWindowsVersion(const filesystem::path& tmpDir)
try try
{ {
NTSTATUS(WINAPI * RtlGetVersion)(LPOSVERSIONINFOEXW); NTSTATUS(WINAPI * RtlGetVersion)
(LPOSVERSIONINFOEXW) = nullptr;
*(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion"); *(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
if (NULL != RtlGetVersion) if (RtlGetVersion)
{ {
osInfo.dwOSVersionInfoSize = sizeof(osInfo); osInfo.dwOSVersionInfoSize = sizeof(osInfo);
RtlGetVersion(&osInfo); RtlGetVersion(&osInfo);
@ -251,6 +239,8 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
try try
{ {
copy(powerToys, tmpDir, copy_options::recursive); copy(powerToys, tmpDir, copy_options::recursive);
// Remove updates folder contents
del(tmpDir / "Updates");
} }
catch (...) catch (...)
{ {
@ -258,7 +248,7 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
return 1; return 1;
} }
// Hide sensative information // Hide sensitive information
hideUserPrivateInfo(tmpDir); hideUserPrivateInfo(tmpDir);
// Write monitors info to the temporary folder // Write monitors info to the temporary folder
@ -269,7 +259,11 @@ int wmain(int argc, wchar_t* argv[], wchar_t*)
// Zip folder // Zip folder
auto zipPath = path::path(saveZipPath); 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 try
{ {
zipFolder(zipPath, tmpDir); zipFolder(zipPath, tmpDir);

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "report-monitor-info.h" #include "ReportMonitorInfo.h"
#include <Windows.h> #include <Windows.h>
#include "../../src/common/utils/winapi_error.h" #include "../../../src/common/utils/winapi_error.h"
int report(std::wostream& os) int report(std::wostream& os)
{ {

View File

@ -1,5 +1,5 @@
#include "zipfolder.h" #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) 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; 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)) for (const auto& dirEntry : recursive_directory_iterator(folderPath))
{ {
if (dirEntry.is_regular_file()) if (dirEntry.is_regular_file())

View 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>

View File

@ -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;
}

View File

@ -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

View File

@ -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