diff --git a/dlls/kernel32/kernel16.c b/dlls/kernel32/kernel16.c index 61767ac2ff5..e298aa3176e 100644 --- a/dlls/kernel32/kernel16.c +++ b/dlls/kernel32/kernel16.c @@ -85,6 +85,56 @@ BOOL WINAPI KERNEL_DllEntryPoint( DWORD reasion, HINSTANCE16 inst, WORD ds, return TRUE; } +/*********************************************************************** + * GetVersion (KERNEL.3) + */ +DWORD WINAPI GetVersion16(void) +{ + static WORD dosver, winver; + + if (!dosver) /* not determined yet */ + { + RTL_OSVERSIONINFOEXW info; + + info.dwOSVersionInfoSize = sizeof(info); + if (RtlGetVersion( &info )) return 0; + + if (info.dwMajorVersion <= 3) + winver = MAKEWORD( info.dwMajorVersion, info.dwMinorVersion ); + else + winver = MAKEWORD( 3, 95 ); + + switch(info.dwPlatformId) + { + case VER_PLATFORM_WIN32s: + switch(MAKELONG( info.dwMinorVersion, info.dwMajorVersion )) + { + case 0x0200: + dosver = 0x0303; /* DOS 3.3 for Windows 2.0 */ + break; + case 0x0300: + dosver = 0x0500; /* DOS 5.0 for Windows 3.0 */ + break; + default: + dosver = 0x0616; /* DOS 6.22 for Windows 3.1 and later */ + break; + } + break; + case VER_PLATFORM_WIN32_WINDOWS: + /* DOS 8.0 for WinME, 7.0 for Win95/98 */ + if (info.dwMinorVersion >= 90) dosver = 0x0800; + else dosver = 0x0700; + break; + case VER_PLATFORM_WIN32_NT: + dosver = 0x0500; /* always DOS 5.0 for NT */ + break; + } + TRACE( "DOS %d.%02d Win %d.%02d\n", + HIBYTE(dosver), LOBYTE(dosver), LOBYTE(winver), HIBYTE(winver) ); + } + return MAKELONG( winver, dosver ); +} + /*********************************************************************** * Reserved1 (KERNEL.77) */ @@ -182,6 +232,52 @@ void WINAPI OutputDebugString16( LPCSTR str ) OutputDebugStringA( str ); } +/*********************************************************************** + * GetWinFlags (KERNEL.132) + */ +DWORD WINAPI GetWinFlags16(void) +{ + static const long cpuflags[5] = { WF_CPU086, WF_CPU186, WF_CPU286, WF_CPU386, WF_CPU486 }; + SYSTEM_INFO si; + OSVERSIONINFOA ovi; + DWORD result; + + GetSystemInfo(&si); + + /* There doesn't seem to be any Pentium flag. */ + result = cpuflags[min(si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING; + if (si.wProcessorLevel >= 4) result |= WF_HASCPUID; + ovi.dwOSVersionInfoSize = sizeof(ovi); + GetVersionExA(&ovi); + if (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT) + result |= WF_WIN32WOW; /* undocumented WF_WINNT */ + return result; +} + +/*********************************************************************** + * GetVersionEx (KERNEL.149) + */ +BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16 *v) +{ + OSVERSIONINFOA info; + + if (v->dwOSVersionInfoSize < sizeof(OSVERSIONINFO16)) + { + WARN("wrong OSVERSIONINFO size from app\n"); + return FALSE; + } + + info.dwOSVersionInfoSize = sizeof(info); + if (!GetVersionExA( &info )) return FALSE; + + v->dwMajorVersion = info.dwMajorVersion; + v->dwMinorVersion = info.dwMinorVersion; + v->dwBuildNumber = info.dwBuildNumber; + v->dwPlatformId = info.dwPlatformId; + strcpy( v->szCSDVersion, info.szCSDVersion ); + return TRUE; +} + /*********************************************************************** * DebugBreak (KERNEL.203) */ @@ -197,6 +293,38 @@ void WINAPI DebugBreak16( CONTEXT *context ) NtRaiseException( &rec, context, TRUE ); } +/*********************************************************************** + * K329 (KERNEL.329) + * + * TODO: + * Should fill lpBuffer only if DBO_BUFFERFILL has been set by SetWinDebugInfo() + */ +void WINAPI DebugFillBuffer(LPSTR lpBuffer, WORD wBytes) +{ + memset(lpBuffer, 0xf9 /* DBGFILL_BUFFER */, wBytes); +} + +/*********************************************************************** + * DiagQuery (KERNEL.339) + * + * returns TRUE if Win called with "/b" (bootlog.txt) + */ +BOOL16 WINAPI DiagQuery16(void) +{ + return FALSE; +} + +/*********************************************************************** + * DiagOutput (KERNEL.340) + * + * writes a debug string into \bootlog.txt + */ +void WINAPI DiagOutput16(LPCSTR str) +{ + /* FIXME */ + TRACE("DIAGOUTPUT:%s\n", debugstr_a(str)); +} + /*********************************************************************** * hmemcpy (KERNEL.348) */ @@ -228,6 +356,72 @@ SEGPTR WINAPI lstrcatn16( SEGPTR dst, LPCSTR src, INT16 n ) return dst; } +#if 0 /* Not used at this time. This is here for documentation only */ + +/* WINDEBUGINFO flags values */ +#define WDI_OPTIONS 0x0001 +#define WDI_FILTER 0x0002 +#define WDI_ALLOCBREAK 0x0004 + +/* dwOptions values */ +#define DBO_CHECKHEAP 0x0001 +#define DBO_BUFFERFILL 0x0004 +#define DBO_DISABLEGPTRAPPING 0x0010 +#define DBO_CHECKFREE 0x0020 + +#define DBO_SILENT 0x8000 + +#define DBO_TRACEBREAK 0x2000 +#define DBO_WARNINGBREAK 0x1000 +#define DBO_NOERRORBREAK 0x0800 +#define DBO_NOFATALBREAK 0x0400 +#define DBO_INT3BREAK 0x0100 + +/* DebugOutput flags values */ +#define DBF_TRACE 0x0000 +#define DBF_WARNING 0x4000 +#define DBF_ERROR 0x8000 +#define DBF_FATAL 0xc000 + +/* dwFilter values */ +#define DBF_KERNEL 0x1000 +#define DBF_KRN_MEMMAN 0x0001 +#define DBF_KRN_LOADMODULE 0x0002 +#define DBF_KRN_SEGMENTLOAD 0x0004 +#define DBF_USER 0x0800 +#define DBF_GDI 0x0400 +#define DBF_MMSYSTEM 0x0040 +#define DBF_PENWIN 0x0020 +#define DBF_APPLICATION 0x0008 +#define DBF_DRIVER 0x0010 + +#endif /* NOLOGERROR */ + +/*********************************************************************** + * GetWinDebugInfo (KERNEL.355) + */ +BOOL16 WINAPI GetWinDebugInfo16(WINDEBUGINFO16 *lpwdi, UINT16 flags) +{ + FIXME("(%8lx,%d): stub returning 0\n", + (unsigned long)lpwdi, flags); + /* 0 means not in debugging mode/version */ + /* Can this type of debugging be used in wine ? */ + /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */ + return 0; +} + +/*********************************************************************** + * SetWinDebugInfo (KERNEL.356) + */ +BOOL16 WINAPI SetWinDebugInfo16(WINDEBUGINFO16 *lpwdi) +{ + FIXME("(%8lx): stub returning 0\n", (unsigned long)lpwdi); + /* 0 means not in debugging mode/version */ + /* Can this type of debugging be used in wine ? */ + /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */ + return 0; +} + /*********************************************************************** * UnicodeToAnsi (KERNEL.434) */ diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 458a47d4467..2fc1d147f2a 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -1224,8 +1224,6 @@ @ stdcall GetExpWinVer16(long) @ stdcall GetModuleHandle16(str) @ stdcall GetSelectorLimit16(long) -@ stdcall GetVersion16() -@ stdcall GetWinFlags16() @ stdcall GlobalDOSAlloc16(long) @ stdcall GlobalDOSFree16(long) @ stdcall GlobalFlags16(long) diff --git a/dlls/kernel32/version.c b/dlls/kernel32/version.c index 48f9bb27459..162da8ffb4e 100644 --- a/dlls/kernel32/version.c +++ b/dlls/kernel32/version.c @@ -36,64 +36,12 @@ #include "winuser.h" #include "winternl.h" #include "winerror.h" -#include "wine/winbase16.h" #include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ver); -/*********************************************************************** - * GetVersion (KERNEL.3) - */ -DWORD WINAPI GetVersion16(void) -{ - static WORD dosver, winver; - - if (!dosver) /* not determined yet */ - { - RTL_OSVERSIONINFOEXW info; - - info.dwOSVersionInfoSize = sizeof(info); - if (RtlGetVersion( &info ) != STATUS_SUCCESS) return 0; - - if (info.dwMajorVersion <= 3) - winver = MAKEWORD( info.dwMajorVersion, info.dwMinorVersion ); - else - winver = MAKEWORD( 3, 95 ); - - switch(info.dwPlatformId) - { - case VER_PLATFORM_WIN32s: - switch(MAKELONG( info.dwMinorVersion, info.dwMajorVersion )) - { - case 0x0200: - dosver = 0x0303; /* DOS 3.3 for Windows 2.0 */ - break; - case 0x0300: - dosver = 0x0500; /* DOS 5.0 for Windows 3.0 */ - break; - default: - dosver = 0x0616; /* DOS 6.22 for Windows 3.1 and later */ - break; - } - break; - case VER_PLATFORM_WIN32_WINDOWS: - /* DOS 8.0 for WinME, 7.0 for Win95/98 */ - if (info.dwMinorVersion >= 90) dosver = 0x0800; - else dosver = 0x0700; - break; - case VER_PLATFORM_WIN32_NT: - dosver = 0x0500; /* always DOS 5.0 for NT */ - break; - } - TRACE( "DOS %d.%02d Win %d.%02d\n", - HIBYTE(dosver), LOBYTE(dosver), LOBYTE(winver), HIBYTE(winver) ); - } - return MAKELONG( winver, dosver ); -} - - /*********************************************************************** * GetVersion (KERNEL32.@) * @@ -117,31 +65,6 @@ DWORD WINAPI GetVersion(void) } -/*********************************************************************** - * GetVersionEx (KERNEL.149) - */ -BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16 *v) -{ - OSVERSIONINFOA info; - - if (v->dwOSVersionInfoSize < sizeof(OSVERSIONINFO16)) - { - WARN("wrong OSVERSIONINFO size from app\n"); - return FALSE; - } - - info.dwOSVersionInfoSize = sizeof(info); - if (!GetVersionExA( &info )) return FALSE; - - v->dwMajorVersion = info.dwMajorVersion; - v->dwMinorVersion = info.dwMinorVersion; - v->dwBuildNumber = info.dwBuildNumber; - v->dwPlatformId = info.dwPlatformId; - strcpy( v->szCSDVersion, info.szCSDVersion ); - return TRUE; -} - - /*********************************************************************** * GetVersionExA (KERNEL32.@) */ @@ -237,134 +160,6 @@ BOOL WINAPI VerifyVersionInfoW( LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMa return TRUE; } - -/*********************************************************************** - * GetWinFlags (KERNEL.132) - */ -DWORD WINAPI GetWinFlags16(void) -{ - static const long cpuflags[5] = - { WF_CPU086, WF_CPU186, WF_CPU286, WF_CPU386, WF_CPU486 }; - SYSTEM_INFO si; - OSVERSIONINFOA ovi; - DWORD result; - - GetSystemInfo(&si); - - /* There doesn't seem to be any Pentium flag. */ - result = cpuflags[min(si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING; - if (si.wProcessorLevel >= 4) result |= WF_HASCPUID; - ovi.dwOSVersionInfoSize = sizeof(ovi); - GetVersionExA(&ovi); - if (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT) - result |= WF_WIN32WOW; /* undocumented WF_WINNT */ - return result; -} - - -#if 0 -/* Not used at this time. This is here for documentation only */ - -/* WINDEBUGINFO flags values */ -#define WDI_OPTIONS 0x0001 -#define WDI_FILTER 0x0002 -#define WDI_ALLOCBREAK 0x0004 - -/* dwOptions values */ -#define DBO_CHECKHEAP 0x0001 -#define DBO_BUFFERFILL 0x0004 -#define DBO_DISABLEGPTRAPPING 0x0010 -#define DBO_CHECKFREE 0x0020 - -#define DBO_SILENT 0x8000 - -#define DBO_TRACEBREAK 0x2000 -#define DBO_WARNINGBREAK 0x1000 -#define DBO_NOERRORBREAK 0x0800 -#define DBO_NOFATALBREAK 0x0400 -#define DBO_INT3BREAK 0x0100 - -/* DebugOutput flags values */ -#define DBF_TRACE 0x0000 -#define DBF_WARNING 0x4000 -#define DBF_ERROR 0x8000 -#define DBF_FATAL 0xc000 - -/* dwFilter values */ -#define DBF_KERNEL 0x1000 -#define DBF_KRN_MEMMAN 0x0001 -#define DBF_KRN_LOADMODULE 0x0002 -#define DBF_KRN_SEGMENTLOAD 0x0004 -#define DBF_USER 0x0800 -#define DBF_GDI 0x0400 -#define DBF_MMSYSTEM 0x0040 -#define DBF_PENWIN 0x0020 -#define DBF_APPLICATION 0x0008 -#define DBF_DRIVER 0x0010 - -#endif /* NOLOGERROR */ - - -/*********************************************************************** - * GetWinDebugInfo (KERNEL.355) - */ -BOOL16 WINAPI GetWinDebugInfo16(WINDEBUGINFO16 *lpwdi, UINT16 flags) -{ - FIXME("(%8lx,%d): stub returning 0\n", - (unsigned long)lpwdi, flags); - /* 0 means not in debugging mode/version */ - /* Can this type of debugging be used in wine ? */ - /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */ - return 0; -} - - -/*********************************************************************** - * SetWinDebugInfo (KERNEL.356) - */ -BOOL16 WINAPI SetWinDebugInfo16(WINDEBUGINFO16 *lpwdi) -{ - FIXME("(%8lx): stub returning 0\n", (unsigned long)lpwdi); - /* 0 means not in debugging mode/version */ - /* Can this type of debugging be used in wine ? */ - /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */ - return 0; -} - - -/*********************************************************************** - * K329 (KERNEL.329) - * - * TODO: - * Should fill lpBuffer only if DBO_BUFFERFILL has been set by SetWinDebugInfo() - */ -void WINAPI DebugFillBuffer(LPSTR lpBuffer, WORD wBytes) -{ - memset(lpBuffer, DBGFILL_BUFFER, wBytes); -} - -/*********************************************************************** - * DiagQuery (KERNEL.339) - * - * returns TRUE if Win called with "/b" (bootlog.txt) - */ -BOOL16 WINAPI DiagQuery16(void) -{ - /* perhaps implement a Wine "/b" command line flag sometime ? */ - return FALSE; -} - -/*********************************************************************** - * DiagOutput (KERNEL.340) - * - * writes a debug string into \bootlog.txt - */ -void WINAPI DiagOutput16(LPCSTR str) -{ - /* FIXME */ - TRACE("DIAGOUTPUT:%s\n", debugstr_a(str)); -} - /*********************************************************************** * TermsrvAppInstallMode (KERNEL32.@) *