diff --git a/if1632/kernel.spec b/if1632/kernel.spec index be68a6ee674..7d8e9690b0c 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -6,7 +6,7 @@ file krnl386.exe # present in win31, win95 and nt351 1 stub FatalExit -2 stub ExitKernel +2 pascal16 ExitKernel() ExitKernel16 3 pascal GetVersion() GetVersion16 4 pascal16 LocalInit(word word word) LocalInit16 5 register LocalAlloc(word word) WIN16_LocalAlloc @@ -289,7 +289,7 @@ file krnl386.exe 348 pascal16 hmemcpy(ptr ptr long) hmemcpy16 349 pascal _hread(word segptr long) WIN16_hread 350 pascal _hwrite(word ptr long) _hwrite16 -351 stub BUNNY_351 +351 return BUNNY_351 0 0 352 pascal lstrcatn(segstr str word) lstrcatn16 353 pascal lstrcpyn(segptr str word) lstrcpyn16 354 pascal GetAppCompatFlags(word) GetAppCompatFlags16 @@ -370,7 +370,7 @@ file krnl386.exe 463 pascal SetThreadQueue(long word) SetThreadQueue16 464 pascal GetThreadQueue(long) GetThreadQueue16 465 stub NukeProcess -466 stub ExitProcess +466 pascal16 ExitProcess(word) ExitProcess16 467 stub WOACreateConsole 468 stub WOASpawnConApp 469 stub WOAGimmeTitle @@ -387,7 +387,7 @@ file krnl386.exe 480 pascal16 _EnterWin16Lock() SYSLEVEL_EnterWin16Lock 481 pascal16 _LeaveWin16Lock() SYSLEVEL_LeaveWin16Lock 482 pascal LoadSystemLibrary32(str) LoadLibrary32_16 # FIXME! -483 stub MapProcessHandle +483 pascal MapProcessHandle(long) MapProcessHandle 484 pascal SetProcessDWORD(long s_word long) SetProcessDword 485 pascal GetProcessDWORD(long s_word) GetProcessDword 486 pascal FreeLibrary32(long) FreeLibrary diff --git a/include/user.h b/include/user.h index d7559270912..d74db21375c 100644 --- a/include/user.h +++ b/include/user.h @@ -38,7 +38,6 @@ typedef struct tagUSER_DRIVER { extern USER_DRIVER *USER_Driver; -void USER_ExitWindows(void); WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID, DWORD dwFlags, HMODULE16 hModule ); diff --git a/include/wine/winbase16.h b/include/wine/winbase16.h index 7097106b5f6..054d70abda3 100644 --- a/include/wine/winbase16.h +++ b/include/wine/winbase16.h @@ -112,6 +112,7 @@ BOOL16 WINAPI CreateDirectory16(LPCSTR,LPVOID); BOOL16 WINAPI DefineHandleTable16(WORD); ATOM WINAPI DeleteAtom16(ATOM); BOOL16 WINAPI DeleteFile16(LPCSTR); +void WINAPI ExitKernel16(void); void WINAPI FatalAppExit16(UINT16,LPCSTR); ATOM WINAPI FindAtom16(SEGPTR); BOOL16 WINAPI FindClose16(HANDLE16); diff --git a/loader/main.c b/loader/main.c index 5f75eb0ab3a..a890ae06ca2 100644 --- a/loader/main.c +++ b/loader/main.c @@ -315,3 +315,21 @@ HINSTANCE MAIN_WinelibInit( int *argc, char *argv[] ) return wm->module; } +/*********************************************************************** + * ExitKernel16 (KERNEL.2) + * + * Clean-up everything and exit the Wine process. + * + */ +void WINAPI ExitKernel16( void ) +{ + /* Do the clean-up stuff */ + + WriteOutProfiles16(); + SHELL_SaveRegistry(); + + SERVICE_Exit(); + + exit(0); +} + diff --git a/loader/task.c b/loader/task.c index 05052e23f4e..520bf485318 100644 --- a/loader/task.c +++ b/loader/task.c @@ -583,8 +583,7 @@ void TASK_KillTask( HTASK16 hTask ) if (nTaskCount <= 1) { TRACE_(task)("this is the last task, exiting\n" ); - SERVICE_Exit(); - USER_ExitWindows(); + ExitKernel16(); } /* FIXME: Hack! Send a message to the initial task so that diff --git a/scheduler/process.c b/scheduler/process.c index 0ffa8019e79..718fa35a55b 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -673,6 +673,14 @@ void WINAPI ExitProcess( DWORD status ) TerminateProcess( GetCurrentProcess(), status ); } +/*********************************************************************** + * ExitProcess16 (KERNEL.466) + */ +void WINAPI ExitProcess16( WORD status ) +{ + SYSLEVEL_ReleaseWin16Lock(); + ExitProcess( status ); +} /****************************************************************************** * TerminateProcess (KERNEL32.684) @@ -831,6 +839,15 @@ HANDLE WINAPI OpenProcess( DWORD access, BOOL inherit, DWORD id ) return reply.handle; } +/********************************************************************* + * MapProcessHandle (KERNEL.483) + */ +DWORD WINAPI MapProcessHandle( HANDLE handle ) +{ + struct get_process_info_reply reply; + if ( !PROCESS_QueryInfo( handle, &reply ) ) return 0; + return (DWORD)reply.pid; +} /*********************************************************************** * GetCurrentProcessId (KERNEL32.199) diff --git a/windows/user.c b/windows/user.c index abc7fd57417..4f94ec77799 100644 --- a/windows/user.c +++ b/windows/user.c @@ -181,24 +181,6 @@ static void USER_AppExit( HINSTANCE16 hInstance ) } -/*********************************************************************** - * USER_ExitWindows - * - * Clean-up everything and exit the Wine process. - * This is the back-end of ExitWindows(), called when all windows - * have agreed to be terminated. - */ -void USER_ExitWindows(void) -{ - /* Do the clean-up stuff */ - - WriteOutProfiles16(); - SHELL_SaveRegistry(); - - exit(0); -} - - /*********************************************************************** * USER_SignalProc (USER.314) */ @@ -329,7 +311,7 @@ BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reserved ) } WIN_ReleaseWinArray(list); - if (result) USER_ExitWindows(); + if (result) ExitKernel16(); WIN_ReleaseDesktop(); return FALSE; }