mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
Renamed some fields in NE_MODULE to use the same name as in the
exported IMAGE_OS2_HEADER structure.
This commit is contained in:
parent
03776ec91a
commit
4417574d2c
@ -31,43 +31,41 @@
|
||||
/* In-memory module structure. See 'Windows Internals' p. 219 */
|
||||
typedef struct _NE_MODULE
|
||||
{
|
||||
WORD magic; /* 00 'NE' signature */
|
||||
WORD count; /* 02 Usage count */
|
||||
WORD entry_table; /* 04 Near ptr to entry table */
|
||||
HMODULE16 next; /* 06 Selector to next module */
|
||||
WORD dgroup_entry; /* 08 Near ptr to segment entry for DGROUP */
|
||||
WORD fileinfo; /* 0a Near ptr to file info (OFSTRUCT) */
|
||||
WORD flags; /* 0c Module flags */
|
||||
WORD dgroup; /* 0e Logical segment for DGROUP */
|
||||
WORD heap_size; /* 10 Initial heap size */
|
||||
WORD stack_size; /* 12 Initial stack size */
|
||||
WORD ip; /* 14 Initial ip */
|
||||
WORD cs; /* 16 Initial cs (logical segment) */
|
||||
WORD sp; /* 18 Initial stack pointer */
|
||||
WORD ss; /* 1a Initial ss (logical segment) */
|
||||
WORD seg_count; /* 1c Number of segments in segment table */
|
||||
WORD modref_count; /* 1e Number of module references */
|
||||
WORD nrname_size; /* 20 Size of non-resident names table */
|
||||
WORD seg_table; /* 22 Near ptr to segment table */
|
||||
WORD res_table; /* 24 Near ptr to resource table */
|
||||
WORD name_table; /* 26 Near ptr to resident names table */
|
||||
WORD modref_table; /* 28 Near ptr to module reference table */
|
||||
WORD import_table; /* 2a Near ptr to imported names table */
|
||||
DWORD nrname_fpos; /* 2c File offset of non-resident names table */
|
||||
WORD moveable_entries; /* 30 Number of moveable entries in entry table*/
|
||||
WORD alignment; /* 32 Alignment shift count */
|
||||
WORD truetype; /* 34 Set to 2 if TrueType font */
|
||||
BYTE os_flags; /* 36 Operating system flags */
|
||||
BYTE misc_flags; /* 37 Misc. flags */
|
||||
HANDLE16 dlls_to_init; /* 38 List of DLLs to initialize */
|
||||
HANDLE16 nrname_handle; /* 3a Handle to non-resident name table */
|
||||
WORD min_swap_area; /* 3c Min. swap area size */
|
||||
WORD expected_version; /* 3e Expected Windows version */
|
||||
WORD ne_magic; /* 00 'NE' signature */
|
||||
WORD count; /* 02 Usage count (ne_ver/ne_rev on disk) */
|
||||
WORD ne_enttab; /* 04 Near ptr to entry table */
|
||||
HMODULE16 next; /* 06 Selector to next module (ne_cbenttab on disk) */
|
||||
WORD dgroup_entry; /* 08 Near ptr to segment entry for DGROUP (ne_crc on disk) */
|
||||
WORD fileinfo; /* 0a Near ptr to file info (OFSTRUCT) (ne_crc on disk) */
|
||||
WORD ne_flags; /* 0c Module flags */
|
||||
WORD ne_autodata; /* 0e Logical segment for DGROUP */
|
||||
WORD ne_heap; /* 10 Initial heap size */
|
||||
WORD ne_stack; /* 12 Initial stack size */
|
||||
DWORD ne_csip; /* 14 Initial cs:ip */
|
||||
DWORD ne_sssp; /* 18 Initial ss:sp */
|
||||
WORD ne_cseg; /* 1c Number of segments in segment table */
|
||||
WORD ne_cmod; /* 1e Number of module references */
|
||||
WORD ne_cbnrestab; /* 20 Size of non-resident names table */
|
||||
WORD ne_segtab; /* 22 Near ptr to segment table */
|
||||
WORD ne_rsrctab; /* 24 Near ptr to resource table */
|
||||
WORD ne_restab; /* 26 Near ptr to resident names table */
|
||||
WORD ne_modtab; /* 28 Near ptr to module reference table */
|
||||
WORD ne_imptab; /* 2a Near ptr to imported names table */
|
||||
DWORD ne_nrestab; /* 2c File offset of non-resident names table */
|
||||
WORD ne_cmovent; /* 30 Number of moveable entries in entry table*/
|
||||
WORD ne_align; /* 32 Alignment shift count */
|
||||
WORD ne_cres; /* 34 # of resource segments */
|
||||
BYTE ne_exetyp; /* 36 Operating system flags */
|
||||
BYTE ne_flagsothers; /* 37 Misc. flags */
|
||||
HANDLE16 dlls_to_init; /* 38 List of DLLs to initialize (ne_pretthunks on disk) */
|
||||
HANDLE16 nrname_handle; /* 3a Handle to non-resident name table (ne_psegrefbytes on disk) */
|
||||
WORD ne_swaparea; /* 3c Min. swap area size */
|
||||
WORD ne_expver; /* 3e Expected Windows version */
|
||||
/* From here, these are extra fields not present in normal Windows */
|
||||
HMODULE module32; /* 40 PE module handle for Win32 modules */
|
||||
HMODULE16 self; /* 44 Handle for this module */
|
||||
WORD self_loading_sel; /* 46 Selector used for self-loading apps. */
|
||||
LPVOID hRsrcMap; /* 48 HRSRC 16->32 map (for 32-bit modules) */
|
||||
LPVOID rsrc32_map; /* 48 HRSRC 16->32 map (for 32-bit modules) */
|
||||
HANDLE fd; /* 4c handle to the binary file */
|
||||
} NE_MODULE;
|
||||
|
||||
@ -104,7 +102,7 @@ extern THHOOK *pThhook;
|
||||
#include "poppack.h"
|
||||
|
||||
#define NE_SEG_TABLE(pModule) \
|
||||
((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->seg_table))
|
||||
((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->ne_segtab))
|
||||
|
||||
#define NE_MODULE_NAME(pModule) \
|
||||
(((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
|
||||
|
@ -1657,7 +1657,7 @@ DWORD WINAPI GetHeapSpaces16( HMODULE16 module )
|
||||
DWORD spaces;
|
||||
|
||||
if (!(pModule = NE_GetPtr( module ))) return 0;
|
||||
CURRENT_DS = GlobalHandleToSel16((NE_SEG_TABLE( pModule ) + pModule->dgroup - 1)->hSeg);
|
||||
CURRENT_DS = GlobalHandleToSel16((NE_SEG_TABLE( pModule ) + pModule->ne_autodata - 1)->hSeg);
|
||||
spaces = MAKELONG( LocalCountFree16(), LocalHeapSize16() );
|
||||
CURRENT_DS = oldDS;
|
||||
return spaces;
|
||||
|
@ -255,15 +255,15 @@ void NE_DumpModule( HMODULE16 hModule )
|
||||
DPRINTF( "---\n" );
|
||||
DPRINTF( "Module %04x:\n", hModule );
|
||||
DPRINTF( "count=%d flags=%04x heap=%d stack=%d\n",
|
||||
pModule->count, pModule->flags,
|
||||
pModule->heap_size, pModule->stack_size );
|
||||
pModule->count, pModule->ne_flags,
|
||||
pModule->ne_heap, pModule->ne_stack );
|
||||
DPRINTF( "cs:ip=%04x:%04x ss:sp=%04x:%04x ds=%04x nb seg=%d modrefs=%d\n",
|
||||
pModule->cs, pModule->ip, pModule->ss, pModule->sp, pModule->dgroup,
|
||||
pModule->seg_count, pModule->modref_count );
|
||||
SELECTOROF(pModule->ne_csip), OFFSETOF(pModule->ne_csip),
|
||||
SELECTOROF(pModule->ne_sssp), OFFSETOF(pModule->ne_sssp),
|
||||
pModule->ne_autodata, pModule->ne_cseg, pModule->ne_cmod );
|
||||
DPRINTF( "os_flags=%d swap_area=%d version=%04x\n",
|
||||
pModule->os_flags, pModule->min_swap_area,
|
||||
pModule->expected_version );
|
||||
if (pModule->flags & NE_FFLAGS_WIN32)
|
||||
pModule->ne_exetyp, pModule->ne_swaparea, pModule->ne_expver );
|
||||
if (pModule->ne_flags & NE_FFLAGS_WIN32)
|
||||
DPRINTF( "PE module=%p\n", pModule->module32 );
|
||||
|
||||
/* Dump the file info */
|
||||
@ -274,7 +274,7 @@ void NE_DumpModule( HMODULE16 hModule )
|
||||
DPRINTF( "---\n" );
|
||||
DPRINTF( "Segment table:\n" );
|
||||
pSeg = NE_SEG_TABLE( pModule );
|
||||
for (i = 0; i < pModule->seg_count; i++, pSeg++)
|
||||
for (i = 0; i < pModule->ne_cseg; i++, pSeg++)
|
||||
DPRINTF( "%02x: pos=%d size=%d flags=%04x minsize=%d hSeg=%04x\n",
|
||||
i + 1, pSeg->filepos, pSeg->size, pSeg->flags,
|
||||
pSeg->minsize, pSeg->hSeg );
|
||||
@ -282,9 +282,9 @@ void NE_DumpModule( HMODULE16 hModule )
|
||||
/* Dump the resource table */
|
||||
DPRINTF( "---\n" );
|
||||
DPRINTF( "Resource table:\n" );
|
||||
if (pModule->res_table)
|
||||
if (pModule->ne_rsrctab)
|
||||
{
|
||||
pword = (WORD *)((BYTE *)pModule + pModule->res_table);
|
||||
pword = (WORD *)((BYTE *)pModule + pModule->ne_rsrctab);
|
||||
DPRINTF( "Alignment: %d\n", *pword++ );
|
||||
while (*pword)
|
||||
{
|
||||
@ -302,7 +302,7 @@ void NE_DumpModule( HMODULE16 hModule )
|
||||
/* Dump the resident name table */
|
||||
DPRINTF( "---\n" );
|
||||
DPRINTF( "Resident-name table:\n" );
|
||||
pstr = (char *)pModule + pModule->name_table;
|
||||
pstr = (char *)pModule + pModule->ne_restab;
|
||||
while (*pstr)
|
||||
{
|
||||
DPRINTF( "%*.*s: %d\n", *pstr, *pstr, pstr + 1,
|
||||
@ -313,10 +313,10 @@ void NE_DumpModule( HMODULE16 hModule )
|
||||
/* Dump the module reference table */
|
||||
DPRINTF( "---\n" );
|
||||
DPRINTF( "Module ref table:\n" );
|
||||
if (pModule->modref_table)
|
||||
if (pModule->ne_modtab)
|
||||
{
|
||||
pword = (WORD *)((BYTE *)pModule + pModule->modref_table);
|
||||
for (i = 0; i < pModule->modref_count; i++, pword++)
|
||||
pword = (WORD *)((BYTE *)pModule + pModule->ne_modtab);
|
||||
for (i = 0; i < pModule->ne_cmod; i++, pword++)
|
||||
{
|
||||
char name[10];
|
||||
GetModuleName16( *pword, name, sizeof(name) );
|
||||
@ -328,7 +328,7 @@ void NE_DumpModule( HMODULE16 hModule )
|
||||
/* Dump the entry table */
|
||||
DPRINTF( "---\n" );
|
||||
DPRINTF( "Entry table:\n" );
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule+pModule->entry_table);
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule+pModule->ne_enttab);
|
||||
do {
|
||||
entry = (ET_ENTRY *)((BYTE *)bundle+6);
|
||||
DPRINTF( "Bundle %d-%d: %02x\n", bundle->first, bundle->last, entry->type);
|
||||
@ -377,9 +377,9 @@ void NE_WalkModules(void)
|
||||
MESSAGE( "Bad module %04x in list\n", hModule );
|
||||
return;
|
||||
}
|
||||
MESSAGE( " %04x %04x %.*s\n", hModule, pModule->flags,
|
||||
*((char *)pModule + pModule->name_table),
|
||||
(char *)pModule + pModule->name_table + 1 );
|
||||
MESSAGE( " %04x %04x %.*s\n", hModule, pModule->ne_flags,
|
||||
*((char *)pModule + pModule->ne_restab),
|
||||
(char *)pModule + pModule->ne_restab + 1 );
|
||||
hModule = pModule->next;
|
||||
}
|
||||
}
|
||||
@ -394,7 +394,7 @@ static void NE_InitResourceHandler( NE_MODULE *pModule )
|
||||
{
|
||||
static FARPROC16 proc;
|
||||
|
||||
NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
|
||||
NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->ne_rsrctab + 2);
|
||||
|
||||
TRACE("InitResourceHandler[%04x]\n", pModule->self );
|
||||
|
||||
@ -420,7 +420,7 @@ WORD NE_GetOrdinal( HMODULE16 hModule, const char *name )
|
||||
NE_MODULE *pModule;
|
||||
|
||||
if (!(pModule = NE_GetPtr( hModule ))) return 0;
|
||||
if (pModule->flags & NE_FFLAGS_WIN32) return 0;
|
||||
if (pModule->ne_flags & NE_FFLAGS_WIN32) return 0;
|
||||
|
||||
TRACE("(%04x,'%s')\n", hModule, name );
|
||||
|
||||
@ -436,7 +436,7 @@ WORD NE_GetOrdinal( HMODULE16 hModule, const char *name )
|
||||
|
||||
/* First search the resident names */
|
||||
|
||||
cpnt = (char *)pModule + pModule->name_table;
|
||||
cpnt = (char *)pModule + pModule->ne_restab;
|
||||
|
||||
/* Skip the first entry (module name) */
|
||||
cpnt += *cpnt + 1 + sizeof(WORD);
|
||||
@ -494,9 +494,9 @@ FARPROC16 NE_GetEntryPointEx( HMODULE16 hModule, WORD ordinal, BOOL16 snoop )
|
||||
ET_BUNDLE *bundle;
|
||||
|
||||
if (!(pModule = NE_GetPtr( hModule ))) return 0;
|
||||
assert( !(pModule->flags & NE_FFLAGS_WIN32) );
|
||||
assert( !(pModule->ne_flags & NE_FFLAGS_WIN32) );
|
||||
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule + pModule->entry_table);
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule + pModule->ne_enttab);
|
||||
while ((ordinal < bundle->first + 1) || (ordinal > bundle->last))
|
||||
{
|
||||
if (!(bundle->next))
|
||||
@ -548,9 +548,9 @@ BOOL16 NE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset )
|
||||
int i;
|
||||
|
||||
if (!(pModule = NE_GetPtr( hModule ))) return FALSE;
|
||||
assert( !(pModule->flags & NE_FFLAGS_WIN32) );
|
||||
assert( !(pModule->ne_flags & NE_FFLAGS_WIN32) );
|
||||
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule + pModule->entry_table);
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule + pModule->ne_enttab);
|
||||
while ((ordinal < bundle->first + 1) || (ordinal > bundle->last))
|
||||
{
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule + bundle->next);
|
||||
@ -679,9 +679,9 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
memcpy( pModule, &ne_header, sizeof(ne_header) );
|
||||
pModule->count = 0;
|
||||
/* check *programs* for default minimal stack size */
|
||||
if ( (!(pModule->flags & NE_FFLAGS_LIBMODULE))
|
||||
&& (pModule->stack_size < 0x1400) )
|
||||
pModule->stack_size = 0x1400;
|
||||
if ( (!(pModule->ne_flags & NE_FFLAGS_LIBMODULE))
|
||||
&& (pModule->ne_stack < 0x1400) )
|
||||
pModule->ne_stack = 0x1400;
|
||||
pModule->module32 = 0;
|
||||
pModule->self = hModule;
|
||||
pModule->self_loading_sel = 0;
|
||||
@ -689,7 +689,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
|
||||
/* Clear internal Wine flags in case they are set in the EXE file */
|
||||
|
||||
pModule->flags &= ~(NE_FFLAGS_BUILTIN | NE_FFLAGS_WIN32);
|
||||
pModule->ne_flags &= ~(NE_FFLAGS_BUILTIN | NE_FFLAGS_WIN32);
|
||||
|
||||
/* Read the fast-load area */
|
||||
|
||||
@ -712,7 +712,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
|
||||
/* Get the segment table */
|
||||
|
||||
pModule->seg_table = pData - (BYTE *)pModule;
|
||||
pModule->ne_segtab = pData - (BYTE *)pModule;
|
||||
buffer = HeapAlloc( GetProcessHeap(), 0, ne_header.ne_cseg *
|
||||
sizeof(struct ne_segment_table_entry_s));
|
||||
if (buffer)
|
||||
@ -748,7 +748,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
|
||||
if (ne_header.ne_rsrctab < ne_header.ne_restab)
|
||||
{
|
||||
pModule->res_table = pData - (BYTE *)pModule;
|
||||
pModule->ne_rsrctab = pData - (BYTE *)pModule;
|
||||
if (!READ(mz_header.e_lfanew + ne_header.ne_rsrctab,
|
||||
ne_header.ne_restab - ne_header.ne_rsrctab,
|
||||
pData ))
|
||||
@ -756,11 +756,11 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
pData += ne_header.ne_restab - ne_header.ne_rsrctab;
|
||||
NE_InitResourceHandler( pModule );
|
||||
}
|
||||
else pModule->res_table = 0; /* No resource table */
|
||||
else pModule->ne_rsrctab = 0; /* No resource table */
|
||||
|
||||
/* Get the resident names table */
|
||||
|
||||
pModule->name_table = pData - (BYTE *)pModule;
|
||||
pModule->ne_restab = pData - (BYTE *)pModule;
|
||||
if (!READ( mz_header.e_lfanew + ne_header.ne_restab,
|
||||
ne_header.ne_modtab - ne_header.ne_restab,
|
||||
pData ))
|
||||
@ -775,7 +775,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
|
||||
if (ne_header.ne_cmod > 0)
|
||||
{
|
||||
pModule->modref_table = pData - (BYTE *)pModule;
|
||||
pModule->ne_modtab = pData - (BYTE *)pModule;
|
||||
if (!READ( mz_header.e_lfanew + ne_header.ne_modtab,
|
||||
ne_header.ne_cmod * sizeof(WORD),
|
||||
pData ))
|
||||
@ -786,11 +786,11 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
}
|
||||
pData += ne_header.ne_cmod * sizeof(WORD);
|
||||
}
|
||||
else pModule->modref_table = 0; /* No module references */
|
||||
else pModule->ne_modtab = 0; /* No module references */
|
||||
|
||||
/* Get the imported names table */
|
||||
|
||||
pModule->import_table = pData - (BYTE *)pModule;
|
||||
pModule->ne_imptab = pData - (BYTE *)pModule;
|
||||
if (!READ( mz_header.e_lfanew + ne_header.ne_imptab,
|
||||
ne_header.ne_enttab - ne_header.ne_imptab,
|
||||
pData ))
|
||||
@ -808,7 +808,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
BYTE nr_entries, type, *s;
|
||||
|
||||
TRACE("Converting entry table.\n");
|
||||
pModule->entry_table = pData - (BYTE *)pModule;
|
||||
pModule->ne_enttab = pData - (BYTE *)pModule;
|
||||
if (!READ( mz_header.e_lfanew + ne_header.ne_enttab,
|
||||
ne_header.ne_cbenttab, pTempEntryTable ))
|
||||
{
|
||||
@ -926,10 +926,10 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
|
||||
/* Allocate a segment for the implicitly-loaded DLLs */
|
||||
|
||||
if (pModule->modref_count)
|
||||
if (pModule->ne_cmod)
|
||||
{
|
||||
pModule->dlls_to_init = GlobalAlloc16( GMEM_ZEROINIT,
|
||||
(pModule->modref_count+1)*sizeof(HMODULE16) );
|
||||
(pModule->ne_cmod+1)*sizeof(HMODULE16) );
|
||||
if (!pModule->dlls_to_init)
|
||||
{
|
||||
if (pModule->nrname_handle) GlobalFree16( pModule->nrname_handle );
|
||||
@ -954,13 +954,13 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
|
||||
static BOOL NE_LoadDLLs( NE_MODULE *pModule )
|
||||
{
|
||||
int i;
|
||||
WORD *pModRef = (WORD *)((char *)pModule + pModule->modref_table);
|
||||
WORD *pModRef = (WORD *)((char *)pModule + pModule->ne_modtab);
|
||||
WORD *pDLLs = (WORD *)GlobalLock16( pModule->dlls_to_init );
|
||||
|
||||
for (i = 0; i < pModule->modref_count; i++, pModRef++)
|
||||
for (i = 0; i < pModule->ne_cmod; i++, pModRef++)
|
||||
{
|
||||
char buffer[260], *p;
|
||||
BYTE *pstr = (BYTE *)pModule + pModule->import_table + *pModRef;
|
||||
BYTE *pstr = (BYTE *)pModule + pModule->ne_imptab + *pModRef;
|
||||
memcpy( buffer, pstr + 1, *pstr );
|
||||
*(buffer + *pstr) = 0; /* terminate it */
|
||||
|
||||
@ -980,8 +980,8 @@ static BOOL NE_LoadDLLs( NE_MODULE *pModule )
|
||||
/* FIXME: cleanup what was done */
|
||||
|
||||
MESSAGE( "Could not load '%s' required by '%.*s', error=%d\n",
|
||||
buffer, *((BYTE*)pModule + pModule->name_table),
|
||||
(char *)pModule + pModule->name_table + 1, hDLL );
|
||||
buffer, *((BYTE*)pModule + pModule->ne_restab),
|
||||
(char *)pModule + pModule->ne_restab + 1, hDLL );
|
||||
return FALSE;
|
||||
}
|
||||
*pModRef = GetExePtr( hDLL );
|
||||
@ -1076,7 +1076,7 @@ static HINSTANCE16 NE_LoadModule( LPCSTR name, BOOL lib_only )
|
||||
}
|
||||
_lclose16( hFile );
|
||||
|
||||
if ( !lib_only && !( pModule->flags & NE_FFLAGS_LIBMODULE ) )
|
||||
if ( !lib_only && !( pModule->ne_flags & NE_FFLAGS_LIBMODULE ) )
|
||||
return hModule;
|
||||
|
||||
hInstance = NE_DoLoadModule( pModule );
|
||||
@ -1123,8 +1123,8 @@ static HMODULE16 NE_DoLoadBuiltinModule( const BUILTIN16_DESCRIPTOR *descr )
|
||||
pModule->count = 1;
|
||||
pModule->fileinfo = sizeof(*pModule);
|
||||
pModule->self = hModule;
|
||||
/* NOTE: (Ab)use the hRsrcMap parameter for resource data pointer */
|
||||
pModule->hRsrcMap = (void *)descr->rsrc;
|
||||
/* NOTE: (Ab)use the rsrc32_map parameter for resource data pointer */
|
||||
pModule->rsrc32_map = (void *)descr->rsrc;
|
||||
|
||||
/* Allocate the code segment */
|
||||
|
||||
@ -1139,7 +1139,7 @@ static HMODULE16 NE_DoLoadBuiltinModule( const BUILTIN16_DESCRIPTOR *descr )
|
||||
/* Allocate the data segment */
|
||||
|
||||
minsize = pSegTable->minsize ? pSegTable->minsize : 0x10000;
|
||||
minsize += pModule->heap_size;
|
||||
minsize += pModule->ne_heap;
|
||||
if (minsize > 0x10000) minsize = 0x10000;
|
||||
pSegTable->hSeg = GlobalAlloc16( GMEM_FIXED, minsize );
|
||||
if (!pSegTable->hSeg) return ERROR_NOT_ENOUGH_MEMORY;
|
||||
@ -1147,7 +1147,7 @@ static HMODULE16 NE_DoLoadBuiltinModule( const BUILTIN16_DESCRIPTOR *descr )
|
||||
pModule->dgroup_entry = (char *)pSegTable - (char *)pModule;
|
||||
if (pSegTable->minsize) memcpy( GlobalLock16( pSegTable->hSeg ),
|
||||
descr->data_start, pSegTable->minsize);
|
||||
if (pModule->heap_size)
|
||||
if (pModule->ne_heap)
|
||||
LocalInit16( GlobalHandleToSel16(pSegTable->hSeg), pSegTable->minsize, minsize );
|
||||
|
||||
if (descr->rsrc) NE_InitResourceHandler(pModule);
|
||||
@ -1256,7 +1256,7 @@ static HINSTANCE16 MODULE_LoadModule16( LPCSTR libname, BOOL implicit, BOOL lib_
|
||||
* Call initialization routines for all loaded DLLs. Note that
|
||||
* when we load implicitly linked DLLs this will be done by InitTask().
|
||||
*/
|
||||
if(pModule->flags & NE_FFLAGS_LIBMODULE)
|
||||
if(pModule->ne_flags & NE_FFLAGS_LIBMODULE)
|
||||
{
|
||||
NE_InitializeDLLs(hModule);
|
||||
NE_DllProcessAttach(hModule);
|
||||
@ -1344,7 +1344,7 @@ HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock )
|
||||
|
||||
/* If library module, we just retrieve the instance handle */
|
||||
|
||||
if ( ( pModule->flags & NE_FFLAGS_LIBMODULE ) || lib_only )
|
||||
if ( ( pModule->ne_flags & NE_FFLAGS_LIBMODULE ) || lib_only )
|
||||
return NE_GetInstance( pModule );
|
||||
|
||||
/*
|
||||
@ -1382,19 +1382,19 @@ DWORD NE_StartTask(void)
|
||||
|
||||
hPrevInstance = NE_GetInstance( pModule );
|
||||
|
||||
if ( pModule->dgroup )
|
||||
if ( NE_CreateSegment( pModule, pModule->dgroup ) )
|
||||
NE_LoadSegment( pModule, pModule->dgroup );
|
||||
if ( pModule->ne_autodata )
|
||||
if ( NE_CreateSegment( pModule, pModule->ne_autodata ) )
|
||||
NE_LoadSegment( pModule, pModule->ne_autodata );
|
||||
|
||||
hInstance = NE_GetInstance( pModule );
|
||||
TRACE("created second instance %04x[%d] of instance %04x.\n", hInstance, pModule->dgroup, hPrevInstance);
|
||||
TRACE("created second instance %04x[%d] of instance %04x.\n", hInstance, pModule->ne_autodata, hPrevInstance);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Load first instance of NE module */
|
||||
|
||||
pModule->flags |= NE_FFLAGS_GUI; /* FIXME: is this necessary? */
|
||||
pModule->ne_flags |= NE_FFLAGS_GUI; /* FIXME: is this necessary? */
|
||||
|
||||
hInstance = NE_DoLoadModule( pModule );
|
||||
hPrevInstance = 0;
|
||||
@ -1411,8 +1411,8 @@ DWORD NE_StartTask(void)
|
||||
|
||||
/* Use DGROUP for 16-bit stack */
|
||||
|
||||
if (!(sp = pModule->sp))
|
||||
sp = pSegTable[pModule->ss-1].minsize + pModule->stack_size;
|
||||
if (!(sp = OFFSETOF(pModule->ne_sssp)))
|
||||
sp = pSegTable[SELECTOROF(pModule->ne_sssp)-1].minsize + pModule->ne_stack;
|
||||
sp &= ~1;
|
||||
sp -= sizeof(STACK16FRAME);
|
||||
NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR( GlobalHandleToSel16(hInstance), sp );
|
||||
@ -1430,14 +1430,14 @@ DWORD NE_StartTask(void)
|
||||
* sp top of the stack
|
||||
*/
|
||||
memset( &context, 0, sizeof(context) );
|
||||
context.SegCs = GlobalHandleToSel16(pSegTable[pModule->cs - 1].hSeg);
|
||||
context.SegCs = GlobalHandleToSel16(pSegTable[SELECTOROF(pModule->ne_csip) - 1].hSeg);
|
||||
context.SegDs = GlobalHandleToSel16(pTask->hInstance);
|
||||
context.SegEs = pTask->hPDB;
|
||||
context.SegFs = wine_get_fs();
|
||||
context.SegGs = wine_get_gs();
|
||||
context.Eip = pModule->ip;
|
||||
context.Ebx = pModule->stack_size;
|
||||
context.Ecx = pModule->heap_size;
|
||||
context.Eip = OFFSETOF(pModule->ne_csip);
|
||||
context.Ebx = pModule->ne_stack;
|
||||
context.Ecx = pModule->ne_heap;
|
||||
context.Edi = pTask->hInstance;
|
||||
context.Esi = pTask->hPrevInstance;
|
||||
|
||||
@ -1516,15 +1516,15 @@ static BOOL16 NE_FreeModule( HMODULE16 hModule, BOOL call_wep )
|
||||
if (((INT16)(--pModule->count)) > 0 ) return TRUE;
|
||||
else pModule->count = 0;
|
||||
|
||||
if (pModule->flags & NE_FFLAGS_BUILTIN)
|
||||
if (pModule->ne_flags & NE_FFLAGS_BUILTIN)
|
||||
return FALSE; /* Can't free built-in module */
|
||||
|
||||
if (call_wep && !(pModule->flags & NE_FFLAGS_WIN32))
|
||||
if (call_wep && !(pModule->ne_flags & NE_FFLAGS_WIN32))
|
||||
{
|
||||
/* Free the objects owned by the DLL module */
|
||||
NE_CallUserSignalProc( hModule, USIG16_DLL_UNLOAD );
|
||||
|
||||
if (pModule->flags & NE_FFLAGS_LIBMODULE)
|
||||
if (pModule->ne_flags & NE_FFLAGS_LIBMODULE)
|
||||
MODULE_CallWEP( hModule );
|
||||
else
|
||||
call_wep = FALSE; /* We are freeing a task -> no more WEPs */
|
||||
@ -1533,7 +1533,7 @@ static BOOL16 NE_FreeModule( HMODULE16 hModule, BOOL call_wep )
|
||||
|
||||
/* Clear magic number just in case */
|
||||
|
||||
pModule->magic = pModule->self = 0;
|
||||
pModule->ne_magic = pModule->self = 0;
|
||||
if (pModule->fd) CloseHandle( pModule->fd );
|
||||
|
||||
/* Remove it from the linked list */
|
||||
@ -1547,8 +1547,8 @@ static BOOL16 NE_FreeModule( HMODULE16 hModule, BOOL call_wep )
|
||||
|
||||
/* Free the referenced modules */
|
||||
|
||||
pModRef = (HMODULE16*)((char *)pModule + pModule->modref_table);
|
||||
for (i = 0; i < pModule->modref_count; i++, pModRef++)
|
||||
pModRef = (HMODULE16*)((char *)pModule + pModule->ne_modtab);
|
||||
for (i = 0; i < pModule->ne_cmod; i++, pModRef++)
|
||||
{
|
||||
NE_FreeModule( *pModRef, call_wep );
|
||||
}
|
||||
@ -1607,9 +1607,9 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
|
||||
{
|
||||
pModule = NE_GetPtr( hModule );
|
||||
if (!pModule) break;
|
||||
if (pModule->flags & NE_FFLAGS_WIN32) continue;
|
||||
if (pModule->ne_flags & NE_FFLAGS_WIN32) continue;
|
||||
|
||||
name_table = (BYTE *)pModule + pModule->name_table;
|
||||
name_table = (BYTE *)pModule + pModule->ne_restab;
|
||||
if ((*name_table == len) && !strncmp(name, name_table+1, len))
|
||||
return hModule;
|
||||
}
|
||||
@ -1623,9 +1623,9 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
|
||||
{
|
||||
pModule = NE_GetPtr( hModule );
|
||||
if (!pModule) break;
|
||||
if (pModule->flags & NE_FFLAGS_WIN32) continue;
|
||||
if (pModule->ne_flags & NE_FFLAGS_WIN32) continue;
|
||||
|
||||
name_table = (BYTE *)pModule + pModule->name_table;
|
||||
name_table = (BYTE *)pModule + pModule->ne_restab;
|
||||
/* FIXME: the strncasecmp is WRONG. It should not be case insensitive,
|
||||
* but case sensitive! (Unfortunately Winword 6 and subdlls have
|
||||
* lowercased module names, but try to load uppercase DLLs, so this
|
||||
@ -1659,7 +1659,7 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
|
||||
pModule = NE_GetPtr( hModule );
|
||||
if (!pModule) break;
|
||||
if (!pModule->fileinfo) continue;
|
||||
if (pModule->flags & NE_FFLAGS_WIN32) continue;
|
||||
if (pModule->ne_flags & NE_FFLAGS_WIN32) continue;
|
||||
|
||||
ofs = (OFSTRUCT*)((BYTE *)pModule + pModule->fileinfo);
|
||||
loadedfn = ((char*)ofs->szPathName) + strlen(ofs->szPathName);
|
||||
@ -1687,7 +1687,7 @@ BOOL16 WINAPI GetModuleName16( HINSTANCE16 hinst, LPSTR buf, INT16 count )
|
||||
BYTE *p;
|
||||
|
||||
if (!(pModule = NE_GetPtr( hinst ))) return FALSE;
|
||||
p = (BYTE *)pModule + pModule->name_table;
|
||||
p = (BYTE *)pModule + pModule->ne_restab;
|
||||
if (count > *p) count = *p + 1;
|
||||
if (count > 0)
|
||||
{
|
||||
@ -1717,7 +1717,7 @@ INT16 WINAPI GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName,
|
||||
|
||||
if (!(pModule = NE_GetPtr( hModule ))) return 0;
|
||||
lstrcpynA( lpFileName, NE_MODULE_NAME(pModule), nSize );
|
||||
if (pModule->expected_version >= 0x400)
|
||||
if (pModule->ne_expver >= 0x400)
|
||||
GetLongPathNameA(NE_MODULE_NAME(pModule), lpFileName, nSize);
|
||||
TRACE("%04x -> '%s'\n", hModule, lpFileName );
|
||||
return strlen(lpFileName);
|
||||
@ -1746,18 +1746,18 @@ WORD WINAPI GetExpWinVer16( HMODULE16 hModule )
|
||||
* For built-in modules, fake the expected version the module should
|
||||
* have according to the Windows version emulated by Wine
|
||||
*/
|
||||
if ( !pModule->expected_version )
|
||||
if ( !pModule->ne_expver )
|
||||
{
|
||||
OSVERSIONINFOA versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
|
||||
|
||||
if ( GetVersionExA( &versionInfo ) )
|
||||
pModule->expected_version =
|
||||
pModule->ne_expver =
|
||||
(versionInfo.dwMajorVersion & 0xff) << 8
|
||||
| (versionInfo.dwMinorVersion & 0xff);
|
||||
}
|
||||
|
||||
return pModule->expected_version;
|
||||
return pModule->ne_expver;
|
||||
}
|
||||
|
||||
|
||||
@ -1971,7 +1971,7 @@ static HMODULE16 NE_GetModuleByFilename( LPCSTR name )
|
||||
pModule = NE_GetPtr( hModule );
|
||||
if (!pModule) break;
|
||||
if (!pModule->fileinfo) continue;
|
||||
if (pModule->flags & NE_FFLAGS_WIN32) continue;
|
||||
if (pModule->ne_flags & NE_FFLAGS_WIN32) continue;
|
||||
|
||||
ofs = (OFSTRUCT*)((BYTE *)pModule + pModule->fileinfo);
|
||||
loadedfn = ((char*)ofs->szPathName) + strlen(ofs->szPathName);
|
||||
@ -1997,9 +1997,9 @@ static HMODULE16 NE_GetModuleByFilename( LPCSTR name )
|
||||
{
|
||||
pModule = NE_GetPtr( hModule );
|
||||
if (!pModule) break;
|
||||
if (pModule->flags & NE_FFLAGS_WIN32) continue;
|
||||
if (pModule->ne_flags & NE_FFLAGS_WIN32) continue;
|
||||
|
||||
name_table = (BYTE *)pModule + pModule->name_table;
|
||||
name_table = (BYTE *)pModule + pModule->ne_restab;
|
||||
if ((*name_table == len) && !NE_strncasecmp(s, name_table+1, len))
|
||||
return hModule;
|
||||
}
|
||||
@ -2042,7 +2042,7 @@ BOOL16 WINAPI ModuleNext16( MODULEENTRY *lpme )
|
||||
|
||||
if (!lpme->wNext) return FALSE;
|
||||
if (!(pModule = NE_GetPtr( lpme->wNext ))) return FALSE;
|
||||
name = (char *)pModule + pModule->name_table;
|
||||
name = (char *)pModule + pModule->ne_restab;
|
||||
memcpy( lpme->szModule, name + 1, min(*name, MAX_MODULE_NAME) );
|
||||
lpme->szModule[min(*name, MAX_MODULE_NAME)] = '\0';
|
||||
lpme->hModule = lpme->wNext;
|
||||
@ -2139,28 +2139,28 @@ static HMODULE16 create_dummy_module( HMODULE module32 )
|
||||
pModule = (NE_MODULE *)GlobalLock16( hModule );
|
||||
|
||||
/* Set all used entries */
|
||||
pModule->magic = IMAGE_OS2_SIGNATURE;
|
||||
pModule->ne_magic = IMAGE_OS2_SIGNATURE;
|
||||
pModule->count = 1;
|
||||
pModule->next = 0;
|
||||
pModule->flags = NE_FFLAGS_WIN32;
|
||||
pModule->dgroup = 0;
|
||||
pModule->ss = 1;
|
||||
pModule->cs = 2;
|
||||
pModule->heap_size = 0;
|
||||
pModule->stack_size = 0;
|
||||
pModule->seg_count = 2;
|
||||
pModule->modref_count = 0;
|
||||
pModule->nrname_size = 0;
|
||||
pModule->ne_flags = NE_FFLAGS_WIN32;
|
||||
pModule->ne_autodata = 0;
|
||||
pModule->ne_sssp = MAKESEGPTR( 0, 1 );
|
||||
pModule->ne_csip = MAKESEGPTR( 0, 2 );
|
||||
pModule->ne_heap = 0;
|
||||
pModule->ne_stack = 0;
|
||||
pModule->ne_cseg = 2;
|
||||
pModule->ne_cmod = 0;
|
||||
pModule->ne_cbnrestab = 0;
|
||||
pModule->fileinfo = sizeof(NE_MODULE);
|
||||
pModule->os_flags = NE_OSFLAGS_WINDOWS;
|
||||
pModule->ne_exetyp = NE_OSFLAGS_WINDOWS;
|
||||
pModule->self = hModule;
|
||||
pModule->module32 = module32;
|
||||
|
||||
/* Set version and flags */
|
||||
pModule->expected_version = ((nt->OptionalHeader.MajorSubsystemVersion & 0xff) << 8 ) |
|
||||
pModule->ne_expver = ((nt->OptionalHeader.MajorSubsystemVersion & 0xff) << 8 ) |
|
||||
(nt->OptionalHeader.MinorSubsystemVersion & 0xff);
|
||||
if (nt->FileHeader.Characteristics & IMAGE_FILE_DLL)
|
||||
pModule->flags |= NE_FFLAGS_LIBMODULE | NE_FFLAGS_SINGLEDATA;
|
||||
pModule->ne_flags |= NE_FFLAGS_LIBMODULE | NE_FFLAGS_SINGLEDATA;
|
||||
|
||||
/* Set loaded file information */
|
||||
ofs = (OFSTRUCT *)(pModule + 1);
|
||||
@ -2169,7 +2169,7 @@ static HMODULE16 create_dummy_module( HMODULE module32 )
|
||||
strcpy( ofs->szPathName, filename );
|
||||
|
||||
pSegment = (SEGTABLEENTRY*)((char*)(pModule + 1) + ((of_size + 3) & ~3));
|
||||
pModule->seg_table = (int)pSegment - (int)pModule;
|
||||
pModule->ne_segtab = (char *)pSegment - (char *)pModule;
|
||||
/* Data segment */
|
||||
pSegment->size = 0;
|
||||
pSegment->flags = NE_SEGFLAGS_DATA;
|
||||
@ -2181,14 +2181,14 @@ static HMODULE16 create_dummy_module( HMODULE module32 )
|
||||
|
||||
/* Module name */
|
||||
pStr = (char *)pSegment;
|
||||
pModule->name_table = (int)pStr - (int)pModule;
|
||||
pModule->ne_restab = pStr - (char *)pModule;
|
||||
assert(len<256);
|
||||
*pStr = len;
|
||||
lstrcpynA( pStr+1, basename, len+1 );
|
||||
pStr += len+2;
|
||||
|
||||
/* All tables zero terminated */
|
||||
pModule->res_table = pModule->import_table = pModule->entry_table = (int)pStr - (int)pModule;
|
||||
pModule->ne_rsrctab = pModule->ne_imptab = pModule->ne_enttab = (char *)pStr - (char *)pModule;
|
||||
|
||||
NE_RegisterModule( pModule );
|
||||
LoadLibraryA( filename ); /* increment the ref count of the 32-bit module */
|
||||
@ -2268,7 +2268,7 @@ HMODULE WINAPI MapHModuleSL(HMODULE16 hmod)
|
||||
hmod = pTask->hModule;
|
||||
}
|
||||
pModule = (NE_MODULE*)GlobalLock16(hmod);
|
||||
if ((pModule->magic!=IMAGE_OS2_SIGNATURE) || !(pModule->flags & NE_FFLAGS_WIN32))
|
||||
if ((pModule->ne_magic != IMAGE_OS2_SIGNATURE) || !(pModule->ne_flags & NE_FFLAGS_WIN32))
|
||||
return 0;
|
||||
return pModule->module32;
|
||||
}
|
||||
|
@ -142,26 +142,26 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
|
||||
if (pSeg->flags & NE_SEGFLAGS_LOADED)
|
||||
{
|
||||
/* self-loader ? -> already loaded it */
|
||||
if (pModule->flags & NE_FFLAGS_SELFLOAD)
|
||||
if (pModule->ne_flags & NE_FFLAGS_SELFLOAD)
|
||||
return TRUE;
|
||||
|
||||
/* leave, except for DGROUP, as this may be the second instance */
|
||||
if (segnum != pModule->dgroup)
|
||||
if (segnum != pModule->ne_autodata)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!pSeg->filepos) return TRUE; /* No file image, just return */
|
||||
|
||||
pModuleTable = (HMODULE16 *)((char *)pModule + pModule->modref_table);
|
||||
pModuleTable = (HMODULE16 *)((char *)pModule + pModule->ne_modtab);
|
||||
|
||||
hf = NE_OpenFile( pModule );
|
||||
TRACE_(module)("Loading segment %d, hSeg=%04x, flags=%04x\n",
|
||||
segnum, pSeg->hSeg, pSeg->flags );
|
||||
SetFilePointer( hf, pSeg->filepos << pModule->alignment, NULL, SEEK_SET );
|
||||
SetFilePointer( hf, pSeg->filepos << pModule->ne_align, NULL, SEEK_SET );
|
||||
if (pSeg->size) size = pSeg->size;
|
||||
else size = pSeg->minsize ? pSeg->minsize : 0x10000;
|
||||
mem = GlobalLock16(pSeg->hSeg);
|
||||
if (pModule->flags & NE_FFLAGS_SELFLOAD && segnum > 1)
|
||||
if (pModule->ne_flags & NE_FFLAGS_SELFLOAD && segnum > 1)
|
||||
{
|
||||
/* Implement self-loading segments */
|
||||
SELFLOADHEADER *selfloadheader;
|
||||
@ -236,8 +236,8 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
|
||||
if (!count) goto succeed;
|
||||
|
||||
TRACE("Fixups for %.*s, segment %d, hSeg %04x\n",
|
||||
*((BYTE *)pModule + pModule->name_table),
|
||||
(char *)pModule + pModule->name_table + 1,
|
||||
*((BYTE *)pModule + pModule->ne_restab),
|
||||
(char *)pModule + pModule->ne_restab + 1,
|
||||
segnum, pSeg->hSeg );
|
||||
|
||||
reloc_entries = HeapAlloc(GetProcessHeap(), 0, count * sizeof(struct relocation_entry_s));
|
||||
@ -279,14 +279,14 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
|
||||
if (!pTarget)
|
||||
WARN_(module)("Module not found: %04x, reference %d of module %*.*s\n",
|
||||
module, rep->target1,
|
||||
*((BYTE *)pModule + pModule->name_table),
|
||||
*((BYTE *)pModule + pModule->name_table),
|
||||
(char *)pModule + pModule->name_table + 1 );
|
||||
*((BYTE *)pModule + pModule->ne_restab),
|
||||
*((BYTE *)pModule + pModule->ne_restab),
|
||||
(char *)pModule + pModule->ne_restab + 1 );
|
||||
else
|
||||
{
|
||||
ERR("No implementation for %.*s.%d, setting to 0xdeadbeef\n",
|
||||
*((BYTE *)pTarget + pTarget->name_table),
|
||||
(char *)pTarget + pTarget->name_table + 1,
|
||||
*((BYTE *)pTarget + pTarget->ne_restab),
|
||||
(char *)pTarget + pTarget->ne_restab + 1,
|
||||
ordinal );
|
||||
address = (FARPROC16)0xdeadbeef;
|
||||
}
|
||||
@ -295,8 +295,8 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
|
||||
{
|
||||
NE_MODULE *pTarget = NE_GetPtr( module );
|
||||
TRACE("%d: %.*s.%d=%04x:%04x %s\n", i + 1,
|
||||
*((BYTE *)pTarget + pTarget->name_table),
|
||||
(char *)pTarget + pTarget->name_table + 1,
|
||||
*((BYTE *)pTarget + pTarget->ne_restab),
|
||||
(char *)pTarget + pTarget->ne_restab + 1,
|
||||
ordinal, HIWORD(address), LOWORD(address),
|
||||
NE_GetRelocAddrName( rep->address_type, additive ) );
|
||||
}
|
||||
@ -304,7 +304,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
|
||||
|
||||
case NE_RELTYPE_NAME:
|
||||
module = pModuleTable[rep->target1-1];
|
||||
func_name = (char *)pModule + pModule->import_table + rep->target2;
|
||||
func_name = (char *)pModule + pModule->ne_imptab + rep->target2;
|
||||
memcpy( buffer, func_name+1, *func_name );
|
||||
buffer[*func_name] = '\0';
|
||||
func_name = buffer;
|
||||
@ -315,16 +315,16 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
|
||||
{
|
||||
NE_MODULE *pTarget = NE_GetPtr( module );
|
||||
ERR("No implementation for %.*s.%s, setting to 0xdeadbeef\n",
|
||||
*((BYTE *)pTarget + pTarget->name_table),
|
||||
(char *)pTarget + pTarget->name_table + 1, func_name );
|
||||
*((BYTE *)pTarget + pTarget->ne_restab),
|
||||
(char *)pTarget + pTarget->ne_restab + 1, func_name );
|
||||
}
|
||||
if (!address) address = (FARPROC16) 0xdeadbeef;
|
||||
if (TRACE_ON(fixup))
|
||||
{
|
||||
NE_MODULE *pTarget = NE_GetPtr( module );
|
||||
TRACE("%d: %.*s.%s=%04x:%04x %s\n", i + 1,
|
||||
*((BYTE *)pTarget + pTarget->name_table),
|
||||
(char *)pTarget + pTarget->name_table + 1,
|
||||
*((BYTE *)pTarget + pTarget->ne_restab),
|
||||
(char *)pTarget + pTarget->ne_restab + 1,
|
||||
func_name, HIWORD(address), LOWORD(address),
|
||||
NE_GetRelocAddrName( rep->address_type, additive ) );
|
||||
}
|
||||
@ -458,7 +458,7 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
|
||||
int i;
|
||||
SEGTABLEENTRY * pSegTable = (SEGTABLEENTRY *) NE_SEG_TABLE(pModule);
|
||||
|
||||
if (pModule->flags & NE_FFLAGS_SELFLOAD)
|
||||
if (pModule->ne_flags & NE_FFLAGS_SELFLOAD)
|
||||
{
|
||||
HANDLE hf;
|
||||
HFILE16 hFile16;
|
||||
@ -470,8 +470,8 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
|
||||
WORD args[2];
|
||||
|
||||
TRACE_(module)("%.*s is a self-loading module!\n",
|
||||
*((BYTE*)pModule + pModule->name_table),
|
||||
(char *)pModule + pModule->name_table + 1);
|
||||
*((BYTE*)pModule + pModule->ne_restab),
|
||||
(char *)pModule + pModule->ne_restab + 1);
|
||||
if (!NE_LoadSegment( pModule, 1 )) return FALSE;
|
||||
selfloadheader = MapSL( MAKESEGPTR(SEL(pSegTable->hSeg), 0) );
|
||||
selfloadheader->EntryAddrProc = GetProcAddress16(mod,"EntryAddrProc");
|
||||
@ -495,12 +495,12 @@ BOOL NE_LoadAllSegments( NE_MODULE *pModule )
|
||||
_lclose16(hFile16);
|
||||
NtCurrentTeb()->WOW32Reserved = oldstack;
|
||||
|
||||
for (i = 2; i <= pModule->seg_count; i++)
|
||||
for (i = 2; i <= pModule->ne_cseg; i++)
|
||||
if (!NE_LoadSegment( pModule, i )) return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 1; i <= pModule->seg_count; i++)
|
||||
for (i = 1; i <= pModule->ne_cseg; i++)
|
||||
if (!NE_LoadSegment( pModule, i )) return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -528,13 +528,13 @@ static void NE_FixupSegmentPrologs(NE_MODULE *pModule, WORD segnum)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pModule->dgroup) return;
|
||||
if (!pModule->ne_autodata) return;
|
||||
|
||||
if (!(dgroup = SEL(pSegTable[pModule->dgroup-1].hSeg))) return;
|
||||
if (!(dgroup = SEL(pSegTable[pModule->ne_autodata-1].hSeg))) return;
|
||||
|
||||
pSeg = MapSL( MAKESEGPTR(sel, 0) );
|
||||
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule+pModule->entry_table);
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule+pModule->ne_enttab);
|
||||
|
||||
do {
|
||||
TRACE("num_entries: %d, bundle: %p, next: %04x, pSeg: %p\n", bundle->last - bundle->first, bundle, bundle->next, pSeg);
|
||||
@ -565,7 +565,7 @@ static void NE_FixupSegmentPrologs(NE_MODULE *pModule, WORD segnum)
|
||||
*(WORD *)(pFunc+1) = dgroup;
|
||||
}
|
||||
else
|
||||
if ((pModule->flags & NE_FFLAGS_MULTIPLEDATA)
|
||||
if ((pModule->ne_flags & NE_FFLAGS_MULTIPLEDATA)
|
||||
&& (entry->flags & 1)) /* exported ? */
|
||||
{
|
||||
TRACE("patch %04x:%04x -> nop, nop\n", sel, entry->offs);
|
||||
@ -596,7 +596,7 @@ DWORD WINAPI PatchCodeHandle16(HANDLE16 hSeg)
|
||||
TRACE_(module)("(%04x);\n", hSeg);
|
||||
|
||||
/* find the segment number of the module that belongs to hSeg */
|
||||
for (segnum = 1; segnum <= pModule->seg_count; segnum++)
|
||||
for (segnum = 1; segnum <= pModule->ne_cseg; segnum++)
|
||||
{
|
||||
if (SEL(pSegTable[segnum-1].hSeg) == sel)
|
||||
{
|
||||
@ -617,9 +617,9 @@ static VOID NE_GetDLLInitParams( NE_MODULE *pModule,
|
||||
{
|
||||
SEGTABLEENTRY *pSegTable = NE_SEG_TABLE( pModule );
|
||||
|
||||
if (!(pModule->flags & NE_FFLAGS_SINGLEDATA))
|
||||
if (!(pModule->ne_flags & NE_FFLAGS_SINGLEDATA))
|
||||
{
|
||||
if (pModule->flags & NE_FFLAGS_MULTIPLEDATA || pModule->dgroup)
|
||||
if (pModule->ne_flags & NE_FFLAGS_MULTIPLEDATA || pModule->ne_autodata)
|
||||
{
|
||||
/* Not SINGLEDATA */
|
||||
ERR_(dll)("Library is not marked SINGLEDATA\n");
|
||||
@ -633,9 +633,9 @@ static VOID NE_GetDLLInitParams( NE_MODULE *pModule,
|
||||
}
|
||||
else /* DATA SINGLE DLL */
|
||||
{
|
||||
if (pModule->dgroup) {
|
||||
*ds = SEL(pSegTable[pModule->dgroup-1].hSeg);
|
||||
*heap = pModule->heap_size;
|
||||
if (pModule->ne_autodata) {
|
||||
*ds = SEL(pSegTable[pModule->ne_autodata-1].hSeg);
|
||||
*heap = pModule->ne_heap;
|
||||
}
|
||||
else /* hmm, DLL has no dgroup,
|
||||
but why has it NE_FFLAGS_SINGLEDATA set ?
|
||||
@ -663,13 +663,13 @@ static BOOL NE_InitDLL( NE_MODULE *pModule )
|
||||
|
||||
pSegTable = NE_SEG_TABLE( pModule );
|
||||
|
||||
if (!(pModule->flags & NE_FFLAGS_LIBMODULE) ||
|
||||
(pModule->flags & NE_FFLAGS_WIN32)) return TRUE; /*not a library*/
|
||||
if (!(pModule->ne_flags & NE_FFLAGS_LIBMODULE) ||
|
||||
(pModule->ne_flags & NE_FFLAGS_WIN32)) return TRUE; /*not a library*/
|
||||
|
||||
/* Call USER signal handler for Win3.1 compatibility. */
|
||||
NE_CallUserSignalProc( pModule->self, USIG16_DLL_LOAD );
|
||||
|
||||
if (!pModule->cs) return TRUE; /* no initialization code */
|
||||
if (!SELECTOROF(pModule->ne_csip)) return TRUE; /* no initialization code */
|
||||
|
||||
|
||||
/* Registers at initialization must be:
|
||||
@ -689,14 +689,14 @@ static BOOL NE_InitDLL( NE_MODULE *pModule )
|
||||
context.SegEs = ds; /* who knows ... */
|
||||
context.SegFs = wine_get_fs();
|
||||
context.SegGs = wine_get_gs();
|
||||
context.SegCs = SEL(pSegTable[pModule->cs-1].hSeg);
|
||||
context.Eip = pModule->ip;
|
||||
context.SegCs = SEL(pSegTable[SELECTOROF(pModule->ne_csip)-1].hSeg);
|
||||
context.Eip = OFFSETOF(pModule->ne_csip);
|
||||
context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + (WORD)&((STACK16FRAME*)0)->bp;
|
||||
|
||||
pModule->cs = 0; /* Don't initialize it twice */
|
||||
pModule->ne_csip = 0; /* Don't initialize it twice */
|
||||
TRACE_(dll)("Calling LibMain for %.*s, cs:ip=%04lx:%04lx ds=%04lx di=%04x cx=%04x\n",
|
||||
*((BYTE*)pModule + pModule->name_table),
|
||||
(char *)pModule + pModule->name_table + 1,
|
||||
*((BYTE*)pModule + pModule->ne_restab),
|
||||
(char *)pModule + pModule->ne_restab + 1,
|
||||
context.SegCs, context.Eip, context.SegDs,
|
||||
LOWORD(context.Edi), LOWORD(context.Ecx) );
|
||||
WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)&context );
|
||||
@ -715,7 +715,7 @@ void NE_InitializeDLLs( HMODULE16 hModule )
|
||||
HMODULE16 *pDLL;
|
||||
|
||||
if (!(pModule = NE_GetPtr( hModule ))) return;
|
||||
assert( !(pModule->flags & NE_FFLAGS_WIN32) );
|
||||
assert( !(pModule->ne_flags & NE_FFLAGS_WIN32) );
|
||||
|
||||
if (pModule->dlls_to_init)
|
||||
{
|
||||
@ -768,8 +768,8 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason )
|
||||
WORD hInst, ds, heap;
|
||||
FARPROC16 entryPoint;
|
||||
|
||||
if (!(pModule->flags & NE_FFLAGS_LIBMODULE)) return;
|
||||
if (!(pModule->flags & NE_FFLAGS_BUILTIN) && pModule->expected_version < 0x0400) return;
|
||||
if (!(pModule->ne_flags & NE_FFLAGS_LIBMODULE)) return;
|
||||
if (!(pModule->ne_flags & NE_FFLAGS_BUILTIN) && pModule->ne_expver < 0x0400) return;
|
||||
if (!(entryPoint = GetProcAddress16( pModule->self, "DllEntryPoint" ))) return;
|
||||
|
||||
NE_GetDLLInitParams( pModule, &hInst, &ds, &heap );
|
||||
@ -778,7 +778,7 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason )
|
||||
NE_MODULE_NAME( pModule ),
|
||||
SELECTOROF(entryPoint), OFFSETOF(entryPoint) );
|
||||
|
||||
if ( pModule->flags & NE_FFLAGS_BUILTIN )
|
||||
if ( pModule->ne_flags & NE_FFLAGS_BUILTIN )
|
||||
{
|
||||
WinNEEntryProc entryProc = (WinNEEntryProc)((ENTRYPOINT16 *)MapSL( (SEGPTR)entryPoint ))->target;
|
||||
|
||||
@ -881,7 +881,7 @@ static void fill_init_list( struct ne_init_list *list, HMODULE16 hModule )
|
||||
int i;
|
||||
|
||||
if (!(pModule = NE_GetPtr( hModule ))) return;
|
||||
assert( !(pModule->flags & NE_FFLAGS_WIN32) );
|
||||
assert( !(pModule->ne_flags & NE_FFLAGS_WIN32) );
|
||||
|
||||
/* Never add a module twice */
|
||||
for ( i = 0; i < list->count; i++ )
|
||||
@ -889,23 +889,23 @@ static void fill_init_list( struct ne_init_list *list, HMODULE16 hModule )
|
||||
return;
|
||||
|
||||
/* Check for recursive call */
|
||||
if ( pModule->misc_flags & 0x80 ) return;
|
||||
if ( pModule->ne_flagsothers & 0x80 ) return;
|
||||
|
||||
TRACE_(dll)("(%s) - START\n", NE_MODULE_NAME(pModule) );
|
||||
|
||||
/* Tag current module to prevent recursive loop */
|
||||
pModule->misc_flags |= 0x80;
|
||||
pModule->ne_flagsothers |= 0x80;
|
||||
|
||||
/* Recursively attach all DLLs this one depends on */
|
||||
pModRef = (HMODULE16 *)((char *)pModule + pModule->modref_table);
|
||||
for ( i = 0; i < pModule->modref_count; i++ )
|
||||
pModRef = (HMODULE16 *)((char *)pModule + pModule->ne_modtab);
|
||||
for ( i = 0; i < pModule->ne_cmod; i++ )
|
||||
if ( pModRef[i] ) fill_init_list( list, pModRef[i] );
|
||||
|
||||
/* Add current module */
|
||||
add_to_init_list( list, pModule );
|
||||
|
||||
/* Remove recursion flag */
|
||||
pModule->misc_flags &= ~0x80;
|
||||
pModule->ne_flagsothers &= ~0x80;
|
||||
|
||||
TRACE_(dll)("(%s) - END\n", NE_MODULE_NAME(pModule) );
|
||||
}
|
||||
@ -986,12 +986,12 @@ DWORD WINAPI MyAlloc16( WORD wFlags, WORD wSize, WORD wElem )
|
||||
*/
|
||||
HINSTANCE16 NE_GetInstance( NE_MODULE *pModule )
|
||||
{
|
||||
if ( !pModule->dgroup )
|
||||
if ( !pModule->ne_autodata )
|
||||
return pModule->self;
|
||||
else
|
||||
{
|
||||
SEGTABLEENTRY *pSeg;
|
||||
pSeg = NE_SEG_TABLE( pModule ) + pModule->dgroup - 1;
|
||||
pSeg = NE_SEG_TABLE( pModule ) + pModule->ne_autodata - 1;
|
||||
return pSeg->hSeg;
|
||||
}
|
||||
}
|
||||
@ -1005,20 +1005,20 @@ BOOL NE_CreateSegment( NE_MODULE *pModule, int segnum )
|
||||
int minsize;
|
||||
unsigned char selflags;
|
||||
|
||||
assert( !(pModule->flags & NE_FFLAGS_WIN32) );
|
||||
assert( !(pModule->ne_flags & NE_FFLAGS_WIN32) );
|
||||
|
||||
if ( segnum < 1 || segnum > pModule->seg_count )
|
||||
if ( segnum < 1 || segnum > pModule->ne_cseg )
|
||||
return FALSE;
|
||||
|
||||
if ( (pModule->flags & NE_FFLAGS_SELFLOAD) && segnum != 1 )
|
||||
if ( (pModule->ne_flags & NE_FFLAGS_SELFLOAD) && segnum != 1 )
|
||||
return TRUE; /* selfloader allocates segment itself */
|
||||
|
||||
if ( (pSeg->flags & NE_SEGFLAGS_ALLOCATED) && segnum != pModule->dgroup )
|
||||
if ( (pSeg->flags & NE_SEGFLAGS_ALLOCATED) && segnum != pModule->ne_autodata )
|
||||
return TRUE; /* all but DGROUP only allocated once */
|
||||
|
||||
minsize = pSeg->minsize ? pSeg->minsize : 0x10000;
|
||||
if ( segnum == pModule->ss ) minsize += pModule->stack_size;
|
||||
if ( segnum == pModule->dgroup ) minsize += pModule->heap_size;
|
||||
if ( segnum == SELECTOROF(pModule->ne_sssp) ) minsize += pModule->ne_stack;
|
||||
if ( segnum == pModule->ne_autodata ) minsize += pModule->ne_heap;
|
||||
|
||||
selflags = (pSeg->flags & NE_SEGFLAGS_DATA) ? WINE_LDT_FLAGS_DATA : WINE_LDT_FLAGS_CODE;
|
||||
if (pSeg->flags & NE_SEGFLAGS_32BIT) selflags |= WINE_LDT_FLAGS_32BIT;
|
||||
@ -1035,12 +1035,12 @@ BOOL NE_CreateSegment( NE_MODULE *pModule, int segnum )
|
||||
BOOL NE_CreateAllSegments( NE_MODULE *pModule )
|
||||
{
|
||||
int i;
|
||||
for ( i = 1; i <= pModule->seg_count; i++ )
|
||||
for ( i = 1; i <= pModule->ne_cseg; i++ )
|
||||
if ( !NE_CreateSegment( pModule, i ) )
|
||||
return FALSE;
|
||||
|
||||
pModule->dgroup_entry = pModule->dgroup ? pModule->seg_table +
|
||||
(pModule->dgroup - 1) * sizeof(SEGTABLEENTRY) : 0;
|
||||
pModule->dgroup_entry = pModule->ne_autodata ? pModule->ne_segtab +
|
||||
(pModule->ne_autodata - 1) * sizeof(SEGTABLEENTRY) : 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1053,5 +1053,5 @@ BOOL16 WINAPI IsSharedSelector16( HANDLE16 selector )
|
||||
/* Check whether the selector belongs to a DLL */
|
||||
NE_MODULE *pModule = NE_GetPtr( selector );
|
||||
if (!pModule) return FALSE;
|
||||
return (pModule->flags & NE_FFLAGS_LIBMODULE) != 0;
|
||||
return (pModule->ne_flags & NE_FFLAGS_LIBMODULE) != 0;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ static const CALLFROM16 *get_entry_point( STACK16FRAME *frame, LPSTR module, LPS
|
||||
|
||||
max_offset = 0;
|
||||
*pOrd = 0;
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule + pModule->entry_table);
|
||||
bundle = (ET_BUNDLE *)((BYTE *)pModule + pModule->ne_enttab);
|
||||
do
|
||||
{
|
||||
entry = (ET_ENTRY *)((BYTE *)bundle+6);
|
||||
@ -260,7 +260,7 @@ static const CALLFROM16 *get_entry_point( STACK16FRAME *frame, LPSTR module, LPS
|
||||
/* Search for the name in the resident names table */
|
||||
/* (built-in modules have no non-resident table) */
|
||||
|
||||
p = (BYTE *)pModule + pModule->name_table;
|
||||
p = (BYTE *)pModule + pModule->ne_restab;
|
||||
memcpy( module, p + 1, *p );
|
||||
module[*p] = 0;
|
||||
|
||||
|
@ -72,7 +72,7 @@ typedef struct _HRSRC_MAP
|
||||
*/
|
||||
static HRSRC16 MapHRsrc32To16( NE_MODULE *pModule, HRSRC hRsrc32, WORD type )
|
||||
{
|
||||
HRSRC_MAP *map = (HRSRC_MAP *)pModule->hRsrcMap;
|
||||
HRSRC_MAP *map = pModule->rsrc32_map;
|
||||
HRSRC_ELEM *newElem;
|
||||
int i;
|
||||
|
||||
@ -84,7 +84,7 @@ static HRSRC16 MapHRsrc32To16( NE_MODULE *pModule, HRSRC hRsrc32, WORD type )
|
||||
ERR("Cannot allocate HRSRC map\n" );
|
||||
return 0;
|
||||
}
|
||||
pModule->hRsrcMap = map;
|
||||
pModule->rsrc32_map = map;
|
||||
}
|
||||
|
||||
/* Check whether HRSRC32 already in map */
|
||||
@ -125,7 +125,7 @@ static HRSRC16 MapHRsrc32To16( NE_MODULE *pModule, HRSRC hRsrc32, WORD type )
|
||||
*/
|
||||
static HRSRC MapHRsrc16To32( NE_MODULE *pModule, HRSRC16 hRsrc16 )
|
||||
{
|
||||
HRSRC_MAP *map = (HRSRC_MAP *)pModule->hRsrcMap;
|
||||
HRSRC_MAP *map = pModule->rsrc32_map;
|
||||
if ( !map || !hRsrc16 || hRsrc16 > map->nUsed ) return 0;
|
||||
|
||||
return map->elem[hRsrc16-1].hRsrc;
|
||||
@ -136,7 +136,7 @@ static HRSRC MapHRsrc16To32( NE_MODULE *pModule, HRSRC16 hRsrc16 )
|
||||
*/
|
||||
static WORD MapHRsrc16ToType( NE_MODULE *pModule, HRSRC16 hRsrc16 )
|
||||
{
|
||||
HRSRC_MAP *map = (HRSRC_MAP *)pModule->hRsrcMap;
|
||||
HRSRC_MAP *map = pModule->rsrc32_map;
|
||||
if ( !map || !hRsrc16 || hRsrc16 > map->nUsed ) return 0;
|
||||
|
||||
return map->elem[hRsrc16-1].type;
|
||||
@ -184,7 +184,7 @@ static inline FARPROC16 get_default_res_handler(void)
|
||||
*/
|
||||
static DWORD NE_FindNameTableId( NE_MODULE *pModule, LPCSTR typeId, LPCSTR resId )
|
||||
{
|
||||
NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
|
||||
NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->ne_rsrctab + 2);
|
||||
NE_NAMEINFO *pNameInfo;
|
||||
HGLOBAL16 handle;
|
||||
WORD *p;
|
||||
@ -332,10 +332,10 @@ HGLOBAL16 WINAPI NE_DefResourceHandler( HGLOBAL16 hMemObj, HMODULE16 hModule,
|
||||
{
|
||||
HANDLE fd;
|
||||
NE_MODULE* pModule = NE_GetPtr( hModule );
|
||||
if (pModule && (pModule->flags & NE_FFLAGS_BUILTIN))
|
||||
if (pModule && (pModule->ne_flags & NE_FFLAGS_BUILTIN))
|
||||
{
|
||||
HGLOBAL16 handle;
|
||||
WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
|
||||
WORD sizeShift = *(WORD *)((char *)pModule + pModule->ne_rsrctab);
|
||||
NE_NAMEINFO* pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
|
||||
|
||||
if ( hMemObj )
|
||||
@ -347,7 +347,7 @@ HGLOBAL16 WINAPI NE_DefResourceHandler( HGLOBAL16 hMemObj, HMODULE16 hModule,
|
||||
{
|
||||
/* NOTE: hRsrcMap points to start of built-in resource data */
|
||||
memcpy( GlobalLock16( handle ),
|
||||
(char *)pModule->hRsrcMap + (pNameInfo->offset << sizeShift),
|
||||
(char *)pModule->rsrc32_map + (pNameInfo->offset << sizeShift),
|
||||
pNameInfo->length << sizeShift );
|
||||
}
|
||||
return handle;
|
||||
@ -355,7 +355,7 @@ HGLOBAL16 WINAPI NE_DefResourceHandler( HGLOBAL16 hMemObj, HMODULE16 hModule,
|
||||
if (pModule && (fd = NE_OpenFile( pModule )) != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
HGLOBAL16 handle;
|
||||
WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
|
||||
WORD sizeShift = *(WORD *)((char *)pModule + pModule->ne_rsrctab);
|
||||
NE_NAMEINFO* pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
|
||||
|
||||
TRACE("loading, pos=%d, len=%d\n",
|
||||
@ -390,9 +390,9 @@ FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, LPCSTR typeId, FARPROC
|
||||
FARPROC16 prevHandler = NULL;
|
||||
NE_MODULE *pModule = NE_GetPtr( hModule );
|
||||
|
||||
if (!pModule || !pModule->res_table) return NULL;
|
||||
if (!pModule || !pModule->ne_rsrctab) return NULL;
|
||||
|
||||
pResTab = (LPBYTE)pModule + pModule->res_table;
|
||||
pResTab = (LPBYTE)pModule + pModule->ne_rsrctab;
|
||||
pTypeInfo = (NE_TYPEINFO *)(pResTab + 2);
|
||||
|
||||
TRACE("module=%04x type=%s\n", hModule, debugstr_a(typeId) );
|
||||
@ -892,11 +892,11 @@ HGLOBAL16 WINAPI AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size)
|
||||
HGLOBAL16 ret;
|
||||
|
||||
NE_MODULE *pModule = NE_GetPtr( hModule );
|
||||
if (!pModule || !pModule->res_table || !hRsrc) return 0;
|
||||
if (!pModule || !pModule->ne_rsrctab || !hRsrc) return 0;
|
||||
|
||||
TRACE("module=%04x res=%04x size=%ld\n", hModule, hRsrc, size );
|
||||
|
||||
sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
|
||||
sizeShift = *(WORD *)((char *)pModule + pModule->ne_rsrctab);
|
||||
pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
|
||||
if (size < (DWORD)pNameInfo->length << sizeShift)
|
||||
size = (DWORD)pNameInfo->length << sizeShift;
|
||||
@ -934,13 +934,13 @@ INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc )
|
||||
HFILE16 fd;
|
||||
NE_MODULE *pModule = NE_GetPtr( hModule );
|
||||
|
||||
if (!pModule || !pModule->res_table || !hRsrc) return -1;
|
||||
if (!pModule || !pModule->ne_rsrctab || !hRsrc) return -1;
|
||||
|
||||
TRACE("module=%04x res=%04x\n", pModule->self, hRsrc );
|
||||
|
||||
if ((fd = _lopen16( NE_MODULE_NAME(pModule), OF_READ )) != HFILE_ERROR16)
|
||||
{
|
||||
WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
|
||||
WORD sizeShift = *(WORD *)((char *)pModule + pModule->ne_rsrctab);
|
||||
NE_NAMEINFO *pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
|
||||
_llseek16( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET );
|
||||
}
|
||||
@ -969,7 +969,7 @@ HRSRC16 WINAPI FindResource16( HMODULE16 hModule, LPCSTR name, LPCSTR type )
|
||||
|
||||
TRACE("module=%04x name=%s type=%s\n", pModule->self, debugstr_a(name), debugstr_a(type) );
|
||||
|
||||
if (!pModule->res_table) return 0;
|
||||
if (!pModule->ne_rsrctab) return 0;
|
||||
|
||||
type = get_res_name( type );
|
||||
name = get_res_name( name );
|
||||
@ -983,7 +983,7 @@ HRSRC16 WINAPI FindResource16( HMODULE16 hModule, LPCSTR name, LPCSTR type )
|
||||
name = (LPCSTR)(ULONG_PTR)HIWORD(id);
|
||||
}
|
||||
}
|
||||
pResTab = (LPBYTE)pModule + pModule->res_table;
|
||||
pResTab = (LPBYTE)pModule + pModule->ne_rsrctab;
|
||||
pTypeInfo = (NE_TYPEINFO *)( pResTab + 2 );
|
||||
|
||||
for (;;)
|
||||
@ -1025,7 +1025,7 @@ HGLOBAL16 WINAPI LoadResource16( HMODULE16 hModule, HRSRC16 hRsrc )
|
||||
|
||||
/* first, verify hRsrc (just an offset from pModule to the needed pNameInfo) */
|
||||
|
||||
d = pModule->res_table + 2;
|
||||
d = pModule->ne_rsrctab + 2;
|
||||
pTypeInfo = (NE_TYPEINFO *)((char *)pModule + d);
|
||||
while( hRsrc > d )
|
||||
{
|
||||
@ -1111,9 +1111,9 @@ DWORD WINAPI SizeofResource16( HMODULE16 hModule, HRSRC16 hRsrc )
|
||||
|
||||
if (!hRsrc) return 0;
|
||||
if (!(pModule = get_module( hModule ))) return 0;
|
||||
if (pModule->res_table)
|
||||
if (pModule->ne_rsrctab)
|
||||
{
|
||||
WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
|
||||
WORD sizeShift = *(WORD *)((char *)pModule + pModule->ne_rsrctab);
|
||||
NE_NAMEINFO *pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
|
||||
return (DWORD)pNameInfo->length << sizeShift;
|
||||
}
|
||||
@ -1141,9 +1141,9 @@ BOOL16 WINAPI FreeResource16( HGLOBAL16 handle )
|
||||
|
||||
/* Try NE resource first */
|
||||
|
||||
if (pModule && pModule->res_table)
|
||||
if (pModule && pModule->ne_rsrctab)
|
||||
{
|
||||
NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
|
||||
NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->ne_rsrctab + 2);
|
||||
while (pTypeInfo->type_id)
|
||||
{
|
||||
WORD count;
|
||||
|
@ -193,7 +193,7 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
|
||||
fun->origfun = origfun;
|
||||
if (fun->name)
|
||||
return (FARPROC16)(SEGPTR)MAKELONG(((char*)fun-(char*)dll->funs),dll->funhandle);
|
||||
cpnt = (unsigned char *)pModule + pModule->name_table;
|
||||
cpnt = (unsigned char *)pModule + pModule->ne_restab;
|
||||
while (*cpnt) {
|
||||
cpnt += *cpnt + 1 + sizeof(WORD);
|
||||
if (*(WORD*)(cpnt+*cpnt+1) == ordinal) {
|
||||
|
@ -273,7 +273,7 @@ static TDB *TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, LPCSTR cmdline, BYT
|
||||
|
||||
pTask->hSelf = hTask;
|
||||
|
||||
pTask->version = pModule ? pModule->expected_version : 0x0400;
|
||||
pTask->version = pModule ? pModule->ne_expver : 0x0400;
|
||||
pTask->hModule = hModule;
|
||||
pTask->hParent = GetCurrentTask();
|
||||
pTask->magic = TDB_MAGIC;
|
||||
@ -856,7 +856,7 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
|
||||
hInstance = GlobalHandle16(hInstanceSelector);
|
||||
|
||||
/* no thunking for DLLs */
|
||||
if (NE_GetPtr(FarGetOwner16(hInstance))->flags & NE_FFLAGS_LIBMODULE)
|
||||
if (NE_GetPtr(FarGetOwner16(hInstance))->ne_flags & NE_FFLAGS_LIBMODULE)
|
||||
return func;
|
||||
|
||||
thunkaddr = TASK_AllocThunk();
|
||||
@ -916,10 +916,10 @@ static BOOL TASK_GetCodeSegment( FARPROC16 proc, NE_MODULE **ppModule,
|
||||
|
||||
/* Try pair of module handle / segment number */
|
||||
pModule = (NE_MODULE *) GlobalLock16( HIWORD( proc ) );
|
||||
if ( pModule && pModule->magic == IMAGE_OS2_SIGNATURE )
|
||||
if ( pModule && pModule->ne_magic == IMAGE_OS2_SIGNATURE )
|
||||
{
|
||||
segNr = LOWORD( proc );
|
||||
if ( segNr && segNr <= pModule->seg_count )
|
||||
if ( segNr && segNr <= pModule->ne_cseg )
|
||||
pSeg = NE_SEG_TABLE( pModule ) + segNr-1;
|
||||
}
|
||||
|
||||
@ -938,11 +938,11 @@ static BOOL TASK_GetCodeSegment( FARPROC16 proc, NE_MODULE **ppModule,
|
||||
pSeg = pModule? NE_SEG_TABLE( pModule ) : NULL;
|
||||
|
||||
if ( pModule )
|
||||
for ( segNr = 1; segNr <= pModule->seg_count; segNr++, pSeg++ )
|
||||
for ( segNr = 1; segNr <= pModule->ne_cseg; segNr++, pSeg++ )
|
||||
if ( GlobalHandleToSel16(pSeg->hSeg) == selector )
|
||||
break;
|
||||
|
||||
if ( pModule && segNr > pModule->seg_count )
|
||||
if ( pModule && segNr > pModule->ne_cseg )
|
||||
pSeg = NULL;
|
||||
}
|
||||
|
||||
@ -992,10 +992,10 @@ BOOL16 WINAPI GetCodeInfo16( FARPROC16 proc, SEGINFO *segInfo )
|
||||
segInfo->flags = pSeg->flags;
|
||||
segInfo->cbAlloc = pSeg->minsize;
|
||||
segInfo->h = pSeg->hSeg;
|
||||
segInfo->alignShift = pModule->alignment;
|
||||
segInfo->alignShift = pModule->ne_align;
|
||||
|
||||
if ( segNr == pModule->dgroup )
|
||||
segInfo->cbAlloc += pModule->heap_size + pModule->stack_size;
|
||||
if ( segNr == pModule->ne_autodata )
|
||||
segInfo->cbAlloc += pModule->ne_heap + pModule->ne_stack;
|
||||
|
||||
/* Return module handle in %es */
|
||||
|
||||
@ -1377,7 +1377,7 @@ static inline HMODULE16 GetExePtrHelper( HANDLE16 handle, HTASK16 *hTask )
|
||||
/* Check for module handle */
|
||||
|
||||
if (!(ptr = GlobalLock16( handle ))) return 0;
|
||||
if (((NE_MODULE *)ptr)->magic == IMAGE_OS2_SIGNATURE) return handle;
|
||||
if (((NE_MODULE *)ptr)->ne_magic == IMAGE_OS2_SIGNATURE) return handle;
|
||||
|
||||
/* Search for this handle inside all tasks */
|
||||
|
||||
@ -1396,7 +1396,7 @@ static inline HMODULE16 GetExePtrHelper( HANDLE16 handle, HTASK16 *hTask )
|
||||
|
||||
owner = FarGetOwner16( handle );
|
||||
if (!(ptr = GlobalLock16( owner ))) return 0;
|
||||
if (((NE_MODULE *)ptr)->magic == IMAGE_OS2_SIGNATURE) return owner;
|
||||
if (((NE_MODULE *)ptr)->ne_magic == IMAGE_OS2_SIGNATURE) return owner;
|
||||
|
||||
/* Search for the owner inside all tasks */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user