Ignore:
Timestamp:
Aug 13, 2006, 10:58:34 PM (19 years ago)
Author:
bird
Message:

Fixed that 'ing hook problem. ARG!!!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/synergy/lib/platform/CPMSynergyHook.cpp

    r2763 r2764  
    9292/** Error description. */
    9393const char          *g_pszErrorMsg;
    94 /** Set if the dummy hook is installed. */
    95 bool                 g_fDummyHook;
    9694/** @} */
    9795
     
    288286
    289287
    290 #define NO_DUMMY_HOOK 1
    291 #ifndef NO_DUMMY_HOOK
    292 /**
    293  * Dummy hook.
    294  */
    295 static VOID EXPENTRY SendMsgHook(HAB hab, PSMHSTRUCT psmh, BOOL fInterTask)
    296 {
    297     /* nop */
    298 }
    299 #endif
    300 
    301 
    302 
    303288//
    304289// external functions
     
    382367    }
    383368
    384 #ifndef NO_DUMMY_HOOK
    385     /*
    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 #endif
    395 
    396369    g_fSynergyInitialized = true;
    397370    return true;
     
    420393    /* parnaoia */
    421394    uninstall(hab);
    422 
    423 #ifndef NO_DUMMY_HOOK
    424     // release the dummy hook.
    425     if (WinReleaseHook(hab, NULLHANDLE, HK_SENDMSG, (PFN)SendMsgHook, g_hmod))
    426         g_fDummyHook = false;
    427 #endif
    428395
    429396    g_hmqSynergy = NULLHANDLE;
     
    564531
    565532
     533//
     534// Message faking.
     535//
     536
    566537/**
    567538 * Hook callback used to insert message into the system queue.
     
    579550static BOOL EXPENTRY MsgInputHook(HAB hab, PQMSG pqmsg, BOOL fSkip, PBOOL pfNoRecord)
    580551{
    581     /*
    582      * FUCKING HELL!
    583      *
    584      * For whatever fucking reason, PM fails to load the hook dll into
    585      * 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 
    599552    /*
    600553     * We've only got one message, so everything is dead simple.
     
    616569    }
    617570
    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);
    624571    return TRUE;
    625572}
Note: See TracChangeset for help on using the changeset viewer.