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.

145 lines
3.4 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // File: oleimpl.hxx
  4. //
  5. // Contents: This file contins the DLL entry points
  6. // LibMain
  7. // DllGetClassObject (Bindings key func)
  8. // DllCanUnloadNow
  9. // CBasicBndCF (class factory)
  10. // History: 30-Mar-92 SarahJ Created
  11. // 31-Dec-93 ErikGav Chicago port
  12. //
  13. //---------------------------------------------------------------------
  14. #ifndef __OLESRV_H__
  15. #define __OLESRV_H__
  16. #include <smartp.hxx>
  17. DefineSmartItfP(IClassFactory)
  18. //+---------------------------------------------------------------------------
  19. //
  20. // Function: operator new, public
  21. //
  22. // Synopsis: Global operator new which does not throw exceptions.
  23. //
  24. // Arguments: [size] -- Size of the memory to allocate.
  25. //
  26. // Returns: A pointer to the allocated memory. Is *NOT* initialized to 0!
  27. //
  28. // Notes: We override new to make delete easier.
  29. //
  30. //----------------------------------------------------------------------------
  31. inline void* __cdecl
  32. operator new (size_t size)
  33. {
  34. return(CoTaskMemAlloc(size));
  35. }
  36. //+-------------------------------------------------------------------------
  37. //
  38. // Function: ::operator delete
  39. //
  40. // Synopsis: Free a block of memory
  41. //
  42. // Arguments: [lpv] - block to free.
  43. //
  44. //--------------------------------------------------------------------------
  45. inline void __cdecl operator delete(void FAR* lpv)
  46. {
  47. CoTaskMemFree(lpv);
  48. }
  49. //+-------------------------------------------------------------------
  50. //
  51. // Class: CBasicBndCF
  52. //
  53. // Synopsis: Class Factory for CBasicBnd
  54. //
  55. // Methods: IUnknown - QueryInterface, AddRef, Release
  56. // IClassFactory - CreateInstance
  57. //
  58. // History: 21-Mar-92 SarahJ Created
  59. //
  60. //--------------------------------------------------------------------
  61. class CAdvBndCF: public IClassFactory
  62. {
  63. public:
  64. // Constructor/Destructor
  65. CAdvBndCF();
  66. ~CAdvBndCF();
  67. static IClassFactory FAR * Create();
  68. // IUnknown
  69. STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
  70. STDMETHODIMP_(ULONG) AddRef (void);
  71. STDMETHODIMP_(ULONG) Release (void);
  72. // IClassFactory
  73. STDMETHODIMP CreateInstance(
  74. IUnknown FAR* pUnkOuter,
  75. REFIID iidInterface,
  76. void FAR* FAR* ppv);
  77. STDMETHODIMP LockServer(BOOL fLock);
  78. private:
  79. XIClassFactory _xifac;
  80. DWORD _dwRegistration;
  81. ULONG _cRefs;
  82. };
  83. //+-------------------------------------------------------------------
  84. //
  85. // Class: CAdvBnd
  86. //
  87. // Synopsis: Test class CBasicBnd
  88. //
  89. // Methods:
  90. //
  91. // History: 21-Mar-92 SarahJ Created
  92. //
  93. //--------------------------------------------------------------------
  94. class CAdvBnd: public IPersistFile
  95. {
  96. public:
  97. CAdvBnd(IClassFactory *pFactory);
  98. ~CAdvBnd();
  99. // IUnknown
  100. STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
  101. STDMETHODIMP_(ULONG) AddRef (void);
  102. STDMETHODIMP_(ULONG) Release (void);
  103. // IPersitFile
  104. STDMETHODIMP GetClassID(LPCLSID lpClassID);
  105. STDMETHODIMP IsDirty();
  106. STDMETHODIMP Load(LPCWSTR lpszFileName, DWORD grfMode);
  107. STDMETHODIMP Save(LPCWSTR lpszFileName, BOOL fRemember);
  108. STDMETHODIMP SaveCompleted(LPCWSTR lpszFileName);
  109. STDMETHODIMP GetCurFile(LPWSTR FAR * lpszFileName);
  110. private:
  111. XIUnknown _xiunk;
  112. DWORD _dwRegister;
  113. ULONG _cRefs;
  114. };
  115. #endif