Is it somewhere related to custom marshaling or in DCOM? Also, is it
possible to achieve the same result somehow in .Net?
A part of the code is
int getConfig(
/* [ref][out][in] */ struct rpcConfig __RPC_FAR *r)
{
RPC_BINDING_HANDLE _Handle = 0;
int _RetVal;
RPC_MESSAGE _RpcMessage;
MIDL_STUB_MESSAGE _StubMsg;
RpcTryFinally
{
NdrClientInitializeNew(
( PRPC_MESSAGE )&_RpcMessage,
( PMIDL_STUB_MESSAGE )&_StubMsg,
( PMIDL_STUB_DESC )&chrpc_StubDesc,
10);
_Handle = hCHrpc;
_StubMsg.BufferLength = 0U;
NdrSimpleStructBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
(unsigned char __RPC_FAR *)r,
(PFORMAT_STRING)
&__MIDL_TypeFormatString.Format[156] );
NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg,
_StubMsg.BufferLength, _Handle );
NdrSimpleStructMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
(unsigned char __RPC_FAR *)r,
(PFORMAT_STRING)
&__MIDL_TypeFormatString.Format[156] );
NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char
__RPC_FAR *) _StubMsg.Buffer );
if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) !=
NDR_LOCAL_DATA_REPRESENTATION )
NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING)
&__MIDL_ProcFormatString.Format[38] );
NdrSimpleStructUnmarshall( (PMIDL_STUB_MESSAGE) &_StubMsg,
(unsigned char __RPC_FAR * __RPC_FAR
*)&r,
(PFORMAT_STRING)
&__MIDL_TypeFormatString.Format[156],
(unsigned char)0 );
_RetVal = *(( int __RPC_FAR * )_StubMsg.Buffer)++;
}
RpcFinally
{
NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
}
RpcEndFinally
return _RetVal;
}
Thanks & Regards,
Ashutosh
At first glance I simply thought that this is standard code generated
by the MIDL compiler for a proxy-stub Dll. However, the function
getConfig is not part of a COM interface, so this method is apparently
hand-written (the author has certainly copy-pasted most of it from
MIDL generated code). The struct rpcConfig is not part of the standard
COM headers (at least not with the Platform SDK 2003), so I guess you
should search for the declaration of this struct. You should also look
for any calls of the function getConfig in the Dll code.
Regards,
Stuart
Also, is there any support in .Net for direct RPC, not using
COM/DCOM??? The server application to which this application connects
can't be changed under any circumstances.
Thanks & Regards,
Ashutosh
> Also, is there any support in .Net for direct RPC, not using
> COM/DCOM??? The server application to which this application connects
> can't be changed under any circumstances.
I doubt that. .Net has Remoting, Sockets, COM-support and most
importantly WCF as *the* communication strategy.
But using RPC (if you really must) might be a good project for using
C++/CLI where you can use native APIs to implement and expose .Net
classes which than can be consumed from C# and VB.Net
--
SvenC
Yes you are correct, there is no direct support of RPC in .Net
Thanks & Regards,
Ashutosh