Commit 967813dc authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Fix snooping of 16-bit dlls being loaded at the same address.

parent ff6bda89
...@@ -103,6 +103,9 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) { ...@@ -103,6 +103,9 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
char *s; char *s;
if (!TRACE_ON(snoop)) return; if (!TRACE_ON(snoop)) return;
TRACE("hmod=%x, name=%s\n", pModule->self, name);
if (!snr) { if (!snr) {
xsnr=GLOBAL_Alloc(GMEM_ZEROINIT,2*sizeof(*snr),0,WINE_LDT_FLAGS_CODE|WINE_LDT_FLAGS_32BIT); xsnr=GLOBAL_Alloc(GMEM_ZEROINIT,2*sizeof(*snr),0,WINE_LDT_FLAGS_CODE|WINE_LDT_FLAGS_32BIT);
snr = GlobalLock16(xsnr); snr = GlobalLock16(xsnr);
...@@ -128,10 +131,15 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) { ...@@ -128,10 +131,15 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
} }
while (*dll) { while (*dll) {
if ((*dll)->hmod == pModule->self) if ((*dll)->hmod == pModule->self)
return; /* already registered */ {
/* another dll, loaded at the same address */
GlobalUnlock16((*dll)->funhandle);
GlobalFree16((*dll)->funhandle);
break;
}
dll = &((*dll)->next); dll = &((*dll)->next);
} }
*dll = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP16_DLL)+strlen(name)); *dll = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *dll, sizeof(SNOOP16_DLL)+strlen(name));
(*dll)->next = NULL; (*dll)->next = NULL;
(*dll)->hmod = pModule->self; (*dll)->hmod = pModule->self;
if ((s=strrchr(name,'\\'))) if ((s=strrchr(name,'\\')))
...@@ -340,4 +348,3 @@ FARPROC16 SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfu ...@@ -340,4 +348,3 @@ FARPROC16 SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfu
return origfun; return origfun;
} }
#endif /* !__i386__ */ #endif /* !__i386__ */
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