httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Tim.Coste...@BTFinancialgroup.com>
Subject [PATCH] ap_get_oslevel (win32)
Date Fri, 07 Apr 2000 01:39:32 GMT
Hi again,

This patch addresses a bug in ap_get_oslevel (which ATM is only called once - from open.c).
The bug is caused by failure to initialise the dwOSVersionInfoSize member of the OSVERSIONINFO
struct, so GetVersionEx always fails. 

It also enhances the function (and the associated enum) to handle selected service packs for
NT4, and adds recognition for Windows 2000. This is useful, eg. if we can recognise NT4 SP2
then we can use ReadFileScatter and WriteFileGather in readwrite.c. 

The patch is included inline.

Tim

--- /srclib/repos/apache/2.0/src/src/lib/apr/include/apr_config.hw	Wed Apr 05 13:59:47 2000
+++ src/lib/apr/include/apr_config.hw	Fri Apr 07 11:28:36 2000
@@ -155,7 +155,13 @@
 typedef enum {
 	APR_WIN_95 = 0, 
 	APR_WIN_98 = 4, 
-	APR_WIN_NT = 8
+	APR_WIN_NT = 8,
+	APR_WIN_NT_4 = 12,
+	APR_WIN_NT_4_SP2 = 14,
+	APR_WIN_NT_4_SP3 = 15,
+	APR_WIN_NT_4_SP4 = 16,
+	APR_WIN_NT_4_SP6 = 18,
+	APR_WIN_2000 = 24
 } ap_oslevel_e;

--- /srclib/repos/apache/2.0/src/src/lib/apr/misc/win32/start.c	Tue Apr 04 05:44:58 2000
+++ src/lib/apr/misc/win32/start.c	Fri Apr 07 11:08:18 2000
@@ -119,14 +119,46 @@
 ap_status_t ap_get_oslevel(ap_context_t *cont, ap_oslevel_e *level)
 {
     static OSVERSIONINFO oslev;
+    static unsigned int servpack = 0;
     static BOOL first = TRUE;
+    char *pservpack;
 
     if (first) {
         first = FALSE;
+        oslev.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
         GetVersionEx(&oslev);
+        if (oslev.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+            for (pservpack = oslev.szCSDVersion; 
+                 *pservpack && !isdigit(*pservpack); pservpack++)
+                ;
+            if (*pservpack)
+                servpack = atoi(pservpack);
+        }
     }
     if (oslev.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-        (*level) = APR_WIN_NT;
+        if (oslev.dwMajorVersion == 5) {
+            (*level) = APR_WIN_2000;
+        }
+        else if (oslev.dwMajorVersion == 4) {
+            if (servpack >= 6) {
+                (*level) = APR_WIN_NT_4_SP6;
+            }
+            else if (servpack >= 4) {
+                (*level) = APR_WIN_NT_4_SP4;
+            }
+            else if (servpack >= 3) {
+                (*level) = APR_WIN_NT_4_SP3;
+            }
+            else if (servpack >= 2) {
+                (*level) = APR_WIN_NT_4_SP2;
+            }
+            else {
+                (*level) = APR_WIN_NT_4;
+            }
+        }
+        else {
+            (*level) = APR_WIN_NT;
+        }
         return APR_SUCCESS;
     }
     else if (oslev.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {


Mime
View raw message