Load Rstrtmgr dynamically.

This commit is contained in:
John Preston 2020-09-25 19:41:39 +03:00
parent 1e31cda78d
commit 90c0929407
4 changed files with 2 additions and 50 deletions

View File

@ -70,11 +70,6 @@ f_PropVariantToString PropVariantToString;
f_PSStringFromPropertyKey PSStringFromPropertyKey;
f_DwmIsCompositionEnabled DwmIsCompositionEnabled;
f_DwmSetWindowAttribute DwmSetWindowAttribute;
f_RmStartSession RmStartSession;
f_RmRegisterResources RmRegisterResources;
f_RmGetList RmGetList;
f_RmShutdown RmShutdown;
f_RmEndSession RmEndSession;
f_GetProcessMemoryInfo GetProcessMemoryInfo;
f_SetWindowCompositionAttribute SetWindowCompositionAttribute;
@ -127,13 +122,6 @@ void start() {
const auto LibDwmApi = SafeLoadLibrary(u"dwmapi.dll"_q);
LoadMethod(LibDwmApi, "DwmIsCompositionEnabled", DwmIsCompositionEnabled);
LoadMethod(LibDwmApi, "DwmSetWindowAttribute", DwmSetWindowAttribute);
const auto LibRstrtMgr = SafeLoadLibrary(u"rstrtmgr.dll"_q);
LoadMethod(LibRstrtMgr, "RmStartSession", RmStartSession);
LoadMethod(LibRstrtMgr, "RmRegisterResources", RmRegisterResources);
LoadMethod(LibRstrtMgr, "RmGetList", RmGetList);
LoadMethod(LibRstrtMgr, "RmShutdown", RmShutdown);
LoadMethod(LibRstrtMgr, "RmEndSession", RmEndSession);
}
const auto LibPsApi = SafeLoadLibrary(u"psapi.dll"_q);

View File

@ -158,42 +158,6 @@ using f_DwmSetWindowAttribute = HRESULT(FAR STDAPICALLTYPE*)(
DWORD cbAttribute);
extern f_DwmSetWindowAttribute DwmSetWindowAttribute;
// RSTRTMGR.DLL
using f_RmStartSession = DWORD(FAR STDAPICALLTYPE*)(
_Out_ DWORD *pSessionHandle,
_Reserved_ DWORD dwSessionFlags,
_Out_writes_(CCH_RM_SESSION_KEY + 1) WCHAR strSessionKey[]);
extern f_RmStartSession RmStartSession;
using f_RmRegisterResources = DWORD(FAR STDAPICALLTYPE*)(
_In_ DWORD dwSessionHandle,
_In_ UINT nFiles,
_In_reads_opt_(nFiles) LPCWSTR rgsFileNames[],
_In_ UINT nApplications,
_In_reads_opt_(nApplications) RM_UNIQUE_PROCESS rgApplications[],
_In_ UINT nServices,
_In_reads_opt_(nServices) LPCWSTR rgsServiceNames[]);
extern f_RmRegisterResources RmRegisterResources;
using f_RmGetList = DWORD(FAR STDAPICALLTYPE*)(
_In_ DWORD dwSessionHandle,
_Out_ UINT *pnProcInfoNeeded,
_Inout_ UINT *pnProcInfo,
_Inout_updates_opt_(*pnProcInfo) RM_PROCESS_INFO rgAffectedApps[],
_Out_ LPDWORD lpdwRebootReasons);
extern f_RmGetList RmGetList;
using f_RmShutdown = DWORD(FAR STDAPICALLTYPE*)(
_In_ DWORD dwSessionHandle,
_In_ ULONG lActionFlags,
_In_opt_ RM_WRITE_STATUS_CALLBACK fnStatus);
extern f_RmShutdown RmShutdown;
using f_RmEndSession = DWORD(FAR STDAPICALLTYPE*)(
_In_ DWORD dwSessionHandle);
extern f_RmEndSession RmEndSession;
// PSAPI.DLL
using f_GetProcessMemoryInfo = BOOL(FAR STDAPICALLTYPE*)(

@ -1 +1 @@
Subproject commit 8609bff8bd418be81f4ed52060576e5d06e4b9a4
Subproject commit c886914f8992614aac5717c858ac2a231ca86a08

2
cmake

@ -1 +1 @@
Subproject commit fb7924a6ffeeaec17ed39203f49fb72dd9eff60f
Subproject commit c9d1ac50d3ed77f424f5a8e12c9924df2c35440c