summaryrefslogtreecommitdiff
path: root/misc/win32/start.c
diff options
context:
space:
mode:
authorstoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68>2000-04-07 03:07:50 +0000
committerstoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68>2000-04-07 03:07:50 +0000
commit4ef8fdf5098ad7ac6267f14c26628380067cbd39 (patch)
treebbf88f01ad3c95ef51af32d735c2b67eae4c2773 /misc/win32/start.c
parentbea579a99143d8f34da04adf958fb83472322c4d (diff)
downloadlibapr-4ef8fdf5098ad7ac6267f14c26628380067cbd39.tar.gz
Win32: Fix a bug in ap_get_oslevel which causes GetVersionEx() to
always fail. Need to initialise the dwOSVersionInfoSize member of the OSVERSIONINFO struct before calling GetVersionEx, so GetVersionEx always fails. The patch also enhances ap_get_oslevel (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. Submitted by: Tim Costello Reviewed by: Bill Stoddard git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59813 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc/win32/start.c')
-rw-r--r--misc/win32/start.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/misc/win32/start.c b/misc/win32/start.c
index 89913672e..20f41465c 100644
--- a/misc/win32/start.c
+++ b/misc/win32/start.c
@@ -119,14 +119,46 @@ ap_status_t ap_destroy_context(ap_context_t *cont)
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) {