Even more misc fixes

Francois Gouget fgouget at free.fr
Thu Jul 26 18:28:47 CDT 2001


On Fri, 27 Jul 2001, Patrik Stridvall wrote:
[...]
> > The volatile stuff in dplay.h is part of the Windows header, you
> > cannot remove it.
> 
> No it isn't. I'm not sure why it was added in the first place.

   I don't have it in my VC6 headers either. But it may be in some more
recent DirectX headers (7 or 8).


[...]
> > Most of these are because of the transition to making HANDLE a void*
> > and compiling with STRICT.
> 
> Yes, I notice this was the case with TIMERPROC casts.
> However it is no so with the HOOKPROC casts,
> and yes it is the same with the real Windows headers.

   ???
   AFAICS there are two versions of HOOKPROC: one for -DSTRICT and a
FARPROC one.


[...]
> But OK I will try and compile with -DSTRICT and see what happends.
> IIRC somebody tried that but it didn't turn out so well.

  That would be me, probably. I started the conversion to -DSTRICT but
then other priorities came up and now it's on the back burner. I will
get back to it eventually but at the current rate it's hard to know when
that will be :-(
  Compiling with -DSTRICT is not that bad: with a relatively simple
patch it compiles (see attachement). Or at least, it used to. But there
are tons of warnings, which means tons of places that need attention and
possibly fixing. That's where the work is.


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                  Hiroshima '45 - Czernobyl '86 - Windows '95
-------------- next part --------------
Index: dlls/winmm/lolvldrv.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/lolvldrv.c,v
retrieving revision 1.22
diff -u -r1.22 lolvldrv.c
--- dlls/winmm/lolvldrv.c	2001/05/22 19:19:50	1.22
+++ dlls/winmm/lolvldrv.c	2001/07/23 23:45:04
@@ -2091,21 +2091,22 @@
 			    DWORD* dwCallback, DWORD* dwInstance, BOOL bFrom32)
 {
     LPWINE_MLD	mld;
+    UINT idx;
 
     mld = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
     if (!mld)	return NULL;
 
     /* find an empty slot in MM_MLDrvs table */
-    for (*hndl = 0; *hndl < MAX_MM_MLDRVS; (*hndl)++) {
-	if (!MM_MLDrvs[*hndl]) break;
+    for (idx = 0; idx < MAX_MM_MLDRVS; idx++) {
+	if (!MM_MLDrvs[idx]) break;
     }
-    if (*hndl == MAX_MM_MLDRVS) {
+    if (idx == MAX_MM_MLDRVS) {
 	/* the MM_MLDrvs table could be made growable in the future if needed */
 	ERR("Too many open drivers\n");
 	return NULL;
     }
-    MM_MLDrvs[*hndl] = mld;
-    *hndl |= 0x8000;
+    MM_MLDrvs[idx] = mld;
+    *hndl = (HANDLE)(idx | 0x8000);
 
     mld->type = type;
     if ((UINT)*hndl < MMDRV_GetNum(type) || HIWORD(*hndl) != 0) {
@@ -2133,8 +2134,8 @@
  */
 void	MMDRV_Free(HANDLE hndl, LPWINE_MLD mld)
 {
-    if (hndl & 0x8000) {
-	unsigned idx = hndl & ~0x8000;
+    if ((UINT)hndl & 0x8000) {
+	unsigned idx = (UINT)hndl & ~0x8000;
 	if (idx < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0])) {
 	    MM_MLDrvs[idx] = NULL;
 	    HeapFree(GetProcessHeap(), 0, mld);
@@ -2214,23 +2215,24 @@
 LPWINE_MLD	MMDRV_Get(HANDLE hndl, UINT type, BOOL bCanBeID)
 {
     LPWINE_MLD	mld = NULL;
+    UINT idx=(UINT)hndl;
 
     assert(type < MMDRV_MAX);
 
-    if ((UINT)hndl >= llTypes[type].wMaxId && 
-	hndl != (UINT16)-1 && hndl != (UINT)-1) {
-	if (hndl & 0x8000) {
-	    hndl &= ~0x8000;
-	    if (hndl < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0])) {
+    if (idx >= llTypes[type].wMaxId && 
+	idx != (UINT16)-1 && idx != (UINT)-1) {
+	if (idx & 0x8000) {
+	    idx &= ~0x8000;
+	    if (idx < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0])) {
 		mld = MM_MLDrvs[hndl];
 		if (!mld || !HeapValidate(GetProcessHeap(), 0, mld) || mld->type != type)
 		    mld = NULL;
 	    }
-	    hndl |= 0x8000;
+	    idx |= 0x8000;
 	}
     }
     if (mld == NULL && bCanBeID) {
-	mld = MMDRV_GetByID((UINT)hndl, type);
+	mld = MMDRV_GetByID(idx, type);
     }
     return mld;
 }


More information about the wine-devel mailing list