msvcrt: Added _get_osplatform implementation.

This commit is contained in:
Piotr Caban 2010-05-05 13:36:58 +02:00 committed by Alexandre Julliard
parent 599531b7d9
commit 3f4eded5d4
4 changed files with 28 additions and 6 deletions

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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)