WinFix.H 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Command & Conquer *
  23. * *
  24. * $Archive:: /Renegade Setup/Autorun/WinFix.H $*
  25. * *
  26. * $Author:: Maria_l $*
  27. * *
  28. * $Modtime:: 11/07/01 5:57p $*
  29. * *
  30. * $Revision:: 6 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * WindowsVersionInfo::Major -- Get the major version of the OS *
  35. * WindowsVersionInfo::Minor -- Get the minor version of the OS *
  36. * WindowsVersionInfo::Build -- Get the build level of the OS *
  37. * WindowsVersionInfo::Info -- Get additional system information *
  38. * WindowsVersionInfo::Is_Win9x -- Determine if we are running on a non-NT system. *
  39. * WindowsVersionInfo::Is_Win95 -- Determine if we are running on a Win95 system. *
  40. * WindowsVersionInfo::Is_Win98 -- Determine if we are running on a Win98 system. *
  41. * WindowsVersionInfo::Is_WinNT -- Determine if we are running on an NT system. *
  42. * WindowsVersionInfo::Is_WinNT5 -- Determine if we are running on an NT 5 system. *
  43. * WindowsVersionInfo::Version -- *
  44. * WindowsVersionInfo::IsOSR2Release -- *
  45. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  46. #pragma once
  47. #ifndef WINFIX_H
  48. #define WINFIX_H
  49. /*-----------------------------------------------------------------------------
  50. ** Windows Version Information class. This is a global object that is used to
  51. ** store information about the specific OS that we are running under. This can
  52. ** be used to make special allowances for differences between OS's, such as when
  53. ** using the registry, or trying to work around a limitaion of a particular OS
  54. ** (their APIs are slightly different...)
  55. **-----------------------------------------------------------------------------*/
  56. class WindowsVersionInfo
  57. {
  58. public:
  59. WindowsVersionInfo (void);
  60. ~WindowsVersionInfo (void) {}
  61. int Major ( void ) const { return( MajorVersionNumber ); }
  62. int Minor ( void ) const { return( MinorVersionNumber ); }
  63. int Build ( void ) const { return( BuildNumber ); }
  64. bool Is_Win9x ( void ) const { return( IsWin9x ); } // Win 9x
  65. bool Is_Win95 ( void ) const { return( IsWin95 ); } // Win 95
  66. bool Is_Win98 ( void ) const { return( IsWin98 ); } // Win 98
  67. bool Is_WinNT ( void ) const { return( IsWinNT ); } // Win NT
  68. bool Is_WinNT4 ( void ) const { return( IsWinNT && MajorVersionNumber == 4 ); } // Win NT
  69. bool Is_WinNT5 ( void ) const { return( IsWinNT && MajorVersionNumber == 5 ); } // Win NT
  70. bool Is_Win_2000 ( void ) const { return( IsWin2000 ); } // Win 2000
  71. bool Is_Win_XP ( void ) const { return( IsWinXP ); } // Win XP
  72. int Version ( void ) const { return( WindowsVersion ); }
  73. int IsOSR2Release ( void ) const { return( RunningOSR2 ); }
  74. const char * Info ( void ) const { return( &AdditionalInfo[0] ); }
  75. char * Version_String ( void );
  76. char * Version_Name ( void );
  77. bool Meets_Minimum_Version_Requirements ( void );
  78. private:
  79. /*-----------------------------------------------------------------------
  80. ** Major version number; i.e. for 4.10.1721 this would be '4'
  81. */
  82. int MajorVersionNumber;
  83. /*-----------------------------------------------------------------------
  84. ** Minor version number; i.e. for 4.10.1721 this would be '10'
  85. */
  86. int MinorVersionNumber;
  87. /*-----------------------------------------------------------------------
  88. ** Version number expressed as a DWORD; i.e. for 4.10 this would be '410'
  89. */
  90. int WindowsVersion;
  91. /*-----------------------------------------------------------------------
  92. ** Build number; i.e. for 4.10.1721 this would be '1721'
  93. */
  94. int BuildNumber;
  95. /*-----------------------------------------------------------------------
  96. ** Is the system running OSR 2 or later release of Windows95.
  97. */
  98. int RunningOSR2;
  99. /*-----------------------------------------------------------------------
  100. ** Additional Info; i.e. for NT 4.0 with SP3, this would be
  101. ** the string 'Service Pack 3'
  102. */
  103. char AdditionalInfo[128];
  104. /*-----------------------------------------------------------------------
  105. ** Windows 9x flag; true if running on non-NT system
  106. */
  107. bool IsWin9x;
  108. bool IsWin95;
  109. bool IsWin98;
  110. /*-----------------------------------------------------------------------
  111. ** Windows NT flag; true if running on Windows NT system
  112. */
  113. bool IsWinNT;
  114. /*-----------------------------------------------------------------------
  115. ** Windows 2000 (Formerly Windows NT 5.0)
  116. ** As you've no doubt heard by now, Windows NT 5.0 has been officially
  117. ** christened "Windows 2000."
  118. */
  119. bool IsWin2000;
  120. /*-----------------------------------------------------------------------
  121. ** Windows XP flag; true if running on Windows NT system
  122. */
  123. bool IsWinXP;
  124. /*-----------------------------------------------------------------------
  125. ** This array is used for formatting the version # as a string
  126. */
  127. char VersionName[30];
  128. };
  129. extern WindowsVersionInfo WinVersion;
  130. #endif