Wine-20041201 vendor drop
Added: vendor/wine/dlls/rpcrt4/
Added: vendor/wine/dlls/rpcrt4/current/
Added: vendor/wine/dlls/rpcrt4/current/Makefile.in
Added: vendor/wine/dlls/rpcrt4/current/cproxy.c
Added: vendor/wine/dlls/rpcrt4/current/cpsf.c
Added: vendor/wine/dlls/rpcrt4/current/cpsf.h
Added: vendor/wine/dlls/rpcrt4/current/cstub.c
Added: vendor/wine/dlls/rpcrt4/current/ndr_marshall.c
Added: vendor/wine/dlls/rpcrt4/current/ndr_midl.c
Added: vendor/wine/dlls/rpcrt4/current/ndr_misc.h
Added: vendor/wine/dlls/rpcrt4/current/ndr_ole.c
Added: vendor/wine/dlls/rpcrt4/current/ndr_stubless.c
Added: vendor/wine/dlls/rpcrt4/current/rpc_binding.c
Added: vendor/wine/dlls/rpcrt4/current/rpc_binding.h
Added: vendor/wine/dlls/rpcrt4/current/rpc_defs.h
Added: vendor/wine/dlls/rpcrt4/current/rpc_epmap.c
Added: vendor/wine/dlls/rpcrt4/current/rpc_message.c
Added: vendor/wine/dlls/rpcrt4/current/rpc_message.h
Added: vendor/wine/dlls/rpcrt4/current/rpc_misc.h
Added: vendor/wine/dlls/rpcrt4/current/rpc_server.c
Added: vendor/wine/dlls/rpcrt4/current/rpc_server.h
Added: vendor/wine/dlls/rpcrt4/current/rpcrt4.spec
Added: vendor/wine/dlls/rpcrt4/current/rpcrt4_main.c
Added: vendor/wine/dlls/rpcrt4/current/rpcss_np_client.c
Added: vendor/wine/dlls/rpcrt4/current/rpcss_np_client.h

Added: vendor/wine/dlls/rpcrt4/current/Makefile.in
--- vendor/wine/dlls/rpcrt4/current/Makefile.in	2004-12-31 15:44:47 UTC (rev 12591)
+++ vendor/wine/dlls/rpcrt4/current/Makefile.in	2004-12-31 15:47:31 UTC (rev 12592)
@@ -0,0 +1,29 @@
+EXTRADEFS = -D_RPCRT4_ -DCOM_NO_WINDOWS_H -DMSWMSG
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = rpcrt4.dll
+IMPORTS   = iphlpapi advapi32 kernel32 ntdll
+EXTRALIBS = -luuid
+
+C_SRCS = \
+	cproxy.c \
+	cpsf.c \
+	cstub.c \
+	ndr_marshall.c \
+	ndr_midl.c \
+	ndr_ole.c \
+	ndr_stubless.c \
+	rpc_binding.c \
+	rpc_epmap.c \
+	rpc_message.c \
+	rpc_server.c \
+	rpcrt4_main.c \
+	rpcss_np_client.c
+
+SUBDIRS = tests
+
+@MAKE_DLL_RULES@
+
+### Dependencies:

Added: vendor/wine/dlls/rpcrt4/current/cproxy.c
--- vendor/wine/dlls/rpcrt4/current/cproxy.c	2004-12-31 15:44:47 UTC (rev 12591)
+++ vendor/wine/dlls/rpcrt4/current/cproxy.c	2004-12-31 15:47:31 UTC (rev 12592)
@@ -0,0 +1,342 @@
+/*
+ * COM proxy implementation
+ *
+ * Copyright 2001 Ove Kåven, TransGaming Technologies
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * 
+ * TODO: Handle non-i386 architectures
+ *       Get rid of #if 0'ed code.
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+
+#include "objbase.h"
+#include "rpcproxy.h"
+
+#include "cpsf.h"
+#include "ndr_misc.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ole);
+
+struct StublessThunk;
+
+/* I don't know what MS's std proxy structure looks like,
+   so this probably doesn't match, but that shouldn't matter */
+typedef struct {
+  IRpcProxyBufferVtbl *lpVtbl;
+  LPVOID *PVtbl;
+  DWORD RefCount;
+  const MIDL_STUBLESS_PROXY_INFO *stubless;
+  const IID* piid;
+  LPUNKNOWN pUnkOuter;
+  PCInterfaceName name;
+  LPPSFACTORYBUFFER pPSFactory;
+  LPRPCCHANNELBUFFER pChannel;
+  struct StublessThunk *thunks;
+} StdProxyImpl;
+
+static IRpcProxyBufferVtbl StdProxy_Vtbl;
+
+#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
+
+/* How the Windows stubless proxy thunks work is explained at
+ * http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp,
+ * but I'll use a slightly different method, to make life easier */
+
+#if defined(__i386__)
+
+#include "pshpack1.h"
+
+struct StublessThunk {
+  BYTE push;
+  DWORD index;
+  BYTE call;
+  LONG handler;
+  BYTE ret;
+  WORD bytes;
+  BYTE pad[3];
+};
+
+#include "poppack.h"
+
+/* adjust the stack size since we don't use Windows's method */
+#define STACK_ADJUST sizeof(DWORD)
+
+#define FILL_STUBLESS(x,idx,stk) \
+ x->push = 0x68; /* pushl [immediate] */ \
+ x->index = (idx); \
+ x->call = 0xe8; /* call [near] */ \
+ x->handler = (char*)ObjectStubless - (char*)&x->ret; \
+ x->ret = 0xc2; /* ret [immediate] */ \
+ x->bytes = stk; \
+ x->pad[0] = 0x8d; /* leal (%esi),%esi */ \
+ x->pad[1] = 0x76; \
+ x->pad[2] = 0x00;
+
+static HRESULT WINAPI ObjectStubless(DWORD index)
+{
+  char *args = (char*)(&index + 2);
+  LPVOID iface = *(LPVOID*)args;
+
+  ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
+
+  PFORMAT_STRING fs = This->stubless->ProcFormatString + This->stubless->FormatStringOffset[index];
+  unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
+  TRACE("(%p)->(%ld)([%d bytes]) ret=%08lx\n", iface, index, bytes, *(DWORD*)(args+bytes));
+
+  return RPCRT4_NdrClientCall2(This->stubless->pStubDesc, fs, args);
+}
+
+#else  /* __i386__ */
+
+/* can't do that on this arch */
+struct StublessThunk { int dummy; };
+#define FILL_STUBLESS(x,idx,stk) \
+ ERR("stubless proxies are not supported on this architecture\n");
+#define STACK_ADJUST 0
+
+#endif  /* __i386__ */
+
+HRESULT WINAPI StdProxy_Construct(REFIID riid,
+                                 LPUNKNOWN pUnkOuter,
+                                 PCInterfaceName name,
+                                 CInterfaceProxyVtbl *vtbl,
+                                 CInterfaceStubVtbl *svtbl,
+                                 LPPSFACTORYBUFFER pPSFactory,
+                                 LPRPCPROXYBUFFER *ppProxy,
+                                 LPVOID *ppvObj)
+{
+  StdProxyImpl *This;
+  const MIDL_STUBLESS_PROXY_INFO *stubless = NULL;
+
+  TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
+
+  /* I can't find any other way to detect stubless proxies than this hack */
+  if (!IsEqualGUID(vtbl->header.piid, riid)) {
+    stubless = *(const void **)vtbl;
+    vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
+    TRACE("stubless=%p\n", stubless);
+  }
+
+  TRACE("iid=%s\n", debugstr_guid(vtbl->header.piid));
+  TRACE("vtbl=%p\n", vtbl->Vtbl);
+
+  if (!IsEqualGUID(vtbl->header.piid, riid)) {
+    ERR("IID mismatch during proxy creation\n");
+    return RPC_E_UNEXPECTED;
+  }
+
+  This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(StdProxyImpl));
+  if (!This) return E_OUTOFMEMORY;
+
+  if (stubless) {
+    unsigned i, count = svtbl->header.DispatchTableCount;
+    /* Maybe the original vtbl is just modified directly to point at
+     * ObjectStublessClientXXX thunks in real Windows, but I don't like it
+     */
+    TRACE("stubless thunks: count=%d\n", count);
+    This->thunks = HeapAlloc(GetProcessHeap(),0,sizeof(struct StublessThunk)*count);
+    This->PVtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPVOID)*count);
+    for (i=0; i<count; i++) {
+      struct StublessThunk *thunk = &This->thunks[i];
+      if (vtbl->Vtbl[i] == (LPVOID)-1) {
+        PFORMAT_STRING fs = stubless->ProcFormatString + stubless->FormatStringOffset[i];
+        unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
+        TRACE("method %d: stacksize=%d\n", i, bytes);
+        FILL_STUBLESS(thunk, i, bytes)
+        This->PVtbl[i] = thunk;
+      }
+      else {
+        memset(thunk, 0, sizeof(struct StublessThunk));
+        This->PVtbl[i] = vtbl->Vtbl[i];
+      }
+    }
+  }
+  else 
+    This->PVtbl = vtbl->Vtbl;
+
+  This->lpVtbl = &StdProxy_Vtbl;
+  /* 1 reference for the proxy and 1 for the object */
+  This->RefCount = 2;
+  This->stubless = stubless;
+  This->piid = vtbl->header.piid;
+  This->pUnkOuter = pUnkOuter;
+  This->name = name;
+  This->pPSFactory = pPSFactory;
+  This->pChannel = NULL;
+  *ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl;
+  *ppvObj = &This->PVtbl;
+  IPSFactoryBuffer_AddRef(pPSFactory);
+
+  return S_OK;
+}
+
+static void WINAPI StdProxy_Destruct(LPRPCPROXYBUFFER iface)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
+
+  if (This->pChannel)
+    IRpcProxyBuffer_Disconnect(iface);
+
+  IPSFactoryBuffer_Release(This->pPSFactory);
+  if (This->thunks) {
+    HeapFree(GetProcessHeap(),0,This->PVtbl);
+    HeapFree(GetProcessHeap(),0,This->thunks);
+  }
+  HeapFree(GetProcessHeap(),0,This);
+}
+
+static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface,
+                                             REFIID riid,
+                                             LPVOID *obj)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
+  TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
+
+  if (IsEqualGUID(&IID_IUnknown,riid) ||
+      IsEqualGUID(This->piid,riid)) {
+    *obj = &This->PVtbl;
+    This->RefCount++;
+    return S_OK;
+  }
+
+  if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) {
+    *obj = &This->lpVtbl;
+    This->RefCount++;
+    return S_OK;
+  }
+
+  return E_NOINTERFACE;
+}
+
+static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
+  TRACE("(%p)->AddRef()\n",This);
+
+  return ++(This->RefCount);
+}
+
+static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
+  TRACE("(%p)->Release()\n",This);
+
+  if (!--(This->RefCount)) {
+    StdProxy_Destruct((LPRPCPROXYBUFFER)&This->lpVtbl);
+    return 0;
+  }
+  return This->RefCount;
+}
+
+static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface,
+                                      LPRPCCHANNELBUFFER pChannel)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
+  TRACE("(%p)->Connect(%p)\n",This,pChannel);
+
+  This->pChannel = pChannel;
+  IRpcChannelBuffer_AddRef(pChannel);
+  return S_OK;
+}
+
+static VOID WINAPI StdProxy_Disconnect(LPRPCPROXYBUFFER iface)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
+  TRACE("(%p)->Disconnect()\n",This);
+
+  IRpcChannelBuffer_Release(This->pChannel);
+  This->pChannel = NULL;
+}
+
+static IRpcProxyBufferVtbl StdProxy_Vtbl =
+{
+  StdProxy_QueryInterface,
+  StdProxy_AddRef,
+  StdProxy_Release,
+  StdProxy_Connect,
+  StdProxy_Disconnect
+};
+
+HRESULT WINAPI StdProxy_GetChannel(LPVOID iface,
+                                  LPRPCCHANNELBUFFER *ppChannel)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
+  TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
+
+  *ppChannel = This->pChannel;
+  return S_OK;
+}
+
+HRESULT WINAPI StdProxy_GetIID(LPVOID iface,
+                              const IID **ppiid)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
+  TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
+
+  *ppiid = This->piid;
+  return S_OK;
+}
+
+HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface,
+                                            REFIID riid,
+                                            LPVOID *ppvObj)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
+  TRACE("(%p)->QueryInterface(%s,%p) %s\n",This,debugstr_guid(riid),ppvObj,This->name);
+  return IUnknown_QueryInterface(This->pUnkOuter,riid,ppvObj);
+}
+
+ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
+  TRACE("(%p)->AddRef() %s\n",This,This->name);
+#if 0 /* interface refcounting */
+  return ++(This->RefCount);
+#else /* object refcounting */
+  return IUnknown_AddRef(This->pUnkOuter);
+#endif
+}
+
+ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
+{
+  ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
+  TRACE("(%p)->Release() %s\n",This,This->name);
+#if 0 /* interface refcounting */
+  if (!--(This->RefCount)) {
+    StdProxy_Destruct((LPRPCPROXYBUFFER)&This->lpVtbl);
+    return 0;
+  }
+  return This->RefCount;
+#else /* object refcounting */
+  return IUnknown_Release(This->pUnkOuter);
+#endif
+}
+
+HRESULT WINAPI
+CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
+                         LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv )
+{
+    FIXME("%p %p %s %p %p\n", pTypeInfo, pUnkOuter, debugstr_guid(riid), ppProxy, ppv);
+    return E_NOTIMPL;
+}

Added: vendor/wine/dlls/rpcrt4/current/cpsf.c
--- vendor/wine/dlls/rpcrt4/current/cpsf.c	2004-12-31 15:44:47 UTC (rev 12591)
+++ vendor/wine/dlls/rpcrt4/current/cpsf.c	2004-12-31 15:47:31 UTC (rev 12592)
@@ -0,0 +1,263 @@
+/*
+ * COM proxy/stub factory (CStdPSFactory) implementation
+ *
+ * Copyright 2001 Ove Kåven, TransGaming Technologies
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "winreg.h"
+
+#include "objbase.h"
+
+#include "rpcproxy.h"
+
+#include "wine/debug.h"
+
+#include "cpsf.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ole);
+
+static BOOL FindProxyInfo(const ProxyFileInfo **pProxyFileList, REFIID riid, const ProxyFileInfo **pProxyInfo, int *pIndex)
+{
+  while (*pProxyFileList) {
+    if ((*pProxyFileList)->pIIDLookupRtn(riid, pIndex)) {
+      *pProxyInfo = *pProxyFileList;
+      TRACE("found: ProxyInfo %p Index %d\n", *pProxyInfo, *pIndex);
+      return TRUE;
+    }
+    pProxyFileList++;
+  }
+  TRACE("not found\n");
+  return FALSE;
+}
+
+static HRESULT WINAPI CStdPSFactory_QueryInterface(LPPSFACTORYBUFFER iface,
+                                                  REFIID riid,
+                                                  LPVOID *obj)
+{
+  CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
+  TRACE("(%p)->QueryInterface(%s,%p)\n",iface,debugstr_guid(riid),obj);
+  if (IsEqualGUID(&IID_IUnknown,riid) ||
+      IsEqualGUID(&IID_IPSFactoryBuffer,riid)) {
+    *obj = This;
+    This->RefCount++;
+    return S_OK;
+  }
+  return E_NOINTERFACE;
+}
+
+static ULONG WINAPI CStdPSFactory_AddRef(LPPSFACTORYBUFFER iface)
+{
+  CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
+  TRACE("(%p)->AddRef()\n",iface);
+  return ++(This->RefCount);
+}
+
+static ULONG WINAPI CStdPSFactory_Release(LPPSFACTORYBUFFER iface)
+{
+  CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
+  TRACE("(%p)->Release()\n",iface);
+  return --(This->RefCount);
+}
+
+static HRESULT WINAPI CStdPSFactory_CreateProxy(LPPSFACTORYBUFFER iface,
+                                               LPUNKNOWN pUnkOuter,
+                                               REFIID riid,
+                                               LPRPCPROXYBUFFER *ppProxy,
+                                               LPVOID *ppv)
+{
+  CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
+  const ProxyFileInfo *ProxyInfo;
+  int Index;
+  TRACE("(%p)->CreateProxy(%p,%s,%p,%p)\n",iface,pUnkOuter,
+       debugstr_guid(riid),ppProxy,ppv);
+  if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
+    return E_NOINTERFACE;
+  return StdProxy_Construct(riid, pUnkOuter, ProxyInfo->pNamesArray[Index],
+                            ProxyInfo->pProxyVtblList[Index],
+                            ProxyInfo->pStubVtblList[Index], iface, ppProxy, ppv);
+}
+
+static HRESULT WINAPI CStdPSFactory_CreateStub(LPPSFACTORYBUFFER iface,
+                                              REFIID riid,
+                                              LPUNKNOWN pUnkServer,
+                                              LPRPCSTUBBUFFER *ppStub)
+{
+  CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
+  const ProxyFileInfo *ProxyInfo;
+  int Index;
+  TRACE("(%p)->CreateStub(%s,%p,%p)\n",iface,debugstr_guid(riid),
+       pUnkServer,ppStub);
+  if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
+    return E_NOINTERFACE;
+  return CStdStubBuffer_Construct(riid, pUnkServer, ProxyInfo->pNamesArray[Index],
+                                  ProxyInfo->pStubVtblList[Index], iface, ppStub);
+}
+
+static IPSFactoryBufferVtbl CStdPSFactory_Vtbl =
+{
+  CStdPSFactory_QueryInterface,
+  CStdPSFactory_AddRef,
+  CStdPSFactory_Release,
+  CStdPSFactory_CreateProxy,
+  CStdPSFactory_CreateStub
+};
+
+/***********************************************************************
+ *           NdrDllGetClassObject [RPCRT4.@]
+ */
+HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv,
+                                   const ProxyFileInfo **pProxyFileList,
+                                   const CLSID *pclsid,
+                                   CStdPSFactoryBuffer *pPSFactoryBuffer)
+{
+  *ppv = NULL;
+  if (!pPSFactoryBuffer->lpVtbl) {
+    pPSFactoryBuffer->lpVtbl = &CStdPSFactory_Vtbl;
+    pPSFactoryBuffer->RefCount = 0;
+    pPSFactoryBuffer->pProxyFileList = pProxyFileList;
+  }
+  if (IsEqualGUID(rclsid, pclsid))
+    return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv);
+  return CLASS_E_CLASSNOTAVAILABLE;
+}
+
+/***********************************************************************
+ *           NdrDllCanUnloadNow [RPCRT4.@]
+ */
+HRESULT WINAPI NdrDllCanUnloadNow(CStdPSFactoryBuffer *pPSFactoryBuffer)
+{
+  return !(pPSFactoryBuffer->RefCount);
+}
+
+/***********************************************************************
+ *           NdrDllRegisterProxy [RPCRT4.@]
+ */
+HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
+                                  const ProxyFileInfo **pProxyFileList,
+                                  const CLSID *pclsid)
+{
+  LPSTR clsid;
+  char keyname[120], module[MAX_PATH];
+  HKEY key, subkey;
+  DWORD len;
+
+  TRACE("(%p,%p,%s)\n", hDll, pProxyFileList, debugstr_guid(pclsid));
+  UuidToStringA((UUID*)pclsid, (unsigned char**)&clsid);
+
+  /* register interfaces to point to clsid */
+  while (*pProxyFileList) {
+    unsigned u;
+    for (u=0; u<(*pProxyFileList)->TableSize; u++) {
+      CInterfaceStubVtbl *proxy = (*pProxyFileList)->pStubVtblList[u];
+      PCInterfaceName name = (*pProxyFileList)->pNamesArray[u];
+      LPSTR iid;
+
+      TRACE("registering %s %s => %s\n", name, debugstr_guid(proxy->header.piid), clsid);
+
+      UuidToStringA((UUID*)proxy->header.piid, (unsigned char**)&iid);
+      snprintf(keyname, sizeof(keyname), "Interface\\{%s}", iid);
+      RpcStringFreeA((unsigned char**)&iid);
+      if (RegCreateKeyExA(HKEY_CLASSES_ROOT, keyname, 0, NULL, 0,
+                          KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) {
+        if (name)
+          RegSetValueExA(key, NULL, 0, REG_SZ, name, strlen(name));
+        if (RegCreateKeyExA(key, "ProxyStubClsid32", 0, NULL, 0,
+                            KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS) {
+          snprintf(module, sizeof(module), "{%s}", clsid);
+          RegSetValueExA(subkey, NULL, 0, REG_SZ, module, strlen(module));
+          RegCloseKey(subkey);
+        }
+        RegCloseKey(key);
+      }
+    }
+    pProxyFileList++;
+  }
+
+  /* register clsid to point to module */
+  snprintf(keyname, sizeof(keyname), "CLSID\\{%s}", clsid);
+  len = GetModuleFileNameA(hDll, module, sizeof(module));
+  if (len && len < sizeof(module)) {
+    TRACE("registering CLSID %s => %s\n", clsid, module);
+    if (RegCreateKeyExA(HKEY_CLASSES_ROOT, keyname, 0, NULL, 0,
+                        KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) {
+      if (RegCreateKeyExA(key, "InProcServer32", 0, NULL, 0,
+                          KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS) {
+        RegSetValueExA(subkey, NULL, 0, REG_SZ, module, strlen(module));
+        RegCloseKey(subkey);
+      }
+      RegCloseKey(key);
+    }
+  }
+
+  /* done */
+  RpcStringFreeA((unsigned char**)&clsid);
+  return S_OK;
+}
+
+/***********************************************************************
+ *           NdrDllUnregisterProxy [RPCRT4.@]
+ */
+HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
+                                    const ProxyFileInfo **pProxyFileList,
+                                    const CLSID *pclsid)
+{
+  LPSTR clsid;
+  char keyname[120], module[MAX_PATH];
+  DWORD len;
+
+  TRACE("(%p,%p,%s)\n", hDll, pProxyFileList, debugstr_guid(pclsid));
+  UuidToStringA((UUID*)pclsid, (unsigned char**)&clsid);
+
+  /* unregister interfaces */
+  while (*pProxyFileList) {
+    unsigned u;
+    for (u=0; u<(*pProxyFileList)->TableSize; u++) {
+      CInterfaceStubVtbl *proxy = (*pProxyFileList)->pStubVtblList[u];
+      PCInterfaceName name = (*pProxyFileList)->pNamesArray[u];
+      LPSTR iid;
+
+      TRACE("unregistering %s %s <= %s\n", name, debugstr_guid(proxy->header.piid), clsid);
+
+      UuidToStringA((UUID*)proxy->header.piid, (unsigned char**)&iid);
+      snprintf(keyname, sizeof(keyname), "Interface\\{%s}", iid);
+      RpcStringFreeA((unsigned char**)&iid);
+      RegDeleteKeyA(HKEY_CLASSES_ROOT, keyname);
+    }
+    pProxyFileList++;
+  }
+
+  /* unregister clsid */
+  snprintf(keyname, sizeof(keyname), "CLSID\\{%s}", clsid);
+  len = GetModuleFileNameA(hDll, module, sizeof(module));
+  if (len && len < sizeof(module)) {
+    TRACE("unregistering CLSID %s <= %s\n", clsid, module);
+    RegDeleteKeyA(HKEY_CLASSES_ROOT, keyname);
+  }
+
+  /* done */
+  RpcStringFreeA((unsigned char**)&clsid);
+  return S_OK;
+}

Added: vendor/wine/dlls/rpcrt4/current/cpsf.h
--- vendor/wine/dlls/rpcrt4/current/cpsf.h	2004-12-31 15:44:47 UTC (rev 12591)
+++ vendor/wine/dlls/rpcrt4/current/cpsf.h	2004-12-31 15:47:31 UTC (rev 12592)
@@ -0,0 +1,44 @@
+/*
+ * COM proxy definitions
+ *
+ * Copyright 2001 Ove Kåven, TransGaming Technologies
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __WINE_CPSF_H
+#define __WINE_CPSF_H
+
+HRESULT WINAPI StdProxy_Construct(REFIID riid,
+				  LPUNKNOWN pUnkOuter,
+				  PCInterfaceName name,
+				  CInterfaceProxyVtbl *vtbl,
+				  CInterfaceStubVtbl *svtbl,
+				  LPPSFACTORYBUFFER pPSFactory,
+				  LPRPCPROXYBUFFER *ppProxy,
+				  LPVOID *ppvObj);
+HRESULT WINAPI StdProxy_GetChannel(LPVOID iface,
+				   LPRPCCHANNELBUFFER *ppChannel);
+HRESULT WINAPI StdProxy_GetIID(LPVOID iface,
+			       const IID **piid);
+
+HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
+					LPUNKNOWN pUnkServer,
+					PCInterfaceName name,
+					CInterfaceStubVtbl *vtbl,
+					LPPSFACTORYBUFFER pPSFactory,
+					LPRPCSTUBBUFFER *ppStub);
+
+#endif  /* __WINE_CPSF_H */

Added: vendor/wine/dlls/rpcrt4/current/cstub.c
--- vendor/wine/dlls/rpcrt4/current/cstub.c	2004-12-31 15:44:47 UTC (rev 12591)
+++ vendor/wine/dlls/rpcrt4/current/cstub.c	2004-12-31 15:47:31 UTC (rev 12592)
@@ -0,0 +1,169 @@
+/*
+ * COM stub (CStdStubBuffer) implementation
+ *
+ * Copyright 2001 Ove Kåven, TransGaming Technologies
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+
+#include "objbase.h"
+
+#include "rpcproxy.h"
+
+#include "wine/debug.h"
+
+#include "cpsf.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ole);
+
+#define STUB_HEADER(This) (((CInterfaceStubHeader*)((This)->lpVtbl))[-1])
+
+HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
+                                       LPUNKNOWN pUnkServer,
+                                       PCInterfaceName name,
+                                       CInterfaceStubVtbl *vtbl,
+                                       LPPSFACTORYBUFFER pPSFactory,
+                                       LPRPCSTUBBUFFER *ppStub)
+{
+  CStdStubBuffer *This;
+
+  TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
+  TRACE("iid=%s\n", debugstr_guid(vtbl->header.piid));
+  TRACE("vtbl=%p\n", &vtbl->Vtbl);
+
+  if (!IsEqualGUID(vtbl->header.piid, riid)) {
+    ERR("IID mismatch during stub creation\n");
+    return RPC_E_UNEXPECTED;
+  }
+
+  This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CStdStubBuffer));
+  if (!This) return E_OUTOFMEMORY;
+
+  This->lpVtbl = &vtbl->Vtbl;
+  This->RefCount = 1;
+  This->pvServerObject = pUnkServer;
+  This->pPSFactory = pPSFactory;
+  *ppStub = (LPRPCSTUBBUFFER)This;
+
+  IUnknown_AddRef(This->pvServerObject);
+  IPSFactoryBuffer_AddRef(pPSFactory);
+  return S_OK;
+}
+
+HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface,
+                                            REFIID riid,
+                                            LPVOID *obj)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
+
+  if (IsEqualGUID(&IID_IUnknown,riid) ||
+      IsEqualGUID(&IID_IRpcStubBuffer,riid)) {
+    *obj = This;
+    This->RefCount++;
+    return S_OK;
+  }
+  return E_NOINTERFACE;
+}
+
+ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->AddRef()\n",This);
+  return ++(This->RefCount);
+}
+
+ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface,
+                                      LPPSFACTORYBUFFER pPSF)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->Release()\n",This);
+
+  if (!--(This->RefCount)) {
+    if(This->pvServerObject)
+        IUnknown_Release(This->pvServerObject);
+    if(This->pPSFactory)
+        IPSFactoryBuffer_Release(This->pPSFactory);
+    HeapFree(GetProcessHeap(),0,This);
+    return 0;
+  }
+  return This->RefCount;
+}
+
+HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface,
+                                     LPUNKNOWN lpUnkServer)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->Connect(%p)\n",This,lpUnkServer);
+  This->pvServerObject = lpUnkServer;
+  return S_OK;
+}
+
+void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->Disconnect()\n",This);
+  This->pvServerObject = NULL;
+}
+
+HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
+                                    PRPCOLEMESSAGE pMsg,
+                                    LPRPCCHANNELBUFFER pChannel)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  DWORD dwPhase = STUB_UNMARSHAL;
+  TRACE("(%p)->Invoke(%p,%p)\n",This,pMsg,pChannel);
+
+  STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
+  return S_OK;
+}
+
+LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface,
+                                                    REFIID riid)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->IsIIDSupported(%s)\n",This,debugstr_guid(riid));
+  return IsEqualGUID(STUB_HEADER(This).piid, riid) ? iface : NULL;
+}
+
+ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->CountRefs()\n",This);
+  return This->RefCount;
+}
+
+HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface,
+                                                       LPVOID *ppv)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->DebugServerQueryInterface(%p)\n",This,ppv);
+  return S_OK;
+}
+
+void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface,
+                                             LPVOID pv)
+{
+  CStdStubBuffer *This = (CStdStubBuffer *)iface;
+  TRACE("(%p)->DebugServerRelease(%p)\n",This,pv);
+}

Added: vendor/wine/dlls/rpcrt4/current/ndr_marshall.c
--- vendor/wine/dlls/rpcrt4/current/ndr_marshall.c	2004-12-31 15:44:47 UTC (rev 12591)
+++ vendor/wine/dlls/rpcrt4/current/ndr_marshall.c	2004-12-31 15:47:31 UTC (rev 12592)
@@ -0,0 +1,2118 @@
+/*
+ * NDR data marshalling
+ *
+ * Copyright 2002 Greg Turner
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * TODO:
+ *  - figure out whether we *really* got this right
+ *  - check for errors and throw exceptions
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "winreg.h"
+
+#include "ndr_misc.h"
+#include "rpcndr.h"
+
+#include "wine/unicode.h"
+#include "wine/rpcfc.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ole);
+
+#define BUFFER_PARANOIA 20
+
+#if defined(__i386__)
+  #define LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32) \
+    (*((UINT32 *)(pchar)) = (uint32))
+
+  #define LITTLE_ENDIAN_UINT32_READ(pchar) \
+    (*((UINT32 *)(pchar)))
+#else
+  /* these would work for i386 too, but less efficient */
+  #define LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32) \
+    (*(pchar)     = LOBYTE(LOWORD(uint32)), \
+     *((pchar)+1) = HIBYTE(LOWORD(uint32)), \
+     *((pchar)+2) = LOBYTE(HIWORD(uint32)), \
+     *((pchar)+3) = HIBYTE(HIWORD(uint32)), \
+     (uint32)) /* allow as r-value */
+
+  #define LITTLE_ENDIAN_UINT32_READ(pchar) \
+    (MAKELONG( \
+      MAKEWORD(*(pchar), *((pchar)+1)), \
+      MAKEWORD(*((pchar)+2), *((pchar)+3))))
+#endif
+
+#define BIG_ENDIAN_UINT32_WRITE(pchar, uint32) \
+  (*((pchar)+3) = LOBYTE(LOWORD(uint32)), \
+   *((pchar)+2) = HIBYTE(LOWORD(uint32)), \
+   *((pchar)+1) = LOBYTE(HIWORD(uint32)), \
+   *(pchar)     = HIBYTE(HIWORD(uint32)), \
+   (uint32)) /* allow as r-value */
+
+#define BIG_ENDIAN_UINT32_READ(pchar) \
+  (MAKELONG( \
+    MAKEWORD(*((pchar)+3), *((pchar)+2)), \
+    MAKEWORD(*((pchar)+1), *(pchar))))
+
+#ifdef NDR_LOCAL_IS_BIG_ENDIAN
+  #define NDR_LOCAL_UINT32_WRITE(pchar, uint32) \
+    BIG_ENDIAN_UINT32_WRITE(pchar, uint32)
+  #define NDR_LOCAL_UINT32_READ(pchar) \
+    BIG_ENDIAN_UINT32_READ(pchar)
+#else
+  #define NDR_LOCAL_UINT32_WRITE(pchar, uint32) \
+    LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32)
+  #define NDR_LOCAL_UINT32_READ(pchar) \
+    LITTLE_ENDIAN_UINT32_READ(pchar)
+#endif
+
+/* _Align must be the desired alignment minus 1,
+ * e.g. ALIGN_LENGTH(len, 3) to align on a dword boundary. */
+#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
+#define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
+#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
+#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
+
+#define STD_OVERFLOW_CHECK(_Msg) do { \
+    TRACE("buffer=%d/%ld\n", _Msg->Buffer - _Msg->BufferStart, _Msg->BufferLength); \
+    if (_Msg->Buffer > _Msg->BufferEnd) ERR("buffer overflow %d bytes\n", _Msg->Buffer - _Msg->BufferEnd); \
+  } while (0)
+
+#define NDR_TABLE_SIZE 128
+#define NDR_TABLE_MASK 127
+
+NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = {
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  /* 0x10 */
+  0,
+  /* 0x11 */
+  NdrPointerMarshall, NdrPointerMarshall,
+  NdrPointerMarshall, NdrPointerMarshall,
+  /* 0x15 */
+  NdrSimpleStructMarshall, NdrSimpleStructMarshall,
+  0, 0, 0,
+  NdrComplexStructMarshall,
+  /* 0x1b */
+  NdrConformantArrayMarshall, 0, 0, 0, 0, 0,
+  NdrComplexArrayMarshall,
+  /* 0x22 */
+  NdrConformantStringMarshall, 0, 0,
[truncated at 1000 lines; 7732 more skipped]