home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / rpc / data / dunion / dunion_c.c next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  8.6 KB  |  313 lines

  1. /* this ALWAYS GENERATED file contains the RPC client stubs */
  2.  
  3.  
  4. /* File created by MIDL compiler version 3.03.0110 */
  5. /* at Mon Mar 30 03:05:33 1998
  6.  */
  7. /* Compiler settings for dunion.idl:
  8.     Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext, oldnames
  9.     error checks: none
  10. */
  11. //@@MIDL_FILE_HEADING(  )
  12.  
  13. #include <string.h>
  14. #if defined( _ALPHA_ )
  15. #include <stdarg.h>
  16. #endif
  17.  
  18. #include "dunion.h"
  19.  
  20. #define TYPE_FORMAT_STRING_SIZE   63                                
  21. #define PROC_FORMAT_STRING_SIZE   17                                
  22.  
  23. typedef struct _MIDL_TYPE_FORMAT_STRING
  24.     {
  25.     short          Pad;
  26.     unsigned char  Format[ TYPE_FORMAT_STRING_SIZE ];
  27.     } MIDL_TYPE_FORMAT_STRING;
  28.  
  29. typedef struct _MIDL_PROC_FORMAT_STRING
  30.     {
  31.     short          Pad;
  32.     unsigned char  Format[ PROC_FORMAT_STRING_SIZE ];
  33.     } MIDL_PROC_FORMAT_STRING;
  34.  
  35.  
  36. extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;
  37. extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;
  38.  
  39. /* Standard interface: dunion, ver. 1.0,
  40.    GUID={0x87E5BFA0,0xCA46,0x1067,{0xB3,0x1B,0x00,0xDD,0x01,0x06,0x62,0xDA}} */
  41.  
  42. handle_t hDiscrim;
  43.  
  44.  
  45. static const RPC_CLIENT_INTERFACE dunion___RpcClientInterface =
  46.     {
  47.     sizeof(RPC_CLIENT_INTERFACE),
  48.     {{0x87E5BFA0,0xCA46,0x1067,{0xB3,0x1B,0x00,0xDD,0x01,0x06,0x62,0xDA}},{1,0}},
  49.     {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}},
  50.     0,
  51.     0,
  52.     0,
  53.     0,
  54.     0,
  55.     0
  56.     };
  57. RPC_IF_HANDLE dunion_ClientIfHandle = (RPC_IF_HANDLE)& dunion___RpcClientInterface;
  58.  
  59. extern const MIDL_STUB_DESC dunion_StubDesc;
  60.  
  61. static RPC_BINDING_HANDLE dunion__MIDL_AutoBindHandle;
  62.  
  63.  
  64. void UnionParamProc( 
  65.     /* [switch_is][in] */ DISCRIM_UNION_PARAM_TYPE __RPC_FAR *UnionParam,
  66.     /* [in] */ short sDiscrim)
  67. {
  68.  
  69.     RPC_BINDING_HANDLE _Handle    =    0;
  70.     
  71.     RPC_MESSAGE _RpcMessage;
  72.     
  73.     MIDL_STUB_MESSAGE _StubMsg;
  74.     
  75.     RpcTryFinally
  76.         {
  77.         NdrClientInitializeNew(
  78.                           ( PRPC_MESSAGE  )&_RpcMessage,
  79.                           ( PMIDL_STUB_MESSAGE  )&_StubMsg,
  80.                           ( PMIDL_STUB_DESC  )&dunion_StubDesc,
  81.                           0);
  82.         
  83.         
  84.         _Handle = hDiscrim;
  85.         
  86.         
  87.         _StubMsg.BufferLength = 0U + 4U;
  88.         _StubMsg.MaxCount = sDiscrim;
  89.         
  90.         NdrNonEncapsulatedUnionBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
  91.                                            (unsigned char __RPC_FAR *)UnionParam,
  92.                                            (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4] );
  93.         
  94.         NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle );
  95.         
  96.         _StubMsg.MaxCount = sDiscrim;
  97.         
  98.         NdrNonEncapsulatedUnionMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
  99.                                          (unsigned char __RPC_FAR *)UnionParam,
  100.                                          (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4] );
  101.         
  102.         _StubMsg.Buffer = (unsigned char __RPC_FAR *)(((long)_StubMsg.Buffer + 1) & ~ 0x1);
  103.         *(( short __RPC_FAR * )_StubMsg.Buffer)++ = sDiscrim;
  104.         
  105.         NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer );
  106.         
  107.         }
  108.     RpcFinally
  109.         {
  110.         NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
  111.         
  112.         }
  113.     RpcEndFinally
  114.     
  115. }
  116.  
  117.  
  118. void UnionStructProc( 
  119.     /* [in] */ DISCRIM_UNION_STRUCT_TYPE __RPC_FAR *UnionStruct)
  120. {
  121.  
  122.     RPC_BINDING_HANDLE _Handle    =    0;
  123.     
  124.     RPC_MESSAGE _RpcMessage;
  125.     
  126.     MIDL_STUB_MESSAGE _StubMsg;
  127.     
  128.     RpcTryFinally
  129.         {
  130.         NdrClientInitializeNew(
  131.                           ( PRPC_MESSAGE  )&_RpcMessage,
  132.                           ( PMIDL_STUB_MESSAGE  )&_StubMsg,
  133.                           ( PMIDL_STUB_DESC  )&dunion_StubDesc,
  134.                           1);
  135.         
  136.         
  137.         _Handle = hDiscrim;
  138.         
  139.         
  140.         _StubMsg.BufferLength = 0U;
  141.         NdrComplexStructBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
  142.                                     (unsigned char __RPC_FAR *)UnionStruct,
  143.                                     (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
  144.         
  145.         NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle );
  146.         
  147.         NdrComplexStructMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
  148.                                   (unsigned char __RPC_FAR *)UnionStruct,
  149.                                   (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[48] );
  150.         
  151.         NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer );
  152.         
  153.         }
  154.     RpcFinally
  155.         {
  156.         NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
  157.         
  158.         }
  159.     RpcEndFinally
  160.     
  161. }
  162.  
  163.  
  164. void Shutdown( void)
  165. {
  166.  
  167.     RPC_BINDING_HANDLE _Handle    =    0;
  168.     
  169.     RPC_MESSAGE _RpcMessage;
  170.     
  171.     MIDL_STUB_MESSAGE _StubMsg;
  172.     
  173.     RpcTryFinally
  174.         {
  175.         NdrClientInitializeNew(
  176.                           ( PRPC_MESSAGE  )&_RpcMessage,
  177.                           ( PMIDL_STUB_MESSAGE  )&_StubMsg,
  178.                           ( PMIDL_STUB_DESC  )&dunion_StubDesc,
  179.                           2);
  180.         
  181.         
  182.         _Handle = hDiscrim;
  183.         
  184.         
  185.         _StubMsg.BufferLength = 0U;
  186.         NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle );
  187.         
  188.         NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer );
  189.         
  190.         }
  191.     RpcFinally
  192.         {
  193.         NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
  194.         
  195.         }
  196.     RpcEndFinally
  197.     
  198. }
  199.  
  200.  
  201. static const MIDL_STUB_DESC dunion_StubDesc = 
  202.     {
  203.     (void __RPC_FAR *)& dunion___RpcClientInterface,
  204.     MIDL_user_allocate,
  205.     MIDL_user_free,
  206.     &hDiscrim,
  207.     0,
  208.     0,
  209.     0,
  210.     0,
  211.     __MIDL_TypeFormatString.Format,
  212.     0, /* -error bounds_check flag */
  213.     0x10001, /* Ndr library version */
  214.     0,
  215.     0x303006e, /* MIDL Version 3.3.110 */
  216.     0,
  217.     0,
  218.     0,  /* Reserved1 */
  219.     0,  /* Reserved2 */
  220.     0,  /* Reserved3 */
  221.     0,  /* Reserved4 */
  222.     0   /* Reserved5 */
  223.     };
  224.  
  225. #if !defined(__RPC_WIN32__)
  226. #error  Invalid build platform for this stub.
  227. #endif
  228.  
  229. static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
  230.     {
  231.         0,
  232.         {
  233.             
  234.             0x4d,        /* FC_IN_PARAM */
  235. #ifndef _ALPHA_
  236.             0x1,        /* x86, MIPS & PPC Stack size = 1 */
  237. #else
  238.             0x2,        /* Alpha Stack size = 2 */
  239. #endif
  240. /*  2 */    NdrFcShort( 0x0 ),    /* Type Offset=0 */
  241. /*  4 */    0x4e,        /* FC_IN_PARAM_BASETYPE */
  242.             0x6,        /* FC_SHORT */
  243. /*  6 */    0x5b,        /* FC_END */
  244.             0x5c,        /* FC_PAD */
  245. /*  8 */    
  246.             0x4d,        /* FC_IN_PARAM */
  247. #ifndef _ALPHA_
  248.             0x1,        /* x86, MIPS & PPC Stack size = 1 */
  249. #else
  250.             0x2,        /* Alpha Stack size = 2 */
  251. #endif
  252. /* 10 */    NdrFcShort( 0x24 ),    /* Type Offset=36 */
  253. /* 12 */    0x5b,        /* FC_END */
  254.             0x5c,        /* FC_PAD */
  255. /* 14 */    0x5b,        /* FC_END */
  256.             0x5c,        /* FC_PAD */
  257.  
  258.             0x0
  259.         }
  260.     };
  261.  
  262. static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
  263.     {
  264.         0,
  265.         {
  266.             0x11, 0x0,    /* FC_RP */
  267. /*  2 */    NdrFcShort( 0x2 ),    /* Offset= 2 (4) */
  268. /*  4 */    
  269.             0x2b,        /* FC_NON_ENCAPSULATED_UNION */
  270.             0x6,        /* FC_SHORT */
  271. /*  6 */    0x26,        /* 38 */
  272.             0x0,        /*  */
  273. #ifndef _ALPHA_
  274. /*  8 */    NdrFcShort( 0x4 ),    /* x86, MIPS, PPC Stack size/offset = 4 */
  275. #else
  276.             NdrFcShort( 0x8 ),    /* Alpha Stack size/offset = 8 */
  277. #endif
  278. /* 10 */    NdrFcShort( 0x2 ),    /* Offset= 2 (12) */
  279. /* 12 */    NdrFcShort( 0x4 ),    /* 4 */
  280. /* 14 */    NdrFcShort( 0x3 ),    /* 3 */
  281. /* 16 */    NdrFcLong( 0x0 ),    /* 0 */
  282. /* 20 */    NdrFcShort( 0xffff8006 ),    /* Offset= -32762 (-32742) */
  283. /* 22 */    NdrFcLong( 0x1 ),    /* 1 */
  284. /* 26 */    NdrFcShort( 0xffff800a ),    /* Offset= -32758 (-32732) */
  285. /* 28 */    NdrFcLong( 0x2 ),    /* 2 */
  286. /* 32 */    NdrFcShort( 0xffff8002 ),    /* Offset= -32766 (-32734) */
  287. /* 34 */    NdrFcShort( 0x0 ),    /* Offset= 0 (34) */
  288. /* 36 */    
  289.             0x11, 0x0,    /* FC_RP */
  290. /* 38 */    NdrFcShort( 0xa ),    /* Offset= 10 (48) */
  291. /* 40 */    
  292.             0x2b,        /* FC_NON_ENCAPSULATED_UNION */
  293.             0x6,        /* FC_SHORT */
  294. /* 42 */    0x6,        /* 6 */
  295.             0x0,        /*  */
  296. /* 44 */    NdrFcShort( 0xfffffffc ),    /* -4 */
  297. /* 46 */    NdrFcShort( 0xffffffde ),    /* Offset= -34 (12) */
  298. /* 48 */    
  299.             0x1a,        /* FC_BOGUS_STRUCT */
  300.             0x3,        /* 3 */
  301. /* 50 */    NdrFcShort( 0x8 ),    /* 8 */
  302. /* 52 */    NdrFcShort( 0x0 ),    /* 0 */
  303. /* 54 */    NdrFcShort( 0x0 ),    /* Offset= 0 (54) */
  304. /* 56 */    0x6,        /* FC_SHORT */
  305.             0x4c,        /* FC_EMBEDDED_COMPLEX */
  306. /* 58 */    0x2,        /* 2 */
  307.             NdrFcShort( 0xffffffed ),    /* Offset= -19 (40) */
  308.             0x5b,        /* FC_END */
  309.  
  310.             0x0
  311.         }
  312.     };
  313.