From 6f488fa0d470bc0f3e6f0f581ad7fb8003c95b41 Mon Sep 17 00:00:00 2001 From: Louis Lenders Date: Sun, 5 Jul 2009 22:16:38 +0200 Subject: wbemprox: add stub wbemlocator interface --- dlls/wbemprox/Makefile.in | 3 +- dlls/wbemprox/main.c | 3 + dlls/wbemprox/wbemlocator.c | 131 +++++++++++++++++++++++++++++++++++++ dlls/wbemprox/wbemprox_internal.h | 27 ++++++++ 4 files changed, 163 insertions(+), 1 deletions(-) create mode 100644 dlls/wbemprox/wbemlocator.c create mode 100644 dlls/wbemprox/wbemprox_internal.h diff --git a/dlls/wbemprox/Makefile.in b/dlls/wbemprox/Makefile.in index 00b9f37..7951677 100644 --- a/dlls/wbemprox/Makefile.in +++ b/dlls/wbemprox/Makefile.in @@ -7,7 +7,8 @@ IMPORTS = uuid ole32 advapi32 user32 kernel32 C_SRCS = \ main.c \ - regsvr.c + regsvr.c \ + wbemlocator.c @MAKE_DLL_RULES@ diff --git a/dlls/wbemprox/main.c b/dlls/wbemprox/main.c index a5a0cc3..96ee242 100644 --- a/dlls/wbemprox/main.c +++ b/dlls/wbemprox/main.c @@ -29,7 +29,9 @@ #include "winreg.h" #include "shlwapi.h" #include "shlguid.h" +#include "wbemcli.h" +#include "wbemprox_internal.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); @@ -44,6 +46,7 @@ static const struct { REFCLSID clsid; LPFNCONSTRUCTOR ctor; } ClassesTable[] = { + {&CLSID_WbemLocator, WbemLocator_Constructor}, {NULL, NULL} }; diff --git a/dlls/wbemprox/wbemlocator.c b/dlls/wbemprox/wbemlocator.c new file mode 100644 index 0000000..8d76d30 --- /dev/null +++ b/dlls/wbemprox/wbemlocator.c @@ -0,0 +1,131 @@ +/* + * Copyright 2009 Louis Lenders + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include + +#define COBJMACROS + +#include "wine/debug.h" +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winuser.h" +#include "shlwapi.h" +#include "winerror.h" +#include "objbase.h" +#include "wbemcli.h" + +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +typedef struct { + const IWbemLocatorVtbl *WbemLocatorVtbl; + LONG refCount; +} wbemlocator; + +static void wbemlocator_Destructor(wbemlocator *This) +{ + TRACE("destroying %p\n", This); + HeapFree(GetProcessHeap(),0,This); +} + +static HRESULT WINAPI wbemlocator_QueryInterface(IWbemLocator *iface, REFIID iid, LPVOID *ppvOut) +{ + wbemlocator *This = (wbemlocator *)iface; + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IWbemLocator)) + { + *ppvOut = This; + } + + if (*ppvOut) + { + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI wbemlocator_AddRef(IWbemLocator *iface) +{ + wbemlocator *This = (wbemlocator *)iface; + return InterlockedIncrement(&This->refCount); +} + +static ULONG WINAPI wbemlocator_Release(IWbemLocator *iface) +{ + wbemlocator *This = (wbemlocator *)iface; + ULONG ret; + + ret = InterlockedDecrement(&This->refCount); + if (ret == 0) + wbemlocator_Destructor(This); + return ret; +} + +/***************************************************** + * Wbemlocator methods + *****************************************************/ +static HRESULT WINAPI wbemlocator_ConnectServer( + IWbemLocator* iface, + const BSTR NetworkResource, + const BSTR User, + const BSTR Password, + const BSTR Locale, + LONG SecurityFlags, + const BSTR Authority, + IWbemContext *pCtx, + IWbemServices **ppNamespace) +{ + FIXME("(%p)->(%s %s %s %s %d %s %p %p) stub\n", iface, debugstr_w(NetworkResource), debugstr_w(User), + debugstr_w(Password), debugstr_w(Locale), SecurityFlags, debugstr_w(Authority), pCtx, ppNamespace); + return E_NOTIMPL; +} + +static const IWbemLocatorVtbl WbemLocator_WbemLocatorVtbl = +{ + wbemlocator_QueryInterface, + wbemlocator_AddRef, + wbemlocator_Release, + + wbemlocator_ConnectServer, +}; + +HRESULT WbemLocator_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) +{ + wbemlocator *This; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(wbemlocator)); + if (This == NULL) + return E_OUTOFMEMORY; + + This->WbemLocatorVtbl= &WbemLocator_WbemLocatorVtbl; + This->refCount = 1; + + TRACE("returning %p\n", This); + *ppOut = (IUnknown *)This; + return S_OK; +} diff --git a/dlls/wbemprox/wbemprox_internal.h b/dlls/wbemprox/wbemprox_internal.h new file mode 100644 index 0000000..835be38 --- /dev/null +++ b/dlls/wbemprox/wbemprox_internal.h @@ -0,0 +1,27 @@ +/* ++ * Internal header for wbemprox.dll ++ * ++ * Copyright 2009 Louis Lenders ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ + +#ifndef __WINE_WBEMPROX_I_H +#define __WINE_WBEMPROX_I_H + +extern HRESULT WbemLocator_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); + +#endif /* __WINE_WBEMPROX_I_H */ + -- 1.6.0.4