From 21247c0bb09a1bee3d14d6efa53d0c247f7236af Mon Sep 17 00:00:00 2001 From: Andrey Nekrasov Date: Thu, 6 May 2021 16:17:57 +0300 Subject: [PATCH] [BugReportTool] Add windows settings (user language and locale) (#11129) --- .github/actions/spell-check/expect.txt | 250 +-------------------- tools/BugReportTool/BugReportTool/Main.cpp | 39 ++++ 2 files changed, 50 insertions(+), 239 deletions(-) diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 24a5b0055a..5148a0f3df 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -1,11 +1,9 @@ aac -AAD abcd abcdef abcdefgh abgr ABlocked -ABOUTBOX Abug accctrl Acceleratorkeys @@ -22,12 +20,10 @@ actioned activatable ACTIVATEAPP Addavirtualdesktop -Addins addrum ADDUNDORECORD ADifferent ADMINS -adopsinsider advapi advfirewall AFeature @@ -35,27 +31,22 @@ AFX AGGREGATABLE AHybrid Aissue -akamaihd ALarger alekhyareddy -alertsolid ALIGNLEFT ALLAPPS Alloc ALLOWUNDO -ALogo ALPHATYPE Altdown altform amd Amicrosoft -AMirror AModifier AMPROPERTY AMPROPSETID anges ansicolor -antialiased ANull AOC aocfnapldcnfbofgmbbllojgocaelgdd @@ -107,7 +98,6 @@ asm asmx aspnet aspx -asyncwebview ASYNCWINDOWPLACEMENT ASYNCWINDOWPOS atl @@ -119,7 +109,6 @@ atlstr attr Attribs aumid -Aut AUTHN AUTOAPPEND autocomplete @@ -174,14 +163,12 @@ bootstrapper BOTTOMALIGN BPBF bpp -Breadcrumb bricelam BRIGHTGREEN Browsable bsd bstr bti -Btn BTNFACE Bto buf @@ -194,7 +181,6 @@ buildtransitive BValue bytearray callbackptr -capitalized CANRENAME Captureascreenshot CAPTURECHANGED @@ -221,13 +207,8 @@ chdir checkbox checkboxes CHECKCANCELED -Checkedin -checknetisolation -Chicklet CHILDACTIVATE -Childof CHILDWINDOW -choiceref chrdavis Chris's chrono @@ -248,7 +229,6 @@ CLIENTPULL clientside CLIPCHILDREN CLIPSIBLINGS -CLogo clrcall cls CLSCTX @@ -275,7 +255,6 @@ Codespaces COINIT colorconv colorpicker -colorpickerref COLORREF colorscheme COLUMNCLICK @@ -288,12 +267,10 @@ comhost cominterop commandline commctrl -Commdlg -commondataservicecds Compat COMPOSITIONFULL comsupp -concat +Concat concrt config CONFLICTINGMODIFIERKEY @@ -310,8 +287,6 @@ CONTROLL CONTROLPARENT Controlz coords -COPYDATASTRUCT -corehr cortana cotaskmem COULDNOT @@ -319,7 +294,6 @@ countof countslabelrenamingfmt countslabelselectedfmt cout -CPlus CPower cpp CPPARM @@ -337,8 +311,6 @@ cref CRename critsec crlf -CRM -crmcustomerinsightsapp CRSEL crutkas CSearch @@ -369,7 +341,6 @@ CURSORINFO cursorpos CUSTOMACTIONTEST cvd -cw cwchar cwd cx @@ -391,7 +362,6 @@ DARKPURPLE DARKRED DARKTEAL DARKYELLOW -Dataflows Datavalue DATAW davidegiacometti @@ -440,18 +410,15 @@ desktopshorcutinstalled desktopwindowxamlsource dest DEU -Devagya devblogs devdocs devenum DEVMON df DFactory -Dialpad diffing difftime dimm -dirname dirs DISABLEASACTIONKEY dispid @@ -473,15 +440,12 @@ dllexport dllhost dllimport dllmain -DLogo -DMap DNLEN doctype DONTVALIDATEPATH dotnet DOUBLEBUFFER DOverlay -downlevel DOWNLOADONLY dpi DPICHANGED @@ -489,14 +453,11 @@ DPolicy DPopup DPSAPI Draggen -Drakula DRAWFRAME drawingcolor dreamsofameaningfullife drivedetectionwarning -DRM dropdown -dropref dshow dst DSVG @@ -524,110 +485,21 @@ dword dworigin dwrite dxgi -EABF -EAC -EACB -EACC -EADA -EADB -EADF -EAE -EAEE -EAEF -EAF -EAFC -EAFD Easeof -eb -EBC -EBD -EBDA -EBE -EBEC -EBEE -EBEF -EBF -EBFC -ECAA -ECAB -ECAC -ECAF -ECCA -ECCB -ECCD -ECDC -ECDE -ECDF -ECEB -ECED -ECEE +EB ecef -ECFE -ECFF ecount EDB -EDBB -EDBC -EDBD -EDBE -EDBF -EDCA -EDCB -EDCC -EDCD -EDCE -EDCF -EDDB -EDDC -EDDD -EDDE -EDDF -EDE ededf -EDFF -edgelogo -edgeoldlogo EDITKEYBOARD editkeyboardwindow -editorbody editorconfig -editorhead -editorheadbuttons -editortitle -editorzone EDITSHORTCUTS editshortcutswindow -Edu -EEB -EEBA -EEBB -EEBC -EEBD -EEBE -EEBF -EECB -EECC -EECD -EECE -EECF -EED -EEED -EEEF -EEF efa -EFB -EFBA -EFC -EFDA -EFDE -EFE -EFEB -EFFC -EFFE efgh EFile egistry -ELogo elseif Emoji emptyrecyclebin @@ -639,7 +511,6 @@ endregion Enque ENTERSIZEMOVE Entireitemname -Entitlements entrypoint ENU enum @@ -662,7 +533,6 @@ etw EUQ ev evenodd -eventdatemissed eventlog everytime EWXFORCE @@ -702,7 +572,6 @@ FANCYZONESDRAWLAYOUTTEST FANCYZONESEDITOR Farbraum FARPROC -Favicon fd feimage ffcd @@ -743,7 +612,6 @@ FPower FRAMECHANGED FRAMEDOWNLOAD Froml -FSharp fstream ftps FTYPE @@ -776,7 +644,6 @@ GETSTATE GETTEXT GETTEXTLENGTH gh -Giftbox github githubusercontent gitignore @@ -785,7 +652,6 @@ gmx GNumber google GPTR -grayscale gui guiddef GUITHREADINFO @@ -907,7 +773,6 @@ IComparer ICONERROR ICONINFORMATION ICONQUESTION -Iconset IContext ICONWARNING ICore @@ -950,12 +815,10 @@ IFile ifndef IFolder ifstream -IIcon iid IImage Iindex IInitialize -IInput IInspectable IItem IJson @@ -974,8 +837,6 @@ IMoniker IMonitor IMouse impl -INav -Inbox INDEXTOSTATEIMAGEMASK indierawk Infobar @@ -1014,7 +875,6 @@ INSTALLSTATE INSTALLUILEVEL Inste Intelli -Intellisense interactable Interlop interop @@ -1105,15 +965,13 @@ jp jpe jpeg jpg -jsoref JPN json jsonval -jsx +JSX junja jxr jyuwono -Kaizala kbd KBDLLHOOKSTRUCT kbm @@ -1129,10 +987,8 @@ keydown keydropdowncontrol keyevent KEYEVENTF -keynum -keyof keyhook -keyparts +keynum keyremaps keystokes Keystool @@ -1155,6 +1011,7 @@ LBUTTON LBUTTONDBLCLK LBUTTONDOWN LBUTTONUP +LCIDTo lcl Lclean LCONTROL @@ -1186,7 +1043,6 @@ Linux listbox listview llkhf -LLogo Llvm lmcons LMEM @@ -1258,8 +1114,7 @@ LVS LVSIL LWA lwin -Lync -lzw +LZW mailto MAINICON Mainwindow @@ -1283,7 +1138,6 @@ MATCHMODE MAXIMIZEBOX MAXSHORTCUTSIZE maxversiontested -mayitbeegh MBUTTON MBUTTONDBLCLK MBUTTONDOWN @@ -1319,11 +1173,9 @@ MINIMIZEBOX miniz MINMAXINFO Miracast -mixin MJPG mkdir -MLogo -MMI +mmi mockapi MODECHANGE moderncop @@ -1343,7 +1195,6 @@ MOUSESWITCH MOUSEWHEEL MOVESIZEEND MOVESIZESTART -Moveto MOVEWINDOWS moz mozilla @@ -1387,7 +1238,6 @@ mutexes muxc mvvm MYICON -myuri NAMECHANGE nameof NAMEONLY @@ -1481,10 +1331,8 @@ notmatch Noto NOTRACK NOUPDATE -nowrap NOZORDER npm -npmjs npos NResize ntdll @@ -1510,7 +1358,6 @@ Oem officehubintl ofs ofstream -Oject oldcolor olditem oldnewthing @@ -1521,11 +1368,7 @@ OleAut OLECHAR OLEDB OLIVEGREEN -OLogo -Onboarding onebranch -onedrive -onedrivelogo ONITEM onstd oobe @@ -1542,7 +1385,6 @@ ostr ostream ostringstream OSVERSIONINFOEXW -osx otating OUTOFCONTEXT OUTOFMEMORY @@ -1556,7 +1398,6 @@ PAINTSTRUCT PAIT PALEBLUE PALETTEWINDOW -Pano paramref params PARENTNOTIFY @@ -1573,7 +1414,6 @@ pcb pcelt pch PCIDLIST -PCOPYDATASTRUCT PCorswitchaccounts PCWSTR pdb @@ -1593,9 +1433,6 @@ pgp pguid phbm phbmp -Phishing -php -phptest phwnd pici pid @@ -1610,7 +1447,6 @@ PKBDLLHOOKSTRUCT placeholders plib PLK -PLogo plugin pluginsmodel plvdi @@ -1621,14 +1457,12 @@ pnm pnmdr pnmlv POINTL -pointstar policheck polymorpism popd popup POPUPWINDOW posix -powerappscds powerlauncher powerpreview powerrename @@ -1667,7 +1501,6 @@ prgms pri PRINTCLIENT printf -Printfax prm PROCESSKEY PRODUCTVERSION @@ -1711,8 +1544,6 @@ pwcs PWSTR pwtd px -py -Qand QI qianlifeng qit @@ -1818,7 +1649,6 @@ roslyn royvou rpc RRF -RSHIFT rshift Rsp rst @@ -1838,7 +1668,6 @@ runsettings runtimeclass runtimeconfig runtimes -rutkas rv rvalue rvm @@ -1859,7 +1688,6 @@ SCOPEID screenshot scrollable scrollviewer -scss sddl sdk SDKDDK @@ -1895,9 +1723,7 @@ Setttings SETWORKAREA sfgao SFGAOF -Sharei SHAREIMAGELISTS -Sharepoint sharpkeys shcore shellapi @@ -1906,7 +1732,6 @@ shellex SHELLEXECUTEINFO SHELLEXECUTEINFOW shellscalingapi -Shelveset SHFILEINFO SHGFI SHIFTDRAG @@ -1917,11 +1742,11 @@ shlwapi shobjidl SHORTCUTATLEAST shortcutcontrol +Shortcutguide SHORTCUTMAXONEACTIONKEY SHORTCUTNOREPEATEDMODIFIER SHORTCUTONEACTIONKEY SHORTCUTSTARTWITHMODIFIER -Shortcutguide Shortcuttool shortdate SHORTPATH @@ -1938,13 +1763,11 @@ sidepanel siex SIGABRT sigdn -Signin signtool SINGLEKEY singlekeyremapcontrol SINGLESEL singletones -sixpointstar SIZEBOX sizeg Sizename @@ -1957,11 +1780,8 @@ sketchapp SKIPOWNPROCESS sku SKYBLUE -Skype SLGP -Slideshow sln -SLogo SMALLICON SMTO Snd @@ -1974,9 +1794,7 @@ spdo spdth spec'ing spesi -spinbuttonref splitwstring -spoprod sppd sppre spsi @@ -2000,9 +1818,7 @@ sstream STACKFRAME stackoverflow stackpanel -Staffhub standalone -Starburst STARTF startupapps STARTUPINFO @@ -2019,8 +1835,8 @@ stdcall stdcpp stdcpplatest stdexcept -stdio stdin +stdio stdlib STDMETHODCALLTYPE STDMETHODIMP @@ -2035,9 +1851,8 @@ stoul stoull strcmp strftime -Strikethrough Stringified -stringify +Stringify STRINGIZE stringstream stringtable @@ -2050,14 +1865,11 @@ Stubless STYLECHANGED STYLECHANGING stylecop -stylesheet Subdir subfolder subkey SUBLANG subquery -subsetted -subsetter substr Superbar sut @@ -2065,13 +1877,10 @@ SVE svg SVGIn svgpreviewhandler -svgr -SVGSVG Switchbetweenvirtualdesktops SWP swprintf SYMED -Symlink SYMOPT SYNCPAINT sys @@ -2090,7 +1899,6 @@ SYSTEMTIME sz tadele Tahoma -talenthrcore talynone TApp TApplication @@ -2102,7 +1910,6 @@ targetnametoken targetsize targetver taskbar -Taskboard TASKID taskkill tasklist @@ -2114,7 +1921,6 @@ tcscpy TCustom td TDevice -Telemarketer Templated templatenamespace Temporarilypeekatthedesktop @@ -2128,7 +1934,6 @@ textblock textbox TEXTINCLUDE textref -TFVC tga thead THEMECHANGED @@ -2137,7 +1942,6 @@ THISCOMPONENT thre tif TILEDWINDOW -Timeline TIMERID timeunion timeutil @@ -2148,11 +1952,6 @@ tlbimp tmp TNP todo -toggleleft -toggleoff -toggleon -toggleref -toggleright toggleswitch toolbar toolset @@ -2169,16 +1968,11 @@ traies TRAYMOUSEMESSAGE TRK trl -truetype trunc -tslint TStr tsx tt -TVM tw -twelvepointstar -txyewy TYMED typedef TYPEKEY @@ -2187,12 +1981,10 @@ typename typeof typeparam TYPESHORTCUT -typings Tz UAC UAL uap -UCHAR udit UIA Uid @@ -2215,7 +2007,6 @@ UNCPRIORITY undef UNDNAME unescape -Ungroup unicode Unindent uninit @@ -2235,13 +2026,10 @@ UNLEN unlicense Unmap UNORM -Unpublish unregister unregistering unremapped unsubscribe -Unsync -Untag Updatelayout UPDOWNKEYDROPSLIST UPGRADINGPRODUCTCODE @@ -2295,7 +2083,6 @@ viewbox viewmodel virtualization Visibletrue -Visio visualbrush visualstudio vk @@ -2303,19 +2090,16 @@ VKey vm vmax vmin -Voicemail VOS VREDRAW VSC VSCBD vscode -vsconfig VSCROLL vse vsonline vstemplate VSTHRD -VSTS VSTT VTABLE Vtbl @@ -2340,20 +2124,15 @@ wcsnicmp wdp wdupenv weakme -webapp webcam webclient -webkit -webp webpack webpage website -webview wekyb Whichdoes whitespaces WIC -Wifi wifstream wih wiki @@ -2371,7 +2150,7 @@ WINDOWNAME WINDOWPLACEMENT WINDOWPOSCHANGED WINDOWPOSCHANGING -windowsapp +Windowsapp WINDOWSBUILDNUMBER windowsdesktop windowssearch @@ -2405,7 +2184,6 @@ WKSG wmain WMKEYDOWN WMKEYUP -wmonk wmp WMSYSKEYDOWN WMSYSKEYUP @@ -2414,7 +2192,6 @@ WNDCLASS WNDCLASSEX WNDCLASSEXW WNDPROC -woff wofstream wordpad workaround @@ -2447,14 +2224,12 @@ wxs xa xamarin xaml -XAngle XAttribute xbf XBUTTON XBUTTONDBLCLK XBUTTONDOWN XBUTTONUP -XCOPY XDiff XDocument XElement @@ -2476,15 +2251,12 @@ XToolset xunit XY Yaml -YAngle YDiff YESNO YIncrement yinwang -YLogo yml YOffset -YourUserName YStr YUY YUYV diff --git a/tools/BugReportTool/BugReportTool/Main.cpp b/tools/BugReportTool/BugReportTool/Main.cpp index b22be935d3..e57cf19193 100644 --- a/tools/BugReportTool/BugReportTool/Main.cpp +++ b/tools/BugReportTool/BugReportTool/Main.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include "ZipTools/ZipFolder.h" #include @@ -185,6 +187,40 @@ void reportWindowsVersion(const filesystem::path& tmpDir) } } +void reportWindowsSettings(const filesystem::path& tmpDir) +{ + std::wstring userLanguage; + std::wstring userLocale; + try + { + const auto lang = winrt::Windows::System::UserProfile::GlobalizationPreferences::Languages().GetAt(0); + userLanguage = winrt::Windows::Globalization::Language{lang}.DisplayName().c_str(); + wchar_t localeName[LOCALE_NAME_MAX_LENGTH]{}; + if (!LCIDToLocaleName(GetThreadLocale(), localeName, LOCALE_NAME_MAX_LENGTH, 0)) + { + throw -1; + } + userLocale = localeName; + } + catch (...) + { + printf("Failed to get windows settings\n"); + return; + } + + try + { + wofstream settingsReport(tmpDir / "windows-settings.txt"); + settingsReport << "Preferred user language: " << userLanguage << endl; + settingsReport << "User locale: " << userLocale << endl; + } + catch(...) + { + printf("Failed to write windows settings\n"); + } + +} + void reportDotNetInstallationInfo(const filesystem::path& tmpDir) { auto dotnetInfoPath = tmpDir; @@ -256,6 +292,9 @@ int wmain(int argc, wchar_t* argv[], wchar_t*) // Hide sensitive information hideUserPrivateInfo(tmpDir); + // Write windows settings to the temporary folder + reportWindowsSettings(tmpDir); + // Write monitors info to the temporary folder reportMonitorInfo(tmpDir);