- Timestamp:
- Oct 22, 2003, 2:43:14 PM (22 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/inituser32.cpp
r10277 r10284 1 /* $Id: inituser32.cpp,v 1.1 5 2003-10-20 17:18:30sandervl Exp $ */1 /* $Id: inituser32.cpp,v 1.16 2003-10-22 12:43:13 sandervl Exp $ */ 2 2 /* 3 3 * USER32 DLL entry point … … 42 42 #include <spy.h> 43 43 #include <monitor.h> 44 #include <kbdhook.h> 44 45 #include "pmwindow.h" 45 46 #include "win32wdesktop.h" … … 70 71 extern INT __cdecl wsnprintfA(LPSTR,UINT,LPCSTR,...); 71 72 72 /**************************************************************/ 73 /* Try to load the Presentation Manager Keyboard Hook module. */ 74 /* If this fails, some hotkeys may not arrive properly at the */ 75 /* targetted window, but no more harmful things will happen. */ 76 /**************************************************************/ 77 static char PMKBDHK_MODULE[16] = "PMKBDHK"; 78 #define PMKBDHK_HOOK_INIT "hookInit" 79 #define PMKBDHK_HOOK_TERM "hookKill" 73 static char PMKBDHK_MODULE[16] = STD_PMKBDHK_MODULE; 80 74 81 75 static BOOL pmkbdhk_installed = FALSE; 82 76 static HMODULE hmodPMKBDHK; 83 77 84 static P VOID (*APIENTRY pfnHookInit)(HAB);85 static BOOL (*APIENTRY pfnHookTerm)(void);78 static PFN_HOOKINIT pfnHookInit = NULL; 79 static PFN_HOOKTERM pfnHookTerm = NULL; 86 80 87 81 // defined initialized in pmwindow.cpp: InitPM() … … 94 88 strcpy(PMKBDHK_MODULE, pszKbdDllName); 95 89 } 96 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 } 171 //****************************************************************************** 97 172 #define FONTSDIRECTORY "Fonts" 98 173 #define REGPATH "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" 99 100 //******************************************************************************101 174 //****************************************************************************** 102 175 void MigrateWindowsFonts() … … 145 218 } 146 219 } 147 148 //******************************************************************************149 //******************************************************************************150 void pmkbdhk_initialize(HAB _hab)151 {152 APIRET rc;153 154 if ((pmkbdhk_installed == FALSE) && PMKBDHK_MODULE[0])155 {156 CHAR szBuf[260];157 158 // load the DLL159 rc = DosLoadModule(szBuf,160 sizeof(szBuf),161 PMKBDHK_MODULE,162 &hmodPMKBDHK);163 if (NO_ERROR != rc)164 {165 dprintf(("USER32: pmkbdhk_initalize(%08xh) failed rc=%d\n",166 _hab,167 rc));168 169 return;170 }171 172 // get the entry points173 rc = DosQueryProcAddr(hmodPMKBDHK,174 0,175 PMKBDHK_HOOK_INIT,176 (PFN*)&pfnHookInit);177 if (NO_ERROR == rc)178 rc = DosQueryProcAddr(hmodPMKBDHK,179 0,180 PMKBDHK_HOOK_TERM,181 (PFN*)&pfnHookTerm);182 183 if (NO_ERROR != rc)184 {185 dprintf(("USER32: pmkbdhk_initalize(%08xh) failed importing functions, rc=%d\n",186 _hab,187 rc));188 189 // free the DLL again190 DosFreeModule(hmodPMKBDHK);191 hmodPMKBDHK = NULLHANDLE;192 193 return;194 }195 196 // now finally call the initializer function197 pfnHookInit(_hab);198 199 // OK, hook is armed200 pmkbdhk_installed = TRUE;201 }202 }203 //******************************************************************************204 //******************************************************************************205 void pmkbdhk_terminate(void)206 {207 if (pmkbdhk_installed == TRUE)208 {209 // call the terminator function210 pfnHookTerm();211 212 // OK, hook is disarmed213 pmkbdhk_installed = FALSE;214 }215 216 // unload the dll217 if (NULLHANDLE != hmodPMKBDHK)218 {219 APIRET rc = DosFreeModule(hmodPMKBDHK);220 if (NO_ERROR != rc)221 {222 dprintf(("USER32: pmkbdhk_terminate() failed rc=%d\n",223 rc));224 225 hmodPMKBDHK = NULLHANDLE;226 }227 }228 }229 220 /****************************************************************************/ 230 221 /* _DLL_InitTerm is the function that gets called by the operating system */ -
trunk/src/user32/oslibwin.cpp
r10275 r10284 1 /* $Id: oslibwin.cpp,v 1.14 4 2003-10-20 17:17:22sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.145 2003-10-22 12:43:13 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 6 6 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) 7 7 * Copyright 1999 Daniela Engert (dani@ngrt.de) 8 * 8 * Copyright 2002-2003 Innotek Systemberatung GmbH 9 9 * 10 10 * Project Odin Software License can be found in LICENSE.TXT … … 37 37 #define WS_TOPMOST 0x00200000L 38 38 39 //pmwindow.cpp 40 MRESULT EXPENTRY Win32FrameWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 41 39 42 //****************************************************************************** 40 43 //****************************************************************************** … … 64 67 DWORD classStyle, HWND *hwndFrame) 65 68 { 66 HWND hwndClient;67 ULONG dwFrameStyle = 0;69 HWND hwndClient; 70 ULONG dwFrameStyle = 0; 68 71 69 72 if(pszName && *pszName == 0) { … … 98 101 // a window with WS_CLIPCHILDREN -> result: dialog window won't update groupbox background as groupbox only draws the border 99 102 *hwndFrame = WinCreateWindow(hwndParent, 100 W IN32_STDFRAMECLASS,103 WC_FRAME, 101 104 pszName, (dwWinStyle & ~WS_CLIPCHILDREN), 0, 0, 0, 0, 102 105 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP, 103 106 id, (PVOID)&FCData, NULL); 104 107 108 //We no longer register our own frame window class as there is code in PM 109 //that makes assumptions about frame window class names. 110 //Instead we subclass the frame window right after creating it. 111 if(*hwndFrame) { 112 WinSubclassWindow(*hwndFrame, Win32FrameWindowProc); 113 } 105 114 if(fOS2Look && *hwndFrame) { 106 115 FCData.flCreateFlags = dwOSFrameStyle; … … 118 127 if (hwndParent == HWND_DESKTOP && *hwndFrame) 119 128 OSLibWinCreateInvisibleScroller(*hwndFrame, SBS_VERT); 120 121 129 122 130 if(hwndClient == 0) { -
trunk/src/user32/pmwindow.cpp
r10276 r10284 1 /* $Id: pmwindow.cpp,v 1.22 1 2003-10-20 17:18:14 sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.222 2003-10-22 12:43:14 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 81 81 BOOL fDragDropDisabled = FALSE; 82 82 83 char WIN32_CDCLASS[255] = "Win32CDWindowClass"; 84 char WIN32_STDCLASS[255] = "Win32WindowClass"; 85 char WIN32_STDFRAMECLASS[255] = "Win32FrameClass"; 83 const char WIN32_CDCLASS[] = "Win32CDWindowClass"; 84 char WIN32_STDCLASS[255] = "Win32WindowClass"; 86 85 87 86 #define PMMENU_MINBUTTON 0 … … 106 105 HBITMAP hBmpCloseButtonDown = 0; 107 106 108 staticPFNWP pfnFrameWndProc = NULL;107 PFNWP pfnFrameWndProc = NULL; 109 108 static HWND hwndFocusChange = 0; 110 109 HWND hwndCD = 0; … … 215 214 } 216 215 216 //We no longer register our own frame window class as there is code in PM 217 //that makes assumptions about frame window class names. 218 //Instead we subclass the frame window right after creating it. 217 219 CLASSINFO FrameClassInfo; 218 220 if(!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) { … … 223 225 224 226 dprintf(("WC_FRAME style %x", FrameClassInfo.flClassStyle)); 225 226 // this is our OS/2 window class for frame windows227 if(!WinRegisterClass( /* Register window class */228 hab, /* Anchor block handle */229 (PSZ)WIN32_STDFRAMECLASS, /* Window class name */230 (PFNWP)Win32FrameWindowProc, /* Address of window procedure */231 CS_FRAME,232 FrameClassInfo.cbWindowData))233 {234 dprintf(("WinRegisterClass Win32BaseWindow failed %x", WinGetLastError(hab)));235 return(FALSE);236 }237 227 238 228 // get the screen dimensions and store them … … 506 496 POSTMSG_PACKET *postmsg; 507 497 OSLIBPOINT point, ClientPoint; 508 498 EXCEPTIONREGISTRATIONRECORD exceptRegRec = {0,0}; 499 500 ODIN_SetExceptionHandler(&exceptRegRec); 509 501 // restore our FS selector 510 502 SetWin32TIB(); … … 583 575 RELEASE_WNDOBJ(win32wnd); 584 576 RestoreOS2TIB(); 577 ODIN_UnsetExceptionHandler(&exceptRegRec); 585 578 586 579 #ifdef DEBUG … … 1155 1148 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 1156 1149 RestoreOS2TIB(); 1150 ODIN_UnsetExceptionHandler(&exceptRegRec); 1157 1151 1158 1152 #ifdef DEBUG … … 1166 1160 1167 1161 RestoreOS2TIB(); 1162 ODIN_UnsetExceptionHandler(&exceptRegRec); 1168 1163 1169 1164 #ifdef DEBUG … … 1182 1177 MRESULT rc = 0; 1183 1178 MSG winMsg, *pWinMsg; 1179 EXCEPTIONREGISTRATIONRECORD exceptRegRec = {0,0}; 1184 1180 1185 1181 #ifdef DEBUG … … 1187 1183 #endif 1188 1184 1185 ODIN_SetExceptionHandler(&exceptRegRec); 1189 1186 //Restore our FS selector 1190 1187 SetWin32TIB(); … … 2172 2169 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 2173 2170 RestoreOS2TIB(); 2171 ODIN_UnsetExceptionHandler(&exceptRegRec); 2174 2172 2175 2173 #ifdef DEBUG … … 2182 2180 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 2183 2181 RestoreOS2TIB(); 2182 ODIN_UnsetExceptionHandler(&exceptRegRec); 2184 2183 2185 2184 #ifdef DEBUG … … 2192 2191 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 2193 2192 RestoreOS2TIB(); 2193 ODIN_UnsetExceptionHandler(&exceptRegRec); 2194 2194 2195 2195 //calling WinDefWindowProc here breaks Opera hotlist window (WM_ADJUSTWINDOWPOS) … … 2229 2229 rc = pfnOldWindowProc(hwnd, msg, mp1, mp2); 2230 2230 2231 ODIN_SetExceptionHandler(&exceptRegRec); 2231 2232 SetWin32TIB(); 2232 2233 switch(msg) { … … 2250 2251 if(win32wnd) RELEASE_WNDOBJ(win32wnd); 2251 2252 RestoreOS2TIB(); 2253 ODIN_UnsetExceptionHandler(&exceptRegRec); 2252 2254 return rc; 2253 2255 … … 2464 2466 } 2465 2467 2466 // @@PF Three funcs to override std class names we use in Odin 2467 //****************************************************************************** 2468 //****************************************************************************** 2469 void WIN32API SetCustomCDClassName(LPSTR pszCDClassName) 2470 { 2471 strcpy(WIN32_CDCLASS, pszCDClassName); 2472 } 2473 //****************************************************************************** 2468 //****************************************************************************** 2469 // Override std class names we use in Odin (necessary for keyboard hook) 2474 2470 //****************************************************************************** 2475 2471 void WIN32API SetCustomStdClassName(LPSTR pszStdClassName) 2476 2472 { 2477 2473 strcpy(WIN32_STDCLASS, pszStdClassName); 2478 }2479 //******************************************************************************2480 //******************************************************************************2481 void WIN32API SetCustomStdFrameClassName(LPSTR pszStdFrameClassName)2482 {2483 strcpy(WIN32_STDFRAMECLASS, pszStdFrameClassName);2484 2474 } 2485 2475 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.