Sun May 17 16:23:56 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [file/profile.c] Fix the return value of PROFILE_GetSection * [misc/crtdll.c] Do _getdrive, fix _chdrive. * [misc/commdlg.c] First cut at ChooseColor[WA]. * [misc/network.c] Do something sensible for WNetGetDirectoryType16. Sun May 17 10:21:35 1998 Andreas Mohr <100.30936@germany.net> * [controls/menu.c] Fixed disabled sub menus with MF_BYPOSITION that were not disabled. * [misc/crtdll.c] [relay32/crtdll.spec] [include/winerror.h] Implemented fscanf, fsetpos, _access, _fpreset (thanks to Uwe Bonnes), and _ltoa. * [loader/task.c] MakeProcInstance: must use CURRENT_DS if hInst == NULL. * [misc/shell.c] SHELL_GetResourceTable, InternalExtractIcon: fixed broken .ICO handling * [windows/winpos.c] DeferWindowPos: removed "same parent" requirement. Which doc states that this is required ? Sat May 16 20:08:11 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [loader/module.c] [loader/ne/module.c] More NE module cleanups. * [loader/task.c] Fixed SwitchStackBack(). Fri May 15 10:04:27 1998 Marcus Meissner <marcus@jet.franken.de> * [configure.in][inlcude/acconfig.h] Fixed broken OSS check, added check for working sigaltstack, fixed broken statfs checks on some linux systems. * [files/directory.c][loader/pe_image.c][relay32/builtin.c] [loader/module.c] Added handling of win32 module pathnames. * [relay32/wnaspi32.spec] New file. * [misc/lzexpand.c] LZCopy auto-decompresses LZ compressed files, even if they are not specially flagged. Fixes some InstallShield problems. * [misc/registry.c] Some fixes for RegQueryInfoKey (reference program monkey.exe from Win32 SDK works now better). Probably still has faults. Fri May 15 08:58:58 1998 Martin Boehme <boehme@informatik.mu-luebeck.de> * [graphics/mapping.c] [include/dc.h] [include/gdi.h] [objects/dc.c] Reworked the way world transformations and mapping modes are handled so that both of these transformations can be computed in a single step. * [graphics/painting.c] [graphics/path.c] [include/path.h] More GDI path support. * [graphics/x11drv/graphics.c] Fixed the return value of GRAPH_DrawArc for the zero height / zero width case to reflect Windows' behaviour. * [include/windows.h] [relay32/gdi32.spec] [objects/dc.c] Implemented ModifyWorldTransform and CombineTransform. Tue May 14 18:03:46 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [controls/commctrl.c][relay32/comctl32.spec] [controls/*.c][include/*.h] Implemented InitCommonControlsEx (dll version 4.72 compatible). InitCommonControls calls ImageCommonControlsEx. Registering code of the common controls had to be changed (see XXXX_Register functions). * [controls/status.c][include/commctrl.h][include/status.h] Implemented most new features and fixed the look and feel. * [contols/commctrl.c][include/commctrl.h][relay32/comctl32.spec] Implemented MenuHelp (incomplete). * [controls/status.c][controls/progress.c] Changed allocation strategy for control specific memory. * [controls/header.c][include/header.h][include/commctrl.h] First implementation of header control. * [windows/defwnd.c][windows/syscolors.c] Fixed default control colors for Win95 look. * [windows/nonclient.c] Fixed off by one error for Win95 look. Top border of child windows should be visible. * [misc/imagelist.h] Improved documentation and fixed some bugs. Thu May 14 15:42:21 1998 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [relay32/crtdll.spec] Added hypot,j0,j1,jn and ceil. Wed May 13 19:10:10 1998 Pascal Cuoq <pcuoq@ens-lyon.fr> * [controls/listbox.c] Item height is now exactly font height. Wine listboxes now behave like Windows' when they are created without WS_VSCROLL but the program subsequently calls ShowScrollBar or SetScrollInfo. Wed May 13 18:33:01 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [relay32/relay386.c] Restore ES also in the non-debug case. * [windows/event.c] Bugfix: Blocking TSXNextEvent could deadlock Wine. * [win32/process.c] [windows/message.c] Silly stubs for MsgWaitForMultipleObjects / PostThreadMessage that make some programs run better. * [windows/winproc.c] WINPROC_MapMsg32Ato16/16To32A: added WM_NOTIFY. * [win32/kernel32.c] Added 16->32 thunking and improved 32->16 thunking functions. * [tools/build.c] Added new variant of CallFrom16 stub for use with Win95 thunks. * [if1632/kernel.spec] [if1632/builtin.c] [win32/kernel32.c] Added a few undocumented KERNEL functions. * [loader/ne/module.c] [loader/ne/segment.c] Call DllEntryPoint for 16-bit DLLs with subsystem >= 4.0. * [win32/kernel32.spec] [win32/wow32.spec] [win32/ordinals.c] Use names from the Oct 94 beta release for undoc. functions. Wed May 13 14:18:26 1998 Matthew Becker <mbecker@glasscity.net> * [misc/registry.c] Code cleanup. * [misc/cpu.c] Commented out the registry puts temporarily. * [programs/regtest/*] New registry testing program. Tue May 12 22:54:03 1998 Michael Mess <michael@kawo2.rwth-aachen.de> * [multimedia/audio.c] ioctl's do not commute in /dev/dsp initialization. Tue May 12 20:11:42 1998 Karl Garrison <karlos@eznet.net> * [win32/console.c] Implemented SetConsoleTextAttribute, FillConsoleOutputCharacter. Improved cursor positioning. This allows for text colors in an xterm, rxvt, or console. Tue May 12 17:57:52 1998 Petter Reinholdtsen <pere@td.org.uit.no> * [Makefile.in] Create prefix/{bin|lib} directories if missing during install. Sun May 10 19:37:51 1998 Jan Willamowius <jan@janhh.shnet.org> * [multimedia/mmio.c] Have mmioSetBuffer return success (0), so Corel Draw 4 keeps working. (IO is still unbuffered) Wed May 6 16:57:55 1998 James Juran <jrj120@psu.edu> * [Makefile.in] [Make.rules.in] Changed "make clean" to remove `textedit` backup files (*%) * [controls/menu.c][graphics/x11drv/xfont.c][include/libres.h] [loader/main.c][loader/ne/module.c][scheduler/synchro.c] [win32/time.c][windows/winpos.c][include/windows.h] Fixed miscellaneous compilation warnings. * [misc/main.c][miscemu/main.c][include/main.h] Moved prototypes to new include file main.h, various cleanups. Tue May 5 21:05:06 1998 Morten Welinder <terra@diku.dk> * [misc/winsock.c] Don't refer to __FreeBSD__ when HAVE_STRERROR is meant. * [misc/debugstr.c] For debug_dumpstrSend, send strings to stderr. Tue May 5 21:47:40 1998 Huw D M Davies <h.davies1@physics.oxford.ac.uk> * [objects/region.c] Fix for REGION_RegionOp() if newReg is one of the source regions. Tue May 5 18:27:32 1998 Jim Peterson <jspeter@roanoke.infi.net> * [misc/main.c] Add '-h/-help' option and print WINE_RELEASE_INFO with usage message. * [misc/spy.c] Realign trace messages. Tue May 5 15:46:47 1998 Donnie V. Savage <dsavage@cisco.com> * [graphics/ddraw.c] Fixed compile warnings * [misc/winsock.c] Warnings should not be errors. Tue May 5 13:40:42 1998 Jim Peterson <jspeter@roanoke.infi.net> * [*/*] Remove many warnings through explicit casts, added #include's, and corrected printf formats. Tue May 5 05:18:12 1998 Insomnia (Stea Greene) <insomnia@core.binghamton.edu> * [graphics/ddraw.c] Kept unchanged portion of old palette when changing only a few palette entries. Really should only deallocate the changed cells. This make StarCraft work almost perfectly (sound overflows still cause static). Mon May 4 15:04:57 1998 Alexander V. Lukyanov <lav@long.yar.ru> * [misc/lstr.c] FormatMessage: terminate string on %0, undo linefeed strip.
430 lines
14 KiB
C
430 lines
14 KiB
C
/*
|
|
* Built-in modules
|
|
*
|
|
* Copyright 1996 Alexandre Julliard
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include <ctype.h>
|
|
#include <string.h>
|
|
#include "windows.h"
|
|
#include "builtin32.h"
|
|
#include "gdi.h"
|
|
#include "global.h"
|
|
#include "heap.h"
|
|
#include "module.h"
|
|
#include "miscemu.h"
|
|
#include "neexe.h"
|
|
#include "stackframe.h"
|
|
#include "user.h"
|
|
#include "process.h"
|
|
#include "debug.h"
|
|
|
|
/* Built-in modules descriptors */
|
|
/* Don't change these structures! (see tools/build.c) */
|
|
|
|
typedef struct
|
|
{
|
|
const char *name; /* DLL name */
|
|
void *module_start; /* 32-bit address of the module data */
|
|
int module_size; /* Size of the module data */
|
|
const BYTE *code_start; /* 32-bit address of DLL code */
|
|
const BYTE *data_start; /* 32-bit address of DLL data */
|
|
} WIN16_DESCRIPTOR;
|
|
|
|
typedef struct
|
|
{
|
|
const WIN16_DESCRIPTOR *descr; /* DLL descriptor */
|
|
int flags; /* flags (see below) */
|
|
} BUILTIN16_DLL;
|
|
|
|
/* DLL flags */
|
|
#define DLL_FLAG_NOT_USED 0x01 /* Use original Windows DLL if possible */
|
|
#define DLL_FLAG_ALWAYS_USED 0x02 /* Always use built-in DLL */
|
|
|
|
/* 16-bit DLLs */
|
|
|
|
extern const WIN16_DESCRIPTOR COMMDLG_Descriptor;
|
|
extern const WIN16_DESCRIPTOR COMPOBJ_Descriptor;
|
|
extern const WIN16_DESCRIPTOR DDEML_Descriptor;
|
|
extern const WIN16_DESCRIPTOR GDI_Descriptor;
|
|
extern const WIN16_DESCRIPTOR KERNEL_Descriptor;
|
|
extern const WIN16_DESCRIPTOR KEYBOARD_Descriptor;
|
|
extern const WIN16_DESCRIPTOR LZEXPAND_Descriptor;
|
|
extern const WIN16_DESCRIPTOR MMSYSTEM_Descriptor;
|
|
extern const WIN16_DESCRIPTOR MOUSE_Descriptor;
|
|
extern const WIN16_DESCRIPTOR OLE2CONV_Descriptor;
|
|
extern const WIN16_DESCRIPTOR OLE2DISP_Descriptor;
|
|
extern const WIN16_DESCRIPTOR OLE2NLS_Descriptor;
|
|
extern const WIN16_DESCRIPTOR OLE2PROX_Descriptor;
|
|
extern const WIN16_DESCRIPTOR OLE2THK_Descriptor;
|
|
extern const WIN16_DESCRIPTOR OLE2_Descriptor;
|
|
extern const WIN16_DESCRIPTOR OLECLI_Descriptor;
|
|
extern const WIN16_DESCRIPTOR OLESVR_Descriptor;
|
|
extern const WIN16_DESCRIPTOR SHELL_Descriptor;
|
|
extern const WIN16_DESCRIPTOR SOUND_Descriptor;
|
|
extern const WIN16_DESCRIPTOR STORAGE_Descriptor;
|
|
extern const WIN16_DESCRIPTOR STRESS_Descriptor;
|
|
extern const WIN16_DESCRIPTOR SYSTEM_Descriptor;
|
|
extern const WIN16_DESCRIPTOR TOOLHELP_Descriptor;
|
|
extern const WIN16_DESCRIPTOR TYPELIB_Descriptor;
|
|
extern const WIN16_DESCRIPTOR USER_Descriptor;
|
|
extern const WIN16_DESCRIPTOR VER_Descriptor;
|
|
extern const WIN16_DESCRIPTOR W32SYS_Descriptor;
|
|
extern const WIN16_DESCRIPTOR WIN32S16_Descriptor;
|
|
extern const WIN16_DESCRIPTOR WIN87EM_Descriptor;
|
|
extern const WIN16_DESCRIPTOR WINASPI_Descriptor;
|
|
extern const WIN16_DESCRIPTOR WINDEBUG_Descriptor;
|
|
extern const WIN16_DESCRIPTOR WING_Descriptor;
|
|
extern const WIN16_DESCRIPTOR WINSOCK_Descriptor;
|
|
extern const WIN16_DESCRIPTOR WPROCS_Descriptor;
|
|
|
|
/* Table of all built-in DLLs */
|
|
|
|
static BUILTIN16_DLL BuiltinDLLs[] =
|
|
{
|
|
{ &KERNEL_Descriptor, DLL_FLAG_ALWAYS_USED },
|
|
{ &USER_Descriptor, DLL_FLAG_ALWAYS_USED },
|
|
{ &GDI_Descriptor, DLL_FLAG_ALWAYS_USED },
|
|
{ &SYSTEM_Descriptor, DLL_FLAG_ALWAYS_USED },
|
|
{ &WPROCS_Descriptor, DLL_FLAG_ALWAYS_USED },
|
|
{ &WINDEBUG_Descriptor, DLL_FLAG_ALWAYS_USED },
|
|
{ &COMMDLG_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &COMPOBJ_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &DDEML_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &KEYBOARD_Descriptor, 0 },
|
|
{ &LZEXPAND_Descriptor, 0 },
|
|
{ &MMSYSTEM_Descriptor, 0 },
|
|
{ &MOUSE_Descriptor, 0 },
|
|
{ &OLE2CONV_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &OLE2DISP_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &OLE2NLS_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &OLE2PROX_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &OLE2THK_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &OLE2_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &OLECLI_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &OLESVR_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &SHELL_Descriptor, 0 },
|
|
{ &SOUND_Descriptor, 0 },
|
|
{ &STORAGE_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &STRESS_Descriptor, 0 },
|
|
{ &TOOLHELP_Descriptor, 0 },
|
|
{ &TYPELIB_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &VER_Descriptor, 0 },
|
|
{ &W32SYS_Descriptor, 0 },
|
|
{ &WIN32S16_Descriptor, 0 },
|
|
{ &WIN87EM_Descriptor, DLL_FLAG_NOT_USED },
|
|
{ &WINASPI_Descriptor, 0 },
|
|
{ &WING_Descriptor, 0 },
|
|
{ &WINSOCK_Descriptor, 0 },
|
|
/* Last entry */
|
|
{ NULL, 0 }
|
|
};
|
|
|
|
/* Ordinal number for interrupt 0 handler in WPROCS.DLL */
|
|
#define FIRST_INTERRUPT_ORDINAL 100
|
|
|
|
|
|
/***********************************************************************
|
|
* BUILTIN_DoLoadModule16
|
|
*
|
|
* Load a built-in Win16 module. Helper function for BUILTIN_LoadModule
|
|
* and BUILTIN_Init.
|
|
*/
|
|
static HMODULE16 BUILTIN_DoLoadModule16( const WIN16_DESCRIPTOR *descr )
|
|
{
|
|
NE_MODULE *pModule;
|
|
int minsize;
|
|
SEGTABLEENTRY *pSegTable;
|
|
|
|
HMODULE16 hModule = GLOBAL_CreateBlock( GMEM_MOVEABLE, descr->module_start,
|
|
descr->module_size, 0,
|
|
FALSE, FALSE, FALSE, NULL );
|
|
if (!hModule) return 0;
|
|
FarSetOwner( hModule, hModule );
|
|
|
|
TRACE(module, "Built-in %s: hmodule=%04x\n",
|
|
descr->name, hModule );
|
|
pModule = (NE_MODULE *)GlobalLock16( hModule );
|
|
pModule->self = hModule;
|
|
|
|
/* Allocate the code segment */
|
|
|
|
pSegTable = NE_SEG_TABLE( pModule );
|
|
pSegTable->selector = GLOBAL_CreateBlock( GMEM_FIXED, descr->code_start,
|
|
pSegTable->minsize, hModule,
|
|
TRUE, TRUE, FALSE, NULL );
|
|
if (!pSegTable->selector) return 0;
|
|
pSegTable++;
|
|
|
|
/* Allocate the data segment */
|
|
|
|
minsize = pSegTable->minsize ? pSegTable->minsize : 0x10000;
|
|
minsize += pModule->heap_size;
|
|
if (minsize > 0x10000) minsize = 0x10000;
|
|
pSegTable->selector = GLOBAL_Alloc( GMEM_FIXED, minsize,
|
|
hModule, FALSE, FALSE, FALSE );
|
|
if (!pSegTable->selector) return 0;
|
|
if (pSegTable->minsize) memcpy( GlobalLock16( pSegTable->selector ),
|
|
descr->data_start, pSegTable->minsize);
|
|
if (pModule->heap_size)
|
|
LocalInit( pSegTable->selector, pSegTable->minsize, minsize );
|
|
|
|
NE_RegisterModule( pModule );
|
|
return hModule;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BUILTIN_Init
|
|
*
|
|
* Load all built-in modules marked as 'always used'.
|
|
*/
|
|
BOOL32 BUILTIN_Init(void)
|
|
{
|
|
BUILTIN16_DLL *dll;
|
|
NE_MODULE *pModule;
|
|
WORD vector;
|
|
HMODULE16 hModule;
|
|
WORD cs, ds;
|
|
|
|
fnBUILTIN_LoadModule = BUILTIN_LoadModule;
|
|
|
|
for (dll = BuiltinDLLs; dll->descr; dll++)
|
|
{
|
|
if (dll->flags & DLL_FLAG_ALWAYS_USED)
|
|
if (!BUILTIN_DoLoadModule16( dll->descr )) return FALSE;
|
|
}
|
|
|
|
/* Set the USER and GDI heap selectors */
|
|
|
|
pModule = NE_GetPtr( GetModuleHandle16( "USER" ));
|
|
USER_HeapSel = (NE_SEG_TABLE( pModule ) + pModule->dgroup - 1)->selector;
|
|
pModule = NE_GetPtr( GetModuleHandle16( "GDI" ));
|
|
GDI_HeapSel = (NE_SEG_TABLE( pModule ) + pModule->dgroup - 1)->selector;
|
|
|
|
/* Initialize KERNEL.178 (__WINFLAGS) with the correct flags value */
|
|
|
|
hModule = GetModuleHandle16( "KERNEL" );
|
|
NE_SetEntryPoint( hModule, 178, GetWinFlags() );
|
|
|
|
/* Initialize KERNEL.454/455 (__FLATCS/__FLATDS) */
|
|
|
|
GET_CS(cs); GET_DS(ds);
|
|
NE_SetEntryPoint( hModule, 454, cs );
|
|
NE_SetEntryPoint( hModule, 455, ds );
|
|
|
|
/* Initialize the real-mode selector entry points */
|
|
|
|
#define SET_ENTRY_POINT( num, addr ) \
|
|
NE_SetEntryPoint( hModule, (num), GLOBAL_CreateBlock( GMEM_FIXED, \
|
|
DOSMEM_MapDosToLinear(addr), 0x10000, hModule, \
|
|
FALSE, FALSE, FALSE, NULL ))
|
|
|
|
SET_ENTRY_POINT( 183, 0x00000 ); /* KERNEL.183: __0000H */
|
|
SET_ENTRY_POINT( 174, 0xa0000 ); /* KERNEL.174: __A000H */
|
|
SET_ENTRY_POINT( 181, 0xb0000 ); /* KERNEL.181: __B000H */
|
|
SET_ENTRY_POINT( 182, 0xb8000 ); /* KERNEL.182: __B800H */
|
|
SET_ENTRY_POINT( 195, 0xc0000 ); /* KERNEL.195: __C000H */
|
|
SET_ENTRY_POINT( 179, 0xd0000 ); /* KERNEL.179: __D000H */
|
|
SET_ENTRY_POINT( 190, 0xe0000 ); /* KERNEL.190: __E000H */
|
|
SET_ENTRY_POINT( 173, 0xf0000 ); /* KERNEL.173: __ROMBIOS */
|
|
SET_ENTRY_POINT( 194, 0xf0000 ); /* KERNEL.194: __F000H */
|
|
NE_SetEntryPoint( hModule, 193, DOSMEM_BiosSeg ); /* KERNEL.193: __0040H */
|
|
#undef SET_ENTRY_POINT
|
|
|
|
/* Set interrupt vectors from entry points in WPROCS.DLL */
|
|
|
|
hModule = GetModuleHandle16( "WPROCS" );
|
|
for (vector = 0; vector < 256; vector++)
|
|
{
|
|
FARPROC16 proc = NE_GetEntryPoint( hModule,
|
|
FIRST_INTERRUPT_ORDINAL + vector );
|
|
assert(proc);
|
|
INT_SetHandler( vector, proc );
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BUILTIN_LoadModule
|
|
*
|
|
* Load a built-in module. If the 'force' parameter is FALSE, we only
|
|
* load the module if it has not been disabled via the -dll option.
|
|
*/
|
|
HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL32 force )
|
|
{
|
|
BUILTIN16_DLL *table;
|
|
char dllname[16], *p;
|
|
|
|
/* Fix the name in case we have a full path and extension */
|
|
|
|
if ((p = strrchr( name, '\\' ))) name = p + 1;
|
|
lstrcpyn32A( dllname, name, sizeof(dllname) );
|
|
if ((p = strrchr( dllname, '.' ))) *p = '\0';
|
|
|
|
for (table = BuiltinDLLs; table->descr; table++)
|
|
if (!lstrcmpi32A( table->descr->name, dllname )) break;
|
|
if (!table->descr) return 0;
|
|
if ((table->flags & DLL_FLAG_NOT_USED) && !force) return 0;
|
|
|
|
return BUILTIN_DoLoadModule16( table->descr );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BUILTIN_GetEntryPoint16
|
|
*
|
|
* Return the ordinal and name corresponding to a CS:IP address.
|
|
* This is used only by relay debugging.
|
|
*/
|
|
LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd )
|
|
{
|
|
static char buffer[80];
|
|
WORD ordinal, i, max_offset;
|
|
register BYTE *p;
|
|
NE_MODULE *pModule;
|
|
|
|
if (!(pModule = NE_GetPtr( FarGetOwner( GlobalHandle16(cs) ))))
|
|
return NULL;
|
|
|
|
/* Search for the ordinal */
|
|
|
|
p = (BYTE *)pModule + pModule->entry_table;
|
|
max_offset = 0;
|
|
ordinal = 1;
|
|
*pOrd = 0;
|
|
while (*p)
|
|
{
|
|
switch(p[1])
|
|
{
|
|
case 0: /* unused */
|
|
ordinal += *p;
|
|
p += 2;
|
|
break;
|
|
case 1: /* code segment */
|
|
i = *p;
|
|
p += 2;
|
|
while (i-- > 0)
|
|
{
|
|
p++;
|
|
if ((*(WORD *)p <= ip) && (*(WORD *)p >= max_offset))
|
|
{
|
|
max_offset = *(WORD *)p;
|
|
*pOrd = ordinal;
|
|
}
|
|
p += 2;
|
|
ordinal++;
|
|
}
|
|
break;
|
|
case 0xff: /* moveable (should not happen in built-in modules) */
|
|
TRACE( relay, "Built-in module has moveable entry\n" );
|
|
ordinal += *p;
|
|
p += 2 + *p * 6;
|
|
break;
|
|
default: /* other segment */
|
|
ordinal += *p;
|
|
p += 2 + *p * 3;
|
|
break;
|
|
}
|
|
}
|
|
|
|
/* Search for the name in the resident names table */
|
|
/* (built-in modules have no non-resident table) */
|
|
|
|
p = (BYTE *)pModule + pModule->name_table;
|
|
while (*p)
|
|
{
|
|
p += *p + 1 + sizeof(WORD);
|
|
if (*(WORD *)(p + *p + 1) == *pOrd) break;
|
|
}
|
|
|
|
sprintf( buffer, "%.*s.%d: %.*s",
|
|
*((BYTE *)pModule + pModule->name_table),
|
|
(char *)pModule + pModule->name_table + 1,
|
|
*pOrd, *p, (char *)(p + 1) );
|
|
return buffer;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
* BUILTIN_DefaultIntHandler
|
|
*
|
|
* Default interrupt handler.
|
|
*/
|
|
void BUILTIN_DefaultIntHandler( CONTEXT *context )
|
|
{
|
|
WORD ordinal;
|
|
STACK16FRAME *frame = CURRENT_STACK16;
|
|
BUILTIN_GetEntryPoint16( frame->entry_cs, frame->entry_ip, &ordinal );
|
|
INT_BARF( context, ordinal - FIRST_INTERRUPT_ORDINAL );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BUILTIN_ParseDLLOptions
|
|
*
|
|
* Set runtime DLL usage flags
|
|
*/
|
|
BOOL32 BUILTIN_ParseDLLOptions( const char *str )
|
|
{
|
|
BUILTIN16_DLL *dll;
|
|
const char *p;
|
|
|
|
while (*str)
|
|
{
|
|
while (*str && isspace(*str)) str++;
|
|
if (!*str) return TRUE;
|
|
if ((*str != '+') && (*str != '-')) return FALSE;
|
|
str++;
|
|
if (!(p = strchr( str, ',' ))) p = str + strlen(str);
|
|
while ((p > str) && isspace(p[-1])) p--;
|
|
if (p == str) return FALSE;
|
|
for (dll = BuiltinDLLs; dll->descr; dll++)
|
|
{
|
|
if (!lstrncmpi32A( str, dll->descr->name, (int)(p - str) ))
|
|
{
|
|
if (dll->descr->name[(int)(p-str)]) /* only partial match */
|
|
continue;
|
|
if (str[-1] == '-')
|
|
{
|
|
if (dll->flags & DLL_FLAG_ALWAYS_USED) return FALSE;
|
|
dll->flags |= DLL_FLAG_NOT_USED;
|
|
}
|
|
else dll->flags &= ~DLL_FLAG_NOT_USED;
|
|
break;
|
|
}
|
|
}
|
|
if (!dll->descr)
|
|
if (!BUILTIN32_EnableDLL( str, (int)(p - str), (str[-1] == '+') ))
|
|
return FALSE;
|
|
str = p;
|
|
while (*str && (isspace(*str) || (*str == ','))) str++;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* BUILTIN_PrintDLLs
|
|
*
|
|
* Print the list of built-in DLLs that can be disabled.
|
|
*/
|
|
void BUILTIN_PrintDLLs(void)
|
|
{
|
|
int i;
|
|
BUILTIN16_DLL *dll;
|
|
|
|
MSG("Example: -dll -ole2 Do not use emulated OLE2.DLL\n");
|
|
MSG("Available Win16 DLLs:\n");
|
|
for (i = 0, dll = BuiltinDLLs; dll->descr; dll++)
|
|
{
|
|
if (!(dll->flags & DLL_FLAG_ALWAYS_USED))
|
|
MSG("%-9s%c", dll->descr->name,
|
|
((++i) % 8) ? ' ' : '\n' );
|
|
}
|
|
MSG("\n");
|
|
BUILTIN32_PrintDLLs();
|
|
}
|