Skip to content

Commit

Permalink
Fea #66, 让.NET 8/9 支持 Windows XP RTM(Avalonia部分)
Browse files Browse the repository at this point in the history
  - 添加 GetPointerInfoHistory
  - 添加 GetPointerTouchInfo
  - 添加 GetPointerTouchInfoHistory
  - 添加 IsMouseInPointerEnabled
  - 添加 EnableMouseInPointer
  • Loading branch information
mingkuang-Chuyu committed Sep 9, 2024
1 parent 146f311 commit ffde8b1
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ThunksList.md
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,11 @@
| GetWindowDpiAwarenessContext | 调用 GetProcessDpiAwareness。
| GetDisplayAutoRotationPreferences | 返回 ORIENTATION_PREFERENCE_NONE。
| SetDisplayAutoRotationPreferences | 假装成功。
| GetPointerInfoHistory | 报告错误 ERROR_INVALID_PARAMETER。
| GetPointerTouchInfo | 报告错误 ERROR_INVALID_PARAMETER。
| GetPointerTouchInfoHistory | 报告错误 ERROR_INVALID_PARAMETER。
| IsMouseInPointerEnabled | 返回关闭。
| EnableMouseInPointer | 假装处于关闭状态。

## userenv.dll
| 函数 | Fallback
Expand Down
129 changes: 129 additions & 0 deletions src/Thunks/ext-ms-win-rtcore-ntuser-wmpointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,133 @@
return TRUE;
}
#endif


#if (YY_Thunks_Target < __WindowsNT6_2)

// 最低受支持的客户端 Windows 8 [仅限桌面应用]
// 最低受支持的服务器 Windows Server 2012 [仅限桌面应用]
__DEFINE_THUNK(
user32,
12,
BOOL,
WINAPI,
GetPointerInfoHistory,
_In_ UINT32 _uPointerId,
_Inout_ UINT32* _pcEntriesCount,
_Out_writes_opt_(*_pcEntriesCount) POINTER_INFO* _pPointerInfo
)
{
if (const auto _pfnGetPointerInfoHistory = try_get_GetPointerInfoHistory())
{
return _pfnGetPointerInfoHistory(_uPointerId, _pcEntriesCount, _pPointerInfo);
}

SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
#endif


#if (YY_Thunks_Target < __WindowsNT6_2)

// 最低受支持的客户端 Windows 8 [仅限桌面应用]
// 最低受支持的服务器 Windows Server 2012 [仅限桌面应用]
__DEFINE_THUNK(
user32,
8,
BOOL,
WINAPI,
GetPointerTouchInfo,
_In_ UINT32 _uPointerId,
_Out_writes_(1) POINTER_TOUCH_INFO* _pTouchInfo
)
{
if (const auto _pfnGetPointerTouchInfo = try_get_GetPointerTouchInfo())
{
return _pfnGetPointerTouchInfo(_uPointerId, _pTouchInfo);
}

SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
#endif


#if (YY_Thunks_Target < __WindowsNT6_2)

// 最低受支持的客户端 Windows 8 [仅限桌面应用]
// 最低受支持的服务器 Windows Server 2012 [仅限桌面应用]
__DEFINE_THUNK(
user32,
12,
BOOL,
WINAPI,
GetPointerTouchInfoHistory,
_In_ UINT32 _uPointerId,
_Inout_ UINT32* _pcEntriesCount,
_Out_writes_opt_(*_pcEntriesCount) POINTER_TOUCH_INFO* _pTouchInfo
)
{
if (const auto _pfnGetPointerTouchInfoHistory = try_get_GetPointerTouchInfoHistory())
{
return _pfnGetPointerTouchInfoHistory(_uPointerId, _pcEntriesCount, _pTouchInfo);
}

SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
#endif


#if (YY_Thunks_Target < __WindowsNT6_2)

// 最低受支持的客户端 Windows 8 [仅限桌面应用]
// 最低受支持的服务器 Windows Server 2012 [仅限桌面应用]
__DEFINE_THUNK(
user32,
0,
BOOL,
WINAPI,
IsMouseInPointerEnabled
)
{
if (const auto _pfnIsMouseInPointerEnabled = try_get_IsMouseInPointerEnabled())
{
return _pfnIsMouseInPointerEnabled();
}

SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
#endif


#if (YY_Thunks_Target < __WindowsNT6_2)

// 最低受支持的客户端 Windows 8 [仅限桌面应用]
// 最低受支持的服务器 Windows Server 2012 [仅限桌面应用]
__DEFINE_THUNK(
user32,
4,
BOOL,
WINAPI,
EnableMouseInPointer,
_In_ BOOL _bEnable
)
{
if (const auto _pfnEnableMouseInPointer = try_get_EnableMouseInPointer())
{
return _pfnEnableMouseInPointer(_bEnable);
}

if (_bEnable == FALSE)
{
return TRUE;
}

SetLastError(ERROR_ACCESS_DENIED);
return FALSE;
}
#endif
}

0 comments on commit ffde8b1

Please sign in to comment.