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.

193 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. HelpAcc.h
  5. Abstract:
  6. Declaration of the HelpAssistantAccount structure
  7. Author:
  8. HueiWang 2/17/2000
  9. --*/
  10. #ifndef __HELPASSISTANTACCOUNT_H__
  11. #define __HELPASSISTANTACCOUNT_H__
  12. #include "stdafx.h"
  13. #include <lm.h>
  14. #include <wtsapi32.h>
  15. #include <winsta.h>
  16. #include "helper.h"
  17. #define HELPACCOUNTPROPERLYSETUP \
  18. _TEXT("20ed87e2-3b82-4114-81f9-5e219ed4c481-SALEMHELPACCOUNT")
  19. #define MAX_USERNAME_LENGTH LM20_UNLEN
  20. //
  21. // Default Help Assistant account name
  22. //
  23. #define HELPASSISTANTACCOUNT_NAME SALEMHELPASSISTANTACCOUNT_NAME
  24. //
  25. // LSA key to store help assistant account password and SID
  26. //
  27. #define HELPASSISTANTACCOUNT_PASSWORDKEY SALEMHELPASSISTANTACCOUNT_PASSWORDKEY
  28. #define HELPASSISTANTACCOUNT_SIDKEY SALEMHELPASSISTANTACCOUNT_SIDKEY
  29. #define HELPASSISTANTACCOUNT_EMPTYPASSWORD L""
  30. #if __WIN9XBUILD__
  31. // pre-define USER SID for Win9x box.
  32. #define WIN9X_USER_SID _TEXT("1-1-1-1-1-1")
  33. #endif
  34. #define RDSADDINEXECNAME _TEXT("rdsaddin.exe")
  35. typedef BOOL (WINAPI* PWTSSetUserConfigW)(
  36. IN LPWSTR pServerName,
  37. IN LPWSTR pUserName,
  38. IN WTS_CONFIG_CLASS WTSConfigClass,
  39. IN LPWSTR pBuffer,
  40. IN DWORD DataLength
  41. );
  42. #define REGVALUE_PERSONAL_WKS_TSSETTING _TEXT("TS Connection")
  43. typedef struct __HelpAssistantAccount
  44. {
  45. private:
  46. static CCriticalSection gm_HelpAccountCS;
  47. static DWORD gm_dwAccErrCode;
  48. HRESULT
  49. GetHelpAccountScript(
  50. CComBSTR& bstrScript
  51. );
  52. HRESULT
  53. CacheHelpAccountSID();
  54. HRESULT
  55. LookupHelpAccountSid(
  56. IN LPTSTR pszAccName,
  57. OUT PSID* ppSid,
  58. OUT DWORD* pcbSid
  59. );
  60. HRESULT
  61. ConfigHelpAccountTSSettings(
  62. IN LPTSTR pszAccName,
  63. IN LPTSTR pszInitProgram
  64. );
  65. DWORD
  66. EnableAccountRights(
  67. BOOL bEnable,
  68. DWORD dwNumRights,
  69. LPTSTR* rights
  70. );
  71. public:
  72. static CComBSTR gm_bstrHelpAccountPwd;
  73. static CComBSTR gm_bstrHelpAccountName;
  74. static PBYTE gm_pbHelpAccountSid;
  75. static DWORD gm_cbHelpAccountSid;
  76. ~__HelpAssistantAccount()
  77. {
  78. FreeMemory(gm_pbHelpAccountSid);
  79. }
  80. HRESULT
  81. Initialize(
  82. BOOL bVerifyPassword = TRUE
  83. );
  84. BOOL
  85. IsValid()
  86. {
  87. return ERROR_SUCCESS == gm_dwAccErrCode;
  88. }
  89. HRESULT
  90. DeleteHelpAccount();
  91. HRESULT
  92. CreateHelpAccount(
  93. LPCTSTR pszPassword = NULL
  94. );
  95. HRESULT
  96. SetupHelpAccountTSSettings();
  97. HRESULT
  98. SetupHelpAccountTSRights(
  99. IN BOOL bDel,
  100. IN BOOL bEnable,
  101. IN BOOL bDelExisting,
  102. IN DWORD dwPermissions
  103. );
  104. HRESULT
  105. ResetHelpAccountPassword(
  106. LPCTSTR pszPassword = NULL
  107. );
  108. HRESULT
  109. GetHelpAccountNameEx( CComBSTR& bstrValue )
  110. {
  111. DWORD dwStatus = ERROR_SUCCESS;
  112. bstrValue = gm_bstrHelpAccountName;
  113. if( 0 == bstrValue.Length() )
  114. {
  115. MYASSERT(0 == bstrValue.Length());
  116. dwStatus = ERROR_INTERNAL_ERROR;
  117. }
  118. return HRESULT_FROM_WIN32( dwStatus );
  119. }
  120. BOOL
  121. IsAccountHelpAccount(
  122. IN PBYTE pbSid,
  123. IN DWORD cbSid
  124. );
  125. HRESULT
  126. EnableRemoteInteractiveRight(
  127. BOOL bEnable
  128. );
  129. HRESULT
  130. EnableHelpAssistantAccount(
  131. BOOL bEnable
  132. );
  133. } HelpAssistantAccount;
  134. #endif