Commit 5c7c5faf authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Add static to non-exported marshal functions.

- Remove unused marshal functions. - Rename several RPC functions.
parent 0ba37e23
...@@ -107,22 +107,6 @@ void MARSHAL_Invalidate_Stub_From_MID(wine_marshal_id *mid) { ...@@ -107,22 +107,6 @@ void MARSHAL_Invalidate_Stub_From_MID(wine_marshal_id *mid) {
} }
HRESULT HRESULT
MARSHAL_Find_Stub_Server(wine_marshal_id *mid,LPUNKNOWN *punk) {
int i;
for (i=0;i<nrofstubs;i++) {
if (!stubs[i].valid) continue;
if (MARSHAL_Compare_Mids_NoInterface(mid,&(stubs[i].mid))) {
*punk = stubs[i].pUnkServer;
IUnknown_AddRef((*punk));
return S_OK;
}
}
return E_FAIL;
}
HRESULT
MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub) { MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub) {
int i; int i;
...@@ -138,7 +122,7 @@ MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub) { ...@@ -138,7 +122,7 @@ MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub) {
return E_FAIL; return E_FAIL;
} }
HRESULT static HRESULT
MARSHAL_Find_Stub(wine_marshal_id *mid,LPUNKNOWN *pUnk) { MARSHAL_Find_Stub(wine_marshal_id *mid,LPUNKNOWN *pUnk) {
int i; int i;
...@@ -154,7 +138,7 @@ MARSHAL_Find_Stub(wine_marshal_id *mid,LPUNKNOWN *pUnk) { ...@@ -154,7 +138,7 @@ MARSHAL_Find_Stub(wine_marshal_id *mid,LPUNKNOWN *pUnk) {
return E_FAIL; return E_FAIL;
} }
HRESULT static HRESULT
MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN pUnk,IRpcStubBuffer *stub) { MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN pUnk,IRpcStubBuffer *stub) {
LPUNKNOWN xPunk; LPUNKNOWN xPunk;
if (!MARSHAL_Find_Stub(mid,&xPunk)) { if (!MARSHAL_Find_Stub(mid,&xPunk)) {
...@@ -175,19 +159,6 @@ MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN pUnk,IRpcStubBuffer *stub) ...@@ -175,19 +159,6 @@ MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN pUnk,IRpcStubBuffer *stub)
} }
HRESULT HRESULT
MARSHAL_Find_Proxy(wine_marshal_id *mid,LPUNKNOWN *punk) {
int i;
for (i=0;i<nrofproxies;i++)
if (MARSHAL_Compare_Mids(mid,&(proxies[i].mid))) {
*punk = proxies[i].pUnk;
IUnknown_AddRef((*punk));
return S_OK;
}
return E_FAIL;
}
HRESULT
MARSHAL_Disconnect_Proxies() { MARSHAL_Disconnect_Proxies() {
int i; int i;
...@@ -199,20 +170,7 @@ MARSHAL_Disconnect_Proxies() { ...@@ -199,20 +170,7 @@ MARSHAL_Disconnect_Proxies() {
return S_OK; return S_OK;
} }
HRESULT static HRESULT
MARSHAL_Find_Proxy_Object(wine_marshal_id *mid,LPUNKNOWN *punk) {
int i;
for (i=0;i<nrofproxies;i++)
if (MARSHAL_Compare_Mids_NoInterface(mid,&(proxies[i].mid))) {
*punk = proxies[i].pUnk;
IUnknown_AddRef((*punk));
return S_OK;
}
return E_FAIL;
}
HRESULT
MARSHAL_Register_Proxy(wine_marshal_id *mid,LPUNKNOWN punk) { MARSHAL_Register_Proxy(wine_marshal_id *mid,LPUNKNOWN punk) {
int i; int i;
...@@ -244,7 +202,7 @@ typedef struct _StdMarshalImpl { ...@@ -244,7 +202,7 @@ typedef struct _StdMarshalImpl {
DWORD mshlflags; DWORD mshlflags;
} StdMarshalImpl; } StdMarshalImpl;
HRESULT WINAPI static HRESULT WINAPI
StdMarshalImpl_QueryInterface(LPMARSHAL iface,REFIID riid,LPVOID *ppv) { StdMarshalImpl_QueryInterface(LPMARSHAL iface,REFIID riid,LPVOID *ppv) {
*ppv = NULL; *ppv = NULL;
if (IsEqualIID(&IID_IUnknown,riid) || IsEqualIID(&IID_IMarshal,riid)) { if (IsEqualIID(&IID_IUnknown,riid) || IsEqualIID(&IID_IMarshal,riid)) {
...@@ -256,14 +214,14 @@ StdMarshalImpl_QueryInterface(LPMARSHAL iface,REFIID riid,LPVOID *ppv) { ...@@ -256,14 +214,14 @@ StdMarshalImpl_QueryInterface(LPMARSHAL iface,REFIID riid,LPVOID *ppv) {
return E_NOINTERFACE; return E_NOINTERFACE;
} }
ULONG WINAPI static ULONG WINAPI
StdMarshalImpl_AddRef(LPMARSHAL iface) { StdMarshalImpl_AddRef(LPMARSHAL iface) {
ICOM_THIS(StdMarshalImpl,iface); ICOM_THIS(StdMarshalImpl,iface);
This->ref++; This->ref++;
return This->ref; return This->ref;
} }
ULONG WINAPI static ULONG WINAPI
StdMarshalImpl_Release(LPMARSHAL iface) { StdMarshalImpl_Release(LPMARSHAL iface) {
ICOM_THIS(StdMarshalImpl,iface); ICOM_THIS(StdMarshalImpl,iface);
This->ref--; This->ref--;
...@@ -274,7 +232,7 @@ StdMarshalImpl_Release(LPMARSHAL iface) { ...@@ -274,7 +232,7 @@ StdMarshalImpl_Release(LPMARSHAL iface) {
return 0; return 0;
} }
HRESULT WINAPI static HRESULT WINAPI
StdMarshalImpl_GetUnmarshalClass( StdMarshalImpl_GetUnmarshalClass(
LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext, LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext,
void* pvDestContext, DWORD mshlflags, CLSID* pCid void* pvDestContext, DWORD mshlflags, CLSID* pCid
...@@ -283,7 +241,7 @@ StdMarshalImpl_GetUnmarshalClass( ...@@ -283,7 +241,7 @@ StdMarshalImpl_GetUnmarshalClass(
return S_OK; return S_OK;
} }
HRESULT WINAPI static HRESULT WINAPI
StdMarshalImpl_GetMarshalSizeMax( StdMarshalImpl_GetMarshalSizeMax(
LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext, LPMARSHAL iface, REFIID riid, void* pv, DWORD dwDestContext,
void* pvDestContext, DWORD mshlflags, DWORD* pSize void* pvDestContext, DWORD mshlflags, DWORD* pSize
...@@ -292,7 +250,7 @@ StdMarshalImpl_GetMarshalSizeMax( ...@@ -292,7 +250,7 @@ StdMarshalImpl_GetMarshalSizeMax(
return S_OK; return S_OK;
} }
HRESULT WINAPI static HRESULT WINAPI
StdMarshalImpl_MarshalInterface( StdMarshalImpl_MarshalInterface(
LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dwDestContext, LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dwDestContext,
void* pvDestContext, DWORD mshlflags void* pvDestContext, DWORD mshlflags
...@@ -339,7 +297,7 @@ StdMarshalImpl_MarshalInterface( ...@@ -339,7 +297,7 @@ StdMarshalImpl_MarshalInterface(
return S_OK; return S_OK;
} }
HRESULT WINAPI static HRESULT WINAPI
StdMarshalImpl_UnmarshalInterface( StdMarshalImpl_UnmarshalInterface(
LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv
) { ) {
...@@ -392,7 +350,7 @@ StdMarshalImpl_UnmarshalInterface( ...@@ -392,7 +350,7 @@ StdMarshalImpl_UnmarshalInterface(
return hres; return hres;
} }
HRESULT WINAPI static HRESULT WINAPI
StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm) { StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm) {
wine_marshal_id mid; wine_marshal_id mid;
ULONG res; ULONG res;
...@@ -427,7 +385,7 @@ StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm) { ...@@ -427,7 +385,7 @@ StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm) {
return S_OK; return S_OK;
} }
HRESULT WINAPI static HRESULT WINAPI
StdMarshalImpl_DisconnectObject(LPMARSHAL iface, DWORD dwReserved) { StdMarshalImpl_DisconnectObject(LPMARSHAL iface, DWORD dwReserved) {
FIXME("(), stub!\n"); FIXME("(), stub!\n");
return S_OK; return S_OK;
......
...@@ -117,7 +117,7 @@ typedef struct _PipeBuf { ...@@ -117,7 +117,7 @@ typedef struct _PipeBuf {
} PipeBuf; } PipeBuf;
static HRESULT WINAPI static HRESULT WINAPI
_xread(HANDLE hf, LPVOID ptr, DWORD size) { read_pipe(HANDLE hf, LPVOID ptr, DWORD size) {
DWORD res; DWORD res;
if (!ReadFile(hf,ptr,size,&res,NULL)) { if (!ReadFile(hf,ptr,size,&res,NULL)) {
FIXME("Failed to read from %p, le is %lx\n",hf,GetLastError()); FIXME("Failed to read from %p, le is %lx\n",hf,GetLastError());
...@@ -157,7 +157,7 @@ drs(LPCSTR where) { ...@@ -157,7 +157,7 @@ drs(LPCSTR where) {
} }
static HRESULT WINAPI static HRESULT WINAPI
_xwrite(HANDLE hf, LPVOID ptr, DWORD size) { write_pipe(HANDLE hf, LPVOID ptr, DWORD size) {
DWORD res; DWORD res;
if (!WriteFile(hf,ptr,size,&res,NULL)) { if (!WriteFile(hf,ptr,size,&res,NULL)) {
FIXME("Failed to write to %p, le is %lx\n",hf,GetLastError()); FIXME("Failed to write to %p, le is %lx\n",hf,GetLastError());
...@@ -307,8 +307,8 @@ PipeBuf_Release(LPRPCCHANNELBUFFER iface) { ...@@ -307,8 +307,8 @@ PipeBuf_Release(LPRPCCHANNELBUFFER iface) {
pipe = PIPE_FindByMID(&This->mid); pipe = PIPE_FindByMID(&This->mid);
_xwrite(pipe, &reqtype, sizeof(reqtype)); write_pipe(pipe, &reqtype, sizeof(reqtype));
_xwrite(pipe, &header, sizeof(wine_rpc_disconnect_header)); write_pipe(pipe, &header, sizeof(wine_rpc_disconnect_header));
TRACE("written disconnect packet\n"); TRACE("written disconnect packet\n");
...@@ -330,7 +330,7 @@ PipeBuf_GetBuffer( ...@@ -330,7 +330,7 @@ PipeBuf_GetBuffer(
} }
static HRESULT static HRESULT
_invoke_onereq(wine_rpc_request *req) { COM_InvokeAndRpcSend(wine_rpc_request *req) {
IRpcStubBuffer *stub; IRpcStubBuffer *stub;
RPCOLEMESSAGE msg; RPCOLEMESSAGE msg;
HRESULT hres; HRESULT hres;
...@@ -351,18 +351,18 @@ _invoke_onereq(wine_rpc_request *req) { ...@@ -351,18 +351,18 @@ _invoke_onereq(wine_rpc_request *req) {
req->Buffer = msg.Buffer; req->Buffer = msg.Buffer;
req->resph.cbBuffer = msg.cbBuffer; req->resph.cbBuffer = msg.cbBuffer;
reqtype = REQTYPE_RESPONSE; reqtype = REQTYPE_RESPONSE;
hres = _xwrite(req->hPipe,&reqtype,sizeof(reqtype)); hres = write_pipe(req->hPipe,&reqtype,sizeof(reqtype));
if (hres) return hres; if (hres) return hres;
hres = _xwrite(req->hPipe,&(req->resph),sizeof(req->resph)); hres = write_pipe(req->hPipe,&(req->resph),sizeof(req->resph));
if (hres) return hres; if (hres) return hres;
hres = _xwrite(req->hPipe,req->Buffer,req->resph.cbBuffer); hres = write_pipe(req->hPipe,req->Buffer,req->resph.cbBuffer);
if (hres) return hres; if (hres) return hres;
req->state = REQSTATE_DONE; req->state = REQSTATE_DONE;
drs("invoke"); drs("invoke");
return S_OK; return S_OK;
} }
static HRESULT _read_one(wine_pipe *xpipe); static HRESULT COM_RpcReceive(wine_pipe *xpipe);
static HRESULT static HRESULT
RPC_QueueRequestAndWait(wine_rpc_request *req) { RPC_QueueRequestAndWait(wine_rpc_request *req) {
...@@ -383,23 +383,23 @@ RPC_QueueRequestAndWait(wine_rpc_request *req) { ...@@ -383,23 +383,23 @@ RPC_QueueRequestAndWait(wine_rpc_request *req) {
req->hPipe = xpipe->hPipe; req->hPipe = xpipe->hPipe;
req->state = REQSTATE_REQ_WAITING_FOR_REPLY; req->state = REQSTATE_REQ_WAITING_FOR_REPLY;
reqtype = REQTYPE_REQUEST; reqtype = REQTYPE_REQUEST;
hres = _xwrite(req->hPipe,&reqtype,sizeof(reqtype)); hres = write_pipe(req->hPipe,&reqtype,sizeof(reqtype));
if (hres) return hres; if (hres) return hres;
hres = _xwrite(req->hPipe,&(req->reqh),sizeof(req->reqh)); hres = write_pipe(req->hPipe,&(req->reqh),sizeof(req->reqh));
if (hres) return hres; if (hres) return hres;
hres = _xwrite(req->hPipe,req->Buffer,req->reqh.cbBuffer); hres = write_pipe(req->hPipe,req->Buffer,req->reqh.cbBuffer);
if (hres) return hres; if (hres) return hres;
/* This loop is about allowing re-entrancy. While waiting for the /* This loop is about allowing re-entrancy. While waiting for the
* response to one RPC we may receive a request starting another. */ * response to one RPC we may receive a request starting another. */
while (!hres) { while (!hres) {
hres = _read_one(xpipe); hres = COM_RpcReceive(xpipe);
if (hres) break; if (hres) break;
for (i=0;i<nrofreqs;i++) { for (i=0;i<nrofreqs;i++) {
xreq = reqs[i]; xreq = reqs[i];
if ((xreq->state==REQSTATE_REQ_GOT) && (xreq->hPipe==req->hPipe)) { if ((xreq->state==REQSTATE_REQ_GOT) && (xreq->hPipe==req->hPipe)) {
hres = _invoke_onereq(xreq); hres = COM_InvokeAndRpcSend(xreq);
if (hres) break; if (hres) break;
} }
} }
...@@ -637,7 +637,7 @@ PIPE_StartRequestThread(HANDLE xhPipe) { ...@@ -637,7 +637,7 @@ PIPE_StartRequestThread(HANDLE xhPipe) {
wine_marshal_id remoteid; wine_marshal_id remoteid;
HRESULT hres; HRESULT hres;
hres = _xread(xhPipe,&remoteid,sizeof(remoteid)); hres = read_pipe(xhPipe,&remoteid,sizeof(remoteid));
if (hres) { if (hres) {
ERR("Failed to read remote mid!\n"); ERR("Failed to read remote mid!\n");
return; return;
...@@ -646,13 +646,13 @@ PIPE_StartRequestThread(HANDLE xhPipe) { ...@@ -646,13 +646,13 @@ PIPE_StartRequestThread(HANDLE xhPipe) {
} }
static HRESULT static HRESULT
_read_one(wine_pipe *xpipe) { COM_RpcReceive(wine_pipe *xpipe) {
DWORD reqtype; DWORD reqtype;
HRESULT hres = S_OK; HRESULT hres = S_OK;
HANDLE xhPipe = xpipe->hPipe; HANDLE xhPipe = xpipe->hPipe;
/*FIXME("%lx %d reading reqtype\n",GetCurrentProcessId(),xhPipe);*/ /*FIXME("%lx %d reading reqtype\n",GetCurrentProcessId(),xhPipe);*/
hres = _xread(xhPipe,&reqtype,sizeof(reqtype)); hres = read_pipe(xhPipe,&reqtype,sizeof(reqtype));
if (hres) goto end; if (hres) goto end;
EnterCriticalSection(&(xpipe->crit)); EnterCriticalSection(&(xpipe->crit));
/*FIXME("%lx got reqtype %ld\n",GetCurrentProcessId(),reqtype);*/ /*FIXME("%lx got reqtype %ld\n",GetCurrentProcessId(),reqtype);*/
...@@ -662,7 +662,7 @@ _read_one(wine_pipe *xpipe) { ...@@ -662,7 +662,7 @@ _read_one(wine_pipe *xpipe) {
IRpcStubBuffer *stub; IRpcStubBuffer *stub;
ULONG ret; ULONG ret;
hres = _xread(xhPipe, &header, sizeof(header)); hres = read_pipe(xhPipe, &header, sizeof(header));
if (hres) { if (hres) {
ERR("could not read disconnect header\n"); ERR("could not read disconnect header\n");
goto end; goto end;
...@@ -689,11 +689,11 @@ _read_one(wine_pipe *xpipe) { ...@@ -689,11 +689,11 @@ _read_one(wine_pipe *xpipe) {
wine_rpc_request *xreq; wine_rpc_request *xreq;
RPC_GetRequest(&xreq); RPC_GetRequest(&xreq);
xreq->hPipe = xhPipe; xreq->hPipe = xhPipe;
hres = _xread(xhPipe,&(xreq->reqh),sizeof(xreq->reqh)); hres = read_pipe(xhPipe,&(xreq->reqh),sizeof(xreq->reqh));
if (hres) goto end; if (hres) goto end;
xreq->resph.reqid = xreq->reqh.reqid; xreq->resph.reqid = xreq->reqh.reqid;
xreq->Buffer = HeapAlloc(GetProcessHeap(),0, xreq->reqh.cbBuffer); xreq->Buffer = HeapAlloc(GetProcessHeap(),0, xreq->reqh.cbBuffer);
hres = _xread(xhPipe,xreq->Buffer,xreq->reqh.cbBuffer); hres = read_pipe(xhPipe,xreq->Buffer,xreq->reqh.cbBuffer);
if (hres) goto end; if (hres) goto end;
xreq->state = REQSTATE_REQ_GOT; xreq->state = REQSTATE_REQ_GOT;
goto end; goto end;
...@@ -701,7 +701,7 @@ _read_one(wine_pipe *xpipe) { ...@@ -701,7 +701,7 @@ _read_one(wine_pipe *xpipe) {
wine_rpc_response_header resph; wine_rpc_response_header resph;
int i; int i;
hres = _xread(xhPipe,&resph,sizeof(resph)); hres = read_pipe(xhPipe,&resph,sizeof(resph));
if (hres) goto end; if (hres) goto end;
for (i=nrofreqs;i--;) { for (i=nrofreqs;i--;) {
wine_rpc_request *xreq = reqs[i]; wine_rpc_request *xreq = reqs[i];
...@@ -715,7 +715,7 @@ _read_one(wine_pipe *xpipe) { ...@@ -715,7 +715,7 @@ _read_one(wine_pipe *xpipe) {
else else
xreq->Buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,xreq->resph.cbBuffer); xreq->Buffer = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,xreq->resph.cbBuffer);
hres = _xread(xhPipe,xreq->Buffer,xreq->resph.cbBuffer); hres = read_pipe(xhPipe,xreq->Buffer,xreq->resph.cbBuffer);
if (hres) goto end; if (hres) goto end;
xreq->state = REQSTATE_RESP_GOT; xreq->state = REQSTATE_RESP_GOT;
/*PulseEvent(hRpcChanged);*/ /*PulseEvent(hRpcChanged);*/
...@@ -742,13 +742,13 @@ _StubReaderThread(LPVOID param) { ...@@ -742,13 +742,13 @@ _StubReaderThread(LPVOID param) {
TRACE("STUB reader thread %lx\n",GetCurrentProcessId()); TRACE("STUB reader thread %lx\n",GetCurrentProcessId());
while (!hres) { while (!hres) {
int i; int i;
hres = _read_one(xpipe); hres = COM_RpcReceive(xpipe);
if (hres) break; if (hres) break;
for (i=nrofreqs;i--;) { for (i=nrofreqs;i--;) {
wine_rpc_request *xreq = reqs[i]; wine_rpc_request *xreq = reqs[i];
if ((xreq->state == REQSTATE_REQ_GOT) && (xreq->hPipe == xhPipe)) { if ((xreq->state == REQSTATE_REQ_GOT) && (xreq->hPipe == xhPipe)) {
hres = _invoke_onereq(xreq); hres = COM_InvokeAndRpcSend(xreq);
if (!hres) break; if (!hres) break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment