From: Stephen Adams Date: Tue, 9 Apr 1996 20:16:32 +0000 (+0000) Subject: Changed Windows version handling so that Scheme correctly X-Git-Tag: 20090517-FFI~5616 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=1265834a711b0d68f19361d62b069618f53b3ac6;p=mit-scheme.git Changed Windows version handling so that Scheme correctly distinguishes Windows 3.1 from Windows 95. --- diff --git a/v7/src/microcode/ntsys.c b/v7/src/microcode/ntsys.c index a5c3ad1a6..28fbfbf42 100644 --- a/v7/src/microcode/ntsys.c +++ b/v7/src/microcode/ntsys.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ntsys.c,v 1.4 1993/09/03 18:03:03 gjr Exp $ +$Id: ntsys.c,v 1.5 1996/04/09 20:16:32 adams Exp $ -Copyright (c) 1992-1993 Massachusetts Institute of Technology +Copyright (c) 1992-1996 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -48,18 +48,6 @@ nt_console_write (void * vbuffer, size_t nsize) return (nsize); } -void -nt_get_version (version_t * version_number) -{ - DWORD ver; - ver = (GetVersion ()); - version_number->platform = ((unsigned char) - ((((unsigned long) ver) & 0x80000000UL) >> 31)); - version_number->major = (LOBYTE (LOWORD (ver))); - version_number->minor = (HIBYTE (LOWORD (ver))); - return; -} - BOOL nt_pathname_as_filename (char * name, char * buffer) { /* Returns whether directory encountered is top level */ diff --git a/v7/src/microcode/ntsys.h b/v7/src/microcode/ntsys.h index d10611bd2..aeb9c8f2f 100644 --- a/v7/src/microcode/ntsys.h +++ b/v7/src/microcode/ntsys.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: ntsys.h,v 1.5 1996/03/23 19:24:46 adams Exp $ +$Id: ntsys.h,v 1.6 1996/04/09 20:16:08 adams Exp $ -Copyright (c) 1992-96 Massachusetts Institute of Technology +Copyright (c) 1992-1996 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -35,18 +35,10 @@ MIT in each case. */ #ifndef SCM_NTSYS_H #define SCM_NTSYS_H -typedef struct version_struct -{ - unsigned char platform; - unsigned char major; - unsigned char minor; -} version_t; - /* Misc */ extern BOOL win32_under_win32s_p (); -extern int nt_console_write (void * vbuffer, size_t nsize); -extern void nt_get_version (version_t * version_number); +extern int nt_console_write (void * vbuffer, size_t nsize); extern BOOL nt_pathname_as_filename (char * name, char * buffer); #endif /* SCM_NTSYS_H */ diff --git a/v7/src/microcode/nttop.c b/v7/src/microcode/nttop.c index 981e309d8..428d46cdf 100644 --- a/v7/src/microcode/nttop.c +++ b/v7/src/microcode/nttop.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: nttop.c,v 1.17 1996/03/23 19:24:40 adams Exp $ +$Id: nttop.c,v 1.18 1996/04/09 20:15:53 adams Exp $ Copyright (c) 1993-96 Massachusetts Institute of Technology @@ -65,7 +65,8 @@ extern CONST char * OS_Variant; BOOL win32_under_win32s_p () { - return ((GetVersion()) >> 31); + DWORD dwVersion = GetVersion(); + return ((dwVersion>0x80000000) && LOBYTE(LOWORD(dwVersion))<4); } WIN32_SYSTEM_UTILITIES win32_system_utilities; @@ -123,16 +124,32 @@ DEFUN_VOID (OS_initialize) OS_Name = SYSTEM_NAME; { - version_t version_number; - const char * variant; - - nt_get_version (&version_number); - variant = ((version_number.platform == 0) ? "Windows NT" : "Windows"); - OS_Variant = (malloc ((strlen (variant)) + 64)); - sprintf (OS_Variant, "%s %d.%d 386/486\n", - variant, - ((int) version_number.major), - ((int) version_number.minor)); + DWORD dwVersion = GetVersion(); + char variant[128]; + + if (dwVersion < 0x80000000) { + // Windows NT + sprintf (variant, "Microsoft Windows NT %u.%u (Build: %u)", + (DWORD)(LOBYTE(LOWORD(dwVersion))), + (DWORD)(HIBYTE(LOWORD(dwVersion))), + (DWORD)(HIWORD(dwVersion))); + } + else if (LOBYTE(LOWORD(dwVersion))<4) { + // Win32s + sprintf (variant, "Microsoft Win32s %u.%u (Build: %u)", + (DWORD)(LOBYTE(LOWORD(dwVersion))), + (DWORD)(HIBYTE(LOWORD(dwVersion))), + (DWORD)(HIWORD(dwVersion) & ~0x8000)); + } else { + // Windows 95 + sprintf (variant, "Microsoft Windows 95 %u.%u (Build: %u)", + (DWORD)(LOBYTE(LOWORD(dwVersion))), + (DWORD)(HIBYTE(LOWORD(dwVersion))), + (DWORD)(HIWORD(dwVersion) & ~0x8000)); + } + + OS_Variant = malloc (128); + sprintf (OS_Variant, "%s 386/486\n", variant); } }