MSIX: keep PowerRename local COM server in memory (#1222)

This commit is contained in:
Andrey Nekrasov
2020-02-07 14:21:10 +03:00
committed by GitHub
parent 09d1af9c46
commit f963d28ba8

View File

@@ -18,7 +18,8 @@ void ModuleRelease()
{ {
if (--g_dwModuleRefCount == 0) if (--g_dwModuleRefCount == 0)
{ {
PostThreadMessage(main_thread_id, WM_QUIT, 0, 0); // Do nothing and keep the COM server in memory forever. We might want to introduce delayed shutdown and/or
// periodic polling whether a user has disabled us in settings. Tracking this in #1217
} }
} }
HINSTANCE g_hInst = 0; HINSTANCE g_hInst = 0;
@@ -95,9 +96,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
main_thread_id = GetCurrentThreadId(); main_thread_id = GetCurrentThreadId();
winrt::init_apartment(); winrt::init_apartment();
g_hInst = hInstance; g_hInst = hInstance;
auto factory = std::make_unique<CPowerRenameClassLocalFactory>(CLSID_PowerRenameMenu); CPowerRenameClassLocalFactory factory{CLSID_PowerRenameMenu};
DWORD token; DWORD token;
if (!SUCCEEDED(CoRegisterClassObject(CLSID_PowerRenameMenu, factory.get(), CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &token))) if (!SUCCEEDED(CoRegisterClassObject(CLSID_PowerRenameMenu, &factory, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &token)))
{ {
return 1; return 1;
} }