Unify startup sequence for Wine and WineLib.

This commit is contained in:
Ulrich Weigand 1999-07-24 12:20:24 +00:00 committed by Alexandre Julliard
parent 83579c8286
commit 2f4bd6617f
6 changed files with 23 additions and 287 deletions

View File

@ -176,14 +176,16 @@ static const CALLBACKS_TABLE CALLBACK_EmulatorTable =
(void *)THUNK_CallTo16_word_ww /* CallDrvAbortProc */
};
const CALLBACKS_TABLE *Callbacks = &CALLBACK_EmulatorTable;
CALLOUT_TABLE Callout = { 0 };
/***********************************************************************
* THUNK_Init
*/
BOOL THUNK_Init(void)
{
/* Set the window proc calling functions */
Callbacks = &CALLBACK_EmulatorTable;
/* Initialize Thunklets */
return THUNK_ThunkletInit();
}

View File

@ -18,6 +18,7 @@ extern void MAIN_ParseLanguageOption( char *arg );
extern void MAIN_ParseModeOption( char *arg );
extern BOOL RELAY_Init(void);
extern void THUNK_InitCallout(void);
extern int RELAY_ShowDebugmsgRelay(const char *func);
extern void CALL32_Init( void *func, void *target, void *stack );

View File

@ -46,6 +46,8 @@
#include "task.h"
#include "debugtools.h"
#include "psdrv.h"
#include "win16drv.h"
#include "callback.h"
#include "server.h"
#include "cursoricon.h"
#include "loadorder.h"
@ -101,6 +103,9 @@ BOOL MAIN_MainInit(void)
/* Read DOS config.sys */
if (!DOSCONF_ReadConfig()) return FALSE;
/* Initialize relay code */
if (!RELAY_Init()) return FALSE;
return TRUE;
}
@ -182,6 +187,8 @@ BOOL WINAPI MAIN_GdiInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved
/* GDI initialisation */
if(!GDI_Init()) return FALSE;
/* Create the Win16 printer driver */
if (!WIN16DRV_Init()) return FALSE;
/* PSDRV initialization */
if(!PSDRV_Init()) return FALSE;
@ -256,9 +263,8 @@ BOOL WINAPI MAIN_UserInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserve
/* Set double click time */
SetDoubleClickTime( GetProfileIntA("windows","DoubleClickSpeed",452) );
/* Create task message queue for the initial task */
queueSize = GetProfileIntA( "windows", "DefaultQueueSize", 8 );
if (!SetMessageQueue( queueSize )) return FALSE;
/* Create message queue of initial thread */
InitThreadInput16( 0, 0 );
/* Create desktop window */
if (!WIN_CreateDesktopWindow()) return FALSE;
@ -296,6 +302,7 @@ HINSTANCE MAIN_WinelibInit( int *argc, char *argv[] )
if (!MAIN_MainInit()) return 0;
/* Initialize KERNEL */
if (!LoadLibrary16( "KERNEL" )) return 0;
if (!LoadLibraryA( "KERNEL32" )) return 0;
/* Create and switch to initial task */
@ -311,9 +318,13 @@ HINSTANCE MAIN_WinelibInit( int *argc, char *argv[] )
if (!TASK_Create( pModule, FALSE )) return 0;
/* Initialize GDI and USER */
if (!LoadLibraryA( "GDI32.DLL" )) return 0;
if (!LoadLibraryA( "USER32.DLL" )) return 0;
/* Load system DLLs into the initial process (and initialize them) */
if ( !LoadLibrary16("GDI.EXE" ) || !LoadLibraryA("GDI32.DLL" )
|| !LoadLibrary16("USER.EXE") || !LoadLibraryA("USER32.DLL"))
ExitProcess( 1 );
/* Get pointers to USER routines called by KERNEL */
THUNK_InitCallout();
return wm->module;
}

View File

@ -7,7 +7,6 @@ VPATH = @srcdir@
MODULE = misc
C_SRCS = \
callback.c \
cdrom.c \
comm.c \
crtdll.c \

View File

@ -1,257 +0,0 @@
/*
* Function callbacks for the library
*
* Copyright 1997 Alexandre Julliard
*/
#include <assert.h>
#include "winuser.h"
#include "callback.h"
#include "task.h"
#include "syslevel.h"
#include "cursoricon.h"
#include "user.h"
#include "queue.h"
#include "debugtools.h"
#include "win.h"
DEFAULT_DEBUG_CHANNEL(relay)
/**********************************************************************
* CALLBACK_CallWndProc
*/
static LRESULT WINAPI CALLBACK_CallWndProc( WNDPROC16 proc, HWND16 hwnd,
UINT16 msg, WPARAM16 wParam,
LPARAM lParam )
{
LRESULT retvalue;
int iWndsLocks;
/* To avoid any deadlocks, all the locks on the windows structures
must be suspended before the control is passed to the application */
iWndsLocks = WIN_SuspendWndsLock();
retvalue = proc( hwnd, msg, wParam, lParam );
WIN_RestoreWndsLock(iWndsLocks);
return retvalue;
}
/**********************************************************************
* CALLBACK_CallRegisterProc
*/
static LONG WINAPI CALLBACK_CallRegisterProc( CONTEXT86 *context, INT offset)
{
ERR("Cannot call a register proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallDriverProc
*/
static LRESULT WINAPI CALLBACK_CallDriverProc( DRIVERPROC16 proc, DWORD dwId,
HDRVR16 hdrvr, UINT16 msg,
LPARAM lp1, LPARAM lp2 )
{
ERR("Cannot call a 16-bit driver proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallDriverCallback
*/
static LRESULT WINAPI CALLBACK_CallDriverCallback( FARPROC16 proc,
HANDLE16 hDev, UINT16 msg,
DWORD dwUser, LPARAM lp1,
LPARAM lp2 )
{
ERR("Cannot call a 16-bit driver proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallTimeFuncProc
*/
static LRESULT WINAPI CALLBACK_CallTimeFuncProc( FARPROC16 proc, WORD id,
UINT16 msg, DWORD dwUser,
LPARAM lp1, LPARAM lp2 )
{
ERR("Cannot call a 16-bit multimedia timer proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallWindowsExitProc
*/
static INT16 WINAPI CALLBACK_CallWindowsExitProc( FARPROC16 proc, INT16 type)
{
ERR("Cannot call a 16-bit WEP routine in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallWordBreakProc
*/
static INT16 WINAPI CALLBACK_CallWordBreakProc( EDITWORDBREAKPROC16 proc,
SEGPTR text, INT16 word,
INT16 len, INT16 action )
{
ERR("Cannot call a 16-bit word break proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallBootAppProc
*/
static void WINAPI CALLBACK_CallBootAppProc( FARPROC16 proc, HANDLE16 module,
HFILE16 file )
{
ERR("Cannot call a 16-bit self-load handler in Winelib\n" );
assert( FALSE );
return;
}
/**********************************************************************
* CALLBACK_CallLoadAppSegProc
*/
static WORD WINAPI CALLBACK_CallLoadAppSegProc( FARPROC16 proc,
HANDLE16 module, HFILE16 file,
WORD seg )
{
ERR("Cannot call a 16-bit self-load handler in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallLocalNotifyFunc
*/
static WORD WINAPI CALLBACK_CallLocalNotifyFunc( FARPROC16 proc,
WORD wMsg, HLOCAL16 hMem, WORD wArg )
{
ERR("Cannot call a 16-bit notification handler in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallResourceHandlerProc
*/
static HGLOBAL16 WINAPI CALLBACK_CallResourceHandlerProc( FARPROC16 proc,
HGLOBAL16 hMemObj,
HMODULE16 hModule,
HRSRC16 hRsrc )
{
ERR("Cannot call a 16-bit resource handler in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallASPIPostProc
*/
static LRESULT WINAPI CALLBACK_CallASPIPostProc( FARPROC16 proc, SEGPTR ptr )
{
ERR("Cannot call a 16-bit ASPI proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallWOWCallbackProc
*/
static DWORD WINAPI CALLBACK_CallWOWCallbackProc( FARPROC16 proc, DWORD dw )
{
ERR("Cannot call a WOW thunk proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallWOWCallback16Ex
*/
static BOOL WINAPI CALLBACK_CallWOWCallback16Ex( FARPROC16 proc, DWORD dwFlags,
DWORD cbArgs, LPVOID xargs, LPDWORD pdwret )
{
ERR("Cannot call a WOW thunk proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_CallUTProc
*/
static DWORD WINAPI CALLBACK_CallUTProc( FARPROC16 proc, DWORD w1, DWORD w2 )
{
ERR("Cannot call a UT thunk proc in Winelib\n" );
assert( FALSE );
return 0;
}
/**********************************************************************
* CALLBACK_WinelibTable
*
* The callbacks function table for Winelib
*/
static const CALLBACKS_TABLE CALLBACK_WinelibTable =
{
CALLBACK_CallRegisterProc, /* CallRegisterShortProc */
CALLBACK_CallRegisterProc, /* CallRegisterLongProc */
NULL, /* CallFrom16WndProc */
CALLBACK_CallWndProc, /* CallWndProc */
CALLBACK_CallDriverProc, /* CallDriverProc */
CALLBACK_CallDriverCallback, /* CallDriverCallback */
CALLBACK_CallTimeFuncProc, /* CallTimeFuncProc */
CALLBACK_CallWindowsExitProc, /* CallWindowsExitProc */
CALLBACK_CallWordBreakProc, /* CallWordBreakProc */
CALLBACK_CallBootAppProc, /* CallBootAppProc */
CALLBACK_CallLoadAppSegProc, /* CallLoadAppSegProc */
CALLBACK_CallLocalNotifyFunc, /* CallLocalNotifyFunc */
CALLBACK_CallResourceHandlerProc, /* CallResourceHandlerProc */
CALLBACK_CallWOWCallbackProc, /* CallWOWCallbackProc */
CALLBACK_CallWOWCallback16Ex, /* CallWOWCallback16Ex */
CALLBACK_CallUTProc, /* CallUTProc */
CALLBACK_CallASPIPostProc, /* CallASPIPostProc */
/* The graphics driver callbacks are never used in Winelib */
NULL, /* CallDrvControlProc */
NULL, /* CallDrvEnableProc */
NULL, /* CallDrvEnumDFontsProc */
NULL, /* CallDrvEnumObjProc */
NULL, /* CallDrvOutputProc */
NULL, /* CallDrvRealizeProc */
NULL, /* CallDrvStretchBltProc */
NULL, /* CallDrvExtTextOutProc */
NULL, /* CallDrvGetCharWidth */
NULL /* CallDrvAbortProc */
};
const CALLBACKS_TABLE *Callbacks = &CALLBACK_WinelibTable;
/**********************************************************************
* CALLOUT_Table
*
* The callout function table for Winelib
*/
CALLOUT_TABLE Callout =
{
PeekMessage16, PeekMessageA, PeekMessageW,
GetMessage16, GetMessageA, GetMessageW,
SendMessage16, SendMessageA, SendMessageW,
PostMessage16, PostMessageA, PostMessageW,
PostAppMessage16, PostThreadMessageA, PostThreadMessageW,
TranslateMessage16, TranslateMessage,
DispatchMessage16, DispatchMessageA, DispatchMessageW,
RedrawWindow16, RedrawWindow,
UserSignalProc,
InitApp16, InitThreadInput16,
UserYield16,
CURSORICON_Destroy
};

View File

@ -10,7 +10,6 @@
#include "debugger.h"
#include "main.h"
#include "miscemu.h"
#include "win16drv.h"
#include "module.h"
#include "options.h"
#include "process.h"
@ -24,30 +23,11 @@ static int MAIN_argc;
static char **MAIN_argv;
/***********************************************************************
* Emulator initialisation
*/
BOOL MAIN_EmulatorInit(void)
{
/* Main initialization */
if (!MAIN_MainInit()) return FALSE;
/* Initialize relay code */
if (!RELAY_Init()) return FALSE;
/* Create the Win16 printer driver */
if (!WIN16DRV_Init()) return FALSE;
return TRUE;
}
/***********************************************************************
* Main loop of initial task
*/
void MAIN_EmulatorRun( void )
{
extern void THUNK_InitCallout( void );
char startProg[256], defProg[256];
HINSTANCE handle;
int i, tasks = 0;
@ -148,7 +128,7 @@ int main( int argc, char *argv[] )
TASK_AddTaskEntryBreakpoint = DEBUG_AddTaskEntryBreakpoint;
/* Initialize everything */
if (!MAIN_EmulatorInit()) return 1;
if (!MAIN_MainInit()) return 1;
/* Load kernel modules */
if (!LoadLibrary16( "KERNEL" )) return 1;