From cb7816439657fb5b057d1ff6c8ddfb9cd0a70945 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Mon, 17 May 1999 14:57:59 +0000 Subject: [PATCH] Fixed THUNK_SetDCHook when using native USER. --- if1632/thunk.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/if1632/thunk.c b/if1632/thunk.c index ac1b888a4db..6a371c28b9d 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -525,7 +525,15 @@ BOOL16 WINAPI THUNK_SetDCHook( HDC16 hdc, FARPROC16 proc, DWORD dwHookData ) THUNK *thunk, *oldThunk; if (!defDCHookProc) /* Get DCHook Win16 entry point */ - defDCHookProc = NE_GetEntryPoint( GetModuleHandle16("USER"), 362 ); + { + HMODULE16 hModule = GetModuleHandle16( "USER" ); + NE_MODULE *pModule = NE_GetPtr( hModule ); + + if ( pModule && (pModule->flags & NE_FFLAGS_BUILTIN) ) + defDCHookProc = NE_GetEntryPoint( hModule, 362 ); + else + defDCHookProc = (FARPROC16)-1; + } if (proc != defDCHookProc) { @@ -553,8 +561,11 @@ DWORD WINAPI THUNK_GetDCHook( HDC16 hdc, FARPROC16 *phookProc ) { if (thunk == (THUNK *)DCHook16) { + /* Note: we can only get here when running built-in USER */ + if (!defDCHookProc) /* Get DCHook Win16 entry point */ defDCHookProc = NE_GetEntryPoint(GetModuleHandle16("USER"),362); + *phookProc = defDCHookProc; } else *phookProc = thunk->proc; -- 2.11.4.GIT