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.

90 lines
3.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: cobjsaf.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __COBJSAF_H
  11. #define __COBJSAF_H
  12. #include "objsafe.h"
  13. #include "comcat.h"
  14. // This class provides a simple implementation for IObjectSafety for
  15. // for object that are either always safe or always unsafe for scripting
  16. // and/or initializing with persistent data.
  17. //
  18. // The constructor takes an IUnknown interface on an outer object and delegates
  19. // all IUnknown calls through that object. Because of this, the object must
  20. // be explicitly destroyed using C++ (rather than COM) mechanisms, either by
  21. // using "delete" or by making the object an embedded member of some other class.
  22. //
  23. // The constructor also takes two booleans telling whether the object is safe
  24. // for scripting and initializing from persistent data.
  25. #if 0
  26. class CObjectSafety : public IObjectSafety
  27. {
  28. public:
  29. CObjectSafety::CObjectSafety
  30. (
  31. IUnknown *punkOuter, // outer (controlling object)
  32. BOOL fSafeForScripting = TRUE, // whether the object is safe for scripting
  33. BOOL fSafeForInitializing = TRUE // whether the object is safe for initializing
  34. )
  35. {
  36. m_punkOuter = punkOuter;
  37. m_fSafeForScripting = fSafeForScripting;
  38. m_fSafeForInitializing = fSafeForInitializing;
  39. }
  40. // Delegating versions of IUnknown functions
  41. STDMETHODIMP_(ULONG) AddRef() {
  42. return m_punkOuter->AddRef();
  43. }
  44. STDMETHODIMP_(ULONG) Release() {
  45. return m_punkOuter->Release();
  46. }
  47. STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppv) {
  48. return m_punkOuter->QueryInterface(iid, ppv);
  49. }
  50. // Return the interface setting options on this object
  51. STDMETHODIMP GetInterfaceSafetyOptions(
  52. /*IN */ REFIID iid, // Interface that we want options for
  53. /*OUT*/ DWORD * pdwSupportedOptions, // Options meaningful on this interface
  54. /*OUT*/ DWORD * pdwEnabledOptions) // current option values on this interface
  55. ;
  56. // Attempt to set the interface setting options on this object.
  57. // Since these are assumed to be fixed, we basically just check
  58. // that the attempted settings are valid.
  59. STDMETHODIMP SetInterfaceSafetyOptions(
  60. /*IN */ REFIID iid, // Interface to set options for
  61. /*IN */ DWORD dwOptionsSetMask, // Options to change
  62. /*IN */ DWORD dwEnabledOptions) // New option values
  63. ;
  64. protected:
  65. IUnknown *m_punkOuter;
  66. BOOL m_fSafeForScripting;
  67. BOOL m_fSafeForInitializing;
  68. };
  69. // Helper function to create a component category and associated description
  70. HRESULT CreateComponentCategory(CATID catid, WCHAR* catDescription);
  71. #endif
  72. // Helper function to register a CLSID as belonging to a component category
  73. HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid);
  74. // Helper function to unregister a CLSID as belonging to a component category
  75. HRESULT UnRegisterCLSIDInCategory(REFCLSID clsid, CATID catid);
  76. #endif