mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
Sync to Wine-20050930:
Robert Shearman <rob@codeweavers.com> - Implement most of the details around unmarshalling of an object pointer. - Fix allocation scheme in NdrConformantArrayUnmarshal to allocate if *ppMemory is NULL, like complex struct and user type unmarshalling. - Fix ref-counting rules to match native DCOM Dlls. Alexandre Julliard <julliard@winehq.org> - Use a more portable scheme for storing the name of a critical section. - We are no longer generating .dbg.c files. Mike McCormack <mike@codeweavers.com> - Fix gcc 4.0 warnings. svn path=/trunk/; revision=18347
This commit is contained in:
parent
60725dc6bb
commit
b40e1a8202
7 changed files with 54 additions and 56 deletions
|
@ -176,8 +176,8 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||||
This->PVtbl = vtbl->Vtbl;
|
This->PVtbl = vtbl->Vtbl;
|
||||||
|
|
||||||
This->lpVtbl = &StdProxy_Vtbl;
|
This->lpVtbl = &StdProxy_Vtbl;
|
||||||
/* 1 reference for the proxy and 1 for the object */
|
/* one reference for the proxy */
|
||||||
This->RefCount = 2;
|
This->RefCount = 1;
|
||||||
This->stubless = stubless;
|
This->stubless = stubless;
|
||||||
This->piid = vtbl->header.piid;
|
This->piid = vtbl->header.piid;
|
||||||
This->pUnkOuter = pUnkOuter;
|
This->pUnkOuter = pUnkOuter;
|
||||||
|
@ -186,6 +186,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||||
This->pChannel = NULL;
|
This->pChannel = NULL;
|
||||||
*ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl;
|
*ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl;
|
||||||
*ppvObj = &This->PVtbl;
|
*ppvObj = &This->PVtbl;
|
||||||
|
IUnknown_AddRef((IUnknown *)*ppvObj);
|
||||||
IPSFactoryBuffer_AddRef(pPSFactory);
|
IPSFactoryBuffer_AddRef(pPSFactory);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -738,6 +738,11 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||||
pStubMsg->Buffer += 4;
|
pStubMsg->Buffer += 4;
|
||||||
break;
|
break;
|
||||||
case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
|
case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
|
||||||
|
pointer_id = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
|
||||||
|
pStubMsg->Buffer += 4;
|
||||||
|
if (*pPointer)
|
||||||
|
FIXME("free object pointer %p\n", *pPointer);
|
||||||
|
break;
|
||||||
case RPC_FC_FP:
|
case RPC_FC_FP:
|
||||||
default:
|
default:
|
||||||
FIXME("unhandled ptr type=%02x\n", type);
|
FIXME("unhandled ptr type=%02x\n", type);
|
||||||
|
@ -1865,18 +1870,10 @@ unsigned char * WINAPI NdrConformantArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||||
pFormat = ReadConformance(pStubMsg, pFormat+4);
|
pFormat = ReadConformance(pStubMsg, pFormat+4);
|
||||||
size = pStubMsg->MaxCount;
|
size = pStubMsg->MaxCount;
|
||||||
|
|
||||||
if (fMustAlloc) {
|
if (fMustAlloc || !*ppMemory)
|
||||||
*ppMemory = NdrAllocate(pStubMsg, size*esize);
|
*ppMemory = NdrAllocate(pStubMsg, size*esize);
|
||||||
|
|
||||||
memcpy(*ppMemory, pStubMsg->Buffer, size*esize);
|
memcpy(*ppMemory, pStubMsg->Buffer, size*esize);
|
||||||
} else {
|
|
||||||
if (pStubMsg->ReuseBuffer && !*ppMemory)
|
|
||||||
/* for servers, we may just point straight into the RPC buffer, I think
|
|
||||||
* (I guess that's what MS does since MIDL code doesn't try to free) */
|
|
||||||
*ppMemory = pStubMsg->Buffer;
|
|
||||||
else
|
|
||||||
/* for clients, memory should be provided by caller */
|
|
||||||
memcpy(*ppMemory, pStubMsg->Buffer, size*esize);
|
|
||||||
}
|
|
||||||
|
|
||||||
pStubMsg->BufferMark = pStubMsg->Buffer;
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
||||||
pStubMsg->Buffer += size*esize;
|
pStubMsg->Buffer += size*esize;
|
||||||
|
|
|
@ -113,7 +113,7 @@ static ULONG WINAPI RpcStream_Release(LPSTREAM iface)
|
||||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||||
if (!--(This->RefCount)) {
|
if (!--(This->RefCount)) {
|
||||||
TRACE("size=%ld\n", *This->size);
|
TRACE("size=%ld\n", *This->size);
|
||||||
This->pMsg->Buffer = This->data + *This->size;
|
This->pMsg->Buffer = (unsigned char*)This->data + *This->size;
|
||||||
HeapFree(GetProcessHeap(),0,This);
|
HeapFree(GetProcessHeap(),0,This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,39 +604,39 @@ RPC_STATUS WINAPI RpcStringBindingComposeA(unsigned char *ObjUuid, unsigned char
|
||||||
LPSTR data;
|
LPSTR data;
|
||||||
|
|
||||||
TRACE( "(%s,%s,%s,%s,%s,%p)\n",
|
TRACE( "(%s,%s,%s,%s,%s,%p)\n",
|
||||||
debugstr_a( ObjUuid ), debugstr_a( Protseq ),
|
debugstr_a( (char*)ObjUuid ), debugstr_a( (char*)Protseq ),
|
||||||
debugstr_a( NetworkAddr ), debugstr_a( Endpoint ),
|
debugstr_a( (char*)NetworkAddr ), debugstr_a( (char*)Endpoint ),
|
||||||
debugstr_a( Options ), StringBinding );
|
debugstr_a( (char*)Options ), StringBinding );
|
||||||
|
|
||||||
if (ObjUuid && *ObjUuid) len += strlen(ObjUuid) + 1;
|
if (ObjUuid && *ObjUuid) len += strlen((char*)ObjUuid) + 1;
|
||||||
if (Protseq && *Protseq) len += strlen(Protseq) + 1;
|
if (Protseq && *Protseq) len += strlen((char*)Protseq) + 1;
|
||||||
if (NetworkAddr && *NetworkAddr) len += strlen(NetworkAddr);
|
if (NetworkAddr && *NetworkAddr) len += strlen((char*)NetworkAddr);
|
||||||
if (Endpoint && *Endpoint) len += strlen(Endpoint) + 2;
|
if (Endpoint && *Endpoint) len += strlen((char*)Endpoint) + 2;
|
||||||
if (Options && *Options) len += strlen(Options) + 2;
|
if (Options && *Options) len += strlen((char*)Options) + 2;
|
||||||
|
|
||||||
data = HeapAlloc(GetProcessHeap(), 0, len);
|
data = HeapAlloc(GetProcessHeap(), 0, len);
|
||||||
*StringBinding = data;
|
*StringBinding = (unsigned char*)data;
|
||||||
|
|
||||||
if (ObjUuid && *ObjUuid) {
|
if (ObjUuid && *ObjUuid) {
|
||||||
data += RPCRT4_strcopyA(data, ObjUuid);
|
data += RPCRT4_strcopyA(data, (char*)ObjUuid);
|
||||||
*data++ = '@';
|
*data++ = '@';
|
||||||
}
|
}
|
||||||
if (Protseq && *Protseq) {
|
if (Protseq && *Protseq) {
|
||||||
data += RPCRT4_strcopyA(data, Protseq);
|
data += RPCRT4_strcopyA(data, (char*)Protseq);
|
||||||
*data++ = ':';
|
*data++ = ':';
|
||||||
}
|
}
|
||||||
if (NetworkAddr && *NetworkAddr)
|
if (NetworkAddr && *NetworkAddr)
|
||||||
data += RPCRT4_strcopyA(data, NetworkAddr);
|
data += RPCRT4_strcopyA(data, (char*)NetworkAddr);
|
||||||
|
|
||||||
if ((Endpoint && *Endpoint) ||
|
if ((Endpoint && *Endpoint) ||
|
||||||
(Options && *Options)) {
|
(Options && *Options)) {
|
||||||
*data++ = '[';
|
*data++ = '[';
|
||||||
if (Endpoint && *Endpoint) {
|
if (Endpoint && *Endpoint) {
|
||||||
data += RPCRT4_strcopyA(data, Endpoint);
|
data += RPCRT4_strcopyA(data, (char*)Endpoint);
|
||||||
if (Options && *Options) *data++ = ',';
|
if (Options && *Options) *data++ = ',';
|
||||||
}
|
}
|
||||||
if (Options && *Options) {
|
if (Options && *Options) {
|
||||||
data += RPCRT4_strcopyA(data, Options);
|
data += RPCRT4_strcopyA(data, (char*)Options);
|
||||||
}
|
}
|
||||||
*data++ = ']';
|
*data++ = ']';
|
||||||
}
|
}
|
||||||
|
@ -708,7 +708,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
|
||||||
CHAR *data, *next;
|
CHAR *data, *next;
|
||||||
static const char ep_opt[] = "endpoint=";
|
static const char ep_opt[] = "endpoint=";
|
||||||
|
|
||||||
TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_a(StringBinding),
|
TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_a((char*)StringBinding),
|
||||||
ObjUuid, Protseq, NetworkAddr, Endpoint, Options);
|
ObjUuid, Protseq, NetworkAddr, Endpoint, Options);
|
||||||
|
|
||||||
if (ObjUuid) *ObjUuid = NULL;
|
if (ObjUuid) *ObjUuid = NULL;
|
||||||
|
@ -717,17 +717,17 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
|
||||||
if (Endpoint) *Endpoint = NULL;
|
if (Endpoint) *Endpoint = NULL;
|
||||||
if (Options) *Options = NULL;
|
if (Options) *Options = NULL;
|
||||||
|
|
||||||
data = StringBinding;
|
data = (char*) StringBinding;
|
||||||
|
|
||||||
next = strchr(data, '@');
|
next = strchr(data, '@');
|
||||||
if (next) {
|
if (next) {
|
||||||
if (ObjUuid) *ObjUuid = RPCRT4_strndupA(data, next - data);
|
if (ObjUuid) *ObjUuid = (unsigned char*)RPCRT4_strndupA(data, next - data);
|
||||||
data = next+1;
|
data = next+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
next = strchr(data, ':');
|
next = strchr(data, ':');
|
||||||
if (next) {
|
if (next) {
|
||||||
if (Protseq) *Protseq = RPCRT4_strndupA(data, next - data);
|
if (Protseq) *Protseq = (unsigned char*)RPCRT4_strndupA(data, next - data);
|
||||||
data = next+1;
|
data = next+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
|
||||||
if (next) {
|
if (next) {
|
||||||
CHAR *close, *opt;
|
CHAR *close, *opt;
|
||||||
|
|
||||||
if (NetworkAddr) *NetworkAddr = RPCRT4_strndupA(data, next - data);
|
if (NetworkAddr) *NetworkAddr = (unsigned char*)RPCRT4_strndupA(data, next - data);
|
||||||
data = next+1;
|
data = next+1;
|
||||||
close = strchr(data, ']');
|
close = strchr(data, ']');
|
||||||
if (!close) goto fail;
|
if (!close) goto fail;
|
||||||
|
@ -753,21 +753,21 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
|
||||||
if (!next) {
|
if (!next) {
|
||||||
/* not an option, must be an endpoint */
|
/* not an option, must be an endpoint */
|
||||||
if (*Endpoint) goto fail;
|
if (*Endpoint) goto fail;
|
||||||
*Endpoint = opt;
|
*Endpoint = (unsigned char*) opt;
|
||||||
} else {
|
} else {
|
||||||
if (strncmp(opt, ep_opt, strlen(ep_opt)) == 0) {
|
if (strncmp(opt, ep_opt, strlen(ep_opt)) == 0) {
|
||||||
/* endpoint option */
|
/* endpoint option */
|
||||||
if (*Endpoint) goto fail;
|
if (*Endpoint) goto fail;
|
||||||
*Endpoint = RPCRT4_strdupA(next+1);
|
*Endpoint = (unsigned char*) RPCRT4_strdupA(next+1);
|
||||||
HeapFree(GetProcessHeap(), 0, opt);
|
HeapFree(GetProcessHeap(), 0, opt);
|
||||||
} else {
|
} else {
|
||||||
/* network option */
|
/* network option */
|
||||||
if (*Options) {
|
if (*Options) {
|
||||||
/* FIXME: this is kind of inefficient */
|
/* FIXME: this is kind of inefficient */
|
||||||
*Options = RPCRT4_strconcatA(*Options, opt);
|
*Options = (unsigned char*) RPCRT4_strconcatA( (char*)*Options, opt);
|
||||||
HeapFree(GetProcessHeap(), 0, opt);
|
HeapFree(GetProcessHeap(), 0, opt);
|
||||||
} else
|
} else
|
||||||
*Options = opt;
|
*Options = (unsigned char*) opt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -776,7 +776,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
|
||||||
if (*data) goto fail;
|
if (*data) goto fail;
|
||||||
}
|
}
|
||||||
else if (NetworkAddr)
|
else if (NetworkAddr)
|
||||||
*NetworkAddr = RPCRT4_strdupA(data);
|
*NetworkAddr = (unsigned char*)RPCRT4_strdupA(data);
|
||||||
|
|
||||||
return RPC_S_OK;
|
return RPC_S_OK;
|
||||||
|
|
||||||
|
@ -942,7 +942,7 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingA( unsigned char *StringBinding, RP
|
||||||
unsigned char *ObjectUuid, *Protseq, *NetworkAddr, *Endpoint, *Options;
|
unsigned char *ObjectUuid, *Protseq, *NetworkAddr, *Endpoint, *Options;
|
||||||
UUID Uuid;
|
UUID Uuid;
|
||||||
|
|
||||||
TRACE("(%s,%p)\n", debugstr_a(StringBinding), Binding);
|
TRACE("(%s,%p)\n", debugstr_a((char*)StringBinding), Binding);
|
||||||
|
|
||||||
ret = RpcStringBindingParseA(StringBinding, &ObjectUuid, &Protseq,
|
ret = RpcStringBindingParseA(StringBinding, &ObjectUuid, &Protseq,
|
||||||
&NetworkAddr, &Endpoint, &Options);
|
&NetworkAddr, &Endpoint, &Options);
|
||||||
|
@ -951,11 +951,11 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingA( unsigned char *StringBinding, RP
|
||||||
ret = UuidFromStringA(ObjectUuid, &Uuid);
|
ret = UuidFromStringA(ObjectUuid, &Uuid);
|
||||||
|
|
||||||
if (ret == RPC_S_OK)
|
if (ret == RPC_S_OK)
|
||||||
ret = RPCRT4_CreateBindingA(&bind, FALSE, Protseq);
|
ret = RPCRT4_CreateBindingA(&bind, FALSE, (char*)Protseq);
|
||||||
if (ret == RPC_S_OK)
|
if (ret == RPC_S_OK)
|
||||||
ret = RPCRT4_SetBindingObject(bind, &Uuid);
|
ret = RPCRT4_SetBindingObject(bind, &Uuid);
|
||||||
if (ret == RPC_S_OK)
|
if (ret == RPC_S_OK)
|
||||||
ret = RPCRT4_CompleteBindingA(bind, NetworkAddr, Endpoint, Options);
|
ret = RPCRT4_CompleteBindingA(bind, (char*)NetworkAddr, (char*)Endpoint, (char*)Options);
|
||||||
|
|
||||||
RpcStringFreeA((unsigned char**)&Options);
|
RpcStringFreeA((unsigned char**)&Options);
|
||||||
RpcStringFreeA((unsigned char**)&Endpoint);
|
RpcStringFreeA((unsigned char**)&Endpoint);
|
||||||
|
@ -1024,8 +1024,8 @@ RPC_STATUS WINAPI RpcBindingToStringBindingA( RPC_BINDING_HANDLE Binding, unsign
|
||||||
ret = UuidToStringA(&bind->ObjectUuid, (unsigned char**)&ObjectUuid);
|
ret = UuidToStringA(&bind->ObjectUuid, (unsigned char**)&ObjectUuid);
|
||||||
if (ret != RPC_S_OK) return ret;
|
if (ret != RPC_S_OK) return ret;
|
||||||
|
|
||||||
ret = RpcStringBindingComposeA(ObjectUuid, bind->Protseq, bind->NetworkAddr,
|
ret = RpcStringBindingComposeA((unsigned char*) ObjectUuid, (unsigned char*)bind->Protseq, (unsigned char*) bind->NetworkAddr,
|
||||||
bind->Endpoint, NULL, StringBinding);
|
(unsigned char*) bind->Endpoint, NULL, StringBinding);
|
||||||
|
|
||||||
RpcStringFreeA((unsigned char**)&ObjectUuid);
|
RpcStringFreeA((unsigned char**)&ObjectUuid);
|
||||||
|
|
||||||
|
@ -1041,7 +1041,7 @@ RPC_STATUS WINAPI RpcBindingToStringBindingW( RPC_BINDING_HANDLE Binding, unsign
|
||||||
unsigned char *str = NULL;
|
unsigned char *str = NULL;
|
||||||
TRACE("(%p,%p)\n", Binding, StringBinding);
|
TRACE("(%p,%p)\n", Binding, StringBinding);
|
||||||
ret = RpcBindingToStringBindingA(Binding, &str);
|
ret = RpcBindingToStringBindingA(Binding, &str);
|
||||||
*StringBinding = RPCRT4_strdupAtoW(str);
|
*StringBinding = RPCRT4_strdupAtoW((char*)str);
|
||||||
RpcStringFreeA((unsigned char**)&str);
|
RpcStringFreeA((unsigned char**)&str);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1071,7 +1071,7 @@ RPC_STATUS WINAPI RpcNetworkIsProtseqValidA(unsigned char *protseq) {
|
||||||
|
|
||||||
if (!protseq) return RPC_S_INVALID_RPC_PROTSEQ; /* ? */
|
if (!protseq) return RPC_S_INVALID_RPC_PROTSEQ; /* ? */
|
||||||
|
|
||||||
if (RtlCreateUnicodeStringFromAsciiz(&protseqW, protseq)) {
|
if (RtlCreateUnicodeStringFromAsciiz(&protseqW, (char*)protseq)) {
|
||||||
RPC_STATUS ret = RpcNetworkIsProtseqValidW(protseqW.Buffer);
|
RPC_STATUS ret = RpcNetworkIsProtseqValidW(protseqW.Buffer);
|
||||||
RtlFreeUnicodeString(&protseqW);
|
RtlFreeUnicodeString(&protseqW);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -78,7 +78,7 @@ static CRITICAL_SECTION_DEBUG server_cs_debug =
|
||||||
{
|
{
|
||||||
0, 0, &server_cs,
|
0, 0, &server_cs,
|
||||||
{ &server_cs_debug.ProcessLocksList, &server_cs_debug.ProcessLocksList },
|
{ &server_cs_debug.ProcessLocksList, &server_cs_debug.ProcessLocksList },
|
||||||
0, 0, { 0, (DWORD)(__FILE__ ": server_cs") }
|
0, 0, { (DWORD_PTR)(__FILE__ ": server_cs") }
|
||||||
};
|
};
|
||||||
static CRITICAL_SECTION server_cs = { &server_cs_debug, -1, 0, 0, 0, 0 };
|
static CRITICAL_SECTION server_cs = { &server_cs_debug, -1, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ static CRITICAL_SECTION_DEBUG listen_cs_debug =
|
||||||
{
|
{
|
||||||
0, 0, &listen_cs,
|
0, 0, &listen_cs,
|
||||||
{ &listen_cs_debug.ProcessLocksList, &listen_cs_debug.ProcessLocksList },
|
{ &listen_cs_debug.ProcessLocksList, &listen_cs_debug.ProcessLocksList },
|
||||||
0, 0, { 0, (DWORD)(__FILE__ ": listen_cs") }
|
0, 0, { (DWORD_PTR)(__FILE__ ": listen_cs") }
|
||||||
};
|
};
|
||||||
static CRITICAL_SECTION listen_cs = { &listen_cs_debug, -1, 0, 0, 0, 0 };
|
static CRITICAL_SECTION listen_cs = { &listen_cs_debug, -1, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ static CRITICAL_SECTION_DEBUG spacket_cs_debug =
|
||||||
{
|
{
|
||||||
0, 0, &spacket_cs,
|
0, 0, &spacket_cs,
|
||||||
{ &spacket_cs_debug.ProcessLocksList, &spacket_cs_debug.ProcessLocksList },
|
{ &spacket_cs_debug.ProcessLocksList, &spacket_cs_debug.ProcessLocksList },
|
||||||
0, 0, { 0, (DWORD)(__FILE__ ": spacket_cs") }
|
0, 0, { (DWORD_PTR)(__FILE__ ": spacket_cs") }
|
||||||
};
|
};
|
||||||
static CRITICAL_SECTION spacket_cs = { &spacket_cs_debug, -1, 0, 0, 0, 0 };
|
static CRITICAL_SECTION spacket_cs = { &spacket_cs_debug, -1, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
|
||||||
{
|
{
|
||||||
0, 0, &uuid_cs,
|
0, 0, &uuid_cs,
|
||||||
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
||||||
0, 0, { 0, (DWORD)(__FILE__ ": uuid_cs") }
|
0, 0, { (DWORD_PTR)(__FILE__ ": uuid_cs") }
|
||||||
};
|
};
|
||||||
static CRITICAL_SECTION uuid_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
|
static CRITICAL_SECTION uuid_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue