ole32/ole2.c
Ge van Geldorp
ge at gse.nl
Wed Jan 28 06:25:17 CST 2004
Changelog:
DLL separation: don't depend on user32-internal implementation
of accelerator tables
Index: dlls/ole32/ole2.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2.c,v
retrieving revision 1.48
diff -u -r1.48 ole2.c
--- dlls/ole32/ole2.c 8 Dec 2003 22:46:08 -0000 1.48
+++ dlls/ole32/ole2.c 28 Jan 2004 12:22:23 -0000
@@ -1419,14 +1419,13 @@
*/
BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* lpwCmd)
{
- /* YES, Accel16! */
- LPACCEL16 lpAccelTbl;
+ LPACCEL lpAccelTbl;
int i;
if(!lpMsg) return FALSE;
- if (!hAccel || !(lpAccelTbl = (LPACCEL16)LockResource16(HACCEL_16(hAccel))))
+ if (!hAccel)
{
- WARN_(accel)("invalid accel handle=%p\n", hAccel);
+ WARN_(accel)("NULL accel handle\n");
return FALSE;
}
if((lpMsg->message != WM_KEYDOWN &&
@@ -1434,6 +1433,16 @@
lpMsg->message != WM_SYSKEYDOWN &&
lpMsg->message != WM_SYSKEYUP &&
lpMsg->message != WM_CHAR)) return FALSE;
+ lpAccelTbl = HeapAlloc(GetProcessHeap(), 0, cAccelEntries * sizeof(ACCEL));
+ if (NULL == lpAccelTbl)
+ {
+ return FALSE;
+ }
+ if (CopyAcceleratorTableW(hAccel, lpAccelTbl, cAccelEntries) != cAccelEntries)
+ {
+ WARN_(accel)("CopyAcceleratorTableW failed\n");
+ return FALSE;
+ }
TRACE_(accel)("hAccel=%p, cAccelEntries=%d,"
"msg->hwnd=%p, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
@@ -1480,10 +1489,12 @@
}
WARN_(accel)("couldn't translate accelerator key\n");
+ HeapFree(GetProcessHeap(), 0, lpAccelTbl);
return FALSE;
found:
if(lpwCmd) *lpwCmd = lpAccelTbl[i].cmd;
+ HeapFree(GetProcessHeap(), 0, lpAccelTbl);
return TRUE;
}
More information about the wine-patches
mailing list