Fixed NdrDllRegisterProxy so it registers the key names that ole32

expects. Better debug traces (include name of interface).
This commit is contained in:
Ove Kaaven 2003-05-20 04:13:44 +00:00 committed by Alexandre Julliard
parent 8daf96c203
commit 6e67d46355
4 changed files with 24 additions and 15 deletions

View File

@ -45,6 +45,7 @@ typedef struct {
const MIDL_STUBLESS_PROXY_INFO *stubless;
const IID* piid;
LPUNKNOWN pUnkOuter;
PCInterfaceName name;
LPPSFACTORYBUFFER pPSFactory;
LPRPCCHANNELBUFFER pChannel;
struct StublessThunk *thunks;
@ -108,6 +109,7 @@ struct StublessThunk { int dummy; };
HRESULT WINAPI StdProxy_Construct(REFIID riid,
LPUNKNOWN pUnkOuter,
PCInterfaceName name,
CInterfaceProxyVtbl *vtbl,
CInterfaceStubVtbl *svtbl,
LPPSFACTORYBUFFER pPSFactory,
@ -117,7 +119,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
StdProxyImpl *This;
const MIDL_STUBLESS_PROXY_INFO *stubless = NULL;
TRACE("(%p,%p,%p,%p,%p)\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj);
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)) {
@ -167,6 +169,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
This->stubless = stubless;
This->piid = vtbl->header.piid;
This->pUnkOuter = pUnkOuter;
This->name = name;
This->pPSFactory = pPSFactory;
This->pChannel = NULL;
*ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl;
@ -263,7 +266,7 @@ HRESULT WINAPI StdProxy_GetChannel(LPVOID iface,
LPRPCCHANNELBUFFER *ppChannel)
{
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
TRACE("(%p)->GetChannel(%p)\n",This,ppChannel);
TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
*ppChannel = This->pChannel;
return S_OK;
@ -273,7 +276,7 @@ HRESULT WINAPI StdProxy_GetIID(LPVOID iface,
const IID **ppiid)
{
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
TRACE("(%p)->GetIID(%p)\n",This,ppiid);
TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
*ppiid = This->piid;
return S_OK;
@ -284,14 +287,14 @@ HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface,
LPVOID *ppvObj)
{
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),ppvObj);
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()\n",This);
TRACE("(%p)->AddRef() %s\n",This,This->name);
#if 0 /* interface refcounting */
return ++(This->RefCount);
#else /* object refcounting */
@ -302,7 +305,7 @@ ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
{
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
TRACE("(%p)->Release()\n",This);
TRACE("(%p)->Release() %s\n",This,This->name);
#if 0 /* interface refcounting */
if (!--(This->RefCount)) {
StdProxy_Destruct((LPRPCPROXYBUFFER)&This->lpVtbl);

View File

@ -92,7 +92,8 @@ static HRESULT WINAPI CStdPSFactory_CreateProxy(LPPSFACTORYBUFFER iface,
debugstr_guid(riid),ppProxy,ppv);
if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
return E_NOINTERFACE;
return StdProxy_Construct(riid, pUnkOuter, ProxyInfo->pProxyVtblList[Index],
return StdProxy_Construct(riid, pUnkOuter, ProxyInfo->pNamesArray[Index],
ProxyInfo->pProxyVtblList[Index],
ProxyInfo->pStubVtblList[Index], iface, ppProxy, ppv);
}
@ -108,7 +109,8 @@ static HRESULT WINAPI CStdPSFactory_CreateStub(LPPSFACTORYBUFFER iface,
pUnkServer,ppStub);
if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
return E_NOINTERFACE;
return CStdStubBuffer_Construct(riid, pUnkServer, ProxyInfo->pStubVtblList[Index], iface, ppStub);
return CStdStubBuffer_Construct(riid, pUnkServer, ProxyInfo->pNamesArray[Index],
ProxyInfo->pStubVtblList[Index], iface, ppStub);
}
static ICOM_VTABLE(IPSFactoryBuffer) CStdPSFactory_Vtbl =
@ -173,7 +175,7 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
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);
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) {
@ -181,7 +183,8 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
RegSetValueExA(key, NULL, 0, REG_SZ, name, strlen(name));
if (RegCreateKeyExA(key, "ProxyStubClsid32", 0, NULL, 0,
KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS) {
RegSetValueExA(subkey, NULL, 0, REG_SZ, clsid, strlen(clsid));
snprintf(module, sizeof(module), "{%s}", clsid);
RegSetValueExA(subkey, NULL, 0, REG_SZ, module, strlen(module));
RegCloseKey(subkey);
}
RegCloseKey(key);
@ -191,7 +194,7 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
}
/* register clsid to point to module */
snprintf(keyname, sizeof(keyname), "CLSID\\%s", clsid);
snprintf(keyname, sizeof(keyname), "CLSID\\{%s}", clsid);
GetModuleFileNameA(hDll, module, sizeof(module));
TRACE("registering CLSID %s => %s\n", clsid, module);
if (RegCreateKeyExA(HKEY_CLASSES_ROOT, keyname, 0, NULL, 0,
@ -233,7 +236,7 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
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);
snprintf(keyname, sizeof(keyname), "Interface\\{%s}", iid);
RpcStringFreeA((unsigned char**)&iid);
RegDeleteKeyA(HKEY_CLASSES_ROOT, keyname);
}
@ -241,7 +244,7 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
}
/* unregister clsid */
snprintf(keyname, sizeof(keyname), "CLSID\\%s", clsid);
snprintf(keyname, sizeof(keyname), "CLSID\\{%s}", clsid);
GetModuleFileNameA(hDll, module, sizeof(module));
TRACE("unregistering CLSID %s <= %s\n", clsid, module);
RegDeleteKeyA(HKEY_CLASSES_ROOT, keyname);

View File

@ -23,6 +23,7 @@
HRESULT WINAPI StdProxy_Construct(REFIID riid,
LPUNKNOWN pUnkOuter,
PCInterfaceName name,
CInterfaceProxyVtbl *vtbl,
CInterfaceStubVtbl *svtbl,
LPPSFACTORYBUFFER pPSFactory,
@ -35,6 +36,7 @@ HRESULT WINAPI StdProxy_GetIID(LPVOID iface,
HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
LPUNKNOWN pUnkServer,
PCInterfaceName name,
CInterfaceStubVtbl *vtbl,
LPPSFACTORYBUFFER pPSFactory,
LPRPCSTUBBUFFER *ppStub);

View File

@ -36,13 +36,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
LPUNKNOWN pUnkServer,
PCInterfaceName name,
CInterfaceStubVtbl *vtbl,
LPPSFACTORYBUFFER pPSFactory,
LPRPCSTUBBUFFER *ppStub)
{
CStdStubBuffer *This;
TRACE("(%p,%p,%p,%p)\n", pUnkServer, vtbl, pPSFactory, ppStub);
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);