summaryrefslogtreecommitdiffstats
path: root/private/oleutest/dll
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/oleutest/dll
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/oleutest/dll')
-rw-r--r--private/oleutest/dll/daytona/makefile10
-rw-r--r--private/oleutest/dll/daytona/makefile.inc1
-rw-r--r--private/oleutest/dll/daytona/oleimpl.src37
-rw-r--r--private/oleutest/dll/daytona/sources109
-rw-r--r--private/oleutest/dll/dirs38
-rw-r--r--private/oleutest/dll/iclisite.cxx108
-rw-r--r--private/oleutest/dll/oleimpl.cxx898
-rw-r--r--private/oleutest/dll/oleimpl.hxx242
8 files changed, 1443 insertions, 0 deletions
diff --git a/private/oleutest/dll/daytona/makefile b/private/oleutest/dll/daytona/makefile
new file mode 100644
index 000000000..1d3728d41
--- /dev/null
+++ b/private/oleutest/dll/daytona/makefile
@@ -0,0 +1,10 @@
+############################################################################
+#
+# Copyright (C) 1992, Microsoft Corporation.
+#
+# All rights reserved.
+#
+############################################################################
+
+!include $(NTMAKEENV)\makefile.def
+
diff --git a/private/oleutest/dll/daytona/makefile.inc b/private/oleutest/dll/daytona/makefile.inc
new file mode 100644
index 000000000..071024ed2
--- /dev/null
+++ b/private/oleutest/dll/daytona/makefile.inc
@@ -0,0 +1 @@
+obj\i386\oleimpl.def: oleimpl.src
diff --git a/private/oleutest/dll/daytona/oleimpl.src b/private/oleutest/dll/daytona/oleimpl.src
new file mode 100644
index 000000000..9805be702
--- /dev/null
+++ b/private/oleutest/dll/daytona/oleimpl.src
@@ -0,0 +1,37 @@
+#if 0
+
+ Microsoft Windows
+ Copyright (C) Microsoft Corporation, 1992 - 1992.
+ All rights reserved.
+
+ This .def file is preprocessed by the compiler to create the version for
+ the current build in the appropriate subdir. Basically, whatever you
+ would have used in your code to control what is compiled when can be
+ used in this file for the same purpose. The following defines are in
+ use at the time this file was written:
+
+ FLAT - Used to indicate a NT/DOS7 build
+ i386 - Intel i386/i486 build
+ MIPS - MIPS R3000/R4000 build
+ ALPHA - DEC Alpha build
+ DBG - Used to control Debug/Retail. Set to 1 if Debug,
+ 0 if Retail.
+ WIN31 - Win16 build
+ __OS2__ - OS/2 build (used by CT mostly)
+
+ If none of these are used, it is assumed the entire file can be used
+ for all builds.
+
+#endif
+
+#ifdef FLAT
+
+LIBRARY oleimpl
+
+DESCRIPTION 'OLEIMPL'
+
+EXPORTS
+ DllGetClassObject PRIVATE
+ DllCanUnloadNow PRIVATE
+
+#endif // FLAT
diff --git a/private/oleutest/dll/daytona/sources b/private/oleutest/dll/daytona/sources
new file mode 100644
index 000000000..9fef44e10
--- /dev/null
+++ b/private/oleutest/dll/daytona/sources
@@ -0,0 +1,109 @@
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ sources.
+
+Abstract:
+
+ This file specifies the target component being built and the list of
+ sources files needed to build that component. Also specifies optional
+ compiler switches and libraries that are unique for the component being
+ built.
+
+
+Author:
+
+ Donna Liu (DonnaLi) 19-Dec-1993
+
+!ENDIF
+
+MAJORCOMP = cairole
+MINORCOMP = com
+
+# This links against oleutest\assert which is built before this directory.
+# So we block here and collect our threads to assure that "assert" is
+# finished building.
+# Blocking here also allows "olebind", "Server1", "Server2" and
+# "Server3", which also need "assert", to build without SYNCHRONZATION.
+
+SYNCHRONIZE_BLOCK=1
+SYNCHRONIZE_DRAIN=1
+
+#
+# This is the name of the target built from the source files specified
+# below. The name should include neither the path nor the file extension.
+#
+
+TARGETNAME= oleimpl
+
+#
+# This specifies where the target is to be built. A private target of
+# type LIBRARY or DYNLINK should go to obj, whereas a public target of
+# type LIBRARY or DYNLINK should go to $(BASEDIR)\public\sdk\lib.
+#
+
+TARGETPATH= obj
+
+#
+# This specifies the type of the target, such as PROGRAM, DYNLINK, LIBRARY,
+# etc.
+#
+
+TARGETTYPE= DYNLINK
+
+DLLDEF= obj\*\oleimpl.def
+
+DLLBASE=@$(BASEDIR)\PUBLIC\SDK\LIB\coffbase.txt,usermode
+
+INCLUDES= ..\..\..\ole32\common\daytona;..\..\..\ole32\ih;..;..\..\common
+
+C_DEFINES= \
+ $(C_DEFINES) \
+ -DFLAT \
+ -DWIN32=100 \
+ -D_NT1X_=100 \
+ -DUNICODE \
+ -D_UNICODE \
+ -DINC_OLE2 \
+ -DNOEXCEPTIONS \
+ -DCAIROLE_DOWNLEVEL
+
+BLDCRT= 1
+
+SOURCES= \
+ ..\oleimpl.cxx \
+ ..\iclisite.cxx
+
+DLLENTRY=_DllMainCRTStartup
+
+UMTYPE= windows
+UMAPPL=
+UMTEST=
+LINKER_FLAGS=-verbose
+LINKLIBS= \
+ ..\..\assert\daytona\obj\*\assert.lib \
+ ..\..\oledll2\daytona\obj\*\oledll2.lib \
+ $(BASEDIR)\public\sdk\lib\*\uuid.lib \
+ $(BASEDIR)\public\sdk\lib\*\ole32.lib \
+ $(BASEDIR)\public\sdk\lib\*\gdi32.lib \
+ $(BASEDIR)\public\sdk\lib\*\kernel32.lib \
+ $(BASEDIR)\public\sdk\lib\*\user32.lib \
+ $(BASEDIR)\public\sdk\lib\*\advapi32.lib \
+ $(BASEDIR)\public\sdk\lib\*\crtdll.lib
+
+USE_CRTDLL= 1
+
+!IF $(386)
+NTTARGETFILE0=$(DLLDEF:*=i386)
+!ENDIF
+
+!IF $(MIPS)
+NTTARGETFILE0=$(DLLDEF:*=mips)
+!ENDIF
+
+!IF $(ALPHA)
+NTTARGETFILE0=$(DLLDEF:*=alpha)
+!ENDIF
diff --git a/private/oleutest/dll/dirs b/private/oleutest/dll/dirs
new file mode 100644
index 000000000..1d0b9edbb
--- /dev/null
+++ b/private/oleutest/dll/dirs
@@ -0,0 +1,38 @@
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ dirs.
+
+Abstract:
+
+ This file specifies the subdirectories of the current directory that
+ contain component makefiles.
+
+
+Author:
+
+ Donna Liu (DonnaLi) 19-Dec-1993
+
+!ENDIF
+
+#
+# This is a list of all subdirectories that build required components.
+# Each subdirectory name should appear on a line by itself. The build
+# follows the order in which the subdirectories are specified.
+#
+
+DIRS=
+
+#
+# This is a list of all subdirectories that build optional components.
+# Each subdirectory name should appear on a line by itself. The build
+# follows the order in which the subdirectories are specified.
+#
+
+OPTIONAL_DIRS= \
+ \
+ \
+ daytona
diff --git a/private/oleutest/dll/iclisite.cxx b/private/oleutest/dll/iclisite.cxx
new file mode 100644
index 000000000..f168e1e35
--- /dev/null
+++ b/private/oleutest/dll/iclisite.cxx
@@ -0,0 +1,108 @@
+//+-------------------------------------------------------------
+// File: iclisite.cxx
+//
+// Contents: CObjClientSite object implementation
+//
+// Methods: CObjClientSite
+// ~CObjClientSite
+// Create
+// QueryInterface
+// AddRef
+// Release
+// SaveObject (NYI)
+// GetMoniker (NYI)
+// GetContainer
+// ShowObject (NYI)
+// OnShowWindow
+//
+// History: 04-Dec-92 Created DeanE
+//---------------------------------------------------------------
+#pragma optimize("",off)
+#include <windows.h>
+#include <ole2.h>
+#include <com.hxx>
+#include "oleimpl.hxx"
+
+//+-------------------------------------------------------------------
+// Method: CBasicBnd::SaveObject
+//
+// Synopsis: See spec 2.00.09 p107. This object should be saved.
+//
+// Returns: Should always return S_OK.
+//
+// History: 04-Dec-92 DeanE Created
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBnd::SaveObject(void)
+{
+ // BUGBUG - NYI
+ // Returning S_OK tells OLE that we actually saved this object
+ return(S_OK);
+}
+
+
+//+-------------------------------------------------------------------
+// Method: CBasicBnd::GetContainer
+//
+// Synopsis: See spec 2.00.09 p108. Return the container in which
+// this object is found.
+//
+// Returns: Should return S_OK.
+//
+// History: 04-Dec-92 DeanE Created
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBnd::GetContainer(LPOLECONTAINER FAR *ppContainer)
+{
+ return QueryInterface(IID_IOleContainer, (void **) ppContainer);
+}
+
+
+//+-------------------------------------------------------------------
+// Method: CBasicBnd::ShowObject
+//
+// Synopsis: See spec 2.00.09 p109. Server for this object is asking
+// us to display it. Caller should not assume we have
+// actually worked, but we return S_OK either way. Great!
+//
+// Returns: S_OK whether we work or not...
+//
+// History: 04-Dec-92 DeanE Created
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBnd::ShowObject(void)
+{
+ return(S_OK);
+}
+
+
+//+-------------------------------------------------------------------
+// Method: CBasicBnd::OnShowWindow
+//
+// Synopsis: ???
+//
+// Parameters: [fShow] -
+//
+// Returns: S_OK?
+//
+// History: 16-Dec-92 DeanE Created
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBnd::OnShowWindow(BOOL fShow)
+{
+ return(S_OK);
+}
+
+
+
+//+-------------------------------------------------------------------
+// Method: CBasicBnd::RequestNewObjectLayout
+//
+// Synopsis: ???
+//
+// Parameters: [fShow] -
+//
+// Returns: S_OK?
+//
+// History: 16-Dec-92 DeanE Created
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBnd::RequestNewObjectLayout(void)
+{
+ return(S_OK);
+}
diff --git a/private/oleutest/dll/oleimpl.cxx b/private/oleutest/dll/oleimpl.cxx
new file mode 100644
index 000000000..018e3d402
--- /dev/null
+++ b/private/oleutest/dll/oleimpl.cxx
@@ -0,0 +1,898 @@
+//+-------------------------------------------------------------------
+//
+// File: oleimpl.cxx
+//
+// Contents: This file contins the DLL entry points
+// LibMain
+// DllGetClassObject (Bindings key func)
+// CBasicBndCF (class factory)
+// CBasicBnd (actual class implementation)
+//
+// Classes: CBasicBndCF, CBasicBnd
+//
+//
+// History: 30-Nov-92 SarahJ Created
+// 31-Dec-93 ErikGav Chicago port
+// 30-Jun-94 AndyH Add call to another DLL
+//
+//---------------------------------------------------------------------
+
+// Turn off ole Cairol IUnknown
+#include <windows.h>
+#include <ole2.h>
+#include <debnot.h>
+#include <com.hxx>
+#include "oleimpl.hxx"
+extern "C" {
+#include "..\oledll2\oledll2.h"
+}
+
+ULONG g_UseCount = 0;
+
+CBasicBndCF *g_pcf = NULL;
+
+static const char *szFatalError = "OLEIMPL.DLL - Fatal Error";
+
+void MsgBox(char *pszMsg)
+{
+ MessageBoxA(NULL, pszMsg, szFatalError, MB_OK);
+}
+
+void HrMsgBox(char *pszMsg, HRESULT hr)
+{
+ char awcBuf[512];
+
+ // Build string for output
+ wsprintfA(awcBuf, "%s HRESULT = %lx", pszMsg, hr);
+
+ // Display message box
+ MessageBoxA(NULL, &awcBuf[0], szFatalError, MB_OK);
+}
+
+
+//+-------------------------------------------------------------------
+//
+// Function: LibMain
+//
+// Synopsis: Entry point to DLL - does little else
+// Added call to anther DLL. This is to test loading of in
+// InProcServer that uses another statically linked DLL.
+// The extra DLL (OleDll2.DLL) should not be on the path
+// when the test is run. The entry point FuntionInAnotherDLL
+// is exported by OleDll2.DLL
+//
+// Arguments:
+//
+// Returns: TRUE
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+
+
+//
+// Entry point to DLL is traditional LibMain
+// Call FunctionInAnotherDLL().
+//
+
+
+extern "C" BOOL _cdecl LibMain ( HINSTANCE hinst,
+ HANDLE segDS,
+ UINT cbHeapSize,
+ LPTSTR lpCmdLine)
+{
+ FunctionInAnotherDLL();
+ return TRUE;
+}
+
+
+//+-------------------------------------------------------------------
+//
+// Function: DllGetClassObject
+//
+// Synopsis: Called by client (from within BindToObject et al)
+// interface requested should be IUnknown or IClassFactory -
+// Creates ClassFactory object and returns pointer to it
+//
+// Arguments: REFCLSID clsid - class id
+// REFIID iid - interface id
+// void FAR* FAR* ppv- pointer to class factory interface
+//
+// Returns: TRUE
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+
+STDAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void FAR* FAR* ppv)
+{
+ if (!GuidEqual(iid, IID_IUnknown) && !GuidEqual(iid, IID_IClassFactory))
+ {
+ return E_NOINTERFACE;
+ }
+
+ if (GuidEqual(clsid, CLSID_BasicBnd))
+ {
+ if (g_pcf)
+ {
+ *ppv = g_pcf;
+ g_pcf->AddRef();
+ }
+ else
+ {
+ *ppv = new CBasicBndCF();
+ }
+
+ return (*ppv != NULL) ? S_OK : E_FAIL;
+ }
+
+ return E_FAIL;
+}
+
+
+STDAPI DllCanUnloadNow(void)
+{
+ return (g_UseCount == 0)
+ ? S_OK
+ : S_FALSE;
+}
+
+//+-------------------------------------------------------------------
+//
+// Class: CBasicBndCF
+//
+// Synopsis: Class Factory for CBasicBnd
+//
+// Interfaces: IUnknown - QueryInterface, AddRef, Release
+// IClassFactory - CreateInstance
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBndCF::CBasicBndCF()
+//
+// Synopsis: The constructor for CBAsicBnd.
+//
+// Arguments: None
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+CBasicBndCF::CBasicBndCF() : _cRefs(1)
+{
+ g_UseCount++;
+}
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::~CBasicBndObj()
+//
+// Synopsis: The destructor for CBAsicBnd.
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+CBasicBndCF::~CBasicBndCF()
+{
+ g_UseCount--;
+ return;
+}
+
+
+//+-------------------------------------------------------------------
+//
+// Method: CBasicBndCF::QueryInterface
+//
+// Synopsis: Only IUnknown and IClassFactory supported
+//
+//--------------------------------------------------------------------
+
+
+STDMETHODIMP CBasicBndCF::QueryInterface(REFIID iid, void FAR * FAR * ppv)
+{
+ if (GuidEqual(iid, IID_IUnknown) || GuidEqual(iid, IID_IClassFactory))
+ {
+ *ppv = this;
+ AddRef();
+ return S_OK;
+ }
+ else
+ {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+}
+
+STDMETHODIMP_(ULONG) CBasicBndCF::AddRef(void)
+{
+ return ++_cRefs;
+}
+
+STDMETHODIMP_(ULONG) CBasicBndCF::Release(void)
+{
+ ULONG cRefs = --_cRefs;
+
+ if (cRefs == 0)
+ {
+ delete this;
+ }
+
+ return cRefs;
+}
+
+
+
+//+-------------------------------------------------------------------
+//
+// Method: CBasicBndCF::CreateInstance
+//
+// Synopsis: This is called by Binding process to create the
+// actual class object
+//
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBndCF::CreateInstance(IUnknown FAR* pUnkOuter,
+ REFIID iidInterface,
+ void FAR* FAR* ppv)
+{
+ HRESULT hresult = S_OK;
+
+ class CUnknownBasicBnd *pubb = new FAR CUnknownBasicBnd(pUnkOuter);
+
+ if (pubb == NULL)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ // Because when an aggregate is being requested, the controlling
+ // must be returned, no QI is necessary.
+ if (pUnkOuter == NULL)
+ {
+ hresult = pubb->QueryInterface(iidInterface, ppv);
+
+ pubb->Release();
+ }
+ else
+ {
+ *ppv = (void *) pubb;
+ }
+
+ return hresult;
+}
+
+//+-------------------------------------------------------------------
+//
+// Method: CBasicBndCF::LockServer
+//
+// Synopsis: Who knows what this is for?
+//
+//--------------------------------------------------------------------
+
+STDMETHODIMP CBasicBndCF::LockServer(BOOL fLock)
+{
+ return E_FAIL;
+}
+
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::CBasicBnd()
+//
+// Synopsis: The constructor for CBAsicBnd. I
+//
+// Arguments: None
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+CBasicBnd::CBasicBnd(IUnknown *punk)
+ : _punk(punk), _pmkContainer(NULL)
+{
+ // Create storage for "contained" objects
+ SCODE sc = StgCreateDocfile(NULL,
+ STGM_DELETEONRELEASE|STGM_DFRALL|STGM_CREATE, 0, &_psStg1);
+
+ if (sc != S_OK)
+ {
+ HrMsgBox("CBasicBnd::CBasicBnd Create of first storage failed", sc);
+ }
+
+ sc = StgCreateDocfile(NULL,
+ STGM_DELETEONRELEASE|STGM_DFRALL|STGM_CREATE, 0, &_psStg2);
+
+ if (sc != S_OK)
+ {
+ HrMsgBox("CBasicBnd::CBasicBnd Create of second storage failed", sc);
+ }
+}
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::~CBasicBndObj()
+//
+// Synopsis: The destructor for CBAsicBnd.
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+CBasicBnd::~CBasicBnd()
+{
+ if (_pmkContainer)
+ {
+ _pmkContainer->Release();
+ }
+
+ if (_psStg1)
+ {
+ _psStg1->Release();
+ }
+
+ if (_psStg2)
+ {
+ _psStg2->Release();
+ }
+
+ return;
+}
+
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::QueryInterface
+//
+// Returns: S_OK
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+
+STDMETHODIMP CBasicBnd::QueryInterface(REFIID iid, void **ppiuk)
+{
+ return _punk->QueryInterface(iid, ppiuk);
+}
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::AddRef
+//
+// Synopsis: Standard stuff
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+STDMETHODIMP_(ULONG) CBasicBnd::AddRef(void)
+{
+ return _punk->AddRef();
+}
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::Release
+//
+// Synopsis: Standard stuff
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+STDMETHODIMP_(ULONG) CBasicBnd::Release(void)
+{
+ return _punk->Release();
+}
+
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::Load
+//
+// Synopsis: IPeristFile interface - needed 'cause we bind with
+// file moniker and BindToObject insists on calling this
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBnd::Load(LPCWSTR lpszFileName, DWORD grfMode)
+{
+ if (grfMode & ~(STGM_READWRITE | STGM_SHARE_EXCLUSIVE))
+ {
+ // Test requires default bind storage request and caller
+ // has set some other bits so we fail.
+ return STG_E_INVALIDPARAMETER;
+ }
+
+ return S_OK;
+}
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::Save
+//
+// Synopsis: IPeristFile interface - save
+// does little but here for commentry
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBnd::Save(LPCWSTR lpszFileName, BOOL fRemember)
+{
+ return S_OK;
+}
+
+
+//+-------------------------------------------------------------------
+//
+// Member: CBasicBnd::SaveCpmpleted
+// CBasicBnd::GetCurFile
+// CBasicBnd::IsDirty
+//
+// Synopsis: More IPeristFile interface methods
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+STDMETHODIMP CBasicBnd::SaveCompleted(LPCWSTR lpszFileName)
+{
+ return S_OK;
+}
+
+STDMETHODIMP CBasicBnd::GetCurFile(LPWSTR FAR *lpszFileName)
+{
+ return S_OK;
+}
+
+STDMETHODIMP CBasicBnd::IsDirty()
+{
+ return S_OK;
+}
+
+//+-------------------------------------------------------------------
+//
+// Interface: IPersist
+//
+// Synopsis: IPersist interface methods
+// Need to return a valid class id here
+//
+// History: 21-Nov-92 SarahJ Created
+//
+
+STDMETHODIMP CBasicBnd::GetClassID(LPCLSID classid)
+{
+ *classid = CLSID_BasicBnd;
+ return S_OK;
+}
+
+// *** IOleObject methods ***
+STDMETHODIMP CBasicBnd::SetClientSite(LPOLECLIENTSITE pClientSite)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::GetClientSite(LPOLECLIENTSITE FAR* ppClientSite)
+{
+ return E_FAIL;
+}
+
+
+STDMETHODIMP CBasicBnd::SetHostNames(
+ LPCWSTR szContainerApp,
+ LPCWSTR szContainerObj)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::Close(DWORD dwSaveOption)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::SetMoniker(DWORD dwWhichMoniker, LPMONIKER pmk)
+{
+ if (_pmkContainer)
+ {
+ _pmkContainer->Release();
+
+ }
+
+ _pmkContainer = pmk;
+
+ pmk->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasicBnd::GetMoniker(
+ DWORD dwAssign,
+ DWORD dwWhichMoniker,
+ LPMONIKER FAR* ppmk)
+{
+ if (_pmkContainer != NULL)
+ {
+ *ppmk = _pmkContainer;
+ _pmkContainer->AddRef();
+ return S_OK;
+ }
+
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::InitFromData(
+ LPDATAOBJECT pDataObject,
+ BOOL fCreation,
+ DWORD dwReserved)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::GetClipboardData(
+ DWORD dwReserved,
+ LPDATAOBJECT FAR* ppDataObject)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::DoVerb(
+ LONG iVerb,
+ LPMSG lpmsg,
+ LPOLECLIENTSITE pActiveSite,
+ LONG reserved,
+ HWND hwndParent,
+ LPCRECT lprcPosRect)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::EnumVerbs(IEnumOLEVERB FAR* FAR* ppenumOleVerb)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::Update(void)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::IsUpToDate(void)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::GetUserClassID(CLSID FAR* pClsid)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::GetUserType(DWORD dwFormOfType, LPWSTR FAR* pszUserType)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::SetExtent(DWORD dwDrawAspect, LPSIZEL lpsizel)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::GetExtent(DWORD dwDrawAspect, LPSIZEL lpsizel)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::Advise(
+ IAdviseSink FAR* pAdvSink,
+ DWORD FAR* pdwConnection)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::Unadvise(DWORD dwConnection)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::EnumAdvise(LPENUMSTATDATA FAR* ppenumAdvise)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::GetMiscStatus(DWORD dwAspect, DWORD FAR* pdwStatus)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::SetColorScheme(LPLOGPALETTE lpLogpal)
+{
+ return E_FAIL;
+}
+
+// *** IParseDisplayName method ***
+STDMETHODIMP CBasicBnd::ParseDisplayName(
+ LPBC pbc,
+ LPWSTR lpszDisplayName,
+ ULONG FAR* pchEaten,
+ LPMONIKER FAR* ppmkOut)
+{
+ *pchEaten = wcslen(lpszDisplayName);
+ return CreateItemMoniker(L"\\", lpszDisplayName, ppmkOut);
+}
+
+// *** IOleContainer methods ***
+STDMETHODIMP CBasicBnd::EnumObjects(
+ DWORD grfFlags,
+ LPENUMUNKNOWN FAR* ppenumUnknown)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::LockContainer(BOOL fLock)
+{
+ return E_FAIL;
+}
+
+// *** IOleItemContainer methods ***
+STDMETHODIMP CBasicBnd::GetObject(
+ LPWSTR lpszItem,
+ DWORD dwSpeedNeeded,
+ LPBINDCTX pbc,
+ REFIID riid,
+ LPVOID FAR* ppvObject)
+{
+ IStorage *psStorage;
+ IOleObject *poo;
+ IUnknown *punk;
+
+ if (wcscmp(lpszItem, L"1") == 0)
+ {
+ psStorage = _psStg1;
+ }
+ else if (wcscmp(lpszItem, L"2") == 0)
+ {
+ psStorage = _psStg2;
+ }
+ else
+ {
+ return E_FAIL;
+ }
+
+ IOleClientSite * pocsObjCliSite;
+
+ HRESULT hresult = QueryInterface(IID_IOleClientSite,
+ (void **) &pocsObjCliSite);
+
+ // Call OleCreate to create our embedded object
+ hresult = OleCreate(
+ CLSID_TestEmbed, // Class ID of the object we are
+ // creating
+ IID_IOleObject, // Interface by which we want to talk
+ // to the object
+ OLERENDER_NONE, // We don't want to draw the object
+ // when it is not active
+ NULL, // Used if we do draw the object when
+ // it is non-active
+ pocsObjCliSite, // IOleClientSite the server will use
+ psStorage, // IStorage the server will use
+ (void **) &poo); // Pointer to the object
+
+ if (FAILED(hresult))
+ {
+ HrMsgBox("CBasicBnd::GetObject OlCreate Failed!", hresult);
+ return hresult;
+ }
+
+ // Set the client site
+ hresult = poo->SetClientSite(pocsObjCliSite);
+
+ if (FAILED(hresult))
+ {
+ HrMsgBox("CBasicBnd::GetObject SetClientSite failed!", hresult);
+ return hresult;
+ }
+
+ hresult = poo->QueryInterface(IID_IUnknown, (void **)&punk);
+
+ if (FAILED(hresult))
+ {
+ HrMsgBox("CBasicBnd::GetObject QI to IUnknown failed!", hresult);
+ return hresult;
+ }
+
+ hresult = OleRun(punk);
+
+ if (FAILED(hresult))
+ {
+ HrMsgBox("CBasicBnd::GetObject OleRun failed!", hresult);
+ return hresult;
+ }
+
+ punk->Release();
+
+ LPRECT lprPosRect = (LPRECT) new RECT;
+
+ hresult = poo->DoVerb(
+ OLEIVERB_SHOW, // Verb we are invoking
+ NULL, // MSG that causes us to do this verb
+ pocsObjCliSite, // Client site of this object
+ 0, // Reserved - definitive value?
+ 0, // hwndParent - ???
+ lprPosRect); // lprcPosRect - rectangle wrt hwndParent
+
+ if (FAILED(hresult))
+ {
+ HrMsgBox("CBasicBnd::GetObject DoVerb failed!", hresult);
+ return hresult;
+ }
+
+ delete lprPosRect;
+
+ pocsObjCliSite->Release();
+
+ *ppvObject = (void *) poo;
+
+ return hresult;
+}
+
+STDMETHODIMP CBasicBnd::GetObjectStorage(
+ LPWSTR lpszItem,
+ LPBINDCTX pbc,
+ REFIID riid,
+ LPVOID FAR* ppvStorage)
+{
+ return E_FAIL;
+}
+
+STDMETHODIMP CBasicBnd::IsRunning(LPWSTR lpszItem)
+{
+ return E_FAIL;
+}
+
+CUnknownBasicBnd::CUnknownBasicBnd(IUnknown *punk)
+ : _pbasicbnd(NULL), _cRefs(1)
+{
+ if (punk == NULL)
+ {
+ punk = (IUnknown *) this;
+ }
+
+ // BUGBUG: No error checking!
+ _pbasicbnd = new CBasicBnd(punk);
+ g_UseCount++;
+}
+
+CUnknownBasicBnd::~CUnknownBasicBnd(void)
+{
+ g_UseCount--;
+ delete _pbasicbnd;
+}
+
+
+
+//+-------------------------------------------------------------------
+//
+// Member: CUnknownBasicBnd::QueryInterface
+//
+// Returns: S_OK
+//
+// History: 21-Nov-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+
+STDMETHODIMP CUnknownBasicBnd::QueryInterface(
+ REFIID iid,
+ void **ppiuk)
+{
+ if (GuidEqual(iid, IID_IUnknown))
+ {
+ *ppiuk = (IUnknown *) this;
+ }
+ else if (GuidEqual(iid, IID_IOleClientSite))
+ {
+ *ppiuk = (IOleClientSite *) _pbasicbnd;
+ }
+ else if (GuidEqual(iid, IID_IPersistFile)
+ || GuidEqual(iid, IID_IPersist))
+ {
+ *ppiuk = (IPersistFile *) _pbasicbnd;
+ }
+ else if (GuidEqual(iid, IID_IOleObject))
+ {
+ *ppiuk = (IOleObject *) _pbasicbnd;
+ }
+ else if (GuidEqual(iid, IID_IOleItemContainer))
+ {
+ *ppiuk = (IOleItemContainer *)_pbasicbnd;
+ }
+ else if (GuidEqual(iid, IID_IOleContainer))
+ {
+ *ppiuk = (IOleContainer *)_pbasicbnd;
+ }
+ else if (GuidEqual(iid, IID_IParseDisplayName))
+ {
+ *ppiuk = (IParseDisplayName *)_pbasicbnd;
+ }
+ else
+ {
+ *ppiuk = NULL;
+ return E_NOINTERFACE;
+ }
+
+ _pbasicbnd->AddRef();
+ return S_OK;
+}
+
+
+STDMETHODIMP_(ULONG) CUnknownBasicBnd::AddRef(void)
+{
+ return ++_cRefs;
+}
+
+STDMETHODIMP_(ULONG) CUnknownBasicBnd::Release(void)
+{
+ ULONG cRefs = --_cRefs;
+
+ if (cRefs == 0)
+ {
+ delete this;
+ }
+
+ return cRefs;
+}
+
+
+
+#ifdef CAIROLE_DOWNLEVEL
+
+extern "C"
+{
+ EXPORTDEF void APINOT
+ RegisterWithCommnot(void);
+
+ EXPORTDEF void APINOT
+ DeRegisterWithCommnot(void);
+}
+
+//+-------------------------------------------------------------------
+//
+// Function: RegisterWithCommnot
+//
+// Synopsis: Used by Cairo to work around DLL unloading problems
+//
+// Arguments: <none>
+//
+// History: 06-Oct-92 BryanT Created
+//
+//--------------------------------------------------------------------
+EXPORTIMP void APINOT
+RegisterWithCommnot( void )
+{
+}
+
+//+-------------------------------------------------------------------
+//
+// Function: DeRegisterWithCommnot
+//
+// Synopsis: Used by Cairo to work around DLL unloading problems
+//
+// Arguments: <none>
+//
+// History: 06-Oct-92 BryanT Created
+//
+// Notes: BUGBUG: Keep in touch with BryanT to see if this is
+// obsolete.
+//
+//--------------------------------------------------------------------
+
+EXPORTIMP void APINOT
+DeRegisterWithCommnot( void )
+{
+}
+
+#endif
diff --git a/private/oleutest/dll/oleimpl.hxx b/private/oleutest/dll/oleimpl.hxx
new file mode 100644
index 000000000..f472c4273
--- /dev/null
+++ b/private/oleutest/dll/oleimpl.hxx
@@ -0,0 +1,242 @@
+//+-------------------------------------------------------------------
+//
+// File: oleimpl.hxx
+//
+// Contents: This file contins the DLL entry points
+// LibMain
+// DllGetClassObject (Bindings key func)
+// DllCanUnloadNow
+// CBasicBndCF (class factory)
+// History: 30-Mar-92 SarahJ Created
+// 31-Dec-93 ErikGav Chicago port
+//
+//---------------------------------------------------------------------
+
+#ifndef __OLEIMPL_H__
+#define __OLEIMPL_H__
+
+
+#define STGM_DFRALL (STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_DENY_WRITE)
+
+//+---------------------------------------------------------------------------
+//
+// Function: operator new, public
+//
+// Synopsis: Global operator new which does not throw exceptions.
+//
+// Arguments: [size] -- Size of the memory to allocate.
+//
+// Returns: A pointer to the allocated memory. Is *NOT* initialized to 0!
+//
+// Notes: We override new to make delete easier.
+//
+//----------------------------------------------------------------------------
+
+inline void* _CRTAPI1
+operator new (size_t size)
+{
+ return(CoTaskMemAlloc(size));
+}
+
+//+-------------------------------------------------------------------------
+//
+// Function: ::operator delete
+//
+// Synopsis: Free a block of memory
+//
+// Arguments: [lpv] - block to free.
+//
+//--------------------------------------------------------------------------
+
+inline void _CRTAPI1 operator delete(void FAR* lpv)
+{
+ CoTaskMemFree(lpv);
+}
+
+
+//
+// Define the interface we are going to use here - avoiding MIDL stuff
+//
+
+//+-------------------------------------------------------------------
+//
+// Class: CBasicBndCF
+//
+// Synopsis: Class Factory for CBasicBnd
+//
+// Methods: IUnknown - QueryInterface, AddRef, Release
+// IClassFactory - CreateInstance
+//
+// History: 21-Mar-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+
+class FAR CBasicBndCF: public IClassFactory
+{
+public:
+
+ // Constructor/Destructor
+ CBasicBndCF();
+ ~CBasicBndCF();
+
+ // IUnknown
+ STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+
+
+ // IClassFactory
+ STDMETHODIMP CreateInstance(IUnknown FAR* pUnkOuter,
+ REFIID iidInterface,
+ void FAR* FAR* ppv);
+
+ STDMETHODIMP LockServer(BOOL fLock);
+
+ BOOL ReleaseClass(void);
+
+private:
+
+ ULONG _cRefs;
+};
+
+
+
+//+-------------------------------------------------------------------
+//
+// Class: CBasicBnd
+//
+// Synopsis: Test class CBasicBnd
+//
+// Methods:
+//
+// History: 21-Mar-92 SarahJ Created
+//
+//--------------------------------------------------------------------
+
+
+class FAR CBasicBnd: public IPersistFile, public IOleClientSite,
+ public IOleObject, public IOleItemContainer
+{
+public:
+// Constructor/Destructor
+ CBasicBnd(IUnknown *punk);
+ ~CBasicBnd();
+
+// IUnknown
+ STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+
+// IPersist - needed 'cause IPersistFile inherits from this
+ STDMETHODIMP GetClassID(LPCLSID lpClassID);
+
+
+// IPersitFile
+ STDMETHODIMP IsDirty();
+ STDMETHODIMP Load(LPCWSTR lpszFileName, DWORD grfMode);
+ STDMETHODIMP Save(LPCWSTR lpszFileName, BOOL fRemember);
+ STDMETHODIMP SaveCompleted(LPCWSTR lpszFileName);
+ STDMETHODIMP GetCurFile(LPWSTR FAR * lplpszFileName);
+
+ // *** IOleObject methods ***
+ STDMETHODIMP SetClientSite( LPOLECLIENTSITE pClientSite);
+ STDMETHODIMP GetClientSite( LPOLECLIENTSITE FAR* ppClientSite);
+ STDMETHODIMP SetHostNames( LPCWSTR szContainerApp, LPCWSTR szContainerObj);
+ STDMETHODIMP Close(DWORD dwSaveOption);
+ STDMETHODIMP SetMoniker( DWORD dwWhichMoniker, LPMONIKER pmk);
+ STDMETHODIMP GetMoniker( DWORD dwAssign, DWORD dwWhichMoniker,
+ LPMONIKER FAR* ppmk);
+ STDMETHODIMP InitFromData( LPDATAOBJECT pDataObject,
+ BOOL fCreation,
+ DWORD dwReserved);
+ STDMETHODIMP GetClipboardData( DWORD dwReserved,
+ LPDATAOBJECT FAR* ppDataObject);
+ STDMETHODIMP DoVerb( LONG iVerb,
+ LPMSG lpmsg,
+ LPOLECLIENTSITE pActiveSite,
+ LONG lindex,
+ HWND hwndParent,
+ LPCRECT lprcPosRect);
+ STDMETHODIMP EnumVerbs(LPENUMOLEVERB FAR* ppenumOleVerb);
+ STDMETHODIMP Update(void);
+ STDMETHODIMP IsUpToDate(void);
+ STDMETHODIMP GetUserClassID(CLSID FAR *pClsid);
+ STDMETHODIMP GetUserType(DWORD dwFormOfType, LPWSTR FAR* pszUserType);
+ STDMETHODIMP SetExtent( DWORD dwDrawAspect, LPSIZEL lpsizel);
+ STDMETHODIMP GetExtent( DWORD dwDrawAspect, LPSIZEL lpsizel);
+
+ STDMETHODIMP Advise( LPADVISESINK pAdvSink, DWORD FAR* pdwConnection);
+ STDMETHODIMP Unadvise( DWORD dwConnection);
+ STDMETHODIMP EnumAdvise( LPENUMSTATDATA FAR* ppenumAdvise);
+ STDMETHODIMP GetMiscStatus(DWORD dwAspect, DWORD FAR* pdwStatus);
+ STDMETHODIMP SetColorScheme( LPLOGPALETTE lpLogpal);
+
+ // *** IParseDisplayName method ***
+ STDMETHODIMP ParseDisplayName(
+ LPBC pbc,
+ LPWSTR lpszDisplayName,
+ ULONG FAR* pchEaten,
+ LPMONIKER FAR* ppmkOut) ;
+
+ // *** IOleContainer methods ***
+ STDMETHODIMP EnumObjects(DWORD grfFlags, LPENUMUNKNOWN FAR* ppenumUnknown);
+ STDMETHODIMP LockContainer(BOOL fLock);
+
+ // *** IOleItemContainer methods ***
+ STDMETHODIMP GetObject(
+ LPWSTR lpszItem,
+ DWORD dwSpeedNeeded,
+ LPBINDCTX pbc,
+ REFIID riid,
+ LPVOID FAR* ppvObject);
+
+ STDMETHODIMP GetObjectStorage(
+ LPWSTR lpszItem,
+ LPBINDCTX pbc,
+ REFIID riid,
+ LPVOID FAR* ppvStorage);
+
+ STDMETHODIMP IsRunning(LPWSTR lpszItem) ;
+
+ // IOleClientSite
+ STDMETHODIMP SaveObject (void);
+ STDMETHODIMP GetContainer (LPOLECONTAINER FAR *ppContainer);
+ STDMETHODIMP ShowObject (void);
+ STDMETHODIMP OnShowWindow (BOOL fShow);
+ STDMETHODIMP RequestNewObjectLayout (void);
+
+private:
+
+ IUnknown * _punk;
+
+ IMoniker * _pmkContainer;
+
+ IStorage * _psStg1;
+
+ IStorage * _psStg2;
+};
+
+
+class CUnknownBasicBnd : public IUnknown
+{
+public:
+
+ CUnknownBasicBnd(IUnknown *punk);
+
+ ~CUnknownBasicBnd(void);
+
+ // IUnknown
+ STDMETHODIMP QueryInterface(REFIID iid, void FAR * FAR * ppv);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+
+private:
+
+ CBasicBnd * _pbasicbnd;
+
+ ULONG _cRefs;
+};
+
+
+#endif