1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Install window hooks from presentation window thread

This commit is contained in:
narzoul 2021-03-15 12:33:31 +01:00
parent aecb55286a
commit 5882ef9f9c
2 changed files with 4 additions and 13 deletions

View File

@ -45,7 +45,6 @@ namespace Gdi
PresentationWindow::installHooks(); PresentationWindow::installHooks();
ScrollFunctions::installHooks(); ScrollFunctions::installHooks();
User32WndProcs::installHooks(); User32WndProcs::installHooks();
WinProc::installHooks();
Caret::installHooks(); Caret::installHooks();
Font::installHooks(); Font::installHooks();
} }

View File

@ -2,6 +2,7 @@
#include <Common/Log.h> #include <Common/Log.h>
#include <Dll/Dll.h> #include <Dll/Dll.h>
#include <Gdi/PresentationWindow.h> #include <Gdi/PresentationWindow.h>
#include <Gdi/WinProc.h>
namespace namespace
{ {
@ -91,9 +92,12 @@ namespace
"DDrawCompatMessageWindow", nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, nullptr, nullptr); "DDrawCompatMessageWindow", nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, nullptr, nullptr);
if (!g_messageWindow) if (!g_messageWindow)
{ {
Compat::Log() << "ERROR: Failed to create a message-only window";
return 0; return 0;
} }
Gdi::WinProc::installHooks();
MSG msg = {}; MSG msg = {};
while (GetMessage(&msg, nullptr, 0, 0)) while (GetMessage(&msg, nullptr, 0, 0))
{ {
@ -136,18 +140,6 @@ namespace Gdi
CALL_ORIG_FUNC(RegisterClassA)(&wc); CALL_ORIG_FUNC(RegisterClassA)(&wc);
Dll::createThread(presentationWindowThreadProc, &g_presentationWindowThreadId, THREAD_PRIORITY_TIME_CRITICAL); Dll::createThread(presentationWindowThreadProc, &g_presentationWindowThreadId, THREAD_PRIORITY_TIME_CRITICAL);
int i = 0;
while (!g_messageWindow && i < 1000)
{
Sleep(1);
++i;
}
if (!g_messageWindow)
{
Compat::Log() << "ERROR: Failed to create a message-only window";
}
} }
bool isPresentationWindow(HWND hwnd) bool isPresentationWindow(HWND hwnd)