mirror of
https://github.com/Chuyu-Team/YY-Thunks.git
synced 2026-10-27 04:09:50 +08:00
Fea #29, 添加PowerDeterminePlatformRole,PowerDeterminePlatformRoleEx
This commit is contained in:
@@ -303,6 +303,12 @@
|
||||
| ---- | -----------
|
||||
| PdhAddEnglishCounterW(A) | 不存在时,调用PdhAddCounterW(A)。
|
||||
|
||||
## powrprof.dll
|
||||
| 函数 | Fallback
|
||||
| ---- | -----------
|
||||
| PowerDeterminePlatformRole | 不存在时,返回PlatformRoleDesktop。
|
||||
| PowerDeterminePlatformRoleEx | 不存在时,调用PlatformRoleDesktop。
|
||||
|
||||
## psapi.dll
|
||||
| 函数 | Fallback
|
||||
| ---- | -----------
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
_APPLY(mfplat, "mfplat" , 0 ) \
|
||||
_APPLY(bluetoothapis, "bluetoothapis" , 0 ) \
|
||||
_APPLY(netapi32, "netapi32" , 0 ) \
|
||||
_APPLY(powrprof, "powrprof" , 0 ) \
|
||||
_APPLY(api_ms_win_core_winrt_l1_1_0, "api-ms-win-core-winrt-l1-1-0" , 0 ) \
|
||||
_APPLY(api_ms_win_core_winrt_string_l1_1_0, "api-ms-win-core-winrt-string-l1-1-0", 0 ) \
|
||||
_APPLY(api_ms_win_core_winrt_error_l1_1_0, "api-ms-win-core-winrt-error-l1-1-0" , 0 ) \
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#if (YY_Thunks_Support_Version < NTDDI_WIN8)
|
||||
#include <powrprof.h>
|
||||
#endif
|
||||
|
||||
#if (YY_Thunks_Support_Version < NTDDI_WIN8)
|
||||
#pragma comment(lib, "PowrProf.lib")
|
||||
#endif
|
||||
|
||||
namespace YY
|
||||
{
|
||||
namespace Thunks
|
||||
{
|
||||
#if (YY_Thunks_Support_Version < NTDDI_WIN8)
|
||||
|
||||
// 最低受支持的客户端 Windows 8 [桌面应用|UWP 应用]
|
||||
// 最低受支持的服务器 Windows Server 2012[桌面应用 | UWP 应用]
|
||||
__DEFINE_THUNK(
|
||||
powrprof,
|
||||
4,
|
||||
POWER_PLATFORM_ROLE,
|
||||
WINAPI,
|
||||
PowerDeterminePlatformRoleEx,
|
||||
_In_ ULONG _uVersion
|
||||
)
|
||||
{
|
||||
if (auto const _pfnPowerDeterminePlatformRoleEx = try_get_PowerDeterminePlatformRoleEx())
|
||||
{
|
||||
return _pfnPowerDeterminePlatformRoleEx(_uVersion);
|
||||
}
|
||||
|
||||
if (_uVersion == POWER_PLATFORM_ROLE_V1)
|
||||
{
|
||||
return PowerDeterminePlatformRole();
|
||||
}
|
||||
else
|
||||
{
|
||||
return PlatformRoleUnspecified;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#if (YY_Thunks_Support_Version < NTDDI_VISTA)
|
||||
#include <powrprof.h>
|
||||
#endif
|
||||
|
||||
namespace YY
|
||||
{
|
||||
namespace Thunks
|
||||
{
|
||||
#if (YY_Thunks_Support_Version < NTDDI_VISTA)
|
||||
|
||||
// 最低受支持的客户端 Windows 8 [桌面应用|UWP 应用]
|
||||
// 最低受支持的服务器 Windows Server 2012[桌面应用 | UWP 应用]
|
||||
__DEFINE_THUNK(
|
||||
powrprof,
|
||||
0,
|
||||
POWER_PLATFORM_ROLE,
|
||||
WINAPI,
|
||||
PowerDeterminePlatformRole,
|
||||
)
|
||||
{
|
||||
if (auto const _pfnPowerDeterminePlatformRole = try_get_PowerDeterminePlatformRole())
|
||||
{
|
||||
return _pfnPowerDeterminePlatformRole();
|
||||
}
|
||||
|
||||
// 假定自己没有电池
|
||||
return PlatformRoleDesktop;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -185,6 +185,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Thunks\api-ms-win-core-com.hpp" />
|
||||
<ClInclude Include="..\Thunks\api-ms-win-eventing-provider.hpp" />
|
||||
<ClInclude Include="..\Thunks\api-ms-win-power-base.hpp" />
|
||||
<ClInclude Include="..\Thunks\bcrypt.hpp" />
|
||||
<ClInclude Include="..\Thunks\bluetoothapis.hpp" />
|
||||
<ClInclude Include="..\Thunks\ext-ms-win-ntuser-window.hpp" />
|
||||
@@ -192,6 +193,7 @@
|
||||
<ClInclude Include="..\Thunks\mfplat.hpp" />
|
||||
<ClInclude Include="..\Thunks\netapi32.hpp" />
|
||||
<ClInclude Include="..\Thunks\Pdh.hpp" />
|
||||
<ClInclude Include="..\Thunks\powrprof.hpp" />
|
||||
<ClInclude Include="..\Thunks\userenv.hpp" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="..\Thunks\api-ms-win-core-datetime.hpp" />
|
||||
|
||||
@@ -200,6 +200,12 @@
|
||||
<ClInclude Include="..\Thunks\netapi32.hpp">
|
||||
<Filter>Thunks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Thunks\api-ms-win-power-base.hpp">
|
||||
<Filter>Thunks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Thunks\powrprof.hpp">
|
||||
<Filter>Thunks</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\def\x86\PSAPI2Kernel32.def">
|
||||
|
||||
Reference in New Issue
Block a user