//****************************************************************************** // // Copyright (c) 1999-2000, Microsoft Corporation, All rights reserved // //***************************************************************************** #ifndef __WBEM_TOKEN_CACHE__H_ #define __WBEM_TOKEN_CACHE__H_ #include #include #include class CWmiToken; class CTokenCache : public CUnkBase { protected: CCritSec m_cs; CRefedPointerArray m_apTokens; protected: BOOL ConstructTokenFromHandle(HANDLE hToken, const BYTE* pSid, IWbemToken** ppToken); public: CTokenCache(CLifeControl* pControl) : CUnkBase(pControl){} HRESULT STDMETHODCALLTYPE GetToken(const BYTE* pSid, IWbemToken** ppToken); HRESULT STDMETHODCALLTYPE Shutdown(); }; class CWmiToken : public CUnkBase { protected: HANDLE m_hToken; CTokenCache* m_pCache; PSID m_pSid; bool m_bOwnHandle; friend CTokenCache; public: CWmiToken(ADDREF CTokenCache* pCache, const PSID pSid, ACQUIRE HANDLE hToken); CWmiToken(READ_ONLY HANDLE hToken); virtual ~CWmiToken(); HRESULT STDMETHODCALLTYPE AccessCheck(DWORD dwDesiredAccess, const BYTE* pSD, DWORD* pdwGrantedAccess); }; #endif