Giter VIP home page Giter VIP logo

yy-thunks's Introduction

YY-Thunks——让兼容Windows更轻松

1. 关于YY-Thunks

总众所周知Windows XP每个SP都会新增大量API,而Windows 10每次更新又会新增大量API,这使得兼容不同版本的Windows需要大量的判断。

甚至大量开源代码已经不再兼容一些早期的Windows XP版本,比如 Windows XP RTM。难道就没有一种快速高效的方案解决无法定位程序输入点的问题吗?

YY-Thunks(鸭船),存在的目的就是抹平不同系统的差异,编译时单纯添加一个obj即可自动解决这些兼容性问题。让你兼容Windows更轻松!

[ 鸭船交流群 633710173 ]

1.1. 原理

使用LoadLibrary以及GetProcAddress动态加载API,不存在时做出补偿措施,最大限度模拟原始API行为,让你的程序正常运行。

1.2. 亮点

  • 更快!更安全!鸭船内建2级缓存以及按需加载机制,同时自动加密所有函数指针,防止内存爆破攻击。最大程度减少不需要的、不必要的LoadLibrary以及GetProcAddress调用以及潜在安全风险。
  • 轻松兼容Windows XP,让你安心专注于业务逻辑。
  • 完全的开放代码,广泛的接受用户意见,希望大家能踊跃的 pull requests,为鸭船添砖加瓦。

2. 使用YY-Thunks

1:下载YY-Thunks-Binary,然后解压到你的工程目录。
2:【链接器】-【输入】-【附加依赖项】,添加objs\$(PlatformShortName)\YY_Thunks_for_WinXP.obj
3:重新编译代码。

3. YY-Thunks兼容性

3.1. 支持的编译器

全平台ABI兼容。

  • 所有Visual Studio版本均支持(比如:VC6.0、VS2008、VS2010、VS2015、VS2017等等)。
  • 所有运行库模式均支持(比如:/MD/MT/MDd/MTd)。

3.2. Thunks清单

此表展示了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。

Changes

1.0.0.3 - 让兼容Windows ARM64更轻松(2018-06-18 11:30)

  • 添加IsWow64Process2
  • 添加IsWow64GuestMachineSupported
  • 添加GetTickCount64
  • 添加GetSystemTimePreciseAsFileTime
  • 添加InitializeCriticalSectionEx
  • 添加InitOnceExecuteOnce
  • 添加GetCurrentProcessorNumber
  • 添加GetCurrentProcessorNumberEx
  • 添加GetNumaNodeProcessorMask
  • 添加GetNumaNodeProcessorMaskEx
  • 添加SetThreadGroupAffinity

1.0.0.2 - 补充API支持(2018-06-01 18:30)

  • 添加RegSetKeyValueW(A)
  • 添加RegDeleteKeyValueW(A)
  • 添加RegDeleteTreeW(A)

1.0.0.1 - 第一版(2018-05-17 19:00)

  • YY-Thunks第一版

yy-thunks's People

Contributors

mingkuang-chuyu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.