2 * 16-bit kernel initialization code
4 * Copyright 2000 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/winuser16.h"
30 #include "kernel16_private.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(module);
35 extern DWORD WINAPI GetProcessFlags( DWORD processid );
37 static DWORD process_dword;
39 /***********************************************************************
40 * KERNEL thread initialisation routine
42 static void thread_attach(void)
44 /* allocate the 16-bit stack (FIXME: should be done lazily) */
45 HGLOBAL16 hstack = WOWGlobalAlloc16( GMEM_FIXED, 0x10000 );
46 kernel_get_thread_data()->stack_sel = GlobalHandleToSel16( hstack );
47 NtCurrentTeb()->WOW32Reserved = (void *)MAKESEGPTR( kernel_get_thread_data()->stack_sel,
48 0x10000 - sizeof(STACK16FRAME) );
49 memset( (char *)GlobalLock16(hstack) + 0x10000 - sizeof(STACK16FRAME), 0, sizeof(STACK16FRAME) );
53 /***********************************************************************
54 * KERNEL thread finalisation routine
56 static void thread_detach(void)
58 /* free the 16-bit stack */
59 WOWGlobalFree16( kernel_get_thread_data()->stack_sel );
60 NtCurrentTeb()->WOW32Reserved = 0;
61 if (NtCurrentTeb()->Tib.SubSystemTib) TASK_ExitTask();
65 /**************************************************************************
68 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
72 case DLL_PROCESS_ATTACH:
73 LoadLibrary16( "krnl386.exe" );
75 case DLL_THREAD_ATTACH:
78 case DLL_THREAD_DETACH:
86 /**************************************************************************
87 * DllEntryPoint (KERNEL.669)
89 BOOL WINAPI KERNEL_DllEntryPoint( DWORD reasion, HINSTANCE16 inst, WORD ds,
90 WORD heap, DWORD reserved1, WORD reserved2 )
94 /* the entry point can be called multiple times */
95 if (done) return TRUE;
98 /* create the shared heap for broken win95 native dlls */
99 HeapCreate( HEAP_SHARED, 0, 0 );
101 /* setup emulation of protected instructions from 32-bit code */
102 if (GetVersion() & 0x80000000) RtlAddVectoredExceptionHandler( TRUE, INSTR_vectored_handler );
104 /* Initialize 16-bit thunking entry points */
105 if (!WOWTHUNK_Init()) return FALSE;
107 /* Initialize DOS memory */
108 if (!DOSMEM_Init()) return FALSE;
110 /* Initialize special KERNEL entry points */
112 NE_SetEntryPoint( inst, 178, GetWinFlags16() );
114 NE_SetEntryPoint( inst, 454, wine_get_cs() );
115 NE_SetEntryPoint( inst, 455, wine_get_ds() );
117 NE_SetEntryPoint( inst, 183, DOSMEM_0000H ); /* KERNEL.183: __0000H */
118 NE_SetEntryPoint( inst, 173, DOSMEM_BiosSysSeg ); /* KERNEL.173: __ROMBIOS */
119 NE_SetEntryPoint( inst, 193, DOSMEM_BiosDataSeg ); /* KERNEL.193: __0040H */
120 NE_SetEntryPoint( inst, 194, DOSMEM_BiosSysSeg ); /* KERNEL.194: __F000H */
122 /* Initialize KERNEL.THHOOK */
123 TASK_InstallTHHook(MapSL((SEGPTR)GetProcAddress16( inst, (LPCSTR)332 )));
124 TASK_CreateMainTask();
126 /* Initialize the real-mode selector entry points */
127 #define SET_ENTRY_POINT( num, addr ) \
128 NE_SetEntryPoint( inst, (num), GLOBAL_CreateBlock( GMEM_FIXED, \
129 DOSMEM_MapDosToLinear(addr), 0x10000, inst, \
130 WINE_LDT_FLAGS_DATA ))
132 SET_ENTRY_POINT( 174, 0xa0000 ); /* KERNEL.174: __A000H */
133 SET_ENTRY_POINT( 181, 0xb0000 ); /* KERNEL.181: __B000H */
134 SET_ENTRY_POINT( 182, 0xb8000 ); /* KERNEL.182: __B800H */
135 SET_ENTRY_POINT( 195, 0xc0000 ); /* KERNEL.195: __C000H */
136 SET_ENTRY_POINT( 179, 0xd0000 ); /* KERNEL.179: __D000H */
137 SET_ENTRY_POINT( 190, 0xe0000 ); /* KERNEL.190: __E000H */
138 #undef SET_ENTRY_POINT
140 /* Force loading of some dlls */
141 LoadLibrary16( "system.drv" );
142 LoadLibrary16( "comm.drv" );
147 /***********************************************************************
148 * GetVersion (KERNEL.3)
150 DWORD WINAPI GetVersion16(void)
152 static WORD dosver, winver;
154 if (!dosver) /* not determined yet */
156 RTL_OSVERSIONINFOEXW info;
158 info.dwOSVersionInfoSize = sizeof(info);
159 if (RtlGetVersion( &info )) return 0;
161 if (info.dwMajorVersion <= 3)
162 winver = MAKEWORD( info.dwMajorVersion, info.dwMinorVersion );
164 winver = MAKEWORD( 3, 95 );
166 switch(info.dwPlatformId)
168 case VER_PLATFORM_WIN32s:
169 switch(MAKELONG( info.dwMinorVersion, info.dwMajorVersion ))
172 dosver = 0x0303; /* DOS 3.3 for Windows 2.0 */
175 dosver = 0x0500; /* DOS 5.0 for Windows 3.0 */
178 dosver = 0x0616; /* DOS 6.22 for Windows 3.1 and later */
182 case VER_PLATFORM_WIN32_WINDOWS:
183 /* DOS 8.0 for WinME, 7.0 for Win95/98 */
184 if (info.dwMinorVersion >= 90) dosver = 0x0800;
185 else dosver = 0x0700;
187 case VER_PLATFORM_WIN32_NT:
188 dosver = 0x0500; /* always DOS 5.0 for NT */
191 TRACE( "DOS %d.%02d Win %d.%02d\n",
192 HIBYTE(dosver), LOBYTE(dosver), LOBYTE(winver), HIBYTE(winver) );
194 return MAKELONG( winver, dosver );
197 /***********************************************************************
198 * Reserved1 (KERNEL.77)
200 SEGPTR WINAPI KERNEL_AnsiNext16(SEGPTR current)
202 return (*(char *)MapSL(current)) ? current + 1 : current;
205 /***********************************************************************
206 * Reserved2(KERNEL.78)
208 SEGPTR WINAPI KERNEL_AnsiPrev16( SEGPTR start, SEGPTR current )
210 return (current==start)?start:current-1;
213 /***********************************************************************
214 * Reserved3 (KERNEL.79)
216 SEGPTR WINAPI KERNEL_AnsiUpper16( SEGPTR strOrChar )
218 /* uppercase only one char if strOrChar < 0x10000 */
219 if (HIWORD(strOrChar))
221 char *s = MapSL(strOrChar);
229 else return toupper((char)strOrChar);
232 /***********************************************************************
233 * Reserved4 (KERNEL.80)
235 SEGPTR WINAPI KERNEL_AnsiLower16( SEGPTR strOrChar )
237 /* lowercase only one char if strOrChar < 0x10000 */
238 if (HIWORD(strOrChar))
240 char *s = MapSL(strOrChar);
248 else return tolower((char)strOrChar);
251 /***********************************************************************
252 * Reserved5 (KERNEL.87)
254 INT16 WINAPI KERNEL_lstrcmp16( LPCSTR str1, LPCSTR str2 )
256 return (INT16)strcmp( str1, str2 );
259 /***********************************************************************
260 * lstrcpy (KERNEL.88)
262 SEGPTR WINAPI lstrcpy16( SEGPTR dst, LPCSTR src )
264 if (!lstrcpyA( MapSL(dst), src )) dst = 0;
268 /***********************************************************************
269 * lstrcat (KERNEL.89)
271 SEGPTR WINAPI lstrcat16( SEGPTR dst, LPCSTR src )
273 /* Windows does not check for NULL pointers here, so we don't either */
274 strcat( MapSL(dst), src );
278 /***********************************************************************
279 * lstrlen (KERNEL.90)
281 INT16 WINAPI lstrlen16( LPCSTR str )
283 return (INT16)lstrlenA( str );
286 /***********************************************************************
287 * OutputDebugString (KERNEL.115)
289 void WINAPI OutputDebugString16( LPCSTR str )
291 OutputDebugStringA( str );
294 /***********************************************************************
295 * GetWinFlags (KERNEL.132)
297 DWORD WINAPI GetWinFlags16(void)
299 static const long cpuflags[5] = { WF_CPU086, WF_CPU186, WF_CPU286, WF_CPU386, WF_CPU486 };
306 /* There doesn't seem to be any Pentium flag. */
307 result = cpuflags[min(si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
308 if (si.wProcessorLevel >= 4) result |= WF_HASCPUID;
309 ovi.dwOSVersionInfoSize = sizeof(ovi);
311 if (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT)
312 result |= WF_WIN32WOW; /* undocumented WF_WINNT */
316 /***********************************************************************
317 * GetVersionEx (KERNEL.149)
319 BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16 *v)
323 if (v->dwOSVersionInfoSize < sizeof(OSVERSIONINFO16))
325 WARN("wrong OSVERSIONINFO size from app\n");
329 info.dwOSVersionInfoSize = sizeof(info);
330 if (!GetVersionExA( &info )) return FALSE;
332 v->dwMajorVersion = info.dwMajorVersion;
333 v->dwMinorVersion = info.dwMinorVersion;
334 v->dwBuildNumber = info.dwBuildNumber;
335 v->dwPlatformId = info.dwPlatformId;
336 strcpy( v->szCSDVersion, info.szCSDVersion );
340 /***********************************************************************
341 * DebugBreak (KERNEL.203)
343 void WINAPI DebugBreak16( CONTEXT *context )
345 EXCEPTION_RECORD rec;
347 rec.ExceptionCode = EXCEPTION_BREAKPOINT;
348 rec.ExceptionFlags = 0;
349 rec.ExceptionRecord = NULL;
350 rec.ExceptionAddress = (LPVOID)context->Eip;
351 rec.NumberParameters = 0;
352 NtRaiseException( &rec, context, TRUE );
355 /***********************************************************************
359 * Should fill lpBuffer only if DBO_BUFFERFILL has been set by SetWinDebugInfo()
361 void WINAPI DebugFillBuffer(LPSTR lpBuffer, WORD wBytes)
363 memset(lpBuffer, 0xf9 /* DBGFILL_BUFFER */, wBytes);
366 /***********************************************************************
367 * DiagQuery (KERNEL.339)
369 * returns TRUE if Win called with "/b" (bootlog.txt)
371 BOOL16 WINAPI DiagQuery16(void)
376 /***********************************************************************
377 * DiagOutput (KERNEL.340)
379 * writes a debug string into <windir>\bootlog.txt
381 void WINAPI DiagOutput16(LPCSTR str)
384 TRACE("DIAGOUTPUT:%s\n", debugstr_a(str));
387 /***********************************************************************
388 * hmemcpy (KERNEL.348)
390 void WINAPI hmemcpy16( LPVOID dst, LPCVOID src, LONG count )
392 memcpy( dst, src, count );
395 /***********************************************************************
396 * lstrcpyn (KERNEL.353)
398 SEGPTR WINAPI lstrcpyn16( SEGPTR dst, LPCSTR src, INT16 n )
400 lstrcpynA( MapSL(dst), src, n );
404 /***********************************************************************
405 * lstrcatn (KERNEL.352)
407 SEGPTR WINAPI lstrcatn16( SEGPTR dst, LPCSTR src, INT16 n )
409 LPSTR p = MapSL(dst);
413 if ((n -= (p - start)) <= 0) return dst;
414 lstrcpynA( p, src, n );
418 #if 0 /* Not used at this time. This is here for documentation only */
420 /* WINDEBUGINFO flags values */
421 #define WDI_OPTIONS 0x0001
422 #define WDI_FILTER 0x0002
423 #define WDI_ALLOCBREAK 0x0004
425 /* dwOptions values */
426 #define DBO_CHECKHEAP 0x0001
427 #define DBO_BUFFERFILL 0x0004
428 #define DBO_DISABLEGPTRAPPING 0x0010
429 #define DBO_CHECKFREE 0x0020
431 #define DBO_SILENT 0x8000
433 #define DBO_TRACEBREAK 0x2000
434 #define DBO_WARNINGBREAK 0x1000
435 #define DBO_NOERRORBREAK 0x0800
436 #define DBO_NOFATALBREAK 0x0400
437 #define DBO_INT3BREAK 0x0100
439 /* DebugOutput flags values */
440 #define DBF_TRACE 0x0000
441 #define DBF_WARNING 0x4000
442 #define DBF_ERROR 0x8000
443 #define DBF_FATAL 0xc000
445 /* dwFilter values */
446 #define DBF_KERNEL 0x1000
447 #define DBF_KRN_MEMMAN 0x0001
448 #define DBF_KRN_LOADMODULE 0x0002
449 #define DBF_KRN_SEGMENTLOAD 0x0004
450 #define DBF_USER 0x0800
451 #define DBF_GDI 0x0400
452 #define DBF_MMSYSTEM 0x0040
453 #define DBF_PENWIN 0x0020
454 #define DBF_APPLICATION 0x0008
455 #define DBF_DRIVER 0x0010
457 #endif /* NOLOGERROR */
459 /***********************************************************************
460 * GetWinDebugInfo (KERNEL.355)
462 BOOL16 WINAPI GetWinDebugInfo16(WINDEBUGINFO16 *lpwdi, UINT16 flags)
464 FIXME("(%8lx,%d): stub returning 0\n",
465 (unsigned long)lpwdi, flags);
466 /* 0 means not in debugging mode/version */
467 /* Can this type of debugging be used in wine ? */
468 /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */
472 /***********************************************************************
473 * SetWinDebugInfo (KERNEL.356)
475 BOOL16 WINAPI SetWinDebugInfo16(WINDEBUGINFO16 *lpwdi)
477 FIXME("(%8lx): stub returning 0\n", (unsigned long)lpwdi);
478 /* 0 means not in debugging mode/version */
479 /* Can this type of debugging be used in wine ? */
480 /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */
484 /***********************************************************************
485 * UnicodeToAnsi (KERNEL.434)
487 INT16 WINAPI UnicodeToAnsi16( LPCWSTR src, LPSTR dst, INT16 codepage )
489 if ( codepage == -1 ) codepage = CP_ACP;
490 return WideCharToMultiByte( codepage, 0, src, -1, dst, 0x7fffffff, NULL, NULL );
493 /***********************************************************************
494 * VWin32_EventCreate (KERNEL.442)
496 HANDLE WINAPI VWin32_EventCreate(VOID)
498 HANDLE hEvent = CreateEventW( NULL, FALSE, 0, NULL );
499 return ConvertToGlobalHandle( hEvent );
502 /***********************************************************************
503 * VWin32_EventDestroy (KERNEL.443)
505 VOID WINAPI VWin32_EventDestroy(HANDLE event)
507 CloseHandle( event );
510 /***********************************************************************
511 * VWin32_EventWait (KERNEL.450)
513 VOID WINAPI VWin32_EventWait(HANDLE event)
517 ReleaseThunkLock( &mutex_count );
518 WaitForSingleObject( event, INFINITE );
519 RestoreThunkLock( mutex_count );
522 /***********************************************************************
523 * VWin32_EventSet (KERNEL.451)
524 * KERNEL_479 (KERNEL.479)
526 VOID WINAPI VWin32_EventSet(HANDLE event)
531 /***********************************************************************
532 * GetProcAddress32 (KERNEL.453)
534 FARPROC WINAPI GetProcAddress32_16( HMODULE hModule, LPCSTR function )
536 /* FIXME: we used to disable snoop when returning proc for Win16 subsystem */
537 return GetProcAddress( hModule, function );
540 /***********************************************************************
541 * CreateW32Event (KERNEL.457)
543 HANDLE WINAPI CreateW32Event( BOOL manual_reset, BOOL initial_state )
545 return CreateEventW( NULL, manual_reset, initial_state, NULL );
548 /***********************************************************************
549 * SetW32Event (KERNEL.458)
551 BOOL WINAPI SetW32Event( HANDLE handle )
553 return SetEvent( handle );
556 /***********************************************************************
557 * ResetW32Event (KERNEL.459)
559 BOOL WINAPI ResetW32Event( HANDLE handle )
561 return ResetEvent( handle );
564 /***********************************************************************
565 * WaitForSingleObject (KERNEL.460)
567 DWORD WINAPI WaitForSingleObject16( HANDLE handle, DWORD timeout )
569 DWORD retval, mutex_count;
571 ReleaseThunkLock( &mutex_count );
572 retval = WaitForSingleObject( handle, timeout );
573 RestoreThunkLock( mutex_count );
577 /***********************************************************************
578 * WaitForMultipleObjects (KERNEL.461)
580 DWORD WINAPI WaitForMultipleObjects16( DWORD count, const HANDLE *handles,
581 BOOL wait_all, DWORD timeout )
583 DWORD retval, mutex_count;
585 ReleaseThunkLock( &mutex_count );
586 retval = WaitForMultipleObjectsEx( count, handles, wait_all, timeout, FALSE );
587 RestoreThunkLock( mutex_count );
591 /***********************************************************************
592 * GetCurrentThreadId (KERNEL.462)
594 DWORD WINAPI GetCurrentThreadId16(void)
596 return GetCurrentThreadId();
599 /***********************************************************************
600 * ExitProcess (KERNEL.466)
602 void WINAPI ExitProcess16( WORD status )
605 ReleaseThunkLock( &count );
606 ExitProcess( status );
609 /***********************************************************************
610 * GetCurrentProcessId (KERNEL.471)
612 DWORD WINAPI GetCurrentProcessId16(void)
614 return GetCurrentProcessId();
617 /*********************************************************************
618 * CloseW32Handle (KERNEL.474)
620 BOOL WINAPI CloseW32Handle( HANDLE handle )
622 return CloseHandle( handle );
625 /***********************************************************************
626 * ConvertToGlobalHandle (KERNEL.476)
628 HANDLE WINAPI ConvertToGlobalHandle16( HANDLE handle )
630 return ConvertToGlobalHandle( handle );
633 /*********************************************************************
634 * MapProcessHandle (KERNEL.483)
636 DWORD WINAPI MapProcessHandle( HANDLE hProcess )
638 return GetProcessId( hProcess );
641 /***********************************************************************
642 * SetProcessDword (KERNEL.484)
643 * 'Of course you cannot directly access Windows internal structures'
645 void WINAPI SetProcessDword16( DWORD dwProcessID, INT offset, DWORD value )
647 TRACE("(%d, %d)\n", dwProcessID, offset );
649 if (dwProcessID && dwProcessID != GetCurrentProcessId())
651 ERR("%d: process %x not accessible\n", offset, dwProcessID);
657 case GPD_APP_COMPAT_FLAGS:
658 case GPD_LOAD_DONE_EVENT:
659 case GPD_HINSTANCE16:
660 case GPD_WINDOWS_VERSION:
663 case GPD_STARTF_SHELLDATA:
664 case GPD_STARTF_HOTKEY:
665 case GPD_STARTF_SHOWWINDOW:
666 case GPD_STARTF_SIZE:
667 case GPD_STARTF_POSITION:
668 case GPD_STARTF_FLAGS:
671 ERR("Not allowed to modify offset %d\n", offset );
674 process_dword = value;
677 ERR("Unknown offset %d\n", offset );
682 /***********************************************************************
683 * GetProcessDword (KERNEL.485)
684 * 'Of course you cannot directly access Windows internal structures'
686 DWORD WINAPI GetProcessDword16( DWORD dwProcessID, INT offset )
691 TRACE("(%d, %d)\n", dwProcessID, offset );
693 if (dwProcessID && dwProcessID != GetCurrentProcessId())
695 ERR("%d: process %x not accessible\n", offset, dwProcessID);
701 case GPD_APP_COMPAT_FLAGS:
702 return GetAppCompatFlags16(0);
703 case GPD_LOAD_DONE_EVENT:
705 case GPD_HINSTANCE16:
706 return GetTaskDS16();
707 case GPD_WINDOWS_VERSION:
708 return GetExeVersion16();
710 return (DWORD_PTR)NtCurrentTeb() - 0x10 /* FIXME */;
712 return (DWORD_PTR)NtCurrentTeb()->Peb; /* FIXME: truncating a pointer */
713 case GPD_STARTF_SHELLDATA: /* return stdoutput handle from startupinfo ??? */
714 GetStartupInfoW(&siw);
715 return HandleToULong(siw.hStdOutput);
716 case GPD_STARTF_HOTKEY: /* return stdinput handle from startupinfo ??? */
717 GetStartupInfoW(&siw);
718 return HandleToULong(siw.hStdInput);
719 case GPD_STARTF_SHOWWINDOW:
720 GetStartupInfoW(&siw);
721 return siw.wShowWindow;
722 case GPD_STARTF_SIZE:
723 GetStartupInfoW(&siw);
725 if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
727 if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
728 return MAKELONG( x, y );
729 case GPD_STARTF_POSITION:
730 GetStartupInfoW(&siw);
732 if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
734 if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
735 return MAKELONG( x, y );
736 case GPD_STARTF_FLAGS:
737 GetStartupInfoW(&siw);
742 return GetProcessFlags(0);
744 return process_dword;
746 ERR("Unknown offset %d\n", offset );
751 /***********************************************************************
752 * FreeLibrary32 (KERNEL.486)
754 BOOL WINAPI FreeLibrary32_16( HINSTANCE module )
756 return FreeLibrary( module );
759 /***********************************************************************
760 * GetModuleFileName32 (KERNEL.487)
762 DWORD WINAPI GetModuleFileName32_16( HMODULE module, LPSTR buffer, DWORD size )
764 return GetModuleFileNameA( module, buffer, size );
767 /***********************************************************************
768 * GetModuleHandle32 (KERNEL.488)
770 HMODULE WINAPI GetModuleHandle32_16(LPCSTR module)
772 return GetModuleHandleA( module );
775 /***********************************************************************
776 * RegisterServiceProcess (KERNEL.491)
778 DWORD WINAPI RegisterServiceProcess16( DWORD dwProcessId, DWORD dwType )
780 return 1; /* success */
783 /***********************************************************************
784 * WaitForMultipleObjectsEx (KERNEL.495)
786 DWORD WINAPI WaitForMultipleObjectsEx16( DWORD count, const HANDLE *handles,
787 BOOL wait_all, DWORD timeout, BOOL alertable )
789 DWORD retval, mutex_count;
791 ReleaseThunkLock( &mutex_count );
792 retval = WaitForMultipleObjectsEx( count, handles, wait_all, timeout, alertable );
793 RestoreThunkLock( mutex_count );
797 /**********************************************************************
798 * VWin32_BoostThreadGroup (KERNEL.535)
800 VOID WINAPI VWin32_BoostThreadGroup( DWORD threadId, INT boost )
802 FIXME("(0x%08x,%d): stub\n", threadId, boost);
806 /**********************************************************************
807 * VWin32_BoostThreadStatic (KERNEL.536)
809 VOID WINAPI VWin32_BoostThreadStatic( DWORD threadId, INT boost )
811 FIXME("(0x%08x,%d): stub\n", threadId, boost);
814 /***********************************************************************
815 * EnableDos (KERNEL.41)
816 * DisableDos (KERNEL.42)
817 * GetLastDiskChange (KERNEL.98)
818 * ValidateCodeSegments (KERNEL.100)
819 * KbdRst (KERNEL.123)
820 * EnableKernel (KERNEL.124)
821 * DisableKernel (KERNEL.125)
822 * ValidateFreeSpaces (KERNEL.200)
824 * BUNNY_351 (KERNEL.351)
825 * PIGLET_361 (KERNEL.361)
827 * Entry point for kernel functions that do nothing.
829 LONG WINAPI KERNEL_nop(void)
834 /***********************************************************************
835 * ToolHelpHook (KERNEL.341)
836 * see "Undocumented Windows"
838 FARPROC16 WINAPI ToolHelpHook16(FARPROC16 func)
840 static FARPROC16 hook;
842 FIXME("(%p), stub.\n", func);
843 return InterlockedExchangePointer( (void **)&hook, func );
846 /* thunk for 16-bit CreateThread */
853 static DWORD CALLBACK start_thread16( LPVOID threadArgs )
855 struct thread_args args = *(struct thread_args *)threadArgs;
856 HeapFree( GetProcessHeap(), 0, threadArgs );
857 return K32WOWCallback16( (DWORD)args.proc, args.param );
860 /***********************************************************************
861 * CreateThread16 (KERNEL.441)
863 HANDLE WINAPI CreateThread16( SECURITY_ATTRIBUTES *sa, DWORD stack,
864 FARPROC16 start, SEGPTR param,
865 DWORD flags, LPDWORD id )
867 struct thread_args *args = HeapAlloc( GetProcessHeap(), 0, sizeof(*args) );
868 if (!args) return INVALID_HANDLE_VALUE;
871 return CreateThread( sa, stack, start_thread16, args, flags, id );
874 /***********************************************************************
875 * _DebugOutput (KERNEL.328)
877 void WINAPIV _DebugOutput( WORD flags, LPCSTR spec, VA_LIST16 valist )
881 /* Decode caller address */
882 if (!GetModuleName16( GetExePtr(CURRENT_STACK16->cs), caller, sizeof(caller) ))
883 sprintf( caller, "%04X:%04X", CURRENT_STACK16->cs, CURRENT_STACK16->ip );
885 /* FIXME: cannot use wvsnprintf16 from kernel */
886 /* wvsnprintf16( temp, sizeof(temp), spec, valist ); */
889 FIXME("%s %04x %s\n", caller, flags, debugstr_a(spec) );