Commit 00a4a989 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Get rid of HeapValidate as it's not properly handled by some memory

management tools (Microquill for example).
parent 81f1ea1c
......@@ -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;
}
/**************************************************************************
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment