Leaked source code of windows server 2003
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.

103 lines
2.3 KiB

  1. /*++
  2. Microsoft Windows
  3. Copyright (c) 1994 Microsoft Corporation. All rights reserved.
  4. Module Name:
  5. proxy.c
  6. Abstract:
  7. Implements the IRpcProxyBuffer interface.
  8. Author:
  9. ShannonC 12-Oct-1994
  10. Environment:
  11. Windows NT and Windows 95 and PowerMac.
  12. We do not support DOS, Win16 and Mac.
  13. Revision History:
  14. --*/
  15. #include "precomp.hxx"
  16. #define USE_STUBLESS_PROXY
  17. #define CINTERFACE
  18. #include <ndrole.h>
  19. #include <rpcproxy.h>
  20. #include <stddef.h>
  21. CStdProxyBuffer * RPC_ENTRY
  22. NdrGetProxyBuffer(
  23. void *pThis);
  24. #pragma code_seg(".ndr64")
  25. void RPC_ENTRY
  26. Ndr64ProxyInitialize(
  27. IN void * pThis,
  28. IN PRPC_MESSAGE pRpcMsg,
  29. IN PMIDL_STUB_MESSAGE pStubMsg,
  30. IN PMIDL_STUBLESS_PROXY_INFO pProxyInfo,
  31. IN unsigned int ProcNum )
  32. /*++
  33. Routine Description:
  34. Initialize the MIDL_STUB_MESSAGE.
  35. Arguments:
  36. pThis - Supplies a pointer to the interface proxy.
  37. pRpcMsg
  38. pStubMsg
  39. pStubDescriptor
  40. ProcNum
  41. Return Value:
  42. --*/
  43. {
  44. CStdProxyBuffer * pProxyBuffer;
  45. HRESULT hr;
  46. pProxyBuffer = NdrGetProxyBuffer(pThis);
  47. //
  48. // Initialize the stub message fields.
  49. //
  50. pStubMsg->dwStubPhase = PROXY_CALCSIZE;
  51. Ndr64ClientInitialize(
  52. pRpcMsg,
  53. pStubMsg,
  54. pProxyInfo,
  55. ProcNum );
  56. //Note that NdrClientInitializeNew sets RPC_FLAGS_VALID_BIT in the ProcNum.
  57. //We don't want to do this for object interfaces, so we clear the flag here.
  58. pRpcMsg->ProcNum &= ~RPC_FLAGS_VALID_BIT;
  59. pStubMsg->pRpcChannelBuffer = pProxyBuffer->pChannel;
  60. //Check if we are connected to a channel.
  61. if(pStubMsg->pRpcChannelBuffer != 0)
  62. {
  63. //AddRef the channel.
  64. //We will release it later in NdrProxyFreeBuffer.
  65. pStubMsg->pRpcChannelBuffer->lpVtbl->AddRef(pStubMsg->pRpcChannelBuffer);
  66. //Get the destination context from the channel
  67. hr = pStubMsg->pRpcChannelBuffer->lpVtbl->GetDestCtx(
  68. pStubMsg->pRpcChannelBuffer, &pStubMsg->dwDestContext, &pStubMsg->pvDestContext);
  69. }
  70. else
  71. {
  72. //We are not connected to a channel.
  73. RpcRaiseException(CO_E_OBJNOTCONNECTED);
  74. }
  75. }