Conversion of HACMOBJ to void* (bug #478)

Vincent Béron vberon at mecano.gme.usherb.ca
Tue Mar 26 11:09:50 CST 2002


Eric Pouech a écrit :
> 
> Vincent Béron a écrit :
> >
> > I had to transform acmMetrics16 to a atub (was dubbed "semi-stub")
> > because of an impossibility to convert a HACMOBJ16 (16bit offset
> > pointer, without segment info) to a HACMOBJ (32bit linear pointer): a
> > pointer less or equal than 0x0000ffff would certainly not access the
> > right memory area.
> two points:
> 1/ a handle can have any value... it's up to the DLL to decide what
>    value it really is (pointer, index into an internal array, key
>    to look up in a set...). in msacm case, since 16bit handles are
>    not implemented yet, you cannot really tell
> 2/ you can leave the semi-stub as it is, mainly when the handle is
>    NULL (which is in lots of cases for acmMetrics). However, since
>    no 16 bit handle can be created, acmMetrics16 will only be called
>    with NULL handles, since the semi-stub
> 
> so, I'd propose to let acmMetrics16 call acmMetrics only if hao is 0
> 
> A+

Would this be better?
acmMetrics16 checks if hao is NULL. It calls acmMetrics only if hao is
NULL, otherwise it sets the last error to ERROR_CALL_NOT_IMPLEMENTED and
returns MMSYSERR_ERROR.

Changelog
Vincent Béron <<vberon at mecano.gme.usherb.ca>>

  dlls/msacm: filter.c, format.c, msacm_main.c
  include/msacm.h:
   - Converts HACMOBJ to void*
   - acmMetrics16 calls acmMetrics only if hao is NULL
-------------- next part --------------
diff -ur wine-20020325-2110/dlls/msacm/filter.c patch-HACMOBJ/dlls/msacm/filter.c
--- wine-20020325-2110/dlls/msacm/filter.c	Tue Mar 12 10:37:42 2002
+++ patch-HACMOBJ/dlls/msacm/filter.c	Mon Mar 25 16:36:23 2002
@@ -235,7 +235,7 @@
     if (had) {
 	HACMDRIVERID	hadid;
 
-	if (acmDriverID(had, &hadid, 0) != MMSYSERR_NOERROR)
+	if (acmDriverID((HACMOBJ)had, &hadid, 0) != MMSYSERR_NOERROR)
 	    return MMSYSERR_INVALHANDLE;
 	MSACM_FilterEnumHelper(MSACM_GetDriverID(hadid), had, pafd,
 			       fnCallback, dwInstance, fdwEnum);
diff -ur wine-20020325-2110/dlls/msacm/format.c patch-HACMOBJ/dlls/msacm/format.c
--- wine-20020325-2110/dlls/msacm/format.c	Tue Mar 12 10:37:42 2002
+++ patch-HACMOBJ/dlls/msacm/format.c	Mon Mar 25 16:36:43 2002
@@ -509,7 +509,7 @@
     if (had) {
 	HACMDRIVERID	hadid;
 
-	if (acmDriverID(had, &hadid, 0) != MMSYSERR_NOERROR)
+	if (acmDriverID((HACMOBJ)had, &hadid, 0) != MMSYSERR_NOERROR)
 	    return MMSYSERR_INVALHANDLE;
 	MSACM_FormatEnumHelper(MSACM_GetDriverID(hadid), had, pafd, &wfxRef, 
 			       fnCallback, dwInstance, fdwEnum);
diff -ur wine-20020325-2110/dlls/msacm/msacm_main.c patch-HACMOBJ/dlls/msacm/msacm_main.c
--- wine-20020325-2110/dlls/msacm/msacm_main.c	Tue Mar 12 10:37:42 2002
+++ patch-HACMOBJ/dlls/msacm/msacm_main.c	Tue Mar 26 11:48:05 2002
@@ -76,7 +76,9 @@
 {
   FIXME("(0x%04x, %d, %p): semi-stub\n", hao, uMetric, pMetric);
 
-  return acmMetrics(hao, uMetric, pMetric);
+  if(!hao) return acmMetrics(NULL, uMetric, pMetric);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return MMSYSERR_ERROR;
 }
 
 /***********************************************************************
diff -ur wine-20020325-2110/include/msacm.h patch-HACMOBJ/include/msacm.h
--- wine-20020325-2110/include/msacm.h	Mon Mar 25 16:00:13 2002
+++ patch-HACMOBJ/include/msacm.h	Mon Mar 25 16:30:19 2002
@@ -211,7 +211,7 @@
 DECLARE_HANDLE(HACMDRIVERID);
 DECLARE_HANDLE(HACMDRIVER);
 DECLARE_HANDLE(HACMSTREAM);
-DECLARE_OLD_HANDLE(HACMOBJ);
+DECLARE_HANDLE(HACMOBJ);
 
 /***********************************************************************
  * Callbacks


More information about the wine-patches mailing list