Fixed handling of a dll being loaded at the same address as a previous

one.
This commit is contained in:
Dmitry Timoshkov 2002-04-02 02:49:42 +00:00 committed by Alexandre Julliard
parent b60ff098f5
commit 23d4aab269

View file

@ -146,14 +146,20 @@ SNOOP_RegisterDLL(HMODULE hmod,LPCSTR name,DWORD ordbase,DWORD nrofordinals) {
SNOOP_DLL **dll = &(firstdll);
char *s;
TRACE("hmod=%x, name=%s, ordbase=%ld, nrofordinals=%ld\n",
hmod, name, ordbase, nrofordinals);
if (!TRACE_ON(snoop)) return;
while (*dll) {
if ((*dll)->hmod == hmod)
return; /* already registered */
{
/* another dll, loaded at the same address */
VirtualFree((*dll)->funs, (*dll)->nrofordinals*sizeof(SNOOP_FUN), MEM_RELEASE);
break;
}
dll = &((*dll)->next);
}
*dll = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP_DLL)+strlen(name));
(*dll)->next = NULL;
*dll = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *dll, sizeof(SNOOP_DLL)+strlen(name));
(*dll)->hmod = hmod;
(*dll)->ordbase = ordbase;
(*dll)->nrofordinals = nrofordinals;