Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.0 KiB

  1. //+----------------------------------------------------------------------------
  2. // defines
  3. //+----------------------------------------------------------------------------
  4. #define WIN95_OSR2_BUILD_NUMBER 1111
  5. #define LOADSTRING_BUFSIZE 24
  6. #define FAREAST_WIN95_LOADSTRING_BUFSIZE 512
  7. //
  8. // platform ID for WINDOWS98
  9. //
  10. #define VER_PLATFORM_WIN32_WINDOWS98 100
  11. //
  12. // platform ID for WINDOWS Millennium
  13. //
  14. #define VER_PLATFORM_WIN32_MILLENNIUM 200
  15. //+----------------------------------------------------------------------------
  16. //
  17. // Function GetOSVersion
  18. //
  19. // Synopsis returns the OS version(platform ID)
  20. //
  21. // Arguments NONE
  22. //
  23. // Returns: DWORD - VER_PLATFORM_WIN32_WINDOWS or
  24. // VER_PLATFORM_WIN32_WINDOWS98 or
  25. // VER_PLATFORM_WIN32_NT
  26. //
  27. // History: Created Header 2/13/98
  28. //
  29. //+----------------------------------------------------------------------------
  30. DWORD WINAPI GetOSVersion()
  31. {
  32. static dwPlatformID = 0;
  33. //
  34. // If this function is called before, reture the saved value
  35. //
  36. if (dwPlatformID != 0)
  37. {
  38. return dwPlatformID;
  39. }
  40. OSVERSIONINFO oviVersion;
  41. ZeroMemory(&oviVersion,sizeof(oviVersion));
  42. oviVersion.dwOSVersionInfoSize = sizeof(oviVersion);
  43. GetVersionEx(&oviVersion);
  44. if (oviVersion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
  45. {
  46. //
  47. // If this is Win95 then leave it as VER_PLATFORM_WIN32_WINDOWS, however if this
  48. // is Millennium, Win98 SE, or Win98 Gold we want to modify the returned value
  49. // as follows: VER_PLATFORM_WIN32_MILLENNIUM -> Millennium
  50. // VER_PLATFORM_WIN32_WINDOWS98 -> Win98 SE and Win98 Gold
  51. //
  52. if (oviVersion.dwMajorVersion == 4)
  53. {
  54. if (LOWORD(oviVersion.dwBuildNumber) > 2222)
  55. {
  56. //
  57. // Millennium
  58. //
  59. oviVersion.dwPlatformId = VER_PLATFORM_WIN32_MILLENNIUM;
  60. }
  61. else if (LOWORD(oviVersion.dwBuildNumber) >= 1998)
  62. {
  63. //
  64. // Win98 Gold and Win98 SE
  65. //
  66. oviVersion.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS98;
  67. }
  68. }
  69. }
  70. dwPlatformID = oviVersion.dwPlatformId;
  71. return(dwPlatformID);
  72. }
  73. //+----------------------------------------------------------------------------
  74. //
  75. // Function GetOSBuildNumber
  76. //
  77. // Synopsis Get the build number of Operating system
  78. //
  79. // Arguments None
  80. //
  81. // Returns Build Number of OS
  82. //
  83. // History 3/5/97 VetriV Created
  84. //
  85. //-----------------------------------------------------------------------------
  86. DWORD WINAPI GetOSBuildNumber()
  87. {
  88. static dwBuildNumber = 0;
  89. OSVERSIONINFO oviVersion;
  90. if (0 != dwBuildNumber)
  91. {
  92. return dwBuildNumber;
  93. }
  94. ZeroMemory(&oviVersion,sizeof(oviVersion));
  95. oviVersion.dwOSVersionInfoSize = sizeof(oviVersion);
  96. GetVersionEx(&oviVersion);
  97. dwBuildNumber = oviVersion.dwBuildNumber;
  98. return dwBuildNumber;
  99. }
  100. //+----------------------------------------------------------------------------
  101. //
  102. // Function GetOSMajorVersion
  103. //
  104. // Synopsis Get the Major version number of Operating system
  105. //
  106. // Arguments None
  107. //
  108. // Returns Major version Number of OS
  109. //
  110. // History 2/19/98 VetriV Created
  111. //
  112. //-----------------------------------------------------------------------------
  113. DWORD WINAPI GetOSMajorVersion(void)
  114. {
  115. static dwMajorVersion = 0;
  116. OSVERSIONINFO oviVersion;
  117. if (0 != dwMajorVersion)
  118. {
  119. return dwMajorVersion;
  120. }
  121. ZeroMemory(&oviVersion,sizeof(oviVersion));
  122. oviVersion.dwOSVersionInfoSize = sizeof(oviVersion);
  123. GetVersionEx(&oviVersion);
  124. dwMajorVersion = oviVersion.dwMajorVersion;
  125. return dwMajorVersion;
  126. }