mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 14:10:32 +00:00
- Make explicit some missing include dependencies.
- Implement NdrGetBuffer, NdrFreeBuffer, NdrConformantStringBufferSize and NdrConformantStringMarshall. - Define the RPC_FC_C_CSTRING constant. - Perhaps I don't want those MIDL_*_FORMAT_STRING structs, after all. Removed. - Add RPC todo list. - MIDL_STUB_MESSAGE.uFlags aren't. - Comment out the NdrClientCall2 mock-up since that stuff is in the process of being implemented and might cause problems.
This commit is contained in:
parent
9134f37e27
commit
4a37d84a9d
@ -24,26 +24,56 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "winreg.h"
|
||||
|
||||
#include "ndr_misc.h"
|
||||
|
||||
#include "wine/rpcfc.h"
|
||||
#include "wine/obj_base.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
#define BUFFER_PARANOIA 40
|
||||
|
||||
/***********************************************************************
|
||||
* NdrConformantStringMarshall [RPCRT4.@]
|
||||
*/
|
||||
unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pszMessage,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
return NULL;
|
||||
UINT32 len, i;
|
||||
unsigned char *c;
|
||||
|
||||
TRACE("(pStubMsg == ^%p, pszMessage == ^%p, pFormat == ^%p)\n", pStubMsg, pszMessage, pFormat);
|
||||
|
||||
if (*pFormat == RPC_FC_C_CSTRING) {
|
||||
len = strlen(pszMessage);
|
||||
assert( (pStubMsg->BufferLength > (len + 13)) && (pStubMsg->Buffer != NULL) );
|
||||
/* in DCE terminology this is a Conformant Varying String */
|
||||
c = pStubMsg->Buffer;
|
||||
ZeroMemory(c, 12);
|
||||
*((UINT32 *)c) = len + 1; /* max length: strlen + 1 (for '\0') */
|
||||
c += 8; /* offset: 0 */
|
||||
*((UINT32 *)c) = len + 1; /* actual length: (same) */
|
||||
c += 4;
|
||||
for (i = 0; i <= len; i++)
|
||||
*(c++) = *(pszMessage++); /* copy the string itself into the remaining space */
|
||||
} else {
|
||||
ERR("Unhandled string type: %#x\n", *pFormat);
|
||||
/* FIXME what to do here? */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* success */
|
||||
pStubMsg->fBufferValid = 1;
|
||||
return NULL; /* is this always right? */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -51,7 +81,14 @@ unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg, u
|
||||
*/
|
||||
void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
|
||||
|
||||
if (*pFormat == RPC_FC_C_CSTRING) {
|
||||
pStubMsg->BufferLength = strlen(pMemory) + BUFFER_PARANOIA;
|
||||
} else {
|
||||
ERR("Unhandled string type: %#x\n", *pFormat);
|
||||
/* FIXME what to do here? */
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
@ -59,7 +96,7 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned
|
||||
*/
|
||||
unsigned long WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat )
|
||||
{
|
||||
FIXME("stub\n");
|
||||
FIXME("(pStubMsg == ^%p, pFormat == ^%p): stub.\n", pStubMsg, pFormat);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -70,5 +107,7 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
|
||||
PFORMAT_STRING pFormat, unsigned char fMustAlloc )
|
||||
{
|
||||
FIXME("stub\n");
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#undef BUFFER_PARANOIA
|
||||
|
@ -196,15 +196,27 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
|
||||
*/
|
||||
unsigned char *WINAPI NdrGetBuffer(MIDL_STUB_MESSAGE *stubmsg, unsigned long buflen, RPC_BINDING_HANDLE handle)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
return NULL;
|
||||
TRACE("(stubmsg == ^%p, buflen == %lu, handle == %p): wild guess.\n", stubmsg, buflen, handle);
|
||||
|
||||
/* FIXME: What are we supposed to do with the handle? */
|
||||
|
||||
stubmsg->RpcMsg->BufferLength = buflen;
|
||||
if (I_RpcGetBuffer(stubmsg->RpcMsg) != S_OK)
|
||||
return NULL;
|
||||
|
||||
stubmsg->BufferLength = stubmsg->RpcMsg->BufferLength;
|
||||
stubmsg->BufferEnd = stubmsg->BufferStart = 0;
|
||||
return (stubmsg->Buffer = (unsigned char *)stubmsg->RpcMsg->Buffer);
|
||||
}
|
||||
/***********************************************************************
|
||||
* NdrFreeBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrFreeBuffer(MIDL_STUB_MESSAGE *pStubMsg)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
TRACE("(pStubMsg == ^%p): wild guess.\n", pStubMsg);
|
||||
I_RpcFreeBuffer(pStubMsg->RpcMsg);
|
||||
pStubMsg->BufferLength = 0;
|
||||
pStubMsg->Buffer = (unsigned char *)(pStubMsg->RpcMsg->Buffer = NULL);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -23,21 +23,7 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define FORMAT_STRING_PARANOIA 20
|
||||
#define TYPE_FORMAT_STRING_SIZE (5 + FORMAT_STRING_PARANOIA)
|
||||
#define PROC_FORMAT_STRING_SIZE (9 + FORMAT_STRING_PARANOIA)
|
||||
|
||||
typedef struct _MIDL_TYPE_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[TYPE_FORMAT_STRING_SIZE];
|
||||
} MIDL_TYPE_FORMAT_STRING;
|
||||
|
||||
typedef struct _MIDL_PROC_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[PROC_FORMAT_STRING_SIZE];
|
||||
} MIDL_PROC_FORMAT_STRING;
|
||||
#include "rpcndr.h"
|
||||
|
||||
struct IPSFactoryBuffer;
|
||||
|
||||
|
@ -45,9 +45,11 @@ LONG_PTR /* CLIENT_CALL_RETURN */ RPCRT4_NdrClientCall2(PMIDL_STUB_DESC pStubDes
|
||||
|
||||
RPC_CLIENT_INTERFACE *rpc_cli_if = (RPC_CLIENT_INTERFACE *)(pStubDesc->RpcInterfaceInformation);
|
||||
LONG_PTR ret = 0;
|
||||
/*
|
||||
RPC_BINDING_HANDLE handle = 0;
|
||||
RPC_MESSAGE rpcmsg;
|
||||
MIDL_STUB_MESSAGE stubmsg;
|
||||
*/
|
||||
|
||||
FIXME("(pStubDec == ^%p,pFormat = ^%p,...): semi-stub\n", pStubDesc, pFormat);
|
||||
if (rpc_cli_if) /* NULL for objects */ {
|
||||
@ -63,16 +65,18 @@ LONG_PTR /* CLIENT_CALL_RETURN */ RPCRT4_NdrClientCall2(PMIDL_STUB_DESC pStubDes
|
||||
TRACE(" Flags == ^%d\n", rpc_cli_if->Flags);
|
||||
}
|
||||
|
||||
/* for now, while these functons are under development, this is too sketchy. commented out. */
|
||||
/*
|
||||
NdrClientInitializeNew( &rpcmsg, &stubmsg, pStubDesc, 0 );
|
||||
|
||||
handle = (RPC_BINDING_HANDLE)0xdeadbeef; /* FIXME: dce uses interop_binding_handle; */
|
||||
|
||||
stubmsg.BufferLength = 0; /* FIXME */
|
||||
handle = (RPC_BINDING_HANDLE)0xdeadbeef; */ /* FIXME */
|
||||
|
||||
/* stubmsg.BufferLength = 0;*/ /* FIXME */
|
||||
/*
|
||||
NdrGetBuffer( &stubmsg, stubmsg.BufferLength, handle );
|
||||
NdrSendReceive( &stubmsg, stubmsg.Buffer );
|
||||
NdrFreeBuffer( &stubmsg );
|
||||
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,81 @@
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* WINE RPC TODO's (and a few TODONT's)
|
||||
*
|
||||
* - widl is like MIDL for wine. For wine to be a useful RPC platform, quite
|
||||
* a bit of work needs to be done here. widl currently doesn't generate stubs
|
||||
* for RPC invocation -- it will need to; this is tricky because the MIDL compiler
|
||||
* does some really wierd stuff. Then again, we don't neccesarily have to
|
||||
* make widl work like MIDL, so it could be worse.
|
||||
*
|
||||
* - RPC has a quite featureful error handling mechanism; none of it is implemented
|
||||
* right now.
|
||||
*
|
||||
* - The server portions of the patch don't seem to be getting accepted by
|
||||
* Alexandre. My guess is that once I have a working test he'll conceed to
|
||||
* let this in. To implement this properly is tricky and possibly beyond my
|
||||
* abilities; Ove seems to think the right way to do this is to use LPC
|
||||
* (Local Procedure Call, another undocumented monster). LPC has no implementation
|
||||
* in wine and is not going to be trivial to create.
|
||||
*
|
||||
* - There are several different memory allocation schemes for MSRPC.
|
||||
* I don't even understand what they all are yet, much less have them
|
||||
* properly implemented. Surely we are supposed to be doing something with
|
||||
* the user-provided allocation/deallocation functions, but so far,
|
||||
* I don't think we are doing this...
|
||||
*
|
||||
* - MSRPC provides impersonation capabilities which currently are not possible
|
||||
* to implement in wine. At the very least we should implement the authorization
|
||||
* API's & gracefully ignore the irrelevant stuff (to a small extent we already do).
|
||||
*
|
||||
* - Some transports are not yet implemented. The existing transport implementations
|
||||
* are incomplete; the various transports probably ought to be supported in a more
|
||||
* object-oriented manner, like in DCE's RPC implementation, instead of cluttering
|
||||
* up the code with conditionals like we do now.
|
||||
*
|
||||
* - Data marshalling: So far, only the very beginnings of an implementation
|
||||
* exist in wine. NDR protocol is mostly documented, but the MS API's to
|
||||
* convert data-types in memory into NDR are not.
|
||||
*
|
||||
* - ORPC is RPC for OLE; once we have a working RPC framework, we can
|
||||
* use it to implement out-of-process OLE client/server communications.
|
||||
* ATM there is a 100% disconnect between the marshalling in the OLE DLL's
|
||||
* and the marshalling going on here. This is a good thing, since marshalling
|
||||
* doesn't work yet. But once it does, obviously there will be the opportunity
|
||||
* to implement out-of-process OLE using wine's rpcrt4 or some derivative.
|
||||
*
|
||||
* - In-source API Documentation, at least for those functions which we have
|
||||
* implemented, but preferably for everything we can document, would be nice.
|
||||
* I started out being quite good about this, and ended up getting lazy.
|
||||
* Some stuff is undocumented by Microsoft and we are guessing how to implement
|
||||
* (in these cases we should document the behavior we implemented, or, if there
|
||||
* is no implementation, at least hazard some kind of guess, and put a few
|
||||
* question marks after it ;) ).
|
||||
*
|
||||
* - Stubs. Lots of stuff is defined in Microsoft's headers, including undocumented
|
||||
* stuff. So let's make a stub-farm and populate it with as many rpcrt4 api's as
|
||||
* we can stand, so people don't get unimplemented function exceptions.
|
||||
*
|
||||
* - Name services: this part hasn't even been started.
|
||||
*
|
||||
* - Concurrency: right now I don't think (?) we handle more than one request at a time;
|
||||
* we are supposed to be able to do this, and to queue requests which exceed the
|
||||
* concurrency limit.
|
||||
*
|
||||
* - Protocol Towers: Totally unimplemented. I don't even know what these are.
|
||||
*
|
||||
* - Context Handle Rundown: whatever that is.
|
||||
*
|
||||
* - Nested RPC's: Totally unimplemented.
|
||||
*
|
||||
* - Statistics: we are supposed to be keeping various counters. we aren't.
|
||||
*
|
||||
* - Connectionless RPC: unimplemented.
|
||||
*
|
||||
* - ...? More stuff I haven't thought of. If you think of more RPC todo's drop me
|
||||
* an e-mail <gmturner007@ameritech.net> or send a patch to wine-patches.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -24,6 +24,8 @@
|
||||
#ifndef __WINE_RPCNDR_H
|
||||
#define __WINE_RPCNDR_H
|
||||
|
||||
#include "rpc.h"
|
||||
|
||||
#define TARGET_IS_NT40_OR_LATER 1
|
||||
#define TARGET_IS_NT351_OR_WIN95_OR_LATER 1
|
||||
|
||||
@ -93,7 +95,7 @@ typedef struct _MIDL_STUB_MESSAGE
|
||||
int IgnoreEmbeddedPointers;
|
||||
unsigned char *PointerBufferMark;
|
||||
unsigned char fBufferValid;
|
||||
unsigned char uFlags;
|
||||
unsigned char Unused;
|
||||
ULONG_PTR MaxCount;
|
||||
unsigned long Offset;
|
||||
unsigned long ActualCount;
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#define RPC_FC_BOGUS_ARRAY 0x21
|
||||
|
||||
#define RPC_FC_C_CSTRING 0x22
|
||||
#define RPC_FC_C_WSTRING 0x25
|
||||
|
||||
#define RPC_FC_ENCAPSULATED_UNION 0x2a
|
||||
|
Loading…
Reference in New Issue
Block a user