summaryrefslogtreecommitdiffstats
path: root/private/ole32/dllhost/srgtfact.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'private/ole32/dllhost/srgtfact.hxx')
-rw-r--r--private/ole32/dllhost/srgtfact.hxx119
1 files changed, 119 insertions, 0 deletions
diff --git a/private/ole32/dllhost/srgtfact.hxx b/private/ole32/dllhost/srgtfact.hxx
new file mode 100644
index 000000000..4a0039a68
--- /dev/null
+++ b/private/ole32/dllhost/srgtfact.hxx
@@ -0,0 +1,119 @@
+//+-------------------------------------------------------------------------
+//
+// Microsoft Windows
+// Copyright (C) Microsoft Corporation, 1992 - 1996.
+//
+// File: srgtfact.hxx
+//
+// Contents: Class that implements a surrogate class factory
+// for dll servers that will be instantiated in surrogate
+// processes.
+//
+//
+// History: 21-May-96 t-AdamE Created
+//
+//--------------------------------------------------------------------------
+
+#if !defined(__SRGTFACT_HXX__)
+#define __SRGTFACT_HXX__
+
+#include <windows.h>
+#include <ole2.h>
+#include "cmonitor.hxx"
+
+
+//+-------------------------------------------------------------------------
+//
+// Class: CSrgtMem
+//
+// Purpose: allow classes to use new and delete with OLE's allocator
+//
+// History: 30-Oct-96 t-Adame Created
+//
+//--------------------------------------------------------------------------
+class CSrgtMem
+{
+public:
+
+ void* _CRTAPI1 operator new(size_t cbsize);
+
+ void _CRTAPI1 operator delete(void* pv);
+
+};
+
+
+//+-------------------------------------------------------------------------
+//
+// Class: CSurrogateFactory
+//
+// Purpose: Class factory that is registered via CoRegisterClassObject
+// for all classes that are to be loaded into a surrogate.
+//
+// Notes: In order to be threadsafe, this class inherits from CMonitor,
+// whose methods are used in any methods which manipulate state
+// data
+//
+// History: 21-May-96 t-Adame Created
+//
+//--------------------------------------------------------------------------
+class CSurrogateFactory : IClassFactory, public IMarshal, public CSrgtMem
+{
+public:
+
+ CSurrogateFactory(REFCLSID clsid);
+
+ // methods from IUnknown
+ STDMETHOD (QueryInterface)(REFIID iid, LPVOID* ppv);
+ STDMETHOD_(ULONG,AddRef)();
+ STDMETHOD_(ULONG,Release)();
+
+ // methods from IClassFactory
+ STDMETHOD (CreateInstance)(IUnknown* pUnkOuter, REFIID iid, void** ppv);
+ STDMETHOD (LockServer)(BOOL fLock);
+
+ // methods from IMarshal
+ STDMETHOD (GetUnmarshalClass)(
+ REFIID riid,
+ void *pv,
+ DWORD dwDestContext,
+ void *pvDestContext,
+ DWORD mshlflags,
+ CLSID *pCid);
+
+ STDMETHOD (GetMarshalSizeMax)(
+ REFIID riid,
+ void *pv,
+ DWORD dwDestContext,
+ void *pvDestContext,
+ DWORD mshlflags,
+ DWORD *pSize);
+
+ STDMETHOD (MarshalInterface)(
+ IStream *pStm,
+ REFIID riid,
+ void *pv,
+ DWORD dwDestContext,
+ void *pvDestContext,
+ DWORD mshlflags);
+
+ STDMETHOD (UnmarshalInterface)(IStream *pStm,REFIID riid,void **ppv);
+
+ STDMETHOD (ReleaseMarshalData)(IStream *pStm);
+
+ STDMETHOD (DisconnectObject)(DWORD dwReserved);
+
+ HRESULT Register();
+ HRESULT Revoke();
+
+
+
+protected:
+
+ CLSID _clsid;
+ DWORD _dwRegister;
+ ULONG _cref;
+};
+
+
+#endif // !defined(__SRGTFACT_HXX__)
+