mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 09:15:11 +00:00
dllhost: Add ISurrogate stub implementation.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
36ac0c1cfb
commit
6b7686946b
|
@ -1,5 +1,5 @@
|
||||||
MODULE = dllhost.exe
|
MODULE = dllhost.exe
|
||||||
IMPORTS = ole32
|
IMPORTS = ole32 uuid
|
||||||
|
|
||||||
EXTRADLLFLAGS = -mwindows -municode
|
EXTRADLLFLAGS = -mwindows -municode
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
|
@ -26,24 +28,104 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dllhost);
|
WINE_DEFAULT_DEBUG_CHANNEL(dllhost);
|
||||||
|
|
||||||
|
struct surrogate
|
||||||
|
{
|
||||||
|
ISurrogate ISurrogate_iface;
|
||||||
|
LONG ref;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline struct surrogate *impl_from_ISurrogate(ISurrogate *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, struct surrogate, ISurrogate_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI surrogate_QueryInterface(ISurrogate *iface,
|
||||||
|
REFIID iid, void **ppv)
|
||||||
|
{
|
||||||
|
struct surrogate *surrogate = impl_from_ISurrogate(iface);
|
||||||
|
|
||||||
|
TRACE("(%p,%s,%p)\n", iface, wine_dbgstr_guid(iid), ppv);
|
||||||
|
|
||||||
|
if (!ppv) return E_INVALIDARG;
|
||||||
|
|
||||||
|
if (IsEqualIID(iid, &IID_IUnknown) ||
|
||||||
|
IsEqualIID(iid, &IID_ISurrogate))
|
||||||
|
{
|
||||||
|
ISurrogate_AddRef(&surrogate->ISurrogate_iface);
|
||||||
|
*ppv = &surrogate->ISurrogate_iface;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppv = NULL;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI surrogate_AddRef(ISurrogate *iface)
|
||||||
|
{
|
||||||
|
TRACE("(%p)\n", iface);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI surrogate_Release(ISurrogate *iface)
|
||||||
|
{
|
||||||
|
TRACE("(%p)\n", iface);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI surrogate_LoadDllServer(ISurrogate *iface, const CLSID *clsid)
|
||||||
|
{
|
||||||
|
FIXME("(%p,%s): stub\n", iface, wine_dbgstr_guid(clsid));
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI surrogate_FreeSurrogate(ISurrogate *iface)
|
||||||
|
{
|
||||||
|
FIXME("(%p): stub\n", iface);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const ISurrogateVtbl Surrogate_Vtbl =
|
||||||
|
{
|
||||||
|
surrogate_QueryInterface,
|
||||||
|
surrogate_AddRef,
|
||||||
|
surrogate_Release,
|
||||||
|
surrogate_LoadDllServer,
|
||||||
|
surrogate_FreeSurrogate
|
||||||
|
};
|
||||||
|
|
||||||
int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int showcmd)
|
int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE previnst, LPWSTR cmdline, int showcmd)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
|
struct surrogate surrogate;
|
||||||
|
|
||||||
if (wcsnicmp(cmdline, L"/PROCESSID:", 11))
|
if (wcsnicmp(cmdline, L"/PROCESSID:", 11))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cmdline += 11;
|
cmdline += 11;
|
||||||
|
|
||||||
|
surrogate.ISurrogate_iface.lpVtbl = &Surrogate_Vtbl;
|
||||||
|
surrogate.ref = 1;
|
||||||
|
|
||||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||||
|
|
||||||
hr = CLSIDFromString(cmdline, &clsid);
|
hr = CLSIDFromString(cmdline, &clsid);
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
{
|
{
|
||||||
FIXME("hosting object %s is not implemented\n", wine_dbgstr_guid(&clsid));
|
CoRegisterSurrogate(&surrogate.ISurrogate_iface);
|
||||||
|
|
||||||
|
hr = ISurrogate_LoadDllServer(&surrogate.ISurrogate_iface, &clsid);
|
||||||
|
if (hr != S_OK)
|
||||||
|
{
|
||||||
|
ERR("Can't create instance of %s\n", wine_dbgstr_guid(&clsid));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: wait for FreeSurrogate being called */
|
||||||
|
Sleep(INFINITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue