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.

86 lines
2.1 KiB

  1. #ifndef __WMIAUTHZ_H__
  2. #define __WMIAUTHZ_H__
  3. #include <wbemint.h>
  4. #include <authz.h>
  5. #include <unk.h>
  6. #include <sync.h>
  7. class CWmiAuthzApi;
  8. /**************************************************************************
  9. CWmiAuthz
  10. ***************************************************************************/
  11. class CWmiAuthz : public CUnkBase<IWbemTokenCache, &IID_IWbemTokenCache>
  12. {
  13. CCritSec m_cs;
  14. BOOL m_bInit;
  15. AUTHZ_RESOURCE_MANAGER_HANDLE m_hResMgr;
  16. CWmiAuthzApi* m_pApi;
  17. PSID m_pLocalSystemSid, m_pAdministratorsSid;
  18. HRESULT EnsureInitialized();
  19. public:
  20. CWmiAuthz( CLifeControl* pControl );
  21. ~CWmiAuthz();
  22. CWmiAuthzApi* GetApi() { return m_pApi; }
  23. STDMETHOD(GetToken)( const BYTE* pSid, IWbemToken** ppToken );
  24. STDMETHOD(Shutdown)();
  25. };
  26. /***************************************************************************
  27. CWmiAuthzToken
  28. ****************************************************************************/
  29. class CWmiAuthzToken : public CUnkBase<IWbemToken, &IID_IWbemToken>
  30. {
  31. AUTHZ_CLIENT_CONTEXT_HANDLE m_hCtx;
  32. CWmiAuthz* m_pOwner;
  33. public:
  34. CWmiAuthzToken( CWmiAuthz* pOwner, AUTHZ_CLIENT_CONTEXT_HANDLE hCtx );
  35. ~CWmiAuthzToken();
  36. STDMETHOD(AccessCheck)( DWORD dwDesiredAccess,
  37. const BYTE* pSD,
  38. DWORD* pdwGrantedAccess);
  39. };
  40. /****************************************************************************
  41. WILL NOT BE COMPILED IN PRESENCE OF AUTHZ LIBRARY
  42. *****************************************************************************/
  43. #ifndef __AUTHZ_H__
  44. /***************************************************************************
  45. CWmiNoAuthzToken
  46. ****************************************************************************/
  47. class CWmiNoAuthzToken : public CUnkBase<IWbemToken, &IID_IWbemToken>
  48. {
  49. CNtSid m_Sid;
  50. public:
  51. CWmiNoAuthzToken( PSID pSid ) : m_Sid( pSid ) {}
  52. STDMETHOD( AccessCheck )( DWORD dwDesiredAccess,
  53. const BYTE* pSD,
  54. DWORD* pdwGrantedAccess );
  55. };
  56. #endif
  57. #endif __WMIAUTHZ_H__