home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / midles.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  6KB  |  219 lines

  1. /*++
  2.  
  3. Copyright 1991-1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     midles.h
  8.  
  9. Abstract:
  10.  
  11.     This module contains definitions needed for encoding/decoding
  12.     support (serializing/deserializing a.k.a. pickling).
  13.  
  14. --*/
  15.  
  16. #ifndef __MIDLES_H__
  17. #define __MIDLES_H__
  18.  
  19. #include <rpcndr.h>
  20.  
  21. //
  22. // Set the packing level for RPC structures for Dos and Windows.
  23. //
  24.  
  25. #if defined(__RPC_DOS__) || defined(__RPC_WIN16__)
  26. #pragma pack(2)
  27. #endif
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. /*
  34.  *  Pickling support
  35.  */
  36. typedef enum
  37. {
  38.     MES_ENCODE,
  39.     MES_DECODE,
  40. } MIDL_ES_CODE;
  41.  
  42. typedef enum
  43. {
  44.     MES_INCREMENTAL_HANDLE,
  45.     MES_FIXED_BUFFER_HANDLE,
  46.     MES_DYNAMIC_BUFFER_HANDLE
  47. } MIDL_ES_HANDLE_STYLE;
  48.  
  49.  
  50. typedef void (__RPC_USER *  MIDL_ES_ALLOC )
  51.                 ( IN OUT  void __RPC_FAR * state,
  52.                   OUT     char __RPC_FAR *  __RPC_FAR * pbuffer,
  53.                   IN OUT  unsigned int __RPC_FAR * psize );
  54.  
  55. typedef void (__RPC_USER *  MIDL_ES_WRITE)
  56.                 ( IN OUT  void __RPC_FAR * state,
  57.                   IN      char __RPC_FAR * buffer,
  58.                   IN      unsigned int  size );
  59.  
  60. typedef void (__RPC_USER *  MIDL_ES_READ)
  61.                 ( IN OUT  void __RPC_FAR * state,
  62.                   OUT     char __RPC_FAR *  __RPC_FAR * pbuffer,
  63.                   IN OUT     unsigned int __RPC_FAR * psize );
  64.  
  65. typedef struct _MIDL_ES_MESSAGE
  66. {
  67.     MIDL_STUB_MESSAGE                       StubMsg;
  68.     MIDL_ES_CODE                            Operation;
  69.     void __RPC_FAR *                        UserState;
  70.     unsigned long                           MesVersion:8;
  71.     unsigned long                           HandleStyle:8;
  72.     unsigned long                           HandleFlags:8;
  73.     unsigned long                           Reserve:8;
  74.     MIDL_ES_ALLOC                           Alloc;
  75.     MIDL_ES_WRITE                           Write;
  76.     MIDL_ES_READ                            Read;
  77.     unsigned char __RPC_FAR *               Buffer;
  78.     unsigned long                           BufferSize;
  79.     unsigned char __RPC_FAR * __RPC_FAR *   pDynBuffer;
  80.     unsigned long __RPC_FAR *               pEncodedSize;
  81.     RPC_SYNTAX_IDENTIFIER                   InterfaceId;
  82.     unsigned long                           ProcNumber;
  83.     unsigned long                           AlienDataRep;
  84.     unsigned long                           IncrDataSize;
  85.     unsigned long                           ByteCount;
  86. } MIDL_ES_MESSAGE, __RPC_FAR * PMIDL_ES_MESSAGE;
  87.  
  88. typedef  PMIDL_ES_MESSAGE  MIDL_ES_HANDLE;
  89.  
  90. RPC_STATUS  RPC_ENTRY
  91. MesEncodeIncrementalHandleCreate(
  92.     void      __RPC_FAR *  UserState,
  93.     MIDL_ES_ALLOC          AllocFn,
  94.     MIDL_ES_WRITE          WriteFn,
  95.     handle_t  __RPC_FAR *  pHandle );
  96.  
  97. RPC_STATUS  RPC_ENTRY
  98. MesDecodeIncrementalHandleCreate(
  99.     void      __RPC_FAR *  UserState,
  100.     MIDL_ES_READ           ReadFn,
  101.     handle_t  __RPC_FAR *  pHandle );
  102.  
  103.  
  104. RPC_STATUS  RPC_ENTRY
  105. MesIncrementalHandleReset(
  106.     handle_t             Handle,
  107.     void    __RPC_FAR *  UserState,
  108.     MIDL_ES_ALLOC        AllocFn,
  109.     MIDL_ES_WRITE        WriteFn,
  110.     MIDL_ES_READ         ReadFn,
  111.     MIDL_ES_CODE         Operation );
  112.  
  113.  
  114. RPC_STATUS  RPC_ENTRY
  115. MesEncodeFixedBufferHandleCreate(
  116.     char __RPC_FAR *            pBuffer,
  117.     unsigned long               BufferSize,
  118.     unsigned long __RPC_FAR *   pEncodedSize,
  119.     handle_t  __RPC_FAR *       pHandle );
  120.  
  121. RPC_STATUS  RPC_ENTRY
  122. MesEncodeDynBufferHandleCreate(
  123.     char __RPC_FAR * __RPC_FAR *    pBuffer,
  124.     unsigned long    __RPC_FAR *    pEncodedSize,
  125.     handle_t  __RPC_FAR *           pHandle );
  126.  
  127. RPC_STATUS  RPC_ENTRY
  128. MesDecodeBufferHandleCreate(
  129.     char __RPC_FAR *        pBuffer,
  130.     unsigned long           BufferSize,
  131.     handle_t  __RPC_FAR *   pHandle );
  132.  
  133.  
  134. RPC_STATUS  RPC_ENTRY
  135. MesBufferHandleReset(
  136.     handle_t                        Handle,
  137.     unsigned long                   HandleStyle,
  138.     MIDL_ES_CODE                    Operation,
  139.     char __RPC_FAR * __RPC_FAR *    pBuffer,
  140.     unsigned long                   BufferSize,
  141.     unsigned long __RPC_FAR *       pEncodedSize );
  142.  
  143.  
  144. RPC_STATUS  RPC_ENTRY
  145. MesHandleFree( handle_t  Handle );
  146.  
  147. RPC_STATUS  RPC_ENTRY
  148. MesInqProcEncodingId(
  149.     handle_t                    Handle,
  150.     PRPC_SYNTAX_IDENTIFIER      pInterfaceId,
  151.     unsigned long __RPC_FAR *   pProcNum );
  152.  
  153.  
  154. #if defined(_MIPS_) || defined(_ALPHA_) || defined(_PPC_)
  155. #define __RPC_UNALIGNED   __unaligned
  156. #else
  157. #define __RPC_UNALIGNED
  158. #endif
  159.  
  160. void  RPC_ENTRY    I_NdrMesMessageInit( PMIDL_STUB_MESSAGE );
  161.  
  162. size_t  RPC_ENTRY
  163. NdrMesSimpleTypeAlignSize ( handle_t );
  164.  
  165. void  RPC_ENTRY
  166. NdrMesSimpleTypeDecode(
  167.     handle_t            Handle,
  168.     void __RPC_FAR *    pObject,
  169.     short               Size );
  170.  
  171. void  RPC_ENTRY
  172. NdrMesSimpleTypeEncode(
  173.     handle_t            Handle,
  174.     PMIDL_STUB_DESC     pStubDesc,
  175.     void __RPC_FAR *    pObject,
  176.     short               Size );
  177.  
  178.  
  179. size_t  RPC_ENTRY
  180. NdrMesTypeAlignSize(
  181.     handle_t            Handle,
  182.     PMIDL_STUB_DESC     pStubDesc,
  183.     PFORMAT_STRING      pFormatString,
  184.     void __RPC_FAR *    pObject );
  185.  
  186. void  RPC_ENTRY
  187. NdrMesTypeEncode(
  188.     handle_t            Handle,
  189.     PMIDL_STUB_DESC     pStubDesc,
  190.     PFORMAT_STRING      pFormatString,
  191.     void __RPC_FAR *    pObject );
  192.  
  193. void  RPC_ENTRY
  194. NdrMesTypeDecode(
  195.     handle_t            Handle,
  196.     PMIDL_STUB_DESC     pStubDesc,
  197.     PFORMAT_STRING      pFormatString,
  198.     void __RPC_FAR *    pObject );
  199.  
  200. void  RPC_VAR_ENTRY
  201. NdrMesProcEncodeDecode(
  202.     handle_t            Handle,
  203.     PMIDL_STUB_DESC     pStubDesc,
  204.     PFORMAT_STRING      pFormatString,
  205.     ... );
  206.  
  207.  
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211.  
  212. // Reset the packing level for DOS and Windows.
  213.  
  214. #if defined(__RPC_DOS__) || defined(__RPC_WIN16__)
  215. #pragma pack()
  216. #endif
  217.  
  218. #endif /* __MIDLES_H__ */
  219.