[idd] helper: synchronize clipboard files

This commit is contained in:
Geoffrey McRae
2026-08-14 14:42:44 +10:00
parent 9ce121f97e
commit 9679c94b91
4 changed files with 2054 additions and 25 deletions

View File

@@ -19,6 +19,7 @@
*/
#include <Windows.h>
#include <Ole2.h>
#include <wrl.h>
#include <UserEnv.h>
@@ -58,6 +59,11 @@ static HandleT<EventTraits> l_childStopEvent;
static DWORD l_desiredSession = NO_CONSOLE_SESSION;
static DWORD l_childSession = NO_CONSOLE_SESSION;
struct OleScope
{
~OleScope() { OleUninitialize(); }
};
static bool Launch(DWORD sessionId);
static bool StopChild();
@@ -122,6 +128,23 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
}
}
const HRESULT ole = OleInitialize(nullptr);
if (FAILED(ole))
{
DEBUG_ERROR_HR(ole, "Failed to initialize OLE");
return EXIT_FAILURE;
}
const OleScope oleScope;
const HRESULT security = CoInitializeSecurity(nullptr, 0, nullptr, nullptr,
RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IDENTIFY, nullptr, EOAC_NONE,
nullptr);
if (FAILED(security))
{
DEBUG_ERROR_HR(security, "Failed to initialize COM security");
return EXIT_FAILURE;
}
if (!CNotifyWindow::registerClass())
{
DEBUG_ERROR("Failed to register message window class");