Hi,

For those who also read the news group, this concerns the bug report
posted under "HomeNet debugmessages".

This Win16 program starts up one executable. The program links with a
DLL that allocates some memory using
GobalAlloc16(GMEM_DDESHARE|...,...). The wine implementation of this
function sets the owner of the memory block to the module handle of
the calling process.

Later the executable starts up another program, this also links with
the same DLL, and shares the global memory block mentioned above.

Now the first process calls ExitProcess() wich does some cleaning up
including module cleanup since there is only one process for this
module. The second process remains.
During the module cleanup also the global memory block is removed
since it is owned by the module. This leads to the crash sometime
later when the second process tries to access it.

Now to my limited knowledge, a owner of the memory block allocated
this way should be realy the module of the dll, not the exe. The
memory block should then only be removed until de dll is unloaded.

The following patch keeps the GMEM_SHARED memory blocks allocated by
making kernel the owner. It avoids the crash and homenet becomes
functional:

--- ./wine/memory/global.c  Wed Mar  8 08:24:33 2000
+++ ./mywine/memory/global.c    Wed Mar  8 11:51:48 2000
@@ -239,7 +239,7 @@
     HANDLE16 owner = GetCurrentPDB16();

     if (flags & GMEM_DDESHARE)
-        owner = GetExePtr(owner);  /* Make it a module handle */
+        owner = GetModuleHandle16("KERNEL"); /* fixme: hack! */
     return GLOBAL_Alloc( flags, size, owner, FALSE, FALSE, FALSE );
 }


I don't know how this should be done properly. Anyone who can comment
on this?

If there is no easy solution, could there be a hack accpetable enough
to be included in the wine tree?

Rein. 
-- 
Rein Klazes
[EMAIL PROTECTED]

Reply via email to