总众所周知Windows XP每个SP都会新增大量API,而Windows 10每次更新又会新增大量API,这使得兼容不同版本的Windows需要大量的判断。
甚至大量开源代码已经不再兼容一些早期的Windows XP版本,比如 Windows XP RTM。难道就没有一种快速高效的方案解决无法定位程序输入点的问题吗?
YY-Thunks(鸭船),存在的目的就是抹平不同系统的差异,编译时单纯添加一个obj即可自动解决这些兼容性问题。让你兼容Windows更轻松!
[ 鸭船交流群 633710173 ]
使用LoadLibrary
以及GetProcAddress
动态加载API,不存在时做出补偿措施,最大限度模拟原始API行为,让你的程序正常运行。
- 更快!更安全!
鸭船
内建2级缓存以及按需加载机制,同时自动加密所有函数指针,防止内存爆破攻击。最大程度减少不需要的、不必要的LoadLibrary以及GetProcAddress
调用以及潜在安全风险。 - 轻松兼容Windows XP,让你安心专注于业务逻辑。
- 完全的开放代码,广泛的接受用户意见,希望大家能踊跃的 pull requests,为
鸭船
添砖加瓦。
1:下载YY-Thunks-Binary,然后解压到你的工程目录。
2:【链接器】-【输入】-【附加依赖项】,添加objs\$(PlatformShortName)\YY_Thunks_for_WinXP.obj
。
3:重新编译代码。
全平台ABI兼容。
- 所有Visual Studio版本均支持(比如:VC6.0、VS2008、VS2010、VS2015、VS2017等等)。
- 所有运行库模式均支持(比如:
/MD
、/MT
、/MDd
、/MTd
)。
此表展示了YY-Thunks(鸭船)可以解决的函数不存在问题,欢迎大家扩充!
开头带
*
的函数并不建议使用,仅用于编译通过处理,如果使用可能导致老版本系统无法充分发挥性能。
函数 | Fallback |
---|---|
DecodePointer | 不存在时,返回指针本身。 |
EncodePointer | 不存在时,返回指针本身。 |
RegDeleteKeyExW(A) | 不存在时,调用RegDeleteKeyW(A)。 |
Wow64DisableWow64FsRedirection | 不存在时,返回FALSE,并设置 LastError = ERROR_INVALID_FUNCTION。 |
Wow64RevertWow64FsRedirection | 不存在时,返回FALSE,并设置 LastError = ERROR_INVALID_FUNCTION。 |
Wow64EnableWow64FsRedirection | 不存在时,返回FALSE,并设置 LastError = ERROR_INVALID_FUNCTION。 |
IsWow64Process | 不存在时,返回TRUE,并设置 *Wow64Process = FALSE 。 |
IsWow64Message | 不存在时,返回FALSE。 |
RegSetKeyValueW(A) | 调用RegCreateKeyExW(A)以及RegSetValueExW(A)实现。 |
RegDeleteKeyValueW(A) | 调用RegOpenKeyExW(A)以及RegDeleteValueW(A)实现。 |
RegDeleteTreeW(A) | 调用SHDeleteKeyW(A)实现。 |
IsWow64Process2 | 不存在时,调用IsWow64Process。 |
IsWow64GuestMachineSupported | 不存在时,调用GetNativeSystemInfo。 |
GetTickCount64 | 不存在时,调用GetTickCount。 |
GetSystemTimePreciseAsFileTime | 不存在时,调用GetSystemTimeAsFileTime。 |
InitializeCriticalSectionEx | 不存在时,调用InitializeCriticalSectionAndSpinCount。 |
InitOnceExecuteOnce | 不存在时,调用自旋锁(InterlockedCompareExchange)。 |
*GetCurrentProcessorNumber | 不存在时,返回0。 |
*GetCurrentProcessorNumberEx | 不存在时,调用GetCurrentProcessorNumber。 |
*GetNumaNodeProcessorMask | 不存在时,返回FALSE,并设置 LastError = ERROR_INVALID_PARAMETER。 |
*GetNumaNodeProcessorMaskEx | 不存在时,调用GetNumaNodeProcessorMask。 |
*SetThreadGroupAffinity | 不存在时,调用SetThreadAffinityMask。 |
- 添加IsWow64Process2
- 添加IsWow64GuestMachineSupported
- 添加GetTickCount64
- 添加GetSystemTimePreciseAsFileTime
- 添加InitializeCriticalSectionEx
- 添加InitOnceExecuteOnce
- 添加GetCurrentProcessorNumber
- 添加GetCurrentProcessorNumberEx
- 添加GetNumaNodeProcessorMask
- 添加GetNumaNodeProcessorMaskEx
- 添加SetThreadGroupAffinity
- 添加RegSetKeyValueW(A)
- 添加RegDeleteKeyValueW(A)
- 添加RegDeleteTreeW(A)
- YY-Thunks第一版