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 "kernel_private.h"
31 #include "kernel16_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(module);
36 extern DWORD WINAPI GetProcessFlags( DWORD processid );
38 static DWORD process_dword;
40 /**************************************************************************
41 * DllEntryPoint (KERNEL.669)
43 BOOL WINAPI KERNEL_DllEntryPoint( DWORD reasion, HINSTANCE16 inst, WORD ds,
44 WORD heap, DWORD reserved1, WORD reserved2 )
48 /* the entry point can be called multiple times */
49 if (done) return TRUE;
52 /* Initialize 16-bit thunking entry points */
53 if (!WOWTHUNK_Init()) return FALSE;
55 /* Initialize DOS memory */
56 if (!DOSMEM_Init()) return FALSE;
58 /* Initialize special KERNEL entry points */
60 NE_SetEntryPoint( inst, 178, GetWinFlags16() );
62 NE_SetEntryPoint( inst, 454, wine_get_cs() );
63 NE_SetEntryPoint( inst, 455, wine_get_ds() );
65 NE_SetEntryPoint( inst, 183, DOSMEM_0000H ); /* KERNEL.183: __0000H */
66 NE_SetEntryPoint( inst, 173, DOSMEM_BiosSysSeg ); /* KERNEL.173: __ROMBIOS */
67 NE_SetEntryPoint( inst, 193, DOSMEM_BiosDataSeg ); /* KERNEL.193: __0040H */
68 NE_SetEntryPoint( inst, 194, DOSMEM_BiosSysSeg ); /* KERNEL.194: __F000H */
70 /* Initialize KERNEL.THHOOK */
71 TASK_InstallTHHook(MapSL((SEGPTR)GetProcAddress16( inst, (LPCSTR)332 )));
73 /* Initialize the real-mode selector entry points */
74 #define SET_ENTRY_POINT( num, addr ) \
75 NE_SetEntryPoint( inst, (num), GLOBAL_CreateBlock( GMEM_FIXED, \
76 DOSMEM_MapDosToLinear(addr), 0x10000, inst, \
77 WINE_LDT_FLAGS_DATA ))
79 SET_ENTRY_POINT( 174, 0xa0000 ); /* KERNEL.174: __A000H */
80 SET_ENTRY_POINT( 181, 0xb0000 ); /* KERNEL.181: __B000H */
81 SET_ENTRY_POINT( 182, 0xb8000 ); /* KERNEL.182: __B800H */
82 SET_ENTRY_POINT( 195, 0xc0000 ); /* KERNEL.195: __C000H */
83 SET_ENTRY_POINT( 179, 0xd0000 ); /* KERNEL.179: __D000H */
84 SET_ENTRY_POINT( 190, 0xe0000 ); /* KERNEL.190: __E000H */
85 #undef SET_ENTRY_POINT
87 /* Force loading of some dlls */
88 LoadLibrary16( "system.drv" );
93 /***********************************************************************
94 * GetVersion (KERNEL.3)
96 DWORD WINAPI GetVersion16(void)
98 static WORD dosver, winver;
100 if (!dosver) /* not determined yet */
102 RTL_OSVERSIONINFOEXW info;
104 info.dwOSVersionInfoSize = sizeof(info);
105 if (RtlGetVersion( &info )) return 0;
107 if (info.dwMajorVersion <= 3)
108 winver = MAKEWORD( info.dwMajorVersion, info.dwMinorVersion );
110 winver = MAKEWORD( 3, 95 );
112 switch(info.dwPlatformId)
114 case VER_PLATFORM_WIN32s:
115 switch(MAKELONG( info.dwMinorVersion, info.dwMajorVersion ))
118 dosver = 0x0303; /* DOS 3.3 for Windows 2.0 */
121 dosver = 0x0500; /* DOS 5.0 for Windows 3.0 */
124 dosver = 0x0616; /* DOS 6.22 for Windows 3.1 and later */
128 case VER_PLATFORM_WIN32_WINDOWS:
129 /* DOS 8.0 for WinME, 7.0 for Win95/98 */
130 if (info.dwMinorVersion >= 90) dosver = 0x0800;
131 else dosver = 0x0700;
133 case VER_PLATFORM_WIN32_NT:
134 dosver = 0x0500; /* always DOS 5.0 for NT */
137 TRACE( "DOS %d.%02d Win %d.%02d\n",
138 HIBYTE(dosver), LOBYTE(dosver), LOBYTE(winver), HIBYTE(winver) );
140 return MAKELONG( winver, dosver );
143 /***********************************************************************
144 * Reserved1 (KERNEL.77)
146 SEGPTR WINAPI KERNEL_AnsiNext16(SEGPTR current)
148 return (*(char *)MapSL(current)) ? current + 1 : current;
151 /***********************************************************************
152 * Reserved2(KERNEL.78)
154 SEGPTR WINAPI KERNEL_AnsiPrev16( SEGPTR start, SEGPTR current )
156 return (current==start)?start:current-1;
159 /***********************************************************************
160 * Reserved3 (KERNEL.79)
162 SEGPTR WINAPI KERNEL_AnsiUpper16( SEGPTR strOrChar )
164 /* uppercase only one char if strOrChar < 0x10000 */
165 if (HIWORD(strOrChar))
167 char *s = MapSL(strOrChar);
175 else return toupper((char)strOrChar);
178 /***********************************************************************
179 * Reserved4 (KERNEL.80)
181 SEGPTR WINAPI KERNEL_AnsiLower16( SEGPTR strOrChar )
183 /* lowercase only one char if strOrChar < 0x10000 */
184 if (HIWORD(strOrChar))
186 char *s = MapSL(strOrChar);
194 else return tolower((char)strOrChar);
197 /***********************************************************************
198 * Reserved5 (KERNEL.87)
200 INT16 WINAPI KERNEL_lstrcmp16( LPCSTR str1, LPCSTR str2 )
202 return (INT16)strcmp( str1, str2 );
205 /***********************************************************************
206 * lstrcpy (KERNEL.88)
208 SEGPTR WINAPI lstrcpy16( SEGPTR dst, LPCSTR src )
210 if (!lstrcpyA( MapSL(dst), src )) dst = 0;
214 /***********************************************************************
215 * lstrcat (KERNEL.89)
217 SEGPTR WINAPI lstrcat16( SEGPTR dst, LPCSTR src )
219 /* Windows does not check for NULL pointers here, so we don't either */
220 strcat( MapSL(dst), src );
224 /***********************************************************************
225 * lstrlen (KERNEL.90)
227 INT16 WINAPI lstrlen16( LPCSTR str )
229 return (INT16)lstrlenA( str );
232 /***********************************************************************
233 * OutputDebugString (KERNEL.115)
235 void WINAPI OutputDebugString16( LPCSTR str )
237 OutputDebugStringA( str );
240 /***********************************************************************
241 * GetWinFlags (KERNEL.132)
243 DWORD WINAPI GetWinFlags16(void)
245 static const long cpuflags[5] = { WF_CPU086, WF_CPU186, WF_CPU286, WF_CPU386, WF_CPU486 };
252 /* There doesn't seem to be any Pentium flag. */
253 result = cpuflags[min(si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
254 if (si.wProcessorLevel >= 4) result |= WF_HASCPUID;
255 ovi.dwOSVersionInfoSize = sizeof(ovi);
257 if (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT)
258 result |= WF_WIN32WOW; /* undocumented WF_WINNT */
262 /***********************************************************************
263 * GetVersionEx (KERNEL.149)
265 BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16 *v)
269 if (v->dwOSVersionInfoSize < sizeof(OSVERSIONINFO16))
271 WARN("wrong OSVERSIONINFO size from app\n");
275 info.dwOSVersionInfoSize = sizeof(info);
276 if (!GetVersionExA( &info )) return FALSE;
278 v->dwMajorVersion = info.dwMajorVersion;
279 v->dwMinorVersion = info.dwMinorVersion;
280 v->dwBuildNumber = info.dwBuildNumber;
281 v->dwPlatformId = info.dwPlatformId;
282 strcpy( v->szCSDVersion, info.szCSDVersion );
286 /***********************************************************************
287 * DebugBreak (KERNEL.203)
289 void WINAPI DebugBreak16( CONTEXT *context )
291 EXCEPTION_RECORD rec;
293 rec.ExceptionCode = EXCEPTION_BREAKPOINT;
294 rec.ExceptionFlags = 0;
295 rec.ExceptionRecord = NULL;
296 rec.ExceptionAddress = (LPVOID)context->Eip;
297 rec.NumberParameters = 0;
298 NtRaiseException( &rec, context, TRUE );
301 /***********************************************************************
305 * Should fill lpBuffer only if DBO_BUFFERFILL has been set by SetWinDebugInfo()
307 void WINAPI DebugFillBuffer(LPSTR lpBuffer, WORD wBytes)
309 memset(lpBuffer, 0xf9 /* DBGFILL_BUFFER */, wBytes);
312 /***********************************************************************
313 * DiagQuery (KERNEL.339)
315 * returns TRUE if Win called with "/b" (bootlog.txt)
317 BOOL16 WINAPI DiagQuery16(void)
322 /***********************************************************************
323 * DiagOutput (KERNEL.340)
325 * writes a debug string into <windir>\bootlog.txt
327 void WINAPI DiagOutput16(LPCSTR str)
330 TRACE("DIAGOUTPUT:%s\n", debugstr_a(str));
333 /***********************************************************************
334 * hmemcpy (KERNEL.348)
336 void WINAPI hmemcpy16( LPVOID dst, LPCVOID src, LONG count )
338 memcpy( dst, src, count );
341 /***********************************************************************
342 * lstrcpyn (KERNEL.353)
344 SEGPTR WINAPI lstrcpyn16( SEGPTR dst, LPCSTR src, INT16 n )
346 lstrcpynA( MapSL(dst), src, n );
350 /***********************************************************************
351 * lstrcatn (KERNEL.352)
353 SEGPTR WINAPI lstrcatn16( SEGPTR dst, LPCSTR src, INT16 n )
355 LPSTR p = MapSL(dst);
359 if ((n -= (p - start)) <= 0) return dst;
360 lstrcpynA( p, src, n );
364 #if 0 /* Not used at this time. This is here for documentation only */
366 /* WINDEBUGINFO flags values */
367 #define WDI_OPTIONS 0x0001
368 #define WDI_FILTER 0x0002
369 #define WDI_ALLOCBREAK 0x0004
371 /* dwOptions values */
372 #define DBO_CHECKHEAP 0x0001
373 #define DBO_BUFFERFILL 0x0004
374 #define DBO_DISABLEGPTRAPPING 0x0010
375 #define DBO_CHECKFREE 0x0020
377 #define DBO_SILENT 0x8000
379 #define DBO_TRACEBREAK 0x2000
380 #define DBO_WARNINGBREAK 0x1000
381 #define DBO_NOERRORBREAK 0x0800
382 #define DBO_NOFATALBREAK 0x0400
383 #define DBO_INT3BREAK 0x0100
385 /* DebugOutput flags values */
386 #define DBF_TRACE 0x0000
387 #define DBF_WARNING 0x4000
388 #define DBF_ERROR 0x8000
389 #define DBF_FATAL 0xc000
391 /* dwFilter values */
392 #define DBF_KERNEL 0x1000
393 #define DBF_KRN_MEMMAN 0x0001
394 #define DBF_KRN_LOADMODULE 0x0002
395 #define DBF_KRN_SEGMENTLOAD 0x0004
396 #define DBF_USER 0x0800
397 #define DBF_GDI 0x0400
398 #define DBF_MMSYSTEM 0x0040
399 #define DBF_PENWIN 0x0020
400 #define DBF_APPLICATION 0x0008
401 #define DBF_DRIVER 0x0010
403 #endif /* NOLOGERROR */
405 /***********************************************************************
406 * GetWinDebugInfo (KERNEL.355)
408 BOOL16 WINAPI GetWinDebugInfo16(WINDEBUGINFO16 *lpwdi, UINT16 flags)
410 FIXME("(%8lx,%d): stub returning 0\n",
411 (unsigned long)lpwdi, flags);
412 /* 0 means not in debugging mode/version */
413 /* Can this type of debugging be used in wine ? */
414 /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */
418 /***********************************************************************
419 * SetWinDebugInfo (KERNEL.356)
421 BOOL16 WINAPI SetWinDebugInfo16(WINDEBUGINFO16 *lpwdi)
423 FIXME("(%8lx): stub returning 0\n", (unsigned long)lpwdi);
424 /* 0 means not in debugging mode/version */
425 /* Can this type of debugging be used in wine ? */
426 /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */
430 /***********************************************************************
431 * UnicodeToAnsi (KERNEL.434)
433 INT16 WINAPI UnicodeToAnsi16( LPCWSTR src, LPSTR dst, INT16 codepage )
435 if ( codepage == -1 ) codepage = CP_ACP;
436 return WideCharToMultiByte( codepage, 0, src, -1, dst, 0x7fffffff, NULL, NULL );
439 /***********************************************************************
440 * VWin32_EventCreate (KERNEL.442)
442 HANDLE WINAPI VWin32_EventCreate(VOID)
444 HANDLE hEvent = CreateEventW( NULL, FALSE, 0, NULL );
445 return ConvertToGlobalHandle( hEvent );
448 /***********************************************************************
449 * VWin32_EventDestroy (KERNEL.443)
451 VOID WINAPI VWin32_EventDestroy(HANDLE event)
453 CloseHandle( event );
456 /***********************************************************************
457 * VWin32_EventWait (KERNEL.450)
459 VOID WINAPI VWin32_EventWait(HANDLE event)
463 ReleaseThunkLock( &mutex_count );
464 WaitForSingleObject( event, INFINITE );
465 RestoreThunkLock( mutex_count );
468 /***********************************************************************
469 * VWin32_EventSet (KERNEL.451)
470 * KERNEL_479 (KERNEL.479)
472 VOID WINAPI VWin32_EventSet(HANDLE event)
477 /***********************************************************************
478 * GetProcAddress32 (KERNEL.453)
480 FARPROC WINAPI GetProcAddress32_16( HMODULE hModule, LPCSTR function )
482 /* FIXME: we used to disable snoop when returning proc for Win16 subsystem */
483 return GetProcAddress( hModule, function );
486 /***********************************************************************
487 * CreateW32Event (KERNEL.457)
489 HANDLE WINAPI CreateW32Event( BOOL manual_reset, BOOL initial_state )
491 return CreateEventW( NULL, manual_reset, initial_state, NULL );
494 /***********************************************************************
495 * SetW32Event (KERNEL.458)
497 BOOL WINAPI SetW32Event( HANDLE handle )
499 return SetEvent( handle );
502 /***********************************************************************
503 * ResetW32Event (KERNEL.459)
505 BOOL WINAPI ResetW32Event( HANDLE handle )
507 return ResetEvent( handle );
510 /***********************************************************************
511 * WaitForSingleObject (KERNEL.460)
513 DWORD WINAPI WaitForSingleObject16( HANDLE handle, DWORD timeout )
515 DWORD retval, mutex_count;
517 ReleaseThunkLock( &mutex_count );
518 retval = WaitForSingleObject( handle, timeout );
519 RestoreThunkLock( mutex_count );
523 /***********************************************************************
524 * WaitForMultipleObjects (KERNEL.461)
526 DWORD WINAPI WaitForMultipleObjects16( DWORD count, const HANDLE *handles,
527 BOOL wait_all, DWORD timeout )
529 DWORD retval, mutex_count;
531 ReleaseThunkLock( &mutex_count );
532 retval = WaitForMultipleObjectsEx( count, handles, wait_all, timeout, FALSE );
533 RestoreThunkLock( mutex_count );
537 /***********************************************************************
538 * GetCurrentThreadId (KERNEL.462)
540 DWORD WINAPI GetCurrentThreadId16(void)
542 return GetCurrentThreadId();
545 /***********************************************************************
546 * ExitProcess (KERNEL.466)
548 void WINAPI ExitProcess16( WORD status )
551 ReleaseThunkLock( &count );
552 ExitProcess( status );
555 /***********************************************************************
556 * GetCurrentProcessId (KERNEL.471)
558 DWORD WINAPI GetCurrentProcessId16(void)
560 return GetCurrentProcessId();
563 /*********************************************************************
564 * CloseW32Handle (KERNEL.474)
566 BOOL WINAPI CloseW32Handle( HANDLE handle )
568 return CloseHandle( handle );
571 /***********************************************************************
572 * ConvertToGlobalHandle (KERNEL.476)
574 HANDLE WINAPI ConvertToGlobalHandle16( HANDLE handle )
576 return ConvertToGlobalHandle( handle );
579 /*********************************************************************
580 * MapProcessHandle (KERNEL.483)
582 DWORD WINAPI MapProcessHandle( HANDLE hProcess )
584 return GetProcessId( hProcess );
587 /***********************************************************************
588 * SetProcessDword (KERNEL.484)
589 * 'Of course you cannot directly access Windows internal structures'
591 void WINAPI SetProcessDword16( DWORD dwProcessID, INT offset, DWORD value )
593 TRACE("(%d, %d)\n", dwProcessID, offset );
595 if (dwProcessID && dwProcessID != GetCurrentProcessId())
597 ERR("%d: process %x not accessible\n", offset, dwProcessID);
603 case GPD_APP_COMPAT_FLAGS:
604 case GPD_LOAD_DONE_EVENT:
605 case GPD_HINSTANCE16:
606 case GPD_WINDOWS_VERSION:
609 case GPD_STARTF_SHELLDATA:
610 case GPD_STARTF_HOTKEY:
611 case GPD_STARTF_SHOWWINDOW:
612 case GPD_STARTF_SIZE:
613 case GPD_STARTF_POSITION:
614 case GPD_STARTF_FLAGS:
617 ERR("Not allowed to modify offset %d\n", offset );
620 process_dword = value;
623 ERR("Unknown offset %d\n", offset );
628 /***********************************************************************
629 * GetProcessDword (KERNEL.485)
630 * 'Of course you cannot directly access Windows internal structures'
632 DWORD WINAPI GetProcessDword16( DWORD dwProcessID, INT offset )
637 TRACE("(%d, %d)\n", dwProcessID, offset );
639 if (dwProcessID && dwProcessID != GetCurrentProcessId())
641 ERR("%d: process %x not accessible\n", offset, dwProcessID);
647 case GPD_APP_COMPAT_FLAGS:
648 return GetAppCompatFlags16(0);
649 case GPD_LOAD_DONE_EVENT:
651 case GPD_HINSTANCE16:
652 return GetTaskDS16();
653 case GPD_WINDOWS_VERSION:
654 return GetExeVersion16();
656 return (DWORD_PTR)NtCurrentTeb() - 0x10 /* FIXME */;
658 return (DWORD_PTR)NtCurrentTeb()->Peb; /* FIXME: truncating a pointer */
659 case GPD_STARTF_SHELLDATA: /* return stdoutput handle from startupinfo ??? */
660 GetStartupInfoW(&siw);
661 return HandleToULong(siw.hStdOutput);
662 case GPD_STARTF_HOTKEY: /* return stdinput handle from startupinfo ??? */
663 GetStartupInfoW(&siw);
664 return HandleToULong(siw.hStdInput);
665 case GPD_STARTF_SHOWWINDOW:
666 GetStartupInfoW(&siw);
667 return siw.wShowWindow;
668 case GPD_STARTF_SIZE:
669 GetStartupInfoW(&siw);
671 if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
673 if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
674 return MAKELONG( x, y );
675 case GPD_STARTF_POSITION:
676 GetStartupInfoW(&siw);
678 if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
680 if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
681 return MAKELONG( x, y );
682 case GPD_STARTF_FLAGS:
683 GetStartupInfoW(&siw);
688 return GetProcessFlags(0);
690 return process_dword;
692 ERR("Unknown offset %d\n", offset );
697 /***********************************************************************
698 * FreeLibrary32 (KERNEL.486)
700 BOOL WINAPI FreeLibrary32_16( HINSTANCE module )
702 return FreeLibrary( module );
705 /***********************************************************************
706 * GetModuleFileName32 (KERNEL.487)
708 DWORD WINAPI GetModuleFileName32_16( HMODULE module, LPSTR buffer, DWORD size )
710 return GetModuleFileNameA( module, buffer, size );
713 /***********************************************************************
714 * GetModuleHandle32 (KERNEL.488)
716 HMODULE WINAPI GetModuleHandle32_16(LPCSTR module)
718 return GetModuleHandleA( module );
721 /***********************************************************************
722 * RegisterServiceProcess (KERNEL.491)
724 DWORD WINAPI RegisterServiceProcess16( DWORD dwProcessId, DWORD dwType )
726 return 1; /* success */
729 /***********************************************************************
730 * WaitForMultipleObjectsEx (KERNEL.495)
732 DWORD WINAPI WaitForMultipleObjectsEx16( DWORD count, const HANDLE *handles,
733 BOOL wait_all, DWORD timeout, BOOL alertable )
735 DWORD retval, mutex_count;
737 ReleaseThunkLock( &mutex_count );
738 retval = WaitForMultipleObjectsEx( count, handles, wait_all, timeout, alertable );
739 RestoreThunkLock( mutex_count );
743 /**********************************************************************
744 * VWin32_BoostThreadGroup (KERNEL.535)
746 VOID WINAPI VWin32_BoostThreadGroup( DWORD threadId, INT boost )
748 FIXME("(0x%08x,%d): stub\n", threadId, boost);
752 /**********************************************************************
753 * VWin32_BoostThreadStatic (KERNEL.536)
755 VOID WINAPI VWin32_BoostThreadStatic( DWORD threadId, INT boost )
757 FIXME("(0x%08x,%d): stub\n", threadId, boost);
760 /***********************************************************************
761 * EnableDos (KERNEL.41)
762 * DisableDos (KERNEL.42)
763 * GetLastDiskChange (KERNEL.98)
764 * ValidateCodeSegments (KERNEL.100)
765 * KbdRst (KERNEL.123)
766 * EnableKernel (KERNEL.124)
767 * DisableKernel (KERNEL.125)
768 * ValidateFreeSpaces (KERNEL.200)
770 * BUNNY_351 (KERNEL.351)
771 * PIGLET_361 (KERNEL.361)
773 * Entry point for kernel functions that do nothing.
775 LONG WINAPI KERNEL_nop(void)
780 /***********************************************************************
781 * ToolHelpHook (KERNEL.341)
782 * see "Undocumented Windows"
784 FARPROC16 WINAPI ToolHelpHook16(FARPROC16 func)
786 static FARPROC16 hook;
788 FIXME("(%p), stub.\n", func);
789 return InterlockedExchangePointer( (void **)&hook, func );
792 /* thunk for 16-bit CreateThread */
799 static DWORD CALLBACK start_thread16( LPVOID threadArgs )
801 struct thread_args args = *(struct thread_args *)threadArgs;
802 HeapFree( GetProcessHeap(), 0, threadArgs );
803 return K32WOWCallback16( (DWORD)args.proc, args.param );
806 /***********************************************************************
807 * CreateThread16 (KERNEL.441)
809 HANDLE WINAPI CreateThread16( SECURITY_ATTRIBUTES *sa, DWORD stack,
810 FARPROC16 start, SEGPTR param,
811 DWORD flags, LPDWORD id )
813 struct thread_args *args = HeapAlloc( GetProcessHeap(), 0, sizeof(*args) );
814 if (!args) return INVALID_HANDLE_VALUE;
817 return CreateThread( sa, stack, start_thread16, args, flags, id );
820 /***********************************************************************
821 * _DebugOutput (KERNEL.328)
823 void WINAPIV _DebugOutput( WORD flags, LPCSTR spec, VA_LIST16 valist )
827 /* Decode caller address */
828 if (!GetModuleName16( GetExePtr(CURRENT_STACK16->cs), caller, sizeof(caller) ))
829 sprintf( caller, "%04X:%04X", CURRENT_STACK16->cs, CURRENT_STACK16->ip );
831 /* FIXME: cannot use wvsnprintf16 from kernel */
832 /* wvsnprintf16( temp, sizeof(temp), spec, valist ); */
835 FIXME("%s %04x %s\n", caller, flags, debugstr_a(spec) );