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

management tools (Microquill for example).
This commit is contained in:
Eric Pouech 2005-07-15 09:56:17 +00:00 committed by Alexandre Julliard
parent 81f1ea1c7c
commit 00a4a989b8
2 changed files with 24 additions and 6 deletions

View File

@ -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;
}
/**************************************************************************

View File

@ -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;
}