Skip to content

Commit

Permalink
* Fea #66, 让.NET 8/9 支持 Windows XP RTM(部分)
Browse files Browse the repository at this point in the history
  - 添加 SetProcessWorkingSetSizeEx
  - 添加 GetProcessWorkingSetSizeEx
  • Loading branch information
mingkuang-Chuyu committed May 6, 2024
1 parent b1cb7cb commit b355301
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ThunksList.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
| K32EnumPageFilesW(A) | 调用EnumPageFilesW(A)。
| K32GetProcessImageFileNameW(A) | 调用GetProcessImageFileNameW(A)。
| K32GetProcessMemoryInfo | 调用GetProcessMemoryInfo。
| K32EnumProcesses | 调用EnumProcesses。
| K32GetModuleInformation | 调用GetModuleInformation。
| QueryFullProcessImageNameW(A) | 不存在时,调用GetProcessImageFileNameW(A) 或者 GetModuleFileNameExW(A)。
| CreateFile2 | 不存在时,调用CreateFileW。
| CreateEventExW(A) | 不存在时,调用CreateEventW(A)。
Expand Down Expand Up @@ -348,6 +350,8 @@
| GetCalendarInfoEx | 不存在时,调用GetCalendarInfoW。
| GetNLSVersionEx | 不存在时,返回一个假版本。
| IsNLSDefinedString | 不存在时,调用GetStringTypeW。
| SetProcessWorkingSetSizeEx | 不存在时,调用SetProcessWorkingSetSize。
| GetProcessWorkingSetSizeEx | 不存在时,调用GetProcessWorkingSetSize。

## mfplat.dll
| 函数 | Fallback
Expand Down
55 changes: 54 additions & 1 deletion src/Thunks/api-ms-win-core-memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,5 +573,58 @@ namespace YY
return TRUE;
}
#endif


#if (YY_Thunks_Support_Version < NTDDI_WS03)

// 最低受支持的客户端 Windows Vista [桌面应用 | UWP 应用]
// 最低受支持的服务器 Windows Server 2003[桌面应用 | UWP 应用]
__DEFINE_THUNK(
kernel32,
16,
BOOL,
WINAPI,
SetProcessWorkingSetSizeEx,
_In_ HANDLE _hProcess,
_In_ SIZE_T _uMinimumWorkingSetSize,
_In_ SIZE_T _uMaximumWorkingSetSize,
_In_ DWORD _fFlags
)
{
if (const auto _pfnSetProcessWorkingSetSizeEx = try_get_SetProcessWorkingSetSizeEx())
{
return _pfnSetProcessWorkingSetSizeEx(_hProcess, _uMinimumWorkingSetSize, _uMaximumWorkingSetSize, _fFlags);
}

return SetProcessWorkingSetSize(_hProcess, _uMinimumWorkingSetSize, _uMaximumWorkingSetSize);
}
#endif


#if (YY_Thunks_Support_Version < NTDDI_WS03)

// 最低受支持的客户端 Windows Vista [桌面应用 | UWP 应用]
// 最低受支持的服务器 Windows Server 2003[桌面应用 | UWP 应用]
__DEFINE_THUNK(
kernel32,
16,
BOOL,
WINAPI,
GetProcessWorkingSetSizeEx,
_In_ HANDLE _hProcess,
_Out_ PSIZE_T _puMinimumWorkingSetSize,
_Out_ PSIZE_T _puMaximumWorkingSetSize,
_Out_ PDWORD _pfFlags
)
{
if (const auto _pfnGetProcessWorkingSetSizeEx = try_get_GetProcessWorkingSetSizeEx())
{
return _pfnGetProcessWorkingSetSizeEx(_hProcess, _puMinimumWorkingSetSize, _puMaximumWorkingSetSize, _pfFlags);
}

*_pfFlags = 0;
return GetProcessWorkingSetSize(_hProcess, _puMinimumWorkingSetSize, _puMaximumWorkingSetSize);
}
#endif
}
}
}

0 comments on commit b355301

Please sign in to comment.