Source code of Windows XP (NT5)
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.

65 lines
1.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: osver.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "pch.h"
  11. #pragma hdrstop
  12. #include "osver.h"
  13. int
  14. OsVersion::Get(
  15. void
  16. ) const
  17. {
  18. if (UNKNOWN == m_os)
  19. {
  20. OSVERSIONINFO osvi;
  21. osvi.dwOSVersionInfoSize = sizeof(osvi);
  22. if (0 != GetVersionEx(&osvi))
  23. {
  24. //
  25. // This code uses the same logic as that used by the shell
  26. // to determine OS version.
  27. //
  28. switch(osvi.dwPlatformId)
  29. {
  30. case VER_PLATFORM_WIN32_WINDOWS:
  31. if (osvi.dwMajorVersion > 4 || (osvi.dwMajorVersion == 4 &&
  32. osvi.dwMinorVersion >= 10))
  33. {
  34. m_os = WIN98;
  35. }
  36. else if (osvi.dwMajorVersion >= 4)
  37. {
  38. m_os = WIN95;
  39. }
  40. break;
  41. case VER_PLATFORM_WIN32_NT:
  42. if (osvi.dwMajorVersion >= 5)
  43. {
  44. m_os = NT5;
  45. }
  46. else if (osvi.dwMajorVersion >= 4)
  47. {
  48. m_os = NT4;
  49. }
  50. break;
  51. default:
  52. break;
  53. }
  54. }
  55. }
  56. return m_os;
  57. }