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.

55 lines
1.5 KiB

  1. //******************************************************************************
  2. //
  3. // Copyright (c) 1999-2000, Microsoft Corporation, All rights reserved
  4. //
  5. //*****************************************************************************
  6. #ifndef __WBEM_TOKEN_CACHE__H_
  7. #define __WBEM_TOKEN_CACHE__H_
  8. #include <wbemcomn.h>
  9. #include <wbemint.h>
  10. #include <sync.h>
  11. class CWmiToken;
  12. class CTokenCache : public CUnkBase<IWbemTokenCache, &IID_IWbemTokenCache>
  13. {
  14. protected:
  15. CCritSec m_cs;
  16. CRefedPointerArray<CWmiToken> m_apTokens;
  17. protected:
  18. BOOL ConstructTokenFromHandle(HANDLE hToken, const BYTE* pSid,
  19. IWbemToken** ppToken);
  20. public:
  21. CTokenCache(CLifeControl* pControl) :
  22. CUnkBase<IWbemTokenCache, &IID_IWbemTokenCache>(pControl){}
  23. HRESULT STDMETHODCALLTYPE GetToken(const BYTE* pSid, IWbemToken** ppToken);
  24. HRESULT STDMETHODCALLTYPE Shutdown();
  25. };
  26. class CWmiToken : public CUnkBase<IWbemToken, &IID_IWbemToken>
  27. {
  28. protected:
  29. HANDLE m_hToken;
  30. CTokenCache* m_pCache;
  31. PSID m_pSid;
  32. bool m_bOwnHandle;
  33. friend CTokenCache;
  34. public:
  35. CWmiToken(ADDREF CTokenCache* pCache, const PSID pSid,
  36. ACQUIRE HANDLE hToken);
  37. CWmiToken(READ_ONLY HANDLE hToken);
  38. virtual ~CWmiToken();
  39. HRESULT STDMETHODCALLTYPE AccessCheck(DWORD dwDesiredAccess,
  40. const BYTE* pSD,
  41. DWORD* pdwGrantedAccess);
  42. };
  43. #endif