Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
4.5 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name :
  4. srvwrap.c
  5. Abstract :
  6. This file contains the function to dispatch calls to stub worker.
  7. Author :
  8. Yong Qu yongqu Feb 2000 created
  9. Revision History :
  10. ---------------------------------------------------------------------*/
  11. #include "precomp.hxx"
  12. #define CINTERFACE
  13. #define USE_STUBLESS_PROXY
  14. #include "ndrole.h"
  15. #include "rpcproxy.h"
  16. #include "interp2.h"
  17. #include <stdarg.h>
  18. extern long RPC_ENTRY
  19. Ndr64StubWorker(
  20. IRpcStubBuffer * pThis,
  21. IRpcChannelBuffer * pChannel,
  22. PRPC_MESSAGE pRpcMsg,
  23. MIDL_SERVER_INFO * pServerInfo,
  24. const SERVER_ROUTINE * DispatchTable,
  25. MIDL_SYNTAX_INFO * pSyntaxInfo,
  26. ulong * pdwStubPhase
  27. );
  28. RPCRTAPI
  29. void RPC_ENTRY
  30. NdrServerCallNdr64(
  31. PRPC_MESSAGE pRpcMsg
  32. )
  33. /*++
  34. Routine Description :
  35. Server Interpreter entry point for regular RPC procs.
  36. Arguments :
  37. pRpcMsg - The RPC message.
  38. Return :
  39. None.
  40. --*/
  41. {
  42. ulong dwStubPhase = STUB_UNMARSHAL;
  43. PRPC_SERVER_INTERFACE pServerIfInfo;
  44. PMIDL_SERVER_INFO pServerInfo;
  45. const SERVER_ROUTINE * DispatchTable;
  46. NDR_PROC_CONTEXT ProcContext;
  47. MIDL_SYNTAX_INFO * pSyntaxInfo;
  48. pServerIfInfo = (PRPC_SERVER_INTERFACE)pRpcMsg->RpcInterfaceInformation;
  49. pServerInfo = (PMIDL_SERVER_INFO)pServerIfInfo->InterpreterInfo;
  50. DispatchTable = pServerInfo->DispatchTable;
  51. pSyntaxInfo = &pServerInfo->pSyntaxInfo[0];
  52. NDR_ASSERT( XFER_SYNTAX_NDR64 == NdrpGetSyntaxType(&pSyntaxInfo->TransferSyntax),
  53. " invalid transfer syntax" );
  54. Ndr64StubWorker( 0,
  55. 0,
  56. pRpcMsg,
  57. pServerInfo,
  58. DispatchTable,
  59. pSyntaxInfo,
  60. &dwStubPhase );
  61. }
  62. RPCRTAPI
  63. void RPC_ENTRY
  64. NdrServerCallAll(
  65. PRPC_MESSAGE pRpcMsg
  66. )
  67. {
  68. ulong dwStubPhase = STUB_UNMARSHAL;
  69. PRPC_SERVER_INTERFACE pServerIfInfo;
  70. PMIDL_SERVER_INFO pServerInfo;
  71. const SERVER_ROUTINE * DispatchTable;
  72. NDR_PROC_CONTEXT ProcContext;
  73. MIDL_SYNTAX_INFO * pSyntaxInfo;
  74. pServerIfInfo = (PRPC_SERVER_INTERFACE)pRpcMsg->RpcInterfaceInformation;
  75. pServerInfo = (PMIDL_SERVER_INFO)pServerIfInfo->InterpreterInfo;
  76. DispatchTable = pServerInfo->DispatchTable;
  77. // assuming the default transfer syntax is DCE, NDR64 is the second syntaxinfo.
  78. pSyntaxInfo = &pServerInfo->pSyntaxInfo[1];
  79. NDR_ASSERT( XFER_SYNTAX_NDR64 == NdrpGetSyntaxType(&pSyntaxInfo->TransferSyntax),
  80. " invalid transfer syntax" );
  81. Ndr64StubWorker( 0,
  82. 0,
  83. pRpcMsg,
  84. pServerInfo,
  85. DispatchTable,
  86. pSyntaxInfo,
  87. &dwStubPhase );
  88. }
  89. long RPC_ENTRY
  90. NdrStubCall3(
  91. struct IRpcStubBuffer * pThis,
  92. struct IRpcChannelBuffer * pChannel,
  93. PRPC_MESSAGE pRpcMsg,
  94. ulong * pdwStubPhase
  95. )
  96. {
  97. IUnknown * pSrvObj;
  98. CInterfaceStubVtbl * pStubVTable;
  99. PMIDL_SERVER_INFO pServerInfo;
  100. const SERVER_ROUTINE * DispatchTable;
  101. SYNTAX_TYPE SyntaxType;
  102. long i;
  103. MIDL_SYNTAX_INFO * pSyntaxInfo = NULL;
  104. if ( NULL == pRpcMsg->TransferSyntax ||
  105. NdrpGetSyntaxType( pRpcMsg->TransferSyntax ) == XFER_SYNTAX_DCE )
  106. return NdrStubCall2( pThis, pChannel, pRpcMsg, pdwStubPhase );
  107. pSrvObj = (IUnknown * )((CStdStubBuffer *)pThis)->pvServerObject;
  108. DispatchTable = (SERVER_ROUTINE *)pSrvObj->lpVtbl;
  109. pStubVTable = (CInterfaceStubVtbl *)
  110. (*((uchar **)pThis) - sizeof(CInterfaceStubHeader));
  111. pServerInfo = (PMIDL_SERVER_INFO) pStubVTable->header.pServerInfo;
  112. for ( i = 0; i < (long)pServerInfo->nCount; i++ )
  113. {
  114. if ( NdrpGetSyntaxType( &pServerInfo->pSyntaxInfo[i].TransferSyntax ) == XFER_SYNTAX_NDR64 )
  115. {
  116. pSyntaxInfo = &pServerInfo->pSyntaxInfo[i];
  117. break;
  118. }
  119. }
  120. if ( NULL == pSyntaxInfo )
  121. return HRESULT_FROM_WIN32( RPC_S_UNSUPPORTED_TRANS_SYN );
  122. return
  123. Ndr64StubWorker( pThis,
  124. pChannel,
  125. pRpcMsg,
  126. pServerInfo,
  127. DispatchTable,
  128. pSyntaxInfo,
  129. pdwStubPhase );
  130. }