diff --git a/dlls/winmm/driver.c b/dlls/winmm/driver.c index ce3e74677f..1af8d057fb 100644 --- a/dlls/winmm/driver.c +++ b/dlls/winmm/driver.c @@ -32,6 +32,8 @@ #include "winemm.h" #include "wine/debug.h" #include "wine/unicode.h" +#include "excpt.h" +#include "wine/exception.h" WINE_DEFAULT_DEBUG_CHANNEL(driver); @@ -75,10 +77,17 @@ LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr) { LPWINE_DRIVER d = (LPWINE_DRIVER)hDrvr; - if (hDrvr && HeapValidate(GetProcessHeap(), 0, d) && d->dwMagic == WINE_DI_MAGIC) { - return d; + __TRY + { + if (d && d->dwMagic != WINE_DI_MAGIC) d = NULL; } - return NULL; + __EXCEPT(NULL) + { + return NULL; + } + __ENDTRY; + + return d; } /************************************************************************** diff --git a/dlls/winmm/lolvldrv.c b/dlls/winmm/lolvldrv.c index 4a7b3b1bbd..209a100b10 100644 --- a/dlls/winmm/lolvldrv.c +++ b/dlls/winmm/lolvldrv.c @@ -30,6 +30,8 @@ #include "winver.h" #include "winemm.h" #include "wine/debug.h" +#include "wine/exception.h" +#include "excpt.h" WINE_DEFAULT_DEBUG_CHANNEL(winmm); @@ -47,7 +49,7 @@ typedef struct tagWINE_LLTYPE { MMDRV_UNMAPFUNC UnMap32ATo16; /* low-func (in .drv) do not match */ LPDRVCALLBACK Callback; /* handles callback for a specified type */ /* those attributes reflect the loaded/current situation for the type */ - UINT wMaxId; /* number of loaded devices (sum across all loaded drivers */ + UINT wMaxId; /* number of loaded devices (sum across all loaded drivers) */ LPWINE_MLD lpMlds; /* "static" mlds to access the part though device IDs */ int nMapper; /* index to mapper */ } WINE_LLTYPE; @@ -441,8 +443,15 @@ LPWINE_MLD MMDRV_Get(HANDLE _hndl, UINT type, BOOL bCanBeID) hndl = hndl & ~0x8000; if (hndl < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0])) { mld = MM_MLDrvs[hndl]; - if (!mld || !HeapValidate(GetProcessHeap(), 0, mld) || mld->type != type) - mld = NULL; + __TRY + { + if (mld && mld->type != type) mld = NULL; + } + __EXCEPT(NULL) + { + mld = NULL; + } + __ENDTRY; } hndl = hndl | 0x8000; }