mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[New utility]Sysinternals ZoomIt (#35880)
* ZoomIt initial code dump * Change vcxproj to normalize dependency versions * Fix code quality to build * Add to PowerToys solution * Clean out C-style casts * Fix some more analyzer errors * Constexpr a function * Disable some warnings locally that it seemed better not to touch * Add ZoomIt module interface * Add GPO * Add Settings page with Enable button * Output as PowerToys.ZoomIt.exe * Extract ZoomIt Settings definition to its own header * Make ZoomItModuleInterface build with ZoomItSettings too * WinRT C++ interop for ZoomItSettings * From Registry To PowerToys Json * Properly fix const_cast analyzer error * Initial Settings page loading from registry * Zoom mode settings * Save settings * Add file picker and DemoType file support * Remaining DemoType settings * Have ZoomIt properly reloading Settings and exiting * Remove context menu entries for Options and Exit * ZoomIt simple Break Options * Break advanced options * Simple Record settings * Record Microphone setting * Fix break background file picker title * Font setting * Fix build issues after merge * Add ZoomIt conflict warning to Settings * Exclude Eula from spell checking * Fix spellcheck errors * Fix spell check for accelerated menu items * Remove cursor files from spellcheck. They're binary * Fix forbidden patterns * Fix XAML style * Fix C# analyzers * Fix signing * Also sign module interface dll * Use actual ZoomIt icon * Add OOBE page for ZoomIt * ZoomIt image for Settings * Flyout and Dashboard entries * Fix type speed slider labels * Correctly load default Font * Correctly register shortcuts on ZoomIt startup first run * Fix modifier keys not changing until restart * Show MsgBox on taken shortcut * Start PowerToys Settings * Normalize ZoomIt file properties with rest of PowerToys * Add attribution * Add ZoomIt team to Community.md * More copyright adjustments * Fix spellcheck * Fix MsgBox simultaneous instance to the front * Add mention of capturevideosample code use * Add ZoomIt to process lists * Add telemetry * Add logging * React to gpo * Normalize code to space identation * Fix installer build * Localize percent setting * Fix XAML styling * Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Fix spellcheck * One more spellcheck fix * Integrate LiveDraw feature changes from upstream * Fix name reuse in same scope * Fix c-style casts * Also register LIVEDRAW_HOTKEY * Fix newLiveZoomToggleKey * Update LiveZoom description in Settings to take LiveDraw into account * Fix spellcheck * Fix more spellcheck * Fix Sysinternals capitalization * Fix ARM64 Debug build * Support Sysinternals build (#36873) * Remove unneeded files * Make build compatible with Sysinternals * Separate PowerToys ZoomIt product name (#36887) * Separate PowerToys ZoomIt product name To help maintain the Sysinternals branding in the standalone version. * Clarify branding-related includes * Remove ZoomIt.sln * Add foxmsft to spell-check names * Add ZoomIt to README * Add ZoomIt to GH templates * Add ZoomIt events to DATA_AND_PRIVACY.md * Remove publish_config.json * Remove publish_config.json from vcxproj too --------- Co-authored-by: Mark Russinovich <markruss@microsoft.com> Co-authored-by: Alex Mihaiuc <69110671+foxmsft@users.noreply.github.com> Co-authored-by: John Stephens <johnstep@microsoft.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
This commit is contained in:
75
src/common/sysinternals/Eula/Eula.txt
Normal file
75
src/common/sysinternals/Eula/Eula.txt
Normal file
@@ -0,0 +1,75 @@
|
||||
Sysinternals Software License Terms
|
||||
These license terms are an agreement between Sysinternals (a wholly owned subsidiary of Microsoft Corporation) and you. Please read them. They apply to the software you are downloading from technet.microsoft.com/sysinternals, which includes the media on which you received it, if any. The terms also apply to any Sysinternals
|
||||
* updates,
|
||||
* supplements,
|
||||
* Internet-based services,
|
||||
* and support services
|
||||
for this software, unless other terms accompany those items. If so, those terms apply.
|
||||
BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.
|
||||
If you comply with these license terms, you have the rights below.
|
||||
|
||||
Installation and User Rights
|
||||
|
||||
You may install and use any number of copies of the software on your devices.
|
||||
|
||||
Scope of License
|
||||
|
||||
The software is licensed, not sold. This agreement only gives you some rights to use the software. Sysinternals reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
|
||||
* work around any technical limitations in the software;
|
||||
* reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
|
||||
* make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;
|
||||
* publish the software for others to copy;
|
||||
* rent, lease or lend the software;
|
||||
* transfer the software or this agreement to any third party; or
|
||||
* use the software for commercial software hosting services.
|
||||
|
||||
Sensitive Information
|
||||
|
||||
Please be aware that, similar to other debug tools that capture “process state” information, files saved by Sysinternals tools may include personally identifiable or other sensitive information (such as usernames, passwords, paths to files accessed, and paths to registry accessed). By using this software, you acknowledge that you are aware of this and take sole responsibility for any personally identifiable or other sensitive information provided to Microsoft or any other party through your use of the software.
|
||||
|
||||
Documentation
|
||||
|
||||
Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.
|
||||
|
||||
Export Restrictions
|
||||
|
||||
The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting .
|
||||
|
||||
Support Services
|
||||
|
||||
Because this software is "as is," we may not provide support services for it.
|
||||
|
||||
Entire Agreement
|
||||
|
||||
This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
|
||||
|
||||
Applicable Law
|
||||
|
||||
United States . If you acquired the software in the United States , Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
|
||||
Outside the United States . If you acquired the software in any other country, the laws of that country apply.
|
||||
|
||||
Legal Effect
|
||||
|
||||
This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
|
||||
|
||||
Disclaimer of Warranty
|
||||
|
||||
The software is licensed "as-is." You bear the risk of using it. Sysinternals gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this agreement cannot change. To the extent permitted under your local laws, sysinternals excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
|
||||
|
||||
Limitation on and Exclusion of Remedies and Damages
|
||||
|
||||
You can recover from sysinternals and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.
|
||||
This limitation applies to
|
||||
* anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
|
||||
* claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
|
||||
|
||||
It also applies even if Sysinternals knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
|
||||
Please note: As this software is distributed in Quebec , Canada , some of the clauses in this agreement are provided below in French.
|
||||
Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français.
|
||||
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Sysinternals n'accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection dues consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d'adéquation à un usage particulier et d'absence de contrefaçon sont exclues.
|
||||
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Sysinternals et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
|
||||
Cette limitation concerne :
|
||||
tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et
|
||||
les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d'une autre faute dans la limite autorisée par la loi en vigueur.
|
||||
Elle s'applique également, même si Sysinternals connaissait ou devrait connaître l'éventualité d'un tel dommage. Si votre pays n'autorise pas l'exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l'exclusion ci-dessus ne s'appliquera pas à votre égard.
|
||||
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d'autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.
|
||||
702
src/common/sysinternals/Eula/eula.c
Normal file
702
src/common/sysinternals/Eula/eula.c
Normal file
File diff suppressed because one or more lines are too long
17
src/common/sysinternals/Eula/eula.h
Normal file
17
src/common/sysinternals/Eula/eula.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
BOOL ShowEulaW( const TCHAR * ToolName, int *argc, PWCHAR argv[] );
|
||||
BOOL ShowEula( const TCHAR * ToolName, int *argc, TCHAR *argv[] );
|
||||
DWORD ShowEulaConsole();
|
||||
void ShowEulaConsoleNoPrompt();
|
||||
BOOL IsIoTEdition();
|
||||
BOOL IsRemoteOnlyEdition();
|
||||
BOOL IsRunningRemotely();
|
||||
BOOL IsEulaAccepted(const TCHAR * ToolName, int *argc, PTCHAR argv[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
76
src/common/sysinternals/Eula/eula.rtf
Normal file
76
src/common/sysinternals/Eula/eula.rtf
Normal file
@@ -0,0 +1,76 @@
|
||||
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Calibri;}}
|
||||
{\colortbl ;\red0\green0\blue255;\red0\green0\blue0;}
|
||||
{\*\generator Riched20 10.0.10240}\viewkind4\uc1
|
||||
\pard\brdrb\brdrs\brdrw10\brsp20 \sb120\sa120\b\f0\fs24 SYSINTERNALS SOFTWARE LICENSE TERMS\fs28\par
|
||||
|
||||
\pard\sb120\sa120\b0\fs19 These license terms are an agreement between Sysinternals (a wholly owned subsidiary of Microsoft Corporation) and you. Please read them. They apply to the software you are downloading from Sysinternals.com, which includes the media on which you received it, if any. The terms also apply to any Sysinternals\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\tx720\'b7\tab updates,\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\'b7\tab supplements,\par
|
||||
\'b7\tab Internet-based services, and \par
|
||||
\'b7\tab support services\par
|
||||
|
||||
\pard\sb120\sa120 for this software, unless other terms accompany those items. If so, those terms apply.\par
|
||||
\b BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par
|
||||
|
||||
\pard\brdrt\brdrs\brdrw10\brsp20 \sb120\sa120 If you comply with these license terms, you have the rights below.\par
|
||||
|
||||
\pard\fi-357\li357\sb120\sa120\tx360\fs20 1.\tab\fs19 INSTALLATION AND USE RIGHTS. \b0 You may install and use any number of copies of the software on your devices.\b\par
|
||||
\caps\fs20 2.\tab\fs19 Scope of License\caps0 .\b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Sysinternals reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\b\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\tx720\b0\'b7\tab work around any technical limitations in the binary versions of the software;\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\'b7\tab reverse engineer, decompile or disassemble the binary versions of the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par
|
||||
\'b7\tab make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;\par
|
||||
\'b7\tab publish the software for others to copy;\par
|
||||
\'b7\tab rent, lease or lend the software;\par
|
||||
\'b7\tab transfer the software or this agreement to any third party; or\par
|
||||
\'b7\tab use the software for commercial software hosting services.\par
|
||||
|
||||
\pard\fi-357\li357\sb120\sa120\tx360\b\fs20 3.\tab SENSITIVE INFORMATION. \b0 Please be aware that, similar to other debug tools that capture \ldblquote process state\rdblquote information, files saved by Sysinternals tools may include personally identifiable or other sensitive information (such as usernames, passwords, paths to files accessed, and paths to registry accessed). By using this software, you acknowledge that you are aware of this and take sole responsibility for any personally identifiable or other sensitive information provided to Microsoft or any other party through your use of the software.\b\par
|
||||
5. \tab\fs19 DOCUMENTATION.\b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\b\par
|
||||
\caps\fs20 6.\tab\fs19 Export Restrictions\caps0 .\b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\cf1\ul{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting}}}}\cf1\ul\f0\fs19 <{{\field{\*\fldinst{HYPERLINK "http://www.microsoft.com/exporting"}}{\fldrslt{http://www.microsoft.com/exporting}}}}\f0\fs19 >\cf0\ulnone .\b\par
|
||||
\caps\fs20 7.\tab\fs19 SUPPORT SERVICES.\caps0 \b0 Because this software is "as is," we may not provide support services for it.\b\par
|
||||
\caps\fs20 8.\tab\fs19 Entire Agreement.\b0\caps0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par
|
||||
|
||||
\pard\keepn\fi-360\li360\sb120\sa120\tx360\cf2\b\caps\fs20 9.\tab\fs19 Applicable Law\caps0 .\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\tx720\cf0\fs20 a.\tab\fs19 United States.\b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\b\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\fs20 b.\tab\fs19 Outside the United States.\b0 If you acquired the software in any other country, the laws of that country apply.\b\par
|
||||
|
||||
\pard\fi-357\li357\sb120\sa120\tx360\caps\fs20 10.\tab\fs19 Legal Effect.\b0\caps0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\b\caps\par
|
||||
\fs20 11.\tab\fs19 Disclaimer of Warranty.\caps0 \caps The software is licensed "as-is." You bear the risk of using it. SYSINTERNALS gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this agreement cannot change. To the extent permitted under your local laws, SYSINTERNALS excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.\par
|
||||
|
||||
\pard\fi-360\li360\sb120\sa120\tx360\fs20 12.\tab\fs19 Limitation on and Exclusion of Remedies and Damages. You can recover from SYSINTERNALS and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.\par
|
||||
|
||||
\pard\li357\sb120\sa120\b0\caps0 This limitation applies to\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\tx720\'b7\tab anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\'b7\tab claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par
|
||||
|
||||
\pard\li360\sb120\sa120 It also applies even if Sysinternals knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par
|
||||
|
||||
\pard\b Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par
|
||||
|
||||
\pard\sb240\lang1036 Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par
|
||||
|
||||
\pard\sb120\sa120 EXON\'c9RATION DE GARANTIE.\b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Sysinternals n'accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection dues consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d'ad\'e9quation \'e0 un usage particulier et d'absence de contrefa\'e7on sont exclues.\par
|
||||
|
||||
\pard\keepn\sb120\sa120\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES.\b0 Vous pouvez obtenir de Sysinternals et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par
|
||||
\lang1033 Cette limitation concerne :\par
|
||||
|
||||
\pard\keepn\fi-360\li720\sb120\sa120\tx720\lang1036\'b7\tab tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par
|
||||
|
||||
\pard\fi-363\li720\sb120\sa120\tx720\'b7\tab les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d'une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par
|
||||
|
||||
\pard\sb120\sa120 Elle s'applique \'e9galement, m\'eame si Sysinternals connaissait ou devrait conna\'eetre l'\'e9ventualit\'e9 d'un tel dommage. Si votre pays n'autorise pas l'exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l'exclusion ci-dessus ne s'appliquera pas \'e0 votre \'e9gard.\par
|
||||
\b EFFET JURIDIQUE.\b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d'autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\b\par
|
||||
|
||||
\pard\b0\fs20\lang1033\par
|
||||
|
||||
\pard\sa200\sl276\slmult1\f1\fs22\lang9\par
|
||||
}
|
||||
|
||||
24
src/common/sysinternals/WindowsVersions.cpp
Normal file
24
src/common/sysinternals/WindowsVersions.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <Windows.h>
|
||||
|
||||
#include "WindowsVersions.h"
|
||||
|
||||
// Declared in wdm.h
|
||||
typedef NTSYSAPI NTSTATUS (NTAPI *RtlGetVersionType)( PRTL_OSVERSIONINFOW );
|
||||
|
||||
DWORD GetWindowsBuild( DWORD* revision )
|
||||
{
|
||||
if( revision ) {
|
||||
|
||||
DWORD size = sizeof( *revision );
|
||||
if( RegGetValueW( HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"UBR", RRF_RT_REG_DWORD, NULL, revision, &size ) != ERROR_SUCCESS ) {
|
||||
|
||||
*revision = 0;
|
||||
}
|
||||
}
|
||||
|
||||
RtlGetVersionType pRtlGetVersion = reinterpret_cast<RtlGetVersionType>(GetProcAddress( GetModuleHandleW( L"ntdll.dll" ), "RtlGetVersion" ));
|
||||
|
||||
RTL_OSVERSIONINFOW version;
|
||||
pRtlGetVersion( &version );
|
||||
return version.dwBuildNumber;
|
||||
}
|
||||
32
src/common/sysinternals/WindowsVersions.h
Normal file
32
src/common/sysinternals/WindowsVersions.h
Normal file
@@ -0,0 +1,32 @@
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// WindowsVersions.h
|
||||
//
|
||||
// Provides helpers for Windows builds and versions.
|
||||
//
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#define BUILD_WINDOWS_SERVER_2008 6003
|
||||
#define BUILD_WINDOWS_SERVER_2008_R2 7601
|
||||
#define BUILD_WINDOWS_SERVER_2012 9200
|
||||
#define BUILD_WINDOWS_8_1 9600
|
||||
#define BUILD_WINDOWS_SERVER_2012_R2 9600
|
||||
#define BUILD_WINDOWS_10_1507 10240
|
||||
#define BUILD_WINDOWS_10_1607 14393
|
||||
#define BUILD_WINDOWS_SERVER_2016 14393
|
||||
#define BUILD_WINDOWS_10_1809 17763
|
||||
#define BUILD_WINDOWS_SERVER_2019 17763
|
||||
#define BUILD_WINDOWS_10_1903 18362
|
||||
#define BUILD_WINDOWS_10_1909 18363
|
||||
#define BUILD_WINDOWS_10_2004 19041
|
||||
#define BUILD_WINDOWS_10_20H2 19042
|
||||
#define BUILD_WINDOWS_SERVER_20H2 19042
|
||||
#define BUILD_WINDOWS_10_21H1 19043
|
||||
#define BUILD_WINDOWS_10_21H2 19044
|
||||
#define BUILD_WINDOWS_SERVER_2022 20348
|
||||
#define BUILD_WINDOWS_11_21H2 22000
|
||||
#define BUILD_WINDOWS_11_22H2 22621
|
||||
|
||||
DWORD GetWindowsBuild( DWORD* revision );
|
||||
74
src/common/sysinternals/dll.c
Normal file
74
src/common/sysinternals/dll.c
Normal file
@@ -0,0 +1,74 @@
|
||||
//=========================================================================-==
|
||||
//
|
||||
// dll.c
|
||||
//
|
||||
// DLL support functions
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
#include <windows.h>
|
||||
#include <assert.h>
|
||||
#include <tchar.h>
|
||||
#include <stdlib.h>
|
||||
#include "dll.h"
|
||||
|
||||
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
|
||||
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x800
|
||||
#endif
|
||||
|
||||
|
||||
//=========================================================================-==
|
||||
//
|
||||
// ExtendedFlagsSupported
|
||||
//
|
||||
// Returns TRUE if running on Windows 7 or later and FALSE otherwise
|
||||
//
|
||||
//============================================================================
|
||||
static BOOLEAN ExtendedFlagsSupported()
|
||||
{
|
||||
OSVERSIONINFO osInfo;
|
||||
BOOLEAN rc = FALSE;
|
||||
|
||||
ZeroMemory(&osInfo, sizeof(OSVERSIONINFO));
|
||||
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
|
||||
#pragma warning ( disable : 4996 ) // deprecated in favour of version helper functions which we can't use
|
||||
|
||||
if (GetVersionEx(&osInfo) && (osInfo.dwMajorVersion > 6 || (osInfo.dwMajorVersion == 6 && osInfo.dwMinorVersion > 0)))
|
||||
rc = TRUE;
|
||||
|
||||
#pragma warning ( default : 4996 )
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
//=========================================================================-==
|
||||
//
|
||||
// LoadLibrarySafe
|
||||
//
|
||||
// Loads a DLL from the system folder in a way that mitigates DLL spoofing /
|
||||
// side-loading attacks
|
||||
//
|
||||
//============================================================================
|
||||
HMODULE LoadLibrarySafe(LPCTSTR libraryName, DLL_LOAD_LOCATION location)
|
||||
{
|
||||
HMODULE hMod = NULL;
|
||||
|
||||
if (NULL == libraryName || location <= DLL_LOAD_LOCATION_MIN || location >= DLL_LOAD_LOCATION_MAX) {
|
||||
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// LOAD_LIBRARY_SEARCH_SYSTEM32 is only supported on Window 7 or later. On earlier SKUs we could use a fully
|
||||
// qualified path to the system folder but specifying a path causes Ldr to skip SxS file redirection. This can
|
||||
// cause the wrong library to be loaded if the application is using a manifest that defines a specific version
|
||||
// of Microsoft.Windows.Common-Controls when loading comctl32.dll
|
||||
if (DLL_LOAD_LOCATION_SYSTEM == location) {
|
||||
|
||||
DWORD flags = ExtendedFlagsSupported() ? LOAD_LIBRARY_SEARCH_SYSTEM32 : 0;
|
||||
hMod = LoadLibraryEx(libraryName, NULL, flags);
|
||||
}
|
||||
|
||||
return hMod;
|
||||
}
|
||||
26
src/common/sysinternals/dll.h
Normal file
26
src/common/sysinternals/dll.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//=========================================================================-==
|
||||
//
|
||||
// dll.h
|
||||
//
|
||||
// DLL support functions
|
||||
//
|
||||
//============================================================================
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DLL_LOAD_LOCATION_MIN = 0,
|
||||
DLL_LOAD_LOCATION_SYSTEM = 1,
|
||||
DLL_LOAD_LOCATION_MAX
|
||||
} DLL_LOAD_LOCATION, *PDLL_LOAD_LOCATION;
|
||||
|
||||
HMODULE LoadLibrarySafe(LPCTSTR libraryName, DLL_LOAD_LOCATION location);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user