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.

145 lines
4.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994.
  5. //
  6. // File: transmit.h
  7. //
  8. // Contents: Function prototypes for STGMEDIUM marshalling.
  9. //
  10. // Functions: STGMEDIUM_to_xmit
  11. // STGMEDIUM_from_xmit
  12. // STGMEDIUM_free_inst
  13. //
  14. // History: May-10-94 ShannonC Created
  15. // History: May-10-95 Ryszardk wire_marshal changes
  16. //
  17. //--------------------------------------------------------------------------
  18. #ifndef __TRANSMIT_H__
  19. #define __TRANSMIT_H__
  20. #if (DBG==1)
  21. #include <debnot.h>
  22. DECLARE_DEBUG(UserNdr)
  23. //
  24. #define UserNdrDebugOut(x)
  25. #define UserNdrAssert(x)
  26. #define UserNdrVerify(x)
  27. //#define UNDR_FORCE DEB_FORCE
  28. #define UNDR_FORCE 0
  29. #define UNDR_OUT1 0
  30. #define UNDR_OUT4 0
  31. EXTERN_C char *
  32. WdtpGetStgmedName( STGMEDIUM * );
  33. #else
  34. #define UserNdrDebugOut(x)
  35. #define UserNdrAssert(x)
  36. #define UserNdrVerify(x)
  37. #define UNDR_FORCE 0
  38. #define UNDR_OUT1 0
  39. #define UNDR_OUT4 0
  40. #endif
  41. // Shortcut typedefs.
  42. typedef unsigned char uchar;
  43. typedef unsigned short ushort;
  44. typedef unsigned long ulong;
  45. typedef unsigned int uint;
  46. #ifndef TRUE
  47. #define TRUE (1)
  48. #define FALSE (0)
  49. typedef unsigned short BOOL;
  50. #endif
  51. #define ALIGN( pStuff, cAlign ) \
  52. pStuff = (unsigned char *)((ulong)((pStuff) + (cAlign)) & ~ (cAlign))
  53. #define LENGTH_ALIGN( Length, cAlign ) \
  54. Length = (((Length) + (cAlign)) & ~ (cAlign))
  55. #define PCHAR_LV_CAST *(char __RPC_FAR * __RPC_FAR *)&
  56. #define PSHORT_LV_CAST *(short __RPC_FAR * __RPC_FAR *)&
  57. #define PLONG_LV_CAST *(long __RPC_FAR * __RPC_FAR *)&
  58. #define PHYPER_LV_CAST *(hyper __RPC_FAR * __RPC_FAR *)&
  59. #define PUSHORT_LV_CAST *(unsigned short __RPC_FAR * __RPC_FAR *)&
  60. #define PULONG_LV_CAST *(unsigned long __RPC_FAR * __RPC_FAR *)&
  61. #define USER_MARSHAL_MARKER 0x72657355
  62. // These are based on flags defined in wtypes.idl comming from the channel
  63. #define INPROC_CALL( Flags) (USER_CALL_CTXT_MASK(Flags) == MSHCTX_INPROC)
  64. #define REMOTE_CALL( Flags) ((USER_CALL_CTXT_MASK(Flags) == MSHCTX_DIFFERENTMACHINE) \
  65. || (USER_CALL_CTXT_MASK(Flags) == MSHCTX_NOSHAREDMEM))
  66. // There is a difference in the scope of handles, Daytona vs. Chicago.
  67. // The following is an illustration of the notions of strict and lax passing.
  68. // rpc call as defined by the flags above
  69. // Daytona rules
  70. //I------------I----------------I-----------------------------------I
  71. //I inproc I same machine I diff. machine (a.k.a "remote" ) I
  72. //I------------I----------------------------------------------------I
  73. //| HGLOBL h.p.| HGLOBAL data passing |
  74. //|------------|----------------------------------------------------|
  75. //| GDI h.p. | GDI data passing |
  76. //|------------|----------------------------------------------------|
  77. // Chicago rules
  78. //I------------I----------------I-----------------------------------I
  79. //I inproc I same machine I diff. machine (a.k.a "remote" ) I
  80. //I------------I----------------------------------------------------I
  81. //| HGLOBL h.p.| HGLOBAL data passing |
  82. //|-----------------------------------------------------------------|
  83. //| GDI handle passing | GDI data passing |
  84. //|-----------------------------|-----------------------------------|
  85. #define HGLOBAL_HANDLE_PASSING( Flags ) INPROC_CALL( Flags)
  86. #define HGLOBAL_DATA_PASSING( Flags ) (! INPROC_CALL( Flags))
  87. // On Chicago, some handles are valid between processes.
  88. #if defined(_CHICAGO_)
  89. #define GDI_HANDLE_PASSING( Flags ) (! REMOTE_CALL( Flags ))
  90. #define GDI_DATA_PASSING( Flags ) REMOTE_CALL( Flags )
  91. #else
  92. #define GDI_HANDLE_PASSING( Flags ) HGLOBAL_HANDLE_PASSING( Flags )
  93. #define GDI_DATA_PASSING( Flags ) HGLOBAL_DATA_PASSING( Flags )
  94. #endif
  95. #define WDT_DATA_MARKER WDT_REMOTE_CALL
  96. #define WDT_HANDLE_MARKER WDT_INPROC_CALL
  97. #define IS_DATA_MARKER( dw ) (WDT_REMOTE_CALL == dw)
  98. #define WdtpMemoryCopy(Destination, Source, Length) \
  99. RtlCopyMemory(Destination, Source, Length)
  100. #define WdtpZeroMemory(Destination, Length) \
  101. RtlZeroMemory(Destination, Length)
  102. #define WdtpAllocate(p,size) \
  103. ((USER_MARSHAL_CB *)p)->pStubMsg->pfnAllocate( size )
  104. #define WdtpFree(pf,ptr) \
  105. ((USER_MARSHAL_CB *)pf)->pStubMsg->pfnFree( ptr )
  106. EXTERN_C
  107. void NukeHandleAndReleasePunk(
  108. STGMEDIUM * pStgmed );
  109. #endif // __TRANSMIT_H__
  110.