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.

150 lines
3.7 KiB

  1. /*
  2. * TSUtil.c
  3. *
  4. * Author: BreenH
  5. *
  6. * Terminal Services utilities.
  7. */
  8. /*
  9. * Includes
  10. */
  11. #include "precomp.h"
  12. #include "tsutil.h"
  13. /*
  14. * Function Implementations
  15. */
  16. BOOL WINAPI
  17. IsFullTerminalServicesEnabled(
  18. VOID
  19. )
  20. {
  21. BOOL fRet;
  22. DWORDLONG dwlConditionMask;
  23. OSVERSIONINFOEX osVersionInfo;
  24. RtlZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX));
  25. osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  26. osVersionInfo.wProductType = VER_NT_SERVER;
  27. osVersionInfo.wSuiteMask = VER_SUITE_TERMINAL;
  28. dwlConditionMask = 0;
  29. VER_SET_CONDITION(dwlConditionMask, VER_PRODUCT_TYPE, VER_EQUAL);
  30. VER_SET_CONDITION(dwlConditionMask, VER_SUITENAME, VER_OR);
  31. fRet = VerifyVersionInfo(
  32. &osVersionInfo,
  33. VER_PRODUCT_TYPE | VER_SUITENAME,
  34. dwlConditionMask
  35. );
  36. return(fRet);
  37. }
  38. BOOL WINAPI
  39. IsPersonalTerminalServicesEnabled(
  40. VOID
  41. )
  42. {
  43. BOOL fRet;
  44. DWORDLONG dwlConditionMask;
  45. OSVERSIONINFOEX osVersionInfo;
  46. RtlZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX));
  47. osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  48. osVersionInfo.wProductType = VER_NT_WORKSTATION;
  49. osVersionInfo.wSuiteMask = VER_SUITE_SINGLEUSERTS;
  50. dwlConditionMask = 0;
  51. VER_SET_CONDITION(dwlConditionMask, VER_PRODUCT_TYPE, VER_EQUAL);
  52. VER_SET_CONDITION(dwlConditionMask, VER_SUITENAME, VER_OR);
  53. fRet = VerifyVersionInfo(
  54. &osVersionInfo,
  55. VER_PRODUCT_TYPE | VER_SUITENAME,
  56. dwlConditionMask
  57. );
  58. return(fRet);
  59. }
  60. BOOL WINAPI
  61. IsTerminalServicesEnabled(
  62. VOID
  63. )
  64. {
  65. BOOL fRet;
  66. DWORDLONG dwlConditionMask;
  67. OSVERSIONINFOEX osVersionInfo;
  68. RtlZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX));
  69. osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  70. osVersionInfo.wSuiteMask = VER_SUITE_TERMINAL | VER_SUITE_SINGLEUSERTS;
  71. dwlConditionMask = 0;
  72. VER_SET_CONDITION(dwlConditionMask, VER_SUITENAME, VER_OR);
  73. fRet = VerifyVersionInfo(&osVersionInfo, VER_SUITENAME, dwlConditionMask);
  74. return(fRet);
  75. }
  76. BOOL WINAPI
  77. IsPersonalWorkstation(
  78. VOID
  79. )
  80. {
  81. BOOL fRet;
  82. DWORDLONG dwlConditionMask;
  83. OSVERSIONINFOEX osVersionInfo;
  84. RtlZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX));
  85. osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  86. osVersionInfo.wProductType = VER_NT_WORKSTATION;
  87. osVersionInfo.wSuiteMask = VER_SUITE_PERSONAL;
  88. dwlConditionMask = 0;
  89. VER_SET_CONDITION(dwlConditionMask, VER_PRODUCT_TYPE, VER_EQUAL);
  90. VER_SET_CONDITION(dwlConditionMask, VER_SUITENAME, VER_OR);
  91. fRet = VerifyVersionInfo(
  92. &osVersionInfo,
  93. VER_PRODUCT_TYPE | VER_SUITENAME,
  94. dwlConditionMask
  95. );
  96. return(fRet);
  97. }
  98. // Is this machine an Advanced Server or above
  99. BOOL WINAPI
  100. IsAdvancedServer(
  101. VOID
  102. )
  103. {
  104. BOOL fRet;
  105. DWORDLONG dwlConditionMask;
  106. OSVERSIONINFOEX osVersionInfo;
  107. BOOL fSuiteAdvancedServer = FALSE;
  108. BOOL fSuiteDataCenter = FALSE;
  109. RtlZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX));
  110. osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  111. dwlConditionMask = 0;
  112. VER_SET_CONDITION(dwlConditionMask, VER_SUITENAME, VER_AND);
  113. osVersionInfo.wSuiteMask = VER_SUITE_ENTERPRISE;
  114. fSuiteAdvancedServer = VerifyVersionInfo(&osVersionInfo, VER_SUITENAME, dwlConditionMask);
  115. osVersionInfo.wSuiteMask = VER_SUITE_DATACENTER;
  116. fSuiteDataCenter = VerifyVersionInfo(&osVersionInfo,VER_SUITENAME,dwlConditionMask);
  117. fRet = fSuiteAdvancedServer || fSuiteDataCenter;
  118. return(fRet);
  119. }