Don't crash on failing DRIVER_FindFromHDrvr
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Mon Sep 6 09:21:27 CDT 2004
>>>>> "Eric" == Eric Pouech <pouech-eric at wanadoo.fr> writes:
>> Why should expecting a NULL return be wrong? It happens, as the the
>> crashes show.
Eric> no. the cases are different. The ones you refer to (mainly in
Eric> driver.c) use a hDrvr passed by the called. So, we have to catch
Eric> erroneous hDrvr values. The case in lolvldrv.c is different. The
Eric> hDrvr used is the one returned by the call to OpenDriver in the
Eric> same function. That's why it shouldn't fail (unless someone closes
Eric> the driver between the call to OpenDriver and the one to
Eric> DRIVER_FindFromHDrvr - and yes, winmm functions should be made
Eric> reentrant, why they are not today) A+
Eric,
we discussed the problem some time ago, and came to no conclusion. You
requested a debug log, but I didn't hit that error in the meantime. Now I
hit it again.
I changed in winmm/driver.c
LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)
{
LPWINE_DRIVER lpDrv = NULL;
HMODULE hModule = 0;
LPSTR ptr;
LPCSTR cause = 0;
TRACE("(%s, %08lX);\n", debugstr_a(fn), lParam2);
if ((ptr = strchr(fn, ' ')) != NULL) {
*ptr++ = '\0';
while (*ptr == ' ') ptr++;
if (*ptr == '\0') ptr = NULL;
}
FIXME("BON: lpDrv before HeapAlloc is %p\n",lpDrv);
lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
FIXME("BON: after HeapAlloc %p\n",lpDrv);
if(!HeapValidate(GetProcessHeap(), 0, lpDrv))
{
FIXME("BON:HeapValidate failed\n");
}
A +relay,+heap,+winmm,+driver log looks like:
trace:winmm:MMDRV_Install ('wineoss.drv', 'wineoss.drv', mapper=N);
trace:driver:OpenDriverA ("wineoss.drv", (null), 0x00000000);
0009:Call kernel32.lstrcpynA(406ef9b8,406efb28 "wineoss.drv",00000080) ret=41285668
0009:Ret kernel32.lstrcpynA() retval=406ef9b8 ret=41285668
trace:driver:DRIVER_TryOpenDriver32 ("wineoss.drv", 00000000);
fixme:driver:DRIVER_TryOpenDriver32 BON: HeapAlloc is (nil)
0009:Call kernel32.GetCurrentThreadId() ret=0a908a76
0009:Ret kernel32.GetCurrentThreadId() retval=00000009 ret=0a908a76
fixme:driver:DRIVER_TryOpenDriver32 BON: HeapAlloc got 0x41c401c0
0009:Call kernel32.HeapValidate(403a0000,00000000,41c401c0) ret=4128527e
0009:Call ntdll.RtlValidateHeap(403a0000,00000000,41c401c0) ret=4050a731
warn:heap:HEAP_IsRealArena Heap 0x403a0000: block 0x41c401c0 is not inside heap
0009:Ret ntdll.RtlValidateHeap() retval=00000000 ret=4050a731
0009:Ret kernel32.HeapValidate() retval=00000000 ret=4128527e
fixme:driver:DRIVER_TryOpenDriver32 BON:HeapValidate failed
Strange: we don't see the RtlHeapAllocate function. But then I remember that
the application (_impact.exe from the Xilinx ISE suite) uses the shsmp library
for memory allocation (http://www.microquill.com/smartheap/sh_tspec.htm).
So our HeapAlloc get patched by the Microquill code, but probably
HeapValidate dose not get patched and things diverge.
Eric, can we do the memory validation perhaps in some other way then by
HeapValidate ?
Bye
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
More information about the wine-devel
mailing list