From 3f4eded5d4842880ee895f00f7e865e30f018482 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 5 May 2010 13:36:58 +0200 Subject: [PATCH] msvcrt: Added _get_osplatform implementation. --- dlls/msvcr80/msvcr80.spec | 4 ++-- dlls/msvcrt/data.c | 17 +++++++++++++++++ dlls/msvcrt/msvcrt.spec | 4 ++-- dlls/msvcrt/tests/data.c | 9 +++++++-- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index f3d74c85d56..92db3f0a308 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -472,7 +472,7 @@ @ cdecl _get_heap_handle() msvcrt._get_heap_handle @ cdecl _get_invalid_parameter_handler() msvcrt._get_invalid_parameter_handler @ cdecl _get_osfhandle(long) msvcrt._get_osfhandle -@ stub _get_osplatform +@ cdecl _get_osplatform(ptr) msvcrt._get_osplatform @ stub _get_osver @ stub _get_output_format @ stub _get_pgmptr @@ -811,7 +811,7 @@ @ cdecl _onexit(ptr) msvcrt._onexit @ varargs _open(str long) msvcrt._open @ cdecl _open_osfhandle(long long) msvcrt._open_osfhandle -@ stub _osplatform +@ extern _osplatform msvcrt._osplatform @ extern _osver msvcrt._osver @ stub _outp @ stub _outpd diff --git a/dlls/msvcrt/data.c b/dlls/msvcrt/data.c index c91980d61ce..54dda1c0f66 100644 --- a/dlls/msvcrt/data.c +++ b/dlls/msvcrt/data.c @@ -39,6 +39,7 @@ unsigned int MSVCRT_osmajor = 0;/* FIXME: */ unsigned int MSVCRT_osminor = 0;/* FIXME: */ unsigned int MSVCRT_osmode = 0;/* FIXME: */ unsigned int MSVCRT__osver = 0; +unsigned int MSVCRT__osplatform = 0; unsigned int MSVCRT_osversion = 0; /* FIXME: */ unsigned int MSVCRT__winmajor = 0; unsigned int MSVCRT__winminor = 0; @@ -228,6 +229,21 @@ char*** CDECL __p___initenv(void) { return &MSVCRT___initenv; } */ MSVCRT_wchar_t*** CDECL __p___winitenv(void) { return &MSVCRT___winitenv; } +/********************************************************************* + * _get_osplatform (MSVCRT.@) + */ +int CDECL MSVCRT__get_osplatform(int *ret) +{ + if(!ret) { + MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0); + *MSVCRT__errno() = MSVCRT_EINVAL; + return MSVCRT_EINVAL; + } + + *ret = MSVCRT__osplatform; + return 0; +} + /* INTERNAL: Create a wide string from an ascii string */ MSVCRT_wchar_t *msvcrt_wstrdupa(const char *str) { @@ -279,6 +295,7 @@ void msvcrt_init_args(void) MSVCRT__winmajor = osvi.dwMajorVersion; MSVCRT__winminor = osvi.dwMinorVersion; MSVCRT__osver = osvi.dwBuildNumber; + MSVCRT__osplatform = osvi.dwPlatformId; MSVCRT_osversion = MSVCRT__winver; MSVCRT_osmajor = MSVCRT__winmajor; MSVCRT_osminor = MSVCRT__winminor; diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index f35fdfd965e..6e581df6b22 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -431,7 +431,7 @@ # stub _get_fmode @ cdecl _get_heap_handle() @ cdecl _get_osfhandle(long) -# stub _get_osplatform +@ cdecl _get_osplatform(ptr) MSVCRT__get_osplatform # stub _get_osver # stub _get_output_format # stub _get_pgmptr @@ -759,7 +759,7 @@ @ cdecl _onexit(ptr) MSVCRT__onexit @ varargs _open(str long) MSVCRT__open @ cdecl _open_osfhandle(long long) -# stub _osplatform +@ extern _osplatform MSVCRT__osplatform @ extern _osver MSVCRT__osver @ stub _outp #(long long) @ stub _outpd #(long long) diff --git a/dlls/msvcrt/tests/data.c b/dlls/msvcrt/tests/data.c index a27ca27f3a6..7061124ef73 100644 --- a/dlls/msvcrt/tests/data.c +++ b/dlls/msvcrt/tests/data.c @@ -74,7 +74,8 @@ static void test_initvar( HMODULE hmsvcrt ) int *pp_winmajor = (int*)GetProcAddress(hmsvcrt, "_winmajor"); int *pp_winminor = (int*)GetProcAddress(hmsvcrt, "_winminor"); int *pp_osver = (int*)GetProcAddress(hmsvcrt, "_osver"); - unsigned int winver, winmajor, winminor, osver; + int *pp_osplatform = (int*)GetProcAddress(hmsvcrt, "_osplatform"); + unsigned int winver, winmajor, winminor, osver, osplatform; if( !( pp_winmajor && pp_winminor && pp_winver)) { win_skip("_winver variables are not available\n"); @@ -91,16 +92,20 @@ static void test_initvar( HMODULE hmsvcrt ) ok( winver == ((osvi.dwMajorVersion << 8) | osvi.dwMinorVersion), "Wrong value for _winver %02x expected %02x\n", winver, ((osvi.dwMajorVersion << 8) | osvi.dwMinorVersion)); - if( !pp_osver) { + if( !pp_osver || !pp_osplatform ) { win_skip("_osver variables are not available\n"); return; } osver = *pp_osver; + osplatform = *pp_osplatform; ok( osver == (osvi.dwBuildNumber & 0xffff) || ((osvi.dwBuildNumber >> 24) == osvi.dwMajorVersion && ((osvi.dwBuildNumber >> 16) & 0xff) == osvi.dwMinorVersion), /* 95/98/ME */ "Wrong value for _osver %04x expected %04x\n", osver, osvi.dwBuildNumber); + ok(osplatform == osvi.dwPlatformId, + "Wrong value for _osplatform %x exprected %x\n", + osplatform, osvi.dwPlatformId); } START_TEST(data)