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)
DECLARE_DEBUG_CHANNEL(module)
DECLARE_DEBUG_CHANNEL(segment)
#define SEL(x) GlobalHandleToSel16(x)
#define SEL(x) ((x)|1)
/***********************************************************************
* NE_GetRelocAddrName
......@@ -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
*
* 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,
{
SEGTABLEENTRY *pSegment;
int minsize;
HINSTANCE16 hNewInstance;
HINSTANCE16 hNewSeg;
if (pModule->dgroup == 0)
{
......@@ -772,40 +798,17 @@ HINSTANCE16 NE_CreateInstance( NE_MODULE *pModule, HINSTANCE16 *prev,
minsize = pSegment->minsize ? pSegment->minsize : 0x10000;
if (pModule->ss == pModule->dgroup) minsize += pModule->stack_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 );
if (!hNewInstance) return 0;
pSegment->hSeg = hNewInstance;
if (!hNewSeg) return 0;
pSegment->hSeg = hNewSeg;
pSegment->flags |= NE_SEGFLAGS_ALLOCATED;
return hNewInstance;
}
/***********************************************************************
* 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;
/* a HINSTANCE is the selector of the DSEG */
return (HINSTANCE16)SEL(hNewSeg);
}
/***********************************************************************
* 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