diff --git a/ReadMe.md b/ReadMe.md index 859bd4f8c..c4f4f8d4b 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -223,276 +223,4 @@ If VC-LTL is referenced correctly, it will be output at the time of generation: ## Changes - -### 1.0.0.1 May 23, 2016 13:42 -* 解决C++异常无法使用问题。 - - -### 1.0.0.2 June 14, 2016 12:52 -* 解决C编译不通过问题。 - - -### 1.0.0.3 Nov 28, 2016 12:54 -* 改进对C工程的兼容性。 - - -### 1.0.0.4 - Initial Release (Mar 6, 2017 16:15) -* Separated from Dism++. - - -### 1.0.0.5 - 新增Visual Studio 2017支持 (Mar 16, 2017 20:53) -* 新增VC 2017支持。 - - -### 1.0.0.6 - 优化引用方式 (Mar 18, 2017 13:46) -* 优化文件引用。 - - -### 1.0.0.7 - 初步添加Windows XP支持 (Apr 22, 2017 19:26) -* 初步添加Windows XP支持。 -* 添加C++异常支持。 -* 添加/GS特性支持。 -* 添加/guard:cf支持。 -* VC140库升级到Vistual Studio 2015 Update3。 - - -### 1.0.0.8 - 简化VC-LTL使用 (Apr 25, 2017 20:37) -* 简化库引用方式。 -* 更新14393 ucrt到最新版(2017-01-05版)。 -* 添加15063 ucrt支持。 - - -### 1.0.0.9 - 添加C++异常支持(May 26, 2017 14:46) -* 改进Windows XP支持。 -* 优化库结构裁剪ltl库体积。 -* 解决使用自定义异常导致程序编译不通过问题。 -* 调整`*_p`系列函数定义,以免使用`*_p`系列函数时编译不通过。 -* 解决使用浮点除法时导致编译不通过问题。 - - -### 1.0.0.10 - 改进对Windows XP的支持 (July 28, 2017 20:28) -* 解决[Bug 9](https://github.com/Chuyu-Team/VC-LTL/issues/9),某些时候编译器引用异常导致XP模式时意外引入`_except_handler4_common`(感谢 HwangBae)。 -* 解决[Bug 8](https://github.com/Chuyu-Team/VC-LTL/issues/8),修复typeid功能无法使用问题(感谢 HwangBae)。 -* 调整异常实现代码,尽可能复用msvcrt.dll代码减少代码体积。 -* 解决Bug,修复无法使用`__argc`、`__argv`、`__wargv`、`_environ`、`_wenviron`全局变量问题(感谢 亮叔叔)。 -* 解决微软Bug,修复使用ATL库的程序不支持XP RTM问题。 - - -### 1.0.0.11 - 解决lib依赖问题 (Aug 23, 2017 19:00) -* 解决Bug,使用`_difftime64`时Windows XP无法运行。 -* 解决Bug,`_msvcrt.cpp`始终会引入urct_14393.lib问题(感谢 亮叔叔)。 -* 更新VC141头文件以及实现,全部同步到最新14.11。 - - -### 1.0.0.12 - 解决某些函数无法使用问题 (Sep 15, 2017 13:33) -* 解决Bug,使用strcat_s时在Windows XP中提示找不到指定符号(感谢 stsm85)。 -* 解决Bug,解决SSE2除法导致编译不通过问题(感谢 stsm85)。 -* 解决Bug,解决wcstoll、vsnprintf、rand_s、strtoll无法使用问题(感谢 stsm85)。 -* 代码调整,消除所有VC-LTL编译警告,强迫症患者福音。 - -> 本次更新后,FastCopy、winpck相关程序直接可以使用VC-LTL编译。 - - -### 1.0.0.13 - 新增 Windows 10 16299 UCRT支持 (Oct 11, 2017 14:00) -* 解决Bug,atanh、acosh、asinh无法使用问题(感谢 stsm85)。 -* 新增Windows 10 16299 UCRT支持。 -* 移除Windows 10 14393 UCRT支持。 - -> 16299已经发布,因此移除老版本14393支持。相关项目请迁徙到15063或者最新16299。 - - -### 2.0.0.1 - 新增C++类库支持 (Oct 29, 2017 22:23) -* 新增iostream、stringstream支持 -* 解决使用`_fstat32`、`_fstat32i64`、`_fstat64i32`、`_stat32`、`_stat32i64`、`_stat64i32`、`_wstat32`、`_wstat32i64`、`_wstat64i32`导致编译不通过问题。 -* 修正`__acrt_iob_func`始终返回输入流问题。 -* 解决 type_info operator != 功能无法使用问题(感谢 sonyps5201314)。 -* 解决_daylight,_dstbias,_timezone,_tzname无法使用问题(感谢 sonyps5201314)。 -* 解决32位 SSE高精度数据函数无法使用问题,比如`_libm_sse2_tan_precise`,`_libm_sse2_sqrt_precise`,`_libm_sse2_sin_precise`(感谢 stsm85)。 - - -### 2.0.0.2 - 扩充对C++类库的支持 (Nov 5, 2017 14:14) -* 新增 `_configthreadlocale`、`_get_current_locale`、`_create_locale`、`_free_locale`接口支持。 -* 为Windows XP添加 `_time32`、`_fseeki64`静态实现。 -* 解决[Bug 14](https://github.com/Chuyu-Team/VC-LTL/issues/14),新增 `_getpid`、`_sys_nerr`、`_sys_errlist`无法使用问题(感谢 HwangBae)。 -* 新增C++类,mutex、thread、xtime、xonce支持。 -* 优化编译方式,消除无意义符号,减少ltl库体积。 - - -### 2.0.0.3 - 补充大量XP静态实现 (Nov 18, 2017 14:18) -* Vista编译模式,CRT函数覆盖率达到90%以上。 -* XP编译模式,CRT函数覆盖率达到80%以上。 -* 简化注册表引用方式。 -* 添加std::thread支持。 - - -### 2.0.0.4 - 全面覆盖STL、ConcRT (Dec 3, 2017 20:40) -* 全面覆盖STL、ConcRT库,让C++如鱼得水,尽情使用STL。 -* 全新的weak别名转发技术,实现零jmp解决新老CRT命名冲突。 - - -### 2.0.0.5 - 增强C++ 17支持 (Dec 10, 2017 20:56) -* 新增C++ 17 align new/delete支持。 -* 解决兼容WinXP时可能出现的ntdll.lib依赖失败以及某些函数转发切换到weak别名技术。 - -> 本次更新主要添加对Vistual Studio 2017 15.5以及更高版本新增的C++ 17功能支持。 - - -### 2.0.0.6 - 2018新春贺岁版 (Jan 17, 2018 17:15) -* 添加Vistual Studio 2017 15.5新增函数支持。 -* 新增Shared.props改进属性表引用灵活性。 -* 新增VC-LTL轻量模式以及高级模式支持(修改Shared.props可以调整模式)。 -* 继续扩充CRT函数支持。 - - -### 2.0.0.7 - 重新规范VC-LTL (Mar 6, 2018 17:17) -* 重新整理VC-LTL,尽可能减少对原版改动。 -* 解决一些Bug(感谢 亮亮、layerfsd、waiting4love)。 - - -### 2.0.0.8 - 累计BUG修复以及适配新版本 (Mar 23, 2018 14:58) -* 解决一些潜在找不到符号问题以及链接失败问题(感谢 Too Simple)。 -* 修正`__crtLCMapString`相关字符串操作兼容性问题(感谢 Too Simple)。 -* 解决`_getptd_noexit`在获取msvcrt.dl的DllMain中创建的 ptd结构时会返回失败问题(感谢 亮亮)。 -* 添加最新Vistual Studio 2017 15.6支持。 - - -### 3.0.0.1 - Improve Platform Support (Apr 26, 2018 18:48) -* Fix [Bug 27](https://github.com/Chuyu-Team/VC-LTL/issues/27), `_set_abort_behavior` maybe output a warning message (Thanks myfreeer). -* Fix [Bug 21](https://github.com/Chuyu-Team/VC-LTL/issues/21), `nothrow` symbol conflict problem. -* Fix Bug, solved the x64 system cann't use the `__p__*` functions (Thanks 昌平). -* Improve, solved an error when RC include _msvcrt.h (Thanks 风清凉). -* Improve, `Shared.props` rename to `VC-LTL helper for Visual Studio.props` and improve support. -* Add [Fea 25](https://github.com/Chuyu-Team/VC-LTL/issues/25), add `VC-LTL helper for nmake.cmd`, provide NMake support. -* Add Fea, add `VC-LTL helper for cmake.cmake`, provide CMake support (Thanks Sandro). -* Add Fea, add ARM and ARM64 support. - - -### 3.0.0.2 - Add Vistual Studio 2017 15.7 Support (May 18, 2018 21:07) -* Add Fea, add VC 14.0.24234&14.14.26428. -* Add Fea, add UCRT 10.0.17134.0. -* Add Fea, add Spectre Mitigtion libs. -* Fix Bug, add `gets` symbol ( Thanks npc ). - -> VC-LTL removed all libs already, please download [VC-LTL Binary](https://github.com/Chuyu-Team/VC-LTL/releases) then compile your project(s). - - -### 3.0.0.3 - Children's Day Version (May 31, 2018 17:07) -* Fix [Bug 32](https://github.com/Chuyu-Team/VC-LTL/issues/32), add `__p__fmode` symbol (Thanks augustheart). -* Update License. - - -### 3.1.0.1 - Add Clang support (June 18, 2018 13:13) -* Add [Fea 34](https://github.com/Chuyu-Team/VC-LTL/issues/34), add Clang with Microsoft CodeGen, Clang 3.7 with Microsoft CodeGen and Clang-LLVM Toolsets support (Thanks to hzqst). -* Fix Bug, in the non-Chinese code page `corecrt.h` will be reported C4828 warning (Thanks to 临渊羡鱼乎). -* Fix [Bug 35](https://github.com/Chuyu-Team/VC-LTL/issues/35), warning when calling vsnprintf C4389: "==": signed/unsigned does not match (Thanks to zhaooptimus). -* Fix Bug, reduce the binary size of the _hypotf program referenced by the amd64 program. -* Fix Bug, Solve VS15.7 special_math problem can not be used. - - -### 4.0.0.2 - Add VC-LTL dynamic library support (Aug 14, 2018 12:30) -> The new VC-LTL 4.0, code-named "Dawning" has been released. As a major version upgrade, you need to pay attention to the following items: -> 1. Beginning with VC-LTL 4.0, if you need static compilation (dependent msvcrt.dll only), please use `/MT`. -> 2. VC-LTL 4.0 is not compatible with VC-LTL 3.X compiled static libraries, you need to recompile with VC-LTL 4.0 (Dawning). - -* Add Fea, add VC-LTL dynamic library support, use `/MD` link to DLL such as `ucrtbase_ltl.dll`. -* Add Fea, discard DDK, refactor CRT library, add support pointer confusion, `quick_exit`, `__stdio_common`, etc. -* Add Fea, support ARM, ARM64 link to msvcrt.dll. -* Add Fea, add WinRT (CX) support (Windows 8.1 and higher). -* Improve, there is no need to specify `Minimum required version` in XP mode. -* Improve, use msvcp60.dll to reduce the program size. - - -### 4.0.0.10 - Add Vistual Studio 2017 15.8 Support (Aug 26, 2018 17:20) -* Fix Bug, Solve "VC-LTL helper for cmake.cmake" syntax error (Thanks to MaMy丶). -* Fix Bug, Solve the wrong way to determine the path of the CMake script (Thanks to Simple, MaMy丶). -* Fix Bug, Solve the CMkae and NMake script lib path error problem. -* Fix Bug, Solve MD mode report not found symbol problem such as `_libm_sse2_tan_precise` (Thanks to 13732650). -* Fix Bug, Remove `/sdl` and avoid using STL crash (Thanks to 漆黑の牙). -* Add Fea, Add Vistual Studio 2017 15.8 Support. -* Add Fea, Add a lib file check, and report an error if it does not exist. - - -### 4.0.0.17 - Add C++/CLI Support (Sep 26, 2018 10:00) -* Fix [Bug 40](https://github.com/Chuyu-Team/VC-LTL/issues/40), solved link failed when using RTTI in XP x64 mode (Thanks to killvxk). -* Fix [Bug 41](https://github.com/Chuyu-Team/VC-LTL/issues/41), solved `_byteswap_ulong`, `_byteswap_uint64` and `_byteswap_ushort` were not found when the internal function was disabled (Thanks to wangwenx190). -* Fix Bug, solved Windows XP cannot find entry points for `_abs64`, `_rotl64` and `_rotr64` functions when internal functions was disabled. -* Add Fea, add `wcstold`、`_wcstof_l`、`_wcstod_l`、`_wcstold_l`、`_strtod_l`(xp) and `_strftime_l`(Vista). -* Add Fea, add C++/CLI Support (Thanks to naturalj0). - - -### 4.0.0.26 - Cumulative bug fixes (Dec 19, 2018 18:00) -* Fix Bug, solved Windows XP mode `_Atexit` function depends on `EncodePointer` problem (Thanks to 亮亮). -* Fix MSBug, solved the wrong use of `EncodePointer` in Microsoft's original details::Etw. -* Fix Bug, solved a memory leak in `_initialize_onexit_table_downlevel` (Thanks to g-qa-ck). -* Fix Bug, solved Windows XP can't find function `operator new(size_t,int,char const *,int) and operator new[](size_t,int,char const *,int)` entry point (Thanks to 希望). -* Fix Bug, solved missing exsup4 symbol problem under Spectre with WinXP 32 (Thanks to Too Simple). -* Add Fea, add `delete[](void *, std::nothrow_t const &)` (Thanks to Too Simple). -* Add Fea, add UCRT 10.17763 (Thanks to MouriNaruto). -* Add Fea, add Vistual Studio 2017 15.9 Support. -* Add Fea, add `_IsExceptionObjectToBeDestroyed, _CreateFrameInfo, _FindAndUnlinkFrame` to Windows XP (Thanks to 夏思畅). - - -### 4.0.0.28 - Cumulative bug fixes (Feb 16, 2019 14:50) -* Fix [Bug 45](https://github.com/Chuyu-Team/VC-LTL/issues/45), the parameter is expanded by default (Thanks to xspeed1989). -* Fix Bug, VS 14.14.26428 or higher missed `pplerror.cpp` problem (Thanks to xspeed1989). -* Add Fea, improved support for Clang-LLVM in Visual Studio 2017 (Thanks to luciouskami). -* Add Fea, add `VC-LTL helper for qmake.pri` to provide support for QMake (Thanks to GPBeta). - - -### 4.0.1.10 - Improved Support (June 1, 2019 13:40) -* Fix Bug, Windows XP mode does not reference `advapi32.lib`, which may cause symbols such as `ImpersonateSelf` to be unresolvable (Thanks to 昌平517). -* Fix Bug, `std::thread` depends on `GetLogicalProcessorInformation` causing XP RTM report not to find entry point (Thanks to 小古). -* Fix Bug, Add `_mbsinc` in XP mode because the old version of msvcrt.dll has an out-of-bounds access the bug (Thanks to 亮亮). -* Fix Bug, `std::mutex` depends on `GetNumaHighestNodeNumber` causing XP RTM report not to find entry point. -* Fix Bug, the "ucrtbase_ltl.dll" module does not export the "llabs" function(Thanks to GPBeta)。 -* Fix Bug, remove the accidentally omitted `_downlevel` suffix (Thanks to 过客). -* Fix Bug, this config.pri syntax error caused QT to fail to load (thanks to GPBeta). -* New Fea, `VC-LTL helper for qmake.pri` is compatible with the old version of QMake (Thanks to BigBrother). -* New Fea, the CMake script adds vcpkg support (Thanks to BigBrother). -* New Fea, add Vistual Studio 2019 Support. -* New Fea, add 10.0.18362.0 UCRT support (Thanks to MouriNaruto). -* Improve, the `_ATL_XP_TARGETING` and `_USING_V110_SDK71_` macros in Vista mode are adjusted from error to warning. - - -### 4.0.2.14 - Improved Support (Aug 14, 2019 18:00) -* Fix Bug, Windows XP mode can't find `__wcsrtombs_utf8` symbol (Thanks To 水边). -* Fix [Bug 56](https://github.com/Chuyu-Team/VC-LTL/issues/56), solve (w)printf, std::(w)cout, etc. can not output text other than ASCII. -* Fix Bug, _tzname declaration is inconsistent (Thanks To BigBrother). -* Fix Bug, `_splitpath_s, _wsplitpath_s` bug in Windows XP mode (Thanks To 水边). -* New Fea, add `_CRT_STDIO_ISO_WIDE_SPECIFIERS` macro and `legacy_stdio_definitions.lib` support (Thanks to BigBrother). -* New Fea, add `_initialize_invalid_parameter_handler`, `_initialize_denormal_control` and `_get_startup_thread_locale_mode (Vista mode only)` support。 -* New Fea, add 14.22.27905 toolset support. -* New Fea, add `_atoi_l, _strtol_l, _atoflt_l, _atoldbl_l`, etc. to Windows XP mode. -* New Fea, upgrade 14.16.27023 to the 14.16.27033 version. -* New [Fea 17](https://github.com/Chuyu-Team/VC-LTL/issues/17), add `_create_locale、_wcreate_locale、_get_current_locale` to Windows XP mode. -* Improve compatibility with Lenovo one-click audio and video (This Issue also exists in Microsoft's UCRT). -* Improve compatibility with Windows 7 RTM and older systems (This Issue also exists in Microsoft's UCRT). -* [Improve 53](https://github.com/Chuyu-Team/VC-LTL/issues/53), disable reference elimination for the STL library and avoid LLVM link failure (Thanks to hotxp, BigBrother). - - -### 4.0.3.8 - Improved Support (Dec 21, 2019 14:00) -* Improve, Improve the experience of VC-LTL in VS (Thanks to MouriNaruto). -* Improve, Improved QT support (Thunks to 昌平517). -* New Fea, add VS 14.23.28105 support. -* New Fea, add VS 14.24.28314 support. -* New Fea, add LLVM for Visual Studio 2019 support. -* Improve, FH4 removes TLS dependencies. -* Fix Bug, C4201 waring in corecrt_wstdio.h and mbstring.h (Thunks to BigBrother). -* Fix Bug, XP `legacy_stdio_definitions.lib` missing vsnprintf_s function issue (Thunks to 昌平517). -* Fix Bug,symbol conflict may occur in `legacy_stdio_definitions.lib` in light mode (Thunks to 昌平517) - - -### 4.1.0.4 - Improved Support (Jul 1, 2020 16:00) -* Improve, Enhanced _Getcvt support for C ++ 17. -* New Fea, add msvcp60 static library mode to improve the compatibility of streamlined systems. -* New Fea, add VS 14.25.28610, 14.26.28801 support. -* New Fea, add UCRT 10.0.19041.0 support. -* Fix Bug, symbol conflict may occur in `legacy_stdio_definitions.lib` in light mode (Thunks to Big吊). -* Fix Bug, eliminate CString::Format warning (Thunks to 大胸滴). -* Fix Bug, fix 14.26.28801 syserror_import_lib msii(Thunks to 噬元兽). - -> Tips: Tips: VC-LTL 4.1 and 4.0 are not compatible in STL stream ABI, please recompile static libraries! - - -### 4.1.1 - Improved Support (Aug 8, 2020 16:00) -* New Fea, add VS 14.27.29110 support. +[Changes](https://github.com/Chuyu-Team/VC-LTL/wiki#changes) diff --git a/ReadMe.osc.md b/ReadMe.osc.md index 36ed40733..127e5faec 100644 --- a/ReadMe.osc.md +++ b/ReadMe.osc.md @@ -214,276 +214,4 @@ nmake /f Test.mak ## 更新日志 - -### 1.0.0.1 2016-05-23 13:42 -* 解决C++异常无法使用问题。 - - -### 1.0.0.2 2016-06-14 12:52 -* 解决C编译不通过问题。 - - -### 1.0.0.3 2016-11-28 12:54 -* 改进对C工程的兼容性。 - - -### 1.0.0.4 - 公众第一版(2017-03-06 16:15) -* 与Dism++彻底分离,方便以后与Dism++共享代码。 - - -### 1.0.0.5 - 新增Visual Studio 2017支持(2017-03-16 20:53) -* 新增VC 2017支持。 - - -### 1.0.0.6 - 优化引用方式(2017-03-18 13:46) -* 优化文件引用。 - - -### 1.0.0.7 - 初步添加Windows XP支持(2017-04-22 19:26) -* 初步添加Windows XP支持。 -* 添加C++异常支持。 -* 添加/GS特性支持。 -* 添加/guard:cf支持。 -* VC140库升级到Vistual Studio 2015 Update3。 - - -### 1.0.0.8 - 简化VC-LTL使用(2017-04-25 20:37) -* 简化库引用方式。 -* 更新14393 ucrt到最新版(2017-01-05版)。 -* 添加15063 ucrt支持。 - - -### 1.0.0.9 - 添加C++异常支持(2017-05-26 14:46) -* 改进Windows XP支持。 -* 优化库结构裁剪ltl库体积。 -* 解决使用自定义异常导致程序编译不通过问题。 -* 调整`*_p`系列函数定义,以免使用`*_p`系列函数时编译不通过。 -* 解决使用浮点除法时导致编译不通过问题。 - - -### 1.0.0.10 - 改进对Windows XP的支持(2017-07-28 20:28) -* 解决[Bug 9](https://github.com/Chuyu-Team/VC-LTL/issues/9),某些时候编译器引用异常导致XP模式时意外引入`_except_handler4_common`(感谢 HwangBae)。 -* 解决[Bug 8](https://github.com/Chuyu-Team/VC-LTL/issues/8),修复typeid功能无法使用问题(感谢 HwangBae)。 -* 调整异常实现代码,尽可能复用msvcrt.dll代码减少代码体积。 -* 解决Bug,修复无法使用`__argc`、`__argv`、`__wargv`、`_environ`、`_wenviron`全局变量问题(感谢 亮叔叔)。 -* 解决微软Bug,修复使用ATL库的程序不支持XP RTM问题。 - - -### 1.0.0.11 - 解决lib依赖问题(2017-08-23 19:00) -* 解决Bug,使用`_difftime64`时Windows XP无法运行。 -* 解决Bug,`_msvcrt.cpp`始终会引入urct_14393.lib问题(感谢 亮叔叔)。 -* 更新VC141头文件以及实现,全部同步到最新14.11。 - - -### 1.0.0.12 - 解决某些函数无法使用问题(2017-09-15 13:33) -* 解决Bug,使用strcat_s时在Windows XP中提示找不到指定符号(感谢 stsm85)。 -* 解决Bug,解决SSE2除法导致编译不通过问题(感谢 stsm85)。 -* 解决Bug,解决wcstoll、vsnprintf、rand_s、strtoll无法使用问题(感谢 stsm85)。 -* 代码调整,消除所有VC-LTL编译警告,强迫症患者福音。 - -> 本次更新后,FastCopy、winpck相关程序直接可以使用VC-LTL编译。 - - -### 1.0.0.13 - 新增 Windows 10 16299 UCRT支持(2017-10-11 14:00) -* 解决Bug,atanh、acosh、asinh无法使用问题(感谢 stsm85)。 -* 新增Windows 10 16299 UCRT支持。 -* 移除Windows 10 14393 UCRT支持。 - -> 16299已经发布,因此移除老版本14393支持。相关项目请迁徙到15063或者最新16299。 - - -### 2.0.0.1 - 新增C++类库支持(2017-10-29 22:23) -* 新增iostream、stringstream支持。 -* 解决使用`_fstat32`、`_fstat32i64`、`_fstat64i32`、`_stat32`、`_stat32i64`、`_stat64i32`、`_wstat32`、`_wstat32i64`、`_wstat64i32`导致编译不通过问题。 -* 修正`__acrt_iob_func`始终返回输入流问题。 -* 解决 type_info operator != 功能无法使用问题(感谢 sonyps5201314)。 -* 解决`_daylight`,`_dstbias`,`_timezone`,`_tzname`无法使用问题(感谢 sonyps5201314)。 -* 解决32位 SSE高精度数据函数无法使用问题,比如`_libm_sse2_tan_precise`,`_libm_sse2_sqrt_precise`,`_libm_sse2_sin_precise`(感谢 stsm85)。 - - -### 2.0.0.2 - 扩充对C++类库的支持(2017-11-05 14:14) -* 新增 `_configthreadlocale`、`_get_current_locale`、`_create_locale`、`_free_locale`接口支持。 -* 为Windows XP添加 `_time32`、`_fseeki64`静态实现。 -* 解决[Bug 14](https://github.com/Chuyu-Team/VC-LTL/issues/14),新增 `_getpid`、`_sys_nerr`、`_sys_errlist`无法使用问题(感谢 HwangBae)。 -* 新增C++类,mutex、thread、xtime、xonce支持。 -* 优化编译方式,消除无意义符号,减少ltl库体积。 - - -### 2.0.0.3 - 补充大量XP静态实现(2017-11-18 14:18) -* Vista编译模式,CRT函数覆盖率达到90%以上。 -* XP编译模式,CRT函数覆盖率达到80%以上。 -* 简化注册表引用方式。 -* 添加std::thread支持。 - - -### 2.0.0.4 - 全面覆盖STL、ConcRT(2017-12-03 20:40) -* 全面覆盖STL、ConcRT库,让C++如鱼得水,尽情使用STL。 -* 全新的weak别名转发技术,实现零jmp解决新老CRT命名冲突。 - - -### 2.0.0.5 - 增强C++ 17支持(2017-12-10 20:56) -* 新增C++ 17 align new/delete支持。 -* 解决兼容WinXP时可能出现的ntdll.lib依赖失败以及某些函数转发切换到weak别名技术。 - -> 本次更新主要添加对Vistual Studio 2017 15.5以及更高版本新增的C++ 17功能支持。 - - -### 2.0.0.6 - 2018新春贺岁版(2018-01-17 17:15) -* 添加Vistual Studio 2017 15.5新增函数支持。 -* 新增Shared.props改进属性表引用灵活性。 -* 新增VC-LTL轻量模式以及高级模式支持(修改Shared.props可以调整模式)。 -* 继续扩充CRT函数支持。 - - -### 2.0.0.7 - 重新规范VC-LTL(2018-03-06 17:17) -* 重新整理VC-LTL,尽可能减少对原版改动。 -* 解决一些Bug(感谢 亮亮、layerfsd、waiting4love)。 - - -### 2.0.0.8 - 累计BUG修复以及适配新版本(2018-03-23 14:58) -* 解决一些潜在找不到符号问题以及链接失败问题(感谢 Too Simple)。 -* 修正`__crtLCMapString`相关字符串操作兼容性问题(感谢 Too Simple)。 -* 解决`_getptd_noexit`在获取msvcrt.dl的DllMain中创建的 ptd结构时会返回失败问题(感谢 亮亮)。 -* 添加最新Vistual Studio 2017 15.6支持。 - - -### 3.0.0.1 - 改进平台支持(2018-04-26 18:48) -* 解决[Bug 27](https://github.com/Chuyu-Team/VC-LTL/issues/27),非中文环境调用`_set_abort_behavior`输出警告问题(感谢 myfreeer)。 -* 解决[Bug 21](https://github.com/Chuyu-Team/VC-LTL/issues/21),特定情况nothrow符号冲突问题(感谢 waiting4love)。 -* 解决Bug,解决x64系统无法使用`__p__*`系列函数问题(感谢 昌平)。 -* 改进体验,当RC中意外引入_msvcrt.h时 自动跳过处理,避免RC报错(感谢 风清凉)。 -* 改进体验,“Shared.props”改名为“VC-LTL helper for Visual Studio.props”并大幅度增强对某些极端工程的支持。 -* 新增[Fea 25](https://github.com/Chuyu-Team/VC-LTL/issues/25),添加“VC-LTL helper for nmake.cmd”,方便nmake引入VC-LTL。 -* 新增Fea,添加“VC-LTL helper for cmake.cmake”,方便cmake引入VC-LTL(感谢 Sandro)。 -* 新增Fea,全面支持ARM、ARM64支持。 - - -### 3.0.0.2 - 添加Vistual Studio 2017 15.7支持(2018-05-18 21:07) -* 新增Fea,添加VC 14.0.24234以及14.14.26428支持。 -* 新增Fea,添加UCRT 10.0.17134.0支持。 -* 新增Fea,添加Spectre缓解库支持。 -* 解决Bug,找不到gets符号问题(感谢 npc)。 - -> VC-LTL本次从仓库中剔除了lib文件,VC-LTL用户请下载[VC-LTL Binary](https://gitee.com/Chuyu-Team/VC-LTL/releases),然后再使用VC-LTL编译代码。 - - -### 3.0.0.3 - 儿童节专版(2018-05-31 17:07) -* 解决[Bug 32](https://github.com/Chuyu-Team/VC-LTL/issues/32),链接时找不到符号`__p__fmode`(感谢 augustheart)。 -* 更新许可。 - - -### 3.1.0.1 - 添加Clang支持(2018-06-18 13:13) -* 新增[Fea 34](https://github.com/Chuyu-Team/VC-LTL/issues/34),添加Clang with Microsoft CodeGen、Clang 3.7 with Microsoft CodeGen、Clang-LLVM工具集支持(感谢 hzqst)。 -* 解决Bug,非中文代码页corecrt.h报告 C4828警告(感谢 临渊羡鱼乎)。 -* 解决[Bug 35](https://github.com/Chuyu-Team/VC-LTL/issues/35),调用vsnprintf时触发警告C4389: “==”: 有符号/无符号不匹配(感谢 zhaooptimus) -* 解决Bug,减少amd64程序调用_hypotf函数时的二进制体积。 -* 解决Bug,解决VS15.7 special_math无法使用问题 - - -### 4.0.0.2 - 添加VC-LTL动态库支持(2018-08-14 12:30) -> 全新的VC-LTL 4.0,代号——“破晓”,作为大版本升级某些行为已经更改: -> 1. VC-LTL 4.0 开始,如需静态编译(仅依赖msvcrt.dll)请使用`/MT`编译。 -> 2. VC-LTL 4.0 不兼容VC-LTL 3.X编译的静态库,你需要使用VC-LTL 4.0(破晓)重新编译。 - -* 新增Fea,添加VC-LTL动态库支持,使用`/MD`编译即可链接到 ucrtbase_ltl.dll 等DLL。 -* 新增Fea,彻底抛弃DDK,重构CRT库,全面支持指针混淆、`quick_exit`、`__stdio_common`等功能。 -* 新增Fea,添加ARM、ARM64链接到msvcrt.dll支持。 -* 新增Fea,添加WinRT(CX)支持(仅限于Windows 8.1以及更高版本支持)。 -* 改进体验,XP模式时无需手动指定`所需的最低版本`。 -* 改进体验,充分利用msvcp60.dll缩小程序体积。 - - -### 4.0.0.10 - 添加Vistual Studio 2017 15.8支持(2018-08-26 17:20) -* 解决Bug,解决CMake脚本语法错误(感谢 MaMy丶)。 -* 解决Bug,解决CMake脚本文件路径判断方式不正确问题。 -* 解决Bug,解决CMkae、NMake脚本lib路径错误问题(感谢 Too Simple、MaMy丶)。 -* 解决Bug,修正MD模式报告找不到`_libm_sse2_tan_precise`相关符号问题(感谢 13732650)。 -* 解决Bug,由于微软类库自身设计缺陷,必须关闭sdl,阻止类成员0初始化,避免特定场合STL崩溃问题(感谢 漆黑の牙)。 -* 新增Fea,添加Vistual Studio 2017 15.8支持。 -* 新增Fea,添加lib文件检测,如果不存在则报错。 - - -### 4.0.0.17 - 添加C++/CLI支持(2018-09-26 10:00) -* 解决[Bug 40](https://github.com/Chuyu-Team/VC-LTL/issues/40),XP x64模式中使用RTTI时链接失败问题(感谢 killvxk)。 -* 解决[Bug 41](https://github.com/Chuyu-Team/VC-LTL/issues/41),当禁用内部函数时无法使用`_byteswap_ulong`、`_byteswap_uint64`、`_byteswap_ushort`(感谢 wangwenx190)。 -* 解决Bug,当禁用内部函数时,Windows XP提示找不到`_abs64`、`_rotl64`以及`_rotr64`函数的入口点。 -* 新增Fea,添加`wcstold`、`_wcstof_l`、`_wcstod_l`、`_wcstold_l`、`_strtod_l`(xp)以及`_strftime_l`(Vista)。 -* 新增Fea,添加C++/CLI支持(感谢 naturalj0)。 - - -### 4.0.0.26 - 累计问题修复(2018-12-19 18:00) -* 解决Bug,修复Windows XP模式`_Atexit`函数依赖`EncodePointer`问题(感谢 亮亮)。 -* 解决Bug,修复微软原版details::Etw中错误的使用`EncodePointer`问题。 -* 解决Bug,修复`_initialize_onexit_table_downlevel`一处内存泄漏问题(感谢 g-qa-ck组)。 -* 解决Bug,修复Windows XP找不到函数`operator new(size_t,int,char const *,int)`、`operator new[](size_t,int,char const *,int)`入口点(感谢 希望)。 -* 解决Bug,修复Spectre + WinXP 32下缺失exsup4符号问题(感谢 Too Simple)。 -* 新增Fea,添加`delete[](void *, std::nothrow_t const &)`(感谢 Too Simple)。 -* 新增Fea,添加Windows 10 17763 UCRT支持(感谢 毛利)。 -* 新增Fea,添加VS 2017 14.16.27023工具集支持。 -* 新增Fea,为Windows XP添加`_IsExceptionObjectToBeDestroyed、_CreateFrameInfo、_FindAndUnlinkFrame`(感谢 夏思畅)。 - - -### 4.0.0.28 - 累计问题修复(2019-02-16 14:50) -* 解决[Bug 45](https://github.com/Chuyu-Team/VC-LTL/issues/45),main函数argv参数默认被展开问题(感谢 xspeed1989 )。 -* 解决Bug,VS 14.14.26428以及更高平台缺少`pplerror.cpp`问题(感谢 xspeed1989 )。 -* 新增Fea,改进Visual Studio 2017中对Clang-LLVM的支持(感谢 神话)。 -* 新增Fea,新增`VC-LTL helper for qmake.pri`脚本,改进对QMake的支持(感谢 漆黑の牙)。 - - -### 4.0.1.10 - 改进支持(2019-06-01 13:40) -* 解决Bug,Windows XP模式没有引用`advapi32.lib`,可能导致`ImpersonateSelf`等符号无法解析(感谢 昌平517)。 -* 解决Bug,微软原版std::thread依赖GetLogicalProcessorInformation导致XP RTM无法运行(感谢 小古)。 -* 解决Bug,为XP模式添加_mbsinc,解决此函数越界问题(感谢 亮亮)。 -* 解决Bug,微软原版std::mutex依赖GetNumaHighestNodeNumber导致XP RTM无法运行。 -* 解决Bug,ucrtbase_ltl.dll没有导出llabs(感谢 GPBeta)。 -* 解决Bug,将意外遗漏的`_downlevel`后缀删除(感谢 过客)。 -* 解决Bug,config.pri错误导致QT无法加载问题(感谢 GPBeta)。 -* 新增Fea,`VC-LTL helper for qmake.pri`脚本添加老版本QMake兼容(感谢 大胸滴)。 -* 新增Fea,CMake脚本添加vcpkg兼容(感谢 大胸滴)。 -* 新增Fea,添加Visual Studio 2019支持。 -* 新增Fea,新增10.0.18362.0 UCRT支持(感谢 毛利) -* 改进体验,Vista模式将`_ATL_XP_TARGETING`以及`_USING_V110_SDK71_`宏从错误降级到警告。 - - -### 4.0.2.14 - 改进支持(2019-08-14 18:00) -* 解决Bug,Windows XP模式找不到 `__wcsrtombs_utf8` 符号问题(感谢 水边)。 -* 解决[Bug 56](https://github.com/Chuyu-Team/VC-LTL/issues/56),解决(w)printf、std::(w)cout等无法输出中文问题。 -* 解决Bug,_tzname声明错误(感谢 大胸)。 -* 解决Bug,Windows XP模式中`_splitpath_s、_wsplitpath_s`文件名为空问题(感谢 水边)。 -* 新增Fea,添加 `_CRT_STDIO_ISO_WIDE_SPECIFIERS` 宏以及 `legacy_stdio_definitions.lib` 支持(感谢 大胸)。 -* 新增Fea,添加`_initialize_invalid_parameter_handler`、`_initialize_denormal_control`、`_get_startup_thread_locale_mode(仅Vista模式)`支持。 -* 新增Fea,添加 14.22.27905 工具集支持。 -* 新增Fea,为Windows XP添加`_atoi_l、_strtol_l、_atoflt_l、_atoldbl_l`等支持。 -* 新增[Fea 17](https://github.com/Chuyu-Team/VC-LTL/issues/17),为Windows XP添加`_create_locale、_wcreate_locale、_get_current_locale`支持。 -* 新增Fea,14.16.27023同步到14.16.27033版本。 -* 改进体验,改进与联想一键影音的兼容性,由于联想一键影音错会乱Hook,导致LoadLibraryExW行为异常。这样将导致VC-LTL等在没有安装KB2533623的系统上无法正常使用问题(微软原版也同样存在此问题)。 -* 改进体验,改进Windows 7 RTM以及以下系统的兼容性,由于这些老版本系统由于在LoadLibraryExW期间不会恢复重定向,因此当目标线程关闭重定向时可能导致VC-LTL无法正常工作(微软原版也同样存在此问题)。 -* [改进体验 53](https://github.com/Chuyu-Team/VC-LTL/issues/53),关闭对STL库的引用消除,规避LLVM链接失败问题(感谢 hotxp、BigBrother)。 - - -### 4.0.3.8 - 改进支持(2019-12-21 14:00) -* 改进体验,改进VS用户使用VC-LTL的体验(感谢 毛利)。 -* 改进体验,改进QT支持(感谢 昌平517)。 -* 新增Fea,添加14.23.28105支持。 -* 新增Fea,添加14.24.28314支持。 -* 新增Fea,添加LLVM for Visual Studio 2019支持。 -* 行为调整,消除FH4对TLS的依赖。 -* 解决Bug,消除 corecrt_wstdio.h 以及 mbstring.h中的 C4201警告(感谢 大胸)。 -* 解决Bug,解决XP `legacy_stdio_definitions.lib` 缺少 vsnprintf_s 问题(感谢 昌平517)。 -* 解决Bug,轻量模式中,`legacy_stdio_definitions.lib`可能出现符号冲突问题(感谢 昌平517)。 - - -### 4.1.0.4 - 改进支持(2020-07-01 16:00) -* 改进体验,增强_Getcvt对C++17支持。 -* 新增Fea,添加msvcp60静态库模式,增强某些精简系统的兼容性。 -* 新增Fea,添加14.25.28610、14.26.28801支持。 -* 新增Fea,添加UCRT 10.0.19041.0支持。 -* 解决Bug,轻量模式中,`legacy_stdio_definitions.lib`可能出现符号冲突问题(感谢 Big吊)。 -* 解决Bug,消除CString::Format警告(感谢 大胸滴)。 -* 解决Bug,解决 14.26.28801 syserror_import_lib 缺失问题(感谢 噬元兽)。 - -> 温馨提示:VC-LTL 4.1 与 4.0版本在STL stream支持中存在ABI不兼容问题,对应静态库请重新编译! - - -### 4.1.1 - 改进支持(2020-08-08 16:00) -* 新增Fea,添加14.27.29110支持。 +[更新日志](https://gitee.com/Chuyu-Team/VC-LTL/wikis/Home#%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97) diff --git a/config/LTL_Version.h b/config/LTL_Version.h index 3021980ac..ca0e77b11 100644 --- a/config/LTL_Version.h +++ b/config/LTL_Version.h @@ -6,7 +6,7 @@ #define LTLVersion1 4 #define LTLVersion2 1 #define LTLVersion3 1 -#define LTLVersion4 0 +#define LTLVersion4 1 #endif diff --git a/src/14.0.23918/vcruntime/exe_common.inl b/src/14.0.23918/vcruntime/exe_common.inl index 083a20b7d..a34bdae94 100644 --- a/src/14.0.23918/vcruntime/exe_common.inl +++ b/src/14.0.23918/vcruntime/exe_common.inl @@ -264,13 +264,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() throw() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.0.24210/vcruntime/exe_common.inl b/src/14.0.24210/vcruntime/exe_common.inl index 083a20b7d..a34bdae94 100644 --- a/src/14.0.24210/vcruntime/exe_common.inl +++ b/src/14.0.24210/vcruntime/exe_common.inl @@ -264,13 +264,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() throw() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.0.24225/lib/x64/msvcrt.cmd b/src/14.0.24225/lib/x64/msvcrt.cmd index b33f20d81..95a30229a 100644 --- a/src/14.0.24225/lib/x64/msvcrt.cmd +++ b/src/14.0.24225/lib/x64/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.0.24225\lib\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\_cpu_disp_.obj @@ -40,7 +46,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ucrt_detection.obj diff --git a/src/14.0.24225/lib/x86/msvcrt.cmd b/src/14.0.24225/lib/x86/msvcrt.cmd index ec6df3f69..0df1ef1a8 100644 --- a/src/14.0.24225/lib/x86/msvcrt.cmd +++ b/src/14.0.24225/lib/x86/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.0.24225\lib\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" @@ -58,7 +64,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ucrt_detection.obj diff --git a/src/14.0.24225/vcruntime/exe_common.inl b/src/14.0.24225/vcruntime/exe_common.inl index 083a20b7d..a34bdae94 100644 --- a/src/14.0.24225/vcruntime/exe_common.inl +++ b/src/14.0.24225/vcruntime/exe_common.inl @@ -264,13 +264,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() throw() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.0.24231/lib/arm/msvcrt.cmd b/src/14.0.24231/lib/arm/msvcrt.cmd index 29053d6e2..7020ccd82 100644 --- a/src/14.0.24231/lib/arm/msvcrt.cmd +++ b/src/14.0.24231/lib/arm/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\VC\14.0.24231\lib\arm\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\_cpu_disp_.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\_convert_.obj @@ -33,7 +40,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\guard_support.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ucrt_detection.obj diff --git a/src/14.0.24231/lib/x64/msvcrt.cmd b/src/14.0.24231/lib/x64/msvcrt.cmd index 5ef765f29..c75733d9a 100644 --- a/src/14.0.24231/lib/x64/msvcrt.cmd +++ b/src/14.0.24231/lib/x64/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.0.24231\lib\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\_cpu_disp_.obj @@ -40,7 +46,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ucrt_detection.obj diff --git a/src/14.0.24231/lib/x86/msvcrt.cmd b/src/14.0.24231/lib/x86/msvcrt.cmd index 221ef6e8c..2c6105a88 100644 --- a/src/14.0.24231/lib/x86/msvcrt.cmd +++ b/src/14.0.24231/lib/x86/msvcrt.cmd @@ -3,8 +3,15 @@ set libfile=%~dp0..\..\..\..\VC\14.0.24231\lib\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" @@ -58,7 +65,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ucrt_detection.obj diff --git a/src/14.0.24231/vcruntime/exe_common.inl b/src/14.0.24231/vcruntime/exe_common.inl index 083a20b7d..a34bdae94 100644 --- a/src/14.0.24231/vcruntime/exe_common.inl +++ b/src/14.0.24231/vcruntime/exe_common.inl @@ -264,13 +264,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() throw() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.10.25017/vcruntime/exe_common.inl b/src/14.10.25017/vcruntime/exe_common.inl index 64bf8ee82..9a5d879d1 100644 --- a/src/14.10.25017/vcruntime/exe_common.inl +++ b/src/14.10.25017/vcruntime/exe_common.inl @@ -270,13 +270,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() throw() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.11.25503/vcruntime/exe_common.inl b/src/14.11.25503/vcruntime/exe_common.inl index 361a0df76..43c602836 100644 --- a/src/14.11.25503/vcruntime/exe_common.inl +++ b/src/14.11.25503/vcruntime/exe_common.inl @@ -296,13 +296,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() throw() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.12.25827/lib/x64/msvcrt.cmd b/src/14.12.25827/lib/x64/msvcrt.cmd index 0a6528ae6..e0ce39f65 100644 --- a/src/14.12.25827/lib/x64/msvcrt.cmd +++ b/src/14.12.25827/lib/x64/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.12.25827\lib\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\_cpu_disp_.obj @@ -44,7 +50,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ucrt_detection.obj diff --git a/src/14.12.25827/lib/x86/msvcrt.cmd b/src/14.12.25827/lib/x86/msvcrt.cmd index 59dc9741e..80b34640e 100644 --- a/src/14.12.25827/lib/x86/msvcrt.cmd +++ b/src/14.12.25827/lib/x86/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.12.25827\lib\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\_cpu_disp_.obj @@ -55,7 +61,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ucrt_detection.obj diff --git a/src/14.12.25827/vcruntime/exe_common.inl b/src/14.12.25827/vcruntime/exe_common.inl index 361a0df76..43c602836 100644 --- a/src/14.12.25827/vcruntime/exe_common.inl +++ b/src/14.12.25827/vcruntime/exe_common.inl @@ -296,13 +296,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() throw() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.13.26128/lib/x64/msvcrt.cmd b/src/14.13.26128/lib/x64/msvcrt.cmd index 3ea724ad9..9cca09fef 100644 --- a/src/14.13.26128/lib/x64/msvcrt.cmd +++ b/src/14.13.26128/lib/x64/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.13.26128\lib\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\_cpu_disp_.obj @@ -44,7 +50,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ucrt_detection.obj diff --git a/src/14.13.26128/lib/x86/msvcrt.cmd b/src/14.13.26128/lib/x86/msvcrt.cmd index f3b099454..6adba624f 100644 --- a/src/14.13.26128/lib/x86/msvcrt.cmd +++ b/src/14.13.26128/lib/x86/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.13.26128\lib\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\_cpu_disp_.obj @@ -55,7 +61,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ucrt_detection.obj diff --git a/src/14.13.26128/vcruntime/exe_common.inl b/src/14.13.26128/vcruntime/exe_common.inl index 361a0df76..43c602836 100644 --- a/src/14.13.26128/vcruntime/exe_common.inl +++ b/src/14.13.26128/vcruntime/exe_common.inl @@ -296,13 +296,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() throw() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.14.26428/lib/Spectre/Build_amd64.cmd b/src/14.14.26428/lib/Spectre/Build_amd64.cmd index 10352d585..0dacbc81b 100644 --- a/src/14.14.26428/lib/Spectre/Build_amd64.cmd +++ b/src/14.14.26428/lib/Spectre/Build_amd64.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.14.26428\lib\Spectre\x64\vc.lib copy "%~dp0x64\msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\amd64\_cpu_disp_.obj @@ -41,7 +47,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_20200 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\amd64\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\amd64\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\amd64\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\amd64\ucrt_detection.obj diff --git a/src/14.14.26428/lib/Spectre/Build_x86.cmd b/src/14.14.26428/lib/Spectre/Build_x86.cmd index 06af9b478..9efef9333 100644 --- a/src/14.14.26428/lib/Spectre/Build_x86.cmd +++ b/src/14.14.26428/lib/Spectre/Build_x86.cmd @@ -3,8 +3,15 @@ set libfile=%~dp0..\..\..\..\VC\14.14.26428\lib\Spectre\x86\vc.lib copy "%~dp0x86\msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\x86\_cpu_disp_.obj @@ -55,7 +62,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_20200 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\x86\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\x86\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\x86\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_202000272\objr\x86\ucrt_detection.obj diff --git a/src/14.14.26428/lib/arm/msvcrt.cmd b/src/14.14.26428/lib/arm/msvcrt.cmd index 603c1d502..a8ddfaa7d 100644 --- a/src/14.14.26428/lib/arm/msvcrt.cmd +++ b/src/14.14.26428/lib/arm/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\VC\14.14.26428\lib\arm\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\_cpu_disp_.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\_convert_.obj @@ -32,7 +39,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\guard_support.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ucrt_detection.obj diff --git a/src/14.14.26428/lib/arm64/msvcrt.cmd b/src/14.14.26428/lib/arm64/msvcrt.cmd index e3c6b9201..317286f1c 100644 --- a/src/14.14.26428/lib/arm64/msvcrt.cmd +++ b/src/14.14.26428/lib/arm64/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\VC\14.14.26428\lib\arm64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\_cpu_disp_.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\_convert_.obj @@ -27,7 +34,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\guard_support.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ucrt_detection.obj diff --git a/src/14.14.26428/lib/x64/msvcrt.cmd b/src/14.14.26428/lib/x64/msvcrt.cmd index bdb9c6718..9fbfe2083 100644 --- a/src/14.14.26428/lib/x64/msvcrt.cmd +++ b/src/14.14.26428/lib/x64/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.14.26428\lib\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\_cpu_disp_.obj @@ -41,7 +47,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ucrt_detection.obj diff --git a/src/14.14.26428/lib/x86/msvcrt.cmd b/src/14.14.26428/lib/x86/msvcrt.cmd index 73c607087..5cb854226 100644 --- a/src/14.14.26428/lib/x86/msvcrt.cmd +++ b/src/14.14.26428/lib/x86/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.14.26428\lib\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\_cpu_disp_.obj @@ -55,7 +61,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\loadcfg.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\pesect.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\matherr_detection.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ucrt_detection.obj diff --git a/src/14.14.26428/vcruntime/exe_common.inl b/src/14.14.26428/vcruntime/exe_common.inl index de75b2b8d..e50eb2c79 100644 --- a/src/14.14.26428/vcruntime/exe_common.inl +++ b/src/14.14.26428/vcruntime/exe_common.inl @@ -296,13 +296,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.15.26726/lib/arm/msvcrt.cmd b/src/14.15.26726/lib/arm/msvcrt.cmd index 996e5fe67..b9bad37ca 100644 --- a/src/14.15.26726/lib/arm/msvcrt.cmd +++ b/src/14.15.26726/lib/arm/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\VC\14.15.26726\lib\arm\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld\arm\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld\arm\dll_obj\almap\_findfirsti64.obj @@ -318,7 +325,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\divide.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvccctr.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvcccvb.obj diff --git a/src/14.15.26726/lib/arm64/msvcrt.cmd b/src/14.15.26726/lib/arm64/msvcrt.cmd index 590ddd379..4b6f8026f 100644 --- a/src/14.15.26726/lib/arm64/msvcrt.cmd +++ b/src/14.15.26726/lib/arm64/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\VC\14.15.26726\lib\arm64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld\arm64\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld\arm64\dll_obj\almap\_findfirsti64.obj @@ -313,7 +320,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\denormal_control.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvccctr.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvcccvb.obj diff --git a/src/14.15.26726/lib/spectre/arm/msvcrt.cmd b/src/14.15.26726/lib/spectre/arm/msvcrt.cmd index 822193e90..b41306b48 100644 --- a/src/14.15.26726/lib/spectre/arm/msvcrt.cmd +++ b/src/14.15.26726/lib/spectre/arm/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\..\VC\14.15.26726\lib\Spectre\arm\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld_spectre\arm\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld_spectre\arm\dll_obj\almap\_findfirsti64.obj @@ -318,7 +325,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 ::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\divide.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvccctr.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvcccvb.obj diff --git a/src/14.15.26726/lib/spectre/arm64/msvcrt.cmd b/src/14.15.26726/lib/spectre/arm64/msvcrt.cmd index 04390e313..67f5ef9d5 100644 --- a/src/14.15.26726/lib/spectre/arm64/msvcrt.cmd +++ b/src/14.15.26726/lib/spectre/arm64/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\..\VC\14.15.26726\lib\spectre\arm64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld_spectre\arm64\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld_spectre\arm64\dll_obj\almap\_findfirsti64.obj @@ -313,7 +320,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\denormal_control.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvccctr.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvcccvb.obj diff --git a/src/14.15.26726/lib/spectre/x64/msvcrt.cmd b/src/14.15.26726/lib/spectre/x64/msvcrt.cmd index 228268922..975619612 100644 --- a/src/14.15.26726/lib/spectre/x64/msvcrt.cmd +++ b/src/14.15.26726/lib/spectre/x64/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\..\VC\14.15.26726\lib\Spectre\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld_spectre\amd64\dll_obj\almap\_findfirst.obj @@ -318,7 +324,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\denormal_control.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvccctr.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvcccvb.obj diff --git a/src/14.15.26726/lib/spectre/x86/msvcrt.cmd b/src/14.15.26726/lib/spectre/x86/msvcrt.cmd index 26a18d908..20a9b4ca0 100644 --- a/src/14.15.26726/lib/spectre/x86/msvcrt.cmd +++ b/src/14.15.26726/lib/spectre/x86/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\..\VC\14.15.26726\lib\spectre\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld_spectre\i386\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld_spectre\i386\dll_obj\almap\_findfirsti64.obj @@ -325,7 +331,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dllsupp.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg2.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg3.obj diff --git a/src/14.15.26726/lib/x64/msvcrt.cmd b/src/14.15.26726/lib/x64/msvcrt.cmd index 16c3c4f73..a6c00846a 100644 --- a/src/14.15.26726/lib/x64/msvcrt.cmd +++ b/src/14.15.26726/lib/x64/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.15.26726\lib\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld\amd64\dll_obj\almap\_findfirst.obj @@ -318,7 +324,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\denormal_control.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvccctr.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvcccvb.obj diff --git a/src/14.15.26726/lib/x86/msvcrt.cmd b/src/14.15.26726/lib/x86/msvcrt.cmd index 35a68c529..74a858b9d 100644 --- a/src/14.15.26726/lib/x86/msvcrt.cmd +++ b/src/14.15.26726/lib/x86/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\VC\14.15.26726\lib\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld\i386\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\crt_bld\i386\dll_obj\almap\_findfirsti64.obj @@ -325,7 +331,7 @@ lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_11033 lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dllsupp.obj -lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg2.obj lib "%libfile%" /remove:f:\binaries\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg3.obj diff --git a/src/14.15.26726/vcruntime/exe_common.inl b/src/14.15.26726/vcruntime/exe_common.inl index 13e201f77..f24181c4a 100644 --- a/src/14.15.26726/vcruntime/exe_common.inl +++ b/src/14.15.26726/vcruntime/exe_common.inl @@ -302,13 +302,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.16.27023/lib/arm/msvcrt.cmd b/src/14.16.27023/lib/arm/msvcrt.cmd index 25aac03cf..efd5b131b 100644 --- a/src/14.16.27023/lib/arm/msvcrt.cmd +++ b/src/14.16.27023/lib/arm/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\VC\14.16.27023\lib\arm\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld\arm\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld\arm\dll_obj\almap\_findfirsti64.obj @@ -307,7 +314,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\divide.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvcccvb.obj diff --git a/src/14.16.27023/lib/arm64/msvcrt.cmd b/src/14.16.27023/lib/arm64/msvcrt.cmd index f4c6d5173..502eb5225 100644 --- a/src/14.16.27023/lib/arm64/msvcrt.cmd +++ b/src/14.16.27023/lib/arm64/msvcrt.cmd @@ -2,7 +2,16 @@ set libfile=%~dp0..\..\..\..\VC\14.16.27023\lib\arm64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" + lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld\arm64\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld\arm64\dll_obj\almap\_findfirsti64.obj @@ -304,7 +313,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvcccvb.obj diff --git a/src/14.16.27023/lib/spectre/arm/msvcrt.cmd b/src/14.16.27023/lib/spectre/arm/msvcrt.cmd index a1eff3727..34f0b7494 100644 --- a/src/14.16.27023/lib/spectre/arm/msvcrt.cmd +++ b/src/14.16.27023/lib/spectre/arm/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\..\VC\14.16.27023\lib\Spectre\arm\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld_spectre\arm\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld_spectre\arm\dll_obj\almap\_findfirsti64.obj @@ -307,7 +314,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\divide.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvcccvb.obj diff --git a/src/14.16.27023/lib/spectre/arm64/msvcrt.cmd b/src/14.16.27023/lib/spectre/arm64/msvcrt.cmd index b2b3b8e15..2674c2d1b 100644 --- a/src/14.16.27023/lib/spectre/arm64/msvcrt.cmd +++ b/src/14.16.27023/lib/spectre/arm64/msvcrt.cmd @@ -2,7 +2,14 @@ set libfile=%~dp0..\..\..\..\..\VC\14.16.27023\lib\spectre\arm64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) + +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld_spectre\arm64\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld_spectre\arm64\dll_obj\almap\_findfirsti64.obj @@ -304,7 +311,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvcccvb.obj diff --git a/src/14.16.27023/lib/spectre/x64/msvcrt.cmd b/src/14.16.27023/lib/spectre/x64/msvcrt.cmd index 4bdf43cd3..4584bd71c 100644 --- a/src/14.16.27023/lib/spectre/x64/msvcrt.cmd +++ b/src/14.16.27023/lib/spectre/x64/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\..\VC\14.16.27023\lib\Spectre\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld_spectre\amd64\dll_obj\almap\_findfirst.obj @@ -308,7 +314,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvcccvb.obj diff --git a/src/14.16.27023/lib/spectre/x86/msvcrt.cmd b/src/14.16.27023/lib/spectre/x86/msvcrt.cmd index 684d91f93..e69ff4284 100644 --- a/src/14.16.27023/lib/spectre/x86/msvcrt.cmd +++ b/src/14.16.27023/lib/spectre/x86/msvcrt.cmd @@ -3,8 +3,14 @@ set libfile=%~dp0..\..\..\..\..\VC\14.16.27023\lib\spectre\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\crt_bld_spectre\i386\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\crt_bld_spectre\i386\dll_obj\almap\_findfirsti64.obj @@ -313,7 +319,7 @@ lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg3.obj diff --git a/src/14.16.27023/lib/x64/msvcrt.cmd b/src/14.16.27023/lib/x64/msvcrt.cmd index c45f29c1f..7485f6f7b 100644 --- a/src/14.16.27023/lib/x64/msvcrt.cmd +++ b/src/14.16.27023/lib/x64/msvcrt.cmd @@ -3,8 +3,15 @@ set libfile=%~dp0..\..\..\..\VC\14.16.27023\lib\x64\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvars64.bat" lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\crt_bld\amd64\dll_obj\almap\_findfirst.obj diff --git a/src/14.16.27023/lib/x86/msvcrt.cmd b/src/14.16.27023/lib/x86/msvcrt.cmd index 98cba44b0..b951ba97c 100644 --- a/src/14.16.27023/lib/x86/msvcrt.cmd +++ b/src/14.16.27023/lib/x86/msvcrt.cmd @@ -3,8 +3,15 @@ set libfile=%~dp0..\..\..\..\VC\14.16.27023\lib\x86\vc.lib copy "%~dp0msvcrt.lib" "%libfile%" /y +set BuiltInVsWhereExe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if not defined ProgramFiles(x86) ( set "BuiltInVsWhereExe="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"" ) -@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsx86_amd64.bat" +if not exist %BuiltInVsWhereExe% (echo 밲װVS2017߸߰汾Ȼ& goto:eof ) + +for /f "tokens=*" %%i in ('%BuiltInVsWhereExe% -latest -prerelease -property installationPath') do ( set LatestVisualStudioRoot=%%i) + + +@call "%LatestVisualStudioRoot%\VC\Auxiliary\Build\vcvarsx86_amd64.bat" lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\crt_bld\i386\dll_obj\almap\_findfirst.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\crt_bld\i386\dll_obj\almap\_findfirsti64.obj diff --git a/src/14.16.27023/vcruntime/exe_common.inl b/src/14.16.27023/vcruntime/exe_common.inl index ed571be91..7a6261944 100644 --- a/src/14.16.27023/vcruntime/exe_common.inl +++ b/src/14.16.27023/vcruntime/exe_common.inl @@ -302,13 +302,12 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif + // // Initialization is complete; invoke main... // diff --git a/src/14.20.27508/vcruntime/exe_common.inl b/src/14.20.27508/vcruntime/exe_common.inl index 62276c497..eb3f7d6c1 100644 --- a/src/14.20.27508/vcruntime/exe_common.inl +++ b/src/14.20.27508/vcruntime/exe_common.inl @@ -302,13 +302,11 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif // // Initialization is complete; invoke main... diff --git a/src/14.21.27702/lib/arm/msvcrt.cmd b/src/14.21.27702/lib/arm/msvcrt.cmd index 5b56506b6..d3ecaf12f 100644 --- a/src/14.21.27702/lib/arm/msvcrt.cmd +++ b/src/14.21.27702/lib/arm/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\divide.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvcccvb.obj diff --git a/src/14.21.27702/lib/arm64/msvcrt.cmd b/src/14.21.27702/lib/arm64/msvcrt.cmd index 07f5f408b..c374ff3ce 100644 --- a/src/14.21.27702/lib/arm64/msvcrt.cmd +++ b/src/14.21.27702/lib/arm64/msvcrt.cmd @@ -304,7 +304,7 @@ lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvcccvb.obj diff --git a/src/14.21.27702/lib/spectre/arm/msvcrt.cmd b/src/14.21.27702/lib/spectre/arm/msvcrt.cmd index 26c9bca66..e223819fa 100644 --- a/src/14.21.27702/lib/spectre/arm/msvcrt.cmd +++ b/src/14.21.27702/lib/spectre/arm/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\divide.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvcccvb.obj diff --git a/src/14.21.27702/lib/spectre/arm64/msvcrt.cmd b/src/14.21.27702/lib/spectre/arm64/msvcrt.cmd index cbda885af..e3ce03883 100644 --- a/src/14.21.27702/lib/spectre/arm64/msvcrt.cmd +++ b/src/14.21.27702/lib/spectre/arm64/msvcrt.cmd @@ -304,7 +304,7 @@ lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvcccvb.obj diff --git a/src/14.21.27702/lib/spectre/x64/msvcrt.cmd b/src/14.21.27702/lib/spectre/x64/msvcrt.cmd index bebb6170f..a23a82d45 100644 --- a/src/14.21.27702/lib/spectre/x64/msvcrt.cmd +++ b/src/14.21.27702/lib/spectre/x64/msvcrt.cmd @@ -308,7 +308,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvcccvb.obj diff --git a/src/14.21.27702/lib/spectre/x86/msvcrt.cmd b/src/14.21.27702/lib/spectre/x86/msvcrt.cmd index d968a52fb..3cf8b86e7 100644 --- a/src/14.21.27702/lib/spectre/x86/msvcrt.cmd +++ b/src/14.21.27702/lib/spectre/x86/msvcrt.cmd @@ -313,7 +313,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg3.obj diff --git a/src/14.21.27702/lib/x64/msvcrt.cmd b/src/14.21.27702/lib/x64/msvcrt.cmd index e2df601d9..d349ba580 100644 --- a/src/14.21.27702/lib/x64/msvcrt.cmd +++ b/src/14.21.27702/lib/x64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvcccvb.obj diff --git a/src/14.21.27702/lib/x86/msvcrt.cmd b/src/14.21.27702/lib/x86/msvcrt.cmd index dd990aa82..26904f17a 100644 --- a/src/14.21.27702/lib/x86/msvcrt.cmd +++ b/src/14.21.27702/lib/x86/msvcrt.cmd @@ -313,7 +313,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg3.obj diff --git a/src/14.21.27702/vcruntime/exe_common.inl b/src/14.21.27702/vcruntime/exe_common.inl index 62276c497..eb3f7d6c1 100644 --- a/src/14.21.27702/vcruntime/exe_common.inl +++ b/src/14.21.27702/vcruntime/exe_common.inl @@ -302,13 +302,11 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif // // Initialization is complete; invoke main... diff --git a/src/14.22.27905/vcruntime/exe_common.inl b/src/14.22.27905/vcruntime/exe_common.inl index 62276c497..eb3f7d6c1 100644 --- a/src/14.22.27905/vcruntime/exe_common.inl +++ b/src/14.22.27905/vcruntime/exe_common.inl @@ -302,13 +302,11 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif // // Initialization is complete; invoke main... diff --git a/src/14.23.28105/lib/Spectre/arm/msvcrt.cmd b/src/14.23.28105/lib/Spectre/arm/msvcrt.cmd index e09fbc0df..18551da62 100644 --- a/src/14.23.28105/lib/Spectre/arm/msvcrt.cmd +++ b/src/14.23.28105/lib/Spectre/arm/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\divide.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvcccvb.obj diff --git a/src/14.23.28105/lib/Spectre/arm64/msvcrt.cmd b/src/14.23.28105/lib/Spectre/arm64/msvcrt.cmd index 073b0edde..d0a85b350 100644 --- a/src/14.23.28105/lib/Spectre/arm64/msvcrt.cmd +++ b/src/14.23.28105/lib/Spectre/arm64/msvcrt.cmd @@ -304,7 +304,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvcccvb.obj diff --git a/src/14.23.28105/lib/Spectre/x64/msvcrt.cmd b/src/14.23.28105/lib/Spectre/x64/msvcrt.cmd index bd1f729d1..fe7528b31 100644 --- a/src/14.23.28105/lib/Spectre/x64/msvcrt.cmd +++ b/src/14.23.28105/lib/Spectre/x64/msvcrt.cmd @@ -308,7 +308,7 @@ lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvcccvb.obj diff --git a/src/14.23.28105/lib/arm/msvcrt.cmd b/src/14.23.28105/lib/arm/msvcrt.cmd index 81aa9ee35..5d9fb2e4b 100644 --- a/src/14.23.28105/lib/arm/msvcrt.cmd +++ b/src/14.23.28105/lib/arm/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\divide.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvcccvb.obj diff --git a/src/14.23.28105/lib/arm64/msvcrt.cmd b/src/14.23.28105/lib/arm64/msvcrt.cmd index 09bd7fb09..6cc0e47b7 100644 --- a/src/14.23.28105/lib/arm64/msvcrt.cmd +++ b/src/14.23.28105/lib/arm64/msvcrt.cmd @@ -304,7 +304,7 @@ lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvcccvb.obj diff --git a/src/14.23.28105/lib/x64/msvcrt.cmd b/src/14.23.28105/lib/x64/msvcrt.cmd index 82d01b0bf..45697cb64 100644 --- a/src/14.23.28105/lib/x64/msvcrt.cmd +++ b/src/14.23.28105/lib/x64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvcccvb.obj diff --git a/src/14.23.28105/lib/x86/msvcrt.cmd b/src/14.23.28105/lib/x86/msvcrt.cmd index ab0b358bd..8c56f121b 100644 --- a/src/14.23.28105/lib/x86/msvcrt.cmd +++ b/src/14.23.28105/lib/x86/msvcrt.cmd @@ -313,7 +313,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg3.obj diff --git a/src/14.23.28105/vcruntime/exe_common.inl b/src/14.23.28105/vcruntime/exe_common.inl index 62276c497..eb3f7d6c1 100644 --- a/src/14.23.28105/vcruntime/exe_common.inl +++ b/src/14.23.28105/vcruntime/exe_common.inl @@ -302,13 +302,11 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif // // Initialization is complete; invoke main... diff --git a/src/14.24.28314/lib/Spectre/arm/msvcrt.cmd b/src/14.24.28314/lib/Spectre/arm/msvcrt.cmd index 7da1566bb..d5215f055 100644 --- a/src/14.24.28314/lib/Spectre/arm/msvcrt.cmd +++ b/src/14.24.28314/lib/Spectre/arm/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\divide.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvcccvb.obj diff --git a/src/14.24.28314/lib/Spectre/arm64/msvcrt.cmd b/src/14.24.28314/lib/Spectre/arm64/msvcrt.cmd index 623f9f5f4..1efaae887 100644 --- a/src/14.24.28314/lib/Spectre/arm64/msvcrt.cmd +++ b/src/14.24.28314/lib/Spectre/arm64/msvcrt.cmd @@ -304,7 +304,7 @@ lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvcccvb.obj diff --git a/src/14.24.28314/lib/Spectre/x64/msvcrt.cmd b/src/14.24.28314/lib/Spectre/x64/msvcrt.cmd index bed226c13..5d78c8f60 100644 --- a/src/14.24.28314/lib/Spectre/x64/msvcrt.cmd +++ b/src/14.24.28314/lib/Spectre/x64/msvcrt.cmd @@ -308,7 +308,7 @@ lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvcccvb.obj diff --git a/src/14.24.28314/lib/Spectre/x86/msvcrt.cmd b/src/14.24.28314/lib/Spectre/x86/msvcrt.cmd index a793f51ae..19b7d12db 100644 --- a/src/14.24.28314/lib/Spectre/x86/msvcrt.cmd +++ b/src/14.24.28314/lib/Spectre/x86/msvcrt.cmd @@ -313,7 +313,7 @@ lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg3.obj diff --git a/src/14.24.28314/lib/arm/msvcrt.cmd b/src/14.24.28314/lib/arm/msvcrt.cmd index 0e0dd9435..dfb4ecf37 100644 --- a/src/14.24.28314/lib/arm/msvcrt.cmd +++ b/src/14.24.28314/lib/arm/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\divide.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvcccvb.obj diff --git a/src/14.24.28314/lib/arm64/msvcrt.cmd b/src/14.24.28314/lib/arm64/msvcrt.cmd index df8de0fbd..9e9124c2f 100644 --- a/src/14.24.28314/lib/arm64/msvcrt.cmd +++ b/src/14.24.28314/lib/arm64/msvcrt.cmd @@ -304,7 +304,7 @@ lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvcccvb.obj diff --git a/src/14.24.28314/lib/x64/msvcrt.cmd b/src/14.24.28314/lib/x64/msvcrt.cmd index 6383df095..d47a770a6 100644 --- a/src/14.24.28314/lib/x64/msvcrt.cmd +++ b/src/14.24.28314/lib/x64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\5\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvcccvb.obj diff --git a/src/14.24.28314/lib/x86/msvcrt.cmd b/src/14.24.28314/lib/x86/msvcrt.cmd index 7d9c80881..ec3636569 100644 --- a/src/14.24.28314/lib/x86/msvcrt.cmd +++ b/src/14.24.28314/lib/x86/msvcrt.cmd @@ -313,7 +313,7 @@ lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg3.obj diff --git a/src/14.24.28314/vcruntime/exe_common.inl b/src/14.24.28314/vcruntime/exe_common.inl index 62276c497..eb3f7d6c1 100644 --- a/src/14.24.28314/vcruntime/exe_common.inl +++ b/src/14.24.28314/vcruntime/exe_common.inl @@ -302,13 +302,11 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif // // Initialization is complete; invoke main... diff --git a/src/14.25.28610/lib/Spectre/arm/msvcrt.cmd b/src/14.25.28610/lib/Spectre/arm/msvcrt.cmd index ed11a0bd7..b9b20cc21 100644 --- a/src/14.25.28610/lib/Spectre/arm/msvcrt.cmd +++ b/src/14.25.28610/lib/Spectre/arm/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\divide.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvcccvb.obj diff --git a/src/14.25.28610/lib/Spectre/arm64/msvcrt.cmd b/src/14.25.28610/lib/Spectre/arm64/msvcrt.cmd index 3c8a5cdf1..cec2d1beb 100644 --- a/src/14.25.28610/lib/Spectre/arm64/msvcrt.cmd +++ b/src/14.25.28610/lib/Spectre/arm64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\denormal_control.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvcccvb.obj diff --git a/src/14.25.28610/lib/Spectre/x64/msvcrt.cmd b/src/14.25.28610/lib/Spectre/x64/msvcrt.cmd index 03b32ed3a..56c1b98d6 100644 --- a/src/14.25.28610/lib/Spectre/x64/msvcrt.cmd +++ b/src/14.25.28610/lib/Spectre/x64/msvcrt.cmd @@ -311,7 +311,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvcccvb.obj diff --git a/src/14.25.28610/lib/Spectre/x86/msvcrt.cmd b/src/14.25.28610/lib/Spectre/x86/msvcrt.cmd index 09760b8bc..a17428174 100644 --- a/src/14.25.28610/lib/Spectre/x86/msvcrt.cmd +++ b/src/14.25.28610/lib/Spectre/x86/msvcrt.cmd @@ -316,7 +316,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg3.obj diff --git a/src/14.25.28610/lib/arm/msvcrt.cmd b/src/14.25.28610/lib/arm/msvcrt.cmd index e92baf4b0..ab0bc2211 100644 --- a/src/14.25.28610/lib/arm/msvcrt.cmd +++ b/src/14.25.28610/lib/arm/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\divide.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvcccvb.obj diff --git a/src/14.25.28610/lib/arm64/msvcrt.cmd b/src/14.25.28610/lib/arm64/msvcrt.cmd index cceffa9d3..157a14d4e 100644 --- a/src/14.25.28610/lib/arm64/msvcrt.cmd +++ b/src/14.25.28610/lib/arm64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\denormal_control.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\2\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvcccvb.obj diff --git a/src/14.25.28610/lib/x64/msvcrt.cmd b/src/14.25.28610/lib/x64/msvcrt.cmd index acada14cc..486a0b553 100644 --- a/src/14.25.28610/lib/x64/msvcrt.cmd +++ b/src/14.25.28610/lib/x64/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\denormal_control.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvcccvb.obj diff --git a/src/14.25.28610/lib/x86/msvcrt.cmd b/src/14.25.28610/lib/x86/msvcrt.cmd index 1f9686548..80f77121b 100644 --- a/src/14.25.28610/lib/x86/msvcrt.cmd +++ b/src/14.25.28610/lib/x86/msvcrt.cmd @@ -316,7 +316,7 @@ lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg3.obj diff --git a/src/14.25.28610/vcruntime/exe_common.inl b/src/14.25.28610/vcruntime/exe_common.inl index 62276c497..eb3f7d6c1 100644 --- a/src/14.25.28610/vcruntime/exe_common.inl +++ b/src/14.25.28610/vcruntime/exe_common.inl @@ -302,13 +302,11 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif // // Initialization is complete; invoke main... diff --git a/src/14.26.28801/lib/Spectre/arm/msvcrt.cmd b/src/14.26.28801/lib/Spectre/arm/msvcrt.cmd index 0585e6ebf..4320ffb19 100644 --- a/src/14.26.28801/lib/Spectre/arm/msvcrt.cmd +++ b/src/14.26.28801/lib/Spectre/arm/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_ ::lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\divide.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvccctr.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvcccvb.obj diff --git a/src/14.26.28801/lib/Spectre/arm64/msvcrt.cmd b/src/14.26.28801/lib/Spectre/arm64/msvcrt.cmd index 067ce0531..b1d684fa1 100644 --- a/src/14.26.28801/lib/Spectre/arm64/msvcrt.cmd +++ b/src/14.26.28801/lib/Spectre/arm64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\denormal_control.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvcccvb.obj diff --git a/src/14.26.28801/lib/Spectre/x64/msvcrt.cmd b/src/14.26.28801/lib/Spectre/x64/msvcrt.cmd index 14cc6f5c6..d4768f023 100644 --- a/src/14.26.28801/lib/Spectre/x64/msvcrt.cmd +++ b/src/14.26.28801/lib/Spectre/x64/msvcrt.cmd @@ -311,7 +311,7 @@ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\denormal_control.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvcccvb.obj diff --git a/src/14.26.28801/lib/Spectre/x86/msvcrt.cmd b/src/14.26.28801/lib/Spectre/x86/msvcrt.cmd index 268a85590..a2c279cdc 100644 --- a/src/14.26.28801/lib/Spectre/x86/msvcrt.cmd +++ b/src/14.26.28801/lib/Spectre/x86/msvcrt.cmd @@ -316,7 +316,7 @@ lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dllsupp.obj -lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg2.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg3.obj diff --git a/src/14.26.28801/lib/arm/msvcrt.cmd b/src/14.26.28801/lib/arm/msvcrt.cmd index 50255309f..86fcbacfc 100644 --- a/src/14.26.28801/lib/arm/msvcrt.cmd +++ b/src/14.26.28801/lib/arm/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_ ::lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\divide.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvccctr.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvcccvb.obj diff --git a/src/14.26.28801/lib/arm64/msvcrt.cmd b/src/14.26.28801/lib/arm64/msvcrt.cmd index 601a7abe2..aff498306 100644 --- a/src/14.26.28801/lib/arm64/msvcrt.cmd +++ b/src/14.26.28801/lib/arm64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\denormal_control.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvccctr.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvcccvb.obj diff --git a/src/14.26.28801/lib/x64/msvcrt.cmd b/src/14.26.28801/lib/x64/msvcrt.cmd index 59775f791..f11bb6fa3 100644 --- a/src/14.26.28801/lib/x64/msvcrt.cmd +++ b/src/14.26.28801/lib/x64/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_ lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\denormal_control.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvccctr.obj lib "%libfile%" /remove:d:\A01\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvcccvb.obj diff --git a/src/14.26.28801/lib/x86/msvcrt.cmd b/src/14.26.28801/lib/x86/msvcrt.cmd index ad9eb5360..7bacd38fa 100644 --- a/src/14.26.28801/lib/x86/msvcrt.cmd +++ b/src/14.26.28801/lib/x86/msvcrt.cmd @@ -316,7 +316,7 @@ lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dllsupp.obj -lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg2.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg3.obj diff --git a/src/14.26.28801/vcruntime/exe_common.inl b/src/14.26.28801/vcruntime/exe_common.inl index 62276c497..eb3f7d6c1 100644 --- a/src/14.26.28801/vcruntime/exe_common.inl +++ b/src/14.26.28801/vcruntime/exe_common.inl @@ -302,13 +302,11 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif // // Initialization is complete; invoke main... diff --git a/src/14.27.29110/lib/Spectre/arm/msvcrt.cmd b/src/14.27.29110/lib/Spectre/arm/msvcrt.cmd index 9eecefd47..fac752f9e 100644 --- a/src/14.27.29110/lib/Spectre/arm/msvcrt.cmd +++ b/src/14.27.29110/lib/Spectre/arm/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\divide.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm\ehvcccvb.obj diff --git a/src/14.27.29110/lib/Spectre/arm64/msvcrt.cmd b/src/14.27.29110/lib/Spectre/arm64/msvcrt.cmd index f5384ff44..07e0c6386 100644 --- a/src/14.27.29110/lib/Spectre/arm64/msvcrt.cmd +++ b/src/14.27.29110/lib/Spectre/arm64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\denormal_control.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\arm64\ehvcccvb.obj diff --git a/src/14.27.29110/lib/Spectre/x64/msvcrt.cmd b/src/14.27.29110/lib/Spectre/x64/msvcrt.cmd index 46a0a61f6..8da959006 100644 --- a/src/14.27.29110/lib/Spectre/x64/msvcrt.cmd +++ b/src/14.27.29110/lib/Spectre/x64/msvcrt.cmd @@ -311,7 +311,7 @@ lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\denormal_control.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\amd64\ehvcccvb.obj diff --git a/src/14.27.29110/lib/Spectre/x86/msvcrt.cmd b/src/14.27.29110/lib/Spectre/x86/msvcrt.cmd index 51c68ec3f..bbc722857 100644 --- a/src/14.27.29110/lib/Spectre/x86/msvcrt.cmd +++ b/src/14.27.29110/lib/Spectre/x86/msvcrt.cmd @@ -316,7 +316,7 @@ lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr_spectre\x86\ehprolg3.obj diff --git a/src/14.27.29110/lib/arm/msvcrt.cmd b/src/14.27.29110/lib/arm/msvcrt.cmd index b9dd4f7f3..f8d2137e3 100644 --- a/src/14.27.29110/lib/arm/msvcrt.cmd +++ b/src/14.27.29110/lib/arm/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativepro ::lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\divide.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\4\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm\ehvcccvb.obj diff --git a/src/14.27.29110/lib/arm64/msvcrt.cmd b/src/14.27.29110/lib/arm64/msvcrt.cmd index d7e9086ef..53cc8ccc4 100644 --- a/src/14.27.29110/lib/arm64/msvcrt.cmd +++ b/src/14.27.29110/lib/arm64/msvcrt.cmd @@ -307,7 +307,7 @@ lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\denormal_control.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\6\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\arm64\ehvcccvb.obj diff --git a/src/14.27.29110/lib/x64/msvcrt.cmd b/src/14.27.29110/lib/x64/msvcrt.cmd index 7eb00d935..caa00616a 100644 --- a/src/14.27.29110/lib/x64/msvcrt.cmd +++ b/src/14.27.29110/lib/x64/msvcrt.cmd @@ -310,7 +310,7 @@ lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\denormal_control.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dll_dllmain_stub.obj -lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj +::lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_dtor.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\dyn_tls_init.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvccctr.obj lib "%libfile%" /remove:D:\agent\_work\9\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\amd64\ehvcccvb.obj diff --git a/src/14.27.29110/lib/x86/msvcrt.cmd b/src/14.27.29110/lib/x86/msvcrt.cmd index 48d0d0abb..0141ad712 100644 --- a/src/14.27.29110/lib/x86/msvcrt.cmd +++ b/src/14.27.29110/lib/x86/msvcrt.cmd @@ -316,7 +316,7 @@ lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativepro lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dll_dllmain_stub.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dllsupp.obj -lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj +::lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_dtor.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\dyn_tls_init.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg2.obj lib "%libfile%" /remove:d:\agent\_work\3\s\Intermediate\vctools\msvcrt.nativeproj_110336922\objr\x86\ehprolg3.obj diff --git a/src/14.27.29110/vcruntime/exe_common.inl b/src/14.27.29110/vcruntime/exe_common.inl index 62276c497..eb3f7d6c1 100644 --- a/src/14.27.29110/vcruntime/exe_common.inl +++ b/src/14.27.29110/vcruntime/exe_common.inl @@ -302,13 +302,11 @@ static __declspec(noinline) int __cdecl __scrt_common_main_seh() // If this module has any thread-local destructors, register the // callback function with the Unified CRT to run on exit. - #ifndef __Build_LTL //޷ȷʵ_register_thread_local_exe_atexit_callback̶Ҫ˳ˣthread-local destructorsϵҲ _tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback(); if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback)) { _register_thread_local_exe_atexit_callback(*tls_dtor_callback); } - #endif // // Initialization is complete; invoke main... diff --git a/src/exit_thunks.cpp b/src/exit_thunks.cpp deleted file mode 100644 index e586ce9d6..000000000 --- a/src/exit_thunks.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -#include -#include "msvcrt_IAT.h" - -extern "C" extern _onexit_table_t __acrt_at_quick_exit_table; - - -static int __cdecl atexit_exception_filter(unsigned long const _exception_code) throw() -{ - if (_exception_code == ('msc' | 0xE0000000)) - { - return EXCEPTION_EXECUTE_HANDLER; - } - - return EXCEPTION_CONTINUE_SEARCH; -} - -// CRT_REFACTOR TODO This is duplicated in the VCStartup utility_desktop.cpp. -static bool __cdecl is_managed_app() throw() -{ - PIMAGE_DOS_HEADER const dos_header = reinterpret_cast(GetModuleHandleW(nullptr)); - if (dos_header == nullptr) - return false; - - if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) - return false; - - PIMAGE_NT_HEADERS const pe_header = reinterpret_cast( - reinterpret_cast(dos_header) + dos_header->e_lfanew); - - if (pe_header->Signature != IMAGE_NT_SIGNATURE) - return false; - - if (pe_header->OptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC) - return false; - - // prefast assumes we are overrunning __ImageBase -#pragma warning(push) -#pragma warning(disable: 26000) - - if (pe_header->OptionalHeader.NumberOfRvaAndSizes <= IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR) - return false; - -#pragma warning(pop) - - if (pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress == 0) - return false; - - return true; -} - -typedef void (WINAPI* exit_process_pft)(UINT); - -static void __cdecl try_cor_exit_process(UINT const return_code) throw() -{ - __crt_unique_hmodule mscoree; - if (!GetModuleHandleExW(0, L"mscoree.dll", mscoree.get_address_of())) - return; - - auto const cor_exit_process = __crt_get_proc_address(mscoree.get(), "CorExitProcess"); - if (!cor_exit_process) - return; - - cor_exit_process(return_code); -} - - -extern "C" void __cdecl quick_exit(int const return_code) -{ - // First, check to see if we're loaded in a managed app. If we are, try to - // call CorExitProcess to let the CLR handle the process termination. If - // the call to CorExitProcess is successful, then it will call back through - // this function with a return mode of _crt_exit_return_to_caller, at which - // point we will run the C termination routines. It will then terminate the - // process itself and not return. - if (is_managed_app()) - { - try_cor_exit_process(return_code); - } - - - __acrt_lock_and_call(__acrt_exit_lock, [&]() - { - __try - { - _execute_onexit_table(&__acrt_at_quick_exit_table); - } - __except (atexit_exception_filter(GetExceptionCode())) - { - terminate(); - } - - _exit(return_code); - - return; - }); -} diff --git a/src/km.h b/src/km.h new file mode 100644 index 000000000..c64fc6fa5 --- /dev/null +++ b/src/km.h @@ -0,0 +1,5072 @@ +#pragma once + +#ifndef SDK_KM_H +#define SDK_KM_H + +#ifndef UMDF_USING_NTSTATUS +#define UMDF_USING_NTSTATUS +#endif +#include +#include +#include + +//#pragma comment(lib,"ntdll.lib") + + +#define FILE_SUPERSEDE 0x00000000 +#define FILE_OPEN 0x00000001 +#define FILE_CREATE 0x00000002 +#define FILE_OPEN_IF 0x00000003 +#define FILE_OVERWRITE 0x00000004 +#define FILE_OVERWRITE_IF 0x00000005 +#define FILE_MAXIMUM_DISPOSITION 0x00000005 + +#define OBJ_INHERIT 0x00000002L +#define OBJ_PERMANENT 0x00000010L +#define OBJ_EXCLUSIVE 0x00000020L +#define OBJ_CASE_INSENSITIVE 0x00000040L +#define OBJ_OPENIF 0x00000080L +#define OBJ_OPENLINK 0x00000100L +#define OBJ_KERNEL_HANDLE 0x00000200L +#define OBJ_FORCE_ACCESS_CHECK 0x00000400L +#define OBJ_VALID_ATTRIBUTES 0x000007F2L + +#define FILE_SUPERSEDED 0x00000000 +#define FILE_OPENED 0x00000001 +#define FILE_CREATED 0x00000002 +#define FILE_OVERWRITTEN 0x00000003 +#define FILE_EXISTS 0x00000004 +#define FILE_DOES_NOT_EXIST 0x00000005 + +#define FILE_DIRECTORY_FILE 0x00000001 +#define FILE_WRITE_THROUGH 0x00000002 +#define FILE_SEQUENTIAL_ONLY 0x00000004 +#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 + +#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 +#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 +#define FILE_NON_DIRECTORY_FILE 0x00000040 +#define FILE_CREATE_TREE_CONNECTION 0x00000080 + +#define FILE_COMPLETE_IF_OPLOCKED 0x00000100 +#define FILE_NO_EA_KNOWLEDGE 0x00000200 +#define FILE_OPEN_REMOTE_INSTANCE 0x00000400 +#define FILE_RANDOM_ACCESS 0x00000800 + +#define FILE_DELETE_ON_CLOSE 0x00001000 +#define FILE_OPEN_BY_FILE_ID 0x00002000 +#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 +#define FILE_NO_COMPRESSION 0x00008000 + +#if (NTDDI_VERSION >= NTDDI_WIN7) +#define FILE_OPEN_REQUIRING_OPLOCK 0x00010000 +#define FILE_DISALLOW_EXCLUSIVE 0x00020000 +#endif /* NTDDI_VERSION >= NTDDI_WIN7 */ + +#define FILE_RESERVE_OPFILTER 0x00100000 +#define FILE_OPEN_REPARSE_POINT 0x00200000 +#define FILE_OPEN_NO_RECALL 0x00400000 +#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 + +#define FILE_VALID_OPTION_FLAGS 0x00ffffff +#define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032 +#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032 +#define FILE_VALID_SET_FLAGS 0x00000036 +#define FILE_SHARE_VALID_FLAGS 0x00000007 + +// +// Define special ByteOffset parameters for read and write operations +// + +#define FILE_WRITE_TO_END_OF_FILE 0xffffffff +#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe + +// +// Define alignment requirement values +// + +#define FILE_BYTE_ALIGNMENT 0x00000000 +#define FILE_WORD_ALIGNMENT 0x00000001 +#define FILE_LONG_ALIGNMENT 0x00000003 +#define FILE_QUAD_ALIGNMENT 0x00000007 +#define FILE_OCTA_ALIGNMENT 0x0000000f +#define FILE_32_BYTE_ALIGNMENT 0x0000001f +#define FILE_64_BYTE_ALIGNMENT 0x0000003f +#define FILE_128_BYTE_ALIGNMENT 0x0000007f +#define FILE_256_BYTE_ALIGNMENT 0x000000ff +#define FILE_512_BYTE_ALIGNMENT 0x000001ff + +// +// Define the maximum length of a filename string +// + +#define MAXIMUM_FILENAME_LENGTH 256 + +#define NtGetCurrentProcess() (HANDLE)-1 + +// begin_access +#define DUPLICATE_CLOSE_SOURCE 0x00000001 +#define DUPLICATE_SAME_ACCESS 0x00000002 +#define DUPLICATE_SAME_ATTRIBUTES 0x00000004 + +#ifndef _Reserved_ +#define _Reserved_ +#endif + +typedef _Return_type_success_(return >= 0) LONG NTSTATUS; +typedef NTSTATUS *PNTSTATUS; + + +#if defined __cplusplus && !defined _Disallow_YY_KM_Namespace +namespace YY { +#endif + +#if _MSC_VER <= 1500 + +typedef enum _FIRMWARE_TYPE { + FirmwareTypeUnknown, + FirmwareTypeBios, + FirmwareTypeUefi, + FirmwareTypeMax +} FIRMWARE_TYPE, *PFIRMWARE_TYPE; + +#endif + +typedef ULONG LOGICAL; + +typedef struct _UNICODE_STRING { + USHORT Length; + USHORT MaximumLength; + PWSTR Buffer; +} UNICODE_STRING, *PUNICODE_STRING; +typedef const UNICODE_STRING *PCUNICODE_STRING; + +typedef struct _ANSI_STRING { + USHORT Length; + USHORT MaximumLength; + PSTR Buffer; +} ANSI_STRING, STRING, *PSTRING, *PANSI_STRING; + +typedef const ANSI_STRING* PCANSI_STRING; + +#define InitializeObjectAttributes( p, n, a, r, s ) { \ + (p)->Length = sizeof( OBJECT_ATTRIBUTES ); \ + (p)->RootDirectory = r; \ + (p)->Attributes = a; \ + (p)->ObjectName = n; \ + (p)->SecurityDescriptor = s; \ + (p)->SecurityQualityOfService = NULL; \ + } + +typedef struct _OBJECT_ATTRIBUTES { + ULONG Length; + HANDLE RootDirectory; + PUNICODE_STRING ObjectName; + ULONG Attributes; + PVOID SecurityDescriptor; + PVOID SecurityQualityOfService; +} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; + + + +//#pragma pack(push,1) +typedef struct _IO_STATUS_BLOCK +{ + union + { + NTSTATUS Status; + PVOID Pointer; + } DUMMYUNIONNAME; + + ULONG_PTR Information; +} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; + +typedef struct _RTL_DRIVE_LETTER_CURDIR +{ + USHORT Flags; + USHORT Length; + ULONG TimeStamp; + STRING DosPath; +} RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR; + +typedef struct _CLIENT_ID { + HANDLE UniqueProcess; + HANDLE UniqueThread; +} CLIENT_ID, *PCLIENT_ID; + +typedef struct _CURDIR +{ + UNICODE_STRING DosPath; + HANDLE Handle; +} CURDIR, *PCURDIR; + +typedef short CSHORT; + +// +// Time conversion routines +// + +typedef struct _TIME_FIELDS { + CSHORT Year; // range [1601...] + CSHORT Month; // range [1..12] + CSHORT Day; // range [1..31] + CSHORT Hour; // range [0..23] + CSHORT Minute; // range [0..59] + CSHORT Second; // range [0..59] + CSHORT Milliseconds;// range [0..999] + CSHORT Weekday; // range [0..6] == [Sunday..Saturday] +} TIME_FIELDS; +typedef TIME_FIELDS *PTIME_FIELDS; + +typedef struct _RTL_USER_PROCESS_PARAMETERS_XP +{ + ULONG MaximumLength; + ULONG Length; + ULONG Flags; + ULONG DebugFlags; + PVOID ConsoleHandle; + ULONG ConsoleFlags; + HANDLE StdInputHandle; + HANDLE StdOutputHandle; + HANDLE StdErrorHandle; + UNICODE_STRING CurrentDirectoryPath; + HANDLE CurrentDirectoryHandle; + UNICODE_STRING DllPath; + UNICODE_STRING ImagePathName; + UNICODE_STRING CommandLine; + PVOID Environment; + ULONG StartingPositionLeft; + ULONG StartingPositionTop; + ULONG Width; + ULONG Height; + ULONG CharWidth; + ULONG CharHeight; + ULONG ConsoleTextAttributes; + ULONG WindowFlags; + ULONG ShowWindowFlags; + UNICODE_STRING WindowTitle; + UNICODE_STRING DesktopName; + UNICODE_STRING ShellInfo; + UNICODE_STRING RuntimeData; + RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20]; +} RTL_USER_PROCESS_PARAMETERS_XP, *PRTL_USER_PROCESS_PARAMETERS_XP, *PPROCESS_PARAMETERS_XP; + +typedef struct _RTL_USER_PROCESS_PARAMETERS_VISTA +{ + ULONG MaximumLength; + ULONG Length; + ULONG Flags; + ULONG DebugFlags; + PVOID ConsoleHandle; + ULONG ConsoleFlags; + HANDLE StdInputHandle; + HANDLE StdOutputHandle; + HANDLE StdErrorHandle; + CURDIR CurrentDirectoryPath; + UNICODE_STRING DllPath; + UNICODE_STRING ImagePathName; + UNICODE_STRING CommandLine; + PVOID Environment; + ULONG StartingPositionLeft; + ULONG StartingPositionTop; + ULONG Width; + ULONG Height; + ULONG CharWidth; + ULONG CharHeight; + ULONG ConsoleTextAttributes; + ULONG WindowFlags; + ULONG ShowWindowFlags; + UNICODE_STRING WindowTitle; + UNICODE_STRING DesktopName; + UNICODE_STRING ShellInfo; + UNICODE_STRING RuntimeData; + RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20]; + volatile ULONG_PTR EnvironmentSize; +} RTL_USER_PROCESS_PARAMETERS_VISTA, *PRTL_USER_PROCESS_PARAMETERS_VISTA, *PPROCESS_PARAMETERS_VISTA; + +typedef struct _RTL_USER_PROCESS_PARAMETERS_7 +{ + ULONG MaximumLength; + ULONG Length; + ULONG Flags; + ULONG DebugFlags; + PVOID ConsoleHandle; + ULONG ConsoleFlags; + HANDLE StdInputHandle; + HANDLE StdOutputHandle; + HANDLE StdErrorHandle; + CURDIR CurrentDirectoryPath; + UNICODE_STRING DllPath; + UNICODE_STRING ImagePathName; + UNICODE_STRING CommandLine; + PVOID Environment; + ULONG StartingPositionLeft; + ULONG StartingPositionTop; + ULONG Width; + ULONG Height; + ULONG CharWidth; + ULONG CharHeight; + ULONG ConsoleTextAttributes; + ULONG WindowFlags; + ULONG ShowWindowFlags; + UNICODE_STRING WindowTitle; + UNICODE_STRING DesktopName; + UNICODE_STRING ShellInfo; + UNICODE_STRING RuntimeData; + RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20]; + volatile ULONG_PTR EnvironmentSize; + volatile ULONG_PTR EnvironmentVersion; +} RTL_USER_PROCESS_PARAMETERS_7, *PRTL_USER_PROCESS_PARAMETERS_7, *PPROCESS_PARAMETERS_7; + +typedef struct _INITIAL_TEB { + PVOID FixedStackBase; + PVOID FixedStackLimit; + PVOID StackBase; + PVOID StackLimit; + PVOID AllocatedStackBase; +} INITIAL_TEB, *PINITIAL_TEB; + + +typedef struct _PEB_LDR_DATA_XP { + ULONG Length; + BOOLEAN Initialized; + PVOID SsHandle; + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + PVOID EntryInProgress; +} PEB_LDR_DATA_XP, *PPEB_LDR_DATA_XP; + +typedef struct _PEB_LDR_DATA_VISTA_7 { + ULONG Length; + BOOLEAN Initialized; + PVOID SsHandle; + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + PVOID EntryInProgress; + BOOLEAN ShutdownInProgress; + PVOID ShutdownThread; +} PEB_LDR_DATA_VISTA_7, *PPEB_LDR_DATA_VISTA_7; + +typedef struct _LDR_DATA_TABLE_ENTRY_XP { + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + PVOID BaseAddress; + PVOID EntryPoint; + ULONG SizeOfImage; + UNICODE_STRING FullDllName; + UNICODE_STRING BaseDllName; + ULONG Flags; + SHORT LoadCount; + SHORT TlsIndex; + union + { + LIST_ENTRY HashLinks; + PVOID SectionPointer; + }; + ULONG Checksum; + union + { + ULONG TimeDataStamp; + PVOID LoadedImports; + }; + PVOID EntryPointActivationContext; + PVOID PatchInformation; +} LDR_DATA_TABLE_ENTRY_XP, *PLDR_DATA_TABLE_ENTRY_XP, LDR_MODULE_XP, *PLDR_MODULE_XP; + +typedef struct _LDR_DATA_TABLE_ENTRY_VISTA { + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + PVOID BaseAddress; + PVOID EntryPoint; + ULONG SizeOfImage; + UNICODE_STRING FullDllName; + UNICODE_STRING BaseDllName; + ULONG Flags; + SHORT LoadCount; + SHORT TlsIndex; + union + { + LIST_ENTRY HashLinks; + PVOID SectionPointer; + }; + ULONG Checksum; + union + { + ULONG TimeDataStamp; + PVOID LoadedImports; + }; + PVOID EntryPointActivationContext; + PVOID PatchInformation; + LIST_ENTRY ForwarderLinks; + LIST_ENTRY ServiceTagLinks; + LIST_ENTRY StaticLinks; +} LDR_DATA_TABLE_ENTRY_VISTA, *PLDR_DATA_TABLE_ENTRY_VISTA, LDR_MODULE_VISTA, *PLDR_MODULE_VISTA; + +typedef struct _LDR_DATA_TABLE_ENTRY_7 { + LIST_ENTRY InLoadOrderModuleList; + LIST_ENTRY InMemoryOrderModuleList; + LIST_ENTRY InInitializationOrderModuleList; + PVOID BaseAddress; + PVOID EntryPoint; + ULONG SizeOfImage; + UNICODE_STRING FullDllName; + UNICODE_STRING BaseDllName; + ULONG Flags; + SHORT LoadCount; + SHORT TlsIndex; + union + { + LIST_ENTRY HashLinks; + PVOID SectionPointer; + }; + ULONG Checksum; + union + { + ULONG TimeDataStamp; + PVOID LoadedImports; + }; + PVOID EntryPointActivationContext; + PVOID PatchInformation; + LIST_ENTRY ForwarderLinks; + LIST_ENTRY ServiceTagLinks; + LIST_ENTRY StaticLinks; + PVOID ContextInformation; + ULONG_PTR OriginalBase; + LARGE_INTEGER LoadTime; +} LDR_DATA_TABLE_ENTRY_7, *PLDR_DATA_TABLE_ENTRY_7, LDR_MODULE_7, *PLDR_MODULE_7; + +typedef +VOID +(NTAPI *PPS_POST_PROCESS_INIT_ROUTINE) ( + VOID + ); + +typedef struct _PEB_FREE_BLOCK +{ + struct _PEB_FREE_BLOCK* Next; + ULONG Size; +} PEB_FREE_BLOCK; + +typedef struct PEB_LDR_DATA *PPEB_LDR_DATA; + +typedef void (NTAPI *PIO_APC_ROUTINE)(PVOID, PIO_STATUS_BLOCK, ULONG); + +#define RTL_MAX_DRIVE_LETTERS 32 +#define RTL_DRIVE_LETTER_VALID (USHORT)0x0001 + +typedef struct _RTL_USER_PROCESS_PARAMETERS +{ + ULONG MaximumLength; + ULONG Length; + + ULONG Flags; + ULONG DebugFlags; + + HANDLE ConsoleHandle; + ULONG ConsoleFlags; + HANDLE StandardInput; + HANDLE StandardOutput; + HANDLE StandardError; + + CURDIR CurrentDirectory; + UNICODE_STRING DllPath; + UNICODE_STRING ImagePathName; + UNICODE_STRING CommandLine; + PVOID Environment; + + ULONG StartingX; + ULONG StartingY; + ULONG CountX; + ULONG CountY; + ULONG CountCharsX; + ULONG CountCharsY; + ULONG FillAttribute; + + ULONG WindowFlags; + ULONG ShowWindowFlags; + UNICODE_STRING WindowTitle; + UNICODE_STRING DesktopInfo; + UNICODE_STRING ShellInfo; + UNICODE_STRING RuntimeData; + RTL_DRIVE_LETTER_CURDIR CurrentDirectories[RTL_MAX_DRIVE_LETTERS]; + + ULONG EnvironmentSize; + ULONG EnvironmentVersion; + PVOID PackageDependencyData; + ULONG ProcessGroupId; + ULONG LoaderThreads; +} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS; + +typedef struct _RTL_CRITICAL_SECTION *PRTL_CRITICAL_SECTION; +typedef struct PEB_LDR_DATA *PPEB_LDR_DATA; + +// symbols +typedef struct _PEB +{ + BOOLEAN InheritedAddressSpace; + BOOLEAN ReadImageFileExecOptions; + BOOLEAN BeingDebugged; + union + { + BOOLEAN BitField; + struct + { + BOOLEAN ImageUsesLargePages : 1; + BOOLEAN IsProtectedProcess : 1; + BOOLEAN IsImageDynamicallyRelocated : 1; + BOOLEAN SkipPatchingUser32Forwarders : 1; + BOOLEAN IsPackagedProcess : 1; + BOOLEAN IsAppContainer : 1; + BOOLEAN IsProtectedProcessLight : 1; + BOOLEAN IsLongPathAwareProcess : 1; + }; + }; + + HANDLE Mutant; + + PVOID ImageBaseAddress; + PPEB_LDR_DATA Ldr; + PRTL_USER_PROCESS_PARAMETERS ProcessParameters; + PVOID SubSystemData; + PVOID ProcessHeap; + PRTL_CRITICAL_SECTION FastPebLock; + PVOID AtlThunkSListPtr; + PVOID IFEOKey; + union + { + ULONG CrossProcessFlags; + struct + { + ULONG ProcessInJob : 1; + ULONG ProcessInitializing : 1; + ULONG ProcessUsingVEH : 1; + ULONG ProcessUsingVCH : 1; + ULONG ProcessUsingFTH : 1; + ULONG ReservedBits0 : 27; + }; + }; + union + { + PVOID KernelCallbackTable; + PVOID UserSharedInfoPtr; + }; + ULONG SystemReserved[1]; + ULONG AtlThunkSListPtr32; + PVOID ApiSetMap; + ULONG TlsExpansionCounter; + PVOID TlsBitmap; + ULONG TlsBitmapBits[2]; + PVOID ReadOnlySharedMemoryBase; + PVOID HotpatchInformation; + PVOID *ReadOnlyStaticServerData; + PVOID AnsiCodePageData; + PVOID OemCodePageData; + PVOID UnicodeCaseTableData; + + ULONG NumberOfProcessors; + ULONG NtGlobalFlag; + + LARGE_INTEGER CriticalSectionTimeout; + SIZE_T HeapSegmentReserve; + SIZE_T HeapSegmentCommit; + SIZE_T HeapDeCommitTotalFreeThreshold; + SIZE_T HeapDeCommitFreeBlockThreshold; + + ULONG NumberOfHeaps; + ULONG MaximumNumberOfHeaps; + PVOID *ProcessHeaps; + + PVOID GdiSharedHandleTable; + PVOID ProcessStarterHelper; + ULONG GdiDCAttributeList; + + PRTL_CRITICAL_SECTION LoaderLock; + + ULONG OSMajorVersion; + ULONG OSMinorVersion; + USHORT OSBuildNumber; + USHORT OSCSDVersion; + ULONG OSPlatformId; + ULONG ImageSubsystem; + ULONG ImageSubsystemMajorVersion; + ULONG ImageSubsystemMinorVersion; + ULONG_PTR ActiveProcessAffinityMask; +#ifdef _AMD64_ + ULONG GdiHandleBuffer[60]; +#else + ULONG GdiHandleBuffer[34]; +#endif + PVOID PostProcessInitRoutine; + + PVOID TlsExpansionBitmap; + ULONG TlsExpansionBitmapBits[32]; + + ULONG SessionId; + + ULARGE_INTEGER AppCompatFlags; + ULARGE_INTEGER AppCompatFlagsUser; + PVOID pShimData; + PVOID AppCompatInfo; + + UNICODE_STRING CSDVersion; + + PVOID ActivationContextData; + PVOID ProcessAssemblyStorageMap; + PVOID SystemDefaultActivationContextData; + PVOID SystemAssemblyStorageMap; + + SIZE_T MinimumStackCommit; + + PVOID *FlsCallback; + LIST_ENTRY FlsListHead; + PVOID FlsBitmap; + ULONG FlsBitmapBits[FLS_MAXIMUM_AVAILABLE / (sizeof(ULONG) * 8)]; + ULONG FlsHighIndex; + + PVOID WerRegistrationData; + PVOID WerShipAssertPtr; + PVOID pContextData; + PVOID pImageHeaderHash; + union + { + ULONG TracingFlags; + struct + { + ULONG HeapTracingEnabled : 1; + ULONG CritSecTracingEnabled : 1; + ULONG LibLoaderTracingEnabled : 1; + ULONG SpareTracingBits : 29; + }; + }; + ULONGLONG CsrServerReadOnlySharedMemoryBase; + PVOID TppWorkerpListLock; + LIST_ENTRY TppWorkerpList; + PVOID WaitOnAddressHashTable[128]; +} PEB, *PPEB; + +typedef +_Function_class_(RTL_HEAP_COMMIT_ROUTINE) +_IRQL_requires_same_ +NTSTATUS +NTAPI +RTL_HEAP_COMMIT_ROUTINE( + _In_ PVOID Base, + _Inout_ PVOID *CommitAddress, + _Inout_ PSIZE_T CommitSize + ); +typedef RTL_HEAP_COMMIT_ROUTINE *PRTL_HEAP_COMMIT_ROUTINE; + +typedef struct _RTL_HEAP_PARAMETERS { + ULONG Length; + SIZE_T SegmentReserve; + SIZE_T SegmentCommit; + SIZE_T DeCommitFreeBlockThreshold; + SIZE_T DeCommitTotalFreeThreshold; + SIZE_T MaximumAllocationSize; + SIZE_T VirtualMemoryThreshold; + SIZE_T InitialCommit; + SIZE_T InitialReserve; + PRTL_HEAP_COMMIT_ROUTINE CommitRoutine; + SIZE_T Reserved[ 2 ]; +} RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS; + + +typedef enum _LPC_TYPE { + LPC_NEW_MESSAGE, // A new message + LPC_REQUEST, // A request message + LPC_REPLY, // A reply to a request message + LPC_DATAGRAM, // + LPC_LOST_REPLY, // + LPC_PORT_CLOSED, // Sent when port is deleted + LPC_CLIENT_DIED, // Messages to thread termination ports + LPC_EXCEPTION, // Messages to thread exception port + LPC_DEBUG_EVENT, // Messages to thread debug port + LPC_ERROR_EVENT, // Used by ZwRaiseHardError + LPC_CONNECTION_REQUEST // Used by ZwConnectPort +} LPC_TYPE; + +typedef struct _PORT_MESSAGE +{ + union { + struct { + SHORT DataLength; + SHORT TotalLength; + } s1; + ULONG Length; + } u1; + union { + struct { + SHORT Type; + SHORT DataInfoOffset; + } s2; + ULONG ZeroInit; + } u2; + union { + CLIENT_ID ClientId; + double DoNotUseThisField; // Force quadword alignment + } DUMMYUNIONNAME3; + ULONG MessageId; + union { + SIZE_T ClientViewSize; // Only valid on LPC_CONNECTION_REQUEST message + ULONG CallbackId; // Only valid on LPC_REQUEST message + } DUMMYUNIONNAME4; + // UCHAR Data[]; +} PORT_MESSAGE, *PPORT_MESSAGE; + +typedef struct _DEBUG_MESSAGE { + PORT_MESSAGE PortMessage; + ULONG EventCode; + ULONG Status; + union { + struct { + EXCEPTION_RECORD ExceptionRecord; + ULONG FirstChance; + } Exception; + struct { + ULONG Reserved; + PVOID StartAddress; + } CreateThread; + struct { + ULONG Reserved; + HANDLE FileHandle; + PVOID Base; + ULONG PointerToSymbolTable; + ULONG NumberOfSymbols; + ULONG Reserved2; + PVOID EntryPoint; + } CreateProcess; + struct { + ULONG ExitCode; + } ExitThread; + struct { + ULONG ExitCode; + } ExitProcess; + struct { + HANDLE FileHandle; + PVOID Base; + ULONG PointerToSymbolTable; + ULONG NumberOfSymbols; + } LoadDll; + struct { + PVOID Base; + } UnloadDll; + struct { + LPSTR lpDebugStringData; + WORD fUnicode; + WORD nDebugStringLength; + } OutputDebugStringInfo; + struct + { + DWORD dwError; + DWORD dwType; + }RipInfo; + } u; +} DEBUG_MESSAGE, *PDEBUG_MESSAGE; + +typedef enum _FILE_INFORMATION_CLASS +{ + FileDirectoryInformation = 1, + FileFullDirectoryInformation, // 2 + FileBothDirectoryInformation, // 3 + FileBasicInformation, // 4 + FileStandardInformation, // 5 + FileInternalInformation, // 6 + FileEaInformation, // 7 + FileAccessInformation, // 8 + FileNameInformation, // 9 + FileRenameInformation, // 10 + FileLinkInformation, // 11 + FileNamesInformation, // 12 + FileDispositionInformation, // 13 + FilePositionInformation, // 14 + FileFullEaInformation, // 15 + FileModeInformation, // 16 + FileAlignmentInformation, // 17 + FileAllInformation, // 18 + FileAllocationInformation, // 19 + FileEndOfFileInformation, // 20 + FileAlternateNameInformation, // 21 + FileStreamInformation, // 22 + FilePipeInformation, // 23 + FilePipeLocalInformation, // 24 + FilePipeRemoteInformation, // 25 + FileMailslotQueryInformation, // 26 + FileMailslotSetInformation, // 27 + FileCompressionInformation, // 28 + FileObjectIdInformation, // 29 + FileCompletionInformation, // 30 + FileMoveClusterInformation, // 31 + FileQuotaInformation, // 32 + FileReparsePointInformation, // 33 + FileNetworkOpenInformation, // 34 + FileAttributeTagInformation, // 35 + FileTrackingInformation, // 36 + FileIdBothDirectoryInformation, // 37 + FileIdFullDirectoryInformation, // 38 + FileValidDataLengthInformation, // 39 + FileShortNameInformation, // 40 + FileIoCompletionNotificationInformation, // 41 + FileIoStatusBlockRangeInformation, // 42 + FileIoPriorityHintInformation, // 43 + FileSfioReserveInformation, // 44 + FileSfioVolumeInformation, // 45 + FileHardLinkInformation, // 46 + FileProcessIdsUsingFileInformation, // 47 + FileNormalizedNameInformation, // 48 + FileNetworkPhysicalNameInformation, // 49 + FileIdGlobalTxDirectoryInformation, // 50 + FileIsRemoteDeviceInformation, // 51 + FileUnusedInformation, // 52 + FileNumaNodeInformation, // 53 + FileStandardLinkInformation, // 54 + FileRemoteProtocolInformation, // 55 + + // + // These are special versions of these operations (defined earlier) + // which can be used by kernel mode drivers only to bypass security + // access checks for Rename and HardLink operations. These operations + // are only recognized by the IOManager, a file system should never + // receive these. + // + FileRenameInformationBypassAccessCheck, // 56 + FileLinkInformationBypassAccessCheck, // 57 + FileVolumeNameInformation, // 58 + FileIdInformation, // 59 + FileIdExtdDirectoryInformation, // 60 + FileReplaceCompletionInformation, // 61 + FileHardLinkFullIdInformation, // 62 + FileIdExtdBothDirectoryInformation, // 63 + FileMaximumInformation + +} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; + +typedef struct _FILE_ALIGNMENT_INFORMATION { + ULONG AlignmentRequirement; +} FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION; + +typedef struct _FILE_NAME_INFORMATION { + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; + +typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION { + ULONG FileAttributes; + ULONG ReparseTag; +} FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION; + + +typedef struct _FILE_END_OF_FILE_INFORMATION { + LARGE_INTEGER EndOfFile; +} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; + +typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION { + LARGE_INTEGER ValidDataLength; +} FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION; + +typedef struct _FILE_BASIC_INFORMATION { + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + ULONG FileAttributes; +} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; + + +typedef struct _FILE_POSITION_INFORMATION { + LARGE_INTEGER CurrentByteOffset; +} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION; + +typedef struct _FILE_NETWORK_OPEN_INFORMATION { + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER AllocationSize; + LARGE_INTEGER EndOfFile; + ULONG FileAttributes; +} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION; + +typedef struct _FILE_FULL_EA_INFORMATION { + ULONG NextEntryOffset; + UCHAR Flags; + UCHAR EaNameLength; + USHORT EaValueLength; + CHAR EaName[1]; +} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION; + +// +// Support to reserve bandwidth for a file handle. +// + +typedef struct _FILE_SFIO_RESERVE_INFORMATION { + ULONG RequestsPerPeriod; + ULONG Period; + BOOLEAN RetryFailures; + BOOLEAN Discardable; + ULONG RequestSize; + ULONG NumOutstandingRequests; +} FILE_SFIO_RESERVE_INFORMATION, *PFILE_SFIO_RESERVE_INFORMATION; + +// +// Support to query bandwidth properties of a volume. +// + +typedef struct _FILE_SFIO_VOLUME_INFORMATION { + ULONG MaximumRequestsPerPeriod; + ULONG MinimumPeriod; + ULONG MinimumTransferSize; +} FILE_SFIO_VOLUME_INFORMATION, *PFILE_SFIO_VOLUME_INFORMATION; + +typedef struct _FILE_EA_INFORMATION { + ULONG EaSize; +} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION; + +typedef struct _FILE_ACCESS_INFORMATION { + ACCESS_MASK AccessFlags; +} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION; + +typedef struct _FILE_MODE_INFORMATION { + ULONG Mode; +} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION; + +typedef struct _FILE_STANDARD_INFORMATION +{ + LARGE_INTEGER AllocationSize; + LARGE_INTEGER EndOfFile; + ULONG NumberOfLinks; + BOOLEAN DeletePending; + BOOLEAN Directory; +} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; + +typedef struct _FILE_FULL_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + WCHAR FileName[1]; +} FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION; + +typedef struct _FILE_BOTH_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + CCHAR ShortNameLength; + WCHAR ShortName[12]; + WCHAR FileName[1]; +} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION; + +typedef struct _FILE_INTERNAL_INFORMATION { + LARGE_INTEGER IndexNumber; +} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION; + +typedef struct _FILE_ALL_INFORMATION { + FILE_BASIC_INFORMATION BasicInformation; + FILE_STANDARD_INFORMATION StandardInformation; + FILE_INTERNAL_INFORMATION InternalInformation; + FILE_EA_INFORMATION EaInformation; + FILE_ACCESS_INFORMATION AccessInformation; + FILE_POSITION_INFORMATION PositionInformation; + FILE_MODE_INFORMATION ModeInformation; + FILE_ALIGNMENT_INFORMATION AlignmentInformation; + FILE_NAME_INFORMATION NameInformation; +} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION; + +typedef struct _FILE_ALLOCATION_INFORMATION { + LARGE_INTEGER AllocationSize; +} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION; + +typedef struct _FILE_COMPRESSION_INFORMATION { + LARGE_INTEGER CompressedFileSize; + USHORT CompressionFormat; + UCHAR CompressionUnitShift; + UCHAR ChunkShift; + UCHAR ClusterShift; + UCHAR Reserved[3]; +} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION; + + + +typedef struct _FILE_ID_FULL_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + LARGE_INTEGER FileId; + WCHAR FileName[1]; +} FILE_ID_FULL_DIR_INFORMATION, *PFILE_ID_FULL_DIR_INFORMATION; + + +typedef struct _FILE_ID_BOTH_DIR_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + ULONG EaSize; + CCHAR ShortNameLength; + WCHAR ShortName[12]; + LARGE_INTEGER FileId; + WCHAR FileName[1]; +} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION; + + + +typedef struct _FILE_DISPOSITION_INFORMATION +{ + BOOLEAN NeedDeleteFile; +} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; +//#pragma pack(pop) + + +typedef struct _FILE_DIRECTORY_INFORMATION { + ULONG NextEntryOffset; + ULONG FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + ULONG FileAttributes; + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION; + + +typedef struct _FILE_MOVE_CLUSTER_INFORMATION { + ULONG ClusterCount; + HANDLE RootDirectory; + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_MOVE_CLUSTER_INFORMATION, *PFILE_MOVE_CLUSTER_INFORMATION; + + +typedef struct _FILE_RENAME_INFORMATION +{ + BOOLEAN ReplaceIfExists; + HANDLE RootDirectory; + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION, FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION; + +typedef struct _FILE_STREAM_INFORMATION { + ULONG NextEntryOffset; + ULONG StreamNameLength; + LARGE_INTEGER StreamSize; + LARGE_INTEGER StreamAllocationSize; + WCHAR StreamName[1]; +} FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION; + +typedef struct _FILE_TRACKING_INFORMATION { + HANDLE DestinationFile; + ULONG ObjectInformationLength; + CHAR ObjectInformation[1]; +} FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION; + +typedef struct _FILE_COMPLETION_INFORMATION { + HANDLE Port; + PVOID Key; +} FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION; + +typedef struct _FILE_PIPE_INFORMATION { + ULONG ReadMode; + ULONG CompletionMode; +} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION; + +typedef struct _FILE_PIPE_LOCAL_INFORMATION { + ULONG NamedPipeType; + ULONG NamedPipeConfiguration; + ULONG MaximumInstances; + ULONG CurrentInstances; + ULONG InboundQuota; + ULONG ReadDataAvailable; + ULONG OutboundQuota; + ULONG WriteQuotaAvailable; + ULONG NamedPipeState; + ULONG NamedPipeEnd; +} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; + +typedef struct _FILE_PIPE_REMOTE_INFORMATION { + LARGE_INTEGER CollectDataTime; + ULONG MaximumCollectionCount; +} FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION; + +typedef struct _FILE_MAILSLOT_QUERY_INFORMATION { + ULONG MaximumMessageSize; + ULONG MailslotQuota; + ULONG NextMessageSize; + ULONG MessagesAvailable; + LARGE_INTEGER ReadTimeout; +} FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION; + +typedef struct _FILE_MAILSLOT_SET_INFORMATION { + PLARGE_INTEGER ReadTimeout; +} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION; + +typedef struct _FILE_REPARSE_POINT_INFORMATION { + LONGLONG FileReference; + ULONG Tag; +} FILE_REPARSE_POINT_INFORMATION, *PFILE_REPARSE_POINT_INFORMATION; + +typedef struct _FILE_LINK_ENTRY_INFORMATION { + ULONG NextEntryOffset; + LONGLONG ParentFileId; + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_LINK_ENTRY_INFORMATION, *PFILE_LINK_ENTRY_INFORMATION; + +typedef struct _FILE_LINKS_INFORMATION { + ULONG BytesNeeded; + ULONG EntriesReturned; + FILE_LINK_ENTRY_INFORMATION Entry; +} FILE_LINKS_INFORMATION, *PFILE_LINKS_INFORMATION; + +typedef struct _FILE_NETWORK_PHYSICAL_NAME_INFORMATION { + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_NETWORK_PHYSICAL_NAME_INFORMATION, *PFILE_NETWORK_PHYSICAL_NAME_INFORMATION; + + +enum SYSTEM_INFORMATION_CLASS +{ + //SystemCurrentEntryIdentifier= 0x5A, + //SystemBootPartition=0x62, //UNICODE_STRING + SystemBasicInformation = 0x0, + SystemProcessorInformation = 0x1, + SystemPerformanceInformation = 0x2, + SystemTimeOfDayInformation = 0x3, + SystemPathInformation = 0x4, // Obsolete: Use KUSER_SHARED_DATA + SystemProcessInformation = 0x5, + SystemCallCountInformation = 0x6, + SystemDeviceInformation = 0x7, + SystemProcessorPerformanceInformation = 0x8, + SystemFlagsInformation = 0x9, + SystemCallTimeInformation = 0xa, + SystemModuleInformation = 0xb, + SystemLocksInformation = 0xc, + SystemStackTraceInformation = 0xd, + SystemPagedPoolInformation = 0xe, + SystemNonPagedPoolInformation = 0xf, + SystemHandleInformation = 0x10, + SystemObjectInformation = 0x11, + SystemPageFileInformation = 0x12, + SystemVdmInstemulInformation = 0x13, + SystemVdmBopInformation = 0x14, + SystemFileCacheInformation = 0x15, + SystemPoolTagInformation = 0x16, + SystemInterruptInformation = 0x17, + SystemDpcBehaviorInformation = 0x18, + SystemFullMemoryInformation = 0x19, + SystemLoadGdiDriverInformation = 0x1a, + SystemUnloadGdiDriverInformation = 0x1b, + SystemTimeAdjustmentInformation = 0x1c, + SystemSummaryMemoryInformation = 0x1d, + SystemMirrorMemoryInformation = 0x1e, + SystemPerformanceTraceInformation = 0x1f, + SystemObsolete0 = 0x20, + SystemExceptionInformation = 0x21, + SystemCrashDumpStateInformation = 0x22, + SystemKernelDebuggerInformation = 0x23, + SystemContextSwitchInformation = 0x24, + SystemRegistryQuotaInformation = 0x25, + SystemExtendServiceTableInformation = 0x26, + SystemPrioritySeperation = 0x27, + SystemVerifierAddDriverInformation = 0x28, + SystemVerifierRemoveDriverInformation = 0x29, + SystemProcessorIdleInformation = 0x2a, + SystemLegacyDriverInformation = 0x2b, + SystemCurrentTimeZoneInformation = 0x2c, + SystemLookasideInformation = 0x2d, + SystemTimeSlipNotification = 0x2e, + SystemSessionCreate = 0x2f, + SystemSessionDetach = 0x30, + SystemSessionInformation = 0x31, + SystemRangeStartInformation = 0x32, + SystemVerifierInformation = 0x33, + SystemVerifierThunkExtend = 0x34, + SystemSessionProcessInformation = 0x35, + SystemLoadGdiDriverInSystemSpace = 0x36, + SystemNumaProcessorMap = 0x37, + SystemPrefetcherInformation = 0x38, + SystemExtendedProcessInformation = 0x39, + SystemRecommendedSharedDataAlignment = 0x3a, + SystemComPlusPackage = 0x3b, + SystemNumaAvailableMemory = 0x3c, + SystemProcessorPowerInformation = 0x3d, + SystemEmulationBasicInformation = 0x3e, + SystemEmulationProcessorInformation = 0x3f, + SystemExtendedHandleInformation = 0x40, + SystemLostDelayedWriteInformation = 0x41, + SystemBigPoolInformation = 0x42, + SystemSessionPoolTagInformation = 0x43, + SystemSessionMappedViewInformation = 0x44, + SystemHotpatchInformation = 0x45, + SystemObjectSecurityMode = 0x46, + SystemWatchdogTimerHandler = 0x47, + SystemWatchdogTimerInformation = 0x48, + SystemLogicalProcessorInformation = 0x49, + SystemWow64SharedInformationObsolete = 0x4a, + SystemRegisterFirmwareTableInformationHandler = 0x4b, + SystemFirmwareTableInformation = 0x4c, + SystemModuleInformationEx = 0x4d, + SystemVerifierTriageInformation = 0x4e, + SystemSuperfetchInformation = 0x4f, + SystemMemoryListInformation = 0x50, + SystemFileCacheInformationEx = 0x51, + SystemThreadPriorityClientIdInformation = 0x52, + SystemProcessorIdleCycleTimeInformation = 0x53, + SystemVerifierCancellationInformation = 0x54, + SystemProcessorPowerInformationEx = 0x55, + SystemRefTraceInformation = 0x56, + SystemSpecialPoolInformation = 0x57, + SystemProcessIdInformation = 0x58, + SystemErrorPortInformation = 0x59, + SystemBootEnvironmentInformation = 0x5a, //ϵͳϢ + SystemHypervisorInformation = 0x5b, + SystemVerifierInformationEx = 0x5c, + SystemTimeZoneInformation = 0x5d, + SystemImageFileExecutionOptionsInformation = 0x5e, + SystemCoverageInformation = 0x5f, + SystemPrefetchPatchInformation = 0x60, + SystemVerifierFaultsInformation = 0x61, + MaxSystemInfoClassWinXP, //WinXPֵ֧˴ + SystemSystemPartitionInformation = 0x62, //ڻȡϵͳϢṹΪUNICODE_STRING + SystemSystemDiskInformation = 0x63, + SystemProcessorPerformanceDistribution = 0x64, + SystemNumaProximityNodeInformation = 0x65, + SystemDynamicTimeZoneInformation = 0x66, + SystemCodeIntegrityInformation = 0x67, + SystemProcessorMicrocodeUpdateInformation = 0x68, + SystemProcessorBrandString = 0x69, + SystemVirtualAddressInformation = 0x6a, + SystemLogicalProcessorAndGroupInformation = 0x6b, + SystemProcessorCycleTimeInformation = 0x6c, + SystemStoreInformation = 0x6d, + SystemRegistryAppendString = 0x6e, + SystemAitSamplingValue = 0x6f, + SystemVhdBootInformation = 0x70, + SystemCpuQuotaInformation = 0x71, + SystemNativeBasicInformation = 0x72, + SystemErrorPortTimeouts = 0x73, + SystemLowPriorityIoInformation = 0x74, + SystemBootEntropyInformation = 0x75, + SystemVerifierCountersInformation = 0x76, + SystemPagedPoolInformationEx = 0x77, + SystemSystemPtesInformationEx = 0x78, + SystemNodeDistanceInformation = 0x79, + SystemAcpiAuditInformation = 0x7a, + SystemBasicPerformanceInformation = 0x7b, + SystemQueryPerformanceCounterInformation = 0x7c, + SystemSessionBigPoolInformation = 0x7d, + SystemBootGraphicsInformation = 0x7e, + SystemScrubPhysicalMemoryInformation = 0x7f, + SystemBadPageInformation = 0x80, + SystemProcessorProfileControlArea = 0x81, + SystemCombinePhysicalMemoryInformation = 0x82, + SystemEntropyInterruptTimingInformation = 0x83, + SystemConsoleInformation = 0x84, + SystemPlatformBinaryInformation = 0x85, + SystemThrottleNotificationInformation = 0x86, + SystemHypervisorProcessorCountInformation = 0x87, + SystemDeviceDataInformation = 0x88, + SystemDeviceDataEnumerationInformation = 0x89, + SystemMemoryTopologyInformation = 0x8a, + SystemMemoryChannelInformation = 0x8b, + SystemBootLogoInformation = 0x8c, + SystemProcessorPerformanceInformationEx = 0x8d, + SystemSpare0 = 0x8e, + SystemSecureBootPolicyInformation = 0x8f, + SystemPageFileInformationEx = 0x90, + SystemSecureBootInformation = 0x91, + SystemEntropyInterruptTimingRawInformation = 0x92, + SystemPortableWorkspaceEfiLauncherInformation = 0x93, + SystemFullProcessInformation = 0x94, + SystemKernelDebuggerInformationEx = 0x95, + SystemBootMetadataInformation = 0x96, + SystemSoftRebootInformation = 0x97, + SystemElamCertificateInformation = 0x98, + SystemOfflineDumpConfigInformation = 0x99, + SystemProcessorFeaturesInformation = 0x9a, + SystemRegistryReconciliationInformation = 0x9b, + MaxSystemInfoClassWindows9= 0x9c, + SystemKernelVaShadowInformation = 0x00C4, + SystemSpeculationControlInformation = 0x00C9, + MaxSystemInfoClass, +}; + +typedef struct _SYSTEM_SPECULATION_CONTROL_INFORMATION +{ + struct + { + ULONG BpbEnabled : 1; + ULONG BpbDisabledSystemPolicy : 1; + ULONG BpbDisabledNoHardwareSupport : 1; + ULONG SpecCtrlEnumerated : 1; + ULONG SpecCmdEnumerated : 1; + ULONG IbrsPresent : 1; + ULONG StibpPresent : 1; + ULONG SmepPresent : 1; + ULONG Reserved : 24; + } SpeculationControlFlags; +} SYSTEM_SPECULATION_CONTROL_INFORMATION, *PSYSTEM_SPECULATION_CONTROL_INFORMATION; + +typedef struct _SYSTEM_KERNEL_VA_SHADOW_INFORMATION +{ + struct + { + ULONG KvaShadowEnabled : 1; + ULONG KvaShadowUserGlobal : 1; + ULONG KvaShadowPcid : 1; + ULONG KvaShadowInvpcid : 1; + ULONG Reserved : 28; + } KvaShadowFlags; +} SYSTEM_KERNEL_VA_SHADOW_INFORMATION, *PSYSTEM_KERNEL_VA_SHADOW_INFORMATION; + + +struct SYSTEM_BOOT_ENVIRONMENT_INFORMATION +{ + GUID CurrentEntryIdentifier; + FIRMWARE_TYPE FirmwareType; + DWORD Unknow[10]; +}; + + +typedef struct _RTL_BUFFER { + PUCHAR Buffer; + PUCHAR StaticBuffer; + SIZE_T Size; + SIZE_T StaticSize; + SIZE_T ReservedForAllocatedSize; // for future doubling + PVOID ReservedForIMalloc; // for future pluggable growth +} RTL_BUFFER, *PRTL_BUFFER; + +struct _RTL_UNICODE_STRING_BUFFER; + +typedef struct _RTL_UNICODE_STRING_BUFFER { + UNICODE_STRING String; + RTL_BUFFER ByteBuffer; + UCHAR MinimumStaticBufferForTerminalNul[sizeof(WCHAR)]; +} RTL_UNICODE_STRING_BUFFER, *PRTL_UNICODE_STRING_BUFFER; + + +typedef struct _FILE_FS_OBJECTID_INFORMATION { + UCHAR ObjectId[16]; + UCHAR ExtendedInfo[48]; +} FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION; + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtCreateFile( + _Out_ PHANDLE FileHandle, + _In_ ACCESS_MASK DesiredAccess, + _In_ POBJECT_ATTRIBUTES ObjectAttributes, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _In_opt_ PLARGE_INTEGER AllocationSize, + _In_ ULONG FileAttributes, + _In_ ULONG ShareAccess, + _In_ ULONG CreateDisposition, + _In_ ULONG CreateOptions, + _In_opt_ PVOID EaBuffer, + _In_ ULONG EaLength + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI ZwCreateFile( + _Out_ PHANDLE FileHandle, + _In_ ACCESS_MASK DesiredAccess, + _In_ POBJECT_ATTRIBUTES ObjectAttributes, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _In_opt_ PLARGE_INTEGER AllocationSize, + _In_ ULONG FileAttributes, + _In_ ULONG ShareAccess, + _In_ ULONG CreateDisposition, + _In_ ULONG CreateOptions, + _In_ PVOID EaBuffer, + _In_ ULONG EaLength + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI ZwQueryDirectoryFile( + _In_ HANDLE FileHandle, + _In_opt_ HANDLE Event, + _In_opt_ PVOID ApcRoutine, + _In_opt_ PVOID ApcContext, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _Out_ PVOID FileInformation, + _In_ ULONG Length, + _In_ FILE_INFORMATION_CLASS FileInformationClass, + _In_ BOOLEAN ReturnSingleEntry, + _In_opt_ PUNICODE_STRING FileName, + _In_ BOOLEAN RestartScan + ); + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +__kernel_entry NTSYSCALLAPI +NTSTATUS +NTAPI +NtQueryDirectoryFile ( + _In_ HANDLE FileHandle, + _In_opt_ HANDLE Event, + _In_opt_ PIO_APC_ROUTINE ApcRoutine, + _In_opt_ PVOID ApcContext, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _Out_writes_bytes_(Length) PVOID FileInformation, + _In_ ULONG Length, + _In_ FILE_INFORMATION_CLASS FileInformationClass, + _In_ BOOLEAN ReturnSingleEntry, + _In_opt_ PUNICODE_STRING FileName, + _In_ BOOLEAN RestartScan + ); +#endif + + EXTERN_C + NTSYSAPI VOID NTAPI RtlInitUnicodeString( + _Out_ PUNICODE_STRING DestinationString, + _In_opt_ PCWSTR SourceString + ); + + EXTERN_C + NTSYSAPI VOID NTAPI RtlCopyUnicodeString( + _Inout_ PUNICODE_STRING DestinationString, + _In_opt_ PCUNICODE_STRING SourceString + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtLoadKey2( + IN POBJECT_ATTRIBUTES DestinationKeyName, + IN POBJECT_ATTRIBUTES HiveFileName, + IN ULONG Flags); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI RtlGetLastNtStatus(); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtOpenFile( + _Out_ PHANDLE FileHandle, + _In_ ACCESS_MASK DesiredAccess, + _In_ POBJECT_ATTRIBUTES ObjectAttributes, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _In_ ULONG ShareAccess, + _In_ ULONG OpenOptions + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtShutdownSystem(INT Type); + + + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI RtlGetVersion(PRTL_OSVERSIONINFOW lpVersionInformation); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtDeleteFile( + _In_ POBJECT_ATTRIBUTES ObjectAttributes + ); + + EXTERN_C + NTSYSAPI NTSTATUS WINAPI RtlCreateProcessParameters( + + OUT PRTL_USER_PROCESS_PARAMETERS *pProcessParameters, + + IN PUNICODE_STRING ImagePathName, + + IN PUNICODE_STRING DllPath OPTIONAL, + + IN PUNICODE_STRING CurrentDirectory OPTIONAL, + + IN PUNICODE_STRING CommandLine OPTIONAL, + + IN PVOID Environment OPTIONAL, + + IN PUNICODE_STRING WindowTitle OPTIONAL, + + IN PUNICODE_STRING DesktopInfo OPTIONAL, + + IN PUNICODE_STRING ShellInfo OPTIONAL, + + IN PUNICODE_STRING RuntimeData OPTIONAL + + ); + + EXTERN_C + NTSYSAPI NTSTATUS WINAPI ZwQuerySymbolicLinkObject( + _In_ HANDLE LinkHandle, + _Inout_ PUNICODE_STRING LinkTarget, + _Out_opt_ PULONG ReturnedLength + ); + + EXTERN_C + NTSYSAPI NTSTATUS WINAPI ZwOpenSymbolicLinkObject( + _Out_ PHANDLE LinkHandle, + _In_ ACCESS_MASK DesiredAccess, + _In_ POBJECT_ATTRIBUTES ObjectAttributes + ); + + EXTERN_C + NTSYSAPI NTSTATUS WINAPI ZwClose( + _In_ HANDLE Handle + ); + +#define RTL_NT_PATH_NAME_TO_DOS_PATH_NAME_AMBIGUOUS (0x00000001) +#define RTL_NT_PATH_NAME_TO_DOS_PATH_NAME_UNC (0x00000002) +#define RTL_NT_PATH_NAME_TO_DOS_PATH_NAME_DRIVE (0x00000003) +#define RTL_NT_PATH_NAME_TO_DOS_PATH_NAME_ALREADY_DOS (0x00000004) + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI RtlNtPathNameToDosPathName( + __in ULONG Flags, + __inout PRTL_UNICODE_STRING_BUFFER Path, + __out_opt PULONG Disposition, + __inout_opt PWSTR* FilePart); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI IoVolumeDeviceToDosName( + _In_ PVOID VolumeDeviceObject, + _Out_ PUNICODE_STRING DosName + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI RtlpEnsureBufferSize( + ULONG flags, + PRTL_BUFFER pBuffer, + SIZE_T requiredSize + ); + + enum OBJECT_INFORMATION_CLASS + { + ObjectBasicInformation, + ObjectNameInformation, + ObjectTypeInformation, + ObjectAllInformation, + ObjectDataInformation + + }; + + typedef struct _OBJECT_NAME_INFORMATION + { + UNICODE_STRING Name; + } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION; + + typedef struct __PUBLIC_OBJECT_TYPE_INFORMATION { + UNICODE_STRING TypeName; + ULONG Reserved[22]; // reserved for internal use + } PUBLIC_OBJECT_TYPE_INFORMATION, *PPUBLIC_OBJECT_TYPE_INFORMATION; + + typedef struct _OBJECT_TYPE_INFORMATION { + UNICODE_STRING TypeName; + ULONG TotalNumberOfHandles; + ULONG TotalNumberOfObjects; + UNICODE_STRING OtherName; + UNICODE_STRING OtherName2; + ULONG HighWaterNumberOfHandles; + ULONG HighWaterNumberOfObjects; + UNICODE_STRING OtherName3; + UNICODE_STRING OtherName4; + ACCESS_MASK InvalidAttributes; + GENERIC_MAPPING GenericMapping; + ACCESS_MASK ValidAttributes; + BOOLEAN SecurityRequired; + BOOLEAN MaintainHandleCount; + USHORT MaintainTypeList; + ULONG PoolType; + ULONG DefaultPagedPoolCharge; + ULONG DefaultNonPagedPoolCharge; + } OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION; + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtQueryObject( + _In_opt_ HANDLE Handle, + _In_ OBJECT_INFORMATION_CLASS ObjectInformationClass, + _Out_opt_ PVOID ObjectInformation, + _In_ ULONG ObjectInformationLength, + _Out_opt_ PULONG ReturnLength + ); + // + // These must be converted to LUIDs before use. + // + +#define SE_MIN_WELL_KNOWN_PRIVILEGE (2L) +#define SE_CREATE_TOKEN_PRIVILEGE (2L) +#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE (3L) +#define SE_LOCK_MEMORY_PRIVILEGE (4L) +#define SE_INCREASE_QUOTA_PRIVILEGE (5L) + +#define SE_MACHINE_ACCOUNT_PRIVILEGE (6L) +#define SE_TCB_PRIVILEGE (7L) +#define SE_SECURITY_PRIVILEGE (8L) +#define SE_TAKE_OWNERSHIP_PRIVILEGE (9L) +#define SE_LOAD_DRIVER_PRIVILEGE (10L) +#define SE_SYSTEM_PROFILE_PRIVILEGE (11L) +#define SE_SYSTEMTIME_PRIVILEGE (12L) +#define SE_PROF_SINGLE_PROCESS_PRIVILEGE (13L) +#define SE_INC_BASE_PRIORITY_PRIVILEGE (14L) +#define SE_CREATE_PAGEFILE_PRIVILEGE (15L) +#define SE_CREATE_PERMANENT_PRIVILEGE (16L) +#define SE_BACKUP_PRIVILEGE (17L) +#define SE_RESTORE_PRIVILEGE (18L) +#define SE_SHUTDOWN_PRIVILEGE (19L) +#define SE_DEBUG_PRIVILEGE (20L) +#define SE_AUDIT_PRIVILEGE (21L) +#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE (22L) +#define SE_CHANGE_NOTIFY_PRIVILEGE (23L) +#define SE_REMOTE_SHUTDOWN_PRIVILEGE (24L) +#define SE_UNDOCK_PRIVILEGE (25L) +#define SE_SYNC_AGENT_PRIVILEGE (26L) +#define SE_ENABLE_DELEGATION_PRIVILEGE (27L) +#define SE_MANAGE_VOLUME_PRIVILEGE (28L) +#define SE_IMPERSONATE_PRIVILEGE (29L) +#define SE_CREATE_GLOBAL_PRIVILEGE (30L) +#define SE_TRUSTED_CREDMAN_ACCESS_PRIVILEGE (31L) +#define SE_RELABEL_PRIVILEGE (32L) +#define SE_INC_WORKING_SET_PRIVILEGE (33L) +#define SE_TIME_ZONE_PRIVILEGE (34L) +#define SE_CREATE_SYMBOLIC_LINK_PRIVILEGE (35L) +#define SE_MAX_WELL_KNOWN_PRIVILEGE (SE_CREATE_SYMBOLIC_LINK_PRIVILEGE) + EXTERN_C NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(ULONG Privilege, BOOLEAN Enable, BOOLEAN CurrentThread, PBOOLEAN Enabled); + + + typedef enum _FSINFOCLASS { + FileFsVolumeInformation = 1, + FileFsLabelInformation, // 2 + FileFsSizeInformation, // 3 + FileFsDeviceInformation, // 4 + FileFsAttributeInformation, // 5 + FileFsControlInformation, // 6 + FileFsFullSizeInformation, // 7 + FileFsObjectIdInformation, // 8 + FileFsDriverPathInformation, // 9 + FileFsVolumeFlagsInformation,// 10 + FileFsSectorSizeInformation, // 11 + FileFsDataCopyInformation, // 12 + FileFsMaximumInformation + } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + ZwQueryVolumeInformationFile( + _In_ HANDLE FileHandle, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + PVOID FsInformation, + _In_ ULONG Length, + _In_ FS_INFORMATION_CLASS FsInformationClass + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtQueryVolumeInformationFile( + IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID FsInformation, + IN ULONG Length, + IN FS_INFORMATION_CLASS FsInformationClass + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtQueryFullAttributesFile( + IN POBJECT_ATTRIBUTES pObjAttrs, + IN OUT PFILE_NETWORK_OPEN_INFORMATION pNetInf + ); + + typedef enum _KEY_INFORMATION_CLASS { + KeyBasicInformation = 0, + KeyNodeInformation = 1, + KeyFullInformation = 2, + KeyNameInformation = 3, + KeyCachedInformation = 4, + KeyFlagsInformation = 5, + KeyVirtualizationInformation = 6, + KeyHandleTagsInformation = 7, + MaxKeyInfoClass = 8 + } KEY_INFORMATION_CLASS; + + + typedef struct _KEY_VIRTUALIZATION_INFORMATION { + ULONG VirtualizationCandidate: 1; + ULONG VirtualizationEnabled : 1; + ULONG VirtualTarget: 1; + ULONG VirtualStore: 1; + ULONG VirtualSource: 1; + ULONG Reserved: 27; + } KEY_VIRTUALIZATION_INFORMATION, *PKEY_VIRTUALIZATION_INFORMATION; + + EXTERN_C + NTSYSAPI + NTSTATUS NTAPI ZwQueryKey( + _In_ HANDLE KeyHandle, + _In_ KEY_INFORMATION_CLASS KeyInformationClass, + _Out_opt_ PVOID KeyInformation, + _In_ ULONG Length, + _Out_ PULONG ResultLength + ); + + + typedef struct _KEY_SET_VIRTUALIZATION_INFORMATION { + ULONG VirtualTarget : 1; // Tells if the key is a virtual target key. + ULONG VirtualStore : 1; // Tells if the key is a virtual store key. + ULONG VirtualSource : 1; // Tells if the key has been virtualized at least one (virtual hint) + ULONG Reserved : 29; + } KEY_SET_VIRTUALIZATION_INFORMATION, *PKEY_SET_VIRTUALIZATION_INFORMATION; + + typedef enum _KEY_SET_INFORMATION_CLASS { + KeyWriteTimeInformation, + KeyWow64FlagsInformation, + KeyControlFlagsInformation, + KeySetVirtualizationInformation, + KeySetDebugInformation, + KeySetHandleTagsInformation, + MaxKeySetInfoClass // MaxKeySetInfoClass should always be the last enum + } KEY_SET_INFORMATION_CLASS; + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + ZwSetInformationKey( + _In_ HANDLE KeyHandle, + _In_ __drv_strictTypeMatch(__drv_typeConst) + KEY_SET_INFORMATION_CLASS KeySetInformationClass, + _In_reads_bytes_(KeySetInformationLength) PVOID KeySetInformation, + _In_ ULONG KeySetInformationLength + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtSetInformationFile( + _In_ HANDLE FileHandle, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _In_ PVOID FileInformation, + _In_ ULONG Length, + _In_ FILE_INFORMATION_CLASS FileInformationClass); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile( + _In_ HANDLE FileHandle, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _Out_ PVOID FileInformation, + _In_ ULONG Length, + _In_ FILE_INFORMATION_CLASS FileInformationClass + ); + + typedef struct _FILE_FS_LABEL_INFORMATION { + ULONG VolumeLabelLength; + WCHAR VolumeLabel[1]; + } FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION; + + typedef struct _FILE_FS_VOLUME_INFORMATION { + LARGE_INTEGER VolumeCreationTime; + ULONG VolumeSerialNumber; + ULONG VolumeLabelLength; + BOOLEAN SupportsObjects; + WCHAR VolumeLabel[1]; + } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION; + + typedef struct _FILE_FS_SIZE_INFORMATION { + LARGE_INTEGER TotalAllocationUnits; + LARGE_INTEGER AvailableAllocationUnits; + ULONG SectorsPerAllocationUnit; + ULONG BytesPerSector; + } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION; + + typedef struct _FILE_FS_FULL_SIZE_INFORMATION { + LARGE_INTEGER TotalAllocationUnits; + LARGE_INTEGER CallerAvailableAllocationUnits; + LARGE_INTEGER ActualAvailableAllocationUnits; + ULONG SectorsPerAllocationUnit; + ULONG BytesPerSector; + } FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION; + + + typedef struct _FILE_FS_DEVICE_INFORMATION { + ULONG DeviceType; + ULONG Characteristics; + } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI RtlCompressBuffer( + _In_ USHORT CompressionFormatAndEngine,//COMPRESSION_FORMAT_NONE + _In_ PUCHAR UncompressedBuffer, + _In_ ULONG UncompressedBufferSize, + _Out_ PUCHAR CompressedBuffer, + _In_ ULONG CompressedBufferSize, + _In_ ULONG UncompressedChunkSize, + _Out_ PULONG FinalCompressedSize, + _In_ PVOID WorkSpace + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI RtlGetCompressionWorkSpaceSize( + _In_ USHORT CompressionFormatAndEngine, + _Out_ PULONG CompressBufferWorkSpaceSize, + _Out_ PULONG CompressFragmentWorkSpaceSize + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI RtlDecompressBuffer( + _In_ USHORT CompressionFormat, + _Out_ PUCHAR UncompressedBuffer, + _In_ ULONG UncompressedBufferSize, + _In_ PUCHAR CompressedBuffer, + _In_ ULONG CompressedBufferSize, + _Out_ PULONG FinalUncompressedSize + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtReadVirtualMemory( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + OUT PVOID Buffer, + IN SIZE_T BufferLength, + OUT PSIZE_T ReturnLength OPTIONAL); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtWriteVirtualMemory( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN PVOID Buffer, + IN SIZE_T NumberOfBytesToWrite, + OUT PSIZE_T NumberOfBytesWritten OPTIONAL); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtWow64ReadVirtualMemory64( + __in HANDLE ProcessHandle, + __in_opt PVOID64 BaseAddress, + __out_bcount(BufferSize) PVOID Buffer, + __in ULONGLONG BufferSize, + __out_opt PULONGLONG NumberOfBytesRead); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtWow64WriteVirtualMemory64( + __in HANDLE ProcessHandle, + __in_opt PVOID64 BaseAddress, + __in_bcount(BufferSize) PVOID Buffer, + __in ULONGLONG BufferSize, + __out_opt PULONGLONG NumberOfBytesWritten); + + typedef enum _PROCESSINFOCLASS + { + ProcessBasicInformation, + ProcessQuotaLimits, + ProcessIoCounters, + ProcessVmCounters, + ProcessTimes, + ProcessBasePriority, + ProcessRaisePriority, + ProcessDebugPort, + ProcessExceptionPort, + ProcessAccessToken, + ProcessLdtInformation, + ProcessLdtSize, + ProcessDefaultHardErrorMode, + ProcessIoPortHandlers, + ProcessPooledUsageAndLimits, + ProcessWorkingSetWatch, + ProcessUserModeIOPL, + ProcessEnableAlignmentFaultFixup, + ProcessPriorityClass, + ProcessWx86Information, + ProcessHandleCount, + ProcessAffinityMask, + ProcessPriorityBoost, + ProcessDeviceMap, + ProcessSessionInformation, + ProcessForegroundInformation, + ProcessWow64Information, + ProcessImageFileName, //ȡ̵NT·ṹΪUNICODE_STRING + ProcessLUIDDeviceMapsEnabled, + ProcessBreakOnTermination, + ProcessDebugObjectHandle, + ProcessDebugFlags, + ProcessHandleTracing, + ProcessIoPriority, + ProcessExecuteFlags, + ProcessTlsInformation, // invalid class + ProcessCookie, + MaxProcessInfoClassWinXP, + ProcessImageInformation = MaxProcessInfoClassWinXP, + ProcessCycleTime, + ProcessPagePriority, + ProcessInstrumentationCallback, + ProcessThreadStackAllocation, + ProcessWorkingSetWatchEx, + ProcessImageFileNameWin32, //ȡ̵Dos·ṹΪUNICODE_STRING + ProcessImageFileMapping, // buffer is a pointer to a file handle open with SYNCHRONIZE | FILE_EXECUTE access, return value is whether the handle is the same used to start the process + ProcessAffinityUpdateMode, + ProcessMemoryAllocationMode, + ProcessGroupInformation, + ProcessTokenVirtualizationEnabled, // invalid class + ProcessConsoleHostProcess, // retrieves the pid for the process' corresponding conhost process + ProcessWindowInformation, // returns the windowflags and windowtitle members of the process' peb->rtl_user_process_params + MaxProcessInfoClass + } PROCESSINFOCLASS; + + + struct WOW64_PROCESS_BASIC_INFORMATION + { + NTSTATUS ExitStatus; + PVOID64 PebBaseAddress; + KAFFINITY AffinityMask; + DWORD BasePriority; + HANDLE UniqueProcessId; + HANDLE InheritedFromUniqueProcessId; + + }; + + EXTERN_C + NTSYSAPI + NTSTATUS WINAPI NtQueryInformationProcess( + _In_ HANDLE ProcessHandle, + _In_ PROCESSINFOCLASS ProcessInformationClass, + _Out_ PVOID ProcessInformation, + _In_ ULONG ProcessInformationLength, + _Out_opt_ PULONG ReturnLength + ); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI + NtWow64QueryInformationProcess64( + __in HANDLE ProcessHandle, + __in PROCESSINFOCLASS ProcessInformationClass, + __out_bcount(ProcessInformationLength) PVOID ProcessInformation64, + __in ULONG ProcessInformationLength, + __out_opt PULONG ReturnLength + ); + + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI NtLoadKey2( IN POBJECT_ATTRIBUTES DestinationKeyName, IN POBJECT_ATTRIBUTES HiveFileName,IN ULONG Flags); + + typedef VOID(NTAPI * PLDR_CALLBACK)(PVOID CallbackContext, PCHAR Name); + + EXTERN_C + NTSYSAPI NTSTATUS NTAPI LdrVerifyImageMatchesChecksum(IN HANDLE FileHandle, + IN PLDR_CALLBACK Callback, + IN PVOID CallbackContext, + OUT PUSHORT ImageCharacteristics + ); + + EXTERN_C + NTSYSAPI PIMAGE_NT_HEADERS NTAPI RtlImageNtHeader(_In_ PVOID BaseAddress); + + EXTERN_C + NTSYSAPI PVOID NTAPI RtlImageRvaToVa(_In_ PIMAGE_NT_HEADERS NtHeader, + _In_ PVOID BaseAddress, + _In_ ULONG Rva, + _Inout_opt_ PIMAGE_SECTION_HEADER * SectionHeader); + + EXTERN_C + NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString( + OUT PUNICODE_STRING DestinationString, + IN PCWSTR SourceString + ); + +#define HASH_STRING_ALGORITHM_DEFAULT (0) +#define HASH_STRING_ALGORITHM_X65599 (1) +#define HASH_STRING_ALGORITHM_INVALID (0xffffffff) +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + RtlHashUnicodeString( + __in PCUNICODE_STRING String, + __in BOOLEAN CaseInSensitive, + __in ULONG HashAlgorithm, + __out PULONG HashValue + ); +#endif + + EXTERN_C + NTSYSAPI VOID NTAPI RtlRunDecodeUnicodeString(IN UCHAR Hash, IN OUT PUNICODE_STRING String); + + EXTERN_C + NTSYSAPI VOID NTAPI RtlRunEncodeUnicodeString(IN OUT PUCHAR Hash, IN OUT PUNICODE_STRING String); + + EXTERN_C + NTSYSAPI + ULONG + NTAPI + RtlGetFullPathName_U( + const WCHAR* name, + ULONG size, + WCHAR* buffer, + WCHAR** file_part + ); + + typedef enum _EVENT_TYPE { + NotificationEvent, + SynchronizationEvent + } EVENT_TYPE; + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtSetEvent( + IN HANDLE EventHandle, + OUT PLONG PreviousState OPTIONAL + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtCreateEvent( + OUT PHANDLE EventHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN EVENT_TYPE EventType, + IN BOOLEAN InitialState + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtWaitForSingleObject( + IN HANDLE Handle, + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Timeout OPTIONAL + ); + + //typedef VOID(CALLBACK*PIO_APC_ROUTINE)(VOID); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtWriteFile( + IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PVOID Buffer, + IN ULONG Length, + IN PLARGE_INTEGER ByteOffset OPTIONAL, + IN PULONG Key OPTIONAL + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtReadFile( + IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID Buffer, + IN ULONG Length, + IN PLARGE_INTEGER ByteOffset OPTIONAL, + IN PULONG Key OPTIONAL + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtTerminateThread( + IN HANDLE ThreadHandle, + IN NTSTATUS ExitStatus + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtAlertThread( + IN HANDLE ThreadHandle + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtResumeThread( + IN HANDLE ThreadHandle, + OUT PULONG SuspendCount OPTIONAL + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtTerminateProcess( + IN HANDLE ProcessHandle, + IN NTSTATUS ExitStatus + ); + + typedef enum _HARDERROR_RESPONSE_OPTION { + OptionAbortRetryIgnore, + OptionOk, + OptionOkCancel, + OptionRetryCancel, + OptionYesNo, + OptionYesNoCancel, + OptionShutdownSystem + } HARDERROR_RESPONSE_OPTION, *PHARDERROR_RESPONSE_OPTION; + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtRaiseHardError( + IN NTSTATUS ErrorStatus, + IN ULONG NumberOfParameters, + IN ULONG UnicodeStringParameterMask, + IN PULONG_PTR Parameters, + IN HARDERROR_RESPONSE_OPTION ValidResponseOptions, + OUT PHARDERROR_RESPONSE_OPTION Response + ); + + typedef enum _MEMORY_INFORMATION_CLASS + { + MemoryBasicInformation + } MEMORY_INFORMATION_CLASS, *PMEMORY_INFORMATION_CLASS; + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtQueryVirtualMemory( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN MEMORY_INFORMATION_CLASS MemoryInformationClass, + OUT PVOID Buffer, + IN ULONG Length, + OUT PULONG ResultLength OPTIONAL + ); + + typedef enum _MEMORY_MAP_TYPE + { + Map_Process = 1 + } MEMORY_MAP_TYPE, *PMEMORY_MAP_TYPE; + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtLockVirtualMemory( + IN HANDLE ProcessHandle, + IN OUT PVOID* BaseAddress, + IN PSIZE_T RegionSize, + IN MEMORY_MAP_TYPE MapType + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtAllocateVirtualMemory( + IN HANDLE ProcessHandle, + IN OUT PVOID *BaseAddress, + IN ULONG ZeroBits, + IN OUT PSIZE_T RegionSize, + IN ULONG AllocationType, + IN ULONG Protect + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtFreeVirtualMemory( + IN HANDLE ProcessHandle, + IN OUT PVOID *BaseAddress, + IN OUT PSIZE_T RegionSize, + IN ULONG FreeType + ); + + typedef VOID(NTAPI*PPS_APC_ROUTINE)(PVOID, PVOID, PVOID); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtQueueApcThread( + IN HANDLE ThreadHandle, + IN PPS_APC_ROUTINE ApcRoutine, + IN PVOID ApcArgument1, + IN PVOID ApcArgument2, + IN PVOID ApcArgument3 + ); + +#define NtCurrentProcess() ((HANDLE)(LONG_PTR) -1) +#define ZwCurrentProcess() NtCurrentProcess() +#define NtCurrentThread() ((HANDLE)(LONG_PTR) -2) +#define ZwCurrentThread() NtCurrentThread() + + EXTERN_C + NTSYSAPI + SIZE_T + NTAPI + RtlCompactHeap( + IN HANDLE hHeap, + IN ULONG flags + ); + + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlDestroyHeap( + IN HANDLE hHeap + ); + + EXTERN_C + NTSYSAPI + VOID + NTAPI + RtlEnterCriticalSection( + IN LPCRITICAL_SECTION pSection + ); + + EXTERN_C + NTSYSAPI + VOID + NTAPI + RtlLeaveCriticalSection( + IN LPCRITICAL_SECTION pSection + ); + + EXTERN_C + NTSYSAPI + VOID + NTAPI + RtlDeleteCriticalSection( + IN LPCRITICAL_SECTION pSection + ); + + EXTERN_C + NTSYSAPI + ULONG + NTAPI + RtlNtStatusToDosError( + IN NTSTATUS status + ); + + EXTERN_C + NTSYSAPI + VOID + NTAPI + RtlSetLastWin32Error( + IN ULONG error + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtClose( + IN HANDLE hObject + ); + + +#define DIRECTORY_QUERY (0x0001) +#define DIRECTORY_TRAVERSE (0x0002) +#define DIRECTORY_CREATE_OBJECT (0x0004) +#define DIRECTORY_CREATE_SUBDIRECTORY (0x0008) + +#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF) + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtCreateDirectoryObject( + OUT PHANDLE DirectoryHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtOpenDirectoryObject( + OUT PHANDLE DirectoryHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); + + typedef struct _OBJECT_DIRECTORY_INFORMATION + { + UNICODE_STRING Name; + UNICODE_STRING TypeName; + } OBJECT_DIRECTORY_INFORMATION, *POBJECT_DIRECTORY_INFORMATION; + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtQueryDirectoryObject( + HANDLE DirectoryHandle, + PVOID Buffer, + ULONG Length, + BOOLEAN ReturnSingleEntry, + BOOLEAN RestartScan, + PULONG Context, + PULONG ReturnLength + ); + + + EXTERN_C + NTSYSAPI + VOID + NTAPI + RtlInitAnsiString( + PANSI_STRING DestinationString, + PCSTR SourceString + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + RtlAnsiStringToUnicodeString( + IN OUT PUNICODE_STRING DestinationString, + IN PCANSI_STRING SourceString, + IN BOOLEAN AllocateDestinationString + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + RtlDestroyProcessParameters( + IN PPROCESS_PARAMETERS_VISTA ProcessParameters + ); + + EXTERN_C + NTSYSAPI + BOOLEAN + NTAPI + RtlDosPathNameToNtPathName_U( + IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *DosFilePath OPTIONAL, + OUT PUNICODE_STRING NtFilePath OPTIONAL + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + RtlDosPathNameToNtPathName_U_WithStatus( + IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *DosFilePath OPTIONAL, + OUT PUNICODE_STRING NtFilePath OPTIONAL + ); + + EXTERN_C + NTSYSAPI + BOOLEAN + NTAPI + RtlDosPathNameToRelativeNtPathName_U( + IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *DosFilePath OPTIONAL, + OUT PUNICODE_STRING NtFilePath OPTIONAL + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + RtlDosPathNameToRelativeNtPathName_U_WithStatus( + IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *DosFilePath OPTIONAL, + OUT PUNICODE_STRING NtFilePath OPTIONAL + ); + + enum RTL_PATH_TYPE + { + RtlPathTypeUnknown, + RtlPathTypeUncAbsolute, + RtlPathTypeDriveAbsolute, + RtlPathTypeDriveRelative, + RtlPathTypeRooted, + RtlPathTypeRelative, + RtlPathTypeLocalDevice, + RtlPathTypeRootLocalDevice, + }; + + EXTERN_C + NTSYSAPI + ULONG + NTAPI + RtlDetermineDosPathNameType_U( + IN PCWSTR Path + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + RtlInitUnicodeStringEx( + OUT PUNICODE_STRING DestinationString, + IN PCWSTR SourceString OPTIONAL + ); + + EXTERN_C + NTSYSAPI + VOID + NTAPI + RtlFreeUnicodeString( + PUNICODE_STRING UnicodeString + ); + + EXTERN_C + NTSYSAPI + PIMAGE_NT_HEADERS + NTAPI + RtlImageNtHeader( + __in PVOID baseAddress + ); + + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlImageDirectoryEntryToData( + __in PVOID pBaseAddress, + __in BOOLEAN bImageLoaded, + __in ULONG dwDirectory, + __out PULONG pSize + ); + + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlImageDirectoryEntryToDataEx( + __in PVOID pBaseAddress, + __in BOOLEAN bImageLoaded, + __in ULONG dwDirectory, + __out PULONG pSize, + __out_opt PIMAGE_SECTION_HEADER pSection + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtCreateProcess( + OUT PHANDLE ProcessHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN HANDLE InheritFromProcessHandle, + IN BOOLEAN InheritHandles, + IN HANDLE SectionHandle OPTIONAL, + IN HANDLE DebugPort OPTIONAL, + IN HANDLE ExceptionPort OPTIONAL + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtCreatePort( + OUT PHANDLE PortHandle, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN ULONG MaxDataSize, + IN ULONG MaxMessageSize, + IN ULONG Reserved + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtCreateWaitablePort( + OUT PHANDLE PortHandle, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN ULONG MaxDataSize, + IN ULONG MaxMessageSize, + IN ULONG Reserved + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtReplyWaitReceivePort( + IN HANDLE PortHandle, + OUT PULONG PortIdentifier OPTIONAL, + IN PPORT_MESSAGE ReplyMessage OPTIONAL, + OUT PPORT_MESSAGE Message + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtReplyPort( + IN HANDLE PortHandle, + IN PPORT_MESSAGE ReplyMessage + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtCreateThread( + OUT PHANDLE ThreadHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN HANDLE ProcessHandle, + OUT PCLIENT_ID ClientId, + IN PCONTEXT ThreadContext, + IN PINITIAL_TEB UserStack, + IN BOOLEAN CreateSuspended + ); + + typedef enum _SECTION_INHERIT { + ViewShare = 1, + ViewUnmap = 2 + } SECTION_INHERIT; + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtCreateSection( + __out PHANDLE SectionHandle, + __in ACCESS_MASK DesiredAccess, + __in_opt POBJECT_ATTRIBUTES ObjectAttributes, + __in_opt PLARGE_INTEGER MaximumSize, + __in ULONG SectionPageProtection, + __in ULONG AllocationAttributes, + __in_opt HANDLE FileHandle + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtOpenSection( + __out PHANDLE SectionHandle, + __in ACCESS_MASK DesiredAccess, + __in POBJECT_ATTRIBUTES ObjectAttributes + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtMapViewOfSection( + __in HANDLE SectionHandle, + __in HANDLE ProcessHandle, + __inout PVOID *BaseAddress, + __in ULONG_PTR ZeroBits, + __in SIZE_T CommitSize, + __inout_opt PLARGE_INTEGER SectionOffset, + __inout PSIZE_T ViewSize, + __in SECTION_INHERIT InheritDisposition, + __in ULONG AllocationType, + __in ULONG Win32Protect + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtUnmapViewOfSection( + __in HANDLE ProcessHandle, + __in_opt PVOID BaseAddress + ); + + + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + LdrLoadDll( + IN PWCHAR SearchPath OPTIONAL, + IN PULONG Flags OPTIONAL, + IN PUNICODE_STRING ModuleFileName, + OUT HMODULE *ModuleHandle + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + LdrUnloadDll( + IN HANDLE ModuleHandle + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + LdrGetLoadDll( + IN PWCHAR SearchPath OPTIONAL, + IN PULONG Flags OPTIONAL, + IN PUNICODE_STRING ModuleFileName, + OUT HMODULE *ModuleHandle + ); + + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + LdrGetProcedureAddress( + IN HMODULE ModuleHandle, + IN PANSI_STRING FunctionName OPTIONAL, + IN WORD Oridinal OPTIONAL, + OUT PVOID *FunctionAddress + ); + + typedef struct _PROCESS_WINDOW_INFORMATION + { + ULONG WindowFlags; + USHORT titleLen; + WCHAR title[0]; + } PROCESS_WINDOW_INFORMATION; + + typedef struct _PROCESS_IMAGE_INFORMATION + { + PVOID pEntryPoint; + PVOID unk; + ULONG_PTR stackReserve; + ULONG_PTR stackCommit; + USHORT subsystem; + USHORT unk2; + ULONG osVersion; + ULONG imageVersion; + USHORT dllCharacteristics; + USHORT fileHeaderCharacteristics; + USHORT machine; + USHORT unk3; + PVOID unk4; + PVOID unk5; + ULONG checksum; + } PROCESS_IMAGE_INFORMATION; + + // + // Process Information Structures + // + + // + // Working set page priority information. + // Used with ProcessPagePriority and ThreadPagePriority + // + + typedef struct _PAGE_PRIORITY_INFORMATION { + ULONG PagePriority; + } PAGE_PRIORITY_INFORMATION, *PPAGE_PRIORITY_INFORMATION; + + // + // PageFaultHistory Information + // NtQueryInformationProcess using ProcessWorkingSetWatch + // + typedef struct _PROCESS_WS_WATCH_INFORMATION { + PVOID FaultingPc; + PVOID FaultingVa; + } PROCESS_WS_WATCH_INFORMATION, *PPROCESS_WS_WATCH_INFORMATION; + + // + // Basic and Extended Basic Process Information + // NtQueryInformationProcess using ProcessBasicInformation + // + + typedef ULONG KPRIORITY; + + typedef struct _PROCESS_BASIC_INFORMATION { + NTSTATUS ExitStatus; + PPEB PebBaseAddress; + ULONG_PTR AffinityMask; + KPRIORITY BasePriority; + ULONG_PTR UniqueProcessId; + ULONG_PTR InheritedFromUniqueProcessId; + } PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION; + + typedef struct _PROCESS_EXTENDED_BASIC_INFORMATION { + SIZE_T Size; // Must be set to structure size on input + PROCESS_BASIC_INFORMATION BasicInfo; + union { + ULONG Flags; + struct { + ULONG IsProtectedProcess : 1; + ULONG IsWow64Process : 1; + ULONG IsProcessDeleting : 1; + ULONG IsCrossSessionCreate : 1; + ULONG SpareBits : 28; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + } PROCESS_EXTENDED_BASIC_INFORMATION, *PPROCESS_EXTENDED_BASIC_INFORMATION; + + // + // Process Device Map information + // NtQueryInformationProcess using ProcessDeviceMap + // NtSetInformationProcess using ProcessDeviceMap + // + + typedef struct _PROCESS_DEVICEMAP_INFORMATION { + union { + struct { + HANDLE DirectoryHandle; + } Set; + struct { + ULONG DriveMap; + UCHAR DriveType[32]; + } Query; + } DUMMYUNIONNAME; + } PROCESS_DEVICEMAP_INFORMATION, *PPROCESS_DEVICEMAP_INFORMATION; + + typedef struct _PROCESS_DEVICEMAP_INFORMATION_EX { + union { + struct { + HANDLE DirectoryHandle; + } Set; + struct { + ULONG DriveMap; + UCHAR DriveType[32]; + } Query; + } DUMMYUNIONNAME; + ULONG Flags; // specifies that the query type + } PROCESS_DEVICEMAP_INFORMATION_EX, *PPROCESS_DEVICEMAP_INFORMATION_EX; + + // + // PROCESS_DEVICEMAP_INFORMATION_EX flags + // +#define PROCESS_LUID_DOSDEVICES_ONLY 0x00000001 + + // + // Multi-User Session specific Process Information + // NtQueryInformationProcess using ProcessSessionInformation + // + + typedef struct _PROCESS_SESSION_INFORMATION { + ULONG SessionId; + } PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION; + + typedef struct _PROCESS_HANDLE_TRACING_ENABLE { + ULONG Flags; + } PROCESS_HANDLE_TRACING_ENABLE, *PPROCESS_HANDLE_TRACING_ENABLE; + + typedef struct _PROCESS_HANDLE_TRACING_ENABLE_EX { + ULONG Flags; + ULONG TotalSlots; + } PROCESS_HANDLE_TRACING_ENABLE_EX, *PPROCESS_HANDLE_TRACING_ENABLE_EX; + + +#define PROCESS_HANDLE_TRACING_MAX_STACKS 16 + + typedef struct _PROCESS_HANDLE_TRACING_ENTRY { + HANDLE Handle; + CLIENT_ID ClientId; + ULONG Type; + PVOID Stacks[PROCESS_HANDLE_TRACING_MAX_STACKS]; + } PROCESS_HANDLE_TRACING_ENTRY, *PPROCESS_HANDLE_TRACING_ENTRY; + + typedef struct _PROCESS_HANDLE_TRACING_QUERY { + HANDLE Handle; + ULONG TotalTraces; + PROCESS_HANDLE_TRACING_ENTRY HandleTrace[1]; + } PROCESS_HANDLE_TRACING_QUERY, *PPROCESS_HANDLE_TRACING_QUERY; + + // + // Process Quotas + // NtQueryInformationProcess using ProcessQuotaLimits + // NtQueryInformationProcess using ProcessPooledQuotaLimits + // NtSetInformationProcess using ProcessQuotaLimits + // + +#define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001 +#define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002 +#define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004 +#define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008 +#define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010 + + // + // Process Security Context Information + // NtSetInformationProcess using ProcessAccessToken + // PROCESS_SET_ACCESS_TOKEN access to the process is needed + // to use this info level. + // + + typedef struct _PROCESS_ACCESS_TOKEN { + + // + // Handle to Primary token to assign to the process. + // TOKEN_ASSIGN_PRIMARY access to this token is needed. + // + + HANDLE Token; + + // + // Handle to the initial thread of the process. + // A process's access token can only be changed if the process has + // no threads or a single thread that has not yet begun execution. + // + // N.B. This field is unused. + // + + HANDLE Thread; + + } PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN; + + // + // Process Exception Port Information + // NtSetInformationProcess using ProcessExceptionPort + // PROCESS_SET_PORT access to the process is needed + // to use this info level. + // + +#define PROCESS_EXCEPTION_PORT_ALL_STATE_BITS 0x00000003UL +#define PROCESS_EXCEPTION_PORT_ALL_STATE_FLAGS ((ULONG_PTR)((1UL << PROCESS_EXCEPTION_PORT_ALL_STATE_BITS) - 1)) + + typedef struct _PROCESS_EXCEPTION_PORT { + + // + // Handle to the exception port. No particular access required. + // + + IN HANDLE ExceptionPortHandle; + + // + // Miscellaneous state flags to be cached along with the exception + // port in the kernel. + // + + IN OUT ULONG StateFlags; + + } PROCESS_EXCEPTION_PORT, *PPROCESS_EXCEPTION_PORT; + + // + // Process/Thread System and User Time + // NtQueryInformationProcess using ProcessTimes + // NtQueryInformationThread using ThreadTimes + // + + typedef struct _KERNEL_USER_TIMES { + LARGE_INTEGER CreateTime; + LARGE_INTEGER ExitTime; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + } KERNEL_USER_TIMES; + typedef KERNEL_USER_TIMES *PKERNEL_USER_TIMES; + + // + // Thread Information Classes + // + + typedef enum _THREADINFOCLASS { + ThreadBasicInformation, + ThreadTimes, + ThreadPriority, + ThreadBasePriority, + ThreadAffinityMask, + ThreadImpersonationToken, + ThreadDescriptorTableEntry, + ThreadEnableAlignmentFaultFixup, + ThreadEventPair_Reusable, + ThreadQuerySetWin32StartAddress, + ThreadZeroTlsCell, + ThreadPerformanceCount, + ThreadAmILastThread, + ThreadIdealProcessor, + ThreadPriorityBoost, + ThreadSetTlsArrayAddress, // Obsolete + ThreadIsIoPending, + ThreadHideFromDebugger, + ThreadBreakOnTermination, + ThreadSwitchLegacyState, + ThreadIsTerminated, + ThreadLastSystemCall, + ThreadIoPriority, + ThreadCycleTime, + ThreadPagePriority, + ThreadActualBasePriority, + ThreadTebInformation, + ThreadCSwitchMon, // Obsolete + ThreadCSwitchPmu, + ThreadWow64Context, + ThreadGroupInformation, + ThreadUmsInformation, // UMS + ThreadCounterProfiling, + ThreadIdealProcessorEx, + MaxThreadInfoClass + } THREADINFOCLASS; + + typedef struct _THREAD_BASIC_INFORMATION + { + NTSTATUS ExitStatus; + PVOID TebBaseAddress; + CLIENT_ID ClientId; + KAFFINITY AffinityMask; + KPRIORITY Priority; + KPRIORITY BasePriority; + } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION; + + typedef struct _THREAD_TIMES_INFORMATION + { + LARGE_INTEGER CreationTime; + LARGE_INTEGER ExitTime; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + } THREAD_TIMES_INFORMATION, *PTHREAD_TIMES_INFORMATION; + + typedef struct _SYSTEM_MODULE + { + ULONG Reserved1; + ULONG Reserved2; + PVOID ImageBaseAddress; + ULONG ImageSize; + ULONG Flags; + WORD Id; + WORD Rank; + WORD w018; + WORD NameOffset; + BYTE Name[256]; + } SYSTEM_MODULE, *PSYSTEM_MODULE; + + typedef struct _SYSTEM_MODULE_INFORMATION + { + ULONG ModulesCount; + SYSTEM_MODULE Modules[0]; + } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION; + + EXTERN_C NTSYSAPI NTSTATUS NTAPI NtSetInformationProcess( + HANDLE ProcessHandle, + PROCESSINFOCLASS ProcessInformationClass, + PVOID ProcessInformation, + ULONG ProcessInformationLength + ); + + EXTERN_C NTSYSAPI NTSTATUS NTAPI NtQueryInformationThread( + IN HANDLE ThreadHandle, + IN THREADINFOCLASS ThreadInformationClass, + OUT PVOID ThreadInformation, + IN ULONG ThreadInformationLength, + OUT PULONG ReturnLength OPTIONAL + ); + + EXTERN_C NTSYSAPI NTSTATUS WINAPI NtQuerySystemInformation( + _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, + _Out_opt_ PVOID SystemInformation, + _In_ ULONG SystemInformationLength, + _Out_opt_ PULONG ReturnLength OPTIONAL + ); + + typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION { + ULONG RegistryQuotaAllowed; + ULONG RegistryQuotaUsed; + PVOID Reserved1; + } SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION; + + typedef struct _SYSTEM_BASIC_INFORMATION { + BYTE Reserved1[24]; + PVOID Reserved2[4]; + CCHAR NumberOfProcessors; + } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION; + + typedef struct _SYSTEM_TIMEOFDAY_INFORMATION { + BYTE Reserved1[48]; + } SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION; + + typedef struct _SYSTEM_PERFORMANCE_INFORMATION { + BYTE Reserved1[312]; + } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION; + + typedef struct _SYSTEM_EXCEPTION_INFORMATION { + BYTE Reserved1[16]; + } SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION; + + typedef struct _SYSTEM_LOOKASIDE_INFORMATION { + BYTE Reserved1[32]; + } SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION; + + typedef struct _SYSTEM_INTERRUPT_INFORMATION { + BYTE Reserved1[24]; + } SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION; + + typedef struct _SYSTEM_HANDLE_INFORMATION + { + ULONG ProcessId; + UCHAR ObjectTypeNumber; + UCHAR Flags; + USHORT Handle; + PVOID Object; + ACCESS_MASK GrantedAccess; + } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION; + + typedef struct _VM_COUNTERS { + SIZE_T PeakVirtualSize; + SIZE_T VirtualSize; + ULONG PageFaultCount; + SIZE_T PeakWorkingSetSize; + SIZE_T WorkingSetSize; + SIZE_T QuotaPeakPagedPoolUsage; + SIZE_T QuotaPagedPoolUsage; + SIZE_T QuotaPeakNonPagedPoolUsage; + SIZE_T QuotaNonPagedPoolUsage; + SIZE_T PagefileUsage; + SIZE_T PeakPagefileUsage; + SIZE_T PrivatePageCount; + } VM_COUNTERS; + + typedef struct _SYSTEM_THREAD_INFORMATION { + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER CreateTime; + ULONG WaitTime; + PVOID StartAddress; + CLIENT_ID ClientId; + KPRIORITY Priority; + KPRIORITY BasePriority; + ULONG ContextSwitchCount; + LONG State; + LONG WaitReason; + } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION; + + typedef struct _SYSTEM_PROCESS_INFORMATION { + ULONG NextEntryDelta; + ULONG ThreadCount; + LARGE_INTEGER Reserved1[3]; + LARGE_INTEGER CreateTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER KernelTime; + UNICODE_STRING ProcessName; + KPRIORITY BasePriority; + HANDLE ProcessId; + HANDLE InheritedFromProcessId; + ULONG HandleCount; + ULONG SessionId; + ULONG_PTR PageDirectoryBase; + VM_COUNTERS VmCounters; +#if _WIN32_WINNT >= 0x500 + IO_COUNTERS IoCounters; +#endif + SYSTEM_THREAD_INFORMATION Threads[1]; + } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION; + + typedef struct _ACTIVATION_CONTEXT_STACK + { + ULONG Flags; + ULONG NextCookieSequenceNumber; + PVOID ActiveFrame; + LIST_ENTRY FrameListCache; + } ACTIVATION_CONTEXT_STACK; + + typedef struct _GDI_TEB_BATCH + { + ULONG Offset; + HDC hdc; + ULONG buffer[310]; + } GDI_TEB_BATCH; + + typedef struct _Wx86ThreadState + { + PULONG CallBx86Eip; + PVOID DeallocationCpu; + BOOLEAN UseKnownWx86Dll; + BOOLEAN OleStubInvoked; + } Wx86ThreadState; + + typedef struct _TEB_ACTIVE_FRAME_CONTEXT + { + ULONG Flags; + char* FrameName; + } TEB_ACTIVE_FRAME_CONTEXT; + + typedef struct _TEB_ACTIVE_FRAME + { + ULONG Flags; + struct _TEB_ACTIVE_FRAME* Previous; + TEB_ACTIVE_FRAME_CONTEXT* Context; + } TEB_ACTIVE_FRAME, *PTEB_ACTIVE_FRAME; + + typedef struct _TEB + { + NT_TIB NtTib; + + PVOID EnvironmentPointer; + CLIENT_ID ClientId; + PVOID ActiveRpcHandle; + PVOID ThreadLocalStoragePointer; + PPEB ProcessEnvironmentBlock; + + ULONG LastErrorValue; + ULONG CountOfOwnedCriticalSections; + PVOID CsrClientThread; + PVOID Win32ThreadInfo; + ULONG User32Reserved[26]; + ULONG UserReserved[5]; + PVOID WOW32Reserved; + LCID CurrentLocale; + ULONG FpSoftwareStatusRegister; + PVOID ReservedForDebuggerInstrumentation[16]; + PVOID SystemReserved1[37]; + UCHAR WorkingOnBehalfTicket[8]; + NTSTATUS ExceptionCode; + + PVOID ActivationContextStackPointer; + ULONG_PTR InstrumentationCallbackSp; + ULONG_PTR InstrumentationCallbackPreviousPc; + ULONG_PTR InstrumentationCallbackPreviousSp; + ULONG TxFsContext; + + BOOLEAN InstrumentationCallbackDisabled; + GDI_TEB_BATCH GdiTebBatch; + CLIENT_ID RealClientId; + HANDLE GdiCachedProcessHandle; + ULONG GdiClientPID; + ULONG GdiClientTID; + PVOID GdiThreadLocalInfo; + ULONG_PTR Win32ClientInfo[62]; + PVOID glDispatchTable[233]; + ULONG_PTR glReserved1[29]; + PVOID glReserved2; + PVOID glSectionInfo; + PVOID glSection; + PVOID glTable; + PVOID glCurrentRC; + PVOID glContext; + + NTSTATUS LastStatusValue; + UNICODE_STRING StaticUnicodeString; + WCHAR StaticUnicodeBuffer[261]; + + PVOID DeallocationStack; + PVOID TlsSlots[64]; + LIST_ENTRY TlsLinks; + + PVOID Vdm; + PVOID ReservedForNtRpc; + PVOID DbgSsReserved[2]; + + ULONG HardErrorMode; +#ifdef _WIN64 + PVOID Instrumentation[11]; +#else + PVOID Instrumentation[9]; +#endif + GUID ActivityId; + + PVOID SubProcessTag; + PVOID PerflibData; + PVOID EtwTraceData; + PVOID WinSockData; + ULONG GdiBatchCount; + + union + { + PROCESSOR_NUMBER CurrentIdealProcessor; + ULONG IdealProcessorValue; + struct + { + UCHAR ReservedPad0; + UCHAR ReservedPad1; + UCHAR ReservedPad2; + UCHAR IdealProcessor; + }; + }; + + ULONG GuaranteedStackBytes; + PVOID ReservedForPerf; + PVOID ReservedForOle; + ULONG WaitingOnLoaderLock; + PVOID SavedPriorityState; + ULONG_PTR ReservedForCodeCoverage; + PVOID ThreadPoolData; + PVOID *TlsExpansionSlots; +#ifdef _WIN64 + PVOID DeallocationBStore; + PVOID BStoreLimit; +#endif + ULONG MuiGeneration; + ULONG IsImpersonating; + PVOID NlsCache; + PVOID pShimData; + USHORT HeapVirtualAffinity; + USHORT LowFragHeapDataSlot; + HANDLE CurrentTransactionHandle; + PTEB_ACTIVE_FRAME ActiveFrame; + PVOID FlsData; + + PVOID PreferredLanguages; + PVOID UserPrefLanguages; + PVOID MergedPrefLanguages; + ULONG MuiImpersonation; + + union + { + USHORT CrossTebFlags; + USHORT SpareCrossTebBits : 16; + }; + union + { + USHORT SameTebFlags; + struct + { + USHORT SafeThunkCall : 1; + USHORT InDebugPrint : 1; + USHORT HasFiberData : 1; + USHORT SkipThreadAttach : 1; + USHORT WerInShipAssertCode : 1; + USHORT RanProcessInit : 1; + USHORT ClonedThread : 1; + USHORT SuppressDebugMsg : 1; + USHORT DisableUserStackWalk : 1; + USHORT RtlExceptionAttached : 1; + USHORT InitialThread : 1; + USHORT SessionAware : 1; + USHORT LoadOwner : 1; + USHORT LoaderWorker : 1; + USHORT SpareSameTebBits : 2; + }; + }; + + PVOID TxnScopeEnterCallback; + PVOID TxnScopeExitCallback; + PVOID TxnScopeContext; + ULONG LockCount; + LONG WowTebOffset; + PVOID ResourceRetValue; + PVOID ReservedForWdf; + ULONGLONG ReservedForCrt; + GUID EffectiveContainerId; + } TEB, *PTEB; + + + __if_not_exists(NtCurrentTeb) + { + PTEB NTAPI NtCurrentTeb(void); + } + +#if _WIN32_WINNT <= 0x0500 + + inline PPEB NTAPI RtlGetCurrentPeb(void) + { + PTEB pTeb = NtCurrentTeb(); + return pTeb->Peb; + } + +#else + + EXTERN_C NTSYSAPI PPEB NTAPI RtlGetCurrentPeb(void); + EXTERN_C + NTSYSAPI + NTSTATUS + NTAPI + NtDuplicateObject( + __in HANDLE SourceProcessHandle, + __in HANDLE SourceHandle, + __in_opt HANDLE TargetProcessHandle, + __out_opt PHANDLE TargetHandle, + __in ACCESS_MASK DesiredAccess, + __in ULONG HandleAttributes, + __in ULONG Options + ); + +#endif + // + // This enumerated type is used as the function return value of the function + // that is used to search the tree for a key. FoundNode indicates that the + // function found the key. Insert as left indicates that the key was not found + // and the node should be inserted as the left child of the parent. Insert as + // right indicates that the key was not found and the node should be inserted + // as the right child of the parent. + // + typedef enum _TABLE_SEARCH_RESULT { + TableEmptyTree, + TableFoundNode, + TableInsertAsLeft, + TableInsertAsRight + } TABLE_SEARCH_RESULT; + + // + // The results of a compare can be less than, equal, or greater than. + // + + typedef enum _RTL_GENERIC_COMPARE_RESULTS { + GenericLessThan, + GenericGreaterThan, + GenericEqual + } RTL_GENERIC_COMPARE_RESULTS; + + // + // Define the Avl version of the generic table package. Note a generic table + // should really be an opaque type. We provide routines to manipulate the structure. + // + // A generic table is package for inserting, deleting, and looking up elements + // in a table (e.g., in a symbol table). To use this package the user + // defines the structure of the elements stored in the table, provides a + // comparison function, a memory allocation function, and a memory + // deallocation function. + // + // Note: the user compare function must impose a complete ordering among + // all of the elements, and the table does not allow for duplicate entries. + // + + // + // Add an empty typedef so that functions can reference the + // a pointer to the generic table struct before it is declared. + // + + struct _RTL_AVL_TABLE; + + // + // The comparison function takes as input pointers to elements containing + // user defined structures and returns the results of comparing the two + // elements. + // + + typedef + __drv_sameIRQL + __drv_functionClass(RTL_AVL_COMPARE_ROUTINE) + RTL_GENERIC_COMPARE_RESULTS + NTAPI + RTL_AVL_COMPARE_ROUTINE( + __in struct _RTL_AVL_TABLE *Table, + __in PVOID FirstStruct, + __in PVOID SecondStruct + ); + typedef RTL_AVL_COMPARE_ROUTINE *PRTL_AVL_COMPARE_ROUTINE; + + // + // The allocation function is called by the generic table package whenever + // it needs to allocate memory for the table. + // + + typedef + __drv_sameIRQL + __drv_functionClass(RTL_AVL_ALLOCATE_ROUTINE) + __drv_allocatesMem(Mem) + PVOID + NTAPI + RTL_AVL_ALLOCATE_ROUTINE( + __in struct _RTL_AVL_TABLE *Table, + __in LONG ByteSize + ); + typedef RTL_AVL_ALLOCATE_ROUTINE *PRTL_AVL_ALLOCATE_ROUTINE; + + // + // The deallocation function is called by the generic table package whenever + // it needs to deallocate memory from the table that was allocated by calling + // the user supplied allocation function. + // + + typedef + __drv_sameIRQL + __drv_functionClass(RTL_AVL_FREE_ROUTINE) + VOID + NTAPI + RTL_AVL_FREE_ROUTINE( + __in struct _RTL_AVL_TABLE *Table, + __in __drv_freesMem(Mem) __post_invalid PVOID Buffer + ); + typedef RTL_AVL_FREE_ROUTINE *PRTL_AVL_FREE_ROUTINE; + + // + // The match function takes as input the user data to be matched and a pointer + // to some match data, which was passed along with the function pointer. It + // returns TRUE for a match and FALSE for no match. + // + // RTL_AVL_MATCH_FUNCTION returns + // STATUS_SUCCESS if the IndexRow matches + // STATUS_NO_MATCH if the IndexRow does not match, but the enumeration should + // continue + // STATUS_NO_MORE_MATCHES if the IndexRow does not match, and the enumeration + // should terminate + // + + + typedef + __drv_sameIRQL + __drv_functionClass(RTL_AVL_MATCH_FUNCTION) + NTSTATUS + NTAPI + RTL_AVL_MATCH_FUNCTION( + __in struct _RTL_AVL_TABLE *Table, + __in PVOID UserData, + __in PVOID MatchData + ); + typedef RTL_AVL_MATCH_FUNCTION *PRTL_AVL_MATCH_FUNCTION; + + // + // Define the balanced tree links and Balance field. (No Rank field + // defined at this time.) + // + // Callers should treat this structure as opaque! + // + // The root of a balanced binary tree is not a real node in the tree + // but rather points to a real node which is the root. It is always + // in the table below, and its fields are used as follows: + // + // Parent Pointer to self, to allow for detection of the root. + // LeftChild NULL + // RightChild Pointer to real root + // Balance Undefined, however it is set to a convenient value + // (depending on the algorithm) prior to rebalancing + // in insert and delete routines. + // + + typedef struct _RTL_BALANCED_LINKS { + struct _RTL_BALANCED_LINKS *Parent; + struct _RTL_BALANCED_LINKS *LeftChild; + struct _RTL_BALANCED_LINKS *RightChild; + CHAR Balance; + UCHAR Reserved[3]; + } RTL_BALANCED_LINKS; + typedef RTL_BALANCED_LINKS *PRTL_BALANCED_LINKS; + + // + // To use the generic table package the user declares a variable of type + // GENERIC_TABLE and then uses the routines described below to initialize + // the table and to manipulate the table. Note that the generic table + // should really be an opaque type. + // + + typedef struct _RTL_AVL_TABLE { + RTL_BALANCED_LINKS BalancedRoot; + PVOID OrderedPointer; + ULONG WhichOrderedElement; + ULONG NumberGenericTableElements; + ULONG DepthOfTree; + PRTL_BALANCED_LINKS RestartKey; + ULONG DeleteCount; + PRTL_AVL_COMPARE_ROUTINE CompareRoutine; + PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine; + PRTL_AVL_FREE_ROUTINE FreeRoutine; + PVOID TableContext; + } RTL_AVL_TABLE; + typedef RTL_AVL_TABLE *PRTL_AVL_TABLE; + + // + // The procedure InitializeGenericTable takes as input an uninitialized + // generic table variable and pointers to the three user supplied routines. + // This must be called for every individual generic table variable before + // it can be used. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + NTSYSAPI + VOID + NTAPI + RtlInitializeGenericTableAvl( + __out PRTL_AVL_TABLE Table, + __in PRTL_AVL_COMPARE_ROUTINE CompareRoutine, + __in PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine, + __in PRTL_AVL_FREE_ROUTINE FreeRoutine, + __in_opt PVOID TableContext + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function InsertElementGenericTable will insert a new element + // in a table. It does this by allocating space for the new element + // (this includes AVL links), inserting the element in the table, and + // then returning to the user a pointer to the new element. If an element + // with the same key already exists in the table the return value is a pointer + // to the old element. The optional output parameter NewElement is used + // to indicate if the element previously existed in the table. Note: the user + // supplied Buffer is only used for searching the table, upon insertion its + // contents are copied to the newly created element. This means that + // pointer to the input buffer will not point to the new element. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlInsertElementGenericTableAvl( + __in PRTL_AVL_TABLE Table, + __in_bcount(BufferSize) PVOID Buffer, + __in LONG BufferSize, + __out_opt PBOOLEAN NewElement + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function InsertElementGenericTableFull will insert a new element + // in a table. It does this by allocating space for the new element + // (this includes AVL links), inserting the element in the table, and + // then returning to the user a pointer to the new element. If an element + // with the same key already exists in the table the return value is a pointer + // to the old element. The optional output parameter NewElement is used + // to indicate if the element previously existed in the table. Note: the user + // supplied Buffer is only used for searching the table, upon insertion its + // contents are copied to the newly created element. This means that + // pointer to the input buffer will not point to the new element. + // This routine is passed the NodeOrParent and SearchResult from a + // previous RtlLookupElementGenericTableFull. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlInsertElementGenericTableFullAvl( + __in PRTL_AVL_TABLE Table, + __in_bcount(BufferSize) PVOID Buffer, + __in LONG BufferSize, + __out_opt PBOOLEAN NewElement, + __in PVOID NodeOrParent, + __in TABLE_SEARCH_RESULT SearchResult + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function DeleteElementGenericTable will find and delete an element + // from a generic table. If the element is located and deleted the return + // value is TRUE, otherwise if the element is not located the return value + // is FALSE. The user supplied input buffer is only used as a key in + // locating the element in the table. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + NTSYSAPI + BOOLEAN + NTAPI + RtlDeleteElementGenericTableAvl( + __in PRTL_AVL_TABLE Table, + __in PVOID Buffer + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function LookupElementGenericTable will find an element in a generic + // table. If the element is located the return value is a pointer to + // the user defined structure associated with the element, otherwise if + // the element is not located the return value is NULL. The user supplied + // input buffer is only used as a key in locating the element in the table. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlLookupElementGenericTableAvl( + __in PRTL_AVL_TABLE Table, + __in PVOID Buffer + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function LookupElementGenericTableFull will find an element in a generic + // table. If the element is located the return value is a pointer to + // the user defined structure associated with the element. If the element is not + // located then a pointer to the parent for the insert location is returned. The + // user must look at the SearchResult value to determine which is being returned. + // The user can use the SearchResult and parent for a subsequent FullInsertElement + // call to optimize the insert. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlLookupElementGenericTableFullAvl( + __in PRTL_AVL_TABLE Table, + __in PVOID Buffer, + __out PVOID *NodeOrParent, + __out TABLE_SEARCH_RESULT *SearchResult + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function EnumerateGenericTable will return to the caller one-by-one + // the elements of of a table. The return value is a pointer to the user + // defined structure associated with the element. The input parameter + // Restart indicates if the enumeration should start from the beginning + // or should return the next element. If the are no more new elements to + // return the return value is NULL. As an example of its use, to enumerate + // all of the elements in a table the user would write: + // + // for (ptr = EnumerateGenericTable(Table, TRUE); + // ptr != NULL; + // ptr = EnumerateGenericTable(Table, FALSE)) { + // : + // } + // + // NOTE: This routine does not modify the structure of the tree, but saves + // the last node returned in the generic table itself, and for this + // reason requires exclusive access to the table for the duration of + // the enumeration. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlEnumerateGenericTableAvl( + __in PRTL_AVL_TABLE Table, + __in BOOLEAN Restart + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function EnumerateGenericTableWithoutSplaying will return to the + // caller one-by-one the elements of of a table. The return value is a + // pointer to the user defined structure associated with the element. + // The input parameter RestartKey indicates if the enumeration should + // start from the beginning or should return the next element. If the + // are no more new elements to return the return value is NULL. As an + // example of its use, to enumerate all of the elements in a table the + // user would write: + // + // RestartKey = NULL; + // for (ptr = EnumerateGenericTableWithoutSplaying(Table, &RestartKey); + // ptr != NULL; + // ptr = EnumerateGenericTableWithoutSplaying(Table, &RestartKey)) { + // : + // } + // + // If RestartKey is NULL, the package will start from the least entry in the + // table, otherwise it will start from the last entry returned. + // + // NOTE: This routine does not modify either the structure of the tree + // or the generic table itself, but must insure that no deletes + // occur for the duration of the enumeration, typically by having + // at least shared access to the table for the duration. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlEnumerateGenericTableWithoutSplayingAvl( + __in PRTL_AVL_TABLE Table, + __inout PVOID *RestartKey + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // RtlLookupFirstMatchingElementGenericTableAvl will return the left-most + // element in the tree matching the data in Buffer. If, for example, the tree + // contains filenames there may exist several that differ only in case. A case- + // blind searcher can use this routine to position himself in the tree at the + // first match, and use an enumeration routine (such as RtlEnumerateGenericTableWithoutSplayingAvl + // to return each subsequent match. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlLookupFirstMatchingElementGenericTableAvl( + __in PRTL_AVL_TABLE Table, + __in PVOID Buffer, + __out PVOID *RestartKey + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function EnumerateGenericTableLikeADirectory will return to the + // caller one-by-one the elements of of a table. The return value is a + // pointer to the user defined structure associated with the element. + // The input parameter RestartKey indicates if the enumeration should + // start from the beginning or should return the next element. If the + // are no more new elements to return the return value is NULL. As an + // example of its use, to enumerate all of the elements in a table the + // user would write: + // + // RestartKey = NULL; + // for (ptr = EnumerateGenericTableLikeADirectory(Table, &RestartKey, ...); + // ptr != NULL; + // ptr = EnumerateGenericTableLikeADirectory(Table, &RestartKey, ...)) { + // : + // } + // + // If RestartKey is NULL, the package will start from the least entry in the + // table, otherwise it will start from the last entry returned. + // + // NOTE: This routine does not modify either the structure of the tree + // or the generic table itself. The table must only be acquired + // shared for the duration of this call, and all synchronization + // may optionally be dropped between calls. Enumeration is always + // correctly resumed in the most efficient manner possible via the + // IN OUT parameters provided. + // + // ****** Explain NextFlag. Directory enumeration resumes from a key + // requires more thought. Also need the match pattern and IgnoreCase. + // Should some structure be introduced to carry it all? + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlEnumerateGenericTableLikeADirectory( + __in PRTL_AVL_TABLE Table, + __in_opt PRTL_AVL_MATCH_FUNCTION MatchFunction, + __in_opt PVOID MatchData, + __in ULONG NextFlag, + __inout PVOID *RestartKey, + __inout PULONG DeleteCount, + __in PVOID Buffer + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function GetElementGenericTable will return the i'th element + // inserted in the generic table. I = 0 implies the first element, + // I = (RtlNumberGenericTableElements(Table)-1) will return the last element + // inserted into the generic table. The type of I is ULONG. Values + // of I > than (NumberGenericTableElements(Table)-1) will return NULL. If + // an arbitrary element is deleted from the generic table it will cause + // all elements inserted after the deleted element to "move up". + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlGetElementGenericTableAvl( + __in PRTL_AVL_TABLE Table, + __in ULONG I + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function NumberGenericTableElements returns a ULONG value + // which is the number of generic table elements currently inserted + // in the generic table. + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + NTSYSAPI + ULONG + NTAPI + RtlNumberGenericTableElementsAvl( + __in PRTL_AVL_TABLE Table + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // The function IsGenericTableEmpty will return to the caller TRUE if + // the input table is empty (i.e., does not contain any elements) and + // FALSE otherwise. + // + +#if (NTDDI_VERSION >= NTDDI_WINXP) + EXTERN_C + __checkReturn + NTSYSAPI + BOOLEAN + NTAPI + RtlIsGenericTableEmptyAvl( + __in PRTL_AVL_TABLE Table + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + + // + // As an aid to allowing existing generic table users to do (in most + // cases) a single-line edit to switch over to Avl table use, we + // have the following defines and inline routine definitions which + // redirect calls and types. Note that the type override (performed + // by #define below) will not work in the unexpected event that someone + // has used a pointer or type specifier in their own #define, since + // #define processing is one pass and does not nest. The __inline + // declarations below do not have this limitation, however. + // + // To switch to using Avl tables, add the following line before your + // includes: + // + // #define RTL_USE_AVL_TABLES 0 + // + +#ifdef RTL_USE_AVL_TABLES + +#undef PRTL_GENERIC_COMPARE_ROUTINE +#undef RTL_GENERIC_COMPARE_ROUTINE +#undef PRTL_GENERIC_ALLOCATE_ROUTINE +#undef RTL_GENERIC_ALLOCATE_ROUTINE +#undef PRTL_GENERIC_FREE_ROUTINE +#undef RTL_GENERIC_FREE_ROUTINE +#undef RTL_GENERIC_TABLE +#undef PRTL_GENERIC_TABLE + +#define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE +#define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE +#define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE +#define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE +#define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE +#define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE +#define RTL_GENERIC_TABLE RTL_AVL_TABLE +#define PRTL_GENERIC_TABLE PRTL_AVL_TABLE + +#define RtlInitializeGenericTable RtlInitializeGenericTableAvl +#define RtlInsertElementGenericTable RtlInsertElementGenericTableAvl +#define RtlInsertElementGenericTableFull RtlInsertElementGenericTableFullAvl +#define RtlDeleteElementGenericTable RtlDeleteElementGenericTableAvl +#define RtlLookupElementGenericTable RtlLookupElementGenericTableAvl +#define RtlLookupElementGenericTableFull RtlLookupElementGenericTableFullAvl +#define RtlEnumerateGenericTable RtlEnumerateGenericTableAvl +#define RtlEnumerateGenericTableWithoutSplaying RtlEnumerateGenericTableWithoutSplayingAvl +#define RtlGetElementGenericTable RtlGetElementGenericTableAvl +#define RtlNumberGenericTableElements RtlNumberGenericTableElementsAvl +#define RtlIsGenericTableEmpty RtlIsGenericTableEmptyAvl + +#endif // RTL_USE_AVL_TABLES + + // + // Define the generic table package. Note a generic table should really + // be an opaque type. We provide routines to manipulate the structure. + // + // A generic table is package for inserting, deleting, and looking up elements + // in a table (e.g., in a symbol table). To use this package the user + // defines the structure of the elements stored in the table, provides a + // comparison function, a memory allocation function, and a memory + // deallocation function. + // + // Note: the user compare function must impose a complete ordering among + // all of the elements, and the table does not allow for duplicate entries. + // + + // + // Do not do the following defines if using Avl + // + +#ifndef RTL_USE_AVL_TABLES + + struct _RTL_GENERIC_TABLE; + + // + // The comparison function takes as input pointers to elements containing + // user defined structures and returns the results of comparing the two + // elements. + // + + typedef + RTL_GENERIC_COMPARE_RESULTS + NTAPI + RTL_GENERIC_COMPARE_ROUTINE( + __in struct _RTL_GENERIC_TABLE *Table, + __in PVOID FirstStruct, + __in PVOID SecondStruct + ); + typedef RTL_GENERIC_COMPARE_ROUTINE *PRTL_GENERIC_COMPARE_ROUTINE; + + // + // The allocation function is called by the generic table package whenever + // it needs to allocate memory for the table. + // + + typedef + PVOID + NTAPI + RTL_GENERIC_ALLOCATE_ROUTINE( + __in struct _RTL_GENERIC_TABLE *Table, + __in LONG ByteSize + ); + typedef RTL_GENERIC_ALLOCATE_ROUTINE *PRTL_GENERIC_ALLOCATE_ROUTINE; + + // + // The deallocation function is called by the generic table package whenever + // it needs to deallocate memory from the table that was allocated by calling + // the user supplied allocation function. + // + + typedef + VOID + NTAPI + RTL_GENERIC_FREE_ROUTINE( + __in struct _RTL_GENERIC_TABLE *Table, + __in PVOID Buffer + ); + typedef RTL_GENERIC_FREE_ROUTINE *PRTL_GENERIC_FREE_ROUTINE; + + // + // To use the generic table package the user declares a variable of type + // GENERIC_TABLE and then uses the routines described below to initialize + // the table and to manipulate the table. Note that the generic table + // should really be an opaque type. + // + + typedef struct _RTL_SPLAY_LINKS { + struct _RTL_SPLAY_LINKS *Parent; + struct _RTL_SPLAY_LINKS *LeftChild; + struct _RTL_SPLAY_LINKS *RightChild; + } RTL_SPLAY_LINKS; + typedef RTL_SPLAY_LINKS *PRTL_SPLAY_LINKS; + + typedef struct _RTL_GENERIC_TABLE { + PRTL_SPLAY_LINKS TableRoot; + LIST_ENTRY InsertOrderList; + PLIST_ENTRY OrderedPointer; + ULONG WhichOrderedElement; + ULONG NumberGenericTableElements; + PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine; + PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine; + PRTL_GENERIC_FREE_ROUTINE FreeRoutine; + PVOID TableContext; + } RTL_GENERIC_TABLE; + typedef RTL_GENERIC_TABLE *PRTL_GENERIC_TABLE; + + EXTERN_C NTSYSAPI + VOID + NTAPI + RtlInitializeGenericTable( + __out PRTL_GENERIC_TABLE Table, + __in PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine, + __in PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine, + __in PRTL_GENERIC_FREE_ROUTINE FreeRoutine, + __in_opt PVOID TableContext + ); + + // + // The function InsertElementGenericTable will insert a new element + // in a table. It does this by allocating space for the new element + // (this includes splay links), inserting the element in the table, and + // then returning to the user a pointer to the new element. If an element + // with the same key already exists in the table the return value is a pointer + // to the old element. The optional output parameter NewElement is used + // to indicate if the element previously existed in the table. Note: the user + // supplied Buffer is only used for searching the table, upon insertion its + // contents are copied to the newly created element. This means that + // pointer to the input buffer will not point to the new element. + // + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlInsertElementGenericTable( + __in PRTL_GENERIC_TABLE Table, + __in_bcount(BufferSize) PVOID Buffer, + __in LONG BufferSize, + __out_opt PBOOLEAN NewElement + ); +#endif + + // + // The function InsertElementGenericTableFull will insert a new element + // in a table. It does this by allocating space for the new element + // (this includes splay links), inserting the element in the table, and + // then returning to the user a pointer to the new element. If an element + // with the same key already exists in the table the return value is a pointer + // to the old element. The optional output parameter NewElement is used + // to indicate if the element previously existed in the table. Note: the user + // supplied Buffer is only used for searching the table, upon insertion its + // contents are copied to the newly created element. This means that + // pointer to the input buffer will not point to the new element. + // This routine is passed the NodeOrParent and SearchResult from a + // previous RtlLookupElementGenericTableFull. + // + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlInsertElementGenericTableFull( + __in PRTL_GENERIC_TABLE Table, + __in_bcount(BufferSize) PVOID Buffer, + __in LONG BufferSize, + __out_opt PBOOLEAN NewElement, + __in PVOID NodeOrParent, + __in TABLE_SEARCH_RESULT SearchResult + ); +#endif + + // + // The function DeleteElementGenericTable will find and delete an element + // from a generic table. If the element is located and deleted the return + // value is TRUE, otherwise if the element is not located the return value + // is FALSE. The user supplied input buffer is only used as a key in + // locating the element in the table. + // + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + NTSYSAPI + BOOLEAN + NTAPI + RtlDeleteElementGenericTable( + __in PRTL_GENERIC_TABLE Table, + __in PVOID Buffer + ); +#endif + + // + // The function LookupElementGenericTable will find an element in a generic + // table. If the element is located the return value is a pointer to + // the user defined structure associated with the element, otherwise if + // the element is not located the return value is NULL. The user supplied + // input buffer is only used as a key in locating the element in the table. + // + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlLookupElementGenericTable( + __in PRTL_GENERIC_TABLE Table, + __in PVOID Buffer + ); +#endif + + // + // The function LookupElementGenericTableFull will find an element in a generic + // table. If the element is located the return value is a pointer to + // the user defined structure associated with the element. If the element is not + // located then a pointer to the parent for the insert location is returned. The + // user must look at the SearchResult value to determine which is being returned. + // The user can use the SearchResult and parent for a subsequent FullInsertElement + // call to optimize the insert. + // + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + NTSYSAPI + PVOID + NTAPI + RtlLookupElementGenericTableFull( + __in PRTL_GENERIC_TABLE Table, + __in PVOID Buffer, + __out PVOID *NodeOrParent, + __out TABLE_SEARCH_RESULT *SearchResult + ); +#endif + + // + // The function EnumerateGenericTable will return to the caller one-by-one + // the elements of of a table. The return value is a pointer to the user + // defined structure associated with the element. The input parameter + // Restart indicates if the enumeration should start from the beginning + // or should return the next element. If the are no more new elements to + // return the return value is NULL. As an example of its use, to enumerate + // all of the elements in a table the user would write: + // + // for (ptr = EnumerateGenericTable(Table, TRUE); + // ptr != NULL; + // ptr = EnumerateGenericTable(Table, FALSE)) { + // : + // } + // + // + // PLEASE NOTE: + // + // If you enumerate a GenericTable using RtlEnumerateGenericTable, you + // will flatten the table, turning it into a sorted linked list. + // To enumerate the table without perturbing the splay links, use + // RtlEnumerateGenericTableWithoutSplaying + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlEnumerateGenericTable( + __in PRTL_GENERIC_TABLE Table, + __in BOOLEAN Restart + ); +#endif + + // + // The function EnumerateGenericTableWithoutSplaying will return to the + // caller one-by-one the elements of of a table. The return value is a + // pointer to the user defined structure associated with the element. + // The input parameter RestartKey indicates if the enumeration should + // start from the beginning or should return the next element. If the + // are no more new elements to return the return value is NULL. As an + // example of its use, to enumerate all of the elements in a table the + // user would write: + // + // RestartKey = NULL; + // for (ptr = EnumerateGenericTableWithoutSplaying(Table, &RestartKey); + // ptr != NULL; + // ptr = EnumerateGenericTableWithoutSplaying(Table, &RestartKey)) { + // : + // } + // + // If RestartKey is NULL, the package will start from the least entry in the + // table, otherwise it will start from the last entry returned. + // + // + // Note that unlike RtlEnumerateGenericTable, this routine will NOT perturb + // the splay order of the tree. + // + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlEnumerateGenericTableWithoutSplaying( + __in PRTL_GENERIC_TABLE Table, + __inout PVOID *RestartKey + ); +#endif + + // + // The function GetElementGenericTable will return the i'th element + // inserted in the generic table. I = 0 implies the first element, + // I = (RtlNumberGenericTableElements(Table)-1) will return the last element + // inserted into the generic table. The type of I is ULONG. Values + // of I > than (NumberGenericTableElements(Table)-1) will return NULL. If + // an arbitrary element is deleted from the generic table it will cause + // all elements inserted after the deleted element to "move up". + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __checkReturn + NTSYSAPI + PVOID + NTAPI + RtlGetElementGenericTable( + __in PRTL_GENERIC_TABLE Table, + __in ULONG I + ); +#endif + + // + // The function NumberGenericTableElements returns a ULONG value + // which is the number of generic table elements currently inserted + // in the generic table. + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + NTSYSAPI + ULONG + NTAPI + RtlNumberGenericTableElements( + __in PRTL_GENERIC_TABLE Table + ); +#endif + + // + // The function IsGenericTableEmpty will return to the caller TRUE if + // the input table is empty (i.e., does not contain any elements) and + // FALSE otherwise. + // + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __checkReturn + NTSYSAPI + BOOLEAN + NTAPI + RtlIsGenericTableEmpty( + __in PRTL_GENERIC_TABLE Table + ); +#endif + +#endif // RTL_USE_AVL_TREES + + // + // Notify filter values + // + + + // + // Key query structures + // + + typedef struct _KEY_BASIC_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG NameLength; + WCHAR Name[1]; // Variable length string + } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION; + + typedef struct _KEY_NODE_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG ClassOffset; + ULONG ClassLength; + ULONG NameLength; + WCHAR Name[1]; // Variable length string + // Class[1]; // Variable length string not declared + } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION; + + typedef struct _KEY_FULL_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG ClassOffset; + ULONG ClassLength; + ULONG SubKeys; + ULONG MaxNameLen; + ULONG MaxClassLen; + ULONG Values; + ULONG MaxValueNameLen; + ULONG MaxValueDataLen; + WCHAR Class[1]; // Variable length + } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION; + + + typedef struct _KEY_WRITE_TIME_INFORMATION { + LARGE_INTEGER LastWriteTime; + } KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION; + + typedef struct _KEY_WOW64_FLAGS_INFORMATION { + ULONG UserFlags; + } KEY_WOW64_FLAGS_INFORMATION, *PKEY_WOW64_FLAGS_INFORMATION; + + typedef struct _KEY_HANDLE_TAGS_INFORMATION { + ULONG HandleTags; + } KEY_HANDLE_TAGS_INFORMATION, *PKEY_HANDLE_TAGS_INFORMATION; + + typedef struct _KEY_CONTROL_FLAGS_INFORMATION { + ULONG ControlFlags; + } KEY_CONTROL_FLAGS_INFORMATION, *PKEY_CONTROL_FLAGS_INFORMATION; + + + // + // Value entry query structures + // + + typedef struct _KEY_VALUE_BASIC_INFORMATION { + ULONG TitleIndex; + ULONG Type; + ULONG NameLength; + WCHAR Name[1]; // Variable size + } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION; + + typedef struct _KEY_VALUE_FULL_INFORMATION { + ULONG TitleIndex; + ULONG Type; + ULONG DataOffset; + ULONG DataLength; + ULONG NameLength; + WCHAR Name[1]; // Variable size + // Data[1]; // Variable size data not declared + } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION; + + typedef struct _KEY_VALUE_PARTIAL_INFORMATION { + ULONG TitleIndex; + ULONG Type; + ULONG DataLength; + UCHAR Data[1]; // Variable size + } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION; + + typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 { + ULONG Type; + ULONG DataLength; + UCHAR Data[1]; // Variable size + } KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64; + + typedef struct _KEY_VALUE_ENTRY { + PUNICODE_STRING ValueName; + ULONG DataLength; + ULONG DataOffset; + ULONG Type; + } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY; + + typedef enum _KEY_VALUE_INFORMATION_CLASS { + KeyValueBasicInformation, + KeyValueFullInformation, + KeyValuePartialInformation, + KeyValueFullInformationAlign64, + KeyValuePartialInformationAlign64, + MaxKeyValueInfoClass // MaxKeyValueInfoClass should always be the last enum + } KEY_VALUE_INFORMATION_CLASS; + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtCreateKey( + _Out_ PHANDLE KeyHandle, + _In_ ACCESS_MASK DesiredAccess, + _In_ POBJECT_ATTRIBUTES ObjectAttributes, + _Reserved_ ULONG TitleIndex, + _In_opt_ PUNICODE_STRING Class, + _In_ ULONG CreateOptions, + _Out_opt_ PULONG Disposition + ); + +#endif + +#if (NTDDI_VERSION >= NTDDI_VISTA) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NtCreateKeyTransacted( + __out PHANDLE KeyHandle, + __in ACCESS_MASK DesiredAccess, + __in POBJECT_ATTRIBUTES ObjectAttributes, + __reserved ULONG TitleIndex, + __in_opt PUNICODE_STRING Class, + __in ULONG CreateOptions, + __in HANDLE TransactionHandle, + __out_opt PULONG Disposition + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtOpenKey( + __out PHANDLE KeyHandle, + __in ACCESS_MASK DesiredAccess, + __in POBJECT_ATTRIBUTES ObjectAttributes + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN7) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtOpenKeyEx( + __out PHANDLE KeyHandle, + __in ACCESS_MASK DesiredAccess, + __in POBJECT_ATTRIBUTES ObjectAttributes, + __in ULONG OpenOptions + ); +#endif + + + +#if (NTDDI_VERSION >= NTDDI_VISTA) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtOpenKeyTransacted( + __out PHANDLE KeyHandle, + __in ACCESS_MASK DesiredAccess, + __in POBJECT_ATTRIBUTES ObjectAttributes, + __in HANDLE TransactionHandle + ); +#endif + + +#if (NTDDI_VERSION >= NTDDI_WIN7) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtOpenKeyTransactedEx( + __out PHANDLE KeyHandle, + __in ACCESS_MASK DesiredAccess, + __in POBJECT_ATTRIBUTES ObjectAttributes, + __in ULONG OpenOptions, + __in HANDLE TransactionHandle + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtDeleteKey( + __in HANDLE KeyHandle + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtDeleteValueKey( + __in HANDLE KeyHandle, + __in PUNICODE_STRING ValueName + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + __drv_when(Length == 0, __drv_valueIs(<0)) + __drv_when(Length>0, __drv_valueIs(<0; == 0)) + NTSYSAPI + NTSTATUS + NTAPI + NtEnumerateKey( + __in HANDLE KeyHandle, + __in ULONG Index, + __in KEY_INFORMATION_CLASS KeyInformationClass, + __out_bcount_opt(Length) PVOID KeyInformation, + __in ULONG Length, + __out PULONG ResultLength + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + __drv_when(Length == 0, __drv_valueIs(<0)) + __drv_when(Length>0, __drv_valueIs(<0; == 0)) + NTSYSAPI + NTSTATUS + NTAPI + NtEnumerateValueKey( + __in HANDLE KeyHandle, + __in ULONG Index, + __in KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, + __out_bcount_opt(Length) PVOID KeyValueInformation, + __in ULONG Length, + __out PULONG ResultLength + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtFlushKey( + __in HANDLE KeyHandle + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN7) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtNotifyChangeMultipleKeys( + __in HANDLE MasterKeyHandle, + __in_opt ULONG Count, + __in_ecount_opt(Count) OBJECT_ATTRIBUTES SubordinateObjects[], + __in_opt HANDLE Event, + __in_opt PIO_APC_ROUTINE ApcRoutine, + __in_opt PVOID ApcContext, + __out PIO_STATUS_BLOCK IoStatusBlock, + __in ULONG CompletionFilter, + __in BOOLEAN WatchTree, + __out_bcount_opt(BufferSize) PVOID Buffer, + __in ULONG BufferSize, + __in BOOLEAN Asynchronous + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN7) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtQueryMultipleValueKey( + __in HANDLE KeyHandle, + __inout_ecount(EntryCount) PKEY_VALUE_ENTRY ValueEntries, + __in ULONG EntryCount, + __out_bcount(*BufferLength) PVOID ValueBuffer, + __inout PULONG BufferLength, + __out_opt PULONG RequiredBufferLength + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + __drv_when(Length == 0, __drv_valueIs(<0)) + __drv_when(Length>0, __drv_valueIs(<0; == 0)) + NTSYSAPI + NTSTATUS + NTAPI + NtQueryKey( + __in HANDLE KeyHandle, + __in KEY_INFORMATION_CLASS KeyInformationClass, + __out_bcount_opt(Length) PVOID KeyInformation, + __in ULONG Length, + __out PULONG ResultLength + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + __drv_when(Length == 0, __drv_valueIs(<0)) + __drv_when(Length>0, __drv_valueIs(<0; == 0)) + NTSYSAPI + NTSTATUS + NTAPI + NtQueryValueKey( + __in HANDLE KeyHandle, + __in PUNICODE_STRING ValueName, + __in KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, + __out_bcount_opt(Length) PVOID KeyValueInformation, + __in ULONG Length, + __out PULONG ResultLength + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN7) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtRenameKey( + __in HANDLE KeyHandle, + __in PUNICODE_STRING NewName + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN7) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtSetInformationKey( + __in HANDLE KeyHandle, + __in KEY_SET_INFORMATION_CLASS KeySetInformationClass, + __in_bcount(KeySetInformationLength) PVOID KeySetInformation, + __in ULONG KeySetInformationLength + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + EXTERN_C + __drv_maxIRQL(PASSIVE_LEVEL) + NTSYSAPI + NTSTATUS + NTAPI + NtSetValueKey( + __in HANDLE KeyHandle, + __in PUNICODE_STRING ValueName, + __in_opt ULONG TitleIndex, + __in ULONG Type, + __in_bcount_opt(DataSize) PVOID Data, + __in ULONG DataSize + ); +#endif + +#define HANDLE_DETACHED_PROCESS (HANDLE)-1 +#define HANDLE_CREATE_NEW_CONSOLE (HANDLE)-2 +#define HANDLE_CREATE_NO_WINDOW (HANDLE)-4 + +#define OBJ_INHERIT 0x00000002L +#define OBJ_PERMANENT 0x00000010L +#define OBJ_EXCLUSIVE 0x00000020L +#define OBJ_CASE_INSENSITIVE 0x00000040L +#define OBJ_OPENIF 0x00000080L +#define OBJ_OPENLINK 0x00000100L +#define OBJ_KERNEL_HANDLE 0x00000200L +#define OBJ_FORCE_ACCESS_CHECK 0x00000400L +#define OBJ_VALID_ATTRIBUTES 0x000007F2L + +#define LDR_IMAGE_IS_DLL 0x00000004 +#define LDR_LOAD_IN_PROGRESS 0x00001000 +#define LDR_UNLOAD_IN_PROGRESS 0x00002000 +#define LDR_NO_DLL_CALLS 0x00040000 +#define LDR_PROCESS_ATTACHED 0x00080000 +#define LDR_MODULE_REBASED 0x00200000 + + EXTERN_C NTSYSAPI NTSTATUS + NTAPI + RtlCreateUserThread( + _In_ HANDLE processHandle, + _In_ SECURITY_DESCRIPTOR* securityDescriptor, + _In_ BOOLEAN createSuspended, + _In_ ULONG stackZeroBits, + _Inout_opt_ size_t* stackReserved, + _Inout_opt_ size_t* stackCommit, + _In_ const void* startAddress, + _In_ void* startParameter, + _Inout_ HANDLE* threadHandle, + _Inout_opt_ CLIENT_ID* clientID + ); + + EXTERN_C NTSYSAPI VOID + NTAPI + RtlExitUserThread( + _In_ NTSTATUS Status + ); + + EXTERN_C NTSYSAPI DWORD NTAPI RtlComputeCrc32 + ( + DWORD dwInitial, + const BYTE* pData, + INT iLen + ); + + EXTERN_C NTSYSAPI NTSTATUS NTAPI NtUnloadKey(IN POBJECT_ATTRIBUTES DestinationKeyName); + + EXTERN_C NTSYSAPI NTSTATUS NTAPI NtUnloadKey2(IN POBJECT_ATTRIBUTES KeyObjectAttributes,IN BOOLEAN ForceUnload); + + EXTERN_C NTSYSAPI NTSTATUS NTAPI NtUnloadKeyEx( IN POBJECT_ATTRIBUTES KeyObjectAttributes, IN HANDLE EventHandle OPTIONAL); + +#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA) + // begin_rev +#define THREAD_CREATE_FLAGS_CREATE_SUSPENDED 0x00000001 +#define THREAD_CREATE_FLAGS_SKIP_THREAD_ATTACH 0x00000002 // ? +#define THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER 0x00000004 +#define THREAD_CREATE_FLAGS_HAS_SECURITY_DESCRIPTOR 0x00000010 // ? +#define THREAD_CREATE_FLAGS_ACCESS_CHECK_IN_TARGET 0x00000020 // ? +#define THREAD_CREATE_FLAGS_INITIAL_THREAD 0x00000080 + + typedef struct _PS_ATTRIBUTE + { + ULONG Attribute; + SIZE_T Size; + union + { + ULONG Value; + PVOID ValuePtr; + }; + PSIZE_T ReturnLength; + } PS_ATTRIBUTE, *PPS_ATTRIBUTE; + + typedef struct _PS_ATTRIBUTE_LIST + { + SIZE_T TotalLength; + PS_ATTRIBUTE Attributes[1]; + } PS_ATTRIBUTE_LIST, *PPS_ATTRIBUTE_LIST; + + + EXTERN_C NTSYSCALLAPI NTSTATUS NTAPI NtCreateThreadEx( + _Out_ PHANDLE ThreadHandle, + _In_ ACCESS_MASK DesiredAccess, + _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes, + _In_ HANDLE ProcessHandle, + _In_ PVOID StartRoutine, // PUSER_THREAD_START_ROUTINE + _In_opt_ PVOID Argument, + _In_ ULONG CreateFlags, // THREAD_CREATE_FLAGS_* + _In_ SIZE_T ZeroBits, + _In_ SIZE_T StackSize, + _In_ SIZE_T MaximumStackSize, + _In_opt_ PPS_ATTRIBUTE_LIST AttributeList + ); +#endif + + //UEFI֧غ + + EXTERN_C NTSYSAPI NTSTATUS NTAPI ZwQueryBootEntryOrder( + OUT PULONG Ids, + IN OUT PULONG Count + ); + + // Firmware Boot Options + typedef struct _BOOT_OPTIONS + { + ULONG Version; + ULONG Length; + ULONG Timeout; + ULONG CurrentBootEntryId; + ULONG NextBootEntryId; + WCHAR HeadlessRedirection[1]; + } BOOT_OPTIONS, *PBOOT_OPTIONS; + + + typedef struct _BOOT_ENTRY + { + //0 + ULONG NextBootEntry; + //4 + + + }BOOT_ENTRY, *PBOOT_ENTRY; + + EXTERN_C NTSYSAPI NTSTATUS NTAPI ZwQueryBootOptions( + OUT PBOOT_OPTIONS BootOptions, + IN OUT PULONG BootOptionsLength + ); + + + EXTERN_C NTSYSAPI + NTSTATUS + NTAPI + ZwSetBootOptions( + IN PBOOT_OPTIONS BootOptions, + IN ULONG FieldsToChange + ); + + EXTERN_C NTSYSAPI + NTSTATUS + NTAPI + ZwEnumerateBootEntries( + __out_bcount_opt(*BufferLength) PVOID Buffer, + __inout PULONG BufferLength + ); + + EXTERN_C NTSYSAPI + NTSTATUS + NTAPI + ZwAddBootEntry( + __in PBOOT_ENTRY BootEntry, + __out_opt PULONG Id + ); + + + EXTERN_C NTSYSAPI + NTSTATUS + NTAPI + ZwModifyBootEntry( + __in PBOOT_ENTRY BootEntry + ); + + EXTERN_C NTSYSAPI + NTSTATUS + NTAPI + ZwSetBootEntryOrder( + __in_ecount(Count) PULONG Ids, + __in ULONG Count + ); + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSYSAPI +NTSTATUS +NTAPI +ZwSetInformationFile( + _In_ HANDLE FileHandle, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _In_reads_bytes_(Length) PVOID FileInformation, + _In_ ULONG Length, + _In_ FILE_INFORMATION_CLASS FileInformationClass + ); +#endif + +#if (NTDDI_VERSION >= NTDDI_WIN7) +EXTERN_C +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSYSAPI +NTSTATUS +NTAPI +ZwOpenKeyEx( + _Out_ PHANDLE KeyHandle, + _In_ ACCESS_MASK DesiredAccess, + _In_ POBJECT_ATTRIBUTES ObjectAttributes, + _In_ ULONG OpenOptions + ); +#endif + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +_IRQL_requires_max_(PASSIVE_LEVEL) +_When_(Length == 0, _Post_satisfies_(return < 0)) +_When_(Length > 0, _Post_satisfies_(return <= 0)) +_Success_(return == STATUS_SUCCESS) +_On_failure_(_When_(return == STATUS_BUFFER_OVERFLOW || return == STATUS_BUFFER_TOO_SMALL, _Post_satisfies_(*ResultLength > Length))) +NTSYSAPI +NTSTATUS +NTAPI +ZwQueryValueKey( + _In_ HANDLE KeyHandle, + _In_ PUNICODE_STRING ValueName, + _In_ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, + _Out_writes_bytes_to_opt_(Length, *ResultLength) PVOID KeyValueInformation, + _In_ ULONG Length, + _Out_ PULONG ResultLength + ); +#endif + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSYSAPI +NTSTATUS +NTAPI +ZwSetValueKey( + _In_ HANDLE KeyHandle, + _In_ PUNICODE_STRING ValueName, + _In_opt_ ULONG TitleIndex, + _In_ ULONG Type, + _In_reads_bytes_opt_(DataSize) PVOID Data, + _In_ ULONG DataSize + ); +#endif + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSYSAPI +NTSTATUS +NTAPI +ZwQueryInformationFile( + _In_ HANDLE FileHandle, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _Out_writes_bytes_(Length) PVOID FileInformation, + _In_ ULONG Length, + _In_ FILE_INFORMATION_CLASS FileInformationClass + ); +#endif + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +NTSYSAPI +_Must_inspect_result_ +_Ret_maybenull_ +_Post_writable_byte_size_(Size) +PVOID +NTAPI +RtlAllocateHeap( + _In_ PVOID HeapHandle, + _In_opt_ ULONG Flags, + _In_ SIZE_T Size + ); +#endif + + +#if (NTDDI_VERSION >= NTDDI_WIN8) +EXTERN_C +_Success_(return != 0) +NTSYSAPI +LOGICAL +NTAPI +RtlFreeHeap( + _In_ PVOID HeapHandle, + _In_opt_ ULONG Flags, + _Frees_ptr_opt_ PVOID BaseAddress + ); +#else +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +_Success_(return != 0) +NTSYSAPI +BOOLEAN +NTAPI +RtlFreeHeap( + _In_ PVOID HeapHandle, + _In_opt_ ULONG Flags, + _Frees_ptr_opt_ PVOID BaseAddress + ); +#endif // NTDDI_VERSION >= NTDDI_WIN2K +#endif // NTDDI_VERSION >= NTDDI_WIN8 + +#if (NTDDI_VERSION >= NTDDI_WINXP) +EXTERN_C +_Must_inspect_result_ +NTSYSAPI +PVOID +NTAPI +RtlCreateHeap( + _In_ ULONG Flags, + _In_opt_ PVOID HeapBase, + _In_opt_ SIZE_T ReserveSize, + _In_opt_ SIZE_T CommitSize, + _In_opt_ PVOID Lock, + _In_opt_ PRTL_HEAP_PARAMETERS Parameters + ); +#endif // NTDDI_VERSION >= NTDDI_WINXP + +EXTERN_C NTSYSAPI NTSTATUS NTAPI NtLoadKey( + IN POBJECT_ATTRIBUTES DestinationKeyName, + IN POBJECT_ATTRIBUTES HiveFileName); + +EXTERN_C NTSYSAPI NTSTATUS NTAPI ZwLoadKey( + IN POBJECT_ATTRIBUTES DestinationKeyName, + IN POBJECT_ATTRIBUTES HiveFileName); + +EXTERN_C NTSYSAPI NTSTATUS NTAPI ZwUnloadKey(IN POBJECT_ATTRIBUTES DestinationKeyName); + +EXTERN_C NTSYSAPI NTSTATUS NTAPI NtUnloadKey(IN POBJECT_ATTRIBUTES DestinationKeyName); + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSYSAPI +NTSTATUS +NTAPI +ZwWriteFile( + _In_ HANDLE FileHandle, + _In_opt_ HANDLE Event, + _In_opt_ PIO_APC_ROUTINE ApcRoutine, + _In_opt_ PVOID ApcContext, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _In_reads_bytes_(Length) PVOID Buffer, + _In_ ULONG Length, + _In_opt_ PLARGE_INTEGER ByteOffset, + _In_opt_ PULONG Key + ); +#endif + +EXTERN_C +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSYSAPI +NTSTATUS +NTAPI +ZwTerminateProcess( + _In_opt_ HANDLE ProcessHandle, + _In_ NTSTATUS ExitStatus + ); + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +EXTERN_C +__kernel_entry NTSYSCALLAPI +NTSTATUS +NTAPI +NtDeviceIoControlFile ( + _In_ HANDLE FileHandle, + _In_opt_ HANDLE Event, + _In_opt_ PIO_APC_ROUTINE ApcRoutine, + _In_opt_ PVOID ApcContext, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _In_ ULONG IoControlCode, + _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer, + _In_ ULONG InputBufferLength, + _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer, + _In_ ULONG OutputBufferLength + ); +#endif + + +typedef struct +{ + ULONG i[2]; + ULONG buf[4]; + unsigned char in[64]; + unsigned char digest[16]; +} MD5_CTX; + + +EXTERN_C DECLSPEC_IMPORT void __stdcall MD5Init(MD5_CTX* context); + +EXTERN_C DECLSPEC_IMPORT void __stdcall MD5Update(MD5_CTX* context, + unsigned char* input, + unsigned int inlen); + +EXTERN_C DECLSPEC_IMPORT void __stdcall MD5Final(MD5_CTX* context); + + +EXTERN_C +DECLSPEC_IMPORT +NTSTATUS +NTAPI +RtlWow64EnableFsRedirectionEx( + _In_opt_ PVOID Wow64FsEnableRedirection, + _Out_ PVOID* OldFsRedirectionLevel + ); + +EXTERN_C +NTSYSAPI +NTSTATUS +NTAPI +NtCreateKeyedEvent( + OUT PHANDLE handle, + IN ACCESS_MASK access, + IN POBJECT_ATTRIBUTES attr, + IN ULONG flags + ); + +EXTERN_C +NTSYSAPI +NTSTATUS +NTAPI +NtOpenKeyedEvent( + OUT PHANDLE KeyedEventHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL + ); + + +EXTERN_C +NTSYSAPI +NTSTATUS +NTAPI +NtWaitForKeyedEvent( + IN HANDLE KeyedEventHandle, + IN PVOID Key, + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Timeout OPTIONAL + ); + + +EXTERN_C +NTSYSAPI +NTSTATUS +NTAPI +NtReleaseKeyedEvent( + IN HANDLE KeyedEventHandle, + IN PVOID Key, + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Timeout OPTIONAL + ); + +//ָʾǷڽ˳ +EXTERN_C +NTSYSAPI +BOOLEAN +NTAPI +RtlDllShutdownInProgress(); + + +EXTERN_C +NTSTATUS +NTAPI +LdrAddRefDll( + IN ULONG Flags, + IN PVOID BaseAddress + ); + +#if defined __cplusplus && !defined _Disallow_YY_KM_Namespace +} //namespace YY +#endif + +#endif \ No newline at end of file diff --git a/src/msvcrt_forward.def b/src/msvcrt_forward.def index 1240973a2..f729b5e01 100644 Binary files a/src/msvcrt_forward.def and b/src/msvcrt_forward.def differ diff --git a/src/onexit_thunks.cpp b/src/onexit_thunks.cpp deleted file mode 100644 index 517c0e157..000000000 --- a/src/onexit_thunks.cpp +++ /dev/null @@ -1,128 +0,0 @@ - -#include -#include "msvcrt_IAT.h" - -//Ҫlibֱתatexit -//extern "C" int __cdecl _crt_atexit(_PVFV const function); - - -extern "C" int __cdecl _initialize_onexit_table(_onexit_table_t* const table) -{ - if (!table) - { - return -1; - } - - // If the table has already been initialized, do not do anything. Note that - // this handles both the case where the table was value initialized and where - // the table was initialized with encoded null pointers. - if (table->_first != table->_end) - { - return 0; - } - - _PVFV* const encoded_nullptr = __crt_fast_encode_pointer(nullptr); - - table->_first = encoded_nullptr; - table->_last = encoded_nullptr; - table->_end = encoded_nullptr; - - return 0; -} - -extern "C" __declspec(dllimport) _onexit_t __cdecl __dllonexit( - _onexit_t func, - _PVFV ** pbegin, - _PVFV ** pend - ); - -// Appends the given 'function' to the given onexit 'table'. Returns 0 on -// success; returns -1 on failure. In general, failures are considered fatal -// in calling code. -extern "C" int __cdecl _register_onexit_function(_onexit_table_t* const table, _onexit_t const function) -{ - if (!table) - return -1; - - return __acrt_lock_and_call(__acrt_exit_lock, [&]() - { - _PVFV* first = __crt_fast_decode_pointer(table->_first); - _PVFV* end = __crt_fast_decode_pointer(table->_end); - - if (first == nullptr && end == nullptr) - { - //ʼtable32Ԫ - first = (_PVFV*)malloc(32 * sizeof(_PVFV)); - - //ڴʧ - if (!first) - return -1; - - end = first; - } - - auto retval = __dllonexit(function, &first, &end); - - if (!retval) - return -1; - - //ɹ¼ԭʼָ - table->_first = __crt_fast_encode_pointer(first); - table->_end = __crt_fast_encode_pointer(end); - //ʹ_last - //table->_last - return 0; - }); -} - - -// This function executes a table of _onexit()/atexit() functions. The -// terminators are executed in reverse order, to give the required LIFO -// execution order. If the table is uninitialized, this function has no -// effect. After executing the terminators, this function resets the table -// so that it is uninitialized. Returns 0 on success; -1 on failure. -extern "C" int __cdecl _execute_onexit_table(_onexit_table_t* const table) -{ - if (!table) - { - return -1; - } - - return __acrt_lock_and_call(__acrt_exit_lock, [&]() - { - _PVFV* first = __crt_fast_decode_pointer(table->_first); - _PVFV* end = __crt_fast_decode_pointer(table->_end); - if (!first || first == reinterpret_cast<_PVFV*>(-1)) - { - return 0; - } - - _PVFV const encoded_nullptr = __crt_fast_encode_pointer(nullptr); - - for (auto last=end-1; last>= first;--last) - { - if (*last != encoded_nullptr) - { - (*last)(); - } - } - - //ͷڴ - free(first); - - //table - table->_first = (_PVFV*)encoded_nullptr; - table->_last = (_PVFV*)encoded_nullptr; - table->_end = (_PVFV*)encoded_nullptr; - - return 0; - }); -} - -extern "C" _onexit_table_t __acrt_at_quick_exit_table{}; - - -extern "C" int __cdecl _crt_at_quick_exit(_PVFV const function) -{ - return _register_onexit_function(&__acrt_at_quick_exit_table, reinterpret_cast<_onexit_t>(function)); -} diff --git a/src/ucrt/inc/corecrt_internal.h b/src/ucrt/inc/corecrt_internal.h index 4f1dbd0f0..0e2b7f400 100644 --- a/src/ucrt/inc/corecrt_internal.h +++ b/src/ucrt/inc/corecrt_internal.h @@ -1485,6 +1485,48 @@ extern "C++" action, [lock_id]() { __acrt_unlock(lock_id); }); } + + template + auto __YY_exit_lock_and_call(void* __lock, Action&& action) throw() + -> decltype(action()) + { + decltype(action()) result{}; + const LONG CurrentThreadId = GetCurrentThreadId(); + LONG OldCurrentThreadId; + + for (;;) + { + OldCurrentThreadId = InterlockedCompareExchange((volatile LONG*)__lock, CurrentThreadId, 0); + + if (OldCurrentThreadId == 0) + { + //ɹ + break; + } + else if (OldCurrentThreadId == CurrentThreadId) + { + //뵱ǰ߳Idһ£ٴ + break; + } + else + { + //ȴͬź + Sleep(0); + } + } + + __try + { + result = action(); + } + __finally + { + if (OldCurrentThreadId == 0) + InterlockedExchange((volatile LONG*)__lock, 0); + } + + return result; + } } #endif @@ -2556,7 +2598,9 @@ typedef enum process_end_policy_exit_process } process_end_policy; -process_end_policy __cdecl __acrt_get_process_end_policy(void); +//process_end_policy __cdecl __acrt_get_process_end_policy(void); +//VC-LTLֻڴͳWin32Ӧãֱprocess_end_policy_exit_processԼɡ +#define __acrt_get_process_end_policy() process_end_policy_exit_process // Specifies whether RoInitialize() should be called when creating a thread typedef enum diff --git a/src/ucrt/internal/initialization.cpp b/src/ucrt/internal/initialization.cpp index da4534597..3bc0b9a71 100644 --- a/src/ucrt/internal/initialization.cpp +++ b/src/ucrt/internal/initialization.cpp @@ -17,7 +17,7 @@ extern "C" { -//extern _onexit_table_t __acrt_atexit_table; +extern _onexit_table_t __acrt_atexit_table; extern _onexit_table_t __acrt_at_quick_exit_table; extern void* __acrt_stdout_buffer; extern void* __acrt_stderr_buffer; @@ -82,7 +82,7 @@ static bool __cdecl initialize_global_variables() static bool __cdecl initialize_c() { - //_initialize_onexit_table(&__acrt_atexit_table); + _initialize_onexit_table(&__acrt_atexit_table); _initialize_onexit_table(&__acrt_at_quick_exit_table); return true; } @@ -152,10 +152,10 @@ static bool __cdecl uninitialize_environment(bool const terminating) static bool __cdecl initialize_pointers() { void* const encoded_null = __crt_fast_encode_pointer(nullptr); - __acrt_initialize_invalid_parameter_handler(encoded_null); - __acrt_initialize_new_handler(encoded_null); - __acrt_initialize_signal_handlers(encoded_null); - __acrt_initialize_user_matherr(encoded_null); + //__acrt_initialize_invalid_parameter_handler(encoded_null); + //__acrt_initialize_new_handler(encoded_null); + //__acrt_initialize_signal_handlers(encoded_null); + //__acrt_initialize_user_matherr(encoded_null); __acrt_initialize_thread_local_exit_callback(encoded_null); return true; } @@ -228,7 +228,7 @@ static __acrt_initializer const __acrt_initializers[] = // Global pointers are stored in encoded form; they must be dynamically // initialized to the encoded nullptr value before they are used by the CRT. - //{ initialize_pointers, nullptr }, + { initialize_pointers, nullptr }, // Enclaves only require initializers for supported features. #ifndef _UCRT_ENCLAVE_BUILD { __acrt_initialize_winapi_thunks, __acrt_uninitialize_winapi_thunks }, diff --git a/src/ucrt/startup/exit.cpp b/src/ucrt/startup/exit.cpp index 260ebe676..c6b4b1be5 100644 --- a/src/ucrt/startup/exit.cpp +++ b/src/ucrt/startup/exit.cpp @@ -5,9 +5,11 @@ // // The exit() implementation // -#include -#include -#include +#define _Disallow_YY_KM_Namespace +#define FLG_APPLICATION_VERIFIER 0x00000100 // user mode only +#define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock) + +#include #include #include #include @@ -198,12 +200,14 @@ static void __cdecl common_exit( // Run the C termination: bool crt_uninitialization_required = false; - __acrt_lock_and_call(__acrt_select_exit_lock(), [&] + static LONG __exit_lock; + + __YY_exit_lock_and_call(&__exit_lock, [&] { static bool c_exit_complete = false; if (c_exit_complete) { - return; + return 0; } _InterlockedExchange(&c_termination_complete, TRUE); @@ -253,6 +257,8 @@ static void __cdecl common_exit( c_exit_complete = true; crt_uninitialization_required = true; } + + return 0; }); // Do NOT try to uninitialize the CRT while holding one of its locks. diff --git a/src/ucrt/startup/onexit.cpp b/src/ucrt/startup/onexit.cpp index d7d77a408..bf61dc657 100644 --- a/src/ucrt/startup/onexit.cpp +++ b/src/ucrt/startup/onexit.cpp @@ -69,7 +69,8 @@ extern "C" int __cdecl _initialize_onexit_table(_onexit_table_t* const table) table->_first = encoded_nullptr; table->_last = encoded_nullptr; - table->_end = encoded_nullptr; + //_endΪ߳idʹá + table->_end = nullptr; return 0; } @@ -81,16 +82,18 @@ extern "C" int __cdecl _initialize_onexit_table(_onexit_table_t* const table) // in calling code. extern "C" int __cdecl _register_onexit_function(_onexit_table_t* const table, _onexit_t const function) { - return __acrt_lock_and_call(__acrt_select_exit_lock(), [&] + if (!table) + { + return -1; + } + + return __YY_exit_lock_and_call(&table->_end, [&] { - if (!table) - { - return -1; - } _PVFV* first = __crt_fast_decode_pointer(table->_first); _PVFV* last = __crt_fast_decode_pointer(table->_last); - _PVFV* end = __crt_fast_decode_pointer(table->_end); + //_PVFV* end = __crt_fast_decode_pointer(table->_end); + _PVFV* end = first ? (first + _msize(first) / sizeof(_PVFV*)) : nullptr; // If there is no room for the new entry, reallocate a larger table: if (last == end) @@ -142,7 +145,7 @@ extern "C" int __cdecl _register_onexit_function(_onexit_table_t* const table, _ table->_first = __crt_fast_encode_pointer(first); table->_last = __crt_fast_encode_pointer(last); - table->_end = __crt_fast_encode_pointer(end); + //table->_end = __crt_fast_encode_pointer(end); return 0; }); @@ -157,13 +160,13 @@ extern "C" int __cdecl _register_onexit_function(_onexit_table_t* const table, _ // so that it is uninitialized. Returns 0 on success; -1 on failure. extern "C" int __cdecl _execute_onexit_table(_onexit_table_t* const table) { - return __acrt_lock_and_call(__acrt_select_exit_lock(), [&] + if (!table) { - if (!table) - { - return -1; - } + return -1; + } + return __YY_exit_lock_and_call(&table->_end, [&] + { _PVFV* first = __crt_fast_decode_pointer(table->_first); _PVFV* last = __crt_fast_decode_pointer(table->_last); if (!first || first == reinterpret_cast<_PVFV*>(-1)) @@ -177,7 +180,7 @@ extern "C" int __cdecl _execute_onexit_table(_onexit_table_t* const table) // are the only non-trivial calls, so we can do this once for the entire // loop.) { - __crt_state_management::scoped_global_state_reset saved_state; + //__crt_state_management::scoped_global_state_reset saved_state; _PVFV const encoded_nullptr = __crt_fast_encode_pointer(nullptr); @@ -224,7 +227,7 @@ extern "C" int __cdecl _execute_onexit_table(_onexit_table_t* const table) table->_first = encoded_nullptr; table->_last = encoded_nullptr; - table->_end = encoded_nullptr; + //table->_end = encoded_nullptr; return 0; }); diff --git a/src/ucrt/ucrt.vcxproj b/src/ucrt/ucrt.vcxproj index ff08505cd..e820d7498 100644 --- a/src/ucrt/ucrt.vcxproj +++ b/src/ucrt/ucrt.vcxproj @@ -643,14 +643,12 @@ - false true - @@ -1119,6 +1117,8 @@ + + true diff --git a/src/ucrt/ucrt.vcxproj.filters b/src/ucrt/ucrt.vcxproj.filters index e030ff439..d0786b4cb 100644 --- a/src/ucrt/ucrt.vcxproj.filters +++ b/src/ucrt/ucrt.vcxproj.filters @@ -420,12 +420,6 @@ ucrt - - ltl - - - ltl - ucrt @@ -585,6 +579,12 @@ ucrt\WinXP + + ucrt + + + ucrt + diff --git a/src/vc_msvcrt.cpp b/src/vc_msvcrt.cpp index 211c9e5b9..964642daa 100644 --- a/src/vc_msvcrt.cpp +++ b/src/vc_msvcrt.cpp @@ -554,18 +554,3 @@ EXTERN_C wchar_t** __cdecl _get_initial_wide_environment(void) } _LCRT_DEFINE_IAT_SYMBOL(_get_initial_wide_environment); - - -typedef int (__cdecl * _crt_atexit_fun)( - void(__cdecl* _Function)(void) - ); - -//将atexit imp版转发到 _crt_atexit -extern "C" extern const _crt_atexit_fun _LCRT_DEFINE_IAT_SYMBOL_MAKE_NAME(atexit); - -extern "C" int __cdecl _crt_atexit( - void(__cdecl* _Function)(void) - ) -{ - return _LCRT_DEFINE_IAT_SYMBOL_MAKE_NAME(atexit)(_Function); -}