Commit 5a08a028 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Fixed the DSEG value in the SEGTABLEENTRY struct.

parent 4d7e8778
...@@ -34,7 +34,7 @@ DECLARE_DEBUG_CHANNEL(fixup) ...@@ -34,7 +34,7 @@ DECLARE_DEBUG_CHANNEL(fixup)
DECLARE_DEBUG_CHANNEL(module) DECLARE_DEBUG_CHANNEL(module)
DECLARE_DEBUG_CHANNEL(segment) DECLARE_DEBUG_CHANNEL(segment)
#define SEL(x) GlobalHandleToSel16(x) #define SEL(x) ((x)|1)
/*********************************************************************** /***********************************************************************
* NE_GetRelocAddrName * NE_GetRelocAddrName
...@@ -742,6 +742,32 @@ void NE_InitializeDLLs( HMODULE16 hModule ) ...@@ -742,6 +742,32 @@ void NE_InitializeDLLs( HMODULE16 hModule )
/*********************************************************************** /***********************************************************************
* NE_Ne2MemFlags
*
* This function translates NE segment flags to GlobalAlloc flags
*/
static WORD NE_Ne2MemFlags(WORD flags)
{
WORD memflags = 0;
#if 1
if (flags & NE_SEGFLAGS_DISCARDABLE)
memflags |= GMEM_DISCARDABLE;
if (flags & NE_SEGFLAGS_MOVEABLE ||
( ! (flags & NE_SEGFLAGS_DATA) &&
! (flags & NE_SEGFLAGS_LOADED) &&
! (flags & NE_SEGFLAGS_ALLOCATED)
)
)
memflags |= GMEM_MOVEABLE;
memflags |= GMEM_ZEROINIT;
#else
memflags = GMEM_ZEROINIT | GMEM_FIXED;
#endif
return memflags;
}
/***********************************************************************
* NE_CreateInstance * NE_CreateInstance
* *
* If lib_only is TRUE, handle the module like a library even if it is a .EXE * If lib_only is TRUE, handle the module like a library even if it is a .EXE
...@@ -751,7 +777,7 @@ HINSTANCE16 NE_CreateInstance( NE_MODULE *pModule, HINSTANCE16 *prev, ...@@ -751,7 +777,7 @@ HINSTANCE16 NE_CreateInstance( NE_MODULE *pModule, HINSTANCE16 *prev,
{ {
SEGTABLEENTRY *pSegment; SEGTABLEENTRY *pSegment;
int minsize; int minsize;
HINSTANCE16 hNewInstance; HINSTANCE16 hNewSeg;
if (pModule->dgroup == 0) if (pModule->dgroup == 0)
{ {
...@@ -772,40 +798,17 @@ HINSTANCE16 NE_CreateInstance( NE_MODULE *pModule, HINSTANCE16 *prev, ...@@ -772,40 +798,17 @@ HINSTANCE16 NE_CreateInstance( NE_MODULE *pModule, HINSTANCE16 *prev,
minsize = pSegment->minsize ? pSegment->minsize : 0x10000; minsize = pSegment->minsize ? pSegment->minsize : 0x10000;
if (pModule->ss == pModule->dgroup) minsize += pModule->stack_size; if (pModule->ss == pModule->dgroup) minsize += pModule->stack_size;
minsize += pModule->heap_size; minsize += pModule->heap_size;
hNewInstance = GLOBAL_Alloc( GMEM_ZEROINIT | GMEM_FIXED, minsize, hNewSeg = GLOBAL_Alloc( NE_Ne2MemFlags(pSegment->flags), minsize,
pModule->self, FALSE, FALSE, FALSE ); pModule->self, FALSE, FALSE, FALSE );
if (!hNewInstance) return 0; if (!hNewSeg) return 0;
pSegment->hSeg = hNewInstance; pSegment->hSeg = hNewSeg;
pSegment->flags |= NE_SEGFLAGS_ALLOCATED; pSegment->flags |= NE_SEGFLAGS_ALLOCATED;
return hNewInstance;
}
/*********************************************************************** /* a HINSTANCE is the selector of the DSEG */
* NE_Ne2MemFlags return (HINSTANCE16)SEL(hNewSeg);
*
* This function translates NE segment flags to GlobalAlloc flags
*/
static WORD NE_Ne2MemFlags(WORD flags)
{
WORD memflags = 0;
#if 1
if (flags & NE_SEGFLAGS_DISCARDABLE)
memflags |= GMEM_DISCARDABLE;
if (flags & NE_SEGFLAGS_MOVEABLE ||
( ! (flags & NE_SEGFLAGS_DATA) &&
! (flags & NE_SEGFLAGS_LOADED) &&
! (flags & NE_SEGFLAGS_ALLOCATED)
)
)
memflags |= GMEM_MOVEABLE;
memflags |= GMEM_ZEROINIT;
#else
memflags = GMEM_ZEROINIT | GMEM_FIXED;
#endif
return memflags;
} }
/*********************************************************************** /***********************************************************************
* NE_AllocateSegment (WPROCS.26) * NE_AllocateSegment (WPROCS.26)
* *
......
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