Changeset 7155 for trunk/src/user32/inituser32.cpp
- Timestamp:
- Oct 23, 2001, 1:17:18 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/inituser32.cpp
r6650 r7155 1 /* $Id: inituser32.cpp,v 1. 5 2001-09-05 13:53:50 birdExp $ */1 /* $Id: inituser32.cpp,v 1.6 2001-10-22 23:13:58 phaller Exp $ */ 2 2 /* 3 3 * USER32 DLL entry point … … 28 28 #define INCL_DOSSEMAPHORES 29 29 #define INCL_DOSMISC 30 #define INCL_DOSERRORS 30 31 #include <os2wrap.h> //Odin32 OS/2 api wrappers 31 32 #include <stdlib.h> … … 64 65 DWORD hInstanceUser32 = 0; 65 66 67 68 /**************************************************************/ 69 /* Try to load the Presentation Manager Keyboard Hook module. */ 70 /* If this fails, some hotkeys may not arrive properly at the */ 71 /* targetted window, but no more harmful things will happen. */ 72 /**************************************************************/ 73 #define PMKBDHK_MODULE "PMKBDHK" 74 #define PMKBDHK_HOOK_INIT "hookInit" 75 #define PMKBDHK_HOOK_TERM "hookKill" 76 77 static BOOL pmkbdhk_installed = FALSE; 78 static HMODULE hmodPMKBDHK; 79 80 static PVOID (*APIENTRY pfnHookInit)(HAB); 81 static BOOL (*APIENTRY pfnHookTerm)(void); 82 83 // defined initialized in pmwindow.cpp: InitPM() 84 extern HAB hab; 85 86 void pmkbdhk_initialize(HAB _hab) 87 { 88 APIRET rc; 89 90 if (pmkbdhk_installed == FALSE) 91 { 92 CHAR szBuf[260]; 93 94 // load the DLL 95 rc = DosLoadModule(szBuf, 96 sizeof(szBuf), 97 PMKBDHK_MODULE, 98 &hmodPMKBDHK); 99 if (NO_ERROR != rc) 100 { 101 dprintf(("USER32: pmkbdhk_initalize(%08xh) failed rc=%d\n", 102 _hab, 103 rc)); 104 105 return; 106 } 107 108 // get the entry points 109 rc = DosQueryProcAddr(hmodPMKBDHK, 110 0, 111 PMKBDHK_HOOK_INIT, 112 (PFN*)&pfnHookInit); 113 if (NO_ERROR == rc) 114 rc = DosQueryProcAddr(hmodPMKBDHK, 115 0, 116 PMKBDHK_HOOK_TERM, 117 (PFN*)&pfnHookTerm); 118 119 if (NO_ERROR != rc) 120 { 121 dprintf(("USER32: pmkbdhk_initalize(%08xh) failed importing functions, rc=%d\n", 122 _hab, 123 rc)); 124 125 // free the DLL again 126 DosFreeModule(hmodPMKBDHK); 127 hmodPMKBDHK = NULLHANDLE; 128 129 return; 130 } 131 132 // now finally call the initializer function 133 pfnHookInit(_hab); 134 135 // OK, hook is armed 136 pmkbdhk_installed = TRUE; 137 } 138 } 139 140 void pmkbdhk_terminate(void) 141 { 142 if (pmkbdhk_installed == TRUE) 143 { 144 // call the terminator function 145 pfnHookTerm(); 146 147 // OK, hook is disarmed 148 pmkbdhk_installed = TRUE; 149 } 150 151 // unload the dll 152 if (NULLHANDLE != hmodPMKBDHK) 153 { 154 APIRET rc = DosFreeModule(hmodPMKBDHK); 155 if (NO_ERROR != rc) 156 { 157 dprintf(("USER32: pmkbdhk_terminate() failed rc=%d\n", 158 rc)); 159 160 hmodPMKBDHK = NULLHANDLE; 161 } 162 } 163 } 164 165 66 166 /****************************************************************************/ 67 167 /* _DLL_InitTerm is the function that gets called by the operating system */ … … 103 203 104 204 //SvL: Init win32 PM classes 105 if(InitPM() == FALSE) { 106 return 0UL; 107 } 205 //PH: initializes HAB! 206 if (FALSE == InitPM()) 207 return 0UL; 208 209 // try to install the keyboard hook 210 pmkbdhk_initialize(hab); 108 211 109 212 //SvL: 18-7-'98, Register system window classes (button, listbox etc etc) … … 114 217 MONITOR_Initialize(&MONITOR_PrimaryMonitor); 115 218 116 break; 117 case 1 : 219 break; 220 221 222 case 1 : 118 223 if(hInstanceUser32) { 119 224 UnregisterLxDll(hInstanceUser32); … … 132 237 void APIENTRY cleanupUser32(ULONG ulReason) 133 238 { 134 dprintf(("user32 exit\n")); 239 dprintf(("user32 exit\n")); 240 241 // try to unistall the keyboard hook 242 pmkbdhk_terminate(); 243 135 244 //SvL: Causes PM hangs on some (a lot?) machines. Reason unknown. 136 245 //// RestoreCursor();
Note:
See TracChangeset
for help on using the changeset viewer.