Ignore:
Timestamp:
Nov 12, 2003, 3:13:26 PM (22 years ago)
Author:
sandervl
Message:

Visible & Clip region changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/inituser32.cpp

    r10284 r10316  
    1 /* $Id: inituser32.cpp,v 1.16 2003-10-22 12:43:13 sandervl Exp $ */
     1/* $Id: inituser32.cpp,v 1.17 2003-11-12 14:10:19 sandervl Exp $ */
    22/*
    33 * USER32 DLL entry point
     
    7171extern INT __cdecl wsnprintfA(LPSTR,UINT,LPCSTR,...);
    7272
    73 static char PMKBDHK_MODULE[16] = STD_PMKBDHK_MODULE;
    74 
    75 static BOOL pmkbdhk_installed = FALSE;
    76 static HMODULE hmodPMKBDHK;
    77 
    78 static PFN_HOOKINIT pfnHookInit = NULL;
    79 static PFN_HOOKTERM pfnHookTerm = NULL;
    80 
    81 // defined initialized in pmwindow.cpp: InitPM()
    82 extern HAB hab;
    83 
    84 //******************************************************************************
    85 //******************************************************************************
    86 void WIN32API SetCustomPMHookDll(LPSTR pszKbdDllName)
    87 {
    88    strcpy(PMKBDHK_MODULE, pszKbdDllName);
    89 }
    90 //******************************************************************************
    91 //******************************************************************************
    92 void pmkbdhk_initialize(HAB _hab)
    93 {
    94   APIRET rc;
    95 
    96   if ((pmkbdhk_installed == FALSE) && PMKBDHK_MODULE[0])
    97   {
    98     CHAR szBuf[260];
    99 
    100     // load the DLL
    101     rc = DosLoadModule(szBuf,
    102                        sizeof(szBuf),
    103                        PMKBDHK_MODULE,
    104                        &hmodPMKBDHK);
    105     if (NO_ERROR != rc)
    106     {
    107       dprintf(("USER32: pmkbdhk_initalize(%08xh) failed rc=%d\n",
    108                _hab,
    109                rc));
    110 
    111       return;
    112     }
    113 
    114     // get the entry points
    115     rc = DosQueryProcAddr(hmodPMKBDHK,
    116                           0,
    117                           PMKBDHK_HOOK_INIT,
    118                           (PFN*)&pfnHookInit);
    119     if (NO_ERROR == rc)
    120       rc = DosQueryProcAddr(hmodPMKBDHK,
    121                             0,
    122                             PMKBDHK_HOOK_TERM,
    123                             (PFN*)&pfnHookTerm);
    124 
    125     if (NO_ERROR != rc)
    126     {
    127       dprintf(("USER32: pmkbdhk_initalize(%08xh) failed importing functions, rc=%d\n",
    128                _hab,
    129                rc));
    130 
    131       // free the DLL again
    132       DosFreeModule(hmodPMKBDHK);
    133       hmodPMKBDHK = NULLHANDLE;
    134 
    135       return;
    136     }
    137 
    138     // now finally call the initializer function
    139     if(pfnHookInit(_hab, WIN32_STDCLASS) == FALSE) DebugInt3();
    140 
    141     // OK, hook is armed
    142     pmkbdhk_installed = TRUE;
    143   }
    144 }
    145 //******************************************************************************
    146 //******************************************************************************
    147 void pmkbdhk_terminate(void)
    148 {
    149   if (pmkbdhk_installed == TRUE)
    150   {
    151     // call the terminator function
    152     pfnHookTerm();
    153 
    154     // OK, hook is disarmed
    155     pmkbdhk_installed = FALSE;
    156   }
    157 
    158   // unload the dll
    159   if (NULLHANDLE != hmodPMKBDHK)
    160   {
    161     APIRET rc = DosFreeModule(hmodPMKBDHK);
    162     if (NO_ERROR != rc)
    163     {
    164       dprintf(("USER32: pmkbdhk_terminate() failed rc=%d\n",
    165                rc));
    166 
    167       hmodPMKBDHK = NULLHANDLE;
    168     }
    169   }
    170 }
    17173//******************************************************************************
    17274#define FONTSDIRECTORY "Fonts"
     
    261163           return 0UL;
    262164
    263          // try to install the keyboard hook
    264          pmkbdhk_initialize(hab);
    265 
    266165         InitializeWindowHandles();
    267166
     
    298197{
    299198  dprintf(("user32 exit\n"));
    300 
    301   // try to unistall the keyboard hook
    302   pmkbdhk_terminate();
    303199
    304200//SvL: Causes PM hangs on some (a lot?) machines. Reason unknown.
Note: See TracChangeset for help on using the changeset viewer.