msvcrt: Do not set the windows version to 0.5.

This commit is contained in:
Rein Klazes 2009-04-16 09:10:28 +02:00 committed by Alexandre Julliard
parent e00d864a35
commit ed20ac877c
2 changed files with 56 additions and 12 deletions

View File

@ -262,7 +262,7 @@ unsigned int CDECL MSVCRT____setlc_active_func(void)
*/
void msvcrt_init_args(void)
{
DWORD version;
OSVERSIONINFOW osvi;
MSVCRT__acmdln = _strdup( GetCommandLineA() );
MSVCRT__wcmdln = msvcrt_wstrdupa(MSVCRT__acmdln);
@ -273,17 +273,23 @@ void msvcrt_init_args(void)
TRACE("got %s, wide = %s argc=%d\n", debugstr_a(MSVCRT__acmdln),
debugstr_w(MSVCRT__wcmdln),MSVCRT___argc);
version = GetVersion();
MSVCRT__osver = version >> 16;
MSVCRT__winminor = version & 0xFF;
MSVCRT__winmajor = (version>>8) & 0xFF;
MSVCRT_baseversion = version >> 16;
MSVCRT__winver = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
MSVCRT_baseminor = (version >> 16) & 0xFF;
MSVCRT_basemajor = (version >> 24) & 0xFF;
MSVCRT_osversion = version & 0xFFFF;
MSVCRT_osminor = version & 0xFF;
MSVCRT_osmajor = (version>>8) & 0xFF;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
GetVersionExW( &osvi );
MSVCRT__winver = (osvi.dwMajorVersion << 8) | osvi.dwMinorVersion;
MSVCRT__winmajor = osvi.dwMajorVersion;
MSVCRT__winminor = osvi.dwMinorVersion;
MSVCRT__osver = osvi.dwBuildNumber;
MSVCRT_osversion = MSVCRT__winver;
MSVCRT_osmajor = MSVCRT__winmajor;
MSVCRT_osminor = MSVCRT__winminor;
MSVCRT_baseversion = MSVCRT__osver;
MSVCRT_baseminor = MSVCRT_baseversion & 0xFF;
MSVCRT_basemajor = (MSVCRT_baseversion >> 8) & 0xFF;
TRACE( "winver %08x winmajor %08x winminor %08x osver%08x baseversion %08x basemajor %08x baseminor %08x\n",
MSVCRT__winver, MSVCRT__winmajor, MSVCRT__winminor, MSVCRT__osver, MSVCRT_baseversion,
MSVCRT_basemajor, MSVCRT_baseminor);
TRACE( "osversion %08x osmajor %08x osminor %08x\n", MSVCRT_osversion, MSVCRT_osmajor, MSVCRT_osminor);
MSVCRT__HUGE = HUGE_VAL;
MSVCRT___setlc_active = 0;
MSVCRT___unguarded_readlc_active = 0;

View File

@ -67,13 +67,51 @@ static void test_initterm(void)
initterm_test(&callbacks[0], &callbacks[3], 2);
}
static void test_initvar( HMODULE hmsvcrt )
{
OSVERSIONINFO osvi = { sizeof(OSVERSIONINFO) };
int* (*pp_winver)() = (int*(*)())GetProcAddress(hmsvcrt, "__p__winver");
int* (*pp_winmajor)() = (int*(*)())GetProcAddress(hmsvcrt, "__p__winmajor");
int* (*pp_winminor)() = (int*(*)())GetProcAddress(hmsvcrt, "__p__winminor");
int* (*pp_osver)() = (int*(*)())GetProcAddress(hmsvcrt, "__p__osver");
int winver, winmajor, winminor, osver;
if( !( pp_winmajor && pp_winminor && pp_winver)) {
win_skip("_winver variables are not available\n");
return;
}
winver = *pp_winver();
winminor = *pp_winminor();
winmajor = *pp_winmajor();
GetVersionEx( &osvi);
ok( winminor == osvi.dwMinorVersion, "Wrong value for _winminor %02x expected %02x\n",
winminor, osvi.dwMinorVersion);
ok( winmajor == osvi.dwMajorVersion, "Wrong value for _winmajor %02x expected %02x\n",
winmajor, osvi.dwMajorVersion);
ok( winver == ((osvi.dwMajorVersion << 8) | osvi.dwMinorVersion),
"Wrong value for _winver %02x expected %02x\n",
winver, ((osvi.dwMajorVersion << 8) | osvi.dwMinorVersion));
if( !pp_osver) {
win_skip("_osver variables are not available\n");
return;
}
osver = *pp_osver();
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);
}
START_TEST(data)
{
HMODULE hmsvcrt;
hmsvcrt = GetModuleHandleA("msvcrt.dll");
if (!hmsvcrt)
hmsvcrt = GetModuleHandleA("msvcrtd.dll");
if (hmsvcrt)
p_initterm=(void*)GetProcAddress(hmsvcrt, "_initterm");
test_initterm();
test_initvar(hmsvcrt);
}