From: hno <> Date: Sun, 6 May 2001 20:25:21 +0000 (+0000) Subject: [win32.c was forgotten in the large commit] X-Git-Tag: SQUID_3_0_PRE1~1517 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3b1797bd17a7bdd2d7119ee32e5859f4c04e48df;p=thirdparty%2Fsquid.git [win32.c was forgotten in the large commit] This patch allows squid to read the DNS servers from the registry. Guido has reintegrated the older NT-port code to do this, and upgraded it to fit in squid more smoothly. --- diff --git a/src/win32.cc b/src/win32.cc new file mode 100644 index 0000000000..b173141e6a --- /dev/null +++ b/src/win32.cc @@ -0,0 +1,92 @@ +/* + * $Id: win32.cc,v 1.1 2001/05/06 14:25:21 hno Exp $ + * + * * * * * * * * Legal stuff * * * * * * * + * + * (C) 2001 Guido Serassio , + * inspired by previous work by Romeo Anghelache & Eric Stern. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#include "squid.h" + +/* This code compiles only CygWin & Windows NT Port */ +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) +#include + +static unsigned int GetOSVersion(); +void WIN32_svcstatusupdate(DWORD); + +/* ====================================================================== */ +/* LOCAL FUNCTIONS */ +/* ====================================================================== */ + +static unsigned int +GetOSVersion() +{ + OSVERSIONINFO osvi; + + memset(&osvi, '\0', sizeof(OSVERSIONINFO)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx((OSVERSIONINFO *) & osvi); + switch (osvi.dwPlatformId) { + case VER_PLATFORM_WIN32_NT: + if (osvi.dwMajorVersion <= 4) { + strcpy(WIN32_OS_string, "Windows NT"); + return _WIN_OS_WINNT; + } + if (osvi.dwMajorVersion == 5) { + strcpy(WIN32_OS_string, "Windows 2000"); + return _WIN_OS_WIN2K; + } + break; + case VER_PLATFORM_WIN32_WINDOWS: + if ((osvi.dwMajorVersion > 4) || + ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0))) { + strcpy(WIN32_OS_string, "Windows 98"); + return _WIN_OS_WIN98; + } + strcpy(WIN32_OS_string, "Windows 95"); + return _WIN_OS_WIN95; + break; + case VER_PLATFORM_WIN32s: + strcpy(WIN32_OS_string, "Windows 3.1 with WIN32S"); + return _WIN_OS_WIN32S; + break; + default: + return _WIN_OS_UNKNOWN; + } + strcpy(WIN32_OS_string, "Unknown"); + return _WIN_OS_UNKNOWN; +} + +/* ====================================================================== */ +/* PUBLIC FUNCTIONS */ +/* ====================================================================== */ + +VOID +WIN32_Exit(int ExitStatus) +{ + exit(0); +} + +int +WIN32_Subsystem_Init() +{ + WIN32_OS_version = GetOSVersion(); + return 0; +} +#endif