Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

winver.cc File Reference

#include <windows.h>
#include <stdio.h>

Include dependency graph for winver.cc:

Include dependency graph

Go to the source code of this file.

Functions

char * winver ()

Variables

char winverbuf [256]
int winver_done = 0


Function Documentation

char* winver  
 

Definition at line 10 of file winver.cc.

Referenced by CMS::setup_diag_proc_info().

00011 {
00012   char *os_string = "Win32";
00013   if (winver_done)
00014     {
00015       return winverbuf;
00016     }
00017 
00018   OSVERSIONINFOEX osvi;
00019   BOOL bOsVersionInfoEx;
00020 
00021   // Try calling GetVersionEx using the OSVERSIONINFOEX structure,
00022   // which is supported on Windows NT versions 5.0 and later.
00023   // If that fails, try using the OSVERSIONINFO structure,
00024   // which is supported on earlier versions of Windows and Windows NT
00025 
00026   ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX));
00027   osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
00028 
00029   if (!(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) & osvi)))
00030     {
00031 
00032       // If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO.
00033 
00034       osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
00035       if (!GetVersionEx ((OSVERSIONINFO *) & osvi))
00036         return (NULL);
00037     }
00038 
00039   switch (osvi.dwPlatformId)
00040     {
00041 
00042     case VER_PLATFORM_WIN32_NT:
00043 
00044       os_string = "WinNT";
00045       break;
00046 
00047     case VER_PLATFORM_WIN32_WINDOWS:
00048 
00049       if ((osvi.dwMajorVersion > 4) ||
00050           ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0)))
00051         os_string = "Win98";
00052       else
00053         os_string = "Win95";
00054       break;
00055 
00056     case VER_PLATFORM_WIN32s:
00057 
00058       os_string = "Ms Win32s";
00059       break;
00060     }
00061 
00062   sprintf (winverbuf, "%s ver %d.%d (Bld %d)\n",
00063            os_string,
00064            osvi.dwMajorVersion,
00065            osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF);
00066   winver_done = 1;
00067   return winverbuf;
00068 };


Variable Documentation

char winverbuf[256] [static]
 

Definition at line 6 of file winver.cc.

int winver_done = 0 [static]
 

Definition at line 7 of file winver.cc.


Generated on Sun Dec 2 15:58:06 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001