Yet another small self-loader fix.

This commit is contained in:
Andreas Mohr 1998-10-11 17:36:46 +00:00 committed by Alexandre Julliard
parent fe6dfb0522
commit e6c12eeb04
4 changed files with 26 additions and 25 deletions

View File

@ -111,7 +111,7 @@ file krnl386.exe
107 pascal16 SetErrorMode(word) SetErrorMode16
108 pascal16 SwitchStackTo(word word word) SwitchStackTo
109 register SwitchStackBack() SwitchStackBack
110 pascal16 PatchCodeHandle(word) PatchCodeHandle
110 pascal PatchCodeHandle(word) PatchCodeHandle
111 pascal GlobalWire(word) GlobalWire16
112 pascal16 GlobalUnWire(word) GlobalUnWire16
113 equate __AHSHIFT 3

View File

@ -74,7 +74,7 @@ typedef struct
typedef struct
{
WORD version; /* Must be 0xA0 */
WORD version; /* Must be "A0" (0x3041) */
WORD reserved;
FARPROC16 BootApp; /* startup procedure */
FARPROC16 LoadAppSeg; /* procedure to load a segment */

View File

@ -133,6 +133,7 @@ struct ne_segment_table_entry_s
#define NE_SEGFLAGS_EXECUTEONLY 0x0080
#define NE_SEGFLAGS_READONLY 0x0080
#define NE_SEGFLAGS_RELOC_DATA 0x0100
#define NE_SEGFLAGS_SELFLOAD 0x0800
#define NE_SEGFLAGS_DISCARDABLE 0x1000
/*

View File

@ -69,17 +69,20 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
pSegTable = NE_SEG_TABLE( pModule );
pSeg = pSegTable + segnum - 1;
pModuleTable = NE_MODULE_TABLE( pModule );
if (pSeg->flags & NE_SEGFLAGS_LOADED) /* already loaded ? */
return TRUE;
if (!pSeg->filepos) return TRUE; /* No file image, just return */
pModuleTable = NE_MODULE_TABLE( pModule );
fd = NE_OpenFile( pModule );
TRACE(module, "Loading segment %d, hSeg=%04x, flags=%04x\n",
segnum, pSeg->hSeg, pSeg->flags );
lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET );
if (pSeg->size) size = pSeg->size;
else if (pSeg->minsize) size = pSeg->minsize;
else size = 0x10000;
else size = pSeg->minsize ? pSeg->minsize : 0x10000;
mem = GlobalLock16(pSeg->hSeg);
if (pModule->flags & NE_FFLAGS_SELFLOAD && segnum > 1)
{
@ -382,12 +385,12 @@ unknown:
BOOL32 NE_LoadAllSegments( NE_MODULE *pModule )
{
int i;
SEGTABLEENTRY * pSegTable = (SEGTABLEENTRY *) NE_SEG_TABLE(pModule);
if (pModule->flags & NE_FFLAGS_SELFLOAD)
{
HFILE32 hf;
/* Handle self loading modules */
SEGTABLEENTRY * pSegTable = (SEGTABLEENTRY *) NE_SEG_TABLE(pModule);
SELFLOADHEADER *selfloadheader;
STACK16FRAME *stack16Top;
THDB *thdb = THREAD_Current();
@ -430,12 +433,8 @@ BOOL32 NE_LoadAllSegments( NE_MODULE *pModule )
pSegTable[pModule->dgroup - 1].hSeg = saved_hSeg;
thdb->cur_stack = oldstack;
/* FIXME
commented out by Andreas Mohr;
some self-loading exe ("BLINKER") relies on non-primary segs not loaded.
contact me if you experience problems */
/*for (i = 2; i <= pModule->seg_count; i++)
if (!NE_LoadSegment( pModule, i )) return FALSE;*/
for (i = 2; i <= pModule->seg_count; i++)
if (!NE_LoadSegment( pModule, i )) return FALSE;
}
else
{
@ -446,6 +445,20 @@ BOOL32 NE_LoadAllSegments( NE_MODULE *pModule )
}
/***********************************************************************
* PatchCodeHandle
*
* Needed for self-loading modules.
*/
/* It does nothing */
DWORD WINAPI PatchCodeHandle(HANDLE16 hSel)
{
FIXME(module,"(%04x): stub.\n",hSel);
return (DWORD)NULL;
}
/***********************************************************************
* NE_FixupPrologs
*
@ -755,19 +768,6 @@ HINSTANCE16 NE_CreateInstance( NE_MODULE *pModule, HINSTANCE16 *prev,
}
/***********************************************************************
* PatchCodeHandle
*
* Needed for self-loading modules.
*/
/* It does nothing */
void WINAPI PatchCodeHandle(HANDLE16 hSel)
{
FIXME(module,"(%04x): stub.\n",hSel);
}
/***********************************************************************
* NE_Ne2MemFlags
*