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.

75 lines
2.0 KiB

  1. #ifndef _TAPI_PROMPTED_OBJECT_SAFETY_H_
  2. #define _TAPI_PROMPTED_OBJECT_SAFETY_H_
  3. /*++
  4. Copyright (c) 1999 Microsoft Corporation
  5. Module Name:
  6. PromptedObjectSafety.h
  7. Abstract:
  8. abstract base class for secure object safety mechanism
  9. calls the derived class's Ask() method to determine
  10. whether safe for scripting request should be rejected
  11. --*/
  12. #include "ObjectSafeImpl.h"
  13. class CPromptedObjectSafety : public CObjectSafeImpl
  14. {
  15. public:
  16. STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid,
  17. DWORD dwOptionSetMask,
  18. DWORD dwEnabledOptions)
  19. {
  20. if ( SUCCEEDED(InterfaceSupported(riid)) && Ask() )
  21. {
  22. return CObjectSafeImpl::SetInterfaceSafetyOptions(riid,
  23. dwOptionSetMask,
  24. dwEnabledOptions);
  25. }
  26. else
  27. {
  28. return E_FAIL;
  29. }
  30. }
  31. STDMETHOD(GetInterfaceSafetyOptions)(REFIID riid,
  32. DWORD *pdwSupportedOptions,
  33. DWORD *pdwEnabledOptions)
  34. {
  35. if (SUCCEEDED(InterfaceSupported(riid)) && Ask())
  36. {
  37. return CObjectSafeImpl::GetInterfaceSafetyOptions(riid,
  38. pdwSupportedOptions,
  39. pdwEnabledOptions);
  40. }
  41. else
  42. {
  43. return E_FAIL;
  44. }
  45. }
  46. //
  47. // implement Ask() in the derived class. Should contain the logic to make
  48. // the decision on whether the control should be allowed to run
  49. //
  50. // return FALSE if you want to mark your control as not safe for scripting
  51. // return TRUE otherwise
  52. //
  53. virtual BOOL Ask() = 0;
  54. };
  55. #endif // _TAPI_PROMPTED_OBJECT_SAFETY_H_