[6/6] xolehlp: implement IResourceManager

Daniel Jeliński djelinski1 at gmail.com
Wed May 1 16:21:31 CDT 2013


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20130501/80ba41fb/attachment.html>
-------------- next part --------------
From 612a250875867244726bc41f1a37519e1cc42a7c Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Wed, 1 May 2013 22:11:06 +0200
Subject: xolehlp: implement IResourceManager

---
 dlls/xolehlp/xolehlp.c |  124 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 121 insertions(+), 3 deletions(-)

diff --git a/dlls/xolehlp/xolehlp.c b/dlls/xolehlp/xolehlp.c
index a264ca6..c690e2a 100644
--- a/dlls/xolehlp/xolehlp.c
+++ b/dlls/xolehlp/xolehlp.c
@@ -28,6 +28,124 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(xolehlp);
 
+/* Resource manager start */
+
+typedef struct {
+    IResourceManager IResourceManager_iface;
+    LONG ref;
+} ResourceManager;
+
+static inline ResourceManager *impl_from_IResourceManager(IResourceManager *iface)
+{
+    return CONTAINING_RECORD(iface, ResourceManager, IResourceManager_iface);
+}
+
+static HRESULT WINAPI ResourceManager_QueryInterface(IResourceManager *iface, REFIID iid,
+    void **ppv)
+{
+    ResourceManager *This = impl_from_IResourceManager(iface);
+    TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
+
+    if (!ppv) return E_INVALIDARG;
+
+    if (IsEqualIID(&IID_IUnknown, iid) ||
+        IsEqualIID(&IID_IResourceManager, iid))
+    {
+        *ppv = &This->IResourceManager_iface;
+    }
+    else
+    {
+        FIXME("(%s): not implemented\n", debugstr_guid(iid));
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static ULONG WINAPI ResourceManager_AddRef(IResourceManager *iface)
+{
+    ResourceManager *This = impl_from_IResourceManager(iface);
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) refcount=%u\n", iface, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI ResourceManager_Release(IResourceManager *iface)
+{
+    ResourceManager *This = impl_from_IResourceManager(iface);
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) refcount=%u\n", iface, ref);
+
+    if (ref == 0)
+    {
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+static HRESULT WINAPI ResourceManager_Enlist(IResourceManager *iface,
+	ITransaction *pTransaction,ITransactionResourceAsync *pRes,XACTUOW *pUOW,
+	LONG *pisoLevel,ITransactionEnlistmentAsync **ppEnlist)
+{
+    FIXME("(%p, %p, %p, %p, %p, %p): stub\n", iface, pTransaction,pRes,pUOW,
+	pisoLevel,ppEnlist);
+    return E_NOTIMPL;
+}
+static HRESULT WINAPI ResourceManager_Reenlist(IResourceManager *iface,
+	byte *pPrepInfo,ULONG cbPrepInfo,DWORD lTimeout,XACTSTAT *pXactStat)
+{
+    FIXME("(%p, %p, %u, %u, %p): stub\n", iface, pPrepInfo, cbPrepInfo, lTimeout, pXactStat);
+    return E_NOTIMPL;
+}
+static HRESULT WINAPI ResourceManager_ReenlistmentComplete(IResourceManager *iface)
+{
+    FIXME("(%p): stub\n", iface);
+    return E_NOTIMPL;
+}
+static HRESULT WINAPI ResourceManager_GetDistributedTransactionManager(IResourceManager *iface,
+	REFIID iid,void **ppvObject)
+{
+    FIXME("(%p, %s, %p): stub\n", iface, debugstr_guid(iid), ppvObject);
+    return E_NOTIMPL;
+}
+
+static const IResourceManagerVtbl ResourceManager_Vtbl = {
+    ResourceManager_QueryInterface,
+    ResourceManager_AddRef,
+    ResourceManager_Release,
+    ResourceManager_Enlist,
+    ResourceManager_Reenlist,
+    ResourceManager_ReenlistmentComplete,
+    ResourceManager_GetDistributedTransactionManager
+};
+
+static HRESULT ResourceManager_Create(IResourceManager **ppv)
+{
+    ResourceManager *This;
+
+    if (!ppv) return E_INVALIDARG;
+
+    This = HeapAlloc(GetProcessHeap(), 0, sizeof(ResourceManager));
+    if (!This) return E_OUTOFMEMORY;
+
+    This->IResourceManager_iface.lpVtbl = &ResourceManager_Vtbl;
+    This->ref = 1;
+
+    *ppv = &This->IResourceManager_iface;
+
+    return S_OK;
+}
+
+/* Resource manager end */
+
+
+/* DTC Proxy Core Object start */
+
 typedef struct {
     ITransactionDispenser ITransactionDispenser_iface;
     LONG ref;
@@ -154,10 +272,9 @@ static ULONG WINAPI ResourceManagerFactory_Release(IResourceManagerFactory *ifac
 static HRESULT WINAPI ResourceManagerFactory_Create(IResourceManagerFactory *iface,
 	GUID *pguidRM, CHAR *pszRMName, IResourceManagerSink *pIResMgrSink, IResourceManager **ppResMgr)
 {
-    FIXME("(%p, %s, %s, %p, %p): stub\n", iface, debugstr_guid(pguidRM),
+    FIXME("(%p, %s, %s, %p, %p): semi-stub\n", iface, debugstr_guid(pguidRM),
         debugstr_a(pszRMName), pIResMgrSink, ppResMgr);
-
-    return E_NOTIMPL;
+    return ResourceManager_Create(ppResMgr);
 }
 static const IResourceManagerFactoryVtbl ResourceManagerFactory_Vtbl = {
     ResourceManagerFactory_QueryInterface,
@@ -229,6 +346,7 @@ static HRESULT TransactionManager_Create(REFIID riid, void **ppv)
 
     return ret;
 }
+/* DTC Proxy Core Object end */
 
 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
 {
-- 
1.7.5.4


More information about the wine-patches mailing list