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.

107 lines
3.3 KiB

  1. //******************************************************************************
  2. //
  3. // Microsoft Confidential. Copyright (c) Microsoft Corporation 1999. All rights reserved
  4. //
  5. // File: RsopSec.h
  6. //
  7. // Description: RSOP Namespace Security functions
  8. //
  9. // History: 8-26-99 leonardm Created
  10. //
  11. //******************************************************************************
  12. #ifndef _RSOPSEC_H__89DD6583_B442_41d6_B300_EFE4326A6752__INCLUDED
  13. #define _RSOPSEC_H__89DD6583_B442_41d6_B300_EFE4326A6752__INCLUDED
  14. #include "smartptr.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. HRESULT SetNamespaceSecurity(const WCHAR* pszNamespace,
  19. long lSecurityLevel,
  20. IWbemServices* pWbemServices=NULL);
  21. HRESULT SetNamespaceSD( SECURITY_DESCRIPTOR* pSD, IWbemServices* pWbemServices);
  22. HRESULT GetNamespaceSD( IWbemServices* pWbemServices, SECURITY_DESCRIPTOR** ppSD);
  23. HRESULT RSoPMakeAbsoluteSD(SECURITY_DESCRIPTOR* pSelfRelativeSD, SECURITY_DESCRIPTOR** ppAbsoluteSD);
  24. HRESULT FreeAbsoluteSD(SECURITY_DESCRIPTOR* pAbsoluteSD);
  25. LPWSTR GetSOM( LPCWSTR szAccount );
  26. DWORD GetDomain( LPCWSTR szSOM, LPWSTR *pszDomain );
  27. HRESULT AuthenticateUser(HANDLE hToken,
  28. LPCWSTR szMachSOM,
  29. LPCWSTR szUserSOM,
  30. BOOL bLogging,
  31. DWORD *pdwExtendedInfo);
  32. //
  33. // lSecurityLevels
  34. //
  35. const long NAMESPACE_SECURITY_DIAGNOSTIC = 0;
  36. const long NAMESPACE_SECURITY_PLANNING = 1;
  37. PSID GetUserSid (HANDLE UserToken);
  38. VOID DeleteUserSid(PSID Sid);
  39. #ifdef __cplusplus
  40. } // extern "C" {
  41. #endif
  42. typedef struct _SidStruct {
  43. PSID pSid;
  44. DWORD dwAccess;
  45. BOOL bUseLocalFree;
  46. DWORD AceFlags;
  47. } SidStruct;
  48. // need to add code for inheritted aces..
  49. class CSecDesc
  50. {
  51. private:
  52. XPtrLF<SidStruct> m_xpSidList;
  53. DWORD m_cAces;
  54. DWORD m_cAllocated;
  55. BOOL m_bInitialised;
  56. BOOL m_bFailed;
  57. XPtrLF<SID> m_xpOwnerSid;
  58. XPtrLF<SID> m_xpGrpSid;
  59. // Not implemented.
  60. CSecDesc(const CSecDesc& x);
  61. CSecDesc& operator=(const CSecDesc& x);
  62. BOOL ReAllocSidList();
  63. public:
  64. CSecDesc();
  65. ~CSecDesc();
  66. BOOL AddLocalSystem(DWORD dwAccess=GENERIC_ALL, DWORD AceFlags=0);
  67. BOOL AddAdministrators(DWORD dwAccess=GENERIC_ALL, DWORD AceFlags=0);
  68. BOOL AddNetworkService(DWORD dwAccess=GENERIC_ALL, DWORD AceFlags=0);
  69. BOOL AddEveryOne(DWORD dwAccess, DWORD AceFlags=0);
  70. BOOL AddAdministratorsAsOwner();
  71. BOOL AddAdministratorsAsGroup();
  72. // BOOL AddThisUser(HANDLE hToken, DWORD dwAccess, BYTE AceFlags=0);
  73. // This cannot be implemented here currently because it needs to call
  74. // GetUserSid which is in userenv\sid.c. To add that code we need to add the
  75. // common headers..
  76. BOOL AddUsers(DWORD dwAccess, DWORD AceFlags=0);
  77. BOOL AddAuthUsers(DWORD dwAccess, DWORD AceFlags=0);
  78. BOOL AddSid(PSID pSid, DWORD dwAccess, DWORD AceFlags=0);
  79. PISECURITY_DESCRIPTOR MakeSD();
  80. PISECURITY_DESCRIPTOR MakeSelfRelativeSD();
  81. };
  82. #endif // _RSOPSEC_H__89DD6583_B442_41d6_B300_EFE4326A6752__INCLUDED