mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-18 10:38:34 +00:00
Moved TASK_Create call to KERNEL initialisation routine.
Clear last error code before calling main entry point (reported by James Juran).
This commit is contained in:
parent
350c04b516
commit
973ce4a088
|
@ -25,6 +25,8 @@ extern BOOL THUNK_Init(void);
|
|||
static BOOL process_attach(void)
|
||||
{
|
||||
HMODULE16 hModule;
|
||||
STARTUPINFOA startup_info;
|
||||
UINT cmdShow = 1; /* SW_SHOWNORMAL but we don't want to include winuser.h here */
|
||||
|
||||
/* Setup codepage info */
|
||||
CODEPAGE_Init();
|
||||
|
@ -77,6 +79,13 @@ static BOOL process_attach(void)
|
|||
/* Read DOS config.sys */
|
||||
if (!DOSCONF_ReadConfig()) return FALSE;
|
||||
|
||||
/* Create 16-bit task */
|
||||
GetStartupInfoA( &startup_info );
|
||||
if (startup_info.dwFlags & STARTF_USESHOWWINDOW) cmdShow = startup_info.wShowWindow;
|
||||
if (!TASK_Create( (NE_MODULE *)GlobalLock16( MapHModuleLS(GetModuleHandleA(0)) ),
|
||||
cmdShow, NtCurrentTeb(), NULL, 0 ))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -229,6 +229,9 @@ static BOOL process_init( char *argv[] )
|
|||
*/
|
||||
static int load_system_dlls(void)
|
||||
{
|
||||
/* Load KERNEL */
|
||||
if (!LoadLibraryA( "KERNEL32" )) return 0;
|
||||
|
||||
/* Get pointers to USER routines called by KERNEL */
|
||||
THUNK_InitCallout();
|
||||
|
||||
|
@ -297,7 +300,6 @@ static void start_process(void)
|
|||
{
|
||||
struct init_process_done_request *req = get_req_buffer();
|
||||
int debugged, console_app;
|
||||
UINT cmdShow = SW_SHOWNORMAL;
|
||||
LPTHREAD_START_ROUTINE entry;
|
||||
HMODULE module = current_process.exe_modref->module;
|
||||
|
||||
|
@ -326,16 +328,6 @@ static void start_process(void)
|
|||
* is sent by REQ_INIT_PROCESS_DONE */
|
||||
if (!SIGNAL_Init()) goto error;
|
||||
|
||||
/* Load KERNEL (necessary for TASK_Create) */
|
||||
if (!LoadLibraryA( "KERNEL32" )) goto error;
|
||||
|
||||
/* Create 16-bit task */
|
||||
if (current_startupinfo.dwFlags & STARTF_USESHOWWINDOW)
|
||||
cmdShow = current_startupinfo.wShowWindow;
|
||||
if (!TASK_Create( (NE_MODULE *)GlobalLock16( MapHModuleLS(module) ), cmdShow,
|
||||
NtCurrentTeb(), NULL, 0 ))
|
||||
goto error;
|
||||
|
||||
/* Load the system dlls */
|
||||
if (!load_system_dlls()) goto error;
|
||||
|
||||
|
@ -351,6 +343,7 @@ static void start_process(void)
|
|||
if (debugged) DbgBreakPoint();
|
||||
/* FIXME: should use _PEB as parameter for NT 3.5 programs !
|
||||
* Dunno about other OSs */
|
||||
SetLastError(0); /* clear error code */
|
||||
ExitThread( entry(NULL) );
|
||||
|
||||
error:
|
||||
|
|
Loading…
Reference in a new issue