mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Data diagnostics opt-in
This commit is contained in:
33
.github/actions/spell-check/expect.txt
vendored
33
.github/actions/spell-check/expect.txt
vendored
@@ -46,6 +46,7 @@ AMPROPSETID
|
|||||||
amr
|
amr
|
||||||
ANDSCANS
|
ANDSCANS
|
||||||
animatedvisuals
|
animatedvisuals
|
||||||
|
anr
|
||||||
ansicolor
|
ansicolor
|
||||||
ANull
|
ANull
|
||||||
AOC
|
AOC
|
||||||
@@ -60,14 +61,12 @@ APPBARDATA
|
|||||||
appdata
|
appdata
|
||||||
APPEXECLINK
|
APPEXECLINK
|
||||||
Appium
|
Appium
|
||||||
applayout
|
|
||||||
Applicationcan
|
Applicationcan
|
||||||
APPLICATIONFRAMEHOST
|
APPLICATIONFRAMEHOST
|
||||||
appmanifest
|
appmanifest
|
||||||
APPNAME
|
APPNAME
|
||||||
appref
|
appref
|
||||||
appsettings
|
appsettings
|
||||||
appsfolder
|
|
||||||
appwindow
|
appwindow
|
||||||
appwiz
|
appwiz
|
||||||
APSTUDIO
|
APSTUDIO
|
||||||
@@ -148,7 +147,6 @@ BTNFACE
|
|||||||
bugreport
|
bugreport
|
||||||
BUILDARCH
|
BUILDARCH
|
||||||
BUILDNUMBER
|
BUILDNUMBER
|
||||||
buildtask
|
|
||||||
buildtransitive
|
buildtransitive
|
||||||
BVal
|
BVal
|
||||||
BValue
|
BValue
|
||||||
@@ -272,7 +270,6 @@ CSettings
|
|||||||
cso
|
cso
|
||||||
CSRW
|
CSRW
|
||||||
CStyle
|
CStyle
|
||||||
cswinrt
|
|
||||||
CSY
|
CSY
|
||||||
CTest
|
CTest
|
||||||
currentculture
|
currentculture
|
||||||
@@ -354,7 +351,6 @@ devpkey
|
|||||||
DEVSOURCE
|
DEVSOURCE
|
||||||
DIIRFLAG
|
DIIRFLAG
|
||||||
dimm
|
dimm
|
||||||
directshow
|
|
||||||
DISABLEASACTIONKEY
|
DISABLEASACTIONKEY
|
||||||
diskmgmt
|
diskmgmt
|
||||||
DISPLAYCHANGE
|
DISPLAYCHANGE
|
||||||
@@ -370,7 +366,6 @@ dllmain
|
|||||||
DNLEN
|
DNLEN
|
||||||
DONOTROUND
|
DONOTROUND
|
||||||
DONTVALIDATEPATH
|
DONTVALIDATEPATH
|
||||||
DOPUS
|
|
||||||
dotnet
|
dotnet
|
||||||
DPICHANGED
|
DPICHANGED
|
||||||
DPIs
|
DPIs
|
||||||
@@ -386,6 +381,7 @@ drf
|
|||||||
drivedetectionwarning
|
drivedetectionwarning
|
||||||
dshow
|
dshow
|
||||||
DSTINVERT
|
DSTINVERT
|
||||||
|
Dstr
|
||||||
DUMMYUNIONNAME
|
DUMMYUNIONNAME
|
||||||
dutil
|
dutil
|
||||||
DVASPECT
|
DVASPECT
|
||||||
@@ -453,12 +449,14 @@ erwrite
|
|||||||
ESettings
|
ESettings
|
||||||
esrp
|
esrp
|
||||||
etl
|
etl
|
||||||
ETW
|
etw
|
||||||
EUQ
|
EUQ
|
||||||
eurochange
|
eurochange
|
||||||
eventlog
|
eventlog
|
||||||
|
EVENTTAG
|
||||||
eventvwr
|
eventvwr
|
||||||
everytime
|
everytime
|
||||||
|
evntrace
|
||||||
evt
|
evt
|
||||||
EWXFORCE
|
EWXFORCE
|
||||||
EWXFORCEIFHUNG
|
EWXFORCEIFHUNG
|
||||||
@@ -530,7 +528,6 @@ FZE
|
|||||||
gacutil
|
gacutil
|
||||||
Gaeilge
|
Gaeilge
|
||||||
Gaidhlig
|
Gaidhlig
|
||||||
GBarm
|
|
||||||
GCLP
|
GCLP
|
||||||
gdi
|
gdi
|
||||||
gdiplus
|
gdiplus
|
||||||
@@ -1000,7 +997,6 @@ NCRENDERING
|
|||||||
ndp
|
ndp
|
||||||
NEEDDISPATCH
|
NEEDDISPATCH
|
||||||
needinfo
|
needinfo
|
||||||
netcore
|
|
||||||
netcoreapp
|
netcoreapp
|
||||||
netcpl
|
netcpl
|
||||||
netframework
|
netframework
|
||||||
@@ -1009,6 +1005,7 @@ netsh
|
|||||||
newcolor
|
newcolor
|
||||||
newdev
|
newdev
|
||||||
NEWDIALOGSTYLE
|
NEWDIALOGSTYLE
|
||||||
|
NEWFILE
|
||||||
newitem
|
newitem
|
||||||
newpath
|
newpath
|
||||||
newplus
|
newplus
|
||||||
@@ -1077,7 +1074,6 @@ NTAPI
|
|||||||
ntdll
|
ntdll
|
||||||
ntfs
|
ntfs
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
nugets
|
|
||||||
nullonfailure
|
nullonfailure
|
||||||
numberbox
|
numberbox
|
||||||
nwc
|
nwc
|
||||||
@@ -1171,6 +1167,7 @@ phwnd
|
|||||||
pici
|
pici
|
||||||
pidl
|
pidl
|
||||||
PIDLIST
|
PIDLIST
|
||||||
|
PII
|
||||||
PINDIR
|
PINDIR
|
||||||
pinfo
|
pinfo
|
||||||
pinvoke
|
pinvoke
|
||||||
@@ -1228,6 +1225,7 @@ proactively
|
|||||||
PROCESSENTRY
|
PROCESSENTRY
|
||||||
PROCESSKEY
|
PROCESSKEY
|
||||||
processthreadsapi
|
processthreadsapi
|
||||||
|
PROCESSTRACE
|
||||||
PRODEXT
|
PRODEXT
|
||||||
PRODUCTVERSION
|
PRODUCTVERSION
|
||||||
Progman
|
Progman
|
||||||
@@ -1269,12 +1267,12 @@ PWSTR
|
|||||||
pwsz
|
pwsz
|
||||||
pwtd
|
pwtd
|
||||||
QDC
|
QDC
|
||||||
QDir
|
|
||||||
qianlifeng
|
qianlifeng
|
||||||
qit
|
qit
|
||||||
QITAB
|
QITAB
|
||||||
QITABENT
|
QITABENT
|
||||||
qoi
|
qoi
|
||||||
|
QPC
|
||||||
Quarternary
|
Quarternary
|
||||||
QUERYENDSESSION
|
QUERYENDSESSION
|
||||||
QUERYOPEN
|
QUERYOPEN
|
||||||
@@ -1593,9 +1591,7 @@ SYSKEYUP
|
|||||||
SYSLIB
|
SYSLIB
|
||||||
SYSMENU
|
SYSMENU
|
||||||
SYSTEMAPPS
|
SYSTEMAPPS
|
||||||
SYSTEMSETTINGS
|
|
||||||
SYSTEMTIME
|
SYSTEMTIME
|
||||||
SYSTEMWOW
|
|
||||||
tapp
|
tapp
|
||||||
TApplication
|
TApplication
|
||||||
TApplied
|
TApplied
|
||||||
@@ -1615,7 +1611,6 @@ TCustom
|
|||||||
tdbuild
|
tdbuild
|
||||||
TDefault
|
TDefault
|
||||||
TDevice
|
TDevice
|
||||||
telem
|
|
||||||
telephon
|
telephon
|
||||||
templatenamespace
|
templatenamespace
|
||||||
testprocess
|
testprocess
|
||||||
@@ -1647,11 +1642,12 @@ toolkitconverters
|
|||||||
Toolset
|
Toolset
|
||||||
toolwindow
|
toolwindow
|
||||||
TOPDOWNDIB
|
TOPDOWNDIB
|
||||||
TOTALCMD
|
|
||||||
TOUCHEVENTF
|
TOUCHEVENTF
|
||||||
TOUCHINPUT
|
TOUCHINPUT
|
||||||
touchpad
|
touchpad
|
||||||
|
TRACEHANDLE
|
||||||
tracelogging
|
tracelogging
|
||||||
|
tracerpt
|
||||||
trafficmanager
|
trafficmanager
|
||||||
traies
|
traies
|
||||||
transicc
|
transicc
|
||||||
@@ -1709,11 +1705,9 @@ urlmon
|
|||||||
Usb
|
Usb
|
||||||
USEDEFAULT
|
USEDEFAULT
|
||||||
USEFILEATTRIBUTES
|
USEFILEATTRIBUTES
|
||||||
USEPOSITION
|
|
||||||
USERDATA
|
USERDATA
|
||||||
Userenv
|
Userenv
|
||||||
USESHOWWINDOW
|
USESHOWWINDOW
|
||||||
USESIZE
|
|
||||||
USESTDHANDLES
|
USESTDHANDLES
|
||||||
USRDLL
|
USRDLL
|
||||||
UType
|
UType
|
||||||
@@ -1741,6 +1735,7 @@ VERBW
|
|||||||
VERIFYCONTEXT
|
VERIFYCONTEXT
|
||||||
verrsrc
|
verrsrc
|
||||||
VERSIONINFO
|
VERSIONINFO
|
||||||
|
vewng
|
||||||
VFT
|
VFT
|
||||||
vget
|
vget
|
||||||
vgetq
|
vgetq
|
||||||
@@ -1806,7 +1801,6 @@ wgpocpl
|
|||||||
WIC
|
WIC
|
||||||
wil
|
wil
|
||||||
winapi
|
winapi
|
||||||
winappdriver
|
|
||||||
wincodec
|
wincodec
|
||||||
Wincodecsdk
|
Wincodecsdk
|
||||||
wincolor
|
wincolor
|
||||||
@@ -1870,6 +1864,7 @@ WNDCLASSEX
|
|||||||
WNDCLASSEXW
|
WNDCLASSEXW
|
||||||
WNDCLASSW
|
WNDCLASSW
|
||||||
WNDPROC
|
WNDPROC
|
||||||
|
wnode
|
||||||
workarounds
|
workarounds
|
||||||
WORKSPACESEDITOR
|
WORKSPACESEDITOR
|
||||||
WORKSPACESLAUNCHER
|
WORKSPACESLAUNCHER
|
||||||
@@ -1914,7 +1909,6 @@ XLoc
|
|||||||
XNamespace
|
XNamespace
|
||||||
XPels
|
XPels
|
||||||
XPixel
|
XPixel
|
||||||
xplorer
|
|
||||||
XResource
|
XResource
|
||||||
xsi
|
xsi
|
||||||
XStr
|
XStr
|
||||||
@@ -1931,6 +1925,7 @@ YPels
|
|||||||
YResolution
|
YResolution
|
||||||
YStr
|
YStr
|
||||||
YVIRTUALSCREEN
|
YVIRTUALSCREEN
|
||||||
|
yyy
|
||||||
ZEROINIT
|
ZEROINIT
|
||||||
zonable
|
zonable
|
||||||
zoneset
|
zoneset
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Microsoft.PowerToys.Telemetry" version="2.0" />
|
<package id="Microsoft.PowerToys.Telemetry" version="2.0.1" />
|
||||||
</packages>
|
</packages>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
<PackageVersion Include="Markdig.Signed" Version="0.34.0" />
|
<PackageVersion Include="Markdig.Signed" Version="0.34.0" />
|
||||||
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
|
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
|
||||||
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.7" />
|
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.7" />
|
||||||
|
<PackageVersion Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="9.3.1.5" />
|
||||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||||
@@ -71,17 +72,18 @@
|
|||||||
<PackageVersion Include="System.Diagnostics.EventLog" Version="8.0.0" />
|
<PackageVersion Include="System.Diagnostics.EventLog" Version="8.0.0" />
|
||||||
<!-- Package System.Diagnostics.PerformanceCounter added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Data.OleDb but the 8.0.1 version wasn't published to nuget. -->
|
<!-- Package System.Diagnostics.PerformanceCounter added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Data.OleDb but the 8.0.1 version wasn't published to nuget. -->
|
||||||
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
|
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
|
||||||
|
<PackageVersion Include="System.Diagnostics.Tracing" Version="4.3.0" />
|
||||||
<PackageVersion Include="System.Drawing.Common" Version="8.0.6" />
|
<PackageVersion Include="System.Drawing.Common" Version="8.0.6" />
|
||||||
<PackageVersion Include="System.IO.Abstractions" Version="17.2.3" />
|
<PackageVersion Include="System.IO.Abstractions" Version="17.2.3" />
|
||||||
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" />
|
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" />
|
||||||
<PackageVersion Include="System.Management" Version="8.0.0" />
|
<PackageVersion Include="System.Management" Version="8.0.0" />
|
||||||
<PackageVersion Include="System.Reactive" Version="6.0.1" />
|
<PackageVersion Include="System.Reactive" Version="6.0.1" />
|
||||||
<PackageVersion Include="System.Runtime.Caching" Version="8.0.0" />
|
<PackageVersion Include="System.Runtime.Caching" Version="8.0.1" />
|
||||||
<!-- Package System.Security.Cryptography.ProtectedData added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Data.OleDb but the 8.0.1 version wasn't published to nuget. -->
|
<!-- Package System.Security.Cryptography.ProtectedData added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Data.OleDb but the 8.0.1 version wasn't published to nuget. -->
|
||||||
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
|
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
|
||||||
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
|
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
|
||||||
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />
|
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />
|
||||||
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
|
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
|
||||||
<PackageVersion Include="UnicodeInformation" Version="2.6.0" />
|
<PackageVersion Include="UnicodeInformation" Version="2.6.0" />
|
||||||
<PackageVersion Include="UnitsNet" Version="5.56.0" />
|
<PackageVersion Include="UnitsNet" Version="5.56.0" />
|
||||||
<PackageVersion Include="UTF.Unknown" Version="2.5.1" />
|
<PackageVersion Include="UTF.Unknown" Version="2.5.1" />
|
||||||
|
|||||||
@@ -297,6 +297,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Telemetry", "Telemetry", "{
|
|||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
src\common\Telemetry\ProjectTelemetry.h = src\common\Telemetry\ProjectTelemetry.h
|
src\common\Telemetry\ProjectTelemetry.h = src\common\Telemetry\ProjectTelemetry.h
|
||||||
src\common\Telemetry\TelemetryBase.cs = src\common\Telemetry\TelemetryBase.cs
|
src\common\Telemetry\TelemetryBase.cs = src\common\Telemetry\TelemetryBase.cs
|
||||||
|
src\common\Telemetry\TraceBase.h = src\common\Telemetry\TraceBase.h
|
||||||
src\common\Telemetry\TraceLoggingDefines.h = src\common\Telemetry\TraceLoggingDefines.h
|
src\common\Telemetry\TraceLoggingDefines.h = src\common\Telemetry\TraceLoggingDefines.h
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
@@ -622,6 +623,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesLauncher", "src\m
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesWindowArranger", "src\modules\Workspaces\WorkspacesWindowArranger\WorkspacesWindowArranger.vcxproj", "{37D07516-4185-43A4-924F-3C7A5D95ECF6}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesWindowArranger", "src\modules\Workspaces\WorkspacesWindowArranger\WorkspacesWindowArranger.vcxproj", "{37D07516-4185-43A4-924F-3C7A5D95ECF6}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EtwTrace", "src\common\Telemetry\EtwTrace\EtwTrace.vcxproj", "{8F021B46-362B-485C-BFBA-CCF83E820CBD}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|ARM64 = Debug|ARM64
|
Debug|ARM64 = Debug|ARM64
|
||||||
@@ -2734,6 +2737,18 @@ Global
|
|||||||
{37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x64.Build.0 = Release|x64
|
{37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x64.Build.0 = Release|x64
|
||||||
{37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x86.ActiveCfg = Release|x64
|
{37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x86.ActiveCfg = Release|x64
|
||||||
{37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x86.Build.0 = Release|x64
|
{37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x86.Build.0 = Release|x64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x86.ActiveCfg = Debug|x64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x86.Build.0 = Debug|x64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|ARM64.Build.0 = Release|ARM64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x64.Build.0 = Release|x64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x86.ActiveCfg = Release|x64
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x86.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -2962,6 +2977,7 @@ Global
|
|||||||
{367D7543-7DBA-4381-99F1-BF6142A996C4} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
{367D7543-7DBA-4381-99F1-BF6142A996C4} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||||
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
{2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||||
{37D07516-4185-43A4-924F-3C7A5D95ECF6} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
{37D07516-4185-43A4-924F-3C7A5D95ECF6} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||||
|
{8F021B46-362B-485C-BFBA-CCF83E820CBD} = {8F62026A-294B-41C6-8839-87463613F216}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||||
|
|||||||
@@ -38,6 +38,48 @@ const DWORD USERNAME_LEN = UNLEN + 1; // User Name + '\0'
|
|||||||
static const wchar_t* POWERTOYS_EXE_COMPONENT = L"{A2C66D91-3485-4D00-B04D-91844E6B345B}";
|
static const wchar_t* POWERTOYS_EXE_COMPONENT = L"{A2C66D91-3485-4D00-B04D-91844E6B345B}";
|
||||||
static const wchar_t* POWERTOYS_UPGRADE_CODE = L"{42B84BF7-5FBF-473B-9C8B-049DC16F7708}";
|
static const wchar_t* POWERTOYS_UPGRADE_CODE = L"{42B84BF7-5FBF-473B-9C8B-049DC16F7708}";
|
||||||
|
|
||||||
|
constexpr inline const wchar_t* DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys";
|
||||||
|
constexpr inline const wchar_t* DataDiagnosticsRegValueName = L"AllowDataDiagnostics";
|
||||||
|
|
||||||
|
#define TraceLoggingWriteWrapper(provider, eventName, ...) \
|
||||||
|
if (isDataDiagnosticEnabled()) \
|
||||||
|
{ \
|
||||||
|
TraceLoggingWrite(provider, eventName, __VA_ARGS__); \
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isDataDiagnosticEnabled()
|
||||||
|
{
|
||||||
|
HKEY key{};
|
||||||
|
if (RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||||
|
DataDiagnosticsRegKey,
|
||||||
|
0,
|
||||||
|
KEY_READ,
|
||||||
|
&key) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD isDataDiagnosticsEnabled = 0;
|
||||||
|
DWORD size = sizeof(isDataDiagnosticsEnabled);
|
||||||
|
|
||||||
|
if (RegGetValueW(
|
||||||
|
HKEY_CURRENT_USER,
|
||||||
|
DataDiagnosticsRegKey,
|
||||||
|
DataDiagnosticsRegValueName,
|
||||||
|
RRF_RT_REG_DWORD,
|
||||||
|
nullptr,
|
||||||
|
&isDataDiagnosticsEnabled,
|
||||||
|
&size) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegCloseKey(key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
RegCloseKey(key);
|
||||||
|
|
||||||
|
return isDataDiagnosticsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT getInstallFolder(MSIHANDLE hInstall, std::wstring& installationDir)
|
HRESULT getInstallFolder(MSIHANDLE hInstall, std::wstring& installationDir)
|
||||||
{
|
{
|
||||||
DWORD len = 0;
|
DWORD len = 0;
|
||||||
@@ -793,13 +835,15 @@ UINT __stdcall TelemetryLogInstallSuccessCA(MSIHANDLE hInstall)
|
|||||||
hr = WcaInitialize(hInstall, "TelemetryLogInstallSuccessCA");
|
hr = WcaInitialize(hInstall, "TelemetryLogInstallSuccessCA");
|
||||||
ExitOnFailure(hr, "Failed to initialize");
|
ExitOnFailure(hr, "Failed to initialize");
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Install_Success",
|
"Install_Success",
|
||||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII)
|
||||||
|
);
|
||||||
|
|
||||||
LExit:
|
LExit:
|
||||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||||
@@ -814,13 +858,14 @@ UINT __stdcall TelemetryLogInstallCancelCA(MSIHANDLE hInstall)
|
|||||||
hr = WcaInitialize(hInstall, "TelemetryLogInstallCancelCA");
|
hr = WcaInitialize(hInstall, "TelemetryLogInstallCancelCA");
|
||||||
ExitOnFailure(hr, "Failed to initialize");
|
ExitOnFailure(hr, "Failed to initialize");
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Install_Cancel",
|
"Install_Cancel",
|
||||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
|
|
||||||
LExit:
|
LExit:
|
||||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||||
@@ -835,13 +880,14 @@ UINT __stdcall TelemetryLogInstallFailCA(MSIHANDLE hInstall)
|
|||||||
hr = WcaInitialize(hInstall, "TelemetryLogInstallFailCA");
|
hr = WcaInitialize(hInstall, "TelemetryLogInstallFailCA");
|
||||||
ExitOnFailure(hr, "Failed to initialize");
|
ExitOnFailure(hr, "Failed to initialize");
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Install_Fail",
|
"Install_Fail",
|
||||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
|
|
||||||
LExit:
|
LExit:
|
||||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||||
@@ -856,13 +902,14 @@ UINT __stdcall TelemetryLogUninstallSuccessCA(MSIHANDLE hInstall)
|
|||||||
hr = WcaInitialize(hInstall, "TelemetryLogUninstallSuccessCA");
|
hr = WcaInitialize(hInstall, "TelemetryLogUninstallSuccessCA");
|
||||||
ExitOnFailure(hr, "Failed to initialize");
|
ExitOnFailure(hr, "Failed to initialize");
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"UnInstall_Success",
|
"UnInstall_Success",
|
||||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
|
|
||||||
LExit:
|
LExit:
|
||||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||||
@@ -877,13 +924,14 @@ UINT __stdcall TelemetryLogUninstallCancelCA(MSIHANDLE hInstall)
|
|||||||
hr = WcaInitialize(hInstall, "TelemetryLogUninstallCancelCA");
|
hr = WcaInitialize(hInstall, "TelemetryLogUninstallCancelCA");
|
||||||
ExitOnFailure(hr, "Failed to initialize");
|
ExitOnFailure(hr, "Failed to initialize");
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"UnInstall_Cancel",
|
"UnInstall_Cancel",
|
||||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
|
|
||||||
LExit:
|
LExit:
|
||||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||||
@@ -898,13 +946,14 @@ UINT __stdcall TelemetryLogUninstallFailCA(MSIHANDLE hInstall)
|
|||||||
hr = WcaInitialize(hInstall, "TelemetryLogUninstallFailCA");
|
hr = WcaInitialize(hInstall, "TelemetryLogUninstallFailCA");
|
||||||
ExitOnFailure(hr, "Failed to initialize");
|
ExitOnFailure(hr, "Failed to initialize");
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"UnInstall_Fail",
|
"UnInstall_Fail",
|
||||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
|
|
||||||
LExit:
|
LExit:
|
||||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||||
@@ -919,13 +968,14 @@ UINT __stdcall TelemetryLogRepairCancelCA(MSIHANDLE hInstall)
|
|||||||
hr = WcaInitialize(hInstall, "TelemetryLogRepairCancelCA");
|
hr = WcaInitialize(hInstall, "TelemetryLogRepairCancelCA");
|
||||||
ExitOnFailure(hr, "Failed to initialize");
|
ExitOnFailure(hr, "Failed to initialize");
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Repair_Cancel",
|
"Repair_Cancel",
|
||||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
|
|
||||||
LExit:
|
LExit:
|
||||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||||
@@ -940,13 +990,14 @@ UINT __stdcall TelemetryLogRepairFailCA(MSIHANDLE hInstall)
|
|||||||
hr = WcaInitialize(hInstall, "TelemetryLogRepairFailCA");
|
hr = WcaInitialize(hInstall, "TelemetryLogRepairFailCA");
|
||||||
ExitOnFailure(hr, "Failed to initialize");
|
ExitOnFailure(hr, "Failed to initialize");
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Repair_Fail",
|
"Repair_Fail",
|
||||||
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
TraceLoggingWideString(get_product_version().c_str(), "Version"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
|
|
||||||
LExit:
|
LExit:
|
||||||
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
|
||||||
|
|||||||
@@ -224,4 +224,8 @@ namespace winrt::PowerToys::GPOWrapper::implementation
|
|||||||
{
|
{
|
||||||
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredNewPlusHideTemplateFilenameExtensionValue());
|
return static_cast<GpoRuleConfigured>(powertoys_gpo::getConfiguredNewPlusHideTemplateFilenameExtensionValue());
|
||||||
}
|
}
|
||||||
|
GpoRuleConfigured GPOWrapper::GetAllowDataDiagnosticsValue()
|
||||||
|
{
|
||||||
|
return static_cast<GpoRuleConfigured>(powertoys_gpo::getAllowDataDiagnosticsValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace winrt::PowerToys::GPOWrapper::implementation
|
|||||||
static GpoRuleConfigured GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
static GpoRuleConfigured GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
||||||
static winrt::hstring GPOWrapper::GetConfiguredMwbPolicyDefinedIpMappingRules();
|
static winrt::hstring GPOWrapper::GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||||
static GpoRuleConfigured GetConfiguredNewPlusHideTemplateFilenameExtensionValue();
|
static GpoRuleConfigured GetConfiguredNewPlusHideTemplateFilenameExtensionValue();
|
||||||
|
static GpoRuleConfigured GetAllowDataDiagnosticsValue();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ namespace PowerToys
|
|||||||
static GpoRuleConfigured GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
static GpoRuleConfigured GetConfiguredMwbDisableUserDefinedIpMappingRulesValue();
|
||||||
static String GetConfiguredMwbPolicyDefinedIpMappingRules();
|
static String GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||||
static GpoRuleConfigured GetConfiguredNewPlusHideTemplateFilenameExtensionValue();
|
static GpoRuleConfigured GetConfiguredNewPlusHideTemplateFilenameExtensionValue();
|
||||||
|
static GpoRuleConfigured GetAllowDataDiagnosticsValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
107
src/common/ManagedTelemetry/Telemetry/DataDiagnosticsSettings.cs
Normal file
107
src/common/ManagedTelemetry/Telemetry/DataDiagnosticsSettings.cs
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Telemetry
|
||||||
|
{
|
||||||
|
public static class DataDiagnosticsSettings
|
||||||
|
{
|
||||||
|
private static readonly string DataDiagnosticsRegistryKey = @"HKEY_CURRENT_USER\Software\Classes\PowerToys\";
|
||||||
|
private static readonly string DataDiagnosticsRegistryValueName = @"AllowDataDiagnostics";
|
||||||
|
private static readonly string DataDiagnosticsDataDiagnosticsUserActionRegistryValueName = @"DataDiagnosticsUserAction";
|
||||||
|
private static readonly string DataDiagnosticsDataDiagnosticsViewDataRegistryValueName = @"DataDiagnosticsViewEnabled";
|
||||||
|
|
||||||
|
public static bool GetEnabledValue()
|
||||||
|
{
|
||||||
|
object registryValue = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
registryValue = Registry.GetValue(DataDiagnosticsRegistryKey, DataDiagnosticsRegistryValueName, 0);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if (registryValue is not null)
|
||||||
|
{
|
||||||
|
return (int)registryValue == 1 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetEnabledValue(bool value)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Registry.SetValue(DataDiagnosticsRegistryKey, DataDiagnosticsRegistryValueName, value ? 1 : 0);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetUserActionValue()
|
||||||
|
{
|
||||||
|
object registryValue = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
registryValue = Registry.GetValue(DataDiagnosticsRegistryKey, DataDiagnosticsDataDiagnosticsUserActionRegistryValueName, 0);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if (registryValue is not null)
|
||||||
|
{
|
||||||
|
return (int)registryValue == 1 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetUserActionValue(bool value)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Registry.SetValue(DataDiagnosticsRegistryKey, DataDiagnosticsDataDiagnosticsUserActionRegistryValueName, value ? 1 : 0);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetViewEnabledValue()
|
||||||
|
{
|
||||||
|
object registryValue = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
registryValue = Registry.GetValue(DataDiagnosticsRegistryKey, DataDiagnosticsDataDiagnosticsViewDataRegistryValueName, 0);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if (registryValue is not null)
|
||||||
|
{
|
||||||
|
return (int)registryValue == 1 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetViewEnabledValue(bool value)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Registry.SetValue(DataDiagnosticsRegistryKey, DataDiagnosticsDataDiagnosticsViewDataRegistryValueName, value ? 1 : 0);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
147
src/common/ManagedTelemetry/Telemetry/EtwTrace.cs
Normal file
147
src/common/ManagedTelemetry/Telemetry/EtwTrace.cs
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.Tracing;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.Diagnostics.Tracing.Session;
|
||||||
|
using Microsoft.PowerToys.Telemetry;
|
||||||
|
|
||||||
|
namespace Microsoft.PowerToys.Telemetry
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This class is based loosely on the C++ ETWTrace class in Win32client/Framework project.
|
||||||
|
/// It is intended to record telemetry events generated by the PowerToys processes so that end users
|
||||||
|
/// can view them if they want.
|
||||||
|
/// </summary>
|
||||||
|
public class ETWTrace : IDisposable
|
||||||
|
{
|
||||||
|
internal const EventKeywords TelemetryKeyword = (EventKeywords)0x0000200000000000;
|
||||||
|
internal const EventKeywords MeasuresKeyword = (EventKeywords)0x0000400000000000;
|
||||||
|
internal const EventKeywords CriticalDataKeyword = (EventKeywords)0x0000800000000000;
|
||||||
|
|
||||||
|
private readonly bool telemetryEnabled = DataDiagnosticsSettings.GetEnabledValue(); // This is the global telemetry setting on whether to log events
|
||||||
|
private readonly bool telemetryRecordingEnabled = DataDiagnosticsSettings.GetViewEnabledValue(); // This is the setting for recording telemetry events to disk for vewng
|
||||||
|
private readonly string etwFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\PowerToys\", "etw");
|
||||||
|
private bool disposedValue;
|
||||||
|
private string sessionName;
|
||||||
|
private string etwFilePath;
|
||||||
|
private bool started;
|
||||||
|
#nullable enable
|
||||||
|
private TraceEventSession? traceSession;
|
||||||
|
|
||||||
|
internal sealed class Lister : EventListener
|
||||||
|
{
|
||||||
|
public Lister()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Lister? listener;
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ETWTrace"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public ETWTrace()
|
||||||
|
{
|
||||||
|
if (File.Exists(etwFolderPath))
|
||||||
|
{
|
||||||
|
File.Delete(etwFolderPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Directory.Exists(etwFolderPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(etwFolderPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.telemetryEnabled && this.telemetryRecordingEnabled)
|
||||||
|
{
|
||||||
|
this.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
listener = new Lister();
|
||||||
|
listener.EnableEvents(PowerToysTelemetry.Log, EventLevel.LogAlways);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||||
|
this.Dispose(disposing: true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts the trace session.
|
||||||
|
/// </summary>
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
if (this.started)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string executable = Process.GetCurrentProcess().ProcessName;
|
||||||
|
string dateTimeNow = DateTime.Now.ToString("MM-d-yyy__H_mm_ss", CultureInfo.InvariantCulture);
|
||||||
|
this.sessionName = string.Format(CultureInfo.InvariantCulture, "{0}-{1}-{2}", executable, Environment.ProcessId, dateTimeNow);
|
||||||
|
this.etwFilePath = Path.Combine(etwFolderPath, $"{this.sessionName}.etl");
|
||||||
|
|
||||||
|
this.traceSession = new TraceEventSession(
|
||||||
|
this.sessionName, this.etwFilePath, (TraceEventSessionOptions)(TraceEventSessionOptions.Create | TraceEventSessionOptions.PrivateLogger | TraceEventSessionOptions.PrivateInProcLogger));
|
||||||
|
TraceEventProviderOptions args = new TraceEventProviderOptions();
|
||||||
|
|
||||||
|
this.traceSession.EnableProvider(
|
||||||
|
PowerToysTelemetry.Log.Guid,
|
||||||
|
matchAnyKeywords: (ulong)TelemetryKeyword | (ulong)MeasuresKeyword | (ulong)CriticalDataKeyword);
|
||||||
|
|
||||||
|
this.started = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops the trace session.
|
||||||
|
/// </summary>
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
if (!this.started)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.traceSession != null)
|
||||||
|
{
|
||||||
|
Trace.TraceInformation("Disposing EventTraceSession");
|
||||||
|
this.traceSession.Dispose();
|
||||||
|
this.traceSession = null;
|
||||||
|
this.started = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disposes the object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">boolean for disposing.</param>
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (!this.disposedValue)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
this.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.disposedValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
<!-- Look at Directory.Build.props in root for common stuff as well -->
|
||||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>PowerToys Telemetry</Description>
|
<Description>PowerToys Telemetry</Description>
|
||||||
<AssemblyName>PowerToys.ManagedTelemetry</AssemblyName>
|
<AssemblyName>PowerToys.ManagedTelemetry</AssemblyName>
|
||||||
@@ -11,4 +11,9 @@
|
|||||||
<Compile Include="..\..\Telemetry\TelemetryBase.cs" Link="TelemetryBase.cs" />
|
<Compile Include="..\..\Telemetry\TelemetryBase.cs" Link="TelemetryBase.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" />
|
||||||
|
<PackageReference Include="System.Diagnostics.Tracing" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -37,14 +37,17 @@ namespace Microsoft.PowerToys.Telemetry
|
|||||||
public void WriteEvent<T>(T telemetryEvent)
|
public void WriteEvent<T>(T telemetryEvent)
|
||||||
where T : EventBase, IEvent
|
where T : EventBase, IEvent
|
||||||
{
|
{
|
||||||
this.Write<T>(
|
if (DataDiagnosticsSettings.GetEnabledValue())
|
||||||
telemetryEvent.EventName,
|
{
|
||||||
new EventSourceOptions()
|
this.Write<T>(
|
||||||
{
|
telemetryEvent.EventName,
|
||||||
Keywords = ProjectKeywordMeasure,
|
new EventSourceOptions()
|
||||||
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
{
|
||||||
},
|
Keywords = ProjectKeywordMeasure,
|
||||||
telemetryEvent);
|
Tags = ProjectTelemetryTagProductAndServicePerformance,
|
||||||
|
},
|
||||||
|
telemetryEvent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace PTSettingsHelper
|
|||||||
constexpr inline const wchar_t* last_version_run_filename = L"last_version_run.json";
|
constexpr inline const wchar_t* last_version_run_filename = L"last_version_run.json";
|
||||||
constexpr inline const wchar_t* opened_at_first_launch_json_field_name = L"openedAtFirstLaunch";
|
constexpr inline const wchar_t* opened_at_first_launch_json_field_name = L"openedAtFirstLaunch";
|
||||||
constexpr inline const wchar_t* last_version_json_field_name = L"last_version";
|
constexpr inline const wchar_t* last_version_json_field_name = L"last_version";
|
||||||
|
constexpr inline const wchar_t* DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys";
|
||||||
|
constexpr inline const wchar_t* DataDiagnosticsRegValueName = L"AllowDataDiagnostics";
|
||||||
|
|
||||||
std::wstring get_root_save_folder_location()
|
std::wstring get_root_save_folder_location()
|
||||||
{
|
{
|
||||||
@@ -25,7 +27,7 @@ namespace PTSettingsHelper
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring get_local_low_folder_location()
|
std::wstring get_local_low_folder_location()
|
||||||
{
|
{
|
||||||
PWSTR local_app_path;
|
PWSTR local_app_path;
|
||||||
winrt::check_hresult(SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, NULL, &local_app_path));
|
winrt::check_hresult(SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, NULL, &local_app_path));
|
||||||
@@ -112,7 +114,7 @@ namespace PTSettingsHelper
|
|||||||
bool opened = saved_settings->GetNamedBoolean(opened_at_first_launch_json_field_name, false);
|
bool opened = saved_settings->GetNamedBoolean(opened_at_first_launch_json_field_name, false);
|
||||||
return opened;
|
return opened;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,12 +126,11 @@ namespace PTSettingsHelper
|
|||||||
json::JsonObject obj;
|
json::JsonObject obj;
|
||||||
obj.SetNamedValue(opened_at_first_launch_json_field_name, json::value(true));
|
obj.SetNamedValue(opened_at_first_launch_json_field_name, json::value(true));
|
||||||
|
|
||||||
json::to_file(oobePath.c_str(), obj);
|
json::to_file(oobePath.c_str(), obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring get_last_version_run()
|
std::wstring get_last_version_run()
|
||||||
{
|
{
|
||||||
|
|
||||||
std::filesystem::path lastVersionRunPath(PTSettingsHelper::get_root_save_folder_location());
|
std::filesystem::path lastVersionRunPath(PTSettingsHelper::get_root_save_folder_location());
|
||||||
lastVersionRunPath = lastVersionRunPath.append(last_version_run_filename);
|
lastVersionRunPath = lastVersionRunPath.append(last_version_run_filename);
|
||||||
if (std::filesystem::exists(lastVersionRunPath))
|
if (std::filesystem::exists(lastVersionRunPath))
|
||||||
@@ -157,4 +158,29 @@ namespace PTSettingsHelper
|
|||||||
json::to_file(lastVersionRunPath.c_str(), obj);
|
json::to_file(lastVersionRunPath.c_str(), obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save_data_diagnostics(bool enabled)
|
||||||
|
{
|
||||||
|
HKEY key{};
|
||||||
|
if (RegCreateKeyExW(HKEY_CURRENT_USER,
|
||||||
|
DataDiagnosticsRegKey,
|
||||||
|
0,
|
||||||
|
nullptr,
|
||||||
|
REG_OPTION_NON_VOLATILE,
|
||||||
|
KEY_ALL_ACCESS,
|
||||||
|
nullptr,
|
||||||
|
&key,
|
||||||
|
nullptr) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool value = enabled;
|
||||||
|
const size_t buf_size = sizeof(bool);
|
||||||
|
if (RegSetValueExW(key, DataDiagnosticsRegValueName, 0, REG_QWORD, reinterpret_cast<const BYTE*>(&value), buf_size) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegCloseKey(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RegCloseKey(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,6 @@ namespace PTSettingsHelper
|
|||||||
void save_oobe_opened_state();
|
void save_oobe_opened_state();
|
||||||
std::wstring get_last_version_run();
|
std::wstring get_last_version_run();
|
||||||
void save_last_version_run(const std::wstring& version);
|
void save_last_version_run(const std::wstring& version);
|
||||||
|
|
||||||
|
void save_data_diagnostics(bool enabled);
|
||||||
}
|
}
|
||||||
|
|||||||
252
src/common/Telemetry/EtwTrace/EtwTrace.cpp
Normal file
252
src/common/Telemetry/EtwTrace/EtwTrace.cpp
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
#include "ETWTrace.h"
|
||||||
|
|
||||||
|
#include <wil\stl.h>
|
||||||
|
#include <wil\win32_helpers.h>
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
constexpr inline const wchar_t* DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys";
|
||||||
|
constexpr inline const wchar_t* ViewDataDiagnosticsRegValueName = L"DataDiagnosticsViewEnabled";
|
||||||
|
|
||||||
|
inline std::wstring get_root_save_folder_location()
|
||||||
|
{
|
||||||
|
PWSTR local_app_path;
|
||||||
|
winrt::check_hresult(SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &local_app_path));
|
||||||
|
std::wstring result{ local_app_path };
|
||||||
|
CoTaskMemFree(local_app_path);
|
||||||
|
|
||||||
|
result += L"\\Microsoft\\PowerToys";
|
||||||
|
std::filesystem::path save_path(result);
|
||||||
|
if (!std::filesystem::exists(save_path))
|
||||||
|
{
|
||||||
|
std::filesystem::create_directories(save_path);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isViewDataDiagnosticEnabled()
|
||||||
|
{
|
||||||
|
HKEY key{};
|
||||||
|
if (RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||||
|
DataDiagnosticsRegKey,
|
||||||
|
0,
|
||||||
|
KEY_READ,
|
||||||
|
&key) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD isDataDiagnosticsEnabled = 0;
|
||||||
|
DWORD size = sizeof(isDataDiagnosticsEnabled);
|
||||||
|
|
||||||
|
if (RegGetValueW(
|
||||||
|
HKEY_CURRENT_USER,
|
||||||
|
DataDiagnosticsRegKey,
|
||||||
|
ViewDataDiagnosticsRegValueName,
|
||||||
|
RRF_RT_REG_DWORD,
|
||||||
|
nullptr,
|
||||||
|
&isDataDiagnosticsEnabled,
|
||||||
|
&size) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegCloseKey(key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
RegCloseKey(key);
|
||||||
|
|
||||||
|
return isDataDiagnosticsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Shared
|
||||||
|
{
|
||||||
|
namespace Trace
|
||||||
|
{
|
||||||
|
ETWTrace::ETWTrace() :
|
||||||
|
ETWTrace(PowerToysProviderGUID)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ETWTrace::ETWTrace(const std::wstring& providerGUIDstr)
|
||||||
|
{
|
||||||
|
GUID id;
|
||||||
|
if (SUCCEEDED(CLSIDFromString(providerGUIDstr.c_str(), &id)))
|
||||||
|
{
|
||||||
|
m_providerGUID = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs::path outputFolder = get_root_save_folder_location();
|
||||||
|
m_etwFolder = (outputFolder / c_etwFolderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
ETWTrace::ETWTrace(const GUID& providerGUID) :
|
||||||
|
m_providerGUID(providerGUID)
|
||||||
|
{
|
||||||
|
fs::path outputFolder = get_root_save_folder_location();
|
||||||
|
m_etwFolder = (outputFolder / c_etwFolderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
ETWTrace::~ETWTrace()
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
m_etwFolder.clear();
|
||||||
|
m_providerGUID = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETWTrace::UpdateState(bool tracing)
|
||||||
|
{
|
||||||
|
if (tracing)
|
||||||
|
{
|
||||||
|
Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETWTrace::Flush()
|
||||||
|
{
|
||||||
|
if (m_tracing)
|
||||||
|
{
|
||||||
|
Control(EVENT_TRACE_CONTROL_FLUSH);
|
||||||
|
Control(EVENT_TRACE_CONTROL_INCREMENT_FILE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETWTrace::CreateEtwFolderIfNeeded()
|
||||||
|
{
|
||||||
|
if (!std::filesystem::exists(m_etwFolder))
|
||||||
|
{
|
||||||
|
std::filesystem::create_directories(m_etwFolder);
|
||||||
|
}
|
||||||
|
else if (!std::filesystem::is_directory(m_etwFolder))
|
||||||
|
{
|
||||||
|
std::filesystem::remove(m_etwFolder);
|
||||||
|
std::filesystem::create_directory(m_etwFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
THROW_HR_IF(E_UNEXPECTED, !std::filesystem::exists(m_etwFolder));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETWTrace::InitEventTraceProperties()
|
||||||
|
{
|
||||||
|
const std::filesystem::path exePath(wil::GetModuleFileNameW<std::wstring>(nullptr));
|
||||||
|
const auto exeName = exePath.stem().wstring();
|
||||||
|
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
auto timeNow = std::chrono::system_clock::to_time_t(now);
|
||||||
|
std::wstringstream dateTime;
|
||||||
|
struct tm timeInfo
|
||||||
|
{
|
||||||
|
};
|
||||||
|
errno_t err = localtime_s(&timeInfo, &timeNow);
|
||||||
|
if (err == 0)
|
||||||
|
{
|
||||||
|
dateTime << std::put_time(&timeInfo, L"-%m-%d-%Y__%H_%M_%S");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sessionName = wil::str_printf<std::wstring>(L"%ws-%d%ws", exeName.c_str(), GetCurrentProcessId(), dateTime.str().c_str());
|
||||||
|
std::replace(m_sessionName.begin(), m_sessionName.end(), '.', '_');
|
||||||
|
|
||||||
|
const ULONG etwSessionNameCharCount = static_cast<ULONG>(m_sessionName.size() + 1);
|
||||||
|
const ULONG etwSessionNameByteSize = etwSessionNameCharCount * sizeof(m_sessionName[0]);
|
||||||
|
|
||||||
|
auto etlFileNameFormattedCounter = m_sessionName + c_etwNewFileFormattedCounter;
|
||||||
|
std::filesystem::path etlFilePath = m_etwFolder / etlFileNameFormattedCounter;
|
||||||
|
etlFilePath.replace_extension(c_etwFileNameEnd);
|
||||||
|
THROW_HR_IF(E_UNEXPECTED, etlFilePath.empty());
|
||||||
|
|
||||||
|
const auto etlFilePathStr = etlFilePath.wstring();
|
||||||
|
// std::string/wstring returns number of characters not including the null terminator, so add +1 for that.
|
||||||
|
const ULONG etwFilePathCharCount = static_cast<ULONG>(etlFilePathStr.size() + 1);
|
||||||
|
const ULONG etwFilePathByteSize = etwFilePathCharCount * sizeof(etlFilePathStr[0]);
|
||||||
|
|
||||||
|
const ULONG bufferSizeInBytes = sizeof(EVENT_TRACE_PROPERTIES) + etwSessionNameByteSize + etwFilePathByteSize;
|
||||||
|
auto eventTracePropertiesBuffer = std::make_unique<unsigned char[]>(bufferSizeInBytes);
|
||||||
|
ZeroMemory(eventTracePropertiesBuffer.get(), bufferSizeInBytes);
|
||||||
|
auto eventTraceProperties = reinterpret_cast<EVENT_TRACE_PROPERTIES*>(eventTracePropertiesBuffer.get());
|
||||||
|
|
||||||
|
eventTraceProperties->Wnode.BufferSize = bufferSizeInBytes;
|
||||||
|
eventTraceProperties->Wnode.Flags = WNODE_FLAG_TRACED_GUID;
|
||||||
|
eventTraceProperties->Wnode.ClientContext = 1; // QPC clock resolution
|
||||||
|
eventTraceProperties->Wnode.Guid = m_providerGUID;
|
||||||
|
eventTraceProperties->BufferSize = 4; // 4KB, the minimum size
|
||||||
|
eventTraceProperties->LogFileMode = EVENT_TRACE_PRIVATE_LOGGER_MODE | EVENT_TRACE_PRIVATE_IN_PROC | EVENT_TRACE_FILE_MODE_NEWFILE;
|
||||||
|
eventTraceProperties->MaximumFileSize = 1; // 1 MB
|
||||||
|
|
||||||
|
// LoggerName is placed at the end of EVENT_TRACE_PROPERTIES structure
|
||||||
|
eventTraceProperties->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES);
|
||||||
|
wcsncpy_s(reinterpret_cast<LPWSTR>(eventTracePropertiesBuffer.get() + eventTraceProperties->LoggerNameOffset), etwSessionNameCharCount, m_sessionName.c_str(), etwSessionNameCharCount);
|
||||||
|
|
||||||
|
// LogFileName is placed at the end of the Logger Name
|
||||||
|
eventTraceProperties->LogFileNameOffset = eventTraceProperties->LoggerNameOffset + etwSessionNameByteSize;
|
||||||
|
wcsncpy_s(reinterpret_cast<LPWSTR>(eventTracePropertiesBuffer.get() + eventTraceProperties->LogFileNameOffset), etwFilePathCharCount, etlFilePathStr.c_str(), etwFilePathCharCount);
|
||||||
|
|
||||||
|
m_eventTracePropertiesBuffer = std::move(eventTracePropertiesBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETWTrace::Start()
|
||||||
|
{
|
||||||
|
if (m_tracing)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isViewDataDiagnosticEnabled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateEtwFolderIfNeeded();
|
||||||
|
InitEventTraceProperties();
|
||||||
|
|
||||||
|
auto eventTraceProperties = reinterpret_cast<EVENT_TRACE_PROPERTIES*>(m_eventTracePropertiesBuffer.get());
|
||||||
|
THROW_IF_WIN32_ERROR(StartTrace(&m_traceHandle, m_sessionName.c_str(), eventTraceProperties));
|
||||||
|
Enable(EVENT_CONTROL_CODE_ENABLE_PROVIDER);
|
||||||
|
|
||||||
|
m_tracing = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETWTrace::Stop()
|
||||||
|
{
|
||||||
|
if (!m_tracing)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Enable(EVENT_CONTROL_CODE_DISABLE_PROVIDER);
|
||||||
|
|
||||||
|
// ControlTrace with EVENT_TRACE_CONTROL_STOP on the trace handle,
|
||||||
|
// which is equivalent to calling CloseTrace() on the trace handle.
|
||||||
|
Control(EVENT_TRACE_CONTROL_STOP);
|
||||||
|
|
||||||
|
m_traceHandle = INVALID_PROCESSTRACE_HANDLE;
|
||||||
|
m_eventTracePropertiesBuffer.reset();
|
||||||
|
m_tracing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETWTrace::Control(ULONG traceControlCode)
|
||||||
|
{
|
||||||
|
auto eventTraceProperties = reinterpret_cast<EVENT_TRACE_PROPERTIES*>(m_eventTracePropertiesBuffer.get());
|
||||||
|
const ULONG result = ControlTrace(m_traceHandle, m_sessionName.c_str(), eventTraceProperties, traceControlCode);
|
||||||
|
THROW_IF_FAILED(HRESULT_FROM_WIN32(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ETWTrace::Enable(ULONG eventControlCode)
|
||||||
|
{
|
||||||
|
// Control the main provider
|
||||||
|
THROW_IF_WIN32_ERROR(EnableTraceEx2(m_traceHandle, &m_providerGUID, eventControlCode, TRACE_LEVEL_VERBOSE, 0, 0, 0, nullptr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
src/common/Telemetry/EtwTrace/EtwTrace.h
Normal file
48
src/common/Telemetry/EtwTrace/EtwTrace.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
#include <evntrace.h>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
namespace Shared
|
||||||
|
{
|
||||||
|
namespace Trace
|
||||||
|
{
|
||||||
|
class ETWTrace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static inline const wchar_t* PowerToysProviderGUID = L"{38e8889b-9731-53f5-e901-e8a7c1753074}";
|
||||||
|
|
||||||
|
ETWTrace();
|
||||||
|
ETWTrace(const std::wstring& providerGUID);
|
||||||
|
ETWTrace(const GUID& providerGUID);
|
||||||
|
~ETWTrace();
|
||||||
|
|
||||||
|
void UpdateState(bool tracing);
|
||||||
|
void Flush();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void CreateEtwFolderIfNeeded();
|
||||||
|
void InitEventTraceProperties();
|
||||||
|
void Start();
|
||||||
|
void Stop();
|
||||||
|
void Control(const ULONG traceControlCode);
|
||||||
|
void Enable(const ULONG eventControlCode);
|
||||||
|
|
||||||
|
GUID m_providerGUID{};
|
||||||
|
std::filesystem::path m_etwFolder;
|
||||||
|
std::wstring m_sessionName;
|
||||||
|
TRACEHANDLE m_traceHandle{ INVALID_PROCESSTRACE_HANDLE };
|
||||||
|
std::unique_ptr<unsigned char[]> m_eventTracePropertiesBuffer;
|
||||||
|
bool m_tracing{ false };
|
||||||
|
|
||||||
|
static constexpr PCWSTR c_etwFolderName = L"etw";
|
||||||
|
static constexpr PCWSTR c_etwNewFileFormattedCounter = L"-%d";
|
||||||
|
static constexpr PCWSTR c_etwFileNameEnd = L".etl";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
51
src/common/Telemetry/EtwTrace/EtwTrace.vcxproj
Normal file
51
src/common/Telemetry/EtwTrace/EtwTrace.vcxproj
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build"
|
||||||
|
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>17.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{8f021b46-362b-485c-bfba-ccf83e820cbd}</ProjectGuid>
|
||||||
|
<RootNamespace>EtwTrace</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="EtwTrace.h" />
|
||||||
|
<ClInclude Include="pch.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="EtwTrace.cpp" />
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||||
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
|
||||||
|
</ImportGroup>
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||||
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.231216.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
39
src/common/Telemetry/EtwTrace/EtwTrace.vcxproj.filters
Normal file
39
src/common/Telemetry/EtwTrace/EtwTrace.vcxproj.filters
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="pch.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="EtwTrace.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="EtwTrace.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
5
src/common/Telemetry/EtwTrace/packages.config
Normal file
5
src/common/Telemetry/EtwTrace/packages.config
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Microsoft.Windows.CppWinRT" version="2.0.240111.5" targetFramework="native" />
|
||||||
|
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.231216.1" targetFramework="native" />
|
||||||
|
</packages>
|
||||||
5
src/common/Telemetry/EtwTrace/pch.cpp
Normal file
5
src/common/Telemetry/EtwTrace/pch.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// pch.cpp: source file corresponding to the pre-compiled header
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
||||||
23
src/common/Telemetry/EtwTrace/pch.h
Normal file
23
src/common/Telemetry/EtwTrace/pch.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// pch.h: This is a precompiled header file.
|
||||||
|
// Files listed below are compiled only once, improving build performance for future builds.
|
||||||
|
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||||
|
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||||
|
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||||
|
|
||||||
|
#ifndef PCH_H
|
||||||
|
#define PCH_H
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <ShlObj.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
|
#include <winrt/base.h>
|
||||||
|
|
||||||
|
#endif //PCH_H
|
||||||
63
src/common/Telemetry/TraceBase.h
Normal file
63
src/common/Telemetry/TraceBase.h
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ProjectTelemetry.h"
|
||||||
|
|
||||||
|
#define TraceLoggingWriteWrapper(provider, eventName, ...) \
|
||||||
|
if (IsDataDiagnosticsEnabled()) \
|
||||||
|
{ \
|
||||||
|
TraceLoggingWrite(provider, eventName, __VA_ARGS__); \
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace telemetry
|
||||||
|
{
|
||||||
|
|
||||||
|
constexpr inline const wchar_t* DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys";
|
||||||
|
constexpr inline const wchar_t* DataDiagnosticsRegValueName = L"AllowDataDiagnostics";
|
||||||
|
|
||||||
|
class TraceBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void RegisterProvider()
|
||||||
|
{
|
||||||
|
TraceLoggingRegister(g_hProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UnregisterProvider()
|
||||||
|
{
|
||||||
|
TraceLoggingUnregister(g_hProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool IsDataDiagnosticsEnabled()
|
||||||
|
{
|
||||||
|
HKEY key{};
|
||||||
|
if (RegOpenKeyExW(HKEY_CURRENT_USER,
|
||||||
|
DataDiagnosticsRegKey,
|
||||||
|
0,
|
||||||
|
KEY_READ,
|
||||||
|
&key) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD isDataDiagnosticsEnabled = 0;
|
||||||
|
DWORD size = sizeof(isDataDiagnosticsEnabled);
|
||||||
|
|
||||||
|
if (RegGetValueW(
|
||||||
|
HKEY_CURRENT_USER,
|
||||||
|
DataDiagnosticsRegKey,
|
||||||
|
DataDiagnosticsRegValueName,
|
||||||
|
RRF_RT_REG_DWORD,
|
||||||
|
nullptr,
|
||||||
|
&isDataDiagnosticsEnabled,
|
||||||
|
&size) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegCloseKey(key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
RegCloseKey(key);
|
||||||
|
|
||||||
|
return isDataDiagnosticsEnabled;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace telemetry
|
||||||
@@ -4,3 +4,4 @@
|
|||||||
#define ProjectTelemetryPrivacyDataTag(tag) TraceLoggingUInt64((tag), "Ignore")
|
#define ProjectTelemetryPrivacyDataTag(tag) TraceLoggingUInt64((tag), "Ignore")
|
||||||
#define ProjectTelemetryTag_ProductAndServicePerformance 0x0u
|
#define ProjectTelemetryTag_ProductAndServicePerformance 0x0u
|
||||||
#define PROJECT_KEYWORD_MEASURE 0x0
|
#define PROJECT_KEYWORD_MEASURE 0x0
|
||||||
|
#define MICROSOFT_EVENTTAG_DROP_PII 0x02000000
|
||||||
@@ -51,6 +51,10 @@ namespace winrt::PowerToys::Interop::implementation
|
|||||||
{
|
{
|
||||||
return CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT;
|
return CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT;
|
||||||
}
|
}
|
||||||
|
hstring Constants::TerminateColorPickerSharedEvent()
|
||||||
|
{
|
||||||
|
return CommonSharedConstants::TERMINATE_COLOR_PICKER_SHARED_EVENT;
|
||||||
|
}
|
||||||
hstring Constants::AdvancedPasteShowUIMessage()
|
hstring Constants::AdvancedPasteShowUIMessage()
|
||||||
{
|
{
|
||||||
return CommonSharedConstants::ADVANCED_PASTE_SHOW_UI_MESSAGE;
|
return CommonSharedConstants::ADVANCED_PASTE_SHOW_UI_MESSAGE;
|
||||||
@@ -67,10 +71,18 @@ namespace winrt::PowerToys::Interop::implementation
|
|||||||
{
|
{
|
||||||
return CommonSharedConstants::ADVANCED_PASTE_CUSTOM_ACTION_MESSAGE;
|
return CommonSharedConstants::ADVANCED_PASTE_CUSTOM_ACTION_MESSAGE;
|
||||||
}
|
}
|
||||||
|
hstring Constants::AdvancedPasteTerminateAppMessage()
|
||||||
|
{
|
||||||
|
return CommonSharedConstants::ADVANCED_PASTE_TERMINATE_APP_MESSAGE;
|
||||||
|
}
|
||||||
hstring Constants::ShowPowerOCRSharedEvent()
|
hstring Constants::ShowPowerOCRSharedEvent()
|
||||||
{
|
{
|
||||||
return CommonSharedConstants::SHOW_POWEROCR_SHARED_EVENT;
|
return CommonSharedConstants::SHOW_POWEROCR_SHARED_EVENT;
|
||||||
}
|
}
|
||||||
|
hstring Constants::TerminatePowerOCRSharedEvent()
|
||||||
|
{
|
||||||
|
return CommonSharedConstants::TERMINATE_POWEROCR_SHARED_EVENT;
|
||||||
|
}
|
||||||
hstring Constants::MouseJumpShowPreviewEvent()
|
hstring Constants::MouseJumpShowPreviewEvent()
|
||||||
{
|
{
|
||||||
return CommonSharedConstants::MOUSE_JUMP_SHOW_PREVIEW_EVENT;
|
return CommonSharedConstants::MOUSE_JUMP_SHOW_PREVIEW_EVENT;
|
||||||
@@ -83,6 +95,10 @@ namespace winrt::PowerToys::Interop::implementation
|
|||||||
{
|
{
|
||||||
return CommonSharedConstants::SHOW_PEEK_SHARED_EVENT;
|
return CommonSharedConstants::SHOW_PEEK_SHARED_EVENT;
|
||||||
}
|
}
|
||||||
|
hstring Constants::TerminatePeekEvent()
|
||||||
|
{
|
||||||
|
return CommonSharedConstants::TERMINATE_PEEK_SHARED_EVENT;
|
||||||
|
}
|
||||||
hstring Constants::PowerAccentExitEvent()
|
hstring Constants::PowerAccentExitEvent()
|
||||||
{
|
{
|
||||||
return CommonSharedConstants::POWERACCENT_EXIT_EVENT;
|
return CommonSharedConstants::POWERACCENT_EXIT_EVENT;
|
||||||
@@ -131,6 +147,10 @@ namespace winrt::PowerToys::Interop::implementation
|
|||||||
{
|
{
|
||||||
return CommonSharedConstants::SHOW_HOSTS_ADMIN_EVENT;
|
return CommonSharedConstants::SHOW_HOSTS_ADMIN_EVENT;
|
||||||
}
|
}
|
||||||
|
hstring Constants::TerminateHostsSharedEvent()
|
||||||
|
{
|
||||||
|
return CommonSharedConstants::TERMINATE_HOSTS_EVENT;
|
||||||
|
}
|
||||||
hstring Constants::CropAndLockThumbnailEvent()
|
hstring Constants::CropAndLockThumbnailEvent()
|
||||||
{
|
{
|
||||||
return CommonSharedConstants::CROP_AND_LOCK_THUMBNAIL_EVENT;
|
return CommonSharedConstants::CROP_AND_LOCK_THUMBNAIL_EVENT;
|
||||||
@@ -155,4 +175,8 @@ namespace winrt::PowerToys::Interop::implementation
|
|||||||
{
|
{
|
||||||
return CommonSharedConstants::WORKSPACES_HOTKEY_EVENT;
|
return CommonSharedConstants::WORKSPACES_HOTKEY_EVENT;
|
||||||
}
|
}
|
||||||
|
hstring Constants::PowerToysRunnerTerminateSettingsEvent()
|
||||||
|
{
|
||||||
|
return CommonSharedConstants::TERMINATE_SETTINGS_SHARED_EVENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,18 @@ namespace winrt::PowerToys::Interop::implementation
|
|||||||
static hstring FZEToggleEvent();
|
static hstring FZEToggleEvent();
|
||||||
static hstring ColorPickerSendSettingsTelemetryEvent();
|
static hstring ColorPickerSendSettingsTelemetryEvent();
|
||||||
static hstring ShowColorPickerSharedEvent();
|
static hstring ShowColorPickerSharedEvent();
|
||||||
|
static hstring TerminateColorPickerSharedEvent();
|
||||||
static hstring AdvancedPasteShowUIMessage();
|
static hstring AdvancedPasteShowUIMessage();
|
||||||
static hstring AdvancedPasteMarkdownMessage();
|
static hstring AdvancedPasteMarkdownMessage();
|
||||||
static hstring AdvancedPasteJsonMessage();
|
static hstring AdvancedPasteJsonMessage();
|
||||||
static hstring AdvancedPasteCustomActionMessage();
|
static hstring AdvancedPasteCustomActionMessage();
|
||||||
|
static hstring AdvancedPasteTerminateAppMessage();
|
||||||
static hstring ShowPowerOCRSharedEvent();
|
static hstring ShowPowerOCRSharedEvent();
|
||||||
|
static hstring TerminatePowerOCRSharedEvent();
|
||||||
static hstring MouseJumpShowPreviewEvent();
|
static hstring MouseJumpShowPreviewEvent();
|
||||||
static hstring AwakeExitEvent();
|
static hstring AwakeExitEvent();
|
||||||
static hstring ShowPeekEvent();
|
static hstring ShowPeekEvent();
|
||||||
|
static hstring TerminatePeekEvent();
|
||||||
static hstring PowerAccentExitEvent();
|
static hstring PowerAccentExitEvent();
|
||||||
static hstring ShortcutGuideTriggerEvent();
|
static hstring ShortcutGuideTriggerEvent();
|
||||||
static hstring RegistryPreviewTriggerEvent();
|
static hstring RegistryPreviewTriggerEvent();
|
||||||
@@ -36,12 +40,14 @@ namespace winrt::PowerToys::Interop::implementation
|
|||||||
static hstring SvgPreviewResizeEvent();
|
static hstring SvgPreviewResizeEvent();
|
||||||
static hstring ShowHostsSharedEvent();
|
static hstring ShowHostsSharedEvent();
|
||||||
static hstring ShowHostsAdminSharedEvent();
|
static hstring ShowHostsAdminSharedEvent();
|
||||||
|
static hstring TerminateHostsSharedEvent();
|
||||||
static hstring CropAndLockThumbnailEvent();
|
static hstring CropAndLockThumbnailEvent();
|
||||||
static hstring CropAndLockReparentEvent();
|
static hstring CropAndLockReparentEvent();
|
||||||
static hstring ShowEnvironmentVariablesSharedEvent();
|
static hstring ShowEnvironmentVariablesSharedEvent();
|
||||||
static hstring ShowEnvironmentVariablesAdminSharedEvent();
|
static hstring ShowEnvironmentVariablesAdminSharedEvent();
|
||||||
static hstring WorkspacesLaunchEditorEvent();
|
static hstring WorkspacesLaunchEditorEvent();
|
||||||
static hstring WorkspacesHotkeyEvent();
|
static hstring WorkspacesHotkeyEvent();
|
||||||
|
static hstring PowerToysRunnerTerminateSettingsEvent();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,14 +13,18 @@ namespace PowerToys
|
|||||||
static String FZEToggleEvent();
|
static String FZEToggleEvent();
|
||||||
static String ColorPickerSendSettingsTelemetryEvent();
|
static String ColorPickerSendSettingsTelemetryEvent();
|
||||||
static String ShowColorPickerSharedEvent();
|
static String ShowColorPickerSharedEvent();
|
||||||
|
static String TerminateColorPickerSharedEvent();
|
||||||
static String AdvancedPasteShowUIMessage();
|
static String AdvancedPasteShowUIMessage();
|
||||||
static String AdvancedPasteMarkdownMessage();
|
static String AdvancedPasteMarkdownMessage();
|
||||||
static String AdvancedPasteJsonMessage();
|
static String AdvancedPasteJsonMessage();
|
||||||
static String AdvancedPasteCustomActionMessage();
|
static String AdvancedPasteCustomActionMessage();
|
||||||
|
static String AdvancedPasteTerminateAppMessage();
|
||||||
static String ShowPowerOCRSharedEvent();
|
static String ShowPowerOCRSharedEvent();
|
||||||
|
static String TerminatePowerOCRSharedEvent();
|
||||||
static String MouseJumpShowPreviewEvent();
|
static String MouseJumpShowPreviewEvent();
|
||||||
static String AwakeExitEvent();
|
static String AwakeExitEvent();
|
||||||
static String ShowPeekEvent();
|
static String ShowPeekEvent();
|
||||||
|
static String TerminatePeekEvent();
|
||||||
static String PowerAccentExitEvent();
|
static String PowerAccentExitEvent();
|
||||||
static String ShortcutGuideTriggerEvent();
|
static String ShortcutGuideTriggerEvent();
|
||||||
static String RegistryPreviewTriggerEvent();
|
static String RegistryPreviewTriggerEvent();
|
||||||
@@ -33,12 +37,14 @@ namespace PowerToys
|
|||||||
static String SvgPreviewResizeEvent();
|
static String SvgPreviewResizeEvent();
|
||||||
static String ShowHostsSharedEvent();
|
static String ShowHostsSharedEvent();
|
||||||
static String ShowHostsAdminSharedEvent();
|
static String ShowHostsAdminSharedEvent();
|
||||||
|
static String TerminateHostsSharedEvent();
|
||||||
static String CropAndLockThumbnailEvent();
|
static String CropAndLockThumbnailEvent();
|
||||||
static String CropAndLockReparentEvent();
|
static String CropAndLockReparentEvent();
|
||||||
static String ShowEnvironmentVariablesSharedEvent();
|
static String ShowEnvironmentVariablesSharedEvent();
|
||||||
static String ShowEnvironmentVariablesAdminSharedEvent();
|
static String ShowEnvironmentVariablesAdminSharedEvent();
|
||||||
static String WorkspacesLaunchEditorEvent();
|
static String WorkspacesLaunchEditorEvent();
|
||||||
static String WorkspacesHotkeyEvent();
|
static String WorkspacesHotkeyEvent();
|
||||||
|
static String PowerToysRunnerTerminateSettingsEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,9 @@ namespace CommonSharedConstants
|
|||||||
|
|
||||||
const wchar_t APPDATA_PATH[] = L"Microsoft\\PowerToys";
|
const wchar_t APPDATA_PATH[] = L"Microsoft\\PowerToys";
|
||||||
|
|
||||||
|
// Path to the event used by runner to terminate Settings app
|
||||||
|
const wchar_t TERMINATE_SETTINGS_SHARED_EVENT[] = L"Local\\PowerToysRunnerTerminateSettingsEvent-c34cb661-2e69-4613-a1f8-4e39c25d7ef6";
|
||||||
|
|
||||||
// Path to the event used by PowerLauncher
|
// Path to the event used by PowerLauncher
|
||||||
const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab";
|
const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab";
|
||||||
|
|
||||||
@@ -34,9 +37,13 @@ namespace CommonSharedConstants
|
|||||||
|
|
||||||
const wchar_t ADVANCED_PASTE_CUSTOM_ACTION_MESSAGE[] = L"CustomAction";
|
const wchar_t ADVANCED_PASTE_CUSTOM_ACTION_MESSAGE[] = L"CustomAction";
|
||||||
|
|
||||||
|
const wchar_t ADVANCED_PASTE_TERMINATE_APP_MESSAGE[] = L"TerminateApp";
|
||||||
|
|
||||||
// Path to the event used to show Color Picker
|
// Path to the event used to show Color Picker
|
||||||
const wchar_t SHOW_COLOR_PICKER_SHARED_EVENT[] = L"Local\\ShowColorPickerEvent-8c46be2a-3e05-4186-b56b-4ae986ef2525";
|
const wchar_t SHOW_COLOR_PICKER_SHARED_EVENT[] = L"Local\\ShowColorPickerEvent-8c46be2a-3e05-4186-b56b-4ae986ef2525";
|
||||||
|
|
||||||
|
const wchar_t TERMINATE_COLOR_PICKER_SHARED_EVENT[] = L"Local\\TerminateColorPickerEvent-3d676258-c4d5-424e-a87a-4be22020e813";
|
||||||
|
|
||||||
const wchar_t SHORTCUT_GUIDE_TRIGGER_EVENT[] = L"Local\\ShortcutGuide-TriggerEvent-d4275ad3-2531-4d19-9252-c0becbd9b496";
|
const wchar_t SHORTCUT_GUIDE_TRIGGER_EVENT[] = L"Local\\ShortcutGuide-TriggerEvent-d4275ad3-2531-4d19-9252-c0becbd9b496";
|
||||||
|
|
||||||
const wchar_t SHORTCUT_GUIDE_EXIT_EVENT[] = L"Local\\ShortcutGuide-ExitEvent-35697cdd-a3d2-47d6-a246-34efcc73eac0";
|
const wchar_t SHORTCUT_GUIDE_EXIT_EVENT[] = L"Local\\ShortcutGuide-ExitEvent-35697cdd-a3d2-47d6-a246-34efcc73eac0";
|
||||||
@@ -51,18 +58,24 @@ namespace CommonSharedConstants
|
|||||||
|
|
||||||
const wchar_t SHOW_HOSTS_ADMIN_EVENT[] = L"Local\\Hosts-ShowHostsAdminEvent-60ff44e2-efd3-43bf-928a-f4d269f98bec";
|
const wchar_t SHOW_HOSTS_ADMIN_EVENT[] = L"Local\\Hosts-ShowHostsAdminEvent-60ff44e2-efd3-43bf-928a-f4d269f98bec";
|
||||||
|
|
||||||
|
const wchar_t TERMINATE_HOSTS_EVENT[] = L"Local\\Hosts-TerminateHostsEvent-d5410d5e-45a6-4d11-bbf0-a4ec2d064888";
|
||||||
|
|
||||||
// Path to the event used by Awake
|
// Path to the event used by Awake
|
||||||
const wchar_t AWAKE_EXIT_EVENT[] = L"Local\\PowerToysAwakeExitEvent-c0d5e305-35fc-4fb5-83ec-f6070cfaf7fe";
|
const wchar_t AWAKE_EXIT_EVENT[] = L"Local\\PowerToysAwakeExitEvent-c0d5e305-35fc-4fb5-83ec-f6070cfaf7fe";
|
||||||
|
|
||||||
// Path to the event used by AlwaysOnTop
|
// Path to the event used by AlwaysOnTop
|
||||||
const wchar_t ALWAYS_ON_TOP_PIN_EVENT[] = L"Local\\AlwaysOnTopPinEvent-892e0aa2-cfa8-4cc4-b196-ddeb32314ce8";
|
const wchar_t ALWAYS_ON_TOP_PIN_EVENT[] = L"Local\\AlwaysOnTopPinEvent-892e0aa2-cfa8-4cc4-b196-ddeb32314ce8";
|
||||||
|
|
||||||
|
const wchar_t ALWAYS_ON_TOP_TERMINATE_EVENT[] = L"Local\\AlwaysOnTopTerminateEvent-cfdf1eae-791f-4953-8021-2f18f3837eae";
|
||||||
|
|
||||||
// Path to the event used by PowerAccent
|
// Path to the event used by PowerAccent
|
||||||
const wchar_t POWERACCENT_EXIT_EVENT[] = L"Local\\PowerToysPowerAccentExitEvent-53e93389-d19a-4fbb-9b36-1981c8965e17";
|
const wchar_t POWERACCENT_EXIT_EVENT[] = L"Local\\PowerToysPowerAccentExitEvent-53e93389-d19a-4fbb-9b36-1981c8965e17";
|
||||||
|
|
||||||
// Path to the event used by PowerOCR
|
// Path to the event used by PowerOCR
|
||||||
const wchar_t SHOW_POWEROCR_SHARED_EVENT[] = L"Local\\PowerOCREvent-dc864e06-e1af-4ecc-9078-f98bee745e3a";
|
const wchar_t SHOW_POWEROCR_SHARED_EVENT[] = L"Local\\PowerOCREvent-dc864e06-e1af-4ecc-9078-f98bee745e3a";
|
||||||
|
|
||||||
|
const wchar_t TERMINATE_POWEROCR_SHARED_EVENT[] = L"Local\\TerminatePowerOCREvent-08e5de9d-15df-4ea8-8840-487c13435a67";
|
||||||
|
|
||||||
// Path to the events used by Mouse Jump
|
// Path to the events used by Mouse Jump
|
||||||
const wchar_t MOUSE_JUMP_SHOW_PREVIEW_EVENT[] = L"Local\\MouseJumpEvent-aa0be051-3396-4976-b7ba-1a9cc7d236a5";
|
const wchar_t MOUSE_JUMP_SHOW_PREVIEW_EVENT[] = L"Local\\MouseJumpEvent-aa0be051-3396-4976-b7ba-1a9cc7d236a5";
|
||||||
|
|
||||||
@@ -92,6 +105,11 @@ namespace CommonSharedConstants
|
|||||||
|
|
||||||
// Path to the event used to show Peek
|
// Path to the event used to show Peek
|
||||||
const wchar_t SHOW_PEEK_SHARED_EVENT[] = L"Local\\ShowPeekEvent";
|
const wchar_t SHOW_PEEK_SHARED_EVENT[] = L"Local\\ShowPeekEvent";
|
||||||
|
// Path to the event used to terminate Peek
|
||||||
|
const wchar_t TERMINATE_PEEK_SHARED_EVENT[] = L"Local\\TerminatePeekEvent-267149fe-7ed2-427d-a3ad-9e18203c037c";
|
||||||
|
|
||||||
|
// Path to the event used to terminate KBM
|
||||||
|
const wchar_t TERMINATE_KBM_SHARED_EVENT[] = L"Local\\TerminateKBMSharedEvent-a787c967-55b6-47de-94d9-56f39fed839e";
|
||||||
|
|
||||||
// Path to the events used by CropAndLock
|
// Path to the events used by CropAndLock
|
||||||
const wchar_t CROP_AND_LOCK_REPARENT_EVENT[] = L"Local\\PowerToysCropAndLockReparentEvent-6060860a-76a1-44e8-8d0e-6355785e9c36";
|
const wchar_t CROP_AND_LOCK_REPARENT_EVENT[] = L"Local\\PowerToysCropAndLockReparentEvent-6060860a-76a1-44e8-8d0e-6355785e9c36";
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ namespace powertoys_gpo {
|
|||||||
|
|
||||||
// The registry value names for other PowerToys policies.
|
// The registry value names for other PowerToys policies.
|
||||||
const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation";
|
const std::wstring POLICY_ALLOW_EXPERIMENTATION = L"AllowExperimentation";
|
||||||
|
const std::wstring POLICY_ALLOW_DATA_DIAGNOSTICS = L"AllowDataDiagnostics";
|
||||||
const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState";
|
const std::wstring POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER_ALL_PLUGINS = L"PowerLauncherAllPluginsEnabledState";
|
||||||
const std::wstring POLICY_ALLOW_ADVANCED_PASTE_ONLINE_AI_MODELS = L"AllowPowerToysAdvancedPasteOnlineAIModels";
|
const std::wstring POLICY_ALLOW_ADVANCED_PASTE_ONLINE_AI_MODELS = L"AllowPowerToysAdvancedPasteOnlineAIModels";
|
||||||
const std::wstring POLICY_MWB_CLIPBOARD_SHARING_ENABLED = L"MwbClipboardSharingEnabled";
|
const std::wstring POLICY_MWB_CLIPBOARD_SHARING_ENABLED = L"MwbClipboardSharingEnabled";
|
||||||
@@ -487,6 +488,11 @@ namespace powertoys_gpo {
|
|||||||
return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION);
|
return getConfiguredValue(POLICY_ALLOW_EXPERIMENTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline gpo_rule_configured_t getAllowDataDiagnosticsValue()
|
||||||
|
{
|
||||||
|
return getConfiguredValue(POLICY_ALLOW_DATA_DIAGNOSTICS);
|
||||||
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID)
|
inline gpo_rule_configured_t getRunPluginEnabledValue(std::string pluginID)
|
||||||
{
|
{
|
||||||
if (pluginID == "" || pluginID == " ")
|
if (pluginID == "" || pluginID == " ")
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<policyNamespaces>
|
<policyNamespaces>
|
||||||
<target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" />
|
<target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" />
|
||||||
</policyNamespaces>
|
</policyNamespaces>
|
||||||
<resources minRequiredRevision="1.13"/><!-- Last changed with PowerToys v0.85.0 -->
|
<resources minRequiredRevision="1.14"/><!-- Last changed with PowerToys v0.86.0 -->
|
||||||
<supportedOn>
|
<supportedOn>
|
||||||
<definitions>
|
<definitions>
|
||||||
<definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/>
|
<definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/>
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
<definition name="SUPPORTED_POWERTOYS_0_83_0" displayName="$(string.SUPPORTED_POWERTOYS_0_83_0)"/>
|
<definition name="SUPPORTED_POWERTOYS_0_83_0" displayName="$(string.SUPPORTED_POWERTOYS_0_83_0)"/>
|
||||||
<definition name="SUPPORTED_POWERTOYS_0_84_0" displayName="$(string.SUPPORTED_POWERTOYS_0_84_0)"/>
|
<definition name="SUPPORTED_POWERTOYS_0_84_0" displayName="$(string.SUPPORTED_POWERTOYS_0_84_0)"/>
|
||||||
<definition name="SUPPORTED_POWERTOYS_0_85_0" displayName="$(string.SUPPORTED_POWERTOYS_0_85_0)"/>
|
<definition name="SUPPORTED_POWERTOYS_0_85_0" displayName="$(string.SUPPORTED_POWERTOYS_0_85_0)"/>
|
||||||
|
<definition name="SUPPORTED_POWERTOYS_0_86_0" displayName="$(string.SUPPORTED_POWERTOYS_0_86_0)"/>
|
||||||
</definitions>
|
</definitions>
|
||||||
</supportedOn>
|
</supportedOn>
|
||||||
<categories>
|
<categories>
|
||||||
@@ -509,6 +510,16 @@
|
|||||||
<decimal value="0" />
|
<decimal value="0" />
|
||||||
</disabledValue>
|
</disabledValue>
|
||||||
</policy>
|
</policy>
|
||||||
|
<policy name="AllowDiagnosticData" class="Both" displayName="$(string.AllowDiagnosticData)" explainText="$(string.AllowDiagnosticDataDescription)" key="Software\Policies\PowerToys" valueName="AllowDataDiagnostics">
|
||||||
|
<parentCategory ref="GeneralSettings" />
|
||||||
|
<supportedOn ref="SUPPORTED_POWERTOYS_0_86_0" />
|
||||||
|
<enabledValue>
|
||||||
|
<decimal value="1" />
|
||||||
|
</enabledValue>
|
||||||
|
<disabledValue>
|
||||||
|
<decimal value="0" />
|
||||||
|
</disabledValue>
|
||||||
|
</policy>
|
||||||
<policy name="PowerToysRunAllPluginsEnabledState" class="Both" displayName="$(string.PowerToysRunAllPluginsEnabledState)" explainText="$(string.PowerToysRunAllPluginsEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="PowerLauncherAllPluginsEnabledState">
|
<policy name="PowerToysRunAllPluginsEnabledState" class="Both" displayName="$(string.PowerToysRunAllPluginsEnabledState)" explainText="$(string.PowerToysRunAllPluginsEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="PowerLauncherAllPluginsEnabledState">
|
||||||
<parentCategory ref="PowerToysRun" />
|
<parentCategory ref="PowerToysRun" />
|
||||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" />
|
<supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright (c) Microsoft Corporation.
|
<!-- Copyright (c) Microsoft Corporation.
|
||||||
Licensed under the MIT License. -->
|
Licensed under the MIT License. -->
|
||||||
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.13" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.14" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
||||||
<displayName>PowerToys</displayName>
|
<displayName>PowerToys</displayName>
|
||||||
<description>PowerToys</description>
|
<description>PowerToys</description>
|
||||||
<resources>
|
<resources>
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
<string id="SUPPORTED_POWERTOYS_0_83_0">PowerToys version 0.83.0 or later</string>
|
<string id="SUPPORTED_POWERTOYS_0_83_0">PowerToys version 0.83.0 or later</string>
|
||||||
<string id="SUPPORTED_POWERTOYS_0_84_0">PowerToys version 0.84.0 or later</string>
|
<string id="SUPPORTED_POWERTOYS_0_84_0">PowerToys version 0.84.0 or later</string>
|
||||||
<string id="SUPPORTED_POWERTOYS_0_85_0">PowerToys version 0.85.0 or later</string>
|
<string id="SUPPORTED_POWERTOYS_0_85_0">PowerToys version 0.85.0 or later</string>
|
||||||
|
<string id="SUPPORTED_POWERTOYS_0_86_0">PowerToys version 0.86.0 or later</string>
|
||||||
|
|
||||||
<string id="ConfigureAllUtilityGlobalEnabledStateDescription">This policy configures the enabled state for all PowerToys utilities.
|
<string id="ConfigureAllUtilityGlobalEnabledStateDescription">This policy configures the enabled state for all PowerToys utilities.
|
||||||
|
|
||||||
@@ -101,6 +102,12 @@ If disabled or not configured, the user can control this in the settings of Powe
|
|||||||
If this setting is enabled or not configured, the user can control experimentation in the PowerToys settings menu.
|
If this setting is enabled or not configured, the user can control experimentation in the PowerToys settings menu.
|
||||||
|
|
||||||
If this setting is disabled, experimentation is not allowed.
|
If this setting is disabled, experimentation is not allowed.
|
||||||
|
</string>
|
||||||
|
<string id="AllowDiagnosticDataDescription">This policy configures whether sending of PowerToys diagnostic data is allowed. With diagnostic data sending allowed the user helps inform bug fixes, performance and improvements.
|
||||||
|
|
||||||
|
If this setting is enabled or not configured, the user can control diagnostic data sending in the PowerToys settings menu.
|
||||||
|
|
||||||
|
If this setting is disabled, diagnostic data sending is not allowed.
|
||||||
</string>
|
</string>
|
||||||
<string id="PowerToysRunAllPluginsEnabledStateDescription">This policy configures the enabled state for all PowerToys Run plugins. All plugins will have the same state.
|
<string id="PowerToysRunAllPluginsEnabledStateDescription">This policy configures the enabled state for all PowerToys Run plugins. All plugins will have the same state.
|
||||||
|
|
||||||
@@ -258,6 +265,8 @@ If you don't configure this policy, the user takes control over the setting and
|
|||||||
<string id="MwbDisableUserDefinedIpMappingRules">Disable user defined IP Address mapping rules</string>
|
<string id="MwbDisableUserDefinedIpMappingRules">Disable user defined IP Address mapping rules</string>
|
||||||
<string id="MwbPolicyDefinedIpMappingRules">Predefined IP Address mapping rules</string>
|
<string id="MwbPolicyDefinedIpMappingRules">Predefined IP Address mapping rules</string>
|
||||||
<string id="NewPlusHideTemplateFilenameExtension">Hide template filename extension</string>
|
<string id="NewPlusHideTemplateFilenameExtension">Hide template filename extension</string>
|
||||||
|
<string id="AllowPowerToysAdvancedPasteOnlineAIModels">Advanced Paste: Allow using online AI models</string>
|
||||||
|
<string id="AllowDiagnosticData">Allow sending diagnostic data</string>
|
||||||
</stringTable>
|
</stringTable>
|
||||||
|
|
||||||
<presentationTable>
|
<presentationTable>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using AdvancedPaste.ViewModels;
|
|||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.PowerToys.Telemetry;
|
||||||
using Microsoft.UI.Windowing;
|
using Microsoft.UI.Windowing;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Windows.Graphics;
|
using Windows.Graphics;
|
||||||
@@ -34,6 +35,8 @@ namespace AdvancedPaste
|
|||||||
{
|
{
|
||||||
public IHost Host { get; private set; }
|
public IHost Host { get; private set; }
|
||||||
|
|
||||||
|
public ETWTrace EtwTrace { get; private set; } = new ETWTrace();
|
||||||
|
|
||||||
private readonly DispatcherQueue _dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
private readonly DispatcherQueue _dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
||||||
private readonly OptionsViewModel viewModel;
|
private readonly OptionsViewModel viewModel;
|
||||||
|
|
||||||
@@ -58,6 +61,8 @@ namespace AdvancedPaste
|
|||||||
|
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
|
||||||
|
EtwTrace.Start();
|
||||||
|
|
||||||
Host = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder().UseContentRoot(AppContext.BaseDirectory).ConfigureServices((context, services) =>
|
Host = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder().UseContentRoot(AppContext.BaseDirectory).ConfigureServices((context, services) =>
|
||||||
{
|
{
|
||||||
services.AddSingleton<OptionsViewModel>();
|
services.AddSingleton<OptionsViewModel>();
|
||||||
@@ -98,6 +103,7 @@ namespace AdvancedPaste
|
|||||||
{
|
{
|
||||||
RunnerHelper.WaitForPowerToysRunner(powerToysRunnerPid, () =>
|
RunnerHelper.WaitForPowerToysRunner(powerToysRunnerPid, () =>
|
||||||
{
|
{
|
||||||
|
Dispose();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -141,6 +147,11 @@ namespace AdvancedPaste
|
|||||||
{
|
{
|
||||||
OnAdvancedPasteCustomActionHotkey(messageParts);
|
OnAdvancedPasteCustomActionHotkey(messageParts);
|
||||||
}
|
}
|
||||||
|
else if (messageType == PowerToys.Interop.Constants.AdvancedPasteTerminateAppMessage())
|
||||||
|
{
|
||||||
|
Dispose();
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
|
private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
|
||||||
@@ -229,6 +240,7 @@ namespace AdvancedPaste
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
|
EtwTrace?.Dispose();
|
||||||
window.Dispose();
|
window.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using AdvancedPaste.Helpers;
|
|||||||
using AdvancedPaste.Settings;
|
using AdvancedPaste.Settings;
|
||||||
using AdvancedPaste.ViewModels;
|
using AdvancedPaste.ViewModels;
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
|
using Microsoft.PowerToys.Telemetry;
|
||||||
using Microsoft.UI.Windowing;
|
using Microsoft.UI.Windowing;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using WinUIEx;
|
using WinUIEx;
|
||||||
@@ -85,6 +86,7 @@ namespace AdvancedPaste
|
|||||||
if (!_disposedValue)
|
if (!_disposedValue)
|
||||||
{
|
{
|
||||||
_msgMonitor?.Dispose();
|
_msgMonitor?.Dispose();
|
||||||
|
(Application.Current as App).EtwTrace?.Dispose();
|
||||||
|
|
||||||
_disposedValue = true;
|
_disposedValue = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -763,6 +763,9 @@ public:
|
|||||||
Logger::trace("AdvancedPaste::disable()");
|
Logger::trace("AdvancedPaste::disable()");
|
||||||
if (m_enabled)
|
if (m_enabled)
|
||||||
{
|
{
|
||||||
|
send_named_pipe_message(CommonSharedConstants::ADVANCED_PASTE_TERMINATE_APP_MESSAGE);
|
||||||
|
WaitForSingleObject(m_hProcess, 1000);
|
||||||
|
|
||||||
m_write_pipe = nullptr;
|
m_write_pipe = nullptr;
|
||||||
|
|
||||||
TerminateProcess(m_hProcess, 1);
|
TerminateProcess(m_hProcess, 1);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winrt/Windows.Foundation.h>
|
#include <winrt/Windows.Foundation.h>
|
||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
@@ -8,46 +8,39 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider()
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider()
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log if the user has AdvancedPaste enabled or disabled
|
// Log if the user has AdvancedPaste enabled or disabled
|
||||||
void Trace::AdvancedPaste_Enable(const bool enabled) noexcept
|
void Trace::AdvancedPaste_Enable(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"AdvancedPaste_EnableAdvancedPaste",
|
"AdvancedPaste_EnableAdvancedPaste",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log if the user has invoked AdvancedPaste
|
// Log if the user has invoked AdvancedPaste
|
||||||
void Trace::AdvancedPaste_Invoked(std::wstring mode) noexcept
|
void Trace::AdvancedPaste_Invoked(std::wstring mode) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"AdvancedPaste_InvokeAdvancedPaste",
|
"AdvancedPaste_InvokeAdvancedPaste",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingValue(mode.c_str(), "Mode"));
|
TraceLoggingValue(mode.c_str(), "Mode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log if an error occurs in AdvancedPaste
|
// Log if an error occurs in AdvancedPaste
|
||||||
void Trace::AdvancedPaste_Error(const DWORD errorCode, std::wstring errorMessage, std::wstring methodName) noexcept
|
void Trace::AdvancedPaste_Error(const DWORD errorCode, std::wstring errorMessage, std::wstring methodName) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"AdvancedPaste_Error",
|
"AdvancedPaste_Error",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingValue(methodName.c_str(), "MethodName"),
|
TraceLoggingValue(methodName.c_str(), "MethodName"),
|
||||||
TraceLoggingValue(errorCode, "ErrorCode"),
|
TraceLoggingValue(errorCode, "ErrorCode"),
|
||||||
TraceLoggingValue(errorMessage.c_str(), "ErrorMessage"));
|
TraceLoggingValue(errorMessage.c_str(), "ErrorMessage"));
|
||||||
@@ -88,15 +81,15 @@ void Trace::AdvancedPaste_SettingsTelemetry(const PowertoyModuleIface::Hotkey& p
|
|||||||
std::wstring(pasteJsonHotkey.alt ? L"Alt + " : L"") +
|
std::wstring(pasteJsonHotkey.alt ? L"Alt + " : L"") +
|
||||||
std::wstring(L"VK ") + std::to_wstring(pasteJsonHotkey.key);
|
std::wstring(L"VK ") + std::to_wstring(pasteJsonHotkey.key);
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"AdvancedPaste_Settings",
|
"AdvancedPaste_Settings",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingWideString(pastePlainHotkeyStr.c_str(), "PastePlainHotkey"),
|
TraceLoggingWideString(pastePlainHotkeyStr.c_str(), "PastePlainHotkey"),
|
||||||
TraceLoggingWideString(advancedPasteUIHotkeyStr.c_str(), "AdvancedPasteUIHotkey"),
|
TraceLoggingWideString(advancedPasteUIHotkeyStr.c_str(), "AdvancedPasteUIHotkey"),
|
||||||
TraceLoggingWideString(pasteMarkdownHotkeyStr.c_str(), "PasteMarkdownHotkey"),
|
TraceLoggingWideString(pasteMarkdownHotkeyStr.c_str(), "PasteMarkdownHotkey"),
|
||||||
TraceLoggingWideString(pasteJsonHotkeyStr.c_str(), "PasteJsonHotkey"),
|
TraceLoggingWideString(pasteJsonHotkeyStr.c_str(), "PasteJsonHotkey"),
|
||||||
TraceLoggingBoolean(preview_custom_format_output, "ShowCustomPreview")
|
TraceLoggingBoolean(preview_custom_format_output, "ShowCustomPreview"));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
#include <interface/powertoy_module_interface.h>
|
#include <interface/powertoy_module_interface.h>
|
||||||
|
|
||||||
class Trace
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider();
|
|
||||||
static void UnregisterProvider();
|
|
||||||
|
|
||||||
// Log if the user has AdvancedPaste enabled or disabled
|
// Log if the user has AdvancedPaste enabled or disabled
|
||||||
static void AdvancedPaste_Enable(const bool enabled) noexcept;
|
static void AdvancedPaste_Enable(const bool enabled) noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,9 @@
|
|||||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
||||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\..\common\Telemetry\EtwTrace\EtwTrace.vcxproj">
|
||||||
|
<Project>{8f021b46-362b-485c-bfba-ccf83e820cbd}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<Import Project="..\..\..\..\deps\spdlog.props" />
|
<Import Project="..\..\..\..\deps\spdlog.props" />
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<ClInclude Include="ChildWindow.h" />
|
<ClInclude Include="ChildWindow.h" />
|
||||||
<ClInclude Include="trace.h" />
|
<ClInclude Include="trace.h" />
|
||||||
<ClInclude Include="ModuleConstants.h" />
|
<ClInclude Include="ModuleConstants.h" />
|
||||||
|
<ClInclude Include="DispatcherQueue.desktop.interop.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="CropAndLock.rc" />
|
<ResourceCompile Include="CropAndLock.rc" />
|
||||||
|
|||||||
@@ -4,15 +4,19 @@
|
|||||||
#include "CropAndLockWindow.h"
|
#include "CropAndLockWindow.h"
|
||||||
#include "ThumbnailCropAndLockWindow.h"
|
#include "ThumbnailCropAndLockWindow.h"
|
||||||
#include "ReparentCropAndLockWindow.h"
|
#include "ReparentCropAndLockWindow.h"
|
||||||
#include <common/interop/shared_constants.h>
|
|
||||||
#include <common/utils/winapi_error.h>
|
|
||||||
#include <common/utils/logger_helper.h>
|
|
||||||
#include <common/utils/UnhandledExceptionHandler.h>
|
|
||||||
#include <common/utils/gpo.h>
|
|
||||||
#include "ModuleConstants.h"
|
#include "ModuleConstants.h"
|
||||||
#include <common/utils/ProcessWaiter.h>
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/interop/shared_constants.h>
|
||||||
|
|
||||||
|
#include <common/utils/gpo.h>
|
||||||
|
#include <common/utils/logger_helper.h>
|
||||||
|
#include <common/utils/ProcessWaiter.h>
|
||||||
|
#include <common/utils/UnhandledExceptionHandler.h>
|
||||||
|
#include <common/utils/winapi_error.h>
|
||||||
|
|
||||||
|
#include <common/Telemetry/EtwTrace/EtwTrace.h>
|
||||||
|
|
||||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
|
||||||
namespace winrt
|
namespace winrt
|
||||||
@@ -36,6 +40,9 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
|
|||||||
// Initialize COM
|
// Initialize COM
|
||||||
winrt::init_apartment(winrt::apartment_type::single_threaded);
|
winrt::init_apartment(winrt::apartment_type::single_threaded);
|
||||||
|
|
||||||
|
Shared::Trace::ETWTrace trace;
|
||||||
|
trace.UpdateState(true);
|
||||||
|
|
||||||
// Initialize logger automatic logging of exceptions.
|
// Initialize logger automatic logging of exceptions.
|
||||||
LoggerHelpers::init_logger(NonLocalizable::ModuleKey, L"", LogSettings::cropAndLockLoggerName);
|
LoggerHelpers::init_logger(NonLocalizable::ModuleKey, L"", LogSettings::cropAndLockLoggerName);
|
||||||
InitUnhandledExceptionHandler();
|
InitUnhandledExceptionHandler();
|
||||||
@@ -153,6 +160,7 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
|
|||||||
croppedWindow = std::make_shared<ThumbnailCropAndLockWindow>(title, 800, 600);
|
croppedWindow = std::make_shared<ThumbnailCropAndLockWindow>(title, 800, 600);
|
||||||
Logger::trace(L"Creating a thumbnail window");
|
Logger::trace(L"Creating a thumbnail window");
|
||||||
Trace::CropAndLock::CreateThumbnailWindow();
|
Trace::CropAndLock::CreateThumbnailWindow();
|
||||||
|
Trace::CropAndLock::ActivateThumbnail();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@@ -195,6 +203,7 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_event_triggers_thread = std::thread([&]() {
|
m_event_triggers_thread = std::thread([&]() {
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
HANDLE event_handles[3] = {m_reparent_event_handle, m_thumbnail_event_handle, m_exit_event_handle};
|
HANDLE event_handles[3] = {m_reparent_event_handle, m_thumbnail_event_handle, m_exit_event_handle};
|
||||||
while (m_running)
|
while (m_running)
|
||||||
@@ -258,6 +267,8 @@ int WINAPI wWinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ PWSTR lpCmdLine, _I
|
|||||||
DispatchMessageW(&msg);
|
DispatchMessageW(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace.Flush();
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
// Needed to unblock MsgWaitForMultipleObjects one last time
|
// Needed to unblock MsgWaitForMultipleObjects one last time
|
||||||
SetEvent(m_reparent_event_handle);
|
SetEvent(m_reparent_event_handle);
|
||||||
|
|||||||
@@ -74,7 +74,6 @@
|
|||||||
#include "WindowRectUtil.h"
|
#include "WindowRectUtil.h"
|
||||||
|
|
||||||
// PowerToys
|
// PowerToys
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
|
|
||||||
// Application resources
|
// Application resources
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
// Telemetry strings should not be localized.
|
// Telemetry strings should not be localized.
|
||||||
#define LoggingProviderKey "Microsoft.PowerToys"
|
#define LoggingProviderKey "Microsoft.PowerToys"
|
||||||
|
|
||||||
@@ -11,60 +13,55 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::CropAndLock::Enable(bool enabled) noexcept
|
void Trace::CropAndLock::Enable(bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"CropAndLock_EnableCropAndLock",
|
"CropAndLock_EnableCropAndLock",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::CropAndLock::ActivateReparent() noexcept
|
void Trace::CropAndLock::ActivateReparent() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"CropAndLock_ActivateReparent",
|
"CropAndLock_ActivateReparent",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::CropAndLock::ActivateThumbnail() noexcept
|
void Trace::CropAndLock::ActivateThumbnail() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"CropAndLock_ActivateThumbnail",
|
"CropAndLock_ActivateThumbnail",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::CropAndLock::CreateReparentWindow() noexcept
|
void Trace::CropAndLock::CreateReparentWindow() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"CropAndLock_CreateReparentWindow",
|
"CropAndLock_CreateReparentWindow",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::CropAndLock::CreateThumbnailWindow() noexcept
|
void Trace::CropAndLock::CreateThumbnailWindow() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"CropAndLock_CreateThumbnailWindow",
|
"CropAndLock_CreateThumbnailWindow",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event to send settings telemetry.
|
// Event to send settings telemetry.
|
||||||
@@ -84,12 +81,12 @@ void Trace::CropAndLock::SettingsTelemetry(PowertoyModuleIface::Hotkey& reparent
|
|||||||
std::wstring(thumbnailHotkey.alt ? L"Alt + " : L"") +
|
std::wstring(thumbnailHotkey.alt ? L"Alt + " : L"") +
|
||||||
std::wstring(L"VK ") + std::to_wstring(thumbnailHotkey.key);
|
std::wstring(L"VK ") + std::to_wstring(thumbnailHotkey.key);
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"CropAndLock_Settings",
|
"CropAndLock_Settings",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingWideString(hotKeyStrReparent.c_str(), "ReparentHotKey"),
|
TraceLoggingWideString(hotKeyStrReparent.c_str(), "ReparentHotKey"),
|
||||||
TraceLoggingWideString(hotKeyStrThumbnail.c_str(), "ThumbnailHotkey")
|
TraceLoggingWideString(hotKeyStrThumbnail.c_str(), "ThumbnailHotkey"));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
#include <modules/interface/powertoy_module_interface.h>
|
#include <modules/interface/powertoy_module_interface.h>
|
||||||
|
|
||||||
class Trace
|
class Trace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
class CropAndLock : public telemetry::TraceBase
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
|
|
||||||
class CropAndLock
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Enable(bool enabled) noexcept;
|
static void Enable(bool enabled) noexcept;
|
||||||
|
|||||||
@@ -40,13 +40,13 @@ BOOL APIENTRY DllMain( HMODULE /*hModule*/,
|
|||||||
switch (ul_reason_for_call)
|
switch (ul_reason_for_call)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
Trace::RegisterProvider();
|
Trace::CropAndLock::RegisterProvider();
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_ATTACH:
|
case DLL_THREAD_ATTACH:
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
break;
|
break;
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
Trace::UnregisterProvider();
|
Trace::CropAndLock::UnregisterProvider();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -6,7 +6,5 @@
|
|||||||
#include <winrt/base.h>
|
#include <winrt/base.h>
|
||||||
#include <winrt/Windows.Foundation.h>
|
#include <winrt/Windows.Foundation.h>
|
||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <TraceLoggingActivity.h>
|
|
||||||
#include <wil\common.h>
|
#include <wil\common.h>
|
||||||
#include <wil\result.h>
|
#include <wil\result.h>
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ namespace EnvironmentVariables
|
|||||||
{
|
{
|
||||||
public IHost Host { get; }
|
public IHost Host { get; }
|
||||||
|
|
||||||
|
public ETWTrace EtwTrace { get; } = new ETWTrace();
|
||||||
|
|
||||||
public static T GetService<T>()
|
public static T GetService<T>()
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
@@ -78,6 +80,8 @@ namespace EnvironmentVariables
|
|||||||
/// <param name="args">Details about the launch request and process.</param>
|
/// <param name="args">Details about the launch request and process.</param>
|
||||||
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
|
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
|
EtwTrace.Start();
|
||||||
|
|
||||||
var cmdArgs = Environment.GetCommandLineArgs();
|
var cmdArgs = Environment.GetCommandLineArgs();
|
||||||
if (cmdArgs?.Length > 1)
|
if (cmdArgs?.Length > 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
x:Uid="Window"
|
x:Uid="Window"
|
||||||
MinWidth="700"
|
MinWidth="700"
|
||||||
MinHeight="480"
|
MinHeight="480"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d"
|
||||||
|
Closed="Window_Closed">
|
||||||
<Window.SystemBackdrop>
|
<Window.SystemBackdrop>
|
||||||
<MicaBackdrop />
|
<MicaBackdrop />
|
||||||
</Window.SystemBackdrop>
|
</Window.SystemBackdrop>
|
||||||
|
|||||||
@@ -88,5 +88,10 @@ namespace EnvironmentVariables
|
|||||||
|
|
||||||
return NativeMethods.CallWindowProc(oldWndProc, hWnd, msg, wParam, lParam);
|
return NativeMethods.CallWindowProc(oldWndProc, hWnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Window_Closed(object sender, WindowEventArgs args)
|
||||||
|
{
|
||||||
|
(App.Current as EnvironmentVariables.App).EtwTrace?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
// Windows Header Files
|
// Windows Header Files
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,33 +10,25 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log if the user has Environment Variables enabled or disabled
|
// Log if the user has Environment Variables enabled or disabled
|
||||||
void Trace::EnableEnvironmentVariables(const bool enabled) noexcept
|
void Trace::EnableEnvironmentVariables(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"EnvironmentVariables_EnableEnvironmentVariables",
|
"EnvironmentVariables_EnableEnvironmentVariables",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log that the user tried to activate the editor
|
// Log that the user tried to activate the editor
|
||||||
void Trace::ActivateEnvironmentVariables() noexcept
|
void Trace::ActivateEnvironmentVariables() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"EnvironmentVariables_Activate",
|
"EnvironmentVariables_Activate",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
|
|
||||||
// Log if the user has EnvironmentVariables enabled or disabled
|
// Log if the user has EnvironmentVariables enabled or disabled
|
||||||
static void EnableEnvironmentVariables(const bool enabled) noexcept;
|
static void EnableEnvironmentVariables(const bool enabled) noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0"
|
||||||
|
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#include "Trace.h"
|
#include "Trace.h"
|
||||||
#include "../common/Telemetry/ProjectTelemetry.h"
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
@@ -10,51 +11,45 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::EnableFileLocksmith(_In_ bool enabled) noexcept
|
void Trace::EnableFileLocksmith(_In_ bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"FileLocksmith_EnableFileLocksmith",
|
"FileLocksmith_EnableFileLocksmith",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::Invoked() noexcept
|
void Trace::Invoked() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"FileLocksmith_Invoked",
|
"FileLocksmith_Invoked",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::InvokedRet(_In_ HRESULT hr) noexcept
|
void Trace::InvokedRet(_In_ HRESULT hr) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"FileLocksmith_InvokedRet",
|
"FileLocksmith_InvokedRet",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingHResult(hr),
|
TraceLoggingHResult(hr),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::QueryContextMenuError(_In_ HRESULT hr) noexcept
|
void Trace::QueryContextMenuError(_In_ HRESULT hr) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"FileLocksmith_QueryContextMenuError",
|
"FileLocksmith_QueryContextMenuError",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingHResult(hr),
|
TraceLoggingHResult(hr),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
static void EnableFileLocksmith(_In_ bool enabled) noexcept;
|
static void EnableFileLocksmith(_In_ bool enabled) noexcept;
|
||||||
static void Invoked() noexcept;
|
static void Invoked() noexcept;
|
||||||
static void InvokedRet(_In_ HRESULT hr) noexcept;
|
static void InvokedRet(_In_ HRESULT hr) noexcept;
|
||||||
|
|||||||
30
src/modules/Hosts/Hosts/Helpers/NativeEventWaiter.cs
Normal file
30
src/modules/Hosts/Hosts/Helpers/NativeEventWaiter.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
using Microsoft.UI.Dispatching;
|
||||||
|
|
||||||
|
namespace Hosts.Helpers
|
||||||
|
{
|
||||||
|
public static class NativeEventWaiter
|
||||||
|
{
|
||||||
|
public static void WaitForEventLoop(string eventName, Action callback)
|
||||||
|
{
|
||||||
|
var dispatcherQueue = DispatcherQueue.GetForCurrentThread();
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName);
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (eventHandle.WaitOne())
|
||||||
|
{
|
||||||
|
dispatcherQueue.TryEnqueue(() => callback());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ using Microsoft.Extensions.Hosting;
|
|||||||
using Microsoft.PowerToys.Telemetry;
|
using Microsoft.PowerToys.Telemetry;
|
||||||
using Microsoft.UI.Dispatching;
|
using Microsoft.UI.Dispatching;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
|
using PowerToys.Interop;
|
||||||
using static HostsUILib.Settings.IUserSettings;
|
using static HostsUILib.Settings.IUserSettings;
|
||||||
|
|
||||||
using Host = Hosts.Helpers.Host;
|
using Host = Hosts.Helpers.Host;
|
||||||
@@ -93,6 +93,12 @@ namespace Hosts
|
|||||||
cleanupBackupThread.Start();
|
cleanupBackupThread.Start();
|
||||||
|
|
||||||
UnhandledException += App_UnhandledException;
|
UnhandledException += App_UnhandledException;
|
||||||
|
|
||||||
|
Hosts.Helpers.NativeEventWaiter.WaitForEventLoop(Constants.TerminateHostsSharedEvent(), () =>
|
||||||
|
{
|
||||||
|
EtwTrace?.Dispose();
|
||||||
|
Environment.Exit(0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -101,6 +107,8 @@ namespace Hosts
|
|||||||
/// <param name="args">Details about the launch request and process.</param>
|
/// <param name="args">Details about the launch request and process.</param>
|
||||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
|
EtwTrace.Start();
|
||||||
|
|
||||||
var cmdArgs = Environment.GetCommandLineArgs();
|
var cmdArgs = Environment.GetCommandLineArgs();
|
||||||
if (cmdArgs?.Length > 1)
|
if (cmdArgs?.Length > 1)
|
||||||
{
|
{
|
||||||
@@ -112,6 +120,7 @@ namespace Hosts
|
|||||||
RunnerHelper.WaitForPowerToysRunner(powerToysRunnerPid, () =>
|
RunnerHelper.WaitForPowerToysRunner(powerToysRunnerPid, () =>
|
||||||
{
|
{
|
||||||
Logger.LogInfo("PowerToys Runner exited. Exiting Hosts");
|
Logger.LogInfo("PowerToys Runner exited. Exiting Hosts");
|
||||||
|
EtwTrace?.Dispose();
|
||||||
dispatcher.TryEnqueue(App.Current.Exit);
|
dispatcher.TryEnqueue(App.Current.Exit);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -133,5 +142,7 @@ namespace Hosts
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Window window;
|
private Window window;
|
||||||
|
|
||||||
|
public ETWTrace EtwTrace { get; private set; } = new ETWTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
Width="680"
|
Width="680"
|
||||||
MinWidth="520"
|
MinWidth="520"
|
||||||
MinHeight="320"
|
MinHeight="320"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d"
|
||||||
|
Closed="WindowEx_Closed">
|
||||||
<Window.SystemBackdrop>
|
<Window.SystemBackdrop>
|
||||||
<MicaBackdrop />
|
<MicaBackdrop />
|
||||||
</Window.SystemBackdrop>
|
</Window.SystemBackdrop>
|
||||||
|
|||||||
@@ -62,5 +62,10 @@ namespace Hosts
|
|||||||
MainGrid.Children.Add(MainPage);
|
MainGrid.Children.Add(MainPage);
|
||||||
Grid.SetRow(MainPage, 1);
|
Grid.SetRow(MainPage, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void WindowEx_Closed(object sender, WindowEventArgs args)
|
||||||
|
{
|
||||||
|
(Application.Current as App).EtwTrace?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ private:
|
|||||||
|
|
||||||
HANDLE m_hShowAdminEvent{};
|
HANDLE m_hShowAdminEvent{};
|
||||||
|
|
||||||
|
HANDLE m_hTerminateEvent{};
|
||||||
|
|
||||||
bool is_process_running()
|
bool is_process_running()
|
||||||
{
|
{
|
||||||
return WaitForSingleObject(m_hProcess, 0) == WAIT_TIMEOUT;
|
return WaitForSingleObject(m_hProcess, 0) == WAIT_TIMEOUT;
|
||||||
@@ -142,6 +144,17 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_hTerminateEvent = CreateDefaultEvent(CommonSharedConstants::TERMINATE_HOSTS_EVENT);
|
||||||
|
if (!m_hTerminateEvent)
|
||||||
|
{
|
||||||
|
Logger::error(L"Failed to create terminate hosts event");
|
||||||
|
auto message = get_last_error_message(GetLastError());
|
||||||
|
if (message.has_value())
|
||||||
|
{
|
||||||
|
Logger::error(message.value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_showEventWaiter = EventWaiter(CommonSharedConstants::SHOW_HOSTS_EVENT, [&](int err)
|
m_showEventWaiter = EventWaiter(CommonSharedConstants::SHOW_HOSTS_EVENT, [&](int err)
|
||||||
{
|
{
|
||||||
if (m_enabled && err == ERROR_SUCCESS)
|
if (m_enabled && err == ERROR_SUCCESS)
|
||||||
@@ -264,6 +277,8 @@ public:
|
|||||||
ResetEvent(m_hShowAdminEvent);
|
ResetEvent(m_hShowAdminEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetEvent(m_hTerminateEvent);
|
||||||
|
WaitForSingleObject(m_hProcess, 1000);
|
||||||
TerminateProcess(m_hProcess, 1);
|
TerminateProcess(m_hProcess, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,3 @@
|
|||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,33 +10,25 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log if the user has HostsFileEditor enabled or disabled
|
// Log if the user has HostsFileEditor enabled or disabled
|
||||||
void Trace::EnableHostsFileEditor(const bool enabled) noexcept
|
void Trace::EnableHostsFileEditor(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"HostsFileEditor_EnableHostsFileEditor",
|
"HostsFileEditor_EnableHostsFileEditor",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log that the user tried to activate the editor
|
// Log that the user tried to activate the editor
|
||||||
void Trace::ActivateEditor() noexcept
|
void Trace::ActivateEditor() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"HostsFileEditor_Activate",
|
"HostsFileEditor_Activate",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
|
|
||||||
// Log if the user has HostsFileEditor enabled or disabled
|
// Log if the user has HostsFileEditor enabled or disabled
|
||||||
static void EnableHostsFileEditor(const bool enabled) noexcept;
|
static void EnableHostsFileEditor(const bool enabled) noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
|
|
||||||
// Undefine GetCurrentTime macro to prevent
|
// Undefine GetCurrentTime macro to prevent
|
||||||
// conflict with Storyboard::GetCurrentTime
|
// conflict with Storyboard::GetCurrentTime
|
||||||
|
|||||||
@@ -9,6 +9,5 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <common/SettingsAPI/settings_helpers.h>
|
#include <common/SettingsAPI/settings_helpers.h>
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,40 +10,33 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::EnableMeasureTool(const bool enabled) noexcept
|
void Trace::EnableMeasureTool(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MeasureTool_EnableMeasureTool",
|
"MeasureTool_EnableMeasureTool",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::BoundsToolActivated() noexcept
|
void Trace::BoundsToolActivated() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MeasureTool_BoundsToolActivated",
|
"MeasureTool_BoundsToolActivated",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::MeasureToolActivated() noexcept
|
void Trace::MeasureToolActivated() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MeasureTool_MeasureToolActivated",
|
"MeasureTool_MeasureToolActivated",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
|
|
||||||
static void EnableMeasureTool(const bool enabled) noexcept;
|
static void EnableMeasureTool(const bool enabled) noexcept;
|
||||||
|
|
||||||
static void BoundsToolActivated() noexcept;
|
static void BoundsToolActivated() noexcept;
|
||||||
|
|||||||
@@ -15,6 +15,5 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <common/SettingsAPI/settings_helpers.h>
|
#include <common/SettingsAPI/settings_helpers.h>
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,33 +10,25 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log if the user has FindMyMouse enabled or disabled
|
// Log if the user has FindMyMouse enabled or disabled
|
||||||
void Trace::EnableFindMyMouse(const bool enabled) noexcept
|
void Trace::EnableFindMyMouse(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"FindMyMouse_EnableFindMyMouse",
|
"FindMyMouse_EnableFindMyMouse",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log that the user activated the module by focusing the mouse pointer
|
// Log that the user activated the module by focusing the mouse pointer
|
||||||
void Trace::MousePointerFocused() noexcept
|
void Trace::MousePointerFocused() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"FindMyMouse_MousePointerFocused",
|
"FindMyMouse_MousePointerFocused",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
|
|
||||||
// Log if the user has FindMyMouse enabled or disabled
|
// Log if the user has FindMyMouse enabled or disabled
|
||||||
static void EnableFindMyMouse(const bool enabled) noexcept;
|
static void EnableFindMyMouse(const bool enabled) noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <common/SettingsAPI/settings_helpers.h>
|
#include <common/SettingsAPI/settings_helpers.h>
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
#include <common/utils/logger_helper.h>
|
#include <common/utils/logger_helper.h>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,33 +10,25 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log if the user has MouseHighlighter enabled or disabled
|
// Log if the user has MouseHighlighter enabled or disabled
|
||||||
void Trace::EnableMouseHighlighter(const bool enabled) noexcept
|
void Trace::EnableMouseHighlighter(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MouseHighlighter_EnableMouseHighlighter",
|
"MouseHighlighter_EnableMouseHighlighter",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log that the user activated the module by starting a highlighting session
|
// Log that the user activated the module by starting a highlighting session
|
||||||
void Trace::StartHighlightingSession() noexcept
|
void Trace::StartHighlightingSession() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MouseHighlighter_StartHighlightingSession",
|
"MouseHighlighter_StartHighlightingSession",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
|
|
||||||
// Log if the user has MouseHighlighter enabled or disabled
|
// Log if the user has MouseHighlighter enabled or disabled
|
||||||
static void EnableMouseHighlighter(const bool enabled) noexcept;
|
static void EnableMouseHighlighter(const bool enabled) noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,5 @@
|
|||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
//#include <common/common.h>
|
//#include <common/common.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <common/SettingsAPI/settings_helpers.h>
|
#include <common/SettingsAPI/settings_helpers.h>
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,31 +10,23 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider()
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider()
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::EnableJumpTool(const bool enabled) noexcept
|
void Trace::EnableJumpTool(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MouseJump_EnableJumpTool",
|
"MouseJump_EnableJumpTool",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::InvokeJumpTool() noexcept
|
void Trace::InvokeJumpTool() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MouseJump_InvokeJumpTool",
|
"MouseJump_InvokeJumpTool",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider();
|
|
||||||
static void UnregisterProvider();
|
|
||||||
|
|
||||||
static void EnableJumpTool(const bool enabled) noexcept;
|
static void EnableJumpTool(const bool enabled) noexcept;
|
||||||
|
|
||||||
static void InvokeJumpTool() noexcept;
|
static void InvokeJumpTool() noexcept;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
#include <winrt/Windows.System.h>
|
#include <winrt/Windows.System.h>
|
||||||
#include <winrt/Windows.UI.Composition.Desktop.h>
|
#include <winrt/Windows.UI.Composition.Desktop.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <common/SettingsAPI/settings_helpers.h>
|
#include <common/SettingsAPI/settings_helpers.h>
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,33 +10,25 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log if the user has MousePointerCrosshairs enabled or disabled
|
// Log if the user has MousePointerCrosshairs enabled or disabled
|
||||||
void Trace::EnableMousePointerCrosshairs(const bool enabled) noexcept
|
void Trace::EnableMousePointerCrosshairs(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MousePointerCrosshairs_EnableMousePointerCrosshairs",
|
"MousePointerCrosshairs_EnableMousePointerCrosshairs",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log that the user activated the module by having the crosshairs be drawn
|
// Log that the user activated the module by having the crosshairs be drawn
|
||||||
void Trace::StartDrawingCrosshairs() noexcept
|
void Trace::StartDrawingCrosshairs() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MousePointerCrosshairs_StartDrawingCrosshairs",
|
"MousePointerCrosshairs_StartDrawingCrosshairs",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
|
|
||||||
// Log if the user has MousePointerCrosshairs enabled or disabled
|
// Log if the user has MousePointerCrosshairs enabled or disabled
|
||||||
static void EnableMousePointerCrosshairs(const bool enabled) noexcept;
|
static void EnableMousePointerCrosshairs(const bool enabled) noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -3,20 +3,22 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
|
using Microsoft.PowerToys.Telemetry;
|
||||||
|
using MouseWithoutBorders.Class;
|
||||||
|
|
||||||
namespace MouseWithoutBorders
|
namespace MouseWithoutBorders
|
||||||
{
|
{
|
||||||
internal class ShutdownWithPowerToys
|
internal class ShutdownWithPowerToys
|
||||||
{
|
{
|
||||||
public static void WaitForPowerToysRunner()
|
public static void WaitForPowerToysRunner(ETWTrace etwTrace)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
||||||
{
|
{
|
||||||
|
etwTrace?.Dispose();
|
||||||
Common.MainForm.Quit(true, false);
|
Common.MainForm.Quit(true, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ namespace MouseWithoutBorders.Class
|
|||||||
ManagedCommon.Logger.InitializeLogger("\\MouseWithoutBorders\\Logs");
|
ManagedCommon.Logger.InitializeLogger("\\MouseWithoutBorders\\Logs");
|
||||||
Common.Log(Application.ProductName + " Started!");
|
Common.Log(Application.ProductName + " Started!");
|
||||||
|
|
||||||
|
ETWTrace etwTrace = new ETWTrace();
|
||||||
|
|
||||||
|
etwTrace.Start();
|
||||||
|
|
||||||
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredMouseWithoutBordersEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
|
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredMouseWithoutBordersEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
|
||||||
{
|
{
|
||||||
Common.Log("Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
|
Common.Log("Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
|
||||||
@@ -115,7 +119,7 @@ namespace MouseWithoutBorders.Class
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShutdownWithPowerToys.WaitForPowerToysRunner();
|
ShutdownWithPowerToys.WaitForPowerToysRunner(etwTrace);
|
||||||
|
|
||||||
if (firstArg != string.Empty)
|
if (firstArg != string.Empty)
|
||||||
{
|
{
|
||||||
@@ -223,6 +227,8 @@ namespace MouseWithoutBorders.Class
|
|||||||
var formScreen = new FrmScreen();
|
var formScreen = new FrmScreen();
|
||||||
|
|
||||||
Application.Run(formScreen);
|
Application.Run(formScreen);
|
||||||
|
|
||||||
|
etwTrace?.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.IO;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
|
using Microsoft.PowerToys.Telemetry;
|
||||||
|
|
||||||
namespace MouseWithoutBorders
|
namespace MouseWithoutBorders
|
||||||
{
|
{
|
||||||
@@ -38,8 +39,12 @@ namespace MouseWithoutBorders
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ETWTrace etwTrace = new ETWTrace();
|
||||||
|
etwTrace.Start();
|
||||||
|
|
||||||
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
RunnerHelper.WaitForPowerToysRunnerExitFallback(() =>
|
||||||
{
|
{
|
||||||
|
etwTrace?.Dispose();
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -76,6 +81,8 @@ namespace MouseWithoutBorders
|
|||||||
|
|
||||||
dotForm = new FormDot();
|
dotForm = new FormDot();
|
||||||
Application.Run(FormHelper = new FormHelper());
|
Application.Run(FormHelper = new FormHelper());
|
||||||
|
|
||||||
|
etwTrace?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID /*lpRese
|
|||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
g_hInst_MouseWithoutBorders = hModule;
|
g_hInst_MouseWithoutBorders = hModule;
|
||||||
Trace::RegisterProvider();
|
Trace::MouseWithoutBorders::RegisterProvider();
|
||||||
break;
|
break;
|
||||||
case DLL_THREAD_ATTACH:
|
case DLL_THREAD_ATTACH:
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
break;
|
break;
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
Trace::UnregisterProvider();
|
Trace::MouseWithoutBorders::UnregisterProvider();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
#include <winrt/base.h>
|
#include <winrt/base.h>
|
||||||
#include <winrt/Windows.Foundation.h>
|
#include <winrt/Windows.Foundation.h>
|
||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <TraceLoggingActivity.h>
|
|
||||||
|
|
||||||
#include <wil\common.h>
|
#include <wil\common.h>
|
||||||
#include <wil\result.h>
|
#include <wil\result.h>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
// Telemetry strings should not be localized.
|
// Telemetry strings should not be localized.
|
||||||
#define LoggingProviderKey "Microsoft.PowerToys"
|
#define LoggingProviderKey "Microsoft.PowerToys"
|
||||||
|
|
||||||
@@ -14,51 +16,45 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::MouseWithoutBorders::Enable(bool enabled) noexcept
|
void Trace::MouseWithoutBorders::Enable(bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
EventEnableMouseWithoutBordersKey,
|
EventEnableMouseWithoutBordersKey,
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, EventEnabledKey));
|
TraceLoggingBoolean(enabled, EventEnabledKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::MouseWithoutBorders::ToggleServiceRegistration(bool enabled) noexcept
|
void Trace::MouseWithoutBorders::ToggleServiceRegistration(bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MouseWithoutBorders_ToggleServiceRegistration",
|
"MouseWithoutBorders_ToggleServiceRegistration",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, EventEnabledKey));
|
TraceLoggingBoolean(enabled, EventEnabledKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::MouseWithoutBorders::Activate() noexcept
|
void Trace::MouseWithoutBorders::Activate() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MouseWithoutBorders_Activate",
|
"MouseWithoutBorders_Activate",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log that the user tried to activate the editor
|
// Log that the user tried to activate the editor
|
||||||
void Trace::MouseWithoutBorders::AddFirewallRule() noexcept
|
void Trace::MouseWithoutBorders::AddFirewallRule() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"MouseWithoutBorders_AddFirewallRule",
|
"MouseWithoutBorders_AddFirewallRule",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
class Trace
|
class Trace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
class MouseWithoutBorders : public telemetry::TraceBase
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
|
|
||||||
class MouseWithoutBorders
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Enable(bool enabled) noexcept;
|
static void Enable(bool enabled) noexcept;
|
||||||
|
|||||||
@@ -10,19 +10,9 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::EventToggleOnOff(_In_ const bool enabled) noexcept
|
void Trace::EventToggleOnOff(_In_ const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"NewPlus_EventToggleOnOff",
|
"NewPlus_EventToggleOnOff",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
@@ -32,7 +22,7 @@ void Trace::EventToggleOnOff(_In_ const bool enabled) noexcept
|
|||||||
|
|
||||||
void Trace::EventChangedTemplateLocation() noexcept
|
void Trace::EventChangedTemplateLocation() noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"NewPlus_ChangedTemplateLocation",
|
"NewPlus_ChangedTemplateLocation",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
@@ -41,7 +31,7 @@ void Trace::EventChangedTemplateLocation() noexcept
|
|||||||
|
|
||||||
void Trace::EventShowTemplateItems(const size_t number_of_templates) noexcept
|
void Trace::EventShowTemplateItems(const size_t number_of_templates) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"NewPlus_EventShowTemplateItems",
|
"NewPlus_EventShowTemplateItems",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
@@ -51,7 +41,7 @@ void Trace::EventShowTemplateItems(const size_t number_of_templates) noexcept
|
|||||||
|
|
||||||
void Trace::EventCopyTemplate(_In_ const std::wstring template_file_extension) noexcept
|
void Trace::EventCopyTemplate(_In_ const std::wstring template_file_extension) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"NewPlus_EventCopyTemplate",
|
"NewPlus_EventCopyTemplate",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
@@ -61,7 +51,7 @@ void Trace::EventCopyTemplate(_In_ const std::wstring template_file_extension) n
|
|||||||
|
|
||||||
void Trace::EventCopyTemplateResult(_In_ const HRESULT hr) noexcept
|
void Trace::EventCopyTemplateResult(_In_ const HRESULT hr) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"NewPlus_EventCopyTemplateResult",
|
"NewPlus_EventCopyTemplateResult",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
static void EventToggleOnOff(_In_ const bool new_enabled_state) noexcept;
|
static void EventToggleOnOff(_In_ const bool new_enabled_state) noexcept;
|
||||||
static void EventChangedTemplateLocation() noexcept;
|
static void EventChangedTemplateLocation() noexcept;
|
||||||
static void EventShowTemplateItems(_In_ const size_t number_of_templates) noexcept;
|
static void EventShowTemplateItems(_In_ const size_t number_of_templates) noexcept;
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using Common.UI;
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
|
using Microsoft.PowerToys.Telemetry;
|
||||||
using PowerOCR.Keyboard;
|
using PowerOCR.Keyboard;
|
||||||
using PowerOCR.Settings;
|
using PowerOCR.Settings;
|
||||||
|
using PowerToys.Interop;
|
||||||
|
|
||||||
namespace PowerOCR;
|
namespace PowerOCR;
|
||||||
|
|
||||||
@@ -22,6 +24,7 @@ public partial class App : Application, IDisposable
|
|||||||
private EventMonitor? eventMonitor;
|
private EventMonitor? eventMonitor;
|
||||||
private Mutex? _instanceMutex;
|
private Mutex? _instanceMutex;
|
||||||
private int _powerToysRunnerPid;
|
private int _powerToysRunnerPid;
|
||||||
|
private ETWTrace etwTrace = new ETWTrace();
|
||||||
|
|
||||||
private CancellationTokenSource NativeThreadCTS { get; set; }
|
private CancellationTokenSource NativeThreadCTS { get; set; }
|
||||||
|
|
||||||
@@ -43,12 +46,21 @@ public partial class App : Application, IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
NativeThreadCTS = new CancellationTokenSource();
|
NativeThreadCTS = new CancellationTokenSource();
|
||||||
|
|
||||||
|
etwTrace.Start();
|
||||||
|
|
||||||
|
NativeEventWaiter.WaitForEventLoop(
|
||||||
|
Constants.TerminatePowerOCRSharedEvent(),
|
||||||
|
this.Shutdown,
|
||||||
|
this.Dispatcher,
|
||||||
|
NativeThreadCTS.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
keyboardMonitor?.Dispose();
|
keyboardMonitor?.Dispose();
|
||||||
|
etwTrace?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Application_Startup(object sender, StartupEventArgs e)
|
private void Application_Startup(object sender, StartupEventArgs e)
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ private:
|
|||||||
|
|
||||||
// Handle to event used to invoke PowerOCR
|
// Handle to event used to invoke PowerOCR
|
||||||
HANDLE m_hInvokeEvent;
|
HANDLE m_hInvokeEvent;
|
||||||
|
// Handle to event used to terminate PowerOCR
|
||||||
|
HANDLE m_hTerminateEvent;
|
||||||
|
|
||||||
void parse_hotkey(PowerToysSettings::PowerToyValues& settings)
|
void parse_hotkey(PowerToysSettings::PowerToyValues& settings)
|
||||||
{
|
{
|
||||||
@@ -160,6 +162,7 @@ public:
|
|||||||
app_key = PowerOcrConstants::ModuleKey;
|
app_key = PowerOcrConstants::ModuleKey;
|
||||||
LoggerHelpers::init_logger(app_key, L"ModuleInterface", "TextExtractor");
|
LoggerHelpers::init_logger(app_key, L"ModuleInterface", "TextExtractor");
|
||||||
m_hInvokeEvent = CreateDefaultEvent(CommonSharedConstants::SHOW_POWEROCR_SHARED_EVENT);
|
m_hInvokeEvent = CreateDefaultEvent(CommonSharedConstants::SHOW_POWEROCR_SHARED_EVENT);
|
||||||
|
m_hTerminateEvent = CreateDefaultEvent(CommonSharedConstants::TERMINATE_POWEROCR_SHARED_EVENT);
|
||||||
init_settings();
|
init_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +252,8 @@ public:
|
|||||||
if (m_enabled)
|
if (m_enabled)
|
||||||
{
|
{
|
||||||
ResetEvent(m_hInvokeEvent);
|
ResetEvent(m_hInvokeEvent);
|
||||||
|
SetEvent(m_hTerminateEvent);
|
||||||
|
WaitForSingleObject(m_hProcess, 1000);
|
||||||
TerminateProcess(m_hProcess, 1);
|
TerminateProcess(m_hProcess, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winrt/Windows.Foundation.h>
|
#include <winrt/Windows.Foundation.h>
|
||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,23 +10,14 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider()
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider()
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log if the user has PowerOCR enabled or disabled
|
// Log if the user has PowerOCR enabled or disabled
|
||||||
void Trace::EnablePowerOCR(const bool enabled) noexcept
|
void Trace::EnablePowerOCR(const bool enabled) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"PowerOCR_EnablePowerOCR",
|
"PowerOCR_EnablePowerOCR",
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII),
|
||||||
TraceLoggingBoolean(enabled, "Enabled"));
|
TraceLoggingBoolean(enabled, "Enabled"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
class Trace
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider();
|
|
||||||
static void UnregisterProvider();
|
|
||||||
|
|
||||||
// Log if the user has PowerOCR enabled or disabled
|
// Log if the user has PowerOCR enabled or disabled
|
||||||
static void EnablePowerOCR(const bool enabled) noexcept;
|
static void EnablePowerOCR(const bool enabled) noexcept;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -158,6 +158,9 @@
|
|||||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
||||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\..\common\Telemetry\EtwTrace\EtwTrace.vcxproj">
|
||||||
|
<Project>{8f021b46-362b-485c-bfba-ccf83e820cbd}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
|
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
|
||||||
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
|
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
|||||||
@@ -116,7 +116,79 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CopyFileToFolders Include="Assets\ShortcutGuide\**">
|
<CopyFileToFolders Include="Assets\ShortcutGuide\1.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\2.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\3.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\4.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\5.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\6.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\7.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\8.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\9.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\no_active_window.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\overlay.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\overlay_portrait.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\0.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\1.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\2.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\3.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\4.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\5.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\6.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\7.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\8.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\9.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\no_active_window.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\overlay.svg">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</CopyFileToFolders>
|
||||||
|
<CopyFileToFolders Include="Assets\ShortcutGuide\overlay_portrait.svg">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</CopyFileToFolders>
|
</CopyFileToFolders>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include <common/utils/EventWaiter.h>
|
#include <common/utils/EventWaiter.h>
|
||||||
#include <common/utils/gpo.h>
|
#include <common/utils/gpo.h>
|
||||||
|
|
||||||
|
#include <common/Telemetry/EtwTrace/EtwTrace.h>
|
||||||
|
|
||||||
#include "shortcut_guide.h"
|
#include "shortcut_guide.h"
|
||||||
#include "target_state.h"
|
#include "target_state.h"
|
||||||
#include "ShortcutGuideConstants.h"
|
#include "ShortcutGuideConstants.h"
|
||||||
@@ -48,6 +50,9 @@ int WINAPI wWinMain(_In_ HINSTANCE /*hInstance*/, _In_opt_ HINSTANCE /*hPrevInst
|
|||||||
winrt::init_apartment();
|
winrt::init_apartment();
|
||||||
LoggerHelpers::init_logger(ShortcutGuideConstants::ModuleKey, L"ShortcutGuide", LogSettings::shortcutGuideLoggerName);
|
LoggerHelpers::init_logger(ShortcutGuideConstants::ModuleKey, L"ShortcutGuide", LogSettings::shortcutGuideLoggerName);
|
||||||
|
|
||||||
|
Shared::Trace::ETWTrace trace;
|
||||||
|
trace.UpdateState(true);
|
||||||
|
|
||||||
if (powertoys_gpo::getConfiguredShortcutGuideEnabledValue() == powertoys_gpo::gpo_rule_configured_disabled)
|
if (powertoys_gpo::getConfiguredShortcutGuideEnabledValue() == powertoys_gpo::gpo_rule_configured_disabled)
|
||||||
{
|
{
|
||||||
Logger::warn(L"Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
|
Logger::warn(L"Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
|
||||||
@@ -132,6 +137,8 @@ int WINAPI wWinMain(_In_ HINSTANCE /*hInstance*/, _In_opt_ HINSTANCE /*hPrevInst
|
|||||||
|
|
||||||
window.ShowWindow();
|
window.ShowWindow();
|
||||||
run_message_loop();
|
run_message_loop();
|
||||||
|
|
||||||
|
trace.Flush();
|
||||||
Trace::UnregisterProvider();
|
Trace::UnregisterProvider();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,5 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
TRACELOGGING_DEFINE_PROVIDER(
|
TRACELOGGING_DEFINE_PROVIDER(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"Microsoft.PowerToys",
|
"Microsoft.PowerToys",
|
||||||
@@ -8,31 +10,22 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||||||
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
||||||
TraceLoggingOptionProjectTelemetry());
|
TraceLoggingOptionProjectTelemetry());
|
||||||
|
|
||||||
void Trace::RegisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingRegister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::UnregisterProvider() noexcept
|
|
||||||
{
|
|
||||||
TraceLoggingUnregister(g_hProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trace::SendGuideSession(const __int64 duration_ms, const wchar_t* close_type) noexcept
|
void Trace::SendGuideSession(const __int64 duration_ms, const wchar_t* close_type) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"ShortcutGuide_GuideSession",
|
"ShortcutGuide_GuideSession",
|
||||||
TraceLoggingInt64(duration_ms, "DurationInMs"),
|
TraceLoggingInt64(duration_ms, "DurationInMs"),
|
||||||
TraceLoggingWideString(close_type, "CloseType"),
|
TraceLoggingWideString(close_type, "CloseType"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trace::SendSettings(ShortcutGuideSettings settings) noexcept
|
void Trace::SendSettings(ShortcutGuideSettings settings) noexcept
|
||||||
{
|
{
|
||||||
TraceLoggingWrite(
|
TraceLoggingWriteWrapper(
|
||||||
g_hProvider,
|
g_hProvider,
|
||||||
"ShortcutGuide_Settings",
|
"ShortcutGuide_Settings",
|
||||||
TraceLoggingWideString(settings.hotkey.c_str(), "Hotkey"),
|
TraceLoggingWideString(settings.hotkey.c_str(), "Hotkey"),
|
||||||
@@ -44,5 +37,6 @@ void Trace::SendSettings(ShortcutGuideSettings settings) noexcept
|
|||||||
TraceLoggingInt32(settings.windowsKeyPressTimeForTaskbarIconShortcuts, "WindowsKeyPressTimeForTaskbarIconShortcuts"),
|
TraceLoggingInt32(settings.windowsKeyPressTimeForTaskbarIconShortcuts, "WindowsKeyPressTimeForTaskbarIconShortcuts"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
||||||
|
TraceLoggingEventTag(MICROSOFT_EVENTTAG_DROP_PII));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ShortcutGuideSettings.h"
|
#include "ShortcutGuideSettings.h"
|
||||||
|
|
||||||
class Trace
|
#include <common/Telemetry/TraceBase.h>
|
||||||
|
|
||||||
|
class Trace : public telemetry::TraceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void RegisterProvider() noexcept;
|
|
||||||
static void UnregisterProvider() noexcept;
|
|
||||||
static void SendGuideSession(const __int64 duration_ms, const wchar_t* close_type) noexcept;
|
static void SendGuideSession(const __int64 duration_ms, const wchar_t* close_type) noexcept;
|
||||||
static void SendSettings(ShortcutGuideSettings settings) noexcept;
|
static void SendSettings(ShortcutGuideSettings settings) noexcept;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <winrt/base.h>
|
#include <winrt/base.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <ProjectTelemetry.h>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <common/logger/logger.h>
|
#include <common/logger/logger.h>
|
||||||
#include <common/utils/resources.h>
|
#include <common/utils/resources.h>
|
||||||
@@ -9,6 +9,7 @@ using System.Windows;
|
|||||||
|
|
||||||
using Common.UI;
|
using Common.UI;
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
|
using Microsoft.PowerToys.Telemetry;
|
||||||
using WorkspacesEditor.Utils;
|
using WorkspacesEditor.Utils;
|
||||||
using WorkspacesEditor.ViewModels;
|
using WorkspacesEditor.ViewModels;
|
||||||
|
|
||||||
@@ -31,8 +32,11 @@ namespace WorkspacesEditor
|
|||||||
|
|
||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
|
|
||||||
|
private ETWTrace etwTrace = new ETWTrace();
|
||||||
|
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
|
etwTrace.Start();
|
||||||
WorkspacesEditorIO = new WorkspacesEditorIO();
|
WorkspacesEditorIO = new WorkspacesEditorIO();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +139,7 @@ namespace WorkspacesEditor
|
|||||||
{
|
{
|
||||||
ThemeManager?.Dispose();
|
ThemeManager?.Dispose();
|
||||||
_instanceMutex?.Dispose();
|
_instanceMutex?.Dispose();
|
||||||
|
etwTrace?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_isDisposed = true;
|
_isDisposed = true;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user