home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / rpcndr.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-05-17  |  75.5 KB  |  2,649 lines

  1. /*++
  2.  
  3. Copyright (c) 1992-1996 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     rpcndr.h
  8.  
  9. Abstract:
  10.  
  11.     Definitions for stub data structures and prototypes of helper functions.
  12.  
  13. Author:
  14.  
  15.     DonnaLi (01-01-91)
  16.  
  17. Environment:
  18.  
  19.     DOS, Win 3.X, and Win/NT.
  20.  
  21. Revision History:
  22.  
  23.    DONNALI  08-29-91     Start recording history
  24.    donnali  09-11-91     change conversion macros
  25.    donnali  09-18-91     check in files for moving
  26.    STEVEZ   10-15-91     Merge with NT tree
  27.    donnali  10-28-91     add prototype
  28.    donnali  11-19-91     bugfix for strings
  29.    MIKEMON  12-17-91     DCE runtime API conversion
  30.    donnali  03-24-92     change rpc public header f
  31.    STEVEZ   04-04-92     add nsi include
  32.    mikemon  04-18-92     security support and misc
  33.    DovhH    04-24-24     Changed signature of <int>_from_ndr
  34.                          (to unsigned <int>)
  35.                          Added <base_type>_array_from_ndr routines
  36.    RyszardK 06-17-93     Added support for hyper
  37.    VibhasC  09-11-93     Created rpcndrn.h
  38.    DKays    10-14-93     Fixed up rpcndrn.h MIDL 2.0
  39.    RyszardK 01-15-94     Merged in the midl 2.0 changes from rpcndrn.h
  40.    Stevebl  04-22-96     Hookole support changes to MIDL_*_INFO
  41.  
  42. --*/
  43.  
  44. #ifndef __RPCNDR_H__
  45. #define __RPCNDR_H__
  46.  
  47. //
  48. // Set the packing level for RPC structures for Dos, Windows and Mac.
  49. //
  50.  
  51. #if defined(__RPC_DOS__) || defined(__RPC_WIN16__) || defined(__RPC_MAC__)
  52. #pragma pack(2)
  53. #endif
  54.  
  55. #if defined(__RPC_MAC__)
  56. #define _MAC_
  57. #endif
  58.  
  59. #include <rpcnsip.h>
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64.  
  65. /****************************************************************************
  66.  
  67.      Network Computing Architecture (NCA) definition:
  68.  
  69.      Network Data Representation: (NDR) Label format:
  70.      An unsigned long (32 bits) with the following layout:
  71.  
  72.      3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  73.      1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  74.     +---------------+---------------+---------------+-------+-------+
  75.     |   Reserved    |   Reserved    |Floating point | Int   | Char  |
  76.     |               |               |Representation | Rep.  | Rep.  |
  77.     +---------------+---------------+---------------+-------+-------+
  78.  
  79.      Where
  80.  
  81.          Reserved:
  82.  
  83.              Must be zero (0) for NCA 1.5 and NCA 2.0.
  84.  
  85.          Floating point Representation is:
  86.  
  87.              0 - IEEE
  88.              1 - VAX
  89.              2 - Cray
  90.              3 - IBM
  91.  
  92.          Int Rep. is Integer Representation:
  93.  
  94.              0 - Big Endian
  95.              1 - Little Endian
  96.  
  97.          Char Rep. is Character Representation:
  98.  
  99.              0 - ASCII
  100.              1 - EBCDIC
  101.  
  102.      The Microsoft Local Data Representation (for all platforms which are
  103.      of interest currently is edefined below:
  104.  
  105.  ****************************************************************************/
  106.  
  107. #define NDR_CHAR_REP_MASK               (unsigned long)0X0000000FL
  108. #define NDR_INT_REP_MASK                (unsigned long)0X000000F0L
  109. #define NDR_FLOAT_REP_MASK              (unsigned long)0X0000FF00L
  110.  
  111. #define NDR_LITTLE_ENDIAN               (unsigned long)0X00000010L
  112. #define NDR_BIG_ENDIAN                  (unsigned long)0X00000000L
  113.  
  114. #define NDR_IEEE_FLOAT                  (unsigned long)0X00000000L
  115. #define NDR_VAX_FLOAT                   (unsigned long)0X00000100L
  116.  
  117. #define NDR_ASCII_CHAR                  (unsigned long)0X00000000L
  118. #define NDR_EBCDIC_CHAR                 (unsigned long)0X00000001L
  119.  
  120. #if defined(__RPC_MAC__)
  121. #define NDR_LOCAL_DATA_REPRESENTATION   (unsigned long)0X00000000L
  122. #define NDR_LOCAL_ENDIAN                NDR_BIG_ENDIAN
  123. #else
  124. #define NDR_LOCAL_DATA_REPRESENTATION   (unsigned long)0X00000010L
  125. #define NDR_LOCAL_ENDIAN                NDR_LITTLE_ENDIAN
  126. #endif
  127.  
  128.  
  129. /****************************************************************************
  130.  *  Macros for targeted platforms
  131.  ****************************************************************************/
  132.  
  133. #if (defined(_WIN32_DCOM) || 0x400 <= _WIN32_WINNT)
  134. #define TARGET_IS_NT40_OR_LATER                   1
  135. #else
  136. #define TARGET_IS_NT40_OR_LATER                   0
  137. #endif
  138.  
  139. #if (0x400 <= WINVER)
  140. #define TARGET_IS_NT351_OR_WIN95_OR_LATER         1
  141. #else
  142. #define TARGET_IS_NT351_OR_WIN95_OR_LATER         0
  143. #endif
  144.  
  145. /****************************************************************************
  146.  *  Other MIDL base types / predefined types:
  147.  ****************************************************************************/
  148.  
  149. #define small char
  150. typedef unsigned char byte;
  151. typedef unsigned char boolean;
  152.  
  153. #ifndef _HYPER_DEFINED
  154. #define _HYPER_DEFINED
  155.  
  156. #if !defined(__RPC_DOS__) && !defined(__RPC_WIN16__) && !defined(__RPC_MAC__) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64))
  157. #define  hyper           __int64
  158. #define MIDL_uhyper  unsigned __int64
  159. #else
  160. typedef double  hyper;
  161. typedef double MIDL_uhyper;
  162. #endif
  163.  
  164. #endif // _HYPER_DEFINED
  165.  
  166. #ifndef _WCHAR_T_DEFINED
  167. typedef unsigned short wchar_t;
  168. #define _WCHAR_T_DEFINED
  169. #endif
  170.  
  171. #ifndef _SIZE_T_DEFINED
  172. typedef unsigned int size_t;
  173. #define _SIZE_T_DEFINED
  174. #endif
  175.  
  176. #ifdef __RPC_DOS__
  177. #define __RPC_CALLEE       __far __pascal
  178. #endif
  179.  
  180. #ifdef __RPC_WIN16__
  181. #define __RPC_CALLEE       __far __pascal __export
  182. #endif
  183.  
  184. #ifdef __RPC_WIN32__
  185. #if   (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
  186. #define __RPC_CALLEE       __stdcall
  187. #else
  188. #define __RPC_CALLEE
  189. #endif
  190. #endif
  191.  
  192. #ifdef __RPC_MAC__
  193. #define __RPC_CALLEE __far
  194. #endif
  195.  
  196. #ifndef __MIDL_USER_DEFINED
  197. #define midl_user_allocate MIDL_user_allocate
  198. #define midl_user_free     MIDL_user_free
  199. #define __MIDL_USER_DEFINED
  200. #endif
  201.  
  202. void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
  203. void             __RPC_USER MIDL_user_free( void __RPC_FAR * );
  204.  
  205. #ifdef __RPC_WIN16__
  206. #define RPC_VAR_ENTRY __export __cdecl
  207. #else
  208. #define RPC_VAR_ENTRY __cdecl
  209. #endif
  210.  
  211.  
  212. /* winnt only */
  213. #if defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA)
  214. #define __MIDL_DECLSPEC_DLLIMPORT   __declspec(dllimport)
  215. #define __MIDL_DECLSPEC_DLLEXPORT   __declspec(dllexport)
  216. #else
  217. #define __MIDL_DECLSPEC_DLLIMPORT
  218. #define __MIDL_DECLSPEC_DLLEXPORT
  219. #endif
  220.  
  221.  
  222.  
  223.  
  224. /****************************************************************************
  225.  * Context handle management related definitions:
  226.  *
  227.  * Client and Server Contexts.
  228.  *
  229.  ****************************************************************************/
  230.  
  231. typedef void __RPC_FAR * NDR_CCONTEXT;
  232.  
  233. typedef struct
  234.     {
  235.     void __RPC_FAR * pad[2];
  236.     void __RPC_FAR * userContext;
  237.     } __RPC_FAR * NDR_SCONTEXT;
  238.  
  239. #define NDRSContextValue(hContext) (&(hContext)->userContext)
  240.  
  241. #define cbNDRContext 20         /* size of context on WIRE */
  242.  
  243. typedef void (__RPC_USER __RPC_FAR * NDR_RUNDOWN)(void __RPC_FAR * context);
  244.  
  245. typedef struct _SCONTEXT_QUEUE {
  246.     unsigned long   NumberOfObjects;
  247.     NDR_SCONTEXT  * ArrayOfObjects;
  248.     } SCONTEXT_QUEUE, __RPC_FAR * PSCONTEXT_QUEUE;
  249.  
  250. RPC_BINDING_HANDLE RPC_ENTRY
  251. NDRCContextBinding (
  252.     IN NDR_CCONTEXT CContext
  253.     );
  254.  
  255. void RPC_ENTRY
  256. NDRCContextMarshall (
  257.         IN  NDR_CCONTEXT CContext,
  258.         OUT void __RPC_FAR *pBuff
  259.         );
  260.  
  261. void RPC_ENTRY
  262. NDRCContextUnmarshall (
  263.         OUT NDR_CCONTEXT __RPC_FAR *pCContext,
  264.         IN  RPC_BINDING_HANDLE hBinding,
  265.         IN  void __RPC_FAR *pBuff,
  266.         IN  unsigned long DataRepresentation
  267.         );
  268.  
  269. void RPC_ENTRY
  270. NDRSContextMarshall (
  271.         IN  NDR_SCONTEXT CContext,
  272.         OUT void __RPC_FAR *pBuff,
  273.         IN  NDR_RUNDOWN userRunDownIn
  274.         );
  275.  
  276. NDR_SCONTEXT RPC_ENTRY
  277. NDRSContextUnmarshall (
  278.     IN  void __RPC_FAR *pBuff,
  279.     IN  unsigned long DataRepresentation
  280.     );
  281.  
  282. void RPC_ENTRY
  283. RpcSsDestroyClientContext (
  284.     IN void __RPC_FAR * __RPC_FAR * ContextHandle
  285.     );
  286.  
  287.  
  288. /****************************************************************************
  289.     NDR conversion related definitions.
  290.  ****************************************************************************/
  291.  
  292. #define byte_from_ndr(source, target) \
  293.     { \
  294.     *(target) = *(*(char __RPC_FAR * __RPC_FAR *)&(source)->Buffer)++; \
  295.     }
  296.  
  297. #define byte_array_from_ndr(Source, LowerIndex, UpperIndex, Target) \
  298.     { \
  299.     NDRcopy ( \
  300.         (((char __RPC_FAR *)(Target))+(LowerIndex)), \
  301.         (Source)->Buffer, \
  302.         (unsigned int)((UpperIndex)-(LowerIndex))); \
  303.     *(unsigned long __RPC_FAR *)&(Source)->Buffer += ((UpperIndex)-(LowerIndex)); \
  304.     }
  305.  
  306. #define boolean_from_ndr(source, target) \
  307.     { \
  308.     *(target) = *(*(char __RPC_FAR * __RPC_FAR *)&(source)->Buffer)++; \
  309.     }
  310.  
  311. #define boolean_array_from_ndr(Source, LowerIndex, UpperIndex, Target) \
  312.     { \
  313.     NDRcopy ( \
  314.         (((char __RPC_FAR *)(Target))+(LowerIndex)), \
  315.         (Source)->Buffer, \
  316.         (unsigned int)((UpperIndex)-(LowerIndex))); \
  317.     *(unsigned long __RPC_FAR *)&(Source)->Buffer += ((UpperIndex)-(LowerIndex)); \
  318.     }
  319.  
  320. #define small_from_ndr(source, target) \
  321.     { \
  322.     *(target) = *(*(char __RPC_FAR * __RPC_FAR *)&(source)->Buffer)++; \
  323.     }
  324.  
  325. #define small_from_ndr_temp(source, target, format) \
  326.     { \
  327.     *(target) = *(*(char __RPC_FAR * __RPC_FAR *)(source))++; \
  328.     }
  329.  
  330. #define small_array_from_ndr(Source, LowerIndex, UpperIndex, Target) \
  331.     { \
  332.     NDRcopy ( \
  333.         (((char __RPC_FAR *)(Target))+(LowerIndex)), \
  334.         (Source)->Buffer, \
  335.         (unsigned int)((UpperIndex)-(LowerIndex))); \
  336.     *(unsigned long __RPC_FAR *)&(Source)->Buffer += ((UpperIndex)-(LowerIndex)); \
  337.     }
  338.  
  339. /****************************************************************************
  340.     Platform specific mapping of c-runtime functions.
  341.  ****************************************************************************/
  342.  
  343. #ifdef __RPC_DOS__
  344. #define MIDL_ascii_strlen(string) \
  345.     _fstrlen(string)
  346. #define MIDL_ascii_strcpy(target,source) \
  347.     _fstrcpy(target,source)
  348. #define MIDL_memset(s,c,n) \
  349.     _fmemset(s,c,n)
  350. #endif
  351.  
  352. #ifdef __RPC_WIN16__
  353. #define MIDL_ascii_strlen(string) \
  354.     _fstrlen(string)
  355. #define MIDL_ascii_strcpy(target,source) \
  356.     _fstrcpy(target,source)
  357. #define MIDL_memset(s,c,n) \
  358.     _fmemset(s,c,n)
  359. #endif
  360.  
  361. #if defined(__RPC_WIN32__) || defined(__RPC_MAC__)
  362. #define MIDL_ascii_strlen(string) \
  363.     strlen(string)
  364. #define MIDL_ascii_strcpy(target,source) \
  365.     strcpy(target,source)
  366. #define MIDL_memset(s,c,n) \
  367.     memset(s,c,n)
  368. #endif
  369.  
  370. /****************************************************************************
  371.     Ndr Library helper function prototypes for MIDL 1.0 ndr functions.
  372.  ****************************************************************************/
  373.  
  374. void RPC_ENTRY
  375. NDRcopy (
  376.     IN void __RPC_FAR *pTarget,
  377.     IN void __RPC_FAR *pSource,
  378.     IN unsigned int size
  379.     );
  380.  
  381. size_t RPC_ENTRY
  382. MIDL_wchar_strlen (
  383.     IN wchar_t __RPC_FAR *   s
  384.     );
  385.  
  386. void RPC_ENTRY
  387. MIDL_wchar_strcpy (
  388.     OUT void __RPC_FAR *     t,
  389.     IN wchar_t __RPC_FAR *   s
  390.     );
  391.  
  392. void RPC_ENTRY
  393. char_from_ndr (
  394.     IN OUT PRPC_MESSAGE                           SourceMessage,
  395.     OUT unsigned char __RPC_FAR *                 Target
  396.     );
  397.  
  398. void RPC_ENTRY
  399. char_array_from_ndr (
  400.     IN OUT PRPC_MESSAGE                           SourceMessage,
  401.     IN unsigned long                              LowerIndex,
  402.     IN unsigned long                              UpperIndex,
  403.     OUT unsigned char __RPC_FAR *                 Target
  404.     );
  405.  
  406. void RPC_ENTRY
  407. short_from_ndr (
  408.     IN OUT PRPC_MESSAGE                           source,
  409.     OUT unsigned short __RPC_FAR *                target
  410.     );
  411.  
  412. void RPC_ENTRY
  413. short_array_from_ndr(
  414.     IN OUT PRPC_MESSAGE                           SourceMessage,
  415.     IN unsigned long                              LowerIndex,
  416.     IN unsigned long                              UpperIndex,
  417.     OUT unsigned short __RPC_FAR *                Target
  418.     );
  419.  
  420. void RPC_ENTRY
  421. short_from_ndr_temp (
  422.     IN OUT unsigned char __RPC_FAR * __RPC_FAR *  source,
  423.     OUT unsigned short __RPC_FAR *                target,
  424.     IN unsigned long                              format
  425.     );
  426.  
  427. void RPC_ENTRY
  428. long_from_ndr (
  429.     IN OUT PRPC_MESSAGE                           source,
  430.     OUT unsigned long __RPC_FAR *                 target
  431.     );
  432.  
  433. void RPC_ENTRY
  434. long_array_from_ndr(
  435.     IN OUT PRPC_MESSAGE                           SourceMessage,
  436.     IN unsigned long                              LowerIndex,
  437.     IN unsigned long                              UpperIndex,
  438.     OUT unsigned long __RPC_FAR *                 Target
  439.     );
  440.  
  441. void RPC_ENTRY
  442. long_from_ndr_temp (
  443.     IN OUT unsigned char __RPC_FAR * __RPC_FAR *  source,
  444.     OUT unsigned long __RPC_FAR *                 target,
  445.     IN unsigned long                              format
  446.     );
  447.  
  448. void RPC_ENTRY
  449. enum_from_ndr(
  450.     IN OUT PRPC_MESSAGE                           SourceMessage,
  451.     OUT unsigned int __RPC_FAR *                  Target
  452.     );
  453.  
  454. void RPC_ENTRY
  455. float_from_ndr (
  456.     IN OUT PRPC_MESSAGE                           SourceMessage,
  457.     OUT void __RPC_FAR *                          Target
  458.     );
  459.  
  460. void RPC_ENTRY
  461. float_array_from_ndr (
  462.     IN OUT PRPC_MESSAGE                           SourceMessage,
  463.     IN unsigned long                              LowerIndex,
  464.     IN unsigned long                              UpperIndex,
  465.     OUT void __RPC_FAR *                          Target
  466.     );
  467.  
  468. void RPC_ENTRY
  469. double_from_ndr (
  470.     IN OUT PRPC_MESSAGE                           SourceMessage,
  471.     OUT void __RPC_FAR *                          Target
  472.     );
  473.  
  474. void RPC_ENTRY
  475. double_array_from_ndr (
  476.     IN OUT PRPC_MESSAGE                           SourceMessage,
  477.     IN unsigned long                              LowerIndex,
  478.     IN unsigned long                              UpperIndex,
  479.     OUT void __RPC_FAR *                          Target
  480.     );
  481.  
  482. void RPC_ENTRY
  483. hyper_from_ndr (
  484.     IN OUT PRPC_MESSAGE                           source,
  485.     OUT    hyper __RPC_FAR *                      target
  486.     );
  487.  
  488. void RPC_ENTRY
  489. hyper_array_from_ndr(
  490.     IN OUT PRPC_MESSAGE                           SourceMessage,
  491.     IN unsigned long                              LowerIndex,
  492.     IN unsigned long                              UpperIndex,
  493.     OUT          hyper __RPC_FAR *                Target
  494.     );
  495.  
  496. void RPC_ENTRY
  497. hyper_from_ndr_temp (
  498.     IN OUT unsigned char __RPC_FAR * __RPC_FAR *  source,
  499.     OUT             hyper __RPC_FAR *             target,
  500.     IN   unsigned   long                          format
  501.     );
  502.  
  503. void RPC_ENTRY
  504. data_from_ndr (
  505.     PRPC_MESSAGE                                  source,
  506.     void __RPC_FAR *                              target,
  507.     char __RPC_FAR *                              format,
  508.     unsigned char                                 MscPak
  509.     );
  510.  
  511. void RPC_ENTRY
  512. data_into_ndr (
  513.     void __RPC_FAR *                              source,
  514.     PRPC_MESSAGE                                  target,
  515.     char __RPC_FAR *                              format,
  516.     unsigned char                                 MscPak
  517.     );
  518.  
  519. void RPC_ENTRY
  520. tree_into_ndr (
  521.     void __RPC_FAR *                              source,
  522.     PRPC_MESSAGE                                  target,
  523.     char __RPC_FAR *                              format,
  524.     unsigned char                                 MscPak
  525.     );
  526.  
  527. void RPC_ENTRY
  528. data_size_ndr (
  529.     void __RPC_FAR *                              source,
  530.     PRPC_MESSAGE                                  target,
  531.     char __RPC_FAR *                              format,
  532.     unsigned char                                 MscPak
  533.     );
  534.  
  535. void RPC_ENTRY
  536. tree_size_ndr (
  537.     void __RPC_FAR *                              source,
  538.     PRPC_MESSAGE                                  target,
  539.     char __RPC_FAR *                              format,
  540.     unsigned char                                 MscPak
  541.     );
  542.  
  543. void RPC_ENTRY
  544. tree_peek_ndr (
  545.     PRPC_MESSAGE                                  source,
  546.     unsigned char __RPC_FAR * __RPC_FAR *         buffer,
  547.     char __RPC_FAR *                              format,
  548.     unsigned char                                 MscPak
  549.     );
  550.  
  551. void __RPC_FAR * RPC_ENTRY
  552. midl_allocate (
  553.     size_t      size
  554.     );
  555.  
  556. /****************************************************************************
  557.     MIDL 2.0 ndr definitions.
  558.  ****************************************************************************/
  559.  
  560. typedef unsigned long error_status_t;
  561.  
  562. #define _midl_ma1( p, cast )    *(*( cast **)&p)++
  563. #define _midl_ma2( p, cast )    *(*( cast **)&p)++
  564. #define _midl_ma4( p, cast )    *(*( cast **)&p)++
  565. #define _midl_ma8( p, cast )    *(*( cast **)&p)++
  566.  
  567. #define _midl_unma1( p, cast )  *(( cast *)p)++
  568. #define _midl_unma2( p, cast )  *(( cast *)p)++
  569. #define _midl_unma3( p, cast )  *(( cast *)p)++
  570. #define _midl_unma4( p, cast )  *(( cast *)p)++
  571.  
  572. // Some alignment specific macros.
  573.  
  574.  
  575. #define _midl_fa2( p )          (p = (RPC_BUFPTR )((unsigned long)(p+1) & 0xfffffffe))
  576. #define _midl_fa4( p )          (p = (RPC_BUFPTR )((unsigned long)(p+3) & 0xfffffffc))
  577. #define _midl_fa8( p )          (p = (RPC_BUFPTR )((unsigned long)(p+7) & 0xfffffff8))
  578.  
  579. #define _midl_addp( p, n )      (p += n)
  580.  
  581. // Marshalling macros
  582.  
  583. #define _midl_marsh_lhs( p, cast )  *(*( cast **)&p)++
  584. #define _midl_marsh_up( mp, p )     *(*(unsigned long **)&mp)++ = (unsigned long)p
  585. #define _midl_advmp( mp )           *(*(unsigned long **)&mp)++
  586. #define _midl_unmarsh_up( p )       (*(*(unsigned long **)&p)++)
  587.  
  588.  
  589. ////////////////////////////////////////////////////////////////////////////
  590. // Ndr macros.
  591. ////////////////////////////////////////////////////////////////////////////
  592.  
  593. #define NdrMarshConfStringHdr( p, s, l )    (_midl_ma4( p, unsigned long) = s, \
  594.                                             _midl_ma4( p, unsigned long) = 0, \
  595.                                             _midl_ma4( p, unsigned long) = l)
  596.  
  597. #define NdrUnMarshConfStringHdr(p, s, l)    ((s=_midl_unma4(p,unsigned long),\
  598.                                             (_midl_addp(p,4)),               \
  599.                                             (l=_midl_unma4(p,unsigned long))
  600.  
  601. #define NdrMarshCCtxtHdl(pc,p)  (NDRCContextMarshall( (NDR_CCONTEXT)pc, p ),p+20)
  602.  
  603. #define NdrUnMarshCCtxtHdl(pc,p,h,drep) \
  604.         (NDRCContextUnmarshall((NDR_CONTEXT)pc,h,p,drep), p+20)
  605.  
  606. #define NdrUnMarshSCtxtHdl(pc, p,drep)  (pc = NdrSContextUnMarshall(p,drep ))
  607.  
  608.  
  609. #define NdrMarshSCtxtHdl(pc,p,rd)   (NdrSContextMarshall((NDR_SCONTEXT)pc,p, (NDR_RUNDOWN)rd)
  610.  
  611. #define NdrFieldOffset(s,f)     (long)(& (((s __RPC_FAR *)0)->f))
  612. #define NdrFieldPad(s,f,p,t)    (NdrFieldOffset(s,f) - NdrFieldOffset(s,p) - sizeof(t))
  613.  
  614. #if defined(__RPC_MAC__)
  615. #define NdrFcShort(s)   (unsigned char)(s >> 8), (unsigned char)(s & 0xff)
  616. #define NdrFcLong(s)    (unsigned char)(s >> 24), (unsigned char)((s & 0x00ff0000) >> 16), \
  617.                         (unsigned char)((s & 0x0000ff00) >> 8), (unsigned char)(s & 0xff)
  618. #else
  619. #define NdrFcShort(s)   (unsigned char)(s & 0xff), (unsigned char)(s >> 8)
  620. #define NdrFcLong(s)    (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \
  621.                         (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24)
  622. #endif //  Mac
  623.  
  624. //
  625. // On the server side, the following exceptions are mapped to
  626. // the bad stub data exception if -error stub_data is used.
  627. //
  628.  
  629. #define RPC_BAD_STUB_DATA_EXCEPTION_FILTER  \
  630.                  ( (RpcExceptionCode() == STATUS_ACCESS_VIOLATION)  || \
  631.                    (RpcExceptionCode() == STATUS_DATATYPE_MISALIGNMENT) || \
  632.                    (RpcExceptionCode() == RPC_X_BAD_STUB_DATA) )
  633.  
  634. /////////////////////////////////////////////////////////////////////////////
  635. // Some stub helper functions.
  636. /////////////////////////////////////////////////////////////////////////////
  637.  
  638. ////////////////////////////////////////////////////////////////////////////
  639. // Stub helper structures.
  640. ////////////////////////////////////////////////////////////////////////////
  641.  
  642. struct _MIDL_STUB_MESSAGE;
  643. struct _MIDL_STUB_DESC;
  644. struct _FULL_PTR_XLAT_TABLES;
  645.  
  646. typedef unsigned char __RPC_FAR * RPC_BUFPTR;
  647. typedef unsigned long             RPC_LENGTH;
  648.  
  649. // Expression evaluation callback routine prototype.
  650. typedef void (__RPC_USER __RPC_FAR * EXPR_EVAL)( struct _MIDL_STUB_MESSAGE __RPC_FAR * );
  651.  
  652. typedef const unsigned char __RPC_FAR * PFORMAT_STRING;
  653.  
  654. /*
  655.  * Multidimensional conformant/varying array struct.
  656.  */
  657. typedef struct
  658.     {
  659.     long                            Dimension;
  660.  
  661.     /* These fields MUST be (unsigned long *) */
  662.     unsigned long __RPC_FAR *       BufferConformanceMark;
  663.     unsigned long __RPC_FAR *       BufferVarianceMark;
  664.  
  665.     /* Count arrays, used for top level arrays in -Os stubs */
  666.     unsigned long __RPC_FAR *       MaxCountArray;
  667.     unsigned long __RPC_FAR *       OffsetArray;
  668.     unsigned long __RPC_FAR *       ActualCountArray;
  669.     } ARRAY_INFO, __RPC_FAR *PARRAY_INFO;
  670.  
  671. /*
  672.  *  Pipe related definitions.
  673.  */
  674.  
  675. typedef void
  676. (__RPC_FAR __RPC_API * NDR_PIPE_PULL_RTN)(
  677.         char          __RPC_FAR *  state,
  678.         void          __RPC_FAR *  buf,
  679.         unsigned long              esize,
  680.         unsigned long __RPC_FAR *  ecount );
  681.  
  682. typedef void
  683. (__RPC_FAR __RPC_API * NDR_PIPE_PUSH_RTN)(
  684.         char          __RPC_FAR *  state,
  685.         void          __RPC_FAR *  buf,
  686.         unsigned long              ecount );
  687.  
  688. typedef void
  689. (__RPC_FAR __RPC_API * NDR_PIPE_ALLOC_RTN)(
  690.         char             __RPC_FAR *  state,
  691.         unsigned long                 bsize,
  692.         void __RPC_FAR * __RPC_FAR *  buf,
  693.         unsigned long    __RPC_FAR *  bcount );
  694.  
  695.  
  696. typedef struct  _GENERIC_PIPE_TYPE
  697.     {
  698.     NDR_PIPE_PULL_RTN       pfnPull;
  699.     NDR_PIPE_PUSH_RTN       pfnPush;
  700.     NDR_PIPE_ALLOC_RTN      pfnAlloc;
  701.     char  __RPC_FAR *       pState;
  702.     } GENERIC_PIPE_TYPE;
  703.  
  704.  
  705. typedef struct {
  706.     int                         CurrentState;
  707.     int                         ElemsInChunk;
  708.     int                         ElemAlign;          
  709.     int                         ElemWireSize;         
  710.     int                         ElemMemSize;
  711.     int                         PartialBufferSize;
  712.     unsigned char __RPC_FAR *   PartialElem;
  713.     int                         PartialElemSize;
  714.     int                         PartialOffset;
  715.     int                         EndOfPipe;
  716.     } NDR_PIPE_STATE;
  717.  
  718. typedef struct  _PIPE_MESSAGE
  719.     {
  720.     unsigned short                  Signature;
  721.     unsigned short                  PipeId;
  722.     GENERIC_PIPE_TYPE  __RPC_FAR *  pPipeType;
  723.     PFORMAT_STRING                  pTypeFormat;
  724.     unsigned short                  PipeStatus;
  725.     unsigned short                  PipeFlags;
  726.     struct _MIDL_STUB_MESSAGE  __RPC_FAR *  pStubMsg;
  727.     } NDR_PIPE_MESSAGE, __RPC_FAR * PNDR_PIPE_MESSAGE;
  728.  
  729. typedef struct  _NDR_PIPE_DESC
  730.     {
  731.     NDR_PIPE_MESSAGE  __RPC_FAR *   pPipeMsg;
  732.     short                           CurrentPipe;
  733.     short                           InPipes;
  734.     short                           OutPipes;
  735.     short                           TotalPipes;
  736.     short                           PipeVersion;
  737.     short                           Flags;
  738.     unsigned char  __RPC_FAR *      DispatchBuffer;
  739.     unsigned char  __RPC_FAR *      LastPartialBuffer;
  740.     unsigned long                   LastPartialSize;
  741.     unsigned char  __RPC_FAR *      BufferSave;
  742.     unsigned long                   LengthSave;
  743.     NDR_PIPE_STATE                  RuntimeState;
  744.     } NDR_PIPE_DESC, __RPC_FAR * PNDR_PIPE_DESC;
  745.  
  746.  
  747. /*
  748.  * MIDL Stub Message
  749.  */
  750. #if !defined(__RPC_DOS__) && !defined(__RPC_WIN16__) && !defined(__RPC_MAC__)
  751. #include <pshpack4.h>
  752. #endif
  753.  
  754. typedef struct _MIDL_STUB_MESSAGE
  755.     {
  756.     /* RPC message structure. */
  757.     PRPC_MESSAGE                RpcMsg;
  758.  
  759.     /* Pointer into RPC message buffer. */
  760.     unsigned char __RPC_FAR *   Buffer;
  761.  
  762.     /*
  763.      * These are used internally by the Ndr routines to mark the beginning
  764.      * and end of an incoming RPC buffer.
  765.      */
  766.     unsigned char __RPC_FAR *   BufferStart;
  767.     unsigned char __RPC_FAR *   BufferEnd;
  768.  
  769.     /*
  770.      * Used internally by the Ndr routines as a place holder in the buffer.
  771.      * On the marshalling side it's used to mark the location where conformance
  772.      * size should be marshalled.
  773.      * On the unmarshalling side it's used to mark the location in the buffer
  774.      * used during pointer unmarshalling to base pointer offsets off of.
  775.      */
  776.     unsigned char __RPC_FAR *   BufferMark;
  777.  
  778.     /* Set by the buffer sizing routines. */
  779.     unsigned long               BufferLength;
  780.  
  781.     /* Set by the memory sizing routines. */
  782.     unsigned long               MemorySize;
  783.  
  784.     /* Pointer to user memory. */
  785.     unsigned char __RPC_FAR *   Memory;
  786.  
  787.     /* Is the Ndr routine begin called from a client side stub. */
  788.     int                         IsClient;
  789.  
  790.     /* Can the buffer be re-used for memory on unmarshalling. */
  791.     int                         ReuseBuffer;
  792.  
  793.     /* Holds the current pointer to an allocate all nodes memory block. */
  794.     unsigned char __RPC_FAR *   AllocAllNodesMemory;
  795.  
  796.     /* Used for debugging asserts only, remove later. */
  797.     unsigned char __RPC_FAR *   AllocAllNodesMemoryEnd;
  798.  
  799.     /*
  800.      * Stuff needed while handling complex structures
  801.      */
  802.  
  803.     /* Ignore imbeded pointers while computing buffer or memory sizes. */
  804.     int                         IgnoreEmbeddedPointers;
  805.  
  806.     /*
  807.      * This marks the location in the buffer where pointees of a complex
  808.      * struct reside.
  809.      */
  810.     unsigned char __RPC_FAR *   PointerBufferMark;
  811.  
  812.     /*
  813.      * Used to catch errors in SendReceive.
  814.      */
  815.     unsigned char               fBufferValid;
  816.  
  817.     /*
  818.      * Obsolete unused field (formerly MaxContextHandleNumber).
  819.      */
  820.     unsigned char               Unused;
  821.  
  822.     /*
  823.      * Used internally by the Ndr routines.  Holds the max counts for
  824.      * a conformant array.
  825.      */
  826.     unsigned long               MaxCount;
  827.  
  828.     /*
  829.      * Used internally by the Ndr routines.  Holds the offsets for a varying
  830.      * array.
  831.      */
  832.     unsigned long               Offset;
  833.  
  834.     /*
  835.      * Used internally by the Ndr routines.  Holds the actual counts for
  836.      * a varying array.
  837.      */
  838.     unsigned long               ActualCount;
  839.  
  840.     /* Allocation and Free routine to be used by the Ndr routines. */
  841.     void __RPC_FAR *    (__RPC_FAR __RPC_API * pfnAllocate)(size_t);
  842.     void                (__RPC_FAR __RPC_API * pfnFree)(void __RPC_FAR *);
  843.  
  844.     /*
  845.      * Top of parameter stack.  Used for "single call" stubs during marshalling
  846.      * to hold the beginning of the parameter list on the stack.  Needed to
  847.      * extract parameters which hold attribute values for top level arrays and
  848.      * pointers.
  849.      */
  850.     unsigned char __RPC_FAR *       StackTop;
  851.  
  852.     /*
  853.      *  Fields used for the transmit_as and represent_as objects.
  854.      *  For represent_as the mapping is: presented=local, transmit=named.
  855.      */
  856.     unsigned char __RPC_FAR *       pPresentedType;
  857.     unsigned char __RPC_FAR *       pTransmitType;
  858.  
  859.     /*
  860.      * When we first construct a binding on the client side, stick it
  861.      * in the rpcmessage and later call RpcGetBuffer, the handle field
  862.      * in the rpcmessage is changed. That's fine except that we need to
  863.      * have that original handle for use in unmarshalling context handles
  864.      * (the second argument in NDRCContextUnmarshall to be exact). So
  865.      * stash the contructed handle here and extract it when needed.
  866.      */
  867.     handle_t                        SavedHandle;
  868.  
  869.     /*
  870.      * Pointer back to the stub descriptor.  Use this to get all handle info.
  871.      */
  872.     const struct _MIDL_STUB_DESC __RPC_FAR *    StubDesc;
  873.  
  874.     /*
  875.      * Full pointer stuff.
  876.      */
  877.     struct _FULL_PTR_XLAT_TABLES __RPC_FAR *    FullPtrXlatTables;
  878.  
  879.     unsigned long                   FullPtrRefId;
  880.  
  881.     /*
  882.      * flags
  883.      */
  884.  
  885.     int                             fCheckBounds;
  886.  
  887.     int                             fInDontFree       :1;
  888.     int                             fDontCallFreeInst :1;
  889.     int                             fInOnlyParam      :1;
  890.     int                             fHasReturn        :1;
  891.  
  892.     unsigned long                   dwDestContext;
  893.     void __RPC_FAR *                pvDestContext;
  894.  
  895.     NDR_SCONTEXT *                  SavedContextHandles;
  896.  
  897.     long                            ParamNumber;
  898.  
  899.     struct IRpcChannelBuffer __RPC_FAR *    pRpcChannelBuffer;
  900.  
  901.     PARRAY_INFO                     pArrayInfo;
  902.  
  903.     /*
  904.      * This is where the Beta2 stub message ends.
  905.      */
  906.  
  907.     unsigned long __RPC_FAR *       SizePtrCountArray;
  908.     unsigned long __RPC_FAR *       SizePtrOffsetArray;
  909.     unsigned long __RPC_FAR *       SizePtrLengthArray;
  910.  
  911.     /*
  912.      * Interpreter argument queue.  Used on server side only.
  913.      */
  914.     void __RPC_FAR *                pArgQueue;
  915.  
  916.     unsigned long                   dwStubPhase;
  917.  
  918.     /*
  919.      * Pipe descriptor, defined for the 4.0 release.
  920.      */
  921.  
  922.     NDR_PIPE_DESC   __RPC_FAR *     pPipeDesc;
  923.  
  924.     unsigned long                   Reserved[4];
  925.  
  926.     /*
  927.      *  Fields up to this point present since the 3.50 release.
  928.      */
  929.  
  930.     } MIDL_STUB_MESSAGE, __RPC_FAR *PMIDL_STUB_MESSAGE;
  931.  
  932. #if !defined(__RPC_DOS__) && !defined(__RPC_WIN16__) && !defined(__RPC_MAC__)
  933. #include <poppack.h>
  934. #endif
  935.  
  936. /*
  937.  * Generic handle bind/unbind routine pair.
  938.  */
  939. typedef void __RPC_FAR *
  940.         (__RPC_FAR __RPC_API * GENERIC_BINDING_ROUTINE)
  941.         (void __RPC_FAR *);
  942. typedef void
  943.         (__RPC_FAR __RPC_API * GENERIC_UNBIND_ROUTINE)
  944.         (void __RPC_FAR *, unsigned char __RPC_FAR *);
  945.  
  946. typedef struct _GENERIC_BINDING_ROUTINE_PAIR
  947.     {
  948.     GENERIC_BINDING_ROUTINE     pfnBind;
  949.     GENERIC_UNBIND_ROUTINE      pfnUnbind;
  950.     } GENERIC_BINDING_ROUTINE_PAIR, __RPC_FAR *PGENERIC_BINDING_ROUTINE_PAIR;
  951.  
  952. typedef struct __GENERIC_BINDING_INFO
  953.     {
  954.     void __RPC_FAR *            pObj;
  955.     unsigned int                Size;
  956.     GENERIC_BINDING_ROUTINE     pfnBind;
  957.     GENERIC_UNBIND_ROUTINE      pfnUnbind;
  958.     } GENERIC_BINDING_INFO, __RPC_FAR *PGENERIC_BINDING_INFO;
  959.  
  960. // typedef EXPR_EVAL - see above
  961. // typedefs for xmit_as
  962.  
  963. #if (defined(_MSC_VER)) && !defined(MIDL_PASS)
  964. // a Microsoft C++ compiler
  965. #define NDR_SHAREABLE __inline
  966. #else
  967. #define NDR_SHAREABLE static
  968. #endif
  969.  
  970.  
  971. typedef void (__RPC_FAR __RPC_USER * XMIT_HELPER_ROUTINE)
  972.     ( PMIDL_STUB_MESSAGE );
  973.  
  974. typedef struct _XMIT_ROUTINE_QUINTUPLE
  975.     {
  976.     XMIT_HELPER_ROUTINE     pfnTranslateToXmit;
  977.     XMIT_HELPER_ROUTINE     pfnTranslateFromXmit;
  978.     XMIT_HELPER_ROUTINE     pfnFreeXmit;
  979.     XMIT_HELPER_ROUTINE     pfnFreeInst;
  980.     } XMIT_ROUTINE_QUINTUPLE, __RPC_FAR *PXMIT_ROUTINE_QUINTUPLE;
  981.  
  982. typedef unsigned long
  983. (__RPC_FAR __RPC_USER * USER_MARSHAL_SIZING_ROUTINE)
  984.     (unsigned long __RPC_FAR *,
  985.      unsigned long,
  986.      void __RPC_FAR * );
  987.  
  988. typedef unsigned char __RPC_FAR *
  989. (__RPC_FAR __RPC_USER * USER_MARSHAL_MARSHALLING_ROUTINE)
  990.     (unsigned long __RPC_FAR *,
  991.      unsigned char  __RPC_FAR * ,
  992.      void __RPC_FAR * );
  993.  
  994. typedef unsigned char __RPC_FAR *
  995. (__RPC_FAR __RPC_USER * USER_MARSHAL_UNMARSHALLING_ROUTINE)
  996.     (unsigned long __RPC_FAR *,
  997.      unsigned char  __RPC_FAR * ,
  998.      void __RPC_FAR * );
  999.  
  1000. typedef void (__RPC_FAR __RPC_USER * USER_MARSHAL_FREEING_ROUTINE)
  1001.     (unsigned long __RPC_FAR *,
  1002.      void __RPC_FAR * );
  1003.  
  1004. typedef struct _USER_MARSHAL_ROUTINE_QUADRUPLE
  1005.     {
  1006.     USER_MARSHAL_SIZING_ROUTINE          pfnBufferSize;
  1007.     USER_MARSHAL_MARSHALLING_ROUTINE     pfnMarshall;
  1008.     USER_MARSHAL_UNMARSHALLING_ROUTINE   pfnUnmarshall;
  1009.     USER_MARSHAL_FREEING_ROUTINE         pfnFree;
  1010.     } USER_MARSHAL_ROUTINE_QUADRUPLE;
  1011.  
  1012. typedef struct _USER_MARSHAL_CB
  1013. {
  1014.     unsigned long       Flags;
  1015.     PMIDL_STUB_MESSAGE  pStubMsg;
  1016.     PFORMAT_STRING      pReserve;
  1017. } USER_MARSHAL_CB;
  1018.  
  1019.  
  1020. #define USER_CALL_CTXT_MASK(f)    ((f) & 0xff)
  1021. #define GET_USER_DATA_REP(f)    ((f) >> 16)
  1022.  
  1023. typedef struct _MALLOC_FREE_STRUCT
  1024.     {
  1025.     void __RPC_FAR *    (__RPC_FAR __RPC_USER * pfnAllocate)(size_t);
  1026.     void                (__RPC_FAR __RPC_USER * pfnFree)(void __RPC_FAR *);
  1027.     } MALLOC_FREE_STRUCT;
  1028.  
  1029. typedef struct _COMM_FAULT_OFFSETS
  1030.     {
  1031.     short       CommOffset;
  1032.     short       FaultOffset;
  1033.     } COMM_FAULT_OFFSETS;
  1034.  
  1035. /*
  1036.  * MIDL Stub Descriptor
  1037.  */
  1038.  
  1039. typedef struct _MIDL_STUB_DESC
  1040.     {
  1041.  
  1042.     void __RPC_FAR *    RpcInterfaceInformation;
  1043.  
  1044.     void __RPC_FAR *    (__RPC_FAR __RPC_API * pfnAllocate)(size_t);
  1045.     void                (__RPC_FAR __RPC_API * pfnFree)(void __RPC_FAR *);
  1046.  
  1047.     union
  1048.         {
  1049.         handle_t __RPC_FAR *            pAutoHandle;
  1050.         handle_t __RPC_FAR *            pPrimitiveHandle;
  1051.         PGENERIC_BINDING_INFO           pGenericBindingInfo;
  1052.         } IMPLICIT_HANDLE_INFO;
  1053.  
  1054.     const NDR_RUNDOWN __RPC_FAR *                   apfnNdrRundownRoutines;
  1055.     const GENERIC_BINDING_ROUTINE_PAIR __RPC_FAR *  aGenericBindingRoutinePairs;
  1056.  
  1057.     const EXPR_EVAL __RPC_FAR *                     apfnExprEval;
  1058.  
  1059.     const XMIT_ROUTINE_QUINTUPLE __RPC_FAR *        aXmitQuintuple;
  1060.  
  1061.     const unsigned char __RPC_FAR *                 pFormatTypes;
  1062.  
  1063.     int                                             fCheckBounds;
  1064.  
  1065.     /* Ndr library version. */
  1066.     unsigned long                                   Version;
  1067.  
  1068.     /*
  1069.      * Reserved for future use. (no reserves )
  1070.      */
  1071.  
  1072.     MALLOC_FREE_STRUCT __RPC_FAR *                  pMallocFreeStruct;
  1073.  
  1074.     long                                MIDLVersion;
  1075.  
  1076.     const COMM_FAULT_OFFSETS __RPC_FAR *    CommFaultOffsets;
  1077.  
  1078.     // New fields for version 3.0+
  1079.  
  1080.     const USER_MARSHAL_ROUTINE_QUADRUPLE __RPC_FAR * aUserMarshalQuadruple;
  1081.  
  1082.     long                                    Reserved1;
  1083.     long                                    Reserved2;
  1084.     long                                    Reserved3;
  1085.     long                                    Reserved4;
  1086.     long                                    Reserved5;
  1087.  
  1088.     } MIDL_STUB_DESC;
  1089.  
  1090. typedef const MIDL_STUB_DESC __RPC_FAR * PMIDL_STUB_DESC;
  1091.  
  1092. typedef void __RPC_FAR * PMIDL_XMIT_TYPE;
  1093.  
  1094. /*
  1095.  * MIDL Stub Format String.  This is a const in the stub.
  1096.  */
  1097. #if !defined( RC_INVOKED )
  1098. #pragma warning( disable:4200 )
  1099. #endif
  1100. typedef struct _MIDL_FORMAT_STRING
  1101.     {
  1102.     short               Pad;
  1103.     unsigned char       Format[];
  1104.     } MIDL_FORMAT_STRING;
  1105. #if !defined( RC_INVOKED )
  1106. #pragma warning( default:4200 )
  1107. #endif
  1108.  
  1109. /*
  1110.  * Stub thunk used for some interpreted server stubs.
  1111.  */
  1112. typedef void (__RPC_FAR __RPC_API * STUB_THUNK)( PMIDL_STUB_MESSAGE );
  1113.  
  1114. typedef long (__RPC_FAR __RPC_API * SERVER_ROUTINE)();
  1115.  
  1116. /*
  1117.  * Server Interpreter's information strucuture.
  1118.  */
  1119. typedef struct  _MIDL_SERVER_INFO_
  1120.     {
  1121.     PMIDL_STUB_DESC             pStubDesc;
  1122.     const SERVER_ROUTINE *      DispatchTable;
  1123.     PFORMAT_STRING              ProcString;
  1124.     const unsigned short *      FmtStringOffset;
  1125.     const STUB_THUNK *          ThunkTable;
  1126.     PFORMAT_STRING              LocalFormatTypes;
  1127.     PFORMAT_STRING              LocalProcString;
  1128.     const unsigned short *      LocalFmtStringOffset;
  1129.     } MIDL_SERVER_INFO, *PMIDL_SERVER_INFO;
  1130.  
  1131. /*
  1132.  * Stubless object proxy information structure.
  1133.  */
  1134. typedef struct _MIDL_STUBLESS_PROXY_INFO
  1135.     {
  1136.     PMIDL_STUB_DESC                     pStubDesc;
  1137.     PFORMAT_STRING                      ProcFormatString;
  1138.     const unsigned short __RPC_FAR *    FormatStringOffset;
  1139.     PFORMAT_STRING                      LocalFormatTypes;
  1140.     PFORMAT_STRING                      LocalProcString;
  1141.     const unsigned short __RPC_FAR *    LocalFmtStringOffset;
  1142.     } MIDL_STUBLESS_PROXY_INFO;
  1143.  
  1144. typedef MIDL_STUBLESS_PROXY_INFO __RPC_FAR * PMIDL_STUBLESS_PROXY_INFO;
  1145.  
  1146. /*
  1147.  * This is the return value from NdrClientCall.
  1148.  */
  1149. typedef union _CLIENT_CALL_RETURN
  1150.     {
  1151.     void __RPC_FAR *        Pointer;
  1152.     long                    Simple;
  1153.     } CLIENT_CALL_RETURN;
  1154.  
  1155. /*
  1156.  * Full pointer data structures.
  1157.  */
  1158.  
  1159. typedef enum
  1160.         {
  1161.         XLAT_SERVER = 1,
  1162.         XLAT_CLIENT
  1163.         } XLAT_SIDE;
  1164.  
  1165. /*
  1166.  * Stores the translation for the conversion from a full pointer into it's
  1167.  * corresponding ref id.
  1168.  */
  1169. typedef struct _FULL_PTR_TO_REFID_ELEMENT
  1170.     {
  1171.     struct _FULL_PTR_TO_REFID_ELEMENT __RPC_FAR *  Next;
  1172.  
  1173.     void __RPC_FAR *            Pointer;
  1174.     unsigned long       RefId;
  1175.     unsigned char       State;
  1176.     } FULL_PTR_TO_REFID_ELEMENT, __RPC_FAR *PFULL_PTR_TO_REFID_ELEMENT;
  1177.  
  1178. /*
  1179.  * Full pointer translation tables.
  1180.  */
  1181. typedef struct _FULL_PTR_XLAT_TABLES
  1182.     {
  1183.     /*
  1184.      * Ref id to pointer translation information.
  1185.      */
  1186.     struct
  1187.         {
  1188.         void __RPC_FAR *__RPC_FAR *             XlatTable;
  1189.         unsigned char __RPC_FAR *     StateTable;
  1190.         unsigned long       NumberOfEntries;
  1191.         } RefIdToPointer;
  1192.  
  1193.     /*
  1194.      * Pointer to ref id translation information.
  1195.      */
  1196.     struct
  1197.         {
  1198.         PFULL_PTR_TO_REFID_ELEMENT __RPC_FAR *  XlatTable;
  1199.         unsigned long                   NumberOfBuckets;
  1200.         unsigned long                   HashMask;
  1201.         } PointerToRefId;
  1202.  
  1203.     /*
  1204.      * Next ref id to use.
  1205.      */
  1206.     unsigned long           NextRefId;
  1207.  
  1208.     /*
  1209.      * Keep track of the translation size we're handling : server or client.
  1210.      * This tells us when we have to do reverse translations when we insert
  1211.      * new translations.  On the server we must insert a pointer-to-refid
  1212.      * translation whenever we insert a refid-to-pointer translation, and
  1213.      * vica versa for the client.
  1214.      */
  1215.     XLAT_SIDE               XlatSide;
  1216.     } FULL_PTR_XLAT_TABLES, __RPC_FAR *PFULL_PTR_XLAT_TABLES;
  1217.  
  1218. /***************************************************************************
  1219.  ** New MIDL 2.0 Ndr routine templates
  1220.  ***************************************************************************/
  1221.  
  1222. /*
  1223.  * Marshall routines
  1224.  */
  1225.  
  1226. void RPC_ENTRY
  1227. NdrSimpleTypeMarshall(
  1228.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1229.     unsigned char __RPC_FAR *                       pMemory,
  1230.     unsigned char                       FormatChar
  1231.     );
  1232.  
  1233. unsigned char __RPC_FAR * RPC_ENTRY
  1234. NdrPointerMarshall(
  1235.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1236.     unsigned char __RPC_FAR *           pMemory,
  1237.     PFORMAT_STRING                      pFormat
  1238.     );
  1239.  
  1240. /* Structures */
  1241.  
  1242. unsigned char __RPC_FAR * RPC_ENTRY
  1243. NdrSimpleStructMarshall(
  1244.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1245.     unsigned char __RPC_FAR *           pMemory,
  1246.     PFORMAT_STRING                      pFormat
  1247.     );
  1248.  
  1249. unsigned char __RPC_FAR * RPC_ENTRY
  1250. NdrConformantStructMarshall(
  1251.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1252.     unsigned char __RPC_FAR *           pMemory,
  1253.     PFORMAT_STRING                      pFormat
  1254.     );
  1255.  
  1256. unsigned char __RPC_FAR * RPC_ENTRY
  1257. NdrConformantVaryingStructMarshall(
  1258.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1259.     unsigned char __RPC_FAR *           pMemory,
  1260.     PFORMAT_STRING                      pFormat
  1261.     );
  1262.  
  1263. unsigned char __RPC_FAR * RPC_ENTRY
  1264. NdrHardStructMarshall(
  1265.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1266.     unsigned char __RPC_FAR *           pMemory,
  1267.     PFORMAT_STRING                      pFormat
  1268.     );
  1269.  
  1270. unsigned char __RPC_FAR * RPC_ENTRY
  1271. NdrComplexStructMarshall(
  1272.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1273.     unsigned char __RPC_FAR *           pMemory,
  1274.     PFORMAT_STRING                      pFormat
  1275.     );
  1276.  
  1277. /* Arrays */
  1278.  
  1279. unsigned char __RPC_FAR * RPC_ENTRY
  1280. NdrFixedArrayMarshall(
  1281.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1282.     unsigned char __RPC_FAR *           pMemory,
  1283.     PFORMAT_STRING                      pFormat
  1284.     );
  1285.  
  1286. unsigned char __RPC_FAR * RPC_ENTRY
  1287. NdrConformantArrayMarshall(
  1288.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1289.     unsigned char __RPC_FAR *           pMemory,
  1290.     PFORMAT_STRING                      pFormat
  1291.     );
  1292.  
  1293. unsigned char __RPC_FAR * RPC_ENTRY
  1294. NdrConformantVaryingArrayMarshall(
  1295.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1296.     unsigned char __RPC_FAR *           pMemory,
  1297.     PFORMAT_STRING                      pFormat
  1298.     );
  1299.  
  1300. unsigned char __RPC_FAR * RPC_ENTRY
  1301. NdrVaryingArrayMarshall(
  1302.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1303.     unsigned char __RPC_FAR *           pMemory,
  1304.     PFORMAT_STRING                      pFormat
  1305.     );
  1306.  
  1307. unsigned char __RPC_FAR * RPC_ENTRY
  1308. NdrComplexArrayMarshall(
  1309.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1310.     unsigned char __RPC_FAR *           pMemory,
  1311.     PFORMAT_STRING                      pFormat
  1312.     );
  1313.  
  1314. /* Strings */
  1315.  
  1316. unsigned char __RPC_FAR * RPC_ENTRY
  1317. NdrNonConformantStringMarshall(
  1318.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1319.     unsigned char __RPC_FAR *           pMemory,
  1320.     PFORMAT_STRING                      pFormat
  1321.     );
  1322.  
  1323. unsigned char __RPC_FAR * RPC_ENTRY
  1324. NdrConformantStringMarshall(
  1325.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1326.     unsigned char __RPC_FAR *           pMemory,
  1327.     PFORMAT_STRING                      pFormat
  1328.     );
  1329.  
  1330. /* Unions */
  1331.  
  1332. unsigned char __RPC_FAR * RPC_ENTRY
  1333. NdrEncapsulatedUnionMarshall(
  1334.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1335.     unsigned char __RPC_FAR *           pMemory,
  1336.     PFORMAT_STRING                      pFormat
  1337.     );
  1338.  
  1339. unsigned char __RPC_FAR * RPC_ENTRY
  1340. NdrNonEncapsulatedUnionMarshall(
  1341.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1342.     unsigned char __RPC_FAR *           pMemory,
  1343.     PFORMAT_STRING                      pFormat
  1344.     );
  1345.  
  1346. /* Byte count pointer */
  1347.  
  1348. unsigned char __RPC_FAR * RPC_ENTRY
  1349. NdrByteCountPointerMarshall(
  1350.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1351.     unsigned char __RPC_FAR *           pMemory,
  1352.     PFORMAT_STRING                      pFormat
  1353.     );
  1354.  
  1355. /* Transmit as and represent as*/
  1356.  
  1357. unsigned char __RPC_FAR * RPC_ENTRY
  1358. NdrXmitOrRepAsMarshall(
  1359.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1360.     unsigned char __RPC_FAR *           pMemory,
  1361.     PFORMAT_STRING                      pFormat
  1362.     );
  1363.  
  1364. /* User_marshal */
  1365.  
  1366. unsigned char __RPC_FAR * RPC_ENTRY
  1367. NdrUserMarshalMarshall(
  1368.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1369.     unsigned char __RPC_FAR *           pMemory,
  1370.     PFORMAT_STRING                      pFormat
  1371.     );
  1372.  
  1373. /* Cairo interface pointer */
  1374.  
  1375. unsigned char __RPC_FAR * RPC_ENTRY
  1376. NdrInterfacePointerMarshall(
  1377.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1378.     unsigned char __RPC_FAR *           pMemory,
  1379.     PFORMAT_STRING                      pFormat
  1380.     );
  1381.  
  1382. /* Context handles */
  1383.  
  1384. void RPC_ENTRY
  1385. NdrClientContextMarshall(
  1386.     PMIDL_STUB_MESSAGE    pStubMsg,
  1387.     NDR_CCONTEXT          ContextHandle,
  1388.     int                   fCheck
  1389.     );
  1390.  
  1391. void RPC_ENTRY
  1392. NdrServerContextMarshall(
  1393.     PMIDL_STUB_MESSAGE    pStubMsg,
  1394.     NDR_SCONTEXT          ContextHandle,
  1395.     NDR_RUNDOWN           RundownRoutine
  1396.     );
  1397.  
  1398. /*
  1399.  * Unmarshall routines
  1400.  */
  1401.  
  1402. void RPC_ENTRY
  1403. NdrSimpleTypeUnmarshall(
  1404.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1405.     unsigned char __RPC_FAR *           pMemory,
  1406.     unsigned char                       FormatChar
  1407.     );
  1408.  
  1409. unsigned char __RPC_FAR * RPC_ENTRY
  1410. NdrPointerUnmarshall(
  1411.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1412.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1413.     PFORMAT_STRING                          pFormat,
  1414.     unsigned char                           fMustAlloc
  1415.     );
  1416.  
  1417. /* Structures */
  1418.  
  1419. unsigned char __RPC_FAR * RPC_ENTRY
  1420. NdrSimpleStructUnmarshall(
  1421.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1422.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1423.     PFORMAT_STRING                          pFormat,
  1424.     unsigned char                           fMustAlloc
  1425.     );
  1426.  
  1427. unsigned char __RPC_FAR * RPC_ENTRY
  1428. NdrConformantStructUnmarshall(
  1429.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1430.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1431.     PFORMAT_STRING                          pFormat,
  1432.     unsigned char                           fMustAlloc
  1433.     );
  1434.  
  1435. unsigned char __RPC_FAR * RPC_ENTRY
  1436. NdrConformantVaryingStructUnmarshall(
  1437.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1438.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1439.     PFORMAT_STRING                          pFormat,
  1440.     unsigned char                           fMustAlloc
  1441.     );
  1442.  
  1443. unsigned char __RPC_FAR * RPC_ENTRY
  1444. NdrHardStructUnmarshall(
  1445.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1446.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1447.     PFORMAT_STRING                          pFormat,
  1448.     unsigned char                           fMustAlloc
  1449.     );
  1450.  
  1451. unsigned char __RPC_FAR * RPC_ENTRY
  1452. NdrComplexStructUnmarshall(
  1453.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1454.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1455.     PFORMAT_STRING                          pFormat,
  1456.     unsigned char                           fMustAlloc
  1457.     );
  1458.  
  1459. /* Arrays */
  1460.  
  1461. unsigned char __RPC_FAR * RPC_ENTRY
  1462. NdrFixedArrayUnmarshall(
  1463.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1464.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1465.     PFORMAT_STRING                          pFormat,
  1466.     unsigned char                           fMustAlloc
  1467.     );
  1468.  
  1469. unsigned char __RPC_FAR * RPC_ENTRY
  1470. NdrConformantArrayUnmarshall(
  1471.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1472.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1473.     PFORMAT_STRING                          pFormat,
  1474.     unsigned char                           fMustAlloc
  1475.     );
  1476.  
  1477. unsigned char __RPC_FAR * RPC_ENTRY
  1478. NdrConformantVaryingArrayUnmarshall(
  1479.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1480.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1481.     PFORMAT_STRING                          pFormat,
  1482.     unsigned char                           fMustAlloc
  1483.     );
  1484.  
  1485. unsigned char __RPC_FAR * RPC_ENTRY
  1486. NdrVaryingArrayUnmarshall(
  1487.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1488.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1489.     PFORMAT_STRING                          pFormat,
  1490.     unsigned char                           fMustAlloc
  1491.     );
  1492.  
  1493. unsigned char __RPC_FAR * RPC_ENTRY
  1494. NdrComplexArrayUnmarshall(
  1495.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1496.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1497.     PFORMAT_STRING                          pFormat,
  1498.     unsigned char                           fMustAlloc
  1499.     );
  1500.  
  1501. /* Strings */
  1502.  
  1503. unsigned char __RPC_FAR * RPC_ENTRY
  1504. NdrNonConformantStringUnmarshall(
  1505.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1506.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1507.     PFORMAT_STRING                          pFormat,
  1508.     unsigned char                           fMustAlloc
  1509.     );
  1510.  
  1511. unsigned char __RPC_FAR * RPC_ENTRY
  1512. NdrConformantStringUnmarshall(
  1513.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1514.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1515.     PFORMAT_STRING                          pFormat,
  1516.     unsigned char                           fMustAlloc
  1517.     );
  1518.  
  1519. /* Unions */
  1520.  
  1521. unsigned char __RPC_FAR * RPC_ENTRY
  1522. NdrEncapsulatedUnionUnmarshall(
  1523.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1524.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1525.     PFORMAT_STRING                          pFormat,
  1526.     unsigned char                           fMustAlloc
  1527.     );
  1528.  
  1529. unsigned char __RPC_FAR * RPC_ENTRY
  1530. NdrNonEncapsulatedUnionUnmarshall(
  1531.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1532.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1533.     PFORMAT_STRING                          pFormat,
  1534.     unsigned char                           fMustAlloc
  1535.     );
  1536.  
  1537. /* Byte count pointer */
  1538.  
  1539. unsigned char __RPC_FAR * RPC_ENTRY
  1540. NdrByteCountPointerUnmarshall(
  1541.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1542.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1543.     PFORMAT_STRING                          pFormat,
  1544.     unsigned char                           fMustAlloc
  1545.     );
  1546.  
  1547. /* Transmit as and represent as*/
  1548.  
  1549. unsigned char __RPC_FAR * RPC_ENTRY
  1550. NdrXmitOrRepAsUnmarshall(
  1551.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1552.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1553.     PFORMAT_STRING                          pFormat,
  1554.     unsigned char                           fMustAlloc
  1555.     );
  1556.  
  1557. /* User_marshal */
  1558.  
  1559. unsigned char __RPC_FAR * RPC_ENTRY
  1560. NdrUserMarshalUnmarshall(
  1561.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1562.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1563.     PFORMAT_STRING                          pFormat,
  1564.     unsigned char                           fMustAlloc
  1565.     );
  1566.  
  1567. /* Cairo interface pointer */
  1568.  
  1569. unsigned char __RPC_FAR * RPC_ENTRY
  1570. NdrInterfacePointerUnmarshall(
  1571.     PMIDL_STUB_MESSAGE                      pStubMsg,
  1572.     unsigned char __RPC_FAR * __RPC_FAR *   ppMemory,
  1573.     PFORMAT_STRING                          pFormat,
  1574.     unsigned char                           fMustAlloc
  1575.     );
  1576.  
  1577. /* Context handles */
  1578.  
  1579. void RPC_ENTRY
  1580. NdrClientContextUnmarshall(
  1581.     PMIDL_STUB_MESSAGE          pStubMsg,
  1582.     NDR_CCONTEXT __RPC_FAR *    pContextHandle,
  1583.     RPC_BINDING_HANDLE          BindHandle
  1584.     );
  1585.  
  1586. NDR_SCONTEXT RPC_ENTRY
  1587. NdrServerContextUnmarshall(
  1588.     PMIDL_STUB_MESSAGE          pStubMsg
  1589.     );
  1590.  
  1591. /*
  1592.  * Buffer sizing routines
  1593.  */
  1594.  
  1595. void RPC_ENTRY
  1596. NdrPointerBufferSize(
  1597.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1598.     unsigned char __RPC_FAR *           pMemory,
  1599.     PFORMAT_STRING                      pFormat
  1600.     );
  1601.  
  1602. /* Structures */
  1603.  
  1604. void RPC_ENTRY
  1605. NdrSimpleStructBufferSize(
  1606.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1607.     unsigned char __RPC_FAR *           pMemory,
  1608.     PFORMAT_STRING                      pFormat
  1609.     );
  1610.  
  1611. void RPC_ENTRY
  1612. NdrConformantStructBufferSize(
  1613.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1614.     unsigned char __RPC_FAR *           pMemory,
  1615.     PFORMAT_STRING                      pFormat
  1616.     );
  1617.  
  1618. void RPC_ENTRY
  1619. NdrConformantVaryingStructBufferSize(
  1620.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1621.     unsigned char __RPC_FAR *           pMemory,
  1622.     PFORMAT_STRING                      pFormat
  1623.     );
  1624.  
  1625. void RPC_ENTRY
  1626. NdrHardStructBufferSize(
  1627.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1628.     unsigned char __RPC_FAR *           pMemory,
  1629.     PFORMAT_STRING                      pFormat
  1630.     );
  1631.  
  1632. void RPC_ENTRY
  1633. NdrComplexStructBufferSize(
  1634.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1635.     unsigned char __RPC_FAR *           pMemory,
  1636.     PFORMAT_STRING                      pFormat
  1637.     );
  1638.  
  1639. /* Arrays */
  1640.  
  1641. void RPC_ENTRY
  1642. NdrFixedArrayBufferSize(
  1643.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1644.     unsigned char __RPC_FAR *           pMemory,
  1645.     PFORMAT_STRING                      pFormat
  1646.     );
  1647.  
  1648. void RPC_ENTRY
  1649. NdrConformantArrayBufferSize(
  1650.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1651.     unsigned char __RPC_FAR *           pMemory,
  1652.     PFORMAT_STRING                      pFormat
  1653.     );
  1654.  
  1655. void RPC_ENTRY
  1656. NdrConformantVaryingArrayBufferSize(
  1657.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1658.     unsigned char __RPC_FAR *           pMemory,
  1659.     PFORMAT_STRING                      pFormat
  1660.     );
  1661.  
  1662. void RPC_ENTRY
  1663. NdrVaryingArrayBufferSize(
  1664.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1665.     unsigned char __RPC_FAR *           pMemory,
  1666.     PFORMAT_STRING                      pFormat
  1667.     );
  1668.  
  1669. void RPC_ENTRY
  1670. NdrComplexArrayBufferSize(
  1671.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1672.     unsigned char __RPC_FAR *           pMemory,
  1673.     PFORMAT_STRING                      pFormat
  1674.     );
  1675.  
  1676. /* Strings */
  1677.  
  1678. void RPC_ENTRY
  1679. NdrConformantStringBufferSize(
  1680.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1681.     unsigned char __RPC_FAR *           pMemory,
  1682.     PFORMAT_STRING                      pFormat
  1683.     );
  1684.  
  1685. void RPC_ENTRY
  1686. NdrNonConformantStringBufferSize(
  1687.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1688.     unsigned char __RPC_FAR *           pMemory,
  1689.     PFORMAT_STRING                      pFormat
  1690.     );
  1691.  
  1692. /* Unions */
  1693.  
  1694. void RPC_ENTRY
  1695. NdrEncapsulatedUnionBufferSize(
  1696.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1697.     unsigned char __RPC_FAR *           pMemory,
  1698.     PFORMAT_STRING                      pFormat
  1699.     );
  1700.  
  1701. void RPC_ENTRY
  1702. NdrNonEncapsulatedUnionBufferSize(
  1703.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1704.     unsigned char __RPC_FAR *           pMemory,
  1705.     PFORMAT_STRING                      pFormat
  1706.     );
  1707.  
  1708. /* Byte count pointer */
  1709.  
  1710. void RPC_ENTRY
  1711. NdrByteCountPointerBufferSize(
  1712.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1713.     unsigned char __RPC_FAR *           pMemory,
  1714.     PFORMAT_STRING                      pFormat
  1715.     );
  1716.  
  1717. /* Transmit as and represent as*/
  1718.  
  1719. void RPC_ENTRY
  1720. NdrXmitOrRepAsBufferSize(
  1721.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1722.     unsigned char __RPC_FAR *           pMemory,
  1723.     PFORMAT_STRING                      pFormat
  1724.     );
  1725.  
  1726. /* User_marshal */
  1727.  
  1728. void RPC_ENTRY
  1729. NdrUserMarshalBufferSize(
  1730.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1731.     unsigned char __RPC_FAR *           pMemory,
  1732.     PFORMAT_STRING                      pFormat
  1733.     );
  1734.  
  1735. /* Cairo Interface pointer */
  1736.  
  1737. void RPC_ENTRY
  1738. NdrInterfacePointerBufferSize(
  1739.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1740.     unsigned char __RPC_FAR *           pMemory,
  1741.     PFORMAT_STRING                      pFormat
  1742.     );
  1743.  
  1744. // Context Handle size
  1745. //
  1746. void RPC_ENTRY
  1747. NdrContextHandleSize(
  1748.     PMIDL_STUB_MESSAGE          pStubMsg,
  1749.     unsigned char __RPC_FAR *           pMemory,
  1750.     PFORMAT_STRING                      pFormat
  1751.     );
  1752.  
  1753. /*
  1754.  * Memory sizing routines
  1755.  */
  1756.  
  1757. unsigned long RPC_ENTRY
  1758. NdrPointerMemorySize(
  1759.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1760.     PFORMAT_STRING                      pFormat
  1761.     );
  1762.  
  1763. /* Structures */
  1764.  
  1765. unsigned long RPC_ENTRY
  1766. NdrSimpleStructMemorySize(
  1767.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1768.     PFORMAT_STRING                      pFormat
  1769.     );
  1770.  
  1771. unsigned long RPC_ENTRY
  1772. NdrConformantStructMemorySize(
  1773.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1774.     PFORMAT_STRING                      pFormat
  1775.     );
  1776.  
  1777. unsigned long RPC_ENTRY
  1778. NdrConformantVaryingStructMemorySize(
  1779.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1780.     PFORMAT_STRING                      pFormat
  1781.     );
  1782.  
  1783. unsigned long RPC_ENTRY
  1784. NdrHardStructMemorySize(
  1785.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1786.     PFORMAT_STRING                      pFormat
  1787.     );
  1788.  
  1789. unsigned long RPC_ENTRY
  1790. NdrComplexStructMemorySize(
  1791.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1792.     PFORMAT_STRING                      pFormat
  1793.     );
  1794.  
  1795. /* Arrays */
  1796.  
  1797. unsigned long RPC_ENTRY
  1798. NdrFixedArrayMemorySize(
  1799.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1800.     PFORMAT_STRING                      pFormat
  1801.     );
  1802.  
  1803. unsigned long RPC_ENTRY
  1804. NdrConformantArrayMemorySize(
  1805.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1806.     PFORMAT_STRING                      pFormat
  1807.     );
  1808.  
  1809. unsigned long RPC_ENTRY
  1810. NdrConformantVaryingArrayMemorySize(
  1811.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1812.     PFORMAT_STRING                      pFormat
  1813.     );
  1814.  
  1815. unsigned long RPC_ENTRY
  1816. NdrVaryingArrayMemorySize(
  1817.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1818.     PFORMAT_STRING                      pFormat
  1819.     );
  1820.  
  1821. unsigned long RPC_ENTRY
  1822. NdrComplexArrayMemorySize(
  1823.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1824.     PFORMAT_STRING                      pFormat
  1825.     );
  1826.  
  1827. /* Strings */
  1828.  
  1829. unsigned long RPC_ENTRY
  1830. NdrConformantStringMemorySize(
  1831.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1832.     PFORMAT_STRING                      pFormat
  1833.     );
  1834.  
  1835. unsigned long RPC_ENTRY
  1836. NdrNonConformantStringMemorySize(
  1837.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1838.     PFORMAT_STRING                      pFormat
  1839.     );
  1840.  
  1841. /* Unions */
  1842.  
  1843. unsigned long RPC_ENTRY
  1844. NdrEncapsulatedUnionMemorySize(
  1845.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1846.     PFORMAT_STRING                      pFormat
  1847.     );
  1848.  
  1849. unsigned long RPC_ENTRY
  1850. NdrNonEncapsulatedUnionMemorySize(
  1851.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1852.     PFORMAT_STRING                      pFormat
  1853.     );
  1854.  
  1855. /* Transmit as and represent as*/
  1856.  
  1857. unsigned long RPC_ENTRY
  1858. NdrXmitOrRepAsMemorySize(
  1859.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1860.     PFORMAT_STRING                      pFormat
  1861.     );
  1862.  
  1863. /* User_marshal */
  1864.  
  1865. unsigned long RPC_ENTRY
  1866. NdrUserMarshalMemorySize(
  1867.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1868.     PFORMAT_STRING                      pFormat
  1869.     );
  1870.  
  1871. /* Cairo Interface pointer */
  1872.  
  1873. unsigned long RPC_ENTRY
  1874. NdrInterfacePointerMemorySize(
  1875.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1876.     PFORMAT_STRING                      pFormat
  1877.     );
  1878.  
  1879. /*
  1880.  * Freeing routines
  1881.  */
  1882.  
  1883. void RPC_ENTRY
  1884. NdrPointerFree(
  1885.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1886.     unsigned char __RPC_FAR *           pMemory,
  1887.     PFORMAT_STRING                      pFormat
  1888.     );
  1889.  
  1890. /* Structures */
  1891.  
  1892. void RPC_ENTRY
  1893. NdrSimpleStructFree(
  1894.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1895.     unsigned char __RPC_FAR *           pMemory,
  1896.     PFORMAT_STRING                      pFormat
  1897.     );
  1898.  
  1899. void RPC_ENTRY
  1900. NdrConformantStructFree(
  1901.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1902.     unsigned char __RPC_FAR *           pMemory,
  1903.     PFORMAT_STRING                      pFormat
  1904.     );
  1905.  
  1906. void RPC_ENTRY
  1907. NdrConformantVaryingStructFree(
  1908.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1909.     unsigned char __RPC_FAR *           pMemory,
  1910.     PFORMAT_STRING                      pFormat
  1911.     );
  1912.  
  1913. void RPC_ENTRY
  1914. NdrHardStructFree(
  1915.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1916.     unsigned char __RPC_FAR *           pMemory,
  1917.     PFORMAT_STRING                      pFormat
  1918.     );
  1919.  
  1920. void RPC_ENTRY
  1921. NdrComplexStructFree(
  1922.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1923.     unsigned char __RPC_FAR *           pMemory,
  1924.     PFORMAT_STRING                      pFormat
  1925.     );
  1926.  
  1927. /* Arrays */
  1928.  
  1929. void RPC_ENTRY
  1930. NdrFixedArrayFree(
  1931.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1932.     unsigned char __RPC_FAR *           pMemory,
  1933.     PFORMAT_STRING                      pFormat
  1934.     );
  1935.  
  1936. void RPC_ENTRY
  1937. NdrConformantArrayFree(
  1938.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1939.     unsigned char __RPC_FAR *           pMemory,
  1940.     PFORMAT_STRING                      pFormat
  1941.     );
  1942.  
  1943. void RPC_ENTRY
  1944. NdrConformantVaryingArrayFree(
  1945.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1946.     unsigned char __RPC_FAR *           pMemory,
  1947.     PFORMAT_STRING                      pFormat
  1948.     );
  1949.  
  1950. void RPC_ENTRY
  1951. NdrVaryingArrayFree(
  1952.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1953.     unsigned char __RPC_FAR *           pMemory,
  1954.     PFORMAT_STRING                      pFormat
  1955.     );
  1956.  
  1957. void RPC_ENTRY
  1958. NdrComplexArrayFree(
  1959.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1960.     unsigned char __RPC_FAR *           pMemory,
  1961.     PFORMAT_STRING                      pFormat
  1962.     );
  1963.  
  1964. /* Unions */
  1965.  
  1966. void RPC_ENTRY
  1967. NdrEncapsulatedUnionFree(
  1968.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1969.     unsigned char __RPC_FAR *           pMemory,
  1970.     PFORMAT_STRING                      pFormat
  1971.     );
  1972.  
  1973. void RPC_ENTRY
  1974. NdrNonEncapsulatedUnionFree(
  1975.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1976.     unsigned char __RPC_FAR *           pMemory,
  1977.     PFORMAT_STRING                      pFormat
  1978.     );
  1979.  
  1980. /* Byte count */
  1981.  
  1982. void RPC_ENTRY
  1983. NdrByteCountPointerFree(
  1984.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1985.     unsigned char __RPC_FAR *           pMemory,
  1986.     PFORMAT_STRING                      pFormat
  1987.     );
  1988.  
  1989. /* Transmit as and represent as*/
  1990.  
  1991. void RPC_ENTRY
  1992. NdrXmitOrRepAsFree(
  1993.     PMIDL_STUB_MESSAGE                  pStubMsg,
  1994.     unsigned char __RPC_FAR *           pMemory,
  1995.     PFORMAT_STRING                      pFormat
  1996.     );
  1997.  
  1998. /* User_marshal */
  1999.  
  2000. void RPC_ENTRY
  2001. NdrUserMarshalFree(
  2002.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2003.     unsigned char __RPC_FAR *           pMemory,
  2004.     PFORMAT_STRING                      pFormat
  2005.     );
  2006.  
  2007. /* Cairo Interface pointer */
  2008.  
  2009. void RPC_ENTRY
  2010. NdrInterfacePointerFree(
  2011.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2012.     unsigned char __RPC_FAR *           pMemory,
  2013.     PFORMAT_STRING                      pFormat
  2014.     );
  2015.  
  2016. /*
  2017.  * Endian conversion routine.
  2018.  */
  2019.  
  2020. void RPC_ENTRY
  2021. NdrConvert2(
  2022.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2023.     PFORMAT_STRING                      pFormat,
  2024.     long                                NumberParams
  2025.     );
  2026.  
  2027. void RPC_ENTRY
  2028. NdrConvert(
  2029.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2030.     PFORMAT_STRING                      pFormat
  2031.     );
  2032.  
  2033. #define USER_MARSHAL_FC_BYTE         1
  2034. #define USER_MARSHAL_FC_CHAR         2
  2035. #define USER_MARSHAL_FC_SMALL        3
  2036. #define USER_MARSHAL_FC_USMALL       4
  2037. #define USER_MARSHAL_FC_WCHAR        5
  2038. #define USER_MARSHAL_FC_SHORT        6
  2039. #define USER_MARSHAL_FC_USHORT       7
  2040. #define USER_MARSHAL_FC_LONG         8
  2041. #define USER_MARSHAL_FC_ULONG        9
  2042. #define USER_MARSHAL_FC_FLOAT       10
  2043. #define USER_MARSHAL_FC_HYPER       11
  2044. #define USER_MARSHAL_FC_DOUBLE      12
  2045.  
  2046. unsigned char __RPC_FAR * RPC_ENTRY
  2047. NdrUserMarshalSimpleTypeConvert(
  2048.     unsigned long * pFlags,
  2049.     unsigned char * pBuffer,
  2050.     unsigned char   FormatChar
  2051.     );
  2052.  
  2053. /*
  2054.  * Auxilary routines
  2055.  */
  2056.  
  2057. void RPC_ENTRY
  2058. NdrClientInitializeNew(
  2059.     PRPC_MESSAGE                        pRpcMsg,
  2060.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2061.     PMIDL_STUB_DESC                     pStubDescriptor,
  2062.     unsigned int                        ProcNum
  2063.     );
  2064.  
  2065. unsigned char __RPC_FAR * RPC_ENTRY
  2066. NdrServerInitializeNew(
  2067.     PRPC_MESSAGE                        pRpcMsg,
  2068.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2069.     PMIDL_STUB_DESC                     pStubDescriptor
  2070.     );
  2071.  
  2072. void RPC_ENTRY
  2073. NdrServerInitializePartial(
  2074.     PRPC_MESSAGE                        pRpcMsg,
  2075.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2076.     PMIDL_STUB_DESC                     pStubDescriptor,
  2077.     unsigned long                       RequestedBufferSize
  2078.     );
  2079.  
  2080. void RPC_ENTRY
  2081. NdrClientInitialize(
  2082.     PRPC_MESSAGE                        pRpcMsg,
  2083.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2084.     PMIDL_STUB_DESC                     pStubDescriptor,
  2085.     unsigned int                        ProcNum
  2086.     );
  2087.  
  2088. unsigned char __RPC_FAR * RPC_ENTRY
  2089. NdrServerInitialize(
  2090.     PRPC_MESSAGE                        pRpcMsg,
  2091.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2092.     PMIDL_STUB_DESC                     pStubDescriptor
  2093.     );
  2094.  
  2095. unsigned char __RPC_FAR * RPC_ENTRY
  2096. NdrServerInitializeUnmarshall (
  2097.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2098.     PMIDL_STUB_DESC                     pStubDescriptor,
  2099.     PRPC_MESSAGE                        pRpcMsg
  2100.     );
  2101.  
  2102. void RPC_ENTRY
  2103. NdrServerInitializeMarshall (
  2104.     PRPC_MESSAGE                        pRpcMsg,
  2105.     PMIDL_STUB_MESSAGE                  pStubMsg
  2106.     );
  2107.  
  2108. unsigned char __RPC_FAR * RPC_ENTRY
  2109. NdrGetBuffer(
  2110.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2111.     unsigned long                       BufferLength,
  2112.     RPC_BINDING_HANDLE                  Handle
  2113.     );
  2114.  
  2115. unsigned char __RPC_FAR * RPC_ENTRY
  2116. NdrNsGetBuffer(
  2117.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2118.     unsigned long                       BufferLength,
  2119.     RPC_BINDING_HANDLE                  Handle
  2120.     );
  2121.  
  2122. unsigned char __RPC_FAR * RPC_ENTRY
  2123. NdrGetPipeBuffer(
  2124.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2125.     unsigned long                       BufferLength,
  2126.     RPC_BINDING_HANDLE                  Handle );
  2127.  
  2128. void RPC_ENTRY
  2129. NdrGetPartialBuffer(
  2130.     PMIDL_STUB_MESSAGE                  pStubMsg );
  2131.  
  2132. unsigned char __RPC_FAR * RPC_ENTRY
  2133. NdrSendReceive(
  2134.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2135.     unsigned char __RPC_FAR*            pBufferEnd
  2136.     );
  2137.  
  2138. unsigned char __RPC_FAR * RPC_ENTRY
  2139. NdrNsSendReceive(
  2140.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2141.     unsigned char __RPC_FAR *           pBufferEnd,
  2142.     RPC_BINDING_HANDLE __RPC_FAR *      pAutoHandle
  2143.     );
  2144.  
  2145. void  RPC_ENTRY
  2146. NdrPipeSendReceive(
  2147.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2148.     NDR_PIPE_DESC  *                    pPipeDesc
  2149.     );
  2150.  
  2151. void RPC_ENTRY
  2152. NdrFreeBuffer(
  2153.     PMIDL_STUB_MESSAGE                  pStubMsg
  2154.     );
  2155.  
  2156.  
  2157. /*
  2158.  * Pipe specific calls
  2159.  */
  2160.  
  2161. void RPC_ENTRY
  2162. NdrPipesInitialize(
  2163.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2164.     PFORMAT_STRING                      pParamDesc,
  2165.     NDR_PIPE_DESC    __RPC_FAR *        pPipeDesc,
  2166.     NDR_PIPE_MESSAGE __RPC_FAR *        pPipeMsg,
  2167.     char             __RPC_FAR *        pStackTop,
  2168.     unsigned long                       NumberParams );
  2169.  
  2170. void
  2171. NdrMarkNextActivePipe( 
  2172.     NDR_PIPE_DESC __RPC_FAR  *          pPipeDesc,
  2173.     unsigned int                        DirectionMask );
  2174.  
  2175. void RPC_ENTRY
  2176. NdrPipePull(
  2177.     char          __RPC_FAR *           pState,
  2178.     void          __RPC_FAR *           buf,
  2179.     unsigned long                       esize,
  2180.     unsigned long __RPC_FAR *           ecount );
  2181.  
  2182. void  RPC_ENTRY
  2183. NdrPipePush(
  2184.     char          __RPC_FAR *           pState,
  2185.     void          __RPC_FAR *           buf,
  2186.     unsigned long                       ecount );
  2187.  
  2188. void RPC_ENTRY
  2189. NdrIsAppDoneWithPipes( 
  2190.     NDR_PIPE_DESC  *                    pPipeDesc
  2191.     );
  2192.  
  2193. void RPC_ENTRY
  2194. NdrPipesDone( 
  2195.     PMIDL_STUB_MESSAGE                  pStubMsg
  2196.     );
  2197.  
  2198.  
  2199. /*
  2200.  * Interpeter calls.
  2201.  */
  2202.  
  2203. /* client */
  2204.  
  2205. CLIENT_CALL_RETURN RPC_VAR_ENTRY
  2206. NdrClientCall2(
  2207.     PMIDL_STUB_DESC                     pStubDescriptor,
  2208.     PFORMAT_STRING                      pFormat,
  2209.     ...
  2210.     );
  2211.  
  2212. CLIENT_CALL_RETURN RPC_VAR_ENTRY
  2213. NdrClientCall(
  2214.     PMIDL_STUB_DESC                     pStubDescriptor,
  2215.     PFORMAT_STRING                      pFormat,
  2216.     ...
  2217.     );
  2218.  
  2219. /* server */
  2220. typedef enum {
  2221.     STUB_UNMARSHAL,
  2222.     STUB_CALL_SERVER,
  2223.     STUB_MARSHAL,
  2224.     STUB_CALL_SERVER_NO_HRESULT
  2225. }STUB_PHASE;
  2226.  
  2227. typedef enum {
  2228.     PROXY_CALCSIZE,
  2229.     PROXY_GETBUFFER,
  2230.     PROXY_MARSHAL,
  2231.     PROXY_SENDRECEIVE,
  2232.     PROXY_UNMARSHAL
  2233. }PROXY_PHASE;
  2234.  
  2235. long RPC_ENTRY
  2236. NdrStubCall2(
  2237.     struct IRpcStubBuffer __RPC_FAR *    pThis,
  2238.     struct IRpcChannelBuffer __RPC_FAR * pChannel,
  2239.     PRPC_MESSAGE                         pRpcMsg,
  2240.     unsigned long __RPC_FAR *            pdwStubPhase
  2241.     );
  2242.  
  2243. void RPC_ENTRY
  2244. NdrServerCall2(
  2245.     PRPC_MESSAGE                         pRpcMsg
  2246.     );
  2247.  
  2248. long RPC_ENTRY
  2249. NdrStubCall (
  2250.     struct IRpcStubBuffer __RPC_FAR *    pThis,
  2251.     struct IRpcChannelBuffer __RPC_FAR * pChannel,
  2252.     PRPC_MESSAGE                         pRpcMsg,
  2253.     unsigned long __RPC_FAR *            pdwStubPhase
  2254.     );
  2255.  
  2256. void RPC_ENTRY
  2257. NdrServerCall(
  2258.     PRPC_MESSAGE                        pRpcMsg
  2259.     );
  2260.  
  2261. int RPC_ENTRY
  2262. NdrServerUnmarshall(
  2263.     struct IRpcChannelBuffer __RPC_FAR * pChannel,
  2264.     PRPC_MESSAGE                         pRpcMsg,
  2265.     PMIDL_STUB_MESSAGE                   pStubMsg,
  2266.     PMIDL_STUB_DESC                      pStubDescriptor,
  2267.     PFORMAT_STRING                       pFormat,
  2268.     void __RPC_FAR *                     pParamList
  2269.     );
  2270.  
  2271. void RPC_ENTRY
  2272. NdrServerMarshall(
  2273.     struct IRpcStubBuffer __RPC_FAR *    pThis,
  2274.     struct IRpcChannelBuffer __RPC_FAR * pChannel,
  2275.     PMIDL_STUB_MESSAGE                   pStubMsg,
  2276.     PFORMAT_STRING                       pFormat
  2277.     );
  2278.  
  2279. /* Comm and Fault status */
  2280.  
  2281. RPC_STATUS RPC_ENTRY
  2282. NdrMapCommAndFaultStatus(
  2283.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2284.     unsigned long __RPC_FAR *                       pCommStatus,
  2285.     unsigned long __RPC_FAR *                       pFaultStatus,
  2286.     RPC_STATUS                          Status
  2287.     );
  2288.  
  2289. /* Helper routines */
  2290.  
  2291. int RPC_ENTRY
  2292. NdrSH_UPDecision(
  2293.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2294.     unsigned char           __RPC_FAR *__RPC_FAR *          pPtrInMem,
  2295.     RPC_BUFPTR                          pBuffer
  2296.     );
  2297.  
  2298. int RPC_ENTRY
  2299. NdrSH_TLUPDecision(
  2300.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2301.     unsigned char           __RPC_FAR *__RPC_FAR *          pPtrInMem
  2302.     );
  2303.  
  2304. int RPC_ENTRY
  2305. NdrSH_TLUPDecisionBuffer(
  2306.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2307.     unsigned char           __RPC_FAR *__RPC_FAR *          pPtrInMem
  2308.     );
  2309.  
  2310. int RPC_ENTRY
  2311. NdrSH_IfAlloc(
  2312.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2313.     unsigned char           __RPC_FAR *__RPC_FAR *          pPtrInMem,
  2314.     unsigned long                       Count
  2315.     );
  2316.  
  2317. int RPC_ENTRY
  2318. NdrSH_IfAllocRef(
  2319.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2320.     unsigned char           __RPC_FAR *__RPC_FAR *          pPtrInMem,
  2321.     unsigned long                       Count
  2322.     );
  2323.  
  2324. int RPC_ENTRY
  2325. NdrSH_IfAllocSet(
  2326.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2327.     unsigned char           __RPC_FAR *__RPC_FAR *          pPtrInMem,
  2328.     unsigned long                       Count
  2329.     );
  2330.  
  2331. RPC_BUFPTR RPC_ENTRY
  2332. NdrSH_IfCopy(
  2333.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2334.     unsigned char           __RPC_FAR *__RPC_FAR *          pPtrInMem,
  2335.     unsigned long                       Count
  2336.     );
  2337.  
  2338. RPC_BUFPTR RPC_ENTRY
  2339. NdrSH_IfAllocCopy(
  2340.     PMIDL_STUB_MESSAGE                  pStubMsg,
  2341.     unsigned char           __RPC_FAR *__RPC_FAR *          pPtrInMem,
  2342.     unsigned long                       Count
  2343.     );
  2344.  
  2345. unsigned long RPC_ENTRY
  2346. NdrSH_Copy(
  2347.     unsigned char           __RPC_FAR *         pStubMsg,
  2348.     unsigned char           __RPC_FAR *         pPtrInMem,
  2349.     unsigned long                       Count
  2350.     );
  2351.  
  2352. void RPC_ENTRY
  2353. NdrSH_IfFree(
  2354.     PMIDL_STUB_MESSAGE                  pMessage,
  2355.     unsigned char           __RPC_FAR *         pPtr );
  2356.  
  2357.  
  2358. RPC_BUFPTR  RPC_ENTRY
  2359. NdrSH_StringMarshall(
  2360.     PMIDL_STUB_MESSAGE                  pMessage,
  2361.     unsigned char           __RPC_FAR *         pMemory,
  2362.     unsigned long                       Count,
  2363.     int                                 Size );
  2364.  
  2365. RPC_BUFPTR  RPC_ENTRY
  2366. NdrSH_StringUnMarshall(
  2367.     PMIDL_STUB_MESSAGE                  pMessage,
  2368.     unsigned char           __RPC_FAR *__RPC_FAR *          pMemory,
  2369.     int                                 Size );
  2370.  
  2371. /****************************************************************************
  2372.     MIDL 2.0 memory package: rpc_ss_* rpc_sm_*
  2373.  ****************************************************************************/
  2374.  
  2375. typedef void __RPC_FAR * RPC_SS_THREAD_HANDLE;
  2376.  
  2377. typedef void __RPC_FAR * __RPC_API
  2378. RPC_CLIENT_ALLOC (
  2379.     IN size_t Size
  2380.     );
  2381.  
  2382. typedef void __RPC_API
  2383. RPC_CLIENT_FREE (
  2384.     IN void __RPC_FAR * Ptr
  2385.     );
  2386.  
  2387. /*++
  2388.      RpcSs* package
  2389. --*/
  2390.  
  2391. void __RPC_FAR * RPC_ENTRY
  2392. RpcSsAllocate (
  2393.     IN size_t Size
  2394.     );
  2395.  
  2396. void RPC_ENTRY
  2397. RpcSsDisableAllocate (
  2398.     void
  2399.     );
  2400.  
  2401. void RPC_ENTRY
  2402. RpcSsEnableAllocate (
  2403.     void
  2404.     );
  2405.  
  2406. void RPC_ENTRY
  2407. RpcSsFree (
  2408.     IN void __RPC_FAR * NodeToFree
  2409.     );
  2410.  
  2411. RPC_SS_THREAD_HANDLE RPC_ENTRY
  2412. RpcSsGetThreadHandle (
  2413.     void
  2414.     );
  2415.  
  2416. void RPC_ENTRY
  2417. RpcSsSetClientAllocFree (
  2418.     IN RPC_CLIENT_ALLOC __RPC_FAR * ClientAlloc,
  2419.     IN RPC_CLIENT_FREE __RPC_FAR * ClientFree
  2420.     );
  2421.  
  2422. void RPC_ENTRY
  2423. RpcSsSetThreadHandle (
  2424.     IN RPC_SS_THREAD_HANDLE Id
  2425.     );
  2426.  
  2427. void RPC_ENTRY
  2428. RpcSsSwapClientAllocFree (
  2429.     IN RPC_CLIENT_ALLOC __RPC_FAR * ClientAlloc,
  2430.     IN RPC_CLIENT_FREE __RPC_FAR * ClientFree,
  2431.     OUT RPC_CLIENT_ALLOC __RPC_FAR * __RPC_FAR * OldClientAlloc,
  2432.     OUT RPC_CLIENT_FREE __RPC_FAR * __RPC_FAR * OldClientFree
  2433.     );
  2434.  
  2435. /*++
  2436.      RpcSm* package
  2437. --*/
  2438.  
  2439. void __RPC_FAR * RPC_ENTRY
  2440. RpcSmAllocate (
  2441.     IN  size_t          Size,
  2442.     OUT RPC_STATUS __RPC_FAR *    pStatus
  2443.     );
  2444.  
  2445. RPC_STATUS RPC_ENTRY
  2446. RpcSmClientFree (
  2447.     IN  void __RPC_FAR * pNodeToFree
  2448.     );
  2449.  
  2450. RPC_STATUS  RPC_ENTRY
  2451. RpcSmDestroyClientContext (
  2452.     IN void __RPC_FAR * __RPC_FAR * ContextHandle
  2453.     );
  2454.  
  2455. RPC_STATUS  RPC_ENTRY
  2456. RpcSmDisableAllocate (
  2457.     void
  2458.     );
  2459.  
  2460. RPC_STATUS  RPC_ENTRY
  2461. RpcSmEnableAllocate (
  2462.     void
  2463.     );
  2464.  
  2465. RPC_STATUS  RPC_ENTRY
  2466. RpcSmFree (
  2467.     IN void __RPC_FAR * NodeToFree
  2468.     );
  2469.  
  2470. RPC_SS_THREAD_HANDLE RPC_ENTRY
  2471. RpcSmGetThreadHandle (
  2472.     OUT RPC_STATUS __RPC_FAR *    pStatus
  2473.     );
  2474.  
  2475. RPC_STATUS  RPC_ENTRY
  2476. RpcSmSetClientAllocFree (
  2477.     IN RPC_CLIENT_ALLOC __RPC_FAR * ClientAlloc,
  2478.     IN RPC_CLIENT_FREE __RPC_FAR * ClientFree
  2479.     );
  2480.  
  2481. RPC_STATUS  RPC_ENTRY
  2482. RpcSmSetThreadHandle (
  2483.     IN RPC_SS_THREAD_HANDLE Id
  2484.     );
  2485.  
  2486. RPC_STATUS  RPC_ENTRY
  2487. RpcSmSwapClientAllocFree (
  2488.     IN RPC_CLIENT_ALLOC __RPC_FAR * ClientAlloc,
  2489.     IN RPC_CLIENT_FREE __RPC_FAR * ClientFree,
  2490.     OUT RPC_CLIENT_ALLOC __RPC_FAR * __RPC_FAR * OldClientAlloc,
  2491.     OUT RPC_CLIENT_FREE __RPC_FAR * __RPC_FAR * OldClientFree
  2492.     );
  2493.  
  2494. /*++
  2495.      Ndr stub entry points
  2496. --*/
  2497.  
  2498. void RPC_ENTRY
  2499. NdrRpcSsEnableAllocate(
  2500.     PMIDL_STUB_MESSAGE      pMessage );
  2501.  
  2502. void RPC_ENTRY
  2503. NdrRpcSsDisableAllocate(
  2504.     PMIDL_STUB_MESSAGE      pMessage );
  2505.  
  2506. void RPC_ENTRY
  2507. NdrRpcSmSetClientToOsf(
  2508.     PMIDL_STUB_MESSAGE      pMessage );
  2509.  
  2510. void __RPC_FAR *  RPC_ENTRY
  2511. NdrRpcSmClientAllocate (
  2512.     IN size_t Size
  2513.     );
  2514.  
  2515. void  RPC_ENTRY
  2516. NdrRpcSmClientFree (
  2517.     IN void __RPC_FAR * NodeToFree
  2518.     );
  2519.  
  2520. void __RPC_FAR *  RPC_ENTRY
  2521. NdrRpcSsDefaultAllocate (
  2522.     IN size_t Size
  2523.     );
  2524.  
  2525. void  RPC_ENTRY
  2526. NdrRpcSsDefaultFree (
  2527.     IN void __RPC_FAR * NodeToFree
  2528.     );
  2529.  
  2530. /****************************************************************************
  2531.     end of memory package: rpc_ss_* rpc_sm_*
  2532.  ****************************************************************************/
  2533.  
  2534. /****************************************************************************
  2535.  * Full Pointer APIs
  2536.  ****************************************************************************/
  2537.  
  2538. PFULL_PTR_XLAT_TABLES RPC_ENTRY
  2539. NdrFullPointerXlatInit(
  2540.     unsigned long           NumberOfPointers,
  2541.     XLAT_SIDE               XlatSide
  2542.     );
  2543.  
  2544. void RPC_ENTRY
  2545. NdrFullPointerXlatFree(
  2546.     PFULL_PTR_XLAT_TABLES   pXlatTables
  2547.     );
  2548.  
  2549. int RPC_ENTRY
  2550. NdrFullPointerQueryPointer(
  2551.     PFULL_PTR_XLAT_TABLES   pXlatTables,
  2552.     void __RPC_FAR *                    pPointer,
  2553.     unsigned char           QueryType,
  2554.     unsigned long __RPC_FAR *           pRefId
  2555.     );
  2556.  
  2557. int RPC_ENTRY
  2558. NdrFullPointerQueryRefId(
  2559.     PFULL_PTR_XLAT_TABLES   pXlatTables,
  2560.     unsigned long           RefId,
  2561.     unsigned char           QueryType,
  2562.     void __RPC_FAR *__RPC_FAR *                 ppPointer
  2563.     );
  2564.  
  2565. void RPC_ENTRY
  2566. NdrFullPointerInsertRefId(
  2567.     PFULL_PTR_XLAT_TABLES   pXlatTables,
  2568.     unsigned long           RefId,
  2569.     void __RPC_FAR *                    pPointer
  2570.     );
  2571.  
  2572. int RPC_ENTRY
  2573. NdrFullPointerFree(
  2574.     PFULL_PTR_XLAT_TABLES   pXlatTables,
  2575.     void __RPC_FAR *                    Pointer
  2576.     );
  2577.  
  2578. void __RPC_FAR *  RPC_ENTRY
  2579. NdrAllocate(
  2580.     PMIDL_STUB_MESSAGE      pStubMsg,
  2581.     size_t                  Len
  2582.     );
  2583.  
  2584. void RPC_ENTRY
  2585. NdrClearOutParameters(
  2586.     PMIDL_STUB_MESSAGE      pStubMsg,
  2587.     PFORMAT_STRING          pFormat,
  2588.     void __RPC_FAR *        ArgAddr
  2589.     );
  2590.  
  2591.  
  2592. /****************************************************************************
  2593.  * Proxy APIs
  2594.  ****************************************************************************/
  2595.  
  2596. void __RPC_FAR * RPC_ENTRY
  2597. NdrOleAllocate (
  2598.     IN size_t Size
  2599.     );
  2600.  
  2601. void RPC_ENTRY
  2602. NdrOleFree (
  2603.     IN void __RPC_FAR * NodeToFree
  2604.     );
  2605.  
  2606. #ifdef CONST_VTABLE
  2607. #define CONST_VTBL const
  2608. #else
  2609. #define CONST_VTBL
  2610. #endif
  2611.  
  2612. /****************************************************************************
  2613.  * Special things for VC5 Com support
  2614.  ****************************************************************************/
  2615.  
  2616. #if _MSC_VER >= 1100
  2617. #define DECLSPEC_UUID(x)    __declspec(uuid(x))
  2618. #define MIDL_INTERFACE(x)   struct __declspec(uuid(x)) __declspec(novtable)
  2619. #else
  2620. #define DECLSPEC_UUID(x)
  2621. #define MIDL_INTERFACE(x)   struct
  2622. #endif
  2623.  
  2624. #if _MSC_VER >= 1100
  2625. #define EXTERN_GUID(itf,l1,s1,s2,c1,c2,c3,c4,c5,c6,c7,c8)  \
  2626.   EXTERN_C const IID __declspec(selectany) itf = {l1,s1,s2,{c1,c2,c3,c4,c5,c6,c7,c8}}
  2627. #else
  2628. #define EXTERN_GUID(itf,l1,s1,s2,c1,c2,c3,c4,c5,c6,c7,c8) EXTERN_C const IID itf
  2629. #endif
  2630.  
  2631.  
  2632.  
  2633. #ifdef __cplusplus
  2634. }
  2635. #endif
  2636.  
  2637. // Reset the packing level for DOS, Windows and Mac.
  2638.  
  2639. #if defined(__RPC_DOS__) || defined(__RPC_WIN16__) || defined(__RPC_MAC__)
  2640. #pragma pack()
  2641. #endif
  2642.  
  2643. #endif /* __RPCNDR_H__ */
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.