Resend: PATCH: Convert HACCEL to a void*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

any problems with this patch?

bye
	michael

On Sat, Aug 10, 2002 at 07:27:25PM +0200, Michael Stefaniuc wrote:
> On Sat, Aug 10, 2002 at 01:17:09PM +0200, Michael Stefaniuc wrote:
> > Some additional informations to the attached patch:
> > - dosn't use the macros from wownt32.h like described in bug #90 because
> >   this would mean to link against wow32.dll and Alexandre dosn't seem to
> >   like it. The HACCEL_{16,32} macros used are functionaly equivalent to
> >   what's in wownt32.h .
> > - internaly wine uses HACCEL16 (but passes only HACCEL between the
> >   funtions). I didn't changed that due to following comments:
> >   /* YES, Accel16! */
> > 
> > License: LGPL, X11
> > Changelog:
> >     Michael Stefaniuc <mstefani@redhat.com>
> >     - Convert HACCEL to a void*
> > 
> > bye
> > 	michael
> 

-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.144
diff -u -r1.144 menu.c
--- controls/menu.c	4 Jun 2002 23:08:16 -0000	1.144
+++ controls/menu.c	10 Aug 2002 10:54:17 -0000
@@ -51,6 +51,8 @@
 WINE_DEFAULT_DEBUG_CHANNEL(menu);
 WINE_DECLARE_DEBUG_CHANNEL(accel);
 
+#define HACCEL_16(h32)		(LOWORD(h32))
+
 /* internal popup menu window messages */
 
 #define MM_SETMENUHANDLE	(WM_USER + 0)
@@ -4995,7 +4997,7 @@
         WARN_(accel)("msg null; should hang here to be win compatible\n");
         return 0;
     }
-    if (!hAccel || !(lpAccelTbl = (LPACCEL16) LockResource16(hAccel)))
+    if (!hAccel || !(lpAccelTbl = (LPACCEL16) LockResource16(HACCEL_16(hAccel))))
     {
         WARN_(accel)("invalid accel handle=%x\n", hAccel);
         return 0;
Index: dlls/ole32/ole2.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2.c,v
retrieving revision 1.32
diff -u -r1.32 ole2.c
--- dlls/ole32/ole2.c	31 May 2002 23:25:50 -0000	1.32
+++ dlls/ole32/ole2.c	10 Aug 2002 10:54:19 -0000
@@ -48,6 +48,8 @@
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 WINE_DECLARE_DEBUG_CHANNEL(accel);
 
+#define HACCEL_16(h32)		(LOWORD(h32))
+
 /******************************************************************************
  * These are static/global variables and internal data structures that the
  * OLE module uses to maintain it's state.
@@ -1431,7 +1433,7 @@
     int i;
 
     if(!lpMsg) return FALSE;
-    if (!hAccel || !(lpAccelTbl = (LPACCEL16)LockResource16(hAccel)))
+    if (!hAccel || !(lpAccelTbl = (LPACCEL16)LockResource16(HACCEL_16(hAccel))))
     {
 	WARN_(accel)("invalid accel handle=%04x\n", hAccel);
 	return FALSE;
Index: dlls/user/msg16.c
===================================================================
RCS file: /home/wine/wine/dlls/user/msg16.c,v
retrieving revision 1.10
diff -u -r1.10 msg16.c
--- dlls/user/msg16.c	5 Jul 2002 00:23:02 -0000	1.10
+++ dlls/user/msg16.c	10 Aug 2002 10:54:21 -0000
@@ -30,6 +30,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(msg);
 
+#define HACCEL_32(h16)		((HACCEL)(ULONG_PTR)(h16))
+
 DWORD USER16_AlertableWait = 0;
 
 /***********************************************************************
@@ -449,7 +451,7 @@
     /* msg32.hwnd not used */
     msg32.wParam  = msg->wParam;
     msg32.lParam  = msg->lParam;
-    return TranslateAccelerator( WIN_Handle32(hwnd), hAccel, &msg32 );
+    return TranslateAccelerator( WIN_Handle32(hwnd), HACCEL_32(hAccel), &msg32 );
 }
 
 
Index: dlls/user/resource.c
===================================================================
RCS file: /home/wine/wine/dlls/user/resource.c,v
retrieving revision 1.12
diff -u -r1.12 resource.c
--- dlls/user/resource.c	31 May 2002 23:40:53 -0000	1.12
+++ dlls/user/resource.c	10 Aug 2002 10:54:21 -0000
@@ -30,6 +30,10 @@
 WINE_DEFAULT_DEBUG_CHANNEL(resource);
 WINE_DECLARE_DEBUG_CHANNEL(accel);
 
+/* HANDLE16 <-> HANDLE conversions */
+#define HACCEL_32(h16)		((HACCEL)(ULONG_PTR)(h16))
+#define HACCEL_16(h32)		(LOWORD(h32))
+
 /* this is the 8 byte accel struct used in Win32 resources (internal only) */
 typedef struct
 {
@@ -70,7 +74,8 @@
 HACCEL WINAPI LoadAcceleratorsW(HINSTANCE instance,LPCWSTR lpTableName)
 {
     HRSRC hRsrc;
-    HACCEL hMem,hRetval=0;
+    HACCEL hMem;
+    HACCEL16 hRetval=0;
     DWORD size;
 
     if (HIWORD(lpTableName))
@@ -103,7 +108,7 @@
       }
     }
     TRACE_(accel)("returning HACCEL 0x%x\n", hRsrc);
-    return hRetval;
+    return HACCEL_32(hRetval);
 }
 
 /***********************************************************************
@@ -144,7 +149,7 @@
 				     INT entries)
 {
   int i,xsize;
-  LPACCEL16 accel = (LPACCEL16)GlobalLock16(src);
+  LPACCEL16 accel = (LPACCEL16)GlobalLock16(HACCEL_16(src));
   BOOL done = FALSE;
 
   /* Do parameter checking to avoid the explosions and the screaming
@@ -154,7 +159,7 @@
 	 (LPVOID)src, (LPVOID)dst, entries);
     return 0;
   }
-  xsize = GlobalSize16(src)/sizeof(ACCEL16);
+  xsize = GlobalSize16(HACCEL_16(src))/sizeof(ACCEL16);
   if (xsize>entries) entries=xsize;
 
   i=0;
@@ -213,7 +218,7 @@
 
 
   /* Allocate memory and copy the table. */
-  hAccel = GlobalAlloc16(0,cEntries*sizeof(ACCEL16));
+  hAccel = HACCEL_32(GlobalAlloc16(0,cEntries*sizeof(ACCEL16)));
 
   TRACE_(accel)("handle %x\n", hAccel);
   if(!hAccel) {
@@ -221,7 +226,7 @@
     SetLastError(ERROR_NOT_ENOUGH_MEMORY);
     return (HACCEL)NULL;
   }
-  accel = GlobalLock16(hAccel);
+  accel = GlobalLock16(HACCEL_16(hAccel));
   for (i=0;i<cEntries;i++) {
   	accel[i].fVirt = lpaccel[i].fVirt;
   	accel[i].key = lpaccel[i].key;
@@ -259,7 +264,7 @@
 
 
   /* Allocate memory and copy the table. */
-  hAccel = GlobalAlloc16(0,cEntries*sizeof(ACCEL16));
+  hAccel = HACCEL_32(GlobalAlloc16(0,cEntries*sizeof(ACCEL16)));
 
   TRACE_(accel)("handle %x\n", hAccel);
   if(!hAccel) {
@@ -267,7 +272,7 @@
     SetLastError(ERROR_NOT_ENOUGH_MEMORY);
     return (HACCEL)NULL;
   }
-  accel = GlobalLock16(hAccel);
+  accel = GlobalLock16(HACCEL_16(hAccel));
 
 
   for (i=0;i<cEntries;i++) {
@@ -303,7 +308,7 @@
  */
 BOOL WINAPI DestroyAcceleratorTable( HACCEL handle )
 {
-    return !GlobalFree16(handle);
+    return !GlobalFree16(HACCEL_16(handle));
 }
 
 /**********************************************************************
Index: include/windef.h
===================================================================
RCS file: /home/wine/wine/include/windef.h,v
retrieving revision 1.68
diff -u -r1.68 windef.h
--- include/windef.h	29 Jul 2002 00:14:59 -0000	1.68
+++ include/windef.h	10 Aug 2002 10:54:21 -0000
@@ -71,7 +71,7 @@
 /* Handle types that exist both in Win16 and Win32. */
 
 typedef int HFILE;
-DECLARE_OLD_HANDLE(HACCEL);
+DECLARE_HANDLE(HACCEL);
 DECLARE_OLD_HANDLE(HBITMAP);
 DECLARE_OLD_HANDLE(HBRUSH);
 DECLARE_HANDLE(HCOLORSPACE);

Attachment: pgp00037.pgp
Description: PGP signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux