Team Fortress 2 Source Code as on 22/4/2020
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.

46 lines
977 B

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "stdafx.h"
  9. #include "osver.h"
  10. static eOSVersion s_OS = eUninitialized;
  11. void initOSVersion()
  12. {
  13. OSVERSIONINFO versioninfo;
  14. versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  15. if (GetVersionEx(&versioninfo))
  16. {
  17. switch(versioninfo.dwPlatformId)
  18. {
  19. case VER_PLATFORM_WIN32_WINDOWS:
  20. {
  21. s_OS = eWin9x;
  22. break;
  23. }
  24. case VER_PLATFORM_WIN32_NT:
  25. {
  26. s_OS = eWinNT;
  27. break;
  28. }
  29. default:
  30. {
  31. s_OS = eUnknown;
  32. break;
  33. }
  34. }
  35. }
  36. }
  37. eOSVersion getOSVersion()
  38. {
  39. if (s_OS == eUninitialized)
  40. {
  41. initOSVersion();
  42. }
  43. return s_OS;
  44. }