Sync to Wine-20050830:

Robert Shearman <rob@codeweavers.com>
- Don't free previous buffer in NdrGetBuffer.
- Add stubs for NdrMapCommAndFaultStatus, conformant string marshaling
  and context handle functions.
Alexandre Julliard <julliard@winehq.org>
- Don't prefix the functions DllCanUnloadNow, DllGetClassObject and
  Dll(Un)RegisterServer with the dll name so that the compiler can check
  the prototypes.
Mike McCormack <mike@codeweavers.com>
- Fix some gcc 4.0 warnings.

svn path=/trunk/; revision=17683
This commit is contained in:
Gé van Geldorp 2005-09-05 22:20:04 +00:00
parent 2372be838c
commit eae95884a8
9 changed files with 701 additions and 630 deletions

View file

@ -1,30 +0,0 @@
EXTRADEFS = -D_RPCRT4_ -DCOM_NO_WINDOWS_H -DMSWMSG
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = rpcrt4.dll
IMPORTLIB = librpcrt4.$(IMPLIBEXT)
IMPORTS = iphlpapi advapi32 kernel32 ntdll
EXTRALIBS = -luuid
C_SRCS = \
cproxy.c \
cpsf.c \
cstub.c \
ndr_marshall.c \
ndr_midl.c \
ndr_ole.c \
ndr_stubless.c \
rpc_binding.c \
rpc_epmap.c \
rpc_message.c \
rpc_server.c \
rpcrt4_main.c \
rpcss_np_client.c
SUBDIRS = tests
@MAKE_DLL_RULES@
### Dependencies:

View file

@ -183,11 +183,11 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
if (RegCreateKeyExA(HKEY_CLASSES_ROOT, keyname, 0, NULL, 0,
KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) {
if (name)
RegSetValueExA(key, NULL, 0, REG_SZ, name, strlen(name));
RegSetValueExA(key, NULL, 0, REG_SZ, (LPBYTE)name, strlen(name));
if (RegCreateKeyExA(key, "ProxyStubClsid32", 0, NULL, 0,
KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS) {
snprintf(module, sizeof(module), "{%s}", clsid);
RegSetValueExA(subkey, NULL, 0, REG_SZ, module, strlen(module));
RegSetValueExA(subkey, NULL, 0, REG_SZ, (LPBYTE)module, strlen(module));
RegCloseKey(subkey);
}
RegCloseKey(key);
@ -205,7 +205,7 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) {
if (RegCreateKeyExA(key, "InProcServer32", 0, NULL, 0,
KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS) {
RegSetValueExA(subkey, NULL, 0, REG_SZ, module, strlen(module));
RegSetValueExA(subkey, NULL, 0, REG_SZ, (LPBYTE)module, strlen(module));
RegCloseKey(subkey);
}
RegCloseKey(key);

View file

@ -125,7 +125,8 @@ NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = {
NdrComplexArrayMarshall,
/* 0x22 */
NdrConformantStringMarshall, 0, 0,
NdrConformantStringMarshall, 0, 0, 0, 0,
NdrConformantStringMarshall,
NdrNonConformantStringMarshall, 0, 0, 0,
/* 0x2a */
NdrEncapsulatedUnionMarshall,
NdrNonEncapsulatedUnionMarshall,
@ -158,7 +159,8 @@ NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE] = {
NdrComplexArrayUnmarshall,
/* 0x22 */
NdrConformantStringUnmarshall, 0, 0,
NdrConformantStringUnmarshall, 0, 0, 0, 0,
NdrConformantStringUnmarshall,
NdrNonConformantStringUnmarshall, 0, 0, 0,
/* 0x2a */
NdrEncapsulatedUnionUnmarshall,
NdrNonEncapsulatedUnionUnmarshall,
@ -191,7 +193,8 @@ NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE] = {
NdrComplexArrayBufferSize,
/* 0x22 */
NdrConformantStringBufferSize, 0, 0,
NdrConformantStringBufferSize, 0, 0, 0, 0,
NdrConformantStringBufferSize,
NdrNonConformantStringBufferSize, 0, 0, 0,
/* 0x2a */
NdrEncapsulatedUnionBufferSize,
NdrNonEncapsulatedUnionBufferSize,
@ -220,7 +223,8 @@ NDR_MEMORYSIZE NdrMemorySizer[NDR_TABLE_SIZE] = {
NdrComplexArrayMemorySize,
/* 0x22 */
NdrConformantStringMemorySize, 0, 0,
NdrConformantStringMemorySize, 0, 0, 0, 0,
NdrConformantStringMemorySize,
NdrNonConformantStringMemorySize, 0, 0, 0,
/* 0x2a */
0, 0, 0, 0, 0,
/* 0x2f */
@ -478,8 +482,8 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
}
else if (*pFormat == RPC_FC_C_CSTRING) {
/* we need 12 octets for the [maxlen, offset, len] DWORDS, + 1 octet for '\0' */
TRACE("string=%s\n", debugstr_a(pMemory));
pStubMsg->BufferLength += strlen(pMemory) + 13 + BUFFER_PARANOIA;
TRACE("string=%s\n", debugstr_a((char*)pMemory));
pStubMsg->BufferLength += strlen((char*)pMemory) + 13 + BUFFER_PARANOIA;
}
else if (*pFormat == RPC_FC_C_WSTRING) {
/* we need 12 octets for the [maxlen, offset, len] DWORDS, + 2 octets for L'\0' */
@ -582,7 +586,7 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
pStubMsg->Buffer += len*esize;
if (*pFormat == RPC_FC_C_CSTRING) {
TRACE("string=%s\n", debugstr_a(pMem));
TRACE("string=%s\n", debugstr_a((char*)pMem));
}
else if (*pFormat == RPC_FC_C_WSTRING) {
TRACE("string=%s\n", debugstr_w((LPWSTR)pMem));
@ -591,6 +595,49 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
return NULL; /* FIXME: is this always right? */
}
/***********************************************************************
* NdrNonConformantStringMarshall [RPCRT4.@]
*/
unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
FIXME("stub\n");
return NULL;
}
/***********************************************************************
* NdrNonConformantStringUnmarshall [RPCRT4.@]
*/
unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char **ppMemory,
PFORMAT_STRING pFormat,
unsigned char fMustAlloc)
{
FIXME("stub\n");
return NULL;
}
/***********************************************************************
* NdrNonConformantStringBufferSize [RPCRT4.@]
*/
void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
FIXME("stub\n");
}
/***********************************************************************
* NdrNonConformantStringMemorySize [RPCRT4.@]
*/
unsigned long WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
FIXME("stub\n");
return 0;
}
static inline void dump_pointer_attr(unsigned char attr)
{
if (attr & RPC_FC_P_ALLOCALLNODES)
@ -2659,8 +2706,56 @@ void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
* NdrClientContextUnmarshall
*/
void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
NDR_CCONTEXT * pContextHandle,
RPC_BINDING_HANDLE BindHandle)
NDR_CCONTEXT * pContextHandle,
RPC_BINDING_HANDLE BindHandle)
{
FIXME("(%p, %p, %p): stub\n", pStubMsg, pContextHandle, BindHandle);
}
void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
NDR_SCONTEXT ContextHandle,
NDR_RUNDOWN RundownRoutine )
{
FIXME("(%p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine);
}
NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg)
{
FIXME("(%p): stub\n", pStubMsg);
return NULL;
}
void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char* pMemory,
PFORMAT_STRING pFormat)
{
FIXME("(%p, %p, %p): stub\n", pStubMsg, pMemory, pFormat);
}
NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
return NULL;
}
void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,
NDR_SCONTEXT ContextHandle,
NDR_RUNDOWN RundownRoutine,
PFORMAT_STRING pFormat)
{
FIXME("(%p, %p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine, pFormat);
}
NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
return NULL;
}
RPC_BINDING_HANDLE WINAPI NDRCContextBinding(NDR_CCONTEXT CContext)
{
FIXME("(%p): stub\n", CContext);
return NULL;
}

View file

@ -292,3 +292,19 @@ unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *pStubMsg, unsigned char
/* FIXME: is this the right return value? */
return NULL;
}
/************************************************************************
* NdrMapCommAndFaultStatus [RPCRT4.@]
*/
RPC_STATUS RPC_ENTRY NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg,
unsigned long *pCommStatus,
unsigned long *pFaultStatus,
RPC_STATUS Status )
{
FIXME("(%p, %p, %p, %ld): stub\n", pStubMsg, pCommStatus, pFaultStatus, Status);
*pCommStatus = 0;
*pFaultStatus = 0;
return RPC_S_OK;
}

View file

@ -76,7 +76,7 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind
unsigned long c;
RPC_STATUS rslt = RPC_S_OK;
TRACE("(%p,%p,%p,%s)\n", IfSpec, BindingVector, UuidVector, debugstr_a(Annotation));
TRACE("(%p,%p,%p,%s)\n", IfSpec, BindingVector, UuidVector, debugstr_a((char*)Annotation));
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
for (c=0; c<BindingVector->Count; c++) {
RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[c]);

View file

@ -483,19 +483,10 @@ fail:
*/
RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
{
RpcBinding* bind = (RpcBinding*)pMsg->Handle;
TRACE("(%p): BufferLength=%d\n", pMsg, pMsg->BufferLength);
/* FIXME: pfnAllocate? */
if (bind->server) {
/* it turns out that the original buffer data must still be available
* while the RPC server is marshalling a reply, so we should not deallocate
* it, we'll leave deallocating the original buffer to the RPC server */
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
} else {
HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
}
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
TRACE("Buffer=%p\n", pMsg->Buffer);
/* FIXME: which errors to return? */
return pMsg->Buffer ? S_OK : E_OUTOFMEMORY;

View file

@ -739,14 +739,14 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExA( unsigned char *Protseq, UINT MaxCall
{
RpcServerProtseq* ps;
TRACE("(%s,%u,%s,%p,{%u,%lu,%lu})\n", debugstr_a( Protseq ), MaxCalls,
debugstr_a( Endpoint ), SecurityDescriptor,
TRACE("(%s,%u,%s,%p,{%u,%lu,%lu})\n", debugstr_a( (char*)Protseq ), MaxCalls,
debugstr_a( (char*)Endpoint ), SecurityDescriptor,
lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
ps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcServerProtseq));
ps->MaxCalls = MaxCalls;
ps->Protseq = RPCRT4_strdupA(Protseq);
ps->Endpoint = RPCRT4_strdupA(Endpoint);
ps->Protseq = RPCRT4_strdupA((char*)Protseq);
ps->Endpoint = RPCRT4_strdupA((char*)Endpoint);
return RPCRT4_use_protseq(ps);
}
@ -776,7 +776,7 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( LPWSTR Protseq, UINT MaxCalls, LPWST
*/
RPC_STATUS WINAPI RpcServerUseProtseqA(unsigned char *Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
{
TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_a(Protseq), MaxCalls, SecurityDescriptor);
TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_a((char*)Protseq), MaxCalls, SecurityDescriptor);
return RpcServerUseProtseqEpA(Protseq, MaxCalls, NULL, SecurityDescriptor);
}

File diff suppressed because it is too large Load diff

View file

@ -536,7 +536,7 @@ RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, unsigned char** StringUuid)
if (!Uuid) Uuid = &uuid_nil;
sprintf(*StringUuid, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
sprintf( (char*)*StringUuid, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Uuid->Data1, Uuid->Data2, Uuid->Data3,
Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2],
Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5],
@ -587,14 +587,13 @@ static const BYTE hex2bin[] =
/***********************************************************************
* UuidFromStringA (RPCRT4.@)
*/
RPC_STATUS WINAPI UuidFromStringA(unsigned char* str, UUID *uuid)
RPC_STATUS WINAPI UuidFromStringA(unsigned char* s, UUID *uuid)
{
BYTE *s = (BYTE *)str;
int i;
if (!s) return UuidCreateNil( uuid );
if (strlen(s) != 36) return RPC_S_INVALID_STRING_UUID;
if (strlen((char*)s) != 36) return RPC_S_INVALID_STRING_UUID;
if ((s[8]!='-') || (s[13]!='-') || (s[18]!='-') || (s[23]!='-'))
return RPC_S_INVALID_STRING_UUID;
@ -668,7 +667,7 @@ RPC_STATUS WINAPI UuidFromStringW(unsigned short* s, UUID *uuid)
* DllRegisterServer (RPCRT4.@)
*/
HRESULT WINAPI RPCRT4_DllRegisterServer( void )
HRESULT WINAPI DllRegisterServer( void )
{
FIXME( "(): stub\n" );
return S_OK;
@ -810,7 +809,7 @@ RPC_STATUS RPC_ENTRY DceErrorInqTextA (RPC_STATUS e, unsigned char *buffer)
WCHAR bufferW [MAX_RPC_ERROR_TEXT];
if ((status = DceErrorInqTextW (e, bufferW)) == RPC_S_OK)
{
if (!WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, MAX_RPC_ERROR_TEXT,
if (!WideCharToMultiByte(CP_ACP, 0, bufferW, -1, (LPSTR)buffer, MAX_RPC_ERROR_TEXT,
NULL, NULL))
{
ERR ("Failed to translate error");