- Use I_RpcGetBuffer, instead of our own buffer routines to fix an
occasional test crash caused by heap corruption. - Zero the memory block passed to RpcServerRegisterIfEx so we don't pass garbage in some of the fields we don't fill in. - Return the correct error code from create_server and fix two handle leaks. - TODO update.
This commit is contained in:
parent
dc16331c75
commit
2d2a39cc42
|
@ -30,9 +30,12 @@
|
||||||
*
|
*
|
||||||
* - Implement the service control manager (in rpcss) to keep track
|
* - Implement the service control manager (in rpcss) to keep track
|
||||||
* of registered class objects: ISCM::ServerRegisterClsid et al
|
* of registered class objects: ISCM::ServerRegisterClsid et al
|
||||||
* - Implement the OXID resolver so we don't need magic pipe names for
|
* - Implement the OXID resolver so we don't need magic endpoint names for
|
||||||
* clients and servers to meet up
|
* clients and servers to meet up
|
||||||
*
|
*
|
||||||
|
* - Pump the message loop during RPC calls.
|
||||||
|
* - Call IMessageFilter functions.
|
||||||
|
*
|
||||||
* - Make all ole interface marshaling use NDR to be wire compatible with
|
* - Make all ole interface marshaling use NDR to be wire compatible with
|
||||||
* native DCOM
|
* native DCOM
|
||||||
* - Use & interpret ORPCTHIS & ORPCTHAT.
|
* - Use & interpret ORPCTHIS & ORPCTHAT.
|
||||||
|
|
|
@ -190,10 +190,8 @@ CFStub_Invoke(
|
||||||
|
|
||||||
msg->cbBuffer = ststg.cbSize.u.LowPart;
|
msg->cbBuffer = ststg.cbSize.u.LowPart;
|
||||||
|
|
||||||
if (msg->Buffer)
|
I_RpcGetBuffer((RPC_MESSAGE *)msg);
|
||||||
msg->Buffer = HeapReAlloc(GetProcessHeap(),0,msg->Buffer,ststg.cbSize.u.LowPart);
|
if (hres) return hres;
|
||||||
else
|
|
||||||
msg->Buffer = HeapAlloc(GetProcessHeap(),0,ststg.cbSize.u.LowPart);
|
|
||||||
|
|
||||||
seekto.u.LowPart = 0;seekto.u.HighPart = 0;
|
seekto.u.LowPart = 0;seekto.u.HighPart = 0;
|
||||||
hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
|
hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos);
|
||||||
|
@ -546,10 +544,10 @@ static HRESULT WINAPI RemUnkStub_Invoke(LPRPCSTUBBUFFER iface,
|
||||||
|
|
||||||
/* out */
|
/* out */
|
||||||
pMsg->cbBuffer = cIids * sizeof(REMQIRESULT);
|
pMsg->cbBuffer = cIids * sizeof(REMQIRESULT);
|
||||||
if (pMsg->Buffer)
|
|
||||||
pMsg->Buffer = HeapReAlloc(GetProcessHeap(), 0, pMsg->Buffer, pMsg->cbBuffer);
|
I_RpcGetBuffer((RPC_MESSAGE *)pMsg);
|
||||||
else
|
if (hr) return hr;
|
||||||
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->cbBuffer);
|
|
||||||
buf = pMsg->Buffer;
|
buf = pMsg->Buffer;
|
||||||
/* FIXME: pQIResults is a unique pointer so pQIResults can be NULL! */
|
/* FIXME: pQIResults is a unique pointer so pQIResults can be NULL! */
|
||||||
memcpy(buf, pQIResults, cIids * sizeof(REMQIRESULT));
|
memcpy(buf, pQIResults, cIids * sizeof(REMQIRESULT));
|
||||||
|
@ -573,12 +571,13 @@ static HRESULT WINAPI RemUnkStub_Invoke(LPRPCSTUBBUFFER iface,
|
||||||
|
|
||||||
/* out */
|
/* out */
|
||||||
pMsg->cbBuffer = cIids * sizeof(HRESULT);
|
pMsg->cbBuffer = cIids * sizeof(HRESULT);
|
||||||
if (pMsg->Buffer)
|
|
||||||
pMsg->Buffer = HeapReAlloc(GetProcessHeap(), 0, pMsg->Buffer, pMsg->cbBuffer);
|
I_RpcGetBuffer((RPC_MESSAGE *)pMsg);
|
||||||
else
|
if (!hr)
|
||||||
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->cbBuffer);
|
{
|
||||||
buf = pMsg->Buffer;
|
buf = pMsg->Buffer;
|
||||||
memcpy(buf, pResults, cIids * sizeof(HRESULT));
|
memcpy(buf, pResults, cIids * sizeof(HRESULT));
|
||||||
|
}
|
||||||
|
|
||||||
CoTaskMemFree(pResults);
|
CoTaskMemFree(pResults);
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ HRESULT RPC_RegisterInterface(REFIID riid)
|
||||||
{
|
{
|
||||||
TRACE("Creating new interface\n");
|
TRACE("Creating new interface\n");
|
||||||
|
|
||||||
rif = HeapAlloc(GetProcessHeap(), 0, sizeof(*rif));
|
rif = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*rif));
|
||||||
if (rif)
|
if (rif)
|
||||||
{
|
{
|
||||||
RPC_STATUS status;
|
RPC_STATUS status;
|
||||||
|
@ -419,10 +419,9 @@ HRESULT RPC_RegisterInterface(REFIID riid)
|
||||||
rif->If.Length = sizeof(RPC_SERVER_INTERFACE);
|
rif->If.Length = sizeof(RPC_SERVER_INTERFACE);
|
||||||
/* RPC interface ID = COM interface ID */
|
/* RPC interface ID = COM interface ID */
|
||||||
rif->If.InterfaceId.SyntaxGUID = *riid;
|
rif->If.InterfaceId.SyntaxGUID = *riid;
|
||||||
/* COM objects always have a version of 0.0 */
|
|
||||||
rif->If.InterfaceId.SyntaxVersion.MajorVersion = 0;
|
|
||||||
rif->If.InterfaceId.SyntaxVersion.MinorVersion = 0;
|
|
||||||
rif->If.DispatchTable = &rpc_dispatch;
|
rif->If.DispatchTable = &rpc_dispatch;
|
||||||
|
/* all other fields are 0, including the version asCOM objects
|
||||||
|
* always have a version of 0.0 */
|
||||||
status = RpcServerRegisterIfEx(
|
status = RpcServerRegisterIfEx(
|
||||||
(RPC_IF_HANDLE)&rif->If,
|
(RPC_IF_HANDLE)&rif->If,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
|
@ -539,8 +538,10 @@ static HRESULT create_server(REFCLSID rclsid)
|
||||||
|
|
||||||
if (!CreateProcessW(exe, command, NULL, NULL, FALSE, 0, NULL, NULL, &sinfo, &pinfo)) {
|
if (!CreateProcessW(exe, command, NULL, NULL, FALSE, 0, NULL, NULL, &sinfo, &pinfo)) {
|
||||||
WARN("failed to run local server %s\n", debugstr_w(exe));
|
WARN("failed to run local server %s\n", debugstr_w(exe));
|
||||||
return E_FAIL;
|
return HRESULT_FROM_WIN32(GetLastError());
|
||||||
}
|
}
|
||||||
|
CloseHandle(pinfo.hProcess);
|
||||||
|
CloseHandle(pinfo.hThread);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue