diff --git a/Readme.md b/Readme.md index 3b70b2a..05303eb 100644 --- a/Readme.md +++ b/Readme.md @@ -99,6 +99,17 @@ Compatible with all platforms. * All runtime modes are supported (such as: `/MD`, `/MT`, `/MDd`, `/MTd`). ### 3.2. Windows SDK Version Requirements +| Thunks Target | At Least Windows SDK Version is required +| ------------------ | ----------- +| Windows 2000 | SDK 6.0 (VS2008 built-in) +| Windows XP(2003) | SDK 6.0 (VS2008 built-in) +| Windows Vista | SDK 6.0 (VS2008 built-in) +| Windows 7 | SDK 7.0 +| Windows 8 | SDK 8.0 +| Windows 8.1 | SDK 8.1 +| Windows 10 10240 | SDK 10.0.10240 +| Windows 10 19041 | SDK 10.0.19041 + At least Windows SDK 6.0 is required. > Note: VC6.0 and VS2005 users should note that the SDK version that comes with these compilers by default is too low. diff --git a/Readme.osc.md b/Readme.osc.md index ab29293..f38322e 100644 --- a/Readme.osc.md +++ b/Readme.osc.md @@ -101,7 +101,17 @@ ULONGLONG WINAPI GetTickCount64(VOID) * 所有运行库模式均支持(比如:`/MD`、`/MT`、`/MDd`、`/MTd`)。 ### 3.2. SDK版本要求 -至少需要SDK 6.0(VS2008默认附带) + +| Thunks等级 | 最低SDK要求 +| ------------------ | ----------- +| Windows 2000 | SDK 6.0(VS2008默认附带) +| Windows XP(2003) | SDK 6.0(VS2008默认附带) +| Windows Vista | SDK 6.0(VS2008默认附带) +| Windows 7 | SDK 7.0 +| Windows 8 | SDK 8.0 +| Windows 8.1 | SDK 8.1 +| Windows 10 10240 | SDK 10.0.10240 +| Windows 10 19041 | SDK 10.0.19041 > 温馨提示:VC6.0、VS2005用户请注意,由于这些编译器默认附带的SDK版本太低。请先将SDK升级到6.0或者更高版本,然后再使用YY-Thunks,否则将发生链接失败! 高版本的SDK不影响对老系统的兼容性,请坐和放宽,安心升级。 diff --git a/src/Thunks/YY_Thunks.cpp b/src/Thunks/YY_Thunks.cpp index 96d60d0..9396d18 100644 --- a/src/Thunks/YY_Thunks.cpp +++ b/src/Thunks/YY_Thunks.cpp @@ -4,10 +4,13 @@ YY-Thunks支持的控制宏: 2. __USING_NTDLL_LIB:假定构建环境存在ntdll.lib,这可以减少一些NTDLL相关函数的动态加载。 特殊支持的变通方案: -1. __ENABLE_WORKAROUND_1_GetProcAddress_ProcessPrng +1. __ENABLE_WORKAROUND_ALL +启用所有兼容方案,即__ENABLE_WORKAROUND_1 ~ __ENABLE_WORKAROUND_N,全部开启。 + +2. __ENABLE_WORKAROUND_1_GetProcAddress_ProcessPrng 兼容方案1:让GetProcAddress也能取到ProcessPrng函数地址。某些代码可能强制依赖ProcessPrng。 -2. __ENABLE_WORKAROUND_2_UNNAME_OBJECT_DACL +3. __ENABLE_WORKAROUND_2_UNNAME_OBJECT_DACL 兼容方案2:Windows 8.1以前的版本对于匿名对象无法生效DACL。就会导致Chrome的CheckPlatformHandlePermissionsCorrespondToMode判断不准确。 修复方案通过给匿名对象创建一个名字解决该问题。 @@ -133,15 +136,25 @@ YY-Thunks支持的控制宏: #define __WarningMessage__(msg) __pragma(message (__FILE__ "(" STRING(__LINE__) "): warning Thunks: " # msg)) #endif -#if defined(__APPLY_CHROMIUM_WORKAROUNDS) -#ifndef __ENABLE_WORKAROUND_1_GetProcAddress_ProcessPrng -#define __ENABLE_WORKAROUND_1_GetProcAddress_ProcessPrng +#if !defined(__ENABLE_WORKAROUND_1_GetProcAddress_ProcessPrng) && (defined(__ENABLE_WORKAROUND_ALL) || defined(__APPLY_CHROMIUM_WORKAROUNDS)) +#define __ENABLE_WORKAROUND_1_GetProcAddress_ProcessPrng 1 #endif -#ifndef __ENABLE_WORKAROUND_2_UNNAME_OBJECT_DACL -#define __ENABLE_WORKAROUND_2_UNNAME_OBJECT_DACL +#if !defined(__ENABLE_WORKAROUND_2_UNNAME_OBJECT_DACL) && (defined(__ENABLE_WORKAROUND_ALL) || defined(__APPLY_CHROMIUM_WORKAROUNDS)) +#define __ENABLE_WORKAROUND_2_UNNAME_OBJECT_DACL 1 +#endif + +#ifndef __FALLBACK_PREFIX +#define __FALLBACK_PREFIX +#define __YY_Thunks_libs 0 +#else +#define __YY_Thunks_libs 1 +#endif + +#if !defined(__USING_NTDLL_LIB) && (__YY_Thunks_libs || YY_Thunks_Support_Version >= NTDDI_WIN10) +// lib模式下必然存在 ntdll.lib,此外最小支持Windows 10时,我们因为强制依赖Windows 10 SDK,所以也必然存在ntdll.lib。 +#define __USING_NTDLL_LIB 1 #endif -#endif // defined(__APPLY_CHROMIUM_WORKAROUNDS) #define _Disallow_YY_KM_Namespace #include "km.h" @@ -230,13 +243,6 @@ RtlCutoverTimeToSystemTime( #include -#ifndef __FALLBACK_PREFIX -#define __FALLBACK_PREFIX -#define __YY_Thunks_libs 0 -#else -#define __YY_Thunks_libs 1 -#endif - //展开函数的所有的 声明 以及 try_get_ 函数 #define __DEFINE_THUNK_EXTERN_PREFIX(_PREFIX, _MODULE, _SIZE, _RETURN_, _CONVENTION_, _FUNCTION, ...) \ __APPLY_UNIT_TEST_BOOL(_FUNCTION); \ diff --git a/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj b/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj index 96cca1d..2805b23 100644 --- a/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj +++ b/src/YY-Thunks.UnitTest/YY-Thunks.UnitTest.vcxproj @@ -96,7 +96,7 @@ true true $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - SymbolBuildTestPath=LR"($(ProjectDir)TestProject\)";YY_ThunksRootPath=LR"($(ProjectDir)..\..\)";MSBuildBinPath=LR"($(MSBuildBinPath)\)";__YY_Thunks_Unit_Test;WIN32;NDEBUG;YY_Thunks_Support_Version=NTDDI_WIN2K;__APPLY_CHROMIUM_WORKAROUNDS;__USING_NTDLL_LIB;%(PreprocessorDefinitions) + SymbolBuildTestPath=LR"($(ProjectDir)TestProject\)";YY_ThunksRootPath=LR"($(ProjectDir)..\..\)";MSBuildBinPath=LR"($(MSBuildBinPath)\)";__YY_Thunks_Unit_Test;WIN32;NDEBUG;YY_Thunks_Support_Version=NTDDI_WIN2K;__ENABLE_WORKAROUND_ALL;__USING_NTDLL_LIB;%(PreprocessorDefinitions) true pch.h Use @@ -117,7 +117,7 @@ Level3 $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - SymbolBuildTestPath=LR"($(ProjectDir)TestProject\)";YY_ThunksRootPath=LR"($(ProjectDir)..\..\)";MSBuildBinPath=LR"($(MSBuildBinPath)\)";__YY_Thunks_Unit_Test;WIN32;_DEBUG;YY_Thunks_Support_Version=NTDDI_WIN2K;__APPLY_CHROMIUM_WORKAROUNDS;__USING_NTDLL_LIB;%(PreprocessorDefinitions) + SymbolBuildTestPath=LR"($(ProjectDir)TestProject\)";YY_ThunksRootPath=LR"($(ProjectDir)..\..\)";MSBuildBinPath=LR"($(MSBuildBinPath)\)";__YY_Thunks_Unit_Test;WIN32;_DEBUG;YY_Thunks_Support_Version=NTDDI_WIN2K;__ENABLE_WORKAROUND_ALL;__USING_NTDLL_LIB;%(PreprocessorDefinitions) true pch.h Use