[AD] Proposing patch in windows detection

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi. I'm trying to track a annoying bug in allegro under my Windows 2003, and I saw that it was wrongly detected as Win2000 (it would be better if it could be detect as WinXP, but it would be wrong yet).
 
So i searched through the allegro sources, and I'M PROPOSING THE ATTACHED DIFF. This diff will detect Win2003 and (hopefully) LongHorn.
 
I also advise that this patch is a bit lazy and doesn't fix the thing completelly. Windows Vista would be detected as LongHorn and XP x64 will be detected as Win2003, but in Allegro 4.2.0 (release), XP x64 would be detected as Win2000 and Longhorn and Vista as WinNT, which is obviously much worse.
 
Unfortunately the proper patch would be a monstruous and confusing thing (which i couldn't understand, so i couldn't make it). This is mainly because Microsoft doesn't like to keep things simple.
 
As this shouldn't break API or ABI compatibility and is a bugfix, I think should be applied not only to 4.3.0 but to 4.2.1 too.
 
Victor Williams Stafusa da Silva


Yahoo! Acesso Grátis: Internet rápida e grátis.
Instale o discador agora!
diff -u3 Al4.2.0/system.h new/system.h
--- Al4.2.0/system.h	Tue Mar 15 20:32:44 2005
+++ new/system.h	Thu Nov 24 05:45:44 2005
@@ -45,6 +45,9 @@
 #define OSTYPE_WINNT       AL_ID('W','N','T',' ')
 #define OSTYPE_WIN2000     AL_ID('W','2','K',' ')
 #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_WINLONGHORN AL_ID('W','L','H',' ')
 #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')
diff -u3 Al4.2.0/wsystem.c new/wsystem.c
--- Al4.2.0/wsystem.c	Mon Aug 22 21:37:18 2005
+++ new/wsystem.c	Thu Nov 24 06:13:39 2005
@@ -142,8 +142,18 @@
    os_multitasking = TRUE;
 
    if (win_ver < 0x80000000) {
-      if (os_version == 5) {
-         if(os_revision == 1)
+
+      /* Since doesn't exist os_version == 7 or greater yet,
+         these will be detected as Longhorn instead of NT. */
+      if (os_version >= 6) {
+         os_type = OSTYPE_WINLONGHORN;
+      }
+      else if (os_version == 5) {
+         /* If in the future a os_revision == 3 or greater comes,
+            it will be detected as Win2003 instead of Win2000. */
+         if (os_revision >= 2)
+	    os_type = OSTYPE_WIN2003;
+         else if (os_revision == 1)
 	    os_type = OSTYPE_WINXP;
 	 else
 	    os_type = OSTYPE_WIN2000;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/