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.

75 lines
2.0 KiB

  1. #include "private.h"
  2. #include "proj.h"
  3. /*----------------------------------------------------------
  4. Purpose: Returns TRUE/FALSE if the platform is the given OS_ value.
  5. */
  6. STDAPI_(BOOL) staticIsOS(DWORD dwOS)
  7. {
  8. BOOL bRet;
  9. static OSVERSIONINFOA s_osvi;
  10. static BOOL s_bVersionCached = FALSE;
  11. if (!s_bVersionCached)
  12. {
  13. s_bVersionCached = TRUE;
  14. s_osvi.dwOSVersionInfoSize = sizeof(s_osvi);
  15. GetVersionExA(&s_osvi);
  16. }
  17. switch (dwOS)
  18. {
  19. case OS_WINDOWS:
  20. bRet = (VER_PLATFORM_WIN32_WINDOWS == s_osvi.dwPlatformId);
  21. break;
  22. case OS_NT:
  23. #ifndef UNIX
  24. bRet = (VER_PLATFORM_WIN32_NT == s_osvi.dwPlatformId);
  25. #else
  26. bRet = ((VER_PLATFORM_WIN32_NT == s_osvi.dwPlatformId) ||
  27. (VER_PLATFORM_WIN32_UNIX == s_osvi.dwPlatformId));
  28. #endif
  29. break;
  30. case OS_WIN95:
  31. bRet = (VER_PLATFORM_WIN32_WINDOWS == s_osvi.dwPlatformId &&
  32. s_osvi.dwMajorVersion >= 4);
  33. break;
  34. case OS_MEMPHIS:
  35. bRet = (VER_PLATFORM_WIN32_WINDOWS == s_osvi.dwPlatformId &&
  36. (s_osvi.dwMajorVersion > 4 ||
  37. s_osvi.dwMajorVersion == 4 && s_osvi.dwMinorVersion >= 10));
  38. break;
  39. case OS_MEMPHIS_GOLD:
  40. bRet = (VER_PLATFORM_WIN32_WINDOWS == s_osvi.dwPlatformId &&
  41. s_osvi.dwMajorVersion == 4 && s_osvi.dwMinorVersion == 10 &&
  42. LOWORD(s_osvi.dwBuildNumber) == 1998);
  43. break;
  44. case OS_NT4:
  45. #ifndef UNIX
  46. bRet = (VER_PLATFORM_WIN32_NT == s_osvi.dwPlatformId &&
  47. #else
  48. bRet = ((VER_PLATFORM_WIN32_NT == s_osvi.dwPlatformId ||
  49. (VER_PLATFORM_WIN32_UNIX == s_osvi.dwPlatformId)) &&
  50. #endif
  51. s_osvi.dwMajorVersion >= 4);
  52. break;
  53. case OS_NT5:
  54. bRet = (VER_PLATFORM_WIN32_NT == s_osvi.dwPlatformId &&
  55. s_osvi.dwMajorVersion >= 5);
  56. break;
  57. default:
  58. bRet = FALSE;
  59. break;
  60. }
  61. return bRet;
  62. }