Changeset 2764 for trunk/synergy/lib/platform/CPMSynergyHook.cpp
- Timestamp:
- Aug 13, 2006, 10:58:34 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/synergy/lib/platform/CPMSynergyHook.cpp
r2763 r2764 92 92 /** Error description. */ 93 93 const char *g_pszErrorMsg; 94 /** Set if the dummy hook is installed. */95 bool g_fDummyHook;96 94 /** @} */ 97 95 … … 288 286 289 287 290 #define NO_DUMMY_HOOK 1291 #ifndef NO_DUMMY_HOOK292 /**293 * Dummy hook.294 */295 static VOID EXPENTRY SendMsgHook(HAB hab, PSMHSTRUCT psmh, BOOL fInterTask)296 {297 /* nop */298 }299 #endif300 301 302 303 288 // 304 289 // external functions … … 382 367 } 383 368 384 #ifndef NO_DUMMY_HOOK385 /*386 * Install the fake hook.387 */388 if (g_fDummyHook)389 WinReleaseHook(WinQueryAnchorBlock(HWND_DESKTOP), NULLHANDLE, HK_SENDMSG, (PFN)SendMsgHook, g_hmod);390 g_fDummyHook = WinSetHook(WinQueryAnchorBlock(HWND_DESKTOP), NULLHANDLE, HK_SENDMSG, (PFN)SendMsgHook, g_hmod);391 if (!g_fDummyHook) {392 return false;393 }394 #endif395 396 369 g_fSynergyInitialized = true; 397 370 return true; … … 420 393 /* parnaoia */ 421 394 uninstall(hab); 422 423 #ifndef NO_DUMMY_HOOK424 // release the dummy hook.425 if (WinReleaseHook(hab, NULLHANDLE, HK_SENDMSG, (PFN)SendMsgHook, g_hmod))426 g_fDummyHook = false;427 #endif428 395 429 396 g_hmqSynergy = NULLHANDLE; … … 564 531 565 532 533 // 534 // Message faking. 535 // 536 566 537 /** 567 538 * Hook callback used to insert message into the system queue. … … 579 550 static BOOL EXPENTRY MsgInputHook(HAB hab, PQMSG pqmsg, BOOL fSkip, PBOOL pfNoRecord) 580 551 { 581 /*582 * FUCKING HELL!583 *584 * For whatever fucking reason, PM fails to load the hook dll into585 * a bunch of processes. We still get here for some peculiar reasons,586 * and thus we can try deal with it...587 */588 BOOL fUnload = FALSE;589 HMODULE hmod;590 ULONG offObj, iObj;591 APIRET rc = DosQueryModFromEIP(&hmod, &iObj, 0, NULL, &offObj, (ULONG)&MsgInputHook);592 if (rc != NO_ERROR) {593 if (DosLoadModule(NULL, 0, (PCSZ)"d:/coding/libc/trunk/out/os2.x86/debug/dist/bin/synrgyhk.dll", &hmod)) {594 return FALSE;595 }596 fUnload = TRUE;597 }598 599 552 /* 600 553 * We've only got one message, so everything is dead simple. … … 616 569 } 617 570 618 /*619 * If we loaded the dll we must unload it.620 * Don't wanna have any DLLs stuck in foreign processes.621 */622 if (fUnload)623 DosFreeModule(hmod);624 571 return TRUE; 625 572 }
Note:
See TracChangeset
for help on using the changeset viewer.