Changeset 10316 for trunk/src/user32/inituser32.cpp
- Timestamp:
- Nov 12, 2003, 3:13:26 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/inituser32.cpp
r10284 r10316 1 /* $Id: inituser32.cpp,v 1.1 6 2003-10-22 12:43:13sandervl Exp $ */1 /* $Id: inituser32.cpp,v 1.17 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 /* 3 3 * USER32 DLL entry point … … 71 71 extern INT __cdecl wsnprintfA(LPSTR,UINT,LPCSTR,...); 72 72 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 DLL101 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 points115 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 again132 DosFreeModule(hmodPMKBDHK);133 hmodPMKBDHK = NULLHANDLE;134 135 return;136 }137 138 // now finally call the initializer function139 if(pfnHookInit(_hab, WIN32_STDCLASS) == FALSE) DebugInt3();140 141 // OK, hook is armed142 pmkbdhk_installed = TRUE;143 }144 }145 //******************************************************************************146 //******************************************************************************147 void pmkbdhk_terminate(void)148 {149 if (pmkbdhk_installed == TRUE)150 {151 // call the terminator function152 pfnHookTerm();153 154 // OK, hook is disarmed155 pmkbdhk_installed = FALSE;156 }157 158 // unload the dll159 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 }171 73 //****************************************************************************** 172 74 #define FONTSDIRECTORY "Fonts" … … 261 163 return 0UL; 262 164 263 // try to install the keyboard hook264 pmkbdhk_initialize(hab);265 266 165 InitializeWindowHandles(); 267 166 … … 298 197 { 299 198 dprintf(("user32 exit\n")); 300 301 // try to unistall the keyboard hook302 pmkbdhk_terminate();303 199 304 200 //SvL: Causes PM hangs on some (a lot?) machines. Reason unknown.
Note:
See TracChangeset
for help on using the changeset viewer.