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:
Gé van Geldorp 2005-10-08 17:26:40 +00:00
parent 60725dc6bb
commit b40e1a8202
7 changed files with 54 additions and 56 deletions

View file

@ -176,8 +176,8 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
This->PVtbl = vtbl->Vtbl;
This->lpVtbl = &StdProxy_Vtbl;
/* 1 reference for the proxy and 1 for the object */
This->RefCount = 2;
/* one reference for the proxy */
This->RefCount = 1;
This->stubless = stubless;
This->piid = vtbl->header.piid;
This->pUnkOuter = pUnkOuter;
@ -186,6 +186,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
This->pChannel = NULL;
*ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl;
*ppvObj = &This->PVtbl;
IUnknown_AddRef((IUnknown *)*ppvObj);
IPSFactoryBuffer_AddRef(pPSFactory);
return S_OK;

View file

@ -738,6 +738,11 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->Buffer += 4;
break;
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:
default:
FIXME("unhandled ptr type=%02x\n", type);
@ -1865,18 +1870,10 @@ unsigned char * WINAPI NdrConformantArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pFormat = ReadConformance(pStubMsg, pFormat+4);
size = pStubMsg->MaxCount;
if (fMustAlloc) {
if (fMustAlloc || !*ppMemory)
*ppMemory = NdrAllocate(pStubMsg, 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);
}
memcpy(*ppMemory, pStubMsg->Buffer, size*esize);
pStubMsg->BufferMark = pStubMsg->Buffer;
pStubMsg->Buffer += size*esize;

View file

@ -113,7 +113,7 @@ static ULONG WINAPI RpcStream_Release(LPSTREAM iface)
RpcStreamImpl *This = (RpcStreamImpl *)iface;
if (!--(This->RefCount)) {
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);
return 0;
}

View file

@ -604,39 +604,39 @@ RPC_STATUS WINAPI RpcStringBindingComposeA(unsigned char *ObjUuid, unsigned char
LPSTR data;
TRACE( "(%s,%s,%s,%s,%s,%p)\n",
debugstr_a( ObjUuid ), debugstr_a( Protseq ),
debugstr_a( NetworkAddr ), debugstr_a( Endpoint ),
debugstr_a( Options ), StringBinding );
debugstr_a( (char*)ObjUuid ), debugstr_a( (char*)Protseq ),
debugstr_a( (char*)NetworkAddr ), debugstr_a( (char*)Endpoint ),
debugstr_a( (char*)Options ), StringBinding );
if (ObjUuid && *ObjUuid) len += strlen(ObjUuid) + 1;
if (Protseq && *Protseq) len += strlen(Protseq) + 1;
if (NetworkAddr && *NetworkAddr) len += strlen(NetworkAddr);
if (Endpoint && *Endpoint) len += strlen(Endpoint) + 2;
if (Options && *Options) len += strlen(Options) + 2;
if (ObjUuid && *ObjUuid) len += strlen((char*)ObjUuid) + 1;
if (Protseq && *Protseq) len += strlen((char*)Protseq) + 1;
if (NetworkAddr && *NetworkAddr) len += strlen((char*)NetworkAddr);
if (Endpoint && *Endpoint) len += strlen((char*)Endpoint) + 2;
if (Options && *Options) len += strlen((char*)Options) + 2;
data = HeapAlloc(GetProcessHeap(), 0, len);
*StringBinding = data;
*StringBinding = (unsigned char*)data;
if (ObjUuid && *ObjUuid) {
data += RPCRT4_strcopyA(data, ObjUuid);
data += RPCRT4_strcopyA(data, (char*)ObjUuid);
*data++ = '@';
}
if (Protseq && *Protseq) {
data += RPCRT4_strcopyA(data, Protseq);
data += RPCRT4_strcopyA(data, (char*)Protseq);
*data++ = ':';
}
if (NetworkAddr && *NetworkAddr)
data += RPCRT4_strcopyA(data, NetworkAddr);
data += RPCRT4_strcopyA(data, (char*)NetworkAddr);
if ((Endpoint && *Endpoint) ||
(Options && *Options)) {
*data++ = '[';
if (Endpoint && *Endpoint) {
data += RPCRT4_strcopyA(data, Endpoint);
data += RPCRT4_strcopyA(data, (char*)Endpoint);
if (Options && *Options) *data++ = ',';
}
if (Options && *Options) {
data += RPCRT4_strcopyA(data, Options);
data += RPCRT4_strcopyA(data, (char*)Options);
}
*data++ = ']';
}
@ -708,7 +708,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
CHAR *data, *next;
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);
if (ObjUuid) *ObjUuid = NULL;
@ -717,17 +717,17 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
if (Endpoint) *Endpoint = NULL;
if (Options) *Options = NULL;
data = StringBinding;
data = (char*) StringBinding;
next = strchr(data, '@');
if (next) {
if (ObjUuid) *ObjUuid = RPCRT4_strndupA(data, next - data);
if (ObjUuid) *ObjUuid = (unsigned char*)RPCRT4_strndupA(data, next - data);
data = next+1;
}
next = strchr(data, ':');
if (next) {
if (Protseq) *Protseq = RPCRT4_strndupA(data, next - data);
if (Protseq) *Protseq = (unsigned char*)RPCRT4_strndupA(data, next - data);
data = next+1;
}
@ -735,7 +735,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
if (next) {
CHAR *close, *opt;
if (NetworkAddr) *NetworkAddr = RPCRT4_strndupA(data, next - data);
if (NetworkAddr) *NetworkAddr = (unsigned char*)RPCRT4_strndupA(data, next - data);
data = next+1;
close = strchr(data, ']');
if (!close) goto fail;
@ -753,21 +753,21 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
if (!next) {
/* not an option, must be an endpoint */
if (*Endpoint) goto fail;
*Endpoint = opt;
*Endpoint = (unsigned char*) opt;
} else {
if (strncmp(opt, ep_opt, strlen(ep_opt)) == 0) {
/* endpoint option */
if (*Endpoint) goto fail;
*Endpoint = RPCRT4_strdupA(next+1);
*Endpoint = (unsigned char*) RPCRT4_strdupA(next+1);
HeapFree(GetProcessHeap(), 0, opt);
} else {
/* network option */
if (*Options) {
/* FIXME: this is kind of inefficient */
*Options = RPCRT4_strconcatA(*Options, opt);
*Options = (unsigned char*) RPCRT4_strconcatA( (char*)*Options, opt);
HeapFree(GetProcessHeap(), 0, opt);
} else
*Options = opt;
*Options = (unsigned char*) opt;
}
}
}
@ -776,7 +776,7 @@ RPC_STATUS WINAPI RpcStringBindingParseA( unsigned char *StringBinding, unsigned
if (*data) goto fail;
}
else if (NetworkAddr)
*NetworkAddr = RPCRT4_strdupA(data);
*NetworkAddr = (unsigned char*)RPCRT4_strdupA(data);
return RPC_S_OK;
@ -942,7 +942,7 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingA( unsigned char *StringBinding, RP
unsigned char *ObjectUuid, *Protseq, *NetworkAddr, *Endpoint, *Options;
UUID Uuid;
TRACE("(%s,%p)\n", debugstr_a(StringBinding), Binding);
TRACE("(%s,%p)\n", debugstr_a((char*)StringBinding), Binding);
ret = RpcStringBindingParseA(StringBinding, &ObjectUuid, &Protseq,
&NetworkAddr, &Endpoint, &Options);
@ -951,11 +951,11 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingA( unsigned char *StringBinding, RP
ret = UuidFromStringA(ObjectUuid, &Uuid);
if (ret == RPC_S_OK)
ret = RPCRT4_CreateBindingA(&bind, FALSE, Protseq);
ret = RPCRT4_CreateBindingA(&bind, FALSE, (char*)Protseq);
if (ret == RPC_S_OK)
ret = RPCRT4_SetBindingObject(bind, &Uuid);
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**)&Endpoint);
@ -1024,8 +1024,8 @@ RPC_STATUS WINAPI RpcBindingToStringBindingA( RPC_BINDING_HANDLE Binding, unsign
ret = UuidToStringA(&bind->ObjectUuid, (unsigned char**)&ObjectUuid);
if (ret != RPC_S_OK) return ret;
ret = RpcStringBindingComposeA(ObjectUuid, bind->Protseq, bind->NetworkAddr,
bind->Endpoint, NULL, StringBinding);
ret = RpcStringBindingComposeA((unsigned char*) ObjectUuid, (unsigned char*)bind->Protseq, (unsigned char*) bind->NetworkAddr,
(unsigned char*) bind->Endpoint, NULL, StringBinding);
RpcStringFreeA((unsigned char**)&ObjectUuid);
@ -1041,7 +1041,7 @@ RPC_STATUS WINAPI RpcBindingToStringBindingW( RPC_BINDING_HANDLE Binding, unsign
unsigned char *str = NULL;
TRACE("(%p,%p)\n", Binding, StringBinding);
ret = RpcBindingToStringBindingA(Binding, &str);
*StringBinding = RPCRT4_strdupAtoW(str);
*StringBinding = RPCRT4_strdupAtoW((char*)str);
RpcStringFreeA((unsigned char**)&str);
return ret;
}
@ -1071,7 +1071,7 @@ RPC_STATUS WINAPI RpcNetworkIsProtseqValidA(unsigned char *protseq) {
if (!protseq) return RPC_S_INVALID_RPC_PROTSEQ; /* ? */
if (RtlCreateUnicodeStringFromAsciiz(&protseqW, protseq)) {
if (RtlCreateUnicodeStringFromAsciiz(&protseqW, (char*)protseq)) {
RPC_STATUS ret = RpcNetworkIsProtseqValidW(protseqW.Buffer);
RtlFreeUnicodeString(&protseqW);
return ret;

View file

@ -78,7 +78,7 @@ static CRITICAL_SECTION_DEBUG server_cs_debug =
{
0, 0, &server_cs,
{ &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 };
@ -87,7 +87,7 @@ static CRITICAL_SECTION_DEBUG listen_cs_debug =
{
0, 0, &listen_cs,
{ &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 };
@ -109,7 +109,7 @@ static CRITICAL_SECTION_DEBUG spacket_cs_debug =
{
0, 0, &spacket_cs,
{ &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 };

View file

@ -1,7 +1,7 @@
#include <windows.h>
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS RPC server API\0"
#define REACTOS_STR_INTERNAL_NAME "rpcrt4\0"
#define REACTOS_STR_ORIGINAL_FILENAME "rpcrt4.dll\0"
#include <reactos/version.rc>
#include <windows.h>
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS RPC server API\0"
#define REACTOS_STR_INTERNAL_NAME "rpcrt4\0"
#define REACTOS_STR_ORIGINAL_FILENAME "rpcrt4.dll\0"
#include <reactos/version.rc>

View file

@ -129,7 +129,7 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &uuid_cs,
{ &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 };