[AD] [4.2]/[4.4]: Added detection of Windows 7 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Currently, the 4.2 and 4.4 branches do not detect versions of Windows
higher than Windows Vista. The included patch adds the ability to
distinguish Windows Vista and Windows 7. Windows server 2008 is not
detected directly (this would require a re-write of sys_directx_init()
to use GetVersionEx() instead of GetVersion()). With the patch, Windows
server 2008will either register as Windows Vista (if not using R2) or
Windows 7 (if using R2)).
Here is a summary of the changes.
system.h
+ Added a #define for OSTYPE_WIN7
wsystem.c
+ Made it detect Windows 7.
wsystem.c is identical in both 4.2.3.1 and 4.4.1.1 . system.h is
slightly different in 4.4.1.1 but the patch should be able to be applied
to both versions as the change occurs before the first difference
between the two versions.
I don't have access to a Windows Vista machine and have only tested it
on Windows 7.
AE.
PS. I had a look at 5.0.1 to see how that handled OS detection, but I
was unable to find it. I tried both the online manual and downloading
the source and doing a search for 'vista'. The only occurance of
GetVersion[Ex]() was in one of the DirectX files and was only used for
treating things differently under Vista. How is OS detection handled in 5.x?
--- wsystem.old.c 2011-03-14 14:27:24.858576000 +0100
+++ wsystem.c 2011-03-14 14:51:37.126835200 +0100
@@ -154,7 +154,12 @@
/* Since doesn't exist os_version == 7 or greater yet,
these will be detected as Vista instead of NT. */
if (os_version >= 6) {
- os_type = OSTYPE_WINVISTA;
+ /* If in the future a os_revision == 2 or greater comes,
+ it will be detected as Windows 7 instead of Vista. */
+ if (os_revision >= 1)
+ os_type = OSTYPE_WIN7;
+ else
+ os_type = OSTYPE_WINVISTA;
}
else if (os_version == 5) {
/* If in the future a os_revision == 3 or greater comes,
--- system.old.h 2011-03-14 14:27:40.100492800 +0100
+++ system.h 2011-03-15 02:36:17.112404800 +0100
@@ -47,6 +47,7 @@
#define OSTYPE_WINXP AL_ID('W','X','P',' ')
#define OSTYPE_WIN2003 AL_ID('W','2','K','3')
#define OSTYPE_WINVISTA AL_ID('W','V','S','T')
+#define OSTYPE_WIN7 AL_ID('W','I','N','7')
#define OSTYPE_OS2 AL_ID('O','S','2',' ')
#define OSTYPE_WARP AL_ID('W','A','R','P')
#define OSTYPE_DOSEMU AL_ID('D','E','M','U')