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 / handles / usrdef / usrdef_c.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  8.7 KB  |  320 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:07:30 1998
  6.  */
  7. /* Compiler settings for usrdef.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 "usrdef.h"
  19.  
  20. #define TYPE_FORMAT_STRING_SIZE   73                                
  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: usrdef, ver. 1.0,
  40.    GUID={0x85D7D1C0,0xCA47,0x1067,{0xB3,0x1E,0x00,0xDD,0x01,0x06,0x62,0xDA}} */
  41.  
  42. handle_t hUnused;
  43.  
  44.  
  45. static const RPC_CLIENT_INTERFACE usrdef___RpcClientInterface =
  46.     {
  47.     sizeof(RPC_CLIENT_INTERFACE),
  48.     {{0x85D7D1C0,0xCA47,0x1067,{0xB3,0x1E,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 usrdef_ClientIfHandle = (RPC_IF_HANDLE)& usrdef___RpcClientInterface;
  58.  
  59. extern const MIDL_STUB_DESC usrdef_StubDesc;
  60.  
  61. static RPC_BINDING_HANDLE usrdef__MIDL_AutoBindHandle;
  62.  
  63.  
  64. void UsrdefProc( 
  65.     /* [in] */ DATA_HANDLE_TYPE hBinding,
  66.     /* [string][in] */ unsigned char __RPC_FAR *pszString)
  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  )&usrdef_StubDesc,
  81.                           0);
  82.         
  83.         
  84.         _Handle = DATA_HANDLE_TYPE_bind(hBinding);;
  85.         
  86.         if(_Handle == 0)
  87.             {
  88.             RpcRaiseException(RPC_S_INVALID_BINDING);
  89.             }
  90.         
  91.         _StubMsg.BufferLength = 0U + 13U;
  92.         NdrSimpleStructBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
  93.                                    (unsigned char __RPC_FAR *)hBinding,
  94.                                    (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4] );
  95.         
  96.         NdrConformantStringBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
  97.                                        (unsigned char __RPC_FAR *)pszString,
  98.                                        (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[70] );
  99.         
  100.         NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle );
  101.         
  102.         NdrSimpleStructMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
  103.                                  (unsigned char __RPC_FAR *)hBinding,
  104.                                  (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4] );
  105.         
  106.         NdrConformantStringMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
  107.                                      (unsigned char __RPC_FAR *)pszString,
  108.                                      (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[70] );
  109.         
  110.         NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer );
  111.         
  112.         }
  113.     RpcFinally
  114.         {
  115.         NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
  116.         
  117.         
  118.         if(_Handle)
  119.             {
  120.             DATA_HANDLE_TYPE_unbind(hBinding,_Handle);
  121.             }
  122.         }
  123.     RpcEndFinally
  124.     
  125. }
  126.  
  127.  
  128. void Shutdown( 
  129.     /* [in] */ DATA_HANDLE_TYPE hBinding)
  130. {
  131.  
  132.     RPC_BINDING_HANDLE _Handle    =    0;
  133.     
  134.     RPC_MESSAGE _RpcMessage;
  135.     
  136.     MIDL_STUB_MESSAGE _StubMsg;
  137.     
  138.     RpcTryFinally
  139.         {
  140.         NdrClientInitializeNew(
  141.                           ( PRPC_MESSAGE  )&_RpcMessage,
  142.                           ( PMIDL_STUB_MESSAGE  )&_StubMsg,
  143.                           ( PMIDL_STUB_DESC  )&usrdef_StubDesc,
  144.                           1);
  145.         
  146.         
  147.         _Handle = DATA_HANDLE_TYPE_bind(hBinding);;
  148.         
  149.         if(_Handle == 0)
  150.             {
  151.             RpcRaiseException(RPC_S_INVALID_BINDING);
  152.             }
  153.         
  154.         _StubMsg.BufferLength = 0U;
  155.         NdrSimpleStructBufferSize( (PMIDL_STUB_MESSAGE) &_StubMsg,
  156.                                    (unsigned char __RPC_FAR *)hBinding,
  157.                                    (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4] );
  158.         
  159.         NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle );
  160.         
  161.         NdrSimpleStructMarshall( (PMIDL_STUB_MESSAGE)& _StubMsg,
  162.                                  (unsigned char __RPC_FAR *)hBinding,
  163.                                  (PFORMAT_STRING) &__MIDL_TypeFormatString.Format[4] );
  164.         
  165.         NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer );
  166.         
  167.         }
  168.     RpcFinally
  169.         {
  170.         NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
  171.         
  172.         
  173.         if(_Handle)
  174.             {
  175.             DATA_HANDLE_TYPE_unbind(hBinding,_Handle);
  176.             }
  177.         }
  178.     RpcEndFinally
  179.     
  180. }
  181.  
  182.  
  183. static const MIDL_STUB_DESC usrdef_StubDesc = 
  184.     {
  185.     (void __RPC_FAR *)& usrdef___RpcClientInterface,
  186.     MIDL_user_allocate,
  187.     MIDL_user_free,
  188.     &hUnused,
  189.     0,
  190.     0,
  191.     0,
  192.     0,
  193.     __MIDL_TypeFormatString.Format,
  194.     0, /* -error bounds_check flag */
  195.     0x10001, /* Ndr library version */
  196.     0,
  197.     0x303006e, /* MIDL Version 3.3.110 */
  198.     0,
  199.     0,
  200.     0,  /* Reserved1 */
  201.     0,  /* Reserved2 */
  202.     0,  /* Reserved3 */
  203.     0,  /* Reserved4 */
  204.     0   /* Reserved5 */
  205.     };
  206.  
  207. #if !defined(__RPC_WIN32__)
  208. #error  Invalid build platform for this stub.
  209. #endif
  210.  
  211. static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
  212.     {
  213.         0,
  214.         {
  215.             
  216.             0x4d,        /* FC_IN_PARAM */
  217. #ifndef _ALPHA_
  218.             0x1,        /* x86, MIPS & PPC Stack size = 1 */
  219. #else
  220.             0x2,        /* Alpha Stack size = 2 */
  221. #endif
  222. /*  2 */    NdrFcShort( 0x0 ),    /* Type Offset=0 */
  223. /*  4 */    
  224.             0x4d,        /* FC_IN_PARAM */
  225. #ifndef _ALPHA_
  226.             0x1,        /* x86, MIPS & PPC Stack size = 1 */
  227. #else
  228.             0x2,        /* Alpha Stack size = 2 */
  229. #endif
  230. /*  6 */    NdrFcShort( 0x44 ),    /* Type Offset=68 */
  231. /*  8 */    0x5b,        /* FC_END */
  232.             0x5c,        /* FC_PAD */
  233. /* 10 */    
  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. /* 12 */    NdrFcShort( 0x0 ),    /* Type Offset=0 */
  241. /* 14 */    0x5b,        /* FC_END */
  242.             0x5c,        /* FC_PAD */
  243.  
  244.             0x0
  245.         }
  246.     };
  247.  
  248. static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
  249.     {
  250.         0,
  251.         {
  252.             0x11, 0x0,    /* FC_RP */
  253. /*  2 */    NdrFcShort( 0x2 ),    /* Offset= 2 (4) */
  254. /*  4 */    
  255.             0x16,        /* FC_PSTRUCT */
  256.             0x3,        /* 3 */
  257. /*  6 */    NdrFcShort( 0x14 ),    /* 20 */
  258. /*  8 */    
  259.             0x4b,        /* FC_PP */
  260.             0x5c,        /* FC_PAD */
  261. /* 10 */    
  262.             0x46,        /* FC_NO_REPEAT */
  263.             0x5c,        /* FC_PAD */
  264. /* 12 */    NdrFcShort( 0x0 ),    /* 0 */
  265. /* 14 */    NdrFcShort( 0x0 ),    /* 0 */
  266. /* 16 */    0x12, 0x8,    /* FC_UP [simple_pointer] */
  267. /* 18 */    0x2,        /* FC_CHAR */
  268.             0x5c,        /* FC_PAD */
  269. /* 20 */    
  270.             0x46,        /* FC_NO_REPEAT */
  271.             0x5c,        /* FC_PAD */
  272. /* 22 */    NdrFcShort( 0x4 ),    /* 4 */
  273. /* 24 */    NdrFcShort( 0x4 ),    /* 4 */
  274. /* 26 */    0x12, 0x8,    /* FC_UP [simple_pointer] */
  275. /* 28 */    0x2,        /* FC_CHAR */
  276.             0x5c,        /* FC_PAD */
  277. /* 30 */    
  278.             0x46,        /* FC_NO_REPEAT */
  279.             0x5c,        /* FC_PAD */
  280. /* 32 */    NdrFcShort( 0x8 ),    /* 8 */
  281. /* 34 */    NdrFcShort( 0x8 ),    /* 8 */
  282. /* 36 */    0x12, 0x8,    /* FC_UP [simple_pointer] */
  283. /* 38 */    0x2,        /* FC_CHAR */
  284.             0x5c,        /* FC_PAD */
  285. /* 40 */    
  286.             0x46,        /* FC_NO_REPEAT */
  287.             0x5c,        /* FC_PAD */
  288. /* 42 */    NdrFcShort( 0xc ),    /* 12 */
  289. /* 44 */    NdrFcShort( 0xc ),    /* 12 */
  290. /* 46 */    0x12, 0x8,    /* FC_UP [simple_pointer] */
  291. /* 48 */    0x2,        /* FC_CHAR */
  292.             0x5c,        /* FC_PAD */
  293. /* 50 */    
  294.             0x46,        /* FC_NO_REPEAT */
  295.             0x5c,        /* FC_PAD */
  296. /* 52 */    NdrFcShort( 0x10 ),    /* 16 */
  297. /* 54 */    NdrFcShort( 0x10 ),    /* 16 */
  298. /* 56 */    0x12, 0x8,    /* FC_UP [simple_pointer] */
  299. /* 58 */    0x2,        /* FC_CHAR */
  300.             0x5c,        /* FC_PAD */
  301. /* 60 */    
  302.             0x5b,        /* FC_END */
  303.  
  304.             0x8,        /* FC_LONG */
  305. /* 62 */    0x8,        /* FC_LONG */
  306.             0x8,        /* FC_LONG */
  307. /* 64 */    0x8,        /* FC_LONG */
  308.             0x8,        /* FC_LONG */
  309. /* 66 */    0x5c,        /* FC_PAD */
  310.             0x5b,        /* FC_END */
  311. /* 68 */    
  312.             0x11, 0x8,    /* FC_RP [simple_pointer] */
  313. /* 70 */    
  314.             0x22,        /* FC_C_CSTRING */
  315.             0x5c,        /* FC_PAD */
  316.  
  317.             0x0
  318.         }
  319.     };
  320.