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.

242 lines
6.5 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 __OLEIMPL_H__
  15. #define __OLEIMPL_H__
  16. #define STGM_DFRALL (STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_DENY_WRITE)
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Function: operator new, public
  20. //
  21. // Synopsis: Global operator new which does not throw exceptions.
  22. //
  23. // Arguments: [size] -- Size of the memory to allocate.
  24. //
  25. // Returns: A pointer to the allocated memory. Is *NOT* initialized to 0!
  26. //
  27. // Notes: We override new to make delete easier.
  28. //
  29. //----------------------------------------------------------------------------
  30. inline void* __cdecl
  31. operator new (size_t size)
  32. {
  33. return(CoTaskMemAlloc(size));
  34. }
  35. //+-------------------------------------------------------------------------
  36. //
  37. // Function: ::operator delete
  38. //
  39. // Synopsis: Free a block of memory
  40. //
  41. // Arguments: [lpv] - block to free.
  42. //
  43. //--------------------------------------------------------------------------
  44. inline void __cdecl operator delete(void FAR* lpv)
  45. {
  46. CoTaskMemFree(lpv);
  47. }
  48. //
  49. // Define the interface we are going to use here - avoiding MIDL stuff
  50. //
  51. //+-------------------------------------------------------------------
  52. //
  53. // Class: CBasicBndCF
  54. //
  55. // Synopsis: Class Factory for CBasicBnd
  56. //
  57. // Methods: IUnknown - QueryInterface, AddRef, Release
  58. // IClassFactory - CreateInstance
  59. //
  60. // History: 21-Mar-92 SarahJ Created
  61. //
  62. //--------------------------------------------------------------------
  63. class FAR CBasicBndCF: public IClassFactory
  64. {
  65. public:
  66. // Constructor/Destructor
  67. CBasicBndCF();
  68. ~CBasicBndCF();
  69. // IUnknown
  70. STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
  71. STDMETHODIMP_(ULONG) AddRef(void);
  72. STDMETHODIMP_(ULONG) Release(void);
  73. // IClassFactory
  74. STDMETHODIMP CreateInstance(IUnknown FAR* pUnkOuter,
  75. REFIID iidInterface,
  76. void FAR* FAR* ppv);
  77. STDMETHODIMP LockServer(BOOL fLock);
  78. BOOL ReleaseClass(void);
  79. private:
  80. ULONG _cRefs;
  81. };
  82. //+-------------------------------------------------------------------
  83. //
  84. // Class: CBasicBnd
  85. //
  86. // Synopsis: Test class CBasicBnd
  87. //
  88. // Methods:
  89. //
  90. // History: 21-Mar-92 SarahJ Created
  91. //
  92. //--------------------------------------------------------------------
  93. class FAR CBasicBnd: public IPersistFile, public IOleClientSite,
  94. public IOleObject, public IOleItemContainer
  95. {
  96. public:
  97. // Constructor/Destructor
  98. CBasicBnd(IUnknown *punk);
  99. ~CBasicBnd();
  100. // IUnknown
  101. STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
  102. STDMETHODIMP_(ULONG) AddRef(void);
  103. STDMETHODIMP_(ULONG) Release(void);
  104. // IPersist - needed 'cause IPersistFile inherits from this
  105. STDMETHODIMP GetClassID(LPCLSID lpClassID);
  106. // IPersitFile
  107. STDMETHODIMP IsDirty();
  108. STDMETHODIMP Load(LPCWSTR lpszFileName, DWORD grfMode);
  109. STDMETHODIMP Save(LPCWSTR lpszFileName, BOOL fRemember);
  110. STDMETHODIMP SaveCompleted(LPCWSTR lpszFileName);
  111. STDMETHODIMP GetCurFile(LPWSTR FAR * lplpszFileName);
  112. // *** IOleObject methods ***
  113. STDMETHODIMP SetClientSite( LPOLECLIENTSITE pClientSite);
  114. STDMETHODIMP GetClientSite( LPOLECLIENTSITE FAR* ppClientSite);
  115. STDMETHODIMP SetHostNames( LPCWSTR szContainerApp, LPCWSTR szContainerObj);
  116. STDMETHODIMP Close(DWORD dwSaveOption);
  117. STDMETHODIMP SetMoniker( DWORD dwWhichMoniker, LPMONIKER pmk);
  118. STDMETHODIMP GetMoniker( DWORD dwAssign, DWORD dwWhichMoniker,
  119. LPMONIKER FAR* ppmk);
  120. STDMETHODIMP InitFromData( LPDATAOBJECT pDataObject,
  121. BOOL fCreation,
  122. DWORD dwReserved);
  123. STDMETHODIMP GetClipboardData( DWORD dwReserved,
  124. LPDATAOBJECT FAR* ppDataObject);
  125. STDMETHODIMP DoVerb( LONG iVerb,
  126. LPMSG lpmsg,
  127. LPOLECLIENTSITE pActiveSite,
  128. LONG lindex,
  129. HWND hwndParent,
  130. LPCRECT lprcPosRect);
  131. STDMETHODIMP EnumVerbs(LPENUMOLEVERB FAR* ppenumOleVerb);
  132. STDMETHODIMP Update(void);
  133. STDMETHODIMP IsUpToDate(void);
  134. STDMETHODIMP GetUserClassID(CLSID FAR *pClsid);
  135. STDMETHODIMP GetUserType(DWORD dwFormOfType, LPWSTR FAR* pszUserType);
  136. STDMETHODIMP SetExtent( DWORD dwDrawAspect, LPSIZEL lpsizel);
  137. STDMETHODIMP GetExtent( DWORD dwDrawAspect, LPSIZEL lpsizel);
  138. STDMETHODIMP Advise( LPADVISESINK pAdvSink, DWORD FAR* pdwConnection);
  139. STDMETHODIMP Unadvise( DWORD dwConnection);
  140. STDMETHODIMP EnumAdvise( LPENUMSTATDATA FAR* ppenumAdvise);
  141. STDMETHODIMP GetMiscStatus(DWORD dwAspect, DWORD FAR* pdwStatus);
  142. STDMETHODIMP SetColorScheme( LPLOGPALETTE lpLogpal);
  143. // *** IParseDisplayName method ***
  144. STDMETHODIMP ParseDisplayName(
  145. LPBC pbc,
  146. LPWSTR lpszDisplayName,
  147. ULONG FAR* pchEaten,
  148. LPMONIKER FAR* ppmkOut) ;
  149. // *** IOleContainer methods ***
  150. STDMETHODIMP EnumObjects(DWORD grfFlags, LPENUMUNKNOWN FAR* ppenumUnknown);
  151. STDMETHODIMP LockContainer(BOOL fLock);
  152. // *** IOleItemContainer methods ***
  153. STDMETHODIMP GetObject(
  154. LPWSTR lpszItem,
  155. DWORD dwSpeedNeeded,
  156. LPBINDCTX pbc,
  157. REFIID riid,
  158. LPVOID FAR* ppvObject);
  159. STDMETHODIMP GetObjectStorage(
  160. LPWSTR lpszItem,
  161. LPBINDCTX pbc,
  162. REFIID riid,
  163. LPVOID FAR* ppvStorage);
  164. STDMETHODIMP IsRunning(LPWSTR lpszItem) ;
  165. // IOleClientSite
  166. STDMETHODIMP SaveObject (void);
  167. STDMETHODIMP GetContainer (LPOLECONTAINER FAR *ppContainer);
  168. STDMETHODIMP ShowObject (void);
  169. STDMETHODIMP OnShowWindow (BOOL fShow);
  170. STDMETHODIMP RequestNewObjectLayout (void);
  171. private:
  172. IUnknown * _punk;
  173. IMoniker * _pmkContainer;
  174. IStorage * _psStg1;
  175. IStorage * _psStg2;
  176. };
  177. class CUnknownBasicBnd : public IUnknown
  178. {
  179. public:
  180. CUnknownBasicBnd(IUnknown *punk);
  181. ~CUnknownBasicBnd(void);
  182. // IUnknown
  183. STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
  184. STDMETHODIMP_(ULONG) AddRef(void);
  185. STDMETHODIMP_(ULONG) Release(void);
  186. private:
  187. CBasicBnd * _pbasicbnd;
  188. ULONG _cRefs;
  189. };
  190. #endif