Commit 2f3e8d3c authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Move the 16-bit version functions to kernel16.c.

parent 3b3112cb
......@@ -86,6 +86,56 @@ BOOL WINAPI KERNEL_DllEntryPoint( DWORD reasion, HINSTANCE16 inst, WORD ds,
}
/***********************************************************************
* 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)
*/
SEGPTR WINAPI KERNEL_AnsiNext16(SEGPTR current)
......@@ -183,6 +233,52 @@ void WINAPI OutputDebugString16( LPCSTR 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)
*/
void WINAPI DebugBreak16( CONTEXT *context )
......@@ -198,6 +294,38 @@ void WINAPI DebugBreak16( CONTEXT *context )
}
/***********************************************************************
* 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 <windir>\bootlog.txt
*/
void WINAPI DiagOutput16(LPCSTR str)
{
/* FIXME */
TRACE("DIAGOUTPUT:%s\n", debugstr_a(str));
}
/***********************************************************************
* hmemcpy (KERNEL.348)
*/
void WINAPI hmemcpy16( LPVOID dst, LPCVOID src, LONG count )
......@@ -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)
*/
......
......@@ -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)
......
......@@ -36,7 +36,6 @@
#include "winuser.h"
#include "winternl.h"
#include "winerror.h"
#include "wine/winbase16.h"
#include "wine/unicode.h"
#include "wine/debug.h"
......@@ -44,57 +43,6 @@ 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.@)
*
* Win31 0x80000a03
......@@ -118,31 +66,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.@)
*/
BOOL WINAPI GetVersionExA(OSVERSIONINFOA *v)
......@@ -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 <windir>\bootlog.txt
*/
void WINAPI DiagOutput16(LPCSTR str)
{
/* FIXME */
TRACE("DIAGOUTPUT:%s\n", debugstr_a(str));
}
/***********************************************************************
* TermsrvAppInstallMode (KERNEL32.@)
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment