Compare commits

..

7 Commits

Author SHA1 Message Date
Clint Rutkas
8564f9d864 Update code.txt 2026-05-25 08:11:54 -07:00
Clint Rutkas
d8a7fe5913 Merge branch 'crutkas/dev/fixcoroutine' of https://github.com/microsoft/powertoys into crutkas/dev/fixcoroutine 2026-05-24 21:36:34 -07:00
Clint Rutkas
e627f1755b Eliminate VS 2026 build warnings: IIDOptimizer, AutoInitializer dupe, CsWinRT projection race fallback
- Common.Dotnet.CsWinRT.props: opt out of CsWinRT 2.2 IIDOptimizer which exits with code -1 on .NET 10 (MSB3073). Add DeleteStaleCsWinRTRspAfterPrepare second-pass target so projects that override CsWinRTGeneratedFilesDir to OutDir (e.g. PowerToys.Settings, PowerAccent.Common.UnitTests) also have stale cswinrt.rsp deleted after the value is resolved.

- PowerRenameUI.vcxproj: add Microsoft.WindowsAppSDK.Foundation PackageReference and FixWinAppSDKAutoInitializer target (same pattern as runner.vcxproj) so WindowsAppRuntimeAutoInitializer.cpp is only added once, eliminating MSB8027 and LNK4042.
2026-05-24 20:51:48 -07:00
copilot-swe-agent[bot]
e503ccfd89 Allow cswinrt and rsp in spell check 2026-05-25 01:04:37 +00:00
Clint Rutkas
2084992f42 getting most stood up and functional again 2026-05-24 09:37:31 -07:00
Clint Rutkas
6ecb06c8cb WIP: spdlog 1.17 / fmt 12 compile fixes
- Add FMT_UNICODE=0 to logging.vcxproj, spdlog.props, UnitTests-CommonUtils (Microsoft codebase isn't /utf-8 by default)
- Rename spdlog's fmt.cpp -> bundled_fmtlib_format.cpp in logging.vcxproj (renamed upstream)
- Add SPDLOG_WCHAR_TO_UTF8_SUPPORT to logging.vcxproj so wstr_to_utf8buf is compiled
- Wrap Logger:: format strings with fmt::runtime() (fmt 11+ requires consteval format strings)
- Bump CalculatorEngineCommon to C++20 to drop dependency on <experimental/coroutine>
2026-05-23 22:08:58 -07:00
Clint Rutkas
a3cad81295 Bump spdlog submodule to v1.17.0 (bundled fmt 12.1); remove MSVC 14.51 checked_array_iterator shim 2026-05-23 21:37:50 -07:00
242 changed files with 2110 additions and 3758 deletions

View File

@@ -308,8 +308,11 @@ pwa
AOT
Aot
cswinrt
ify
rsp
TFM
RTIID
# YML
onefuzz

View File

@@ -105,9 +105,7 @@
^src/common/ManagedCommon/ColorFormatHelper\.cs$
^src/common/notifications/BackgroundActivatorDLL/cpp\.hint$
^src/common/sysinternals/Eula/
^src/modules/cmdpal/Tests/Microsoft\.CommandPalette\.Extensions\.Toolkit\.UnitTests/FuzzyMatcherComparisonTests.cs$
^src/modules/cmdpal/Tests/Microsoft\.CommandPalette\.Extensions\.Toolkit\.UnitTests/FuzzyMatcherDiacriticsTests.cs$
^src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002\.pdn$
^doc/devdocs/modules/cmdpal/initial-sdk-spec/list-elements-mock-002\.pdn$
^src/modules/cmdpal/ext/SamplePagesExtension/Pages/SampleMarkdownImagesPage\.cs$
^src/modules/cmdpal/Microsoft\.CmdPal\.UI/Settings/InternalPage\.SampleData\.cs$
^src/modules/cmdpal/Tests/Microsoft\.CmdPal\.Common\.UnitTests/.*\.TestData\.cs$

View File

@@ -1,6 +1,7 @@
AAAAs
abcdefghjkmnpqrstuvxyz
abgr
ABlocked
ABORTIFHUNG
ABOUTBOX
Abug
@@ -10,13 +11,18 @@ ACCESSDENIED
ACCESSTOKEN
acfs
ACIE
AClient
AColumn
ACR
acrt
ACTIVATEAPP
ACTIVATEOPTIONS
activationaction
adaptivecards
ADate
ADDSTRING
ADDUNDORECORD
ADifferent
ADMINS
adml
admx
@@ -30,8 +36,10 @@ AFX
agentskills
AGGREGATABLE
AHK
AHybrid
AIUI
akv
ALarger
ALIGNRIGHT
ALLAPPS
ALLCHILDREN
@@ -43,13 +51,17 @@ ALLOWUNDO
ALLVIEW
ALPHATYPE
altkey
AModifier
amr
ANDSCANS
animatedvisuals
Animnate
ANull
AOC
aocfnapldcnfbofgmbbllojgocaelgdd
AOklab
aot
APeriod
apicontract
apidl
APIENTRY
@@ -63,7 +75,6 @@ APPEXECLINK
appext
apphost
APPLICATIONFRAMEHOST
Applocal
appmanifest
APPMODEL
APPNAME
@@ -76,7 +87,9 @@ appxpackage
APSTUDIO
AQS
Aquadrant
ARandom
ARCHITEW
ARemapped
ARPINSTALLLOCATION
ARPPRODUCTICON
ARRAYSIZE
@@ -87,9 +100,11 @@ ARTIFACTSTAGINGDIRECTORY
asf
Ashcraft
AShortcut
ASingle
ASSOCCHANGED
ASSOCF
ASSOCSTR
ASUS
ASYNCWINDOWPLACEMENT
ASYNCWINDOWPOS
atl
@@ -120,6 +135,7 @@ Badmode
Badparam
bbwe
BCIE
bck
BESTEFFORT
bezelled
bhid
@@ -146,7 +162,9 @@ bluelightreductionstate
BLURBEHIND
BLURREGION
bmi
BNumber
BODGY
BOklab
BOOTSTRAPPERINSTALLFOLDER
Bootstrappers
BOTTOMALIGN
@@ -166,10 +184,11 @@ bugreport
bugreportfile
BUILDARCH
BUILDNUMBER
buildsystems
buildtransitive
builttoroam
BUNDLEINFO
BVal
BValue
byapp
BYCOMMAND
BYPOSITION
@@ -185,13 +204,18 @@ CAPTURECHANGED
CARETBLINKING
carlos
Carlseibert
CAtl
caub
CBN
cch
CCHDEVICENAME
CCHFORMNAME
CCom
CContext
CDeclaration
CDPX
Cds
CElems
CENTERALIGN
cer
certlm
@@ -205,10 +229,12 @@ CHILDACTIVATE
CHILDWINDOW
CHOOSEFONT
chu
Chunghwa
CIBUILD
cidl
CIELCh
cim
CImage
cla
CLASSDC
classguid
@@ -237,6 +263,7 @@ CMIC
CMINVOKECOMMANDINFO
CMINVOKECOMMANDINFOEX
CMN
CMock
CMONITORS
cmph
CNF
@@ -293,6 +320,7 @@ Cowait
cpcontrols
cph
cplusplus
CPower
cpptools
cppvsdbg
cppwinrt
@@ -311,9 +339,14 @@ CROPTOSQUARE
Crossdevice
crt
csdevkit
CSearch
CSettings
cso
CSOT
CSRW
CStyle
cswin
CTest
CTEXT
CTLCOLORSTATIC
CURRENTDIR
@@ -324,7 +357,9 @@ cursorwrap
customaction
CUSTOMACTIONTEST
CUSTOMFORMATPLACEHOLDER
CVal
cvd
CVirtual
CWMO
CXSCREEN
CXSMICON
@@ -337,6 +372,7 @@ Dac
dacl
DAffine
DAFFINETRANSFORM
DArchitectures
datareader
Datasheet
datatracker
@@ -352,6 +388,7 @@ DBT
DCapabilities
DCBA
DCOM
DComposition
DCR
ddc
DDEIf
@@ -368,6 +405,7 @@ DEFAULTICON
defaultlib
DEFAULTONLY
DEFAULTSIZE
defaulttonearest
DEFAULTTONULL
DEFAULTTOPRIMARY
DEFERERASE
@@ -400,7 +438,6 @@ DEVMODE
DEVMODEW
DEVNODES
devpal
devpackages
DEVTYP
dfx
DIALOGEX
@@ -416,6 +453,8 @@ DISPLAYFLAGS
DISPLAYFREQUENCY
displayname
DISPLAYORIENTATION
DISPLAYPORT
diu
divyan
DLGFRAME
dlgmodalframe
@@ -443,9 +482,9 @@ drawingcolor
dreamsofameaningfullife
drivedetectionwarning
DROPFILES
DSPDLOG
DSTINVERT
DString
DSVG
dto
DUMMYUNIONNAME
dumpbin
@@ -471,10 +510,12 @@ DWMWINDOWATTRIBUTE
DWMWINDOWMAXIMIZEDCHANGE
DWORDLONG
dworigin
dwrite
DWRITE
dxgi
Dxva
eab
EAccess
easeofaccess
ecount
edid
@@ -482,6 +523,8 @@ EDITKEYBOARD
EDITSHORTCUTS
EDITTEXT
eep
EFile
EInvalid
eku
emojis
ENABLEDELAYEDEXPANSION
@@ -491,24 +534,28 @@ ENABLETEMPLATE
encodedlaunch
encryptor
ENDSESSION
ENot
ENSUREVISIBLE
ENTERSIZEMOVE
ENTRYW
ENU
environmentvariables
EPO
EProvider
epu
ERASEBKGND
EREOF
EResize
ERRORIMAGE
ERRORTITLE
ESettings
esrp
etd
ETDT
etl
etw
eula
eurochange
eventvwr
evt
EWXFORCE
@@ -544,6 +591,7 @@ FANCYZONESEDITOR
FARPROC
fdw
fdx
FErase
fesf
FFFF
fffffffzzz
@@ -570,13 +618,16 @@ FILESYSPATH
Filetime
FILEVERSION
FILTERMODE
FInc
findfast
findmymouse
FIXEDFILEINFO
FIXEDSYS
flac
flyouts
FMask
fmtid
FNumber
FOF
FOFX
FOLDERID
@@ -589,6 +640,7 @@ formatetc
FORPARSING
foundrylocal
framechanged
FRestore
frm
FROMTOUCH
fsanitize
@@ -628,6 +680,7 @@ gfx
GHND
gitmodules
GMEM
GNumber
googleai
googlegemini
Gotchas
@@ -648,10 +701,12 @@ GSM
gtm
guiddata
GUITHREADINFO
GValue
gwl
GWLP
GWLSTYLE
hangeul
Hann
Hantai
Hanzi
Hardlines
@@ -684,6 +739,7 @@ hgdiobj
HGFE
hglobal
hhk
HHmmssfff
hhx
Hiber
Hiberboot
@@ -723,6 +779,7 @@ HORZSIZE
Hostbackdropbrush
hostfxr
hostsfileeditor
Hostx
hotfixes
hotkeycontrol
HOTKEYF
@@ -730,6 +787,7 @@ hotkeys
hotlight
hotspot
HPAINTBUFFER
HPhysical
HPS
HRAWINPUT
HREDRAW
@@ -740,11 +798,15 @@ HROW
hsb
HSCROLL
hsi
HSpeed
HSync
HTCLIENT
hthumbnail
HTOUCHINPUT
HTTRANSPARENT
hutchinsoniana
HVal
HValue
Hvci
hwb
HWHEEL
@@ -755,6 +817,7 @@ HWNDLAST
HWNDNEXT
HWNDPARENT
HWNDPREV
HWP
hyjiacan
IAI
icf
@@ -836,6 +899,7 @@ INVALIDARG
invalidoperatioexception
invokecommand
ipcmanager
IPREVIEW
ipreviewhandlervisualssetfont
IPTC
irow
@@ -851,8 +915,10 @@ issuecomment
istep
Italicise
ith
ITHUMBNAIL
IUI
IUWP
IVO
IWIC
jeli
jfif
@@ -862,6 +928,7 @@ jjw
jobject
JOBOBJECT
jpe
JPN
jpnime
jrsoftware
Jsons
@@ -869,6 +936,7 @@ jsonval
jxr
Kantai
KBSC
kdc
keybd
KEYBDDATA
KEYBDINPUT
@@ -913,6 +981,7 @@ LEFTTEXT
Lenovo
LError
LEVELID
LExit
LFU
LGD
lhwnd
@@ -952,6 +1021,7 @@ lowlevel
LOWORD
lparam
LPBITMAPINFOHEADER
LPCFHOOKPROC
lpch
LPCITEMIDLIST
LPCLSID
@@ -970,6 +1040,7 @@ LPMONITORINFO
LPOSVERSIONINFOEXW
LPQUERY
lprc
LPrivate
LPSAFEARRAY
lpstr
lpsz
@@ -983,6 +1054,7 @@ LPW
lpwcx
lpwndpl
lquadrant
LReader
LRESULT
LSTATUS
lstrcmp
@@ -993,8 +1065,12 @@ LTEXT
LTM
LTRREADING
luid
LUMA
lusrmgr
LVal
LVDS
LWA
lwin
LWIN
LZero
MAGTRANSFORM
@@ -1058,10 +1134,13 @@ MINIMIZESTART
MINMAXINFO
minwindef
Mip
Miracast
miracast
mkdn
mlcfg
mmc
mmcexe
MMdd
mmi
mmsys
mobileredirect
@@ -1087,6 +1166,7 @@ mouseutils
MOVESIZEEND
MOVESIZESTART
MRM
MRT
mru
msaccess
MSAL
@@ -1097,6 +1177,8 @@ msdata
msdia
MSDL
MSGFLT
MSHCTX
MSHLFLAGS
msiexec
MSIFASTINSTALL
MSIHANDLE
@@ -1133,6 +1215,7 @@ myorg
myrepo
NAMECHANGE
namespaceanddescendants
Nanjing
nao
NCACTIVATE
ncc
@@ -1158,6 +1241,7 @@ netcpl
netframework
netsetup
netsh
newcolor
NEWDIALOGSTYLE
NEWFILE
NEWFILEHEADER
@@ -1170,6 +1254,7 @@ newrow
nicksnettravels
NIF
nightlight
NLog
NLSTEXT
NMAKE
NNN
@@ -1259,6 +1344,7 @@ OFN
ofs
OICI
OICIIO
oldcolor
olditem
oldpath
oldtheme
@@ -1289,6 +1375,7 @@ OUTOFCONTEXT
Outptr
outputtype
outsettings
outsourced
OVERLAPPEDWINDOW
Oversampling
OVERWRITEPROMPT
@@ -1315,6 +1402,7 @@ PATINVERT
PATPAINT
pbc
pbi
PBlob
PBP
pbrush
pcb
@@ -1325,7 +1413,6 @@ pchast
PCIDLIST
PCTSTR
PCWSTR
pdbs
PDBs
PDEVMODE
PDFs
@@ -1337,6 +1424,7 @@ pdto
pdtobj
pdw
Peb
PElems
Pels
PELSHEIGHT
PELSWIDTH
@@ -1353,6 +1441,7 @@ pguid
phbm
phbmp
phicon
PHL
Photoshop
photoshop
phwnd
@@ -1360,6 +1449,7 @@ pici
pidl
PIDLIST
pii
pinboard
pinfo
pinvoke
pipename
@@ -1384,9 +1474,7 @@ Pokedex
Pomodoro
popups
POPUPWINDOW
portfile
POSITIONITEM
Postbot
POWERBROADCAST
powerdisplay
POWERDISPLAYMODULEINTERFACE
@@ -1462,6 +1550,7 @@ psrm
psrree
pstatstg
pstm
PStr
pstream
pstrm
PSYSTEM
@@ -1472,6 +1561,7 @@ PTCHAR
ptcontrols
ptd
PTOKEN
PToy
ptstr
ptsym
pui
@@ -1482,6 +1572,7 @@ PWSTR
pwsz
pwtd
qdc
QDS
qit
QITAB
QITABENT
@@ -1496,7 +1587,9 @@ quicklinks
quickmask
QUNS
RAII
RAlt
randi
RAquadrant
rasterization
Rasterize
rasterizing
@@ -1514,6 +1607,7 @@ READMODE
READOBJECTS
recents
RECTDESTINATION
rectp
RECTSOURCE
recursesubdirs
recyclebin
@@ -1572,6 +1666,8 @@ RIDEV
RIGHTBUTTON
RIGHTSCROLLBAR
riid
RKey
RNumber
rollups
rop
ROUNDSMALL
@@ -1601,9 +1697,9 @@ SAMESHORTCUTPREVIOUSLYMAPPED
samsung
sancov
SAVEFAILED
scanled
schedtasks
SCID
SCL
Scode
SCREENFONTS
screenruler
@@ -1779,7 +1875,6 @@ STDAPI
stdc
stdcpp
stdcpplatest
stdext
STDMETHODCALLTYPE
STDMETHODIMP
steamapps
@@ -1810,6 +1905,7 @@ sublang
SUBMODULEUPDATE
subresource
sug
suntimes
Superbar
SUPPRESSMSGBOXES
sut
@@ -1817,6 +1913,7 @@ svchost
SVGIn
SVGIO
svgz
SVIDEO
SVSI
SWFO
swp
@@ -1884,6 +1981,7 @@ thickframe
THISCOMPONENT
threadpool
throughs
Tianma
TILEDWINDOW
TILLSON
timedate
@@ -1901,7 +1999,6 @@ TNP
Toggleable
tontrager
Toolhelp
toolsets
toolwindow
TOPDOWNDIB
TOUCHEVENTF
@@ -1934,11 +2031,16 @@ UACUI
UAL
uap
UBR
UBreak
ubrk
UCallback
ucrt
ucrtd
uefi
UError
uesc
UFlags
UHash
UIA
UIDs
UIEx
@@ -1947,6 +2049,8 @@ uitests
UITo
ULONGLONG
Ultrawide
UMax
UMin
ums
uncompilable
UNCPRIORITY
@@ -1965,11 +2069,12 @@ UNORM
unparsable
unremapped
Unsend
Unsubscribes
unsubscribes
untriaged
unvirtualized
unwide
unzoom
UOffset
UOI
UPDATENOW
updown
@@ -1985,6 +2090,7 @@ USEINSTALLERFORTEST
USESHOWWINDOW
USESTDHANDLES
USRDLL
UType
uuidv
uwp
uxt
@@ -1995,16 +2101,17 @@ valuegenerator
VARTYPE
vbcscompiler
vcamp
vcenter
VCENTER
vcgtq
VCINSTALLDIR
vcp
Vcpkg
vcpkg
vcpname
VCRT
vcruntime
vcvars
VDesktop
vdupq
VERBSONLY
VERBW
@@ -2033,6 +2140,7 @@ vorrq
VOS
vpaddlq
vqsubq
vredraw
VREDRAW
vreinterpretq
VSC
@@ -2045,20 +2153,24 @@ VSINSTALLDIR
VSM
vso
vsonline
VSpeed
vstemplate
vstest
VSTHRD
vstprintf
VSTT
vswhere
VSync
Vtbl
WANTNUKEWARNING
WANTPALM
WASDK
wbem
WBounds
Wca
WCE
wcex
WClass
WCRAPI
wcsicmp
wcsncpy
@@ -2141,6 +2253,7 @@ WNDCLASSW
wndproc
wnode
wom
workerw
WORKSPACESEDITOR
WORKSPACESLAUNCHER
WORKSPACESSNAPSHOTTOOL
@@ -2155,6 +2268,7 @@ wpr
wprp
wql
wregex
WReserved
WResize
WRITEOBJECTS
Wrk
@@ -2172,23 +2286,49 @@ Wubi
WUX
Wwanpp
xap
XAxis
XButton
Xbuttondown
xclip
xcopy
XDeployment
xdf
XDimension
XDocument
XElement
xfd
XFile
XIncrement
XLoc
xmp
XNamespace
Xoshiro
XPels
XPixel
XPos
XResource
xsi
XSpeed
XStr
xstyler
XTimer
XUP
XVIRTUALSCREEN
XXL
xxxxxx
YAxis
ycombinator
YDimension
YIncrement
yinle
yinyue
yoko
YPels
YPos
YResolution
YSpeed
YStr
YTimer
YVIRTUALSCREEN
zamora
Zenbook

View File

@@ -163,7 +163,7 @@ configuration:
association: Collaborator
then:
- addReply:
reply: We've identified this issue as a duplicate of an existing one and are closing this thread so discussion stays in one place.<br/><br/>Please see the comment above for the link to the original tracking issue, and feel free to subscribe there for updates.
reply: Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
- closeIssue
- removeLabel:
label: Needs-Triage

View File

@@ -9,22 +9,21 @@
*/
const fs = require('node:fs');
const REVIEWER_LOGIN = 'chatasweetie';
const REVIEWER_MENTION = `@${REVIEWER_LOGIN}`;
const COMMENT_MARKER = '<!-- telemetry-event-check -->';
const COMMENT_BODY_WITH_PRIVACY_UPDATE = `${COMMENT_MARKER}
Thank you for contributing to PowerToys. We've detected that this PR might include a new or modified telemetry event. After this PR is merged, please follow these next steps:
THIS IS A TEST | @chatasweetie is testing this functionality
Thanks for contributing to PowerToys. This change might include a new or modified telemetry event, and we want to help make sure you can get your data end to end.
- [ ] Reach out to Jessica (${REVIEWER_MENTION}) to follow up on the next steps: https://aka.ms/pt-telemetry-process
`;
1. Reach out to Jessica (@chatasweetie) to follow up on the next steps to add these telemetry events to our pipelines.`;
const COMMENT_BODY_WITHOUT_PRIVACY_UPDATE = `${COMMENT_MARKER}
Thank you for contributing to PowerToys. We've detected that this PR might include a new or modified telemetry event. Please ensure the following before merging:
THIS IS A TEST | @chatasweetie is testing this functionality
Thanks for contributing to PowerToys. This change might include a new or modified telemetry event, and we want to help make sure you can get your data end to end.
- [ ] Add your telemetry events to [DATA_AND_PRIVACY](https://github.com/microsoft/PowerToys/blob/main/DATA_AND_PRIVACY.md).md within this PR.
1. Make sure to add your telemetry events to DATA_AND_PRIVACY.md.
- [ ] Reach out to Jessica (${REVIEWER_MENTION}) to follow up on the next steps: https://aka.ms/pt-telemetry-process`;
2. Reach out to Jessica (@chatasweetie) to follow up on the next steps to add these telemetry events to our pipelines.`;
const TELEMETRY_PATH_PATTERNS = [
/(^|\/)trace\.(h|hpp|cpp|cs)$/i,
@@ -192,48 +191,6 @@ async function getAllPullFiles(apiBaseUrl, repository, pullNumber) {
return files;
}
async function getPullRequest(apiBaseUrl, repository, pullNumber) {
const url = `${apiBaseUrl}/repos/${repository}/pulls/${pullNumber}`;
const pullRequest = await apiRequest(url);
if (!pullRequest || typeof pullRequest !== 'object') {
throw new Error('Unexpected response while fetching pull request details.');
}
return pullRequest;
}
async function ensureReviewerRequested(apiBaseUrl, repository, pullNumber, pullRequest) {
const authorLogin = String(pullRequest?.user?.login || '').toLowerCase();
const targetReviewer = REVIEWER_LOGIN.toLowerCase();
if (authorLogin === targetReviewer) {
console.log(`Skipping reviewer request: ${REVIEWER_LOGIN} is the PR author.`);
return;
}
const requestedReviewers = Array.isArray(pullRequest?.requested_reviewers)
? pullRequest.requested_reviewers
: [];
const alreadyRequested = requestedReviewers.some(
(reviewer) => String(reviewer?.login || '').toLowerCase() === targetReviewer
);
if (alreadyRequested) {
console.log(`Reviewer ${REVIEWER_LOGIN} is already requested.`);
return;
}
const url = `${apiBaseUrl}/repos/${repository}/pulls/${pullNumber}/requested_reviewers`;
try {
await apiRequest(url, 'POST', { reviewers: [REVIEWER_LOGIN] });
console.log(`Requested reviewer ${REVIEWER_LOGIN}.`);
} catch (error) {
// Reviewer request should not fail the telemetry guidance workflow.
console.warn(
`Unable to request reviewer ${REVIEWER_LOGIN}: ${error instanceof Error ? error.message : String(error)}`
);
}
}
async function findExistingTelemetryComment(apiBaseUrl, repository, pullNumber) {
let page = 1;
@@ -353,16 +310,6 @@ async function main() {
);
}
try {
const pullRequest = await getPullRequest(parsedApiBaseUrl.origin, repository, pullNumber);
await ensureReviewerRequested(parsedApiBaseUrl.origin, repository, pullNumber, pullRequest);
} catch (error) {
console.warn(
'Failed to fetch PR details or request reviewer; continuing to post telemetry guidance comment.'
);
console.warn(error instanceof Error ? error.stack || error.message : error);
}
const commentBody = dataAndPrivacyChanged
? COMMENT_BODY_WITH_PRIVACY_UPDATE
: COMMENT_BODY_WITHOUT_PRIVACY_UPDATE;

5
.gitignore vendored
View File

@@ -370,8 +370,3 @@ installer/*/*.wxs.bk
.squad-workstream
.github/agents/**squad**.md
.github/workflows/**squad**.yml
# vcpkg manifest mode installed packages
vcpkg_installed/
deps/vcpkg/

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "deps/spdlog"]
path = deps/spdlog
url = https://github.com/gabime/spdlog.git
[submodule "deps/expected-lite"]
path = deps/expected-lite
url = https://github.com/martinmoene/expected-lite.git

View File

@@ -212,7 +212,6 @@
"WinUI3Apps\\PowerToys.NewPlus.ShellExtension.win10.dll",
"PowerAccent.Core.dll",
"PowerAccent.Common.dll",
"PowerToys.PowerAccent.dll",
"PowerToys.PowerAccent.exe",
"PowerToys.PowerAccentModuleInterface.dll",

View File

@@ -104,10 +104,6 @@ extends:
# Have msbuild use the release nuget config profile
additionalBuildOptions: /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:EnableCmdPalAOT=true
beforeBuildSteps:
# Install the Terrapin retrieval tool, which replaces vcpkg's download handler
# to redirect it to a safe Microsoft-controlled location
- template: .pipelines/v2/templates/steps-install-terrapin.yml@self
# Sets versions for all PowerToy created DLLs
- pwsh: |-
.pipelines/versionSetting.ps1 -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment ''
@@ -144,10 +140,6 @@ extends:
signCertName: $(SigningSignCertName)
useManagedIdentity: $(SigningUseManagedIdentity)
clientId: $(SigningOriginalClientId)
beforeBuildSteps:
# Install the Terrapin retrieval tool, which replaces vcpkg's download handler
# to redirect it to a safe Microsoft-controlled location
- template: .pipelines/v2/templates/steps-install-terrapin.yml@self
- stage: Publish
displayName: Publish

View File

@@ -270,34 +270,6 @@ jobs:
parameters:
directory: $(build.sourcesdirectory)\src\modules\cmdpal
# --- vcpkg detection + binary cache --------------------------------------
# PowerToys consumes spdlog (and, over time, other native deps) via vcpkg in
# manifest mode. steps-install-vcpkg.yml prefers the vcpkg shipped with
# Visual Studio (Microsoft.VisualStudio.Component.Vcpkg) and falls back to a
# fresh clone of microsoft/vcpkg into deps/vcpkg if VS doesn't have it.
# Either way it sets the VCPKG_ROOT pipeline variable; MSBuild integration
# is wired globally from Cpp.Build.props (with vcpkg.targets in
# Cpp.Build.targets) using the three-tier VcpkgRoot fallback
# (env var > VS-shipped > deps/vcpkg runtime clone).
#
# Vcpkg's MSBuild integration runs `vcpkg install` once per project, so the
# binary cache below saves ~3-5 minutes per triplet on cache hits.
- template: .\steps-install-vcpkg.yml
parameters:
useVSPreview: ${{ parameters.useVSPreview }}
- ${{ if eq(parameters.enablePackageCaching, true) }}:
- task: Cache@2
displayName: 'Cache vcpkg binary archives'
inputs:
# Key on the inputs vcpkg uses to compute its package ABI: the manifest,
# configuration, every overlay-port file, and the agent OS.
key: '"vcpkg" | "$(Agent.OS)" | vcpkg.json | vcpkg-configuration.json | deps/vcpkg-overlays/**'
restoreKeys: |
"vcpkg" | "$(Agent.OS)"
"vcpkg"
path: $(LOCALAPPDATA)\vcpkg\archives
- ${{ parameters.beforeBuildSteps }}

View File

@@ -15,9 +15,6 @@ parameters:
- name: signingIdentity
type: object
default: {}
- name: beforeBuildSteps
type: stepList
default: []
jobs:
- job: "BuildSDK"
@@ -48,8 +45,6 @@ jobs:
parameters:
directory: $(build.sourcesdirectory)\src\modules\cmdpal
- ${{ parameters.beforeBuildSteps }}
- pwsh: |-
& "$(build.sourcesdirectory)\src\modules\cmdpal\extensionsdk\nuget\BuildSDKHelper.ps1" -Configuration "Release" -BuildStep "build" -IsAzurePipelineBuild
displayName: Build SDK

View File

@@ -1,6 +0,0 @@
steps:
- pwsh: |-
nuget install -source "https://microsoft.pkgs.visualstudio.com/Dart/_packaging/PowerToysDependencies/nuget/v3/index.json" TerrapinRetrievalTool -Prerelease -OutputDirectory _trt -Config "$(Build.SourcesDirectory)\.pipelines\release-nuget.config"
$TerrapinRetrievalToolPath = (Get-Item _trt\TerrapinRetrievalTool.*\win-x64\TerrapinRetrievalTool.exe).FullName
Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES]x-script,${TerrapinRetrievalToolPath} -b https://vcpkg.storage.devpackages.microsoft.io/artifacts/ -a true -u None -p {url} -s {sha512} -d {dst};x-block-origin"
displayName: Set up the Terrapin Retrieval Tool (vcpkg cache)

View File

@@ -1,41 +0,0 @@
# Adapted from microsoft/terminal build/pipelines/templates-v2/steps-install-vcpkg.yml.
#
# Detects vcpkg from (in order):
# 1. The Visual Studio installation (Microsoft.VisualStudio.Component.Vcpkg,
# declared in the repo-root .vsconfig).
# 2. A local clone at deps/vcpkg, cloned and bootstrapped on demand.
#
# Sets the pipeline-scoped VCPKG_ROOT variable; the rest of the build
# resolves vcpkg through it (see the three-tier VcpkgRoot fallback in
# Cpp.Build.props). No repo-level vcpkg submodule required.
parameters:
- name: useVSPreview
type: boolean
default: false
steps:
- pwsh: |-
# vswhere -prerelease is opt-in via the useVSPreview parameter so CI on
# stable VS doesn't accidentally pick up a Preview install when both
# are present. Matches the existing useVSPreview plumbing for
# verifyAndSetLatestVCToolsVersion.ps1.
$vswhereArgs = @('-latest', '-requires', 'Microsoft.VisualStudio.Component.Vcpkg', '-property', 'installationPath')
$useVSPreview = '${{ parameters.useVSPreview }}' -eq 'True'
if ($useVSPreview) { $vswhereArgs = @('-prerelease') + $vswhereArgs }
$VsInstallRoot = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' @vswhereArgs
If ([String]::IsNullOrEmpty($VsInstallRoot)) {
Remove-Item -Recurse -Force deps/vcpkg -ErrorAction:Ignore
git clone https://github.com/microsoft/vcpkg deps/vcpkg
if ($LASTEXITCODE -ne 0) { throw "git clone vcpkg failed (exit $LASTEXITCODE)" }
Push-Location deps/vcpkg
& ./bootstrap-vcpkg.bat -disableMetrics
if ($LASTEXITCODE -ne 0) { Pop-Location; throw "bootstrap-vcpkg failed (exit $LASTEXITCODE)" }
$VcpkgRoot = $PWD
Pop-Location
Write-Host "Using vcpkg from local checkout ($VcpkgRoot)"
} Else {
$VcpkgRoot = Join-Path $VsInstallRoot 'VC\vcpkg'
Write-Host "Using vcpkg from Visual Studio installation ($VcpkgRoot)"
}
Write-Host "##vso[task.setvariable variable=VCPKG_ROOT]$VcpkgRoot"
displayName: Detect VS vcpkg or bootstrap locally

View File

@@ -18,7 +18,6 @@
"Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.ATL.Spectre",
"Microsoft.VisualStudio.Component.Vcpkg",
"Microsoft.VisualStudio.ComponentGroup.WindowsAppSDK.Cs"
]
}

View File

@@ -39,8 +39,7 @@
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
<PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
<!-- vcpkg.targets is imported via Cpp.Build.targets after Microsoft.Cpp.targets. -->
<ForceImportAfterCppTargets>$(MSBuildThisFileDirectory)Cpp.Build.targets</ForceImportAfterCppTargets>
<VcpkgEnabled>false</VcpkgEnabled>
<ReplaceWildcardsInProjectItems>true</ReplaceWildcardsInProjectItems>
<ExternalIncludePath>$(MSBuildThisFileDirectory)deps;$(MSBuildThisFileDirectory)packages;$(ExternalIncludePath)</ExternalIncludePath>
<!-- Enable control flow guard for C++ projects that don't consume any C++ files -->
@@ -122,48 +121,6 @@
<SpectreMitigation>Spectre</SpectreMitigation>
</PropertyGroup>
<!--
vcpkg integration. Set globally and loaded before Microsoft.Cpp.props (via
ForceImportBeforeCppProps) so that vcpkg.props' ClCompile hook is in place
before the C++ targets run. VcpkgRoot is resolved via the same three-tier
fallback used by microsoft/terminal (env var → VS-shipped → deps/vcpkg).
-->
<PropertyGroup Label="vcpkg">
<VcpkgEnabled>true</VcpkgEnabled>
<VcpkgEnableManifest>true</VcpkgEnableManifest>
<VcpkgManifestEnabled>true</VcpkgManifestEnabled>
<VcpkgManifestRoot>$(MSBuildThisFileDirectory)</VcpkgManifestRoot>
<VcpkgOSTarget>windows</VcpkgOSTarget>
<VcpkgUseStatic>true</VcpkgUseStatic>
<!--
Force VcpkgConfiguration to follow $(Configuration). Without this,
vcpkg.props infers VcpkgConfiguration from $(UseDebugLibraries), which
Microsoft.Cpp.Default.props has already defaulted to 'false' by the
time vcpkg.props is imported here (the PowerToys-wide Debug override
below runs LATER). That would silently link the Release-built spdlog
into Debug consumers and trigger LNK2038 (MT/MTd, _ITERATOR_DEBUG_LEVEL).
-->
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
<!-- vcpkg validates triplets case-sensitively; PowerToys uses ARM64 capital-case. -->
<VcpkgPlatformTarget Condition="'$(Platform)' == 'ARM64'">arm64</VcpkgPlatformTarget>
<VcpkgApplocalDeps>false</VcpkgApplocalDeps>
<VcpkgInstalledDir>$(MSBuildThisFileDirectory)vcpkg_installed\$(Platform)\</VcpkgInstalledDir>
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$(VCPKG_ROOT)</VcpkgRoot>
<VcpkgRoot Condition="'$(VcpkgRoot)' == '' and '$(VsInstallRoot)' != ''">$(VsInstallRoot)\VC\vcpkg</VcpkgRoot>
<VcpkgRoot Condition="'$(VcpkgRoot)' == '' or !Exists('$(VcpkgRoot)\vcpkg.exe')">$(MSBuildThisFileDirectory)deps\vcpkg</VcpkgRoot>
<CAExcludePath>$(CAExcludePath);$(VcpkgInstalledDir)</CAExcludePath>
<VCPkgLocalAppDataDisabled>true</VCPkgLocalAppDataDisabled>
</PropertyGroup>
<!-- Fail fast with an actionable message instead of opaque C1083 spdlog/spdlog.h errors. -->
<Target Name="PowerToysEnsureVcpkgAvailable"
BeforeTargets="PrepareForBuild"
Condition="'$(MSBuildProjectExtension)' == '.vcxproj' and '$(VcpkgEnabled)' == 'true' and !Exists('$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props')">
<Error Text="PowerToys requires the 'vcpkg' Visual Studio component, but it was not found.%0A%0AOpen the Visual Studio Installer, click Modify on your VS install, search for 'vcpkg', enable 'C++ vcpkg package manager', and click Modify. (Visual Studio will also prompt you to install missing .vsconfig components when you open PowerToys.slnx.)%0A%0AIf you have vcpkg installed elsewhere, set the VCPKG_ROOT environment variable to its root before building.%0A%0ASearched: '$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props'" />
</Target>
<Import Project="$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props"
Condition="'$(MSBuildProjectExtension)' == '.vcxproj' and Exists('$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props')" />
<!-- Debug/Release props -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
PowerToys global C++ post-targets. Wired in via
<ForceImportAfterCppTargets> in Cpp.Build.props so MSBuild loads this
file AFTER Microsoft.Cpp.targets for every .vcxproj.
Conditionally imports vcpkg.targets to hook ClCompile into vcpkg's
VcpkgInstallManifestDependencies target so spdlog headers are
auto-discovered on the include path and spdlog.lib is auto-linked.
vcpkg.props is imported in Cpp.Build.props (before Microsoft.Cpp.props);
vcpkg.targets needs the matching "after" hook here.
-->
<Import Project="$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.targets"
Condition="'$(MSBuildProjectExtension)' == '.vcxproj' and '$(VcpkgEnabled)' == 'true' and Exists('$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.targets')" />
</Project>

View File

@@ -41,21 +41,21 @@
<PackageVersion Include="MessagePack" Version="3.1.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.102" />
<PackageVersion Include="Microsoft.CommandPalette.Extensions" Version="0.9.260303001" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="10.0.8" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="10.0.7" />
<!-- Including Microsoft.Bcl.AsyncInterfaces to force version, since it's used by Microsoft.SemanticKernel. -->
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.8" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.7" />
<PackageVersion Include="Microsoft.Graphics.Win2D" Version="1.3.2" />
<PackageVersion Include="Microsoft.Windows.CppWinRT" Version="2.0.250303.1" />
<PackageVersion Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.16" />
<PackageVersion Include="Microsoft.Extensions.AI" Version="10.2.0" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="10.0.1-preview.1.25571.5" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.7" />
<PackageVersion Include="Microsoft.AI.Foundry.Local" Version="0.3.0" />
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.71.0" />
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.OpenAI" Version="1.71.0" />
@@ -66,9 +66,9 @@
<PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.3719.77" />
<!-- Package Microsoft.Win32.SystemEvents 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.Drawing.Common but the 8.0.1 version wasn't published to nuget. -->
<PackageVersion Include="Microsoft.Win32.SystemEvents" Version="10.0.8" />
<PackageVersion Include="Microsoft.Win32.SystemEvents" Version="10.0.7" />
<PackageVersion Include="Microsoft.WindowsPackageManager.ComInterop" Version="1.10.340" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="10.0.8" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="10.0.7" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.269" />
<!-- CsWinRT version needs to be set to have a WinRT.Runtime.dll at the same version contained inside the NET SDK we're currently building on CI. -->
<!--
@@ -106,28 +106,28 @@
<PackageVersion Include="StreamJsonRpc" Version="2.21.69" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<!-- Package System.CodeDom 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.Management but the 8.0.1 version wasn't published to nuget. -->
<PackageVersion Include="System.CodeDom" Version="10.0.8" />
<PackageVersion Include="System.CodeDom" Version="10.0.7" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.ComponentModel.Composition" Version="10.0.8" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.0.8" />
<PackageVersion Include="System.Data.OleDb" Version="10.0.8" />
<PackageVersion Include="System.ComponentModel.Composition" Version="10.0.7" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.0.7" />
<PackageVersion Include="System.Data.OleDb" Version="10.0.7" />
<!-- Package System.Diagnostics.EventLog 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.EventLog" Version="10.0.8" />
<PackageVersion Include="System.Diagnostics.EventLog" Version="10.0.7" />
<!-- Package System.Diagnostics.PerformanceCounter added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.11. -->
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="10.0.8" />
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="10.0.7" />
<PackageVersion Include="System.ClientModel" Version="1.8.1" />
<PackageVersion Include="System.Drawing.Common" Version="10.0.8" />
<PackageVersion Include="System.Drawing.Common" Version="10.0.7" />
<PackageVersion Include="System.IO.Abstractions" Version="22.0.13" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="22.0.13" />
<PackageVersion Include="System.Management" Version="10.0.8" />
<PackageVersion Include="System.Management" Version="10.0.7" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Numerics.Tensors" Version="10.0.2" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Runtime.Caching" Version="10.0.8" />
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="10.0.8" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="10.0.8" />
<PackageVersion Include="System.Text.Json" Version="10.0.8" />
<PackageVersion Include="System.Runtime.Caching" Version="10.0.7" />
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="10.0.7" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="10.0.7" />
<PackageVersion Include="System.Text.Json" Version="10.0.7" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="ToolGood.Words.Pinyin" Version="3.1.0.3" />
<PackageVersion Include="UnicodeInformation" Version="2.6.0" />

View File

@@ -68,7 +68,10 @@
<Project Path="src/common/interop/PowerToys.Interop.vcxproj" Id="f055103b-f80b-4d0c-bf48-057c55620033" />
</Folder>
<Folder Name="/common/log/">
<Project Path="src/common/logger/logger.vcxproj" Id="d9b8fc84-322a-4f9f-bbb9-20915c47ddfd" />
<Project Path="src/common/logger/logger.vcxproj" Id="d9b8fc84-322a-4f9f-bbb9-20915c47ddfd">
<BuildDependency Project="src/logging/logging.vcxproj" />
</Project>
<Project Path="src/logging/logging.vcxproj" Id="7e1e3f13-2bd6-3f75-a6a7-873a2b55c60f" />
</Folder>
<Folder Name="/common/notifications/">
<Project Path="src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj" Id="0b593a6c-4143-4337-860e-db5710fb87db" />
@@ -1004,10 +1007,6 @@
<Platform Solution="*|ARM64" Project="ARM64" />
<Platform Solution="*|x64" Project="x64" />
</Project>
<Project Path="src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ShortcutGuide.UnitTests.csproj">
<Platform Solution="*|ARM64" Project="ARM64" />
<Platform Solution="*|x64" Project="x64" />
</Project>
<Project Path="src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj" Id="e487304a-b1fb-4e6b-8e70-014051af5b99" />
</Folder>
<Folder Name="/modules/Workspaces/">

1
deps/expected-lite vendored Submodule

Submodule deps/expected-lite added at 95b9cb015f

7
deps/expected.props vendored Normal file
View File

@@ -0,0 +1,7 @@
<Project>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)expected-lite\include\nonstd\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
</Project>

1
deps/spdlog vendored Submodule

Submodule deps/spdlog added at 79524ddd08

18
deps/spdlog.props vendored
View File

@@ -1,14 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
SPDLOG_* preprocessor defines for spdlog consumers. The actual vcpkg
integration (VcpkgEnabled, VcpkgRoot, triplet, manifest install) lives
in Cpp.Build.props; this file just carries the defines that match how
the pre-vcpkg in-tree build was configured.
-->
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>SPDLOG_WCHAR_TO_UTF8_SUPPORT;SPDLOG_COMPILED_LIB;SPDLOG_WCHAR_FILENAMES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)spdlog\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SPDLOG_WCHAR_TO_UTF8_SUPPORT;SPDLOG_COMPILED_LIB;SPDLOG_WCHAR_FILENAMES;FMT_UNICODE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
</Project>

View File

@@ -1,16 +0,0 @@
--- a/include/spdlog/fmt/bundled/format.h
+++ b/include/spdlog/fmt/bundled/format.h
@@ -354,7 +354,12 @@ inline typename Container::value_type* get_data(Container& c) {
return c.data();
}
-#if defined(_SECURE_SCL) && _SECURE_SCL
+// PowerToys: stdext::checked_array_iterator was deprecated in VS 2019 16.10
+// and removed entirely in MSVC 14.51 (compiler 19.51, _MSC_VER >= 1951;
+// see microsoft/STL STL4043). Skip the broken branch on those toolsets so the
+// pointer-based fallback below is used instead. Drop this guard once
+// deps/spdlog is bumped past v1.14 (which ships fmt 10.2 and removes this code).
+#if defined(_SECURE_SCL) && _SECURE_SCL && (!defined(_MSC_VER) || _MSC_VER < 1951)
// Make a checked iterator to avoid MSVC warnings.
template <typename T> using checked_ptr = stdext::checked_array_iterator<T*>;
template <typename T> checked_ptr<T> make_checked(T* p, size_t size) {

View File

@@ -1,43 +0,0 @@
# PowerToys overlay port for spdlog.
#
# Pinned to the same git commit that the deleted deps/spdlog submodule pointed
# at, so this is a 1:1 submodule->vcpkg migration with no version change
# (per the maintainer guidance: convert one submodule at a time, atomic
# commit, don't also bump the version).
#
# A single hunk patch works around MSVC 14.51 STL4043 (removal of
# stdext::checked_array_iterator) in spdlog's bundled fmt 7. Drop this overlay
# (and switch to upstream vcpkg's spdlog port) once PowerToys bumps spdlog
# past v1.14, which ships fmt 10.2 and removes the affected code path.
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO gabime/spdlog
REF 616866fcf40340ea25a8f218369bad810ef58e72
SHA512 2076c527c7768627e6856b2f7ef663b185fd6251894cffd9299203d00f3d2de5696461060442dd72b96c9d3f0fd27f7f63ad2edfdf295e9b06c5fac6d6212faf
HEAD_REF v1.x
PATCHES
msvc-14.51-stdext-checked-array-iterator.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSPDLOG_BUILD_EXAMPLE=OFF
-DSPDLOG_BUILD_TESTS=OFF
-DSPDLOG_BUILD_BENCH=OFF
-DSPDLOG_FMT_EXTERNAL=OFF
-DSPDLOG_WCHAR_SUPPORT=ON
-DSPDLOG_WCHAR_FILENAMES=ON
-DSPDLOG_NO_EXCEPTIONS=OFF
-DSPDLOG_BUILD_SHARED=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME spdlog CONFIG_PATH lib/cmake/spdlog)
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@@ -1,18 +0,0 @@
{
"name": "spdlog",
"version-string": "1.8.5-pt-616866fc",
"port-version": 0,
"description": "Very fast, header-only/compiled, C++ logging library. PowerToys overlay pinned to gabime/spdlog@616866fc (the exact submodule commit before this migration), with a single-hunk patch that works around MSVC 14.51 removing stdext::checked_array_iterator (STL4043).",
"homepage": "https://github.com/gabime/spdlog",
"license": "MIT",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@@ -97,10 +97,6 @@ The Shell Process Debugging Tool is a Visual Studio extension that helps debug m
- Check Event Viewer for application crashes related to `PowerToys.Settings.exe`
- Crash dumps can be obtained from Event Viewer
### Debugging Command Palette
Command Palette can be easily debugged using the solution filter in `src/modules/cmdpal/Command Palette.slnf`. This will open Command Palette as its own Visual Studio solution that can be run and debugged directly in Visual Studio without the need for the Shell Process Debugging Tool.
## Troubleshooting Build Errors
### Missing Image Files or Corrupted Build State

View File

Before

Width:  |  Height:  |  Size: 497 KiB

After

Width:  |  Height:  |  Size: 497 KiB

View File

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 276 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

Before

Width:  |  Height:  |  Size: 269 KiB

After

Width:  |  Height:  |  Size: 269 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 228 KiB

View File

Before

Width:  |  Height:  |  Size: 491 KiB

After

Width:  |  Height:  |  Size: 491 KiB

View File

Before

Width:  |  Height:  |  Size: 706 KiB

After

Width:  |  Height:  |  Size: 706 KiB

View File

Before

Width:  |  Height:  |  Size: 408 KiB

After

Width:  |  Height:  |  Size: 408 KiB

View File

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 384 KiB

View File

Before

Width:  |  Height:  |  Size: 493 KiB

After

Width:  |  Height:  |  Size: 493 KiB

View File

Before

Width:  |  Height:  |  Size: 492 KiB

After

Width:  |  Height:  |  Size: 492 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View File

Before

Width:  |  Height:  |  Size: 311 KiB

After

Width:  |  Height:  |  Size: 311 KiB

View File

Before

Width:  |  Height:  |  Size: 297 KiB

After

Width:  |  Height:  |  Size: 297 KiB

View File

Before

Width:  |  Height:  |  Size: 284 KiB

After

Width:  |  Height:  |  Size: 284 KiB

View File

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 225 KiB

View File

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

View File

Before

Width:  |  Height:  |  Size: 890 KiB

After

Width:  |  Height:  |  Size: 890 KiB

View File

Before

Width:  |  Height:  |  Size: 858 KiB

After

Width:  |  Height:  |  Size: 858 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -87,7 +87,7 @@ Per Application/Package one or more Keyboard manifests can be declared. Every ma
<details>
<summary><b>WindowFilter</b> - The filter of window processes to which the shortcuts apply to</summary>
This field declares for which process name the shortcuts should be shown (To rephrase: For which processes the shortcut will have an effect if pressed). The value can be either an exact process executable name, for example `explorer.exe` or `chrome.exe`, or a single asterisk (`*`) to apply to any process. No other wildcard patterns are supported by this specification.
This field declares for which process name the shortcuts should be showed (To rephrase: For which processes the shortcut will have an effect if pressed). You can use an asterisk to leave out a certain part. For example `*.PowerToys.*.exe` targets all PowerToys processes and `*` apply to any process.
</details>
@@ -195,18 +195,10 @@ Special sections start with an identifier enclosed between `<` and `>`. This dec
A string array of all the keys that need to be pressed. If a number is supplied, it should be read as a [KeyCode](https://learn.microsoft.com/windows/win32/inputdev/virtual-key-codes) and displayed accordingly (based on the Keyboard Layout of the user).
**Literal digit keys**:
Because a bare number is interpreted as a virtual-key code, a literal digit key must be authored using the `<N>` notation (the digit enclosed between `<` and `>`), where `N` is `0``9`. For example, `<9>` represents the literal `9` key (as in the "switch to the last tab" shortcut), not the virtual-key code `9` (which is `Tab`). The interpreter strips the brackets and displays just the digit.
This applies only to a single literal digit. A range such as `1 - 8` is a free-form label, not a key, and is supplied verbatim (the brackets would only be trimmed from the ends, so `<1> - <8>` would not render as intended).
**Special keys**:
Special keys are enclosed between `<` and `>` and correspond to a key that should be displayed in a certain way. If the interpreter of the manifest file can't understand the content, the brackets should be left out.
By convention these tokens are written as double-quoted strings in the YAML (for example `"<Enter>"` and `"<9>"`), matching the quoting used for punctuation key values. YAML treats the quoted and unquoted forms identically, so quoting is for consistency rather than a strict requirement for bracketed tokens.
|Name|Description|
|----|-----------|
|`<Office>`| Corresponds to the Office key on some Windows keyboards |

View File

@@ -79,4 +79,3 @@ Below are community created plugins that target a website or software. They are
| [Linear](https://github.com/vednig/powertoys-linear) | [vednig](https://github.com/vednig) | Create Linear Issues directly from Powertoys Run |
| [PerplexitySearchShortcut](https://github.com/0x6f677548/PowerToys-Run-PerplexitySearchShortcut) | [0x6f677548](https://github.com/0x6f677548) | Search Perplexity |
| [SpeedTest](https://github.com/ruslanlap/PowerToysRun-SpeedTest) | [ruslanlap](https://github.com/ruslanlap) | One-command internet speed tests with real-time results, modern UI, and shareable links. |
| [DiskAnalyzer](https://github.com/thetsaw/PowerToys.Plugin) | [thetsaw](https://github.com/thetsaw) | Scan folders, find the largest files, and view drive space usage with visual progress bars. |

View File

@@ -8,6 +8,9 @@
</Project>
<Project Path="../src/common/Telemetry/EtwTrace/EtwTrace.vcxproj" Id="8f021b46-362b-485c-bfba-ccf83e820cbd" />
<Project Path="../src/common/version/version.vcxproj" Id="cc6e41ac-8174-4e8a-8d22-85dd7f4851df" />
<Project Path="../src/logging/logging.vcxproj" Id="7e1e3f13-2bd6-3f75-a6a7-873a2b55c60f">
<Build Solution="Debug|ARM64" Project="false" />
</Project>
<Project Path="PowerToysSetupCustomActionsVNext/PowerToysSetupCustomActionsVNext.vcxproj" Id="b3a354b0-1e54-4b55-a962-fb5af9330c19">
<Build Solution="Debug|ARM64" Project="false" />
</Project>

View File

@@ -4,23 +4,15 @@
<?define ShortcutGuideAssetsFiles=?>
<?define ShortcutGuideAssetsFilesPath=$(var.BinDir)WinUI3Apps\Assets\ShortcutGuide\?>
<?define ShortcutGuideManifestsFiles=?>
<?define ShortcutGuideManifestsFilesPath=$(var.BinDir)WinUI3Apps\Assets\ShortcutGuide\Manifests\?>
<Fragment>
<DirectoryRef Id="WinUI3AppsAssetsFolder">
<Directory Id="ShortcutGuideAssetsFolder" Name="ShortcutGuide">
<Directory Id="ShortcutGuideManifestsFolder" Name="Manifests" />
</Directory>
<Directory Id="ShortcutGuideAssetsFolder" Name="ShortcutGuide" />
</DirectoryRef>
<DirectoryRef Id="ShortcutGuideAssetsFolder" FileSource="$(var.ShortcutGuideAssetsFilesPath)">
<!-- Generated by generateFileComponents.ps1 -->
<!--ShortcutGuideAssetsFiles_Component_Def-->
</DirectoryRef>
<DirectoryRef Id="ShortcutGuideManifestsFolder" FileSource="$(var.ShortcutGuideManifestsFilesPath)">
<!-- Generated by generateFileComponents.ps1 -->
<!--ShortcutGuideManifestsFiles_Component_Def-->
</DirectoryRef>
<!-- Shortcut guide -->
<ComponentGroup Id="ShortcutGuideComponentGroup" >
@@ -30,12 +22,6 @@
</RegistryKey>
<RemoveFolder Id="RemoveFolderShortcutGuideAssetsInstallFolder" Directory="ShortcutGuideAssetsFolder" On="uninstall"/>
</Component>
<Component Id="RemoveShortcutGuideManifestsFolder" Guid="F47E2C3A-8D91-4B6F-A2E5-9C8D7F6A1B3E" Directory="ShortcutGuideManifestsFolder" >
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="RemoveShortcutGuideManifestsFolder" Value="" KeyPath="yes"/>
</RegistryKey>
<RemoveFolder Id="RemoveFolderShortcutGuideManifestsInstallFolder" Directory="ShortcutGuideManifestsFolder" On="uninstall"/>
</Component>
</ComponentGroup>
</Fragment>

View File

@@ -28,7 +28,7 @@ Function Generate-FileList() {
$fileExclusionList = @("*.pdb", "*.lastcodeanalysissucceeded", "createdump.exe", "powertoys.exe")
$fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*.png", "*.gif", "*.ico", "*.cur", "*.svg", "index.html", "reg.js", "gitignore.js", "srt.js", "monacoSpecialLanguages.js", "customTokenThemeRules.js", "*.pri", "*.yml")
$fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*.png", "*.gif", "*.ico", "*.cur", "*.svg", "index.html", "reg.js", "gitignore.js", "srt.js", "monacoSpecialLanguages.js", "customTokenThemeRules.js", "*.pri")
# MFC DLLs leak into the output via WindowsAppSDKSelfContained but no PowerToys binary imports them.
# Verified with dumpbin /dependents across all 2176 binaries — zero consumers.
@@ -112,8 +112,6 @@ Function Generate-FileComponents() {
foreach ($file in $fileList) {
$fileTmp = $file -replace "-", "_"
$fileTmp = $fileTmp -replace "[^A-Za-z0-9_.]", "_"
if ($fileTmp -match "^[^A-Za-z_]") { $fileTmp = "_$fileTmp" }
$componentDefs +=
@"
<File Id="$($fileListName)_File_$($fileTmp)" Source="`$(var.$($fileListName)Path)\$($file)" />`r`n
@@ -399,24 +397,8 @@ Generate-FileComponents -fileListName "ValueGeneratorImagesCmpFiles" -wxsFilePat
## Plugins
#ShortcutGuide
# Ensure manifest yml files are in the build output (the Build target's CopyToOutputDirectory
# may not run reliably under -graph mode in solution builds).
$sgManifestsSrc = "$PSScriptRoot..\..\..\src\modules\ShortcutGuide\ShortcutGuide.Ui\Assets\ShortcutGuide\Manifests"
$sgManifestsDst = "$PSScriptRoot..\..\..\$platform\Release\WinUI3Apps\Assets\ShortcutGuide\Manifests"
Write-Host "ShortcutGuide manifests: src=$sgManifestsSrc exists=$(Test-Path $sgManifestsSrc)"
Write-Host "ShortcutGuide manifests: dst=$sgManifestsDst exists=$(Test-Path $sgManifestsDst)"
if (Test-Path $sgManifestsSrc) {
New-Item -Path $sgManifestsDst -ItemType Directory -Force | Out-Null
Copy-Item "$sgManifestsSrc\*.yml" -Destination $sgManifestsDst -Force
$copied = (Get-ChildItem "$sgManifestsDst\*.yml" -ErrorAction SilentlyContinue).Count
Write-Host "ShortcutGuide manifests: copied $copied yml files to build output"
} else {
Write-Host "WARNING: ShortcutGuide manifest source not found at $sgManifestsSrc"
}
Generate-FileList -fileDepsJson "" -fileListName ShortcutGuideAssetsFiles -wxsFilePath $PSScriptRoot\ShortcutGuide.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\WinUI3Apps\Assets\ShortcutGuide\"
Generate-FileComponents -fileListName "ShortcutGuideAssetsFiles" -wxsFilePath $PSScriptRoot\ShortcutGuide.wxs
Generate-FileList -fileDepsJson "" -fileListName ShortcutGuideManifestsFiles -wxsFilePath $PSScriptRoot\ShortcutGuide.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\WinUI3Apps\Assets\ShortcutGuide\Manifests\"
Generate-FileComponents -fileListName "ShortcutGuideManifestsFiles" -wxsFilePath $PSScriptRoot\ShortcutGuide.wxs
Generate-FileComponents -fileListName "ShortcutGuideAssetsFiles" -wxsFilePath $PSScriptRoot\ShortcutGuide.wxs -regroot $registryroot
#Settings
Generate-FileList -fileDepsJson "" -fileListName SettingsV2AssetsFiles -wxsFilePath $PSScriptRoot\Settings.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\WinUI3Apps\Assets\Settings\"

View File

@@ -14,6 +14,7 @@
<PropertyGroup Label="Configuration">
</PropertyGroup>
<Import Project="$(RepoRoot)deps\expected.props" />
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>

View File

@@ -12,6 +12,17 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
</PropertyGroup>
<!--
Opt out of CsWinRT 2.2 IIDOptimizer. On .NET 10 / CsWinRT 2.2 the tool exits with code -1
after producing "0 IID calculations/fetches patched", which generates a noisy MSB3073
warning for every CsWinRT-consuming project. The IIDOptimizer is a runtime-perf optimization
that interns GUID lookups; disabling it just means a small first-call cost. This switch
causes Microsoft.Windows.CsWinRT.IIDOptimizer.targets to not be imported at all.
-->
<PropertyGroup>
<CsWinRTIIDOptimizerOptOut>true</CsWinRTIIDOptimizerOptOut>
</PropertyGroup>
<!-- Common from the debug / release items -->
<PropertyGroup>
<WarningLevel>4</WarningLevel>
@@ -41,7 +52,54 @@
<!-- this may need to be removed on future CsWinRT upgrades-->
<Target Name="RemoveCsWinRTPackageAnalyzer" BeforeTargets="CoreCompile">
<ItemGroup>
<Analyzer Remove="@(Analyzer)" Condition="%(Analyzer.NuGetPackageId) == 'Microsoft.Windows.CsWinRT'" />
<Analyzer Remove="@(Analyzer)" Condition="%(Analyzer.NuGetPackageId) == 'Microsoft.Windows.CsWinRT'" />
</ItemGroup>
</Target>
<!--
Ensure any referenced C++/WinRT (.vcxproj) projects are fully built BEFORE the CsWinRT
source generator runs in this csproj. On a clean machine the SDK-style ProjectReference
graph does not guarantee that the producing vcxproj has emitted its .winmd before the
consuming C# Compile / source-generator stage starts in a parallel solution build,
which manifests as CS0246 on the projected namespace (e.g. 'PowerToys.Interop').
Forcing a serialized Build of the .vcxproj references here closes that race.
We hook BEFORE ResolveProjectReferences so the produced .winmd is visible to
CsWinRTRemoveWinMDReferences (which moves it into @(CsWinRTInputs)) and we also
delete a possibly stale cswinrt.rsp so CsWinRTGenerateProjection re-invokes
cswinrt.exe instead of incrementally skipping.
-->
<Target Name="EnsureNativeWinMDProjectionInputsBuilt"
BeforeTargets="ResolveProjectReferences;ResolveAssemblyReferences;CsWinRTPrepareProjection;CsWinRTGenerateProjection"
Condition="'@(ProjectReference)' != '' and '$(DesignTimeBuild)' != 'true' and '$(BuildingProject)' != 'false'">
<ItemGroup>
<_NativeWinMDProjectionRef Include="@(ProjectReference)" Condition="'%(Extension)' == '.vcxproj'" />
</ItemGroup>
<MSBuild Projects="@(_NativeWinMDProjectionRef)"
Properties="Configuration=$(Configuration);Platform=$(Platform)"
Targets="Build"
BuildInParallel="false"
Condition="'@(_NativeWinMDProjectionRef)' != ''" />
<!-- Force CsWinRTGenerateProjection to re-run so stale-rsp incremental skip cannot
leave us without generated .cs files when the .winmd has just been (re)produced. -->
<Delete Files="$(CsWinRTGeneratedFilesDir)cswinrt.rsp;$(CsWinRTGeneratedFilesDir)cswinrt_internal.rsp"
Condition="'@(_NativeWinMDProjectionRef)' != '' and '$(CsWinRTGeneratedFilesDir)' != ''" />
<!-- Mark that we need to delete the rsp again once CsWinRTGeneratedFilesDir is fully resolved
(some projects set it to $(OutDir) which is not evaluated this early). -->
<PropertyGroup>
<_DeleteStaleCsWinRTRspPending>true</_DeleteStaleCsWinRTRspPending>
</PropertyGroup>
</Target>
<!--
Second pass: after CsWinRTPrepareProjection has resolved $(CsWinRTGeneratedFilesDir) to its
final value (which may depend on $(OutDir)), delete any stale cswinrt.rsp so the
CsWinRTGenerateProjection target's incremental-skip cannot leave us without generated .cs files.
-->
<Target Name="DeleteStaleCsWinRTRspAfterPrepare"
AfterTargets="CsWinRTPrepareProjection"
BeforeTargets="CsWinRTGenerateProjection"
Condition="'$(_DeleteStaleCsWinRTRspPending)' == 'true' and '$(CsWinRTGeneratedFilesDir)' != ''">
<Delete Files="$(CsWinRTGeneratedFilesDir)cswinrt.rsp;$(CsWinRTGeneratedFilesDir)cswinrt_internal.rsp" />
</Target>
</Project>

View File

@@ -14,6 +14,7 @@
<PropertyGroup Label="Configuration">
</PropertyGroup>
<Import Project="$(RepoRoot)deps\expected.props" />
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>

View File

@@ -161,7 +161,7 @@
<ClCompile>
<!-- We use MultiThreadedDebug, rather than MultiThreadedDebugDLL, to avoid DLL dependencies on VCRUNTIME140d.dll and MSVCP140d.dll. -->
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<!-- Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT

View File

@@ -27,9 +27,9 @@
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\;..\utils;..\Telemetry;..\..\;..\..\..\deps\;..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\;..\utils;..\Telemetry;..\..\;..\..\..\deps\;..\..\..\deps\spdlog\include;..\..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.260126.7\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp23</LanguageStandard>
<PreprocessorDefinitions>SPDLOG_WCHAR_TO_UTF8_SUPPORT;SPDLOG_HEADER_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SPDLOG_WCHAR_TO_UTF8_SUPPORT;SPDLOG_HEADER_ONLY;FMT_UNICODE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

View File

@@ -1,7 +1,27 @@
#pragma once
#include <spdlog/spdlog.h>
#include <type_traits>
#include "logger_settings.h"
// fmt 9+ no longer auto-formats enums. Provide a generic formatter that
// converts any scoped or unscoped enum to its underlying integer type so
// existing Logger::xxx(L"... {} ...", someEnum) call sites keep working
// after the spdlog 1.17 / fmt 12 upgrade.
namespace fmt
{
template <typename E, typename Char>
struct formatter<E, Char, std::enable_if_t<std::is_enum_v<E>>>
: formatter<std::underlying_type_t<E>, Char>
{
template <typename FormatContext>
auto format(E value, FormatContext& ctx) const
{
return formatter<std::underlying_type_t<E>, Char>::format(
static_cast<std::underlying_type_t<E>>(value), ctx);
}
};
}
class Logger
{
private:
@@ -17,44 +37,44 @@ public:
// log message should not be localized
template<typename FormatString, typename... Args>
static void trace(const FormatString& fmt, const Args&... args)
static void trace(const FormatString& formatString, const Args&... args)
{
logger->trace(fmt, args...);
logger->trace(fmt::runtime(formatString), args...);
}
// log message should not be localized
template<typename FormatString, typename... Args>
static void debug(const FormatString& fmt, const Args&... args)
static void debug(const FormatString& formatString, const Args&... args)
{
logger->debug(fmt, args...);
logger->debug(fmt::runtime(formatString), args...);
}
// log message should not be localized
template<typename FormatString, typename... Args>
static void info(const FormatString& fmt, const Args&... args)
static void info(const FormatString& formatString, const Args&... args)
{
logger->info(fmt, args...);
logger->info(fmt::runtime(formatString), args...);
}
// log message should not be localized
template<typename FormatString, typename... Args>
static void warn(const FormatString& fmt, const Args&... args)
static void warn(const FormatString& formatString, const Args&... args)
{
logger->warn(fmt, args...);
logger->warn(fmt::runtime(formatString), args...);
}
// log message should not be localized
template<typename FormatString, typename... Args>
static void error(const FormatString& fmt, const Args&... args)
static void error(const FormatString& formatString, const Args&... args)
{
logger->error(fmt, args...);
logger->error(fmt::runtime(formatString), args...);
}
// log message should not be localized
template<typename FormatString, typename... Args>
static void critical(const FormatString& fmt, const Args&... args)
static void critical(const FormatString& formatString, const Args&... args)
{
logger->critical(fmt, args...);
logger->critical(fmt::runtime(formatString), args...);
}
static void flush()

View File

@@ -70,6 +70,9 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\logging\logging.vcxproj">
<Project>{7e1e3f13-2bd6-3f75-a6a7-873a2b55c60f}</Project>
</ProjectReference>
<ProjectReference Include="..\version\version.vcxproj">
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
</ProjectReference>

View File

@@ -24,6 +24,8 @@
#include <regex>
#include <charconv>
#include <expected.hpp>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.ApplicationModel.h>

View File

@@ -87,7 +87,11 @@ namespace updating
// If the current version starts with 0.0.*, it means we're on a local build from a farm and shouldn't check for updates.
if constexpr (VERSION_MAJOR == 0 && VERSION_MINOR == 0)
{
#if USE_STD_EXPECTED
co_return std::unexpected(LOCAL_BUILD_ERROR);
#else
co_return nonstd::make_unexpected(LOCAL_BUILD_ERROR);
#endif
}
try
@@ -139,7 +143,11 @@ namespace updating
catch (...)
{
}
#if USE_STD_EXPECTED
co_return std::unexpected(NETWORK_ERROR);
#else
co_return nonstd::make_unexpected(NETWORK_ERROR);
#endif
}
#pragma warning(pop)

View File

@@ -5,7 +5,14 @@
#include <filesystem>
#include <variant>
#include <winrt/Windows.Foundation.h>
//#if __MSVC_VERSION__ >= 1933 // MSVC begin to support std::unexpected in 19.33
#if __has_include(<expected> ) // use the same way with excepted-lite to detect std::unexcepted, as using it as backup
#include <expected>
#define USE_STD_EXPECTED 1
#else
#include <expected.hpp>
#define USE_STD_EXPECTED 0
#endif
#include <common/version/helper.h>
#include <wil/coroutine.h>
@@ -24,7 +31,12 @@ namespace updating
std::wstring installer_filename;
};
using github_version_info = std::variant<new_version_download_info, version_up_to_date>;
#if USE_STD_EXPECTED
using github_version_result = std::expected<github_version_info, std::wstring>;
#else
using github_version_result = nonstd::expected<github_version_info, std::wstring>;
#endif
wil::task<github_version_result> get_github_version_info_async(bool prerelease = false);
wil::task<std::optional<std::filesystem::path>> download_new_version_async(new_version_download_info new_version);

View File

@@ -9,6 +9,7 @@
<ProjectName>ApplicationUpdate</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\..\..\deps\expected.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>

164
src/logging/logging.vcxproj Normal file
View File

@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7E1E3F13-2BD6-3F75-A6A7-873A2B55C60F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<ProjectName>spdlog</ProjectName>
</PropertyGroup>
<Import Project="$(RepoRoot)deps\spdlog.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<OutDir>$(RepoRoot)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</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" />
<ItemDefinitionGroup>
<ClCompile>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<DebugInformationFormat>None</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;SPDLOG_COMPILED_LIB;SPDLOG_WCHAR_FILENAMES;SPDLOG_WCHAR_TO_UTF8_SUPPORT;FMT_UNICODE=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)</ObjectFileName>
<FunctionLevelLinking>true</FunctionLevelLinking>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
</ClCompile>
<Lib>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(RepoRoot)deps\spdlog\src\spdlog.cpp" />
<ClCompile Include="$(RepoRoot)deps\spdlog\src\stdout_sinks.cpp" />
<ClCompile Include="$(RepoRoot)deps\spdlog\src\color_sinks.cpp" />
<ClCompile Include="$(RepoRoot)deps\spdlog\src\file_sinks.cpp" />
<ClCompile Include="$(RepoRoot)deps\spdlog\src\async.cpp" />
<ClCompile Include="$(RepoRoot)deps\spdlog\src\cfg.cpp" />
<ClCompile Include="$(RepoRoot)deps\spdlog\src\bundled_fmtlib_format.cpp" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\async.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\async_logger-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\async_logger.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\common-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\common.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\formatter.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fwd.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\logger-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\logger.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\pattern_formatter-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\pattern_formatter.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\spdlog-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\spdlog.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\stopwatch.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\tweakme.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\version.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\backtracer-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\backtracer.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\circular_q.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\console_globals.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\file_helper-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\file_helper.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\fmt_helper.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\log_msg-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\log_msg.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\log_msg_buffer-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\log_msg_buffer.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\mpmc_blocking_q.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\null_mutex.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\os-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\os.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\periodic_worker-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\periodic_worker.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\registry-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\registry.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\synchronous_factory.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\tcp_client-windows.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\tcp_client.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\thread_pool-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\thread_pool.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\details\windows_include.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\android_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\ansicolor_sink-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\ansicolor_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\base_sink-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\base_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\basic_file_sink-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\basic_file_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\daily_file_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\dist_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\dup_filter_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\msvc_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\null_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\ostream_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\ringbuffer_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\rotating_file_sink-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\rotating_file_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\sink-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\stdout_color_sinks-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\stdout_color_sinks.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\stdout_sinks-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\stdout_sinks.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\syslog_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\systemd_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\tcp_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\win_eventlog_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\wincolor_sink-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\sinks\wincolor_sink.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bin_to_hex.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\chrono.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\fmt.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\ostr.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\chrono.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\color.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\compile.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\core.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\format-inl.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\format.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\locale.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\os.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\ostream.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\posix.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\printf.h" />
<ClInclude Include="$(RepoRoot)deps\spdlog\include\spdlog\fmt\bundled\ranges.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="$(ProjectDir)..\..\deps\spdlog\src\spdlog.cpp" />
<ClCompile Include="$(ProjectDir)..\..\deps\spdlog\src\stdout_sinks.cpp" />
<ClCompile Include="$(ProjectDir)..\..\deps\spdlog\src\color_sinks.cpp" />
<ClCompile Include="$(ProjectDir)..\..\deps\spdlog\src\file_sinks.cpp" />
<ClCompile Include="$(ProjectDir)..\..\deps\spdlog\src\async.cpp" />
<ClCompile Include="$(ProjectDir)..\..\deps\spdlog\src\cfg.cpp" />
<ClCompile Include="$(ProjectDir)..\..\deps\spdlog\src\fmt.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\async.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\async_logger-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\async_logger.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\common-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\common.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\formatter.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fwd.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\logger-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\logger.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\pattern_formatter-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\pattern_formatter.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\spdlog-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\spdlog.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\stopwatch.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\tweakme.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\version.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\backtracer-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\backtracer.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\circular_q.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\console_globals.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\file_helper-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\file_helper.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\fmt_helper.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\log_msg-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\log_msg.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\log_msg_buffer-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\log_msg_buffer.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\mpmc_blocking_q.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\null_mutex.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\os-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\os.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\periodic_worker-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\periodic_worker.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\registry-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\registry.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\synchronous_factory.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\tcp_client-windows.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\tcp_client.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\thread_pool-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\thread_pool.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\details\windows_include.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\android_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\ansicolor_sink-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\ansicolor_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\base_sink-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\base_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\basic_file_sink-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\basic_file_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\daily_file_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\dist_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\dup_filter_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\msvc_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\null_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\ostream_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\ringbuffer_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\rotating_file_sink-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\rotating_file_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\sink-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\stdout_color_sinks-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\stdout_color_sinks.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\stdout_sinks-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\stdout_sinks.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\syslog_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\systemd_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\tcp_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\win_eventlog_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\wincolor_sink-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\sinks\wincolor_sink.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bin_to_hex.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\chrono.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\fmt.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\ostr.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\chrono.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\color.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\compile.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\core.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\format-inl.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\format.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\locale.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\os.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\ostream.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\posix.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\printf.h" />
<ClInclude Include="$(ProjectDir)..\..\deps\spdlog\include\spdlog\fmt\bundled\ranges.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{CDF4BA23-560C-3A6F-8D1C-2F5ACA434329}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\spdlog">
<UniqueIdentifier>{EFFE8123-D806-3145-8ABC-B48562A6C8F2}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\spdlog\details">
<UniqueIdentifier>{C546A431-88F1-390F-B0F0-D9CAC274B7F5}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\spdlog\fmt">
<UniqueIdentifier>{08320F28-6D0D-3217-B0B3-A98758C02C97}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\spdlog\fmt\bundled">
<UniqueIdentifier>{C856528D-4506-3A62-B279-CBB4558CB61D}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\spdlog\sinks">
<UniqueIdentifier>{A5EE33C4-AB64-38F0-BF4A-CCD02FFAB715}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{8B480F42-A230-3344-A387-2D050CFF7D9C}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@@ -2,8 +2,6 @@
// 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.Text;
using AdvancedPaste.Helpers;
using Windows.ApplicationModel.DataTransfer;
@@ -15,26 +13,15 @@ namespace AdvancedPaste.FuzzTests
{
public static void FuzzToJsonFromXmlOrCsv(ReadOnlySpan<byte> input)
{
// Decode the input bytes as UTF-8 text. `ReadOnlySpan<byte>.ToString()`
// returns the type name (e.g. "System.ReadOnlySpan<Byte>[N]") rather
// than the bytes, so an explicit decode is required to actually exercise
// the helper with the provided input.
string text = Encoding.UTF8.GetString(input);
var dataPackage = new DataPackage();
dataPackage.SetText(text);
// Use GetAwaiter().GetResult() so any thrown exception surfaces with its
// original type. `Task.Run(...).Result` wraps thrown exceptions in an
// AggregateException, which would prevent the
// `when (ex is ArgumentException)` filter below from matching.
try
{
_ = Task.Run(async () => await JsonHelper.ToJsonFromXmlOrCsvAsync(dataPackage.GetView())).GetAwaiter().GetResult();
var dataPackage = new DataPackage();
dataPackage.SetText(input.ToString());
_ = Task.Run(async () => await JsonHelper.ToJsonFromXmlOrCsvAsync(dataPackage.GetView())).Result;
}
catch (Exception ex) when (ex is ArgumentException)
{
// It's important to filter out any *expected* exceptions from our code here.
// This is an example. It's important to filter out any *expected* exceptions from our code here.
// However, catching all exceptions is considered an anti-pattern because it may suppress legitimate
// issues, such as a NullReferenceException thrown by our code. In this case, we still re-throw
// the exception, as the ToJsonFromXmlOrCsvAsync method is not expected to throw any exceptions.

View File

@@ -57,21 +57,7 @@ namespace AdvancedPaste.Helpers
return string.Empty;
}
string text;
try
{
text = await clipboardData.GetTextAsync();
}
catch (Exception ex)
{
// GetTextAsync goes through WinRT/COM and can fail for reasons outside
// our control (e.g. clipboard contention, malformed payloads from other
// apps). The contract for this helper is that it does not throw — any
// failure to read clipboard text should be treated as "no text".
Logger.LogError("Failed reading text from clipboard", ex);
return string.Empty;
}
var text = await clipboardData.GetTextAsync();
string jsonText = string.Empty;
// If the text is already JSON, return it

View File

@@ -28,12 +28,7 @@ namespace ipc
try
{
m_stream = std::ofstream(path, std::ios::binary);
if (!m_stream.is_open())
{
return E_FAIL;
}
m_stream = std::ofstream(path);
return S_OK;
}
catch (...)

View File

@@ -61,7 +61,7 @@ namespace winrt::PowerToys::FileLocksmithLib::Interop::implementation
com_array<hstring> NativeMethods::ReadPathsFromFile()
{
std::ifstream stream(paths_file(), std::ios::binary);
std::ifstream stream(paths_file());
std::vector<std::wstring> result_cpp;
std::wstring line;
@@ -98,7 +98,7 @@ namespace winrt::PowerToys::FileLocksmithLib::Interop::implementation
bool NativeMethods::StartAsElevated(array_view<hstring const> paths)
{
std::ofstream stream(paths_file(), std::ios::binary);
std::ofstream stream(paths_file());
const WCHAR newline = L'\n';
for (uint32_t i = 0; i < paths.size(); i++)

View File

@@ -84,6 +84,7 @@
..\..\..\common;
..\..\..\common\logger;
..\..\..\common\utils;
..\..\..\..\deps\spdlog\include;
%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
</ClCompile>

View File

@@ -698,7 +698,7 @@ void LightSwitchInterface::init_settings()
}
catch (const winrt::hresult_error& e)
{
Logger::error(L"[Light Switch] init_settings: hresult_error 0x{:08X} - {}", e.code(), e.message().c_str());
Logger::error(L"[Light Switch] init_settings: hresult_error 0x{:08X} - {}", static_cast<int32_t>(e.code()), e.message().c_str());
}
catch (const std::exception& e)
{

View File

@@ -63,6 +63,7 @@
$(RepoRoot)src\common\SettingsAPI;
$(RepoRoot)src\common\Telemetry;
$(RepoRoot)src\;
..\..\..\..\deps\spdlog\include;
./;
%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>

View File

@@ -10,11 +10,12 @@
// 2009-... modified by Truong Do (TruongDo).
// 2023- Included in PowerToys.
// </history>
namespace MouseWithoutBorders.Core;
internal enum SeverityLevel
namespace MouseWithoutBorders.Class
{
Information,
Warning,
Error,
internal class SeverityLevel
{
internal static readonly SeverityLevel Information = new SeverityLevel();
internal static readonly SeverityLevel Error = new SeverityLevel();
internal static readonly SeverityLevel Warning = new SeverityLevel();
}
}

View File

@@ -196,6 +196,11 @@ internal static class Encryption
return (uint)((hashValue[0] << 23) + (hashValue[1] << 16) + (hashValue[^1] << 8) + hashValue[2]);
}
internal static string GetDebugInfo(string st)
{
return string.IsNullOrEmpty(st) ? st : ((byte)(Common.GetBytesU(st).Sum(value => value) % 256)).ToString(CultureInfo.InvariantCulture);
}
internal static string CreateDefaultKey()
{
return CreateRandomKey();

View File

@@ -62,7 +62,7 @@ internal static class Helper
{
Process p = Process.GetCurrentProcess();
string procInfo = $"{p.PrivateMemorySize64 / 1024 / 1024}MB, {p.TotalProcessorTime}, {Environment.ProcessorCount}.";
string threadStacks = $"{procInfo}\r\n{Thread.DumpThreadsStack()}\r\n";
string threadStacks = $"{procInfo} {Thread.DumpThreadsStack()}";
Logger.TelemetryLogTrace(threadStacks, SeverityLevel.Error);
break;
}
@@ -379,7 +379,7 @@ internal static class Helper
log += "=============================================================================================================================\r\n";
log += $"{Application.ProductName} version {Application.ProductVersion}\r\n";
log += $"{Setting.Values.Username}/{Logger.GetChecksum(Encryption.MyKey)}\r\n";
log += $"{Setting.Values.Username}/{Encryption.GetDebugInfo(Encryption.MyKey)}\r\n";
log += $"{Common.MachineName}/{Common.MachineID}/{Common.DesMachineID}\r\n";
log += $"Id: {Setting.Values.DeviceId}\r\n";
log += $"Matrix: {string.Join(",", MachineStuff.MachineMatrix)}\r\n";
@@ -428,12 +428,9 @@ internal static class Helper
log += Setting.Values.LastPersonalizeLogonScr + "\r\n";
log += "Name2IP =\r\n" + Setting.Values.Name2IP + "\r\n";
// note - this doesn't actually log the last 10 messages - it really concatenates the counts of
// the first 10 unique messages that were logged, which isn't really very useful so we'll remove it
/*
log += "Last 10 trace messages:\r\n";
log += string.Join(Environment.NewLine, Logger.LogCounter.Select(item => $"({item.Value}): {item.Key}").Take(10));
*/
log += "\r\n=============================================================================================================================";

View File

@@ -7,11 +7,10 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
@@ -31,60 +30,29 @@ namespace MouseWithoutBorders.Core;
internal static class Logger
{
// keep a count of unique lines of text that get logged
private static readonly ConcurrentDictionary<string, int> LogCounter = new();
// implements a simple ring buffer to store recent log entries in memory
private const int MAX_LOG = 10000;
private static readonly string[] AllLogs = new string[MAX_LOG];
internal static readonly string[] AllLogs = new string[MAX_LOG];
private static readonly Lock AllLogsLock = new();
internal static readonly ConcurrentDictionary<string, int> LogCounter = new();
private const int MAX_LOG = 10000;
private static int allLogsIndex;
// used for throttling the number of exceptions that get logged
// so that high-volume exceptions don't flood the logs
private const int MaxLogExceptionPerHour = 1000;
private static int lastHour;
private static int exceptionCount;
// track some application statistics
private static PackageMonitor lastPackageSent;
private static PackageMonitor lastPackageReceived;
internal static void TelemetryLogTrace(string log, SeverityLevel severityLevel, bool flush = false)
{
var logCount = Logger.LogCounter.AddOrUpdate(log, 1, (key, value) => value + 1);
int logCount = LogCounter.AddOrUpdate(log, 1, (key, value) => value + 1);
Logger.Log(log);
}
private static void Log(string format, params object[] args)
{
Logger.Log(string.Format(CultureInfo.InvariantCulture, format, args));
}
internal static void Log(string log, bool clearLog = false, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
{
log = DateTime.Now.ToString("MM/dd HH:mm:ss.fff", CultureInfo.InvariantCulture) + $"({Thread.CurrentThread.ManagedThreadId})" + log;
ManagedCommon.Logger.LogInfo(log, memberName, sourceFilePath, sourceLineNumber);
lock (AllLogsLock)
{
if (clearLog)
{
allLogsIndex = 0;
}
AllLogs[allLogsIndex] = log;
allLogsIndex = (allLogsIndex + 1) % MAX_LOG;
}
}
internal static void Log(Exception e, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
internal static void Log(Exception e, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
if (e is not KnownException)
{
var exText = e.ToString();
string exText = e.ToString();
Logger.Log($"!Exception!: {exText}", memberName, sourceFilePath, sourceLineNumber);
Log($"!Exception!: {exText}", memberName, sourceFilePath, sourceLineNumber);
if (DateTime.UtcNow.Hour != lastHour)
{
@@ -103,209 +71,172 @@ internal static class Logger
}
}
[Conditional("DEBUG")]
private const string HeaderSENT =
"Be{0},Ke{1},Mo{2},He{3},Mx{4},Tx{5},Im{6},By{7},Cl{8},Dr{9},De{10},Ed{11},Ie{12},Ni{13}";
private const string HeaderRECEIVED =
"Be{0},Ke{1},Mo{2},He{3},Mx{4},Tx{5},Im{6},By{7},Cl{8},Dr{9},De{10},Ed{11},In{12},Ni{13},Pc{14}/{15}";
internal static void LogDebug(string log, bool clearLog = false, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
#if DEBUG
Log(log, clearLog, memberName, sourceFilePath, sourceLineNumber);
#endif
}
internal static void Log(string log, bool clearLog = false, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0)
{
log = DateTime.Now.ToString("MM/dd HH:mm:ss.fff", CultureInfo.InvariantCulture) + $"({Thread.CurrentThread.ManagedThreadId})" + log;
ManagedCommon.Logger.LogInfo(log, memberName, sourceFilePath, sourceLineNumber);
lock (AllLogsLock)
{
if (clearLog)
{
allLogsIndex = 0;
}
AllLogs[allLogsIndex] = log;
allLogsIndex = (allLogsIndex + 1) % MAX_LOG;
}
}
internal static void LogDebug(string format, params object[] args)
{
#if DEBUG
Logger.Log(format, args);
#endif
}
[Conditional("DEBUG")]
internal static void LogDebug(string log, bool clearLog = false, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
private static void Log(string format, params object[] args)
{
Logger.Log(log, clearLog, memberName, sourceFilePath, sourceLineNumber);
Logger.Log(string.Format(CultureInfo.InvariantCulture, format, args));
}
private static PackageMonitor lastPackageSent;
private static PackageMonitor lastPackageReceived;
[Conditional("DEBUG")]
internal static void LogStatistics()
internal static void LogAll()
{
string log;
if (!lastPackageSent.Equals(Package.PackageSent))
{
var log =
$"SENT:" +
$"Be{Package.PackageSent.Heartbeat}," +
$"Ke{Package.PackageSent.Keyboard}," +
$"Mo{Package.PackageSent.Mouse}," +
$"He{Package.PackageSent.Hello}," +
$"Mx{Package.PackageSent.Matrix}," +
$"Tx{Package.PackageSent.ClipboardText}," +
$"Im{Package.PackageSent.ClipboardImage}," +
$"By{Package.PackageSent.ByeBye}," +
$"Cl{Package.PackageSent.Clipboard}," +
$"Dr{Package.PackageSent.ClipboardDragDrop}," +
$"De{Package.PackageSent.ClipboardDragDropEnd}," +
$"Ed{Package.PackageSent.ExplorerDragDrop}," +
$"Ie{Event.inputEventCount}," +
$"Ni{Package.PackageSent.Nil}";
Logger.Log(log);
lastPackageSent = Package.PackageSent;
log = string.Format(
CultureInfo.CurrentCulture,
"SENT:" + HeaderSENT,
Package.PackageSent.Heartbeat,
Package.PackageSent.Keyboard,
Package.PackageSent.Mouse,
Package.PackageSent.Hello,
Package.PackageSent.Matrix,
Package.PackageSent.ClipboardText,
Package.PackageSent.ClipboardImage,
Package.PackageSent.ByeBye,
Package.PackageSent.Clipboard,
Package.PackageSent.ClipboardDragDrop,
Package.PackageSent.ClipboardDragDropEnd,
Package.PackageSent.ExplorerDragDrop,
Event.inputEventCount,
Package.PackageSent.Nil);
Log(log);
lastPackageSent = Package.PackageSent; // Copy data
}
if (!lastPackageReceived.Equals(Package.PackageReceived))
{
var log =
$"RECEIVED:" +
$"Be{Package.PackageReceived.Heartbeat}," +
$"Ke{Package.PackageReceived.Keyboard}," +
$"Mo{Package.PackageReceived.Mouse}," +
$"He{Package.PackageReceived.Hello}," +
$"Mx{Package.PackageReceived.Matrix}," +
$"Tx{Package.PackageReceived.ClipboardText}," +
$"Im{Package.PackageReceived.ClipboardImage}," +
$"By{Package.PackageReceived.ByeBye}," +
$"Cl{Package.PackageReceived.Clipboard}," +
$"Dr{Package.PackageReceived.ClipboardDragDrop}," +
$"De{Package.PackageReceived.ClipboardDragDropEnd}," +
$"Ed{Package.PackageReceived.ExplorerDragDrop}," +
$"Ie{Event.invalidPackageCount}," +
$"Ni{Package.PackageReceived.Nil}" +
$"Pc{Receiver.processedPackageCount}/{Receiver.skippedPackageCount}";
Logger.Log(log);
log = string.Format(
CultureInfo.CurrentCulture,
"RECEIVED:" + HeaderRECEIVED,
Package.PackageReceived.Heartbeat,
Package.PackageReceived.Keyboard,
Package.PackageReceived.Mouse,
Package.PackageReceived.Hello,
Package.PackageReceived.Matrix,
Package.PackageReceived.ClipboardText,
Package.PackageReceived.ClipboardImage,
Package.PackageReceived.ByeBye,
Package.PackageReceived.Clipboard,
Package.PackageReceived.ClipboardDragDrop,
Package.PackageReceived.ClipboardDragDropEnd,
Package.PackageReceived.ExplorerDragDrop,
Event.invalidPackageCount,
Package.PackageReceived.Nil,
Receiver.processedPackageCount,
Receiver.skippedPackageCount);
Log(log);
lastPackageReceived = Package.PackageReceived;
}
}
internal static void GenerateLog()
{
int l = Setting.Values.DumpObjectsLevel;
if (l is > 0 and < 10)
{
Logger.DumpObjects(l);
}
}
private static List<ProcessThread> myThreads;
internal static void DumpObjects(int level)
{
try
{
string logFile = Path.Combine(Common.RunWithNoAdminRight ? Path.GetTempPath() : Path.GetDirectoryName(Application.ExecutablePath), "MagicMouse.log");
StringBuilder sb = new(1000000);
string log;
myThreads = new List<ProcessThread>();
foreach (ProcessThread t in Process.GetCurrentProcess().Threads)
{
myThreads.Add(t);
}
Logger.DumpProgramLogs(sb, level);
Logger.DumpStaticTypes(sb, level);
log = string.Format(
CultureInfo.CurrentCulture,
"{0} {1}\r\n{2}\r\n\r\n{3}",
Application.ProductName,
Application.ProductVersion,
"Private Mem: " + (Process.GetCurrentProcess().PrivateMemorySize64 / 1024).ToString(CultureInfo.CurrentCulture) + "KB",
sb.ToString());
if (!string.IsNullOrEmpty(Encryption.myKey))
{
log = log.Replace(Encryption.MyKey, Encryption.GetDebugInfo(Encryption.MyKey));
}
log += Thread.DumpThreadsStack();
log += $"\r\nCurrent process session: {Process.GetCurrentProcess().SessionId}, active console session: {NativeMethods.WTSGetActiveConsoleSessionId()}.";
File.WriteAllText(logFile, log);
if (Common.RunOnLogonDesktop || Common.RunOnScrSaverDesktop)
{
_ = MessageBox.Show("Dump file created: " + logFile, Application.ProductName);
}
else
{
Common.ShowToolTip("Dump file created: " + logFile + " and placed in the Clipboard.", 10000);
Clipboard.SetText(logFile);
}
}
catch (Exception e)
{
_ = MessageBox.Show(e.Message + "\r\n" + e.StackTrace, Application.ProductName);
}
}
internal static void DumpProgramLogs(StringBuilder sb, int level)
{
_ = Logger.PrivateDump(sb, AllLogs, "[Program Logs]\r\n===============\r\n", 0, level, true);
}
internal static string DumpObjects(int level)
{
var sb = new StringBuilder(1000000);
Logger.DumpProgramLogs(sb, level);
Logger.DumpStaticTypes(sb, level);
var log =
$"{Application.ProductName} {Application.ProductVersion}\r\n" +
$"Private Mem: {Process.GetCurrentProcess().PrivateMemorySize64 / 1024}KB\r\n" +
$"\r\n" +
$"{sb}\r\n";
// obfuscate the current encryption key
if (!string.IsNullOrEmpty(Encryption.myKey))
{
log = log.Replace(Encryption.MyKey, Logger.GetChecksum(Encryption.MyKey));
}
log += Thread.DumpThreadsStack();
log += "\r\n";
log += $"Current process session: {Process.GetCurrentProcess().SessionId}\r\n";
log += $"Active console session: {NativeMethods.WTSGetActiveConsoleSessionId()}";
return log;
}
private static void DumpObject(StringBuilder sb, object obj, int level, Type t, int maxLevel)
{
if (t == typeof(Delegate))
{
return;
}
if (obj is PackageType or string or AddressFamily or ID or IPAddress)
{
return;
}
var typeName = obj.GetType().ToString();
if (typeName.EndsWith("type", StringComparison.CurrentCultureIgnoreCase)
|| typeName.Contains("Cryptography")
|| typeName.EndsWith("AsyncEventBits", StringComparison.CurrentCultureIgnoreCase))
{
return;
}
var recurse = (obj is not null)
&& (obj is not DATA)
&& (obj.GetType().BaseType != typeof(ValueType))
&& !obj.GetType().Namespace.Contains("System.Windows");
var fi = t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
foreach (var f in fi)
{
if (f.GetValue(obj) != AllLogs)
{
_ = PrivateDump(sb, f.GetValue(obj), f.Name, level + 1, maxLevel, recurse);
}
}
if (obj is Dictionary<string, List<IPAddress>> dict)
{
foreach (var kvp in dict)
{
foreach (var ipAddress in kvp.Value)
{
_ = PrivateDump(sb, ipAddress, $"[{kvp.Key}]", level + 1, maxLevel, true);
}
}
}
else if (obj is Array arr)
{
try
{
if (obj is string[] or int[] or uint[] or short[] or ushort[]
or MachineInf[] or TcpClient[] or IPAddress[] or TcpSk[]
or TcpServer[] or ProcessThread[] or Thread[])
{
for (var i = 0; i < arr.GetLength(0); i++)
{
_ = PrivateDump(sb, arr.GetValue(i), $"[{i}]", level + 1, maxLevel, true);
}
}
else
{
_ = PrivateDump(sb, $"{typeName}: N/A", typeName, level + 1, maxLevel, true);
}
}
catch (Exception)
{
}
}
}
private static bool PrivateDump(StringBuilder sb, object obj, string objName, int level, int maxLevel, bool recurse)
{
if (obj == null || ((maxLevel is >= 0) && (level >= maxLevel)) || obj is Cursor)
{
return false;
}
var objString = obj.ToString();
var values = new string[7];
values[0] = new string('-', Math.Max(level - 1, 0) * 2);
values[1] = objName;
/* values[2] = " "; */
/* values[3] = t.FullName; */
values[4] = " = ";
values[5] = objName.Equals(nameof(Encryption.myKey), StringComparison.OrdinalIgnoreCase)
? Logger.GetChecksum(objString)
: objName.Equals("lastClipboardObject", StringComparison.OrdinalIgnoreCase)
? string.Empty
: objString
.Replace("System.Windows.Forms.", string.Empty)
.Replace("System.Net.Sockets.", string.Empty)
.Replace("System.Security.Cryptography.", string.Empty)
.Replace("System.Threading.", string.Empty)
.Replace("System.ComponentModel.", string.Empty)
.Replace("System.Runtime.", string.Empty)
.Replace("System.Drawing.", string.Empty)
.Replace("System.Object", "O")
.Replace("System.Diagnostics.", string.Empty)
.Replace("System.Collections.", string.Empty)
.Replace("System.Drawing.", string.Empty)
.Replace("System.Int", string.Empty)
.Replace("System.EventHandler.", string.Empty);
values[6] = "\r\n";
_ = sb.Append(string.Concat(values).Replace(Common.BinaryName, "MM"));
var t = obj.GetType();
if (!recurse || t.IsPrimitive)
{
return false;
}
Logger.DumpObject(sb, obj, level, t, maxLevel);
return true;
_ = Logger.PrivateDump(sb, AllLogs, "[Program logs]\r\n===============\r\n", 0, level, false);
}
internal static void DumpStaticTypes(StringBuilder sb, int level)
@@ -336,7 +267,169 @@ internal static class Logger
}
}
private static void DumpType(StringBuilder sb, Type typeToDump, int level, int maxLevel)
internal static bool PrivateDump(StringBuilder sb, object obj, string objName, int level, int maxLevel, bool stop)
{
Type t;
string padStr = string.Empty;
string[] strArr;
string objString;
if (obj == null || (maxLevel >= 0 && level >= maxLevel) || obj is Cursor)
{
return false;
}
for (int i = 0; i < level; i++)
{
padStr += i < level - 1 ? "-" : padStr += string.Empty;
}
objString = obj.ToString();
t = obj.GetType();
strArr = new string[7];
strArr[0] = padStr;
strArr[1] = objName;
// strArr[2] = " ";
// strArr[3] = t.FullName;
strArr[4] = " = ";
strArr[5] = objName.Equals("myKey", StringComparison.OrdinalIgnoreCase)
? Encryption.GetDebugInfo(objString)
: objName.Equals("lastClipboardObject", StringComparison.OrdinalIgnoreCase)
? string.Empty
: objString
.Replace("System.Windows.Forms.", string.Empty)
.Replace("System.Net.Sockets.", string.Empty)
.Replace("System.Security.Cryptography.", string.Empty)
.Replace("System.Threading.", string.Empty)
.Replace("System.ComponentModel.", string.Empty)
.Replace("System.Runtime.", string.Empty)
.Replace("System.Drawing.", string.Empty)
.Replace("System.Object", "O")
.Replace("System.Diagnostics.", string.Empty)
.Replace("System.Collections.", string.Empty)
.Replace("System.Drawing.", string.Empty)
.Replace("System.Int", string.Empty)
.Replace("System.EventHandler.", string.Empty);
strArr[6] = "\r\n";
_ = sb.Append(string.Concat(strArr).Replace(Common.BinaryName, "MM"));
if (stop || t.IsPrimitive)
{
return false;
}
Logger.DumpObject(sb, obj, level, t, maxLevel);
return true;
}
internal static void DumpObject(StringBuilder sb, object obj, int level, Type t, int maxLevel)
{
int i;
bool stop;
if (t == typeof(Delegate))
{
return;
}
FieldInfo[] fi;
string type;
if (obj is PackageType or string or AddressFamily or ID or IPAddress)
{
return;
}
type = obj.GetType().ToString();
if (type.EndsWith("type", StringComparison.CurrentCultureIgnoreCase) || type.Contains("Cryptography")
|| type.EndsWith("AsyncEventBits", StringComparison.CurrentCultureIgnoreCase))
{
return;
}
stop = obj == null || obj is DATA || obj.GetType().BaseType == typeof(ValueType)
|| obj.GetType().Namespace.Contains("System.Windows");
fi = t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
foreach (FieldInfo f in fi)
{
if (f.GetValue(obj) != AllLogs)
{
_ = PrivateDump(sb, f.GetValue(obj), f.Name, level + 1, maxLevel, stop);
}
}
if (obj is Dictionary<string, List<IPAddress>>)
{
Dictionary<string, List<IPAddress>> d = obj as Dictionary<string, List<IPAddress>>;
foreach (string k in d.Keys)
{
if (d.TryGetValue(k, out List<IPAddress> l))
{
foreach (IPAddress ip in l)
{
_ = PrivateDump(sb, ip, "[" + k + "]", level + 1, maxLevel, false);
}
}
}
}
if (obj is Array)
{
try
{
if (obj is MachineInf[])
{
MachineInf[] os = (MachineInf[])obj;
for (i = 0; i < os.GetLength(0); i++)
{
_ = PrivateDump(sb, os[i], "[" + i + "]", level + 1, maxLevel, false);
}
}
else if (obj is int[] || obj is uint[])
{
int[] os = (int[])obj;
for (i = 0; i < os.GetLength(0); i++)
{
_ = PrivateDump(sb, os[i], "[" + i + "]", level + 1, maxLevel, false);
}
}
else if (obj is short[] || obj is ushort[])
{
short[] os = (short[])obj;
for (i = 0; i < os.GetLength(0); i++)
{
_ = PrivateDump(sb, os[i], "[" + i + "]", level + 1, maxLevel, false);
}
}
else if (obj is TcpClient[] || obj is IPAddress[] || obj is TcpSk[] || obj is string[]
|| obj is TcpServer[]
|| obj is ProcessThread[] || obj is Thread[])
{
object[] os = (object[])obj;
for (i = 0; i < os.GetLength(0); i++)
{
_ = PrivateDump(sb, os[i], "[" + i + "]", level + 1, maxLevel, false);
}
}
else
{
_ = PrivateDump(sb, obj.GetType().ToString() + ": N/A", obj.GetType().ToString(), level + 1, maxLevel, false);
}
}
catch (Exception)
{
}
}
}
internal static void DumpType(StringBuilder sb, Type typeToDump, int level, int maxLevel)
{
if ((typeToDump == typeof(Delegate))
|| (typeToDump == typeof(PackageType))
@@ -348,45 +441,39 @@ internal static class Logger
return;
}
var typeName = typeToDump.ToString();
if (typeName.EndsWith("type", StringComparison.CurrentCultureIgnoreCase)
|| typeName.Contains("Cryptography")
|| typeName.EndsWith("AsyncEventBits", StringComparison.CurrentCultureIgnoreCase))
var typeFullName = typeToDump.ToString();
if (typeFullName.EndsWith("type", StringComparison.CurrentCultureIgnoreCase)
|| typeFullName.Contains("Cryptography")
|| typeFullName.EndsWith("AsyncEventBits", StringComparison.CurrentCultureIgnoreCase))
{
return;
}
var recurse = (typeToDump is not null)
&& (typeToDump != typeof(DATA))
&& (typeToDump.BaseType != typeof(ValueType))
&& !typeToDump.Namespace.Contains("System.Windows");
var stop = (typeToDump == null)
|| (typeToDump == typeof(DATA))
|| (typeToDump.BaseType == typeof(ValueType))
|| typeToDump.Namespace.Contains("System.Windows");
var fieldInfos = typeToDump.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
foreach (var fieldInfo in fieldInfos)
{
var fieldValue = fieldInfo.GetValue(null);
if (fieldValue != AllLogs)
if (fieldInfo.GetValue(null) != AllLogs)
{
_ = Logger.PrivateDump(sb, fieldValue, fieldInfo.Name, level + 1, maxLevel, recurse);
_ = Logger.PrivateDump(sb, fieldInfo.GetValue(null), fieldInfo.Name, level + 1, maxLevel, stop);
}
}
}
/// <summary>
/// Calculates a basic checksum of the given string to be written to logs
/// for quick verification without revealing the original sensitive value.
/// </summary>
internal static string GetChecksum(string st)
{
return string.IsNullOrEmpty(st)
? st
: ((byte)(Common.GetBytesU(st).Sum(value => value) % 256)).ToString(CultureInfo.InvariantCulture);
}
internal static string GetStackTrace(StackTrace st)
{
return string.Join(
" <= ",
st.GetFrames().Select(frame => frame.GetMethod().ToString()));
string rv = string.Empty;
for (int i = 0; i < st.FrameCount; i++)
{
StackFrame sf = st.GetFrame(i);
rv += sf.GetMethod() + " <= ";
}
return rv;
}
}

View File

@@ -68,7 +68,7 @@ internal sealed class Thread
internal static string DumpThreadsStack()
{
string stack = "MANAGED THREADS: " + threads.Count.ToString(CultureInfo.InvariantCulture);
string stack = "\r\nMANAGED THREADS: " + threads.Count.ToString(CultureInfo.InvariantCulture) + "\r\n";
stack += Logger.GetStackTrace(new StackTrace());
return stack;
}

View File

@@ -25,7 +25,6 @@ using MouseWithoutBorders.Class;
using MouseWithoutBorders.Core;
using MouseWithoutBorders.Properties;
using Clipboard = MouseWithoutBorders.Core.Clipboard;
using Timer = System.Windows.Forms.Timer;
[module: SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "MouseWithoutBorders.frmScreen.#ShowMouseWithoutBordersUiOnWinLogonDesktop(System.Boolean)", Justification = "Dotnet port with style preservation")]
@@ -551,7 +550,7 @@ namespace MouseWithoutBorders
if (count % 20 == 0)
{
Logger.LogStatistics();
Logger.LogAll();
// Need to review this code on why it is needed (moved from MoveToMyNeighbourIfNeeded(...))
for (int i = 0; i < MachineStuff.MachineMatrix.Length; i++)
@@ -1216,29 +1215,7 @@ namespace MouseWithoutBorders
private void MenuGenDumpFile_Click(object sender, EventArgs e)
{
int l = Setting.Values.DumpObjectsLevel;
if (l is > 0 and < 10)
{
try
{
string logFile = Path.Combine(Common.RunWithNoAdminRight ? Path.GetTempPath() : Path.GetDirectoryName(Application.ExecutablePath), "MagicMouse.log");
var log = Logger.DumpObjects(l);
File.WriteAllText(logFile, log);
if (Common.RunOnLogonDesktop || Common.RunOnScrSaverDesktop)
{
_ = MessageBox.Show("Dump file created: " + logFile, Application.ProductName);
}
else
{
Common.ShowToolTip("Dump file created: " + logFile + " and placed in the Clipboard.", 10000);
Clipboard.SetText(logFile);
}
}
catch (Exception ex)
{
_ = MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace, Application.ProductName);
}
}
Logger.GenerateLog();
}
private void MainMenu_Opening(object sender, CancelEventArgs e)

View File

@@ -1,4 +1,4 @@
[Program Logs]
[Program logs]
===============
= System.String[]
[Clipboard]
@@ -199,6 +199,15 @@ HelperProcessName = PowerToys.MouseWithoutBordersHelper
===============
[Logger]
===============
AllLogsLock = Lock
--_owningThreadId = 0
--_state = 0
--_recursionCount = 0
--_spinCount = 22
--_waiterStartTimeMs = 0
--s_contentionCount = 0
--s_maxSpinCount = 22
--s_minSpinCountForAdaptiveSpin = -100
LogCounter = Concurrent.ConcurrentDictionary`2[System.String,32]
--_tables = Concurrent.ConcurrentDictionary`2+Tables[System.String,32]
----_comparer = Generic.NonRandomizedStringEqualityComparer+OrdinalComparer
@@ -219,15 +228,6 @@ LogCounter = Concurrent.ConcurrentDictionary`2[System.String,32]
--_budget = ????????????
--_growLockArray = True
--_comparerIsDefaultForClasses = False
AllLogsLock = Lock
--_owningThreadId = 0
--_state = 0
--_recursionCount = 0
--_spinCount = 22
--_waiterStartTimeMs = 0
--s_contentionCount = 0
--s_maxSpinCount = 22
--s_minSpinCountForAdaptiveSpin = -100
allLogsIndex = 0
lastHour = 0
exceptionCount = 0
@@ -263,6 +263,8 @@ lastPackageReceived = MouseWithoutBorders.Core.PackageMonitor
--Nil = 0
MAX_LOG = 10000
MaxLogExceptionPerHour = 1000
HeaderSENT = Be{0},Ke{1},Mo{2},He{3},Mx{4},Tx{5},Im{6},By{7},Cl{8},Dr{9},De{10},Ed{11},Ie{12},Ni{13}
HeaderRECEIVED = Be{0},Ke{1},Mo{2},He{3},Mx{4},Tx{5},Im{6},By{7},Cl{8},Dr{9},De{10},Ed{11},In{12},Ni{13},Pc{14}/{15}
[MachineStuff]
===============
McMatrixLock = Lock

Some files were not shown because too many files have changed in this diff Show More