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 / callback / call_c.c next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  6.4 KB  |  259 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:13 1998
  6.  */
  7. /* Compiler settings for call.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 "call.h"
  19.  
  20. #define TYPE_FORMAT_STRING_SIZE   1                                 
  21. #define PROC_FORMAT_STRING_SIZE   7                                 
  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: callback, ver. 1.0,
  40.    GUID={0xD694C1C0,0x09D7,0x1068,{0x94,0xAF,0x00,0xDD,0x01,0x06,0x62,0xDA}} */
  41.  
  42. handle_t callback_IfHandle;
  43.  
  44.  
  45. extern RPC_DISPATCH_TABLE callback_DispatchTable;
  46.  
  47. static const RPC_CLIENT_INTERFACE callback___RpcClientInterface =
  48.     {
  49.     sizeof(RPC_CLIENT_INTERFACE),
  50.     {{0xD694C1C0,0x09D7,0x1068,{0x94,0xAF,0x00,0xDD,0x01,0x06,0x62,0xDA}},{1,0}},
  51.     {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}},
  52.     &callback_DispatchTable,
  53.     0,
  54.     0,
  55.     0,
  56.     0,
  57.     0
  58.     };
  59. RPC_IF_HANDLE callback_ClientIfHandle = (RPC_IF_HANDLE)& callback___RpcClientInterface;
  60.  
  61. extern const MIDL_STUB_DESC callback_StubDesc;
  62.  
  63. static RPC_BINDING_HANDLE callback__MIDL_AutoBindHandle;
  64.  
  65.  
  66. short Fibonacci( 
  67.     /* [in] */ short nValue)
  68. {
  69.  
  70.     RPC_BINDING_HANDLE _Handle    =    0;
  71.     
  72.     short _RetVal;
  73.     
  74.     RPC_MESSAGE _RpcMessage;
  75.     
  76.     MIDL_STUB_MESSAGE _StubMsg;
  77.     
  78.     RpcTryFinally
  79.         {
  80.         NdrClientInitializeNew(
  81.                           ( PRPC_MESSAGE  )&_RpcMessage,
  82.                           ( PMIDL_STUB_MESSAGE  )&_StubMsg,
  83.                           ( PMIDL_STUB_DESC  )&callback_StubDesc,
  84.                           0);
  85.         
  86.         
  87.         _Handle = callback_IfHandle;
  88.         
  89.         
  90.         _StubMsg.BufferLength = 2U;
  91.         NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle );
  92.         
  93.         *(( short __RPC_FAR * )_StubMsg.Buffer)++ = nValue;
  94.         
  95.         NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer );
  96.         
  97.         if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
  98.             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
  99.         
  100.         _RetVal = *(( short __RPC_FAR * )_StubMsg.Buffer)++;
  101.         
  102.         }
  103.     RpcFinally
  104.         {
  105.         NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
  106.         
  107.         }
  108.     RpcEndFinally
  109.     
  110.     return _RetVal;
  111. }
  112.  
  113. void __RPC_STUB
  114. callback_Fibonacci2(
  115.     PRPC_MESSAGE _pRpcMessage )
  116. {
  117.     short _RetVal;
  118.     MIDL_STUB_MESSAGE _StubMsg;
  119.     short nValue;
  120.     RPC_STATUS _Status;
  121.     
  122.     ((void)(_Status));
  123.     NdrServerInitializeNew(
  124.                           _pRpcMessage,
  125.                           &_StubMsg,
  126.                           &callback_StubDesc);
  127.     
  128.     RpcTryFinally
  129.         {
  130.         if ( (_pRpcMessage->DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION )
  131.             NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] );
  132.         
  133.         nValue = *(( short __RPC_FAR * )_StubMsg.Buffer)++;
  134.         
  135.         
  136.         _RetVal = Fibonacci2(nValue);
  137.         
  138.         _StubMsg.BufferLength = 2U;
  139.         _pRpcMessage->BufferLength = _StubMsg.BufferLength;
  140.         
  141.         _Status = I_RpcGetBuffer( _pRpcMessage ); 
  142.         if ( _Status )
  143.             RpcRaiseException( _Status );
  144.         
  145.         _StubMsg.Buffer = (unsigned char __RPC_FAR *) _pRpcMessage->Buffer;
  146.         
  147.         *(( short __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal;
  148.         
  149.         }
  150.     RpcFinally
  151.         {
  152.         }
  153.     RpcEndFinally
  154.     _pRpcMessage->BufferLength = 
  155.         (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer);
  156.     
  157. }
  158.  
  159.  
  160. void Shutdown( void)
  161. {
  162.  
  163.     RPC_BINDING_HANDLE _Handle    =    0;
  164.     
  165.     RPC_MESSAGE _RpcMessage;
  166.     
  167.     MIDL_STUB_MESSAGE _StubMsg;
  168.     
  169.     RpcTryFinally
  170.         {
  171.         NdrClientInitializeNew(
  172.                           ( PRPC_MESSAGE  )&_RpcMessage,
  173.                           ( PMIDL_STUB_MESSAGE  )&_StubMsg,
  174.                           ( PMIDL_STUB_DESC  )&callback_StubDesc,
  175.                           1);
  176.         
  177.         
  178.         _Handle = callback_IfHandle;
  179.         
  180.         
  181.         _StubMsg.BufferLength = 0U;
  182.         NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle );
  183.         
  184.         NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer );
  185.         
  186.         }
  187.     RpcFinally
  188.         {
  189.         NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
  190.         
  191.         }
  192.     RpcEndFinally
  193.     
  194. }
  195.  
  196.  
  197. static const MIDL_STUB_DESC callback_StubDesc = 
  198.     {
  199.     (void __RPC_FAR *)& callback___RpcClientInterface,
  200.     MIDL_user_allocate,
  201.     MIDL_user_free,
  202.     &callback_IfHandle,
  203.     0,
  204.     0,
  205.     0,
  206.     0,
  207.     __MIDL_TypeFormatString.Format,
  208.     0, /* -error bounds_check flag */
  209.     0x10001, /* Ndr library version */
  210.     0,
  211.     0x303006e, /* MIDL Version 3.3.110 */
  212.     0,
  213.     0,
  214.     0,  /* Reserved1 */
  215.     0,  /* Reserved2 */
  216.     0,  /* Reserved3 */
  217.     0,  /* Reserved4 */
  218.     0   /* Reserved5 */
  219.     };
  220.  
  221. static RPC_DISPATCH_FUNCTION callback_table[] =
  222.     {
  223.     callback_Fibonacci2,
  224.     0
  225.     };
  226. RPC_DISPATCH_TABLE callback_DispatchTable = 
  227.     {
  228.     1,
  229.     callback_table
  230.     };
  231.  
  232. #if !defined(__RPC_WIN32__)
  233. #error  Invalid build platform for this stub.
  234. #endif
  235.  
  236. static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
  237.     {
  238.         0,
  239.         {
  240.             0x4e,        /* FC_IN_PARAM_BASETYPE */
  241.             0x6,        /* FC_SHORT */
  242. /*  2 */    0x53,        /* FC_RETURN_PARAM_BASETYPE */
  243.             0x6,        /* FC_SHORT */
  244. /*  4 */    0x5b,        /* FC_END */
  245.             0x5c,        /* FC_PAD */
  246.  
  247.             0x0
  248.         }
  249.     };
  250.  
  251. static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
  252.     {
  253.         0,
  254.         {
  255.  
  256.             0x0
  257.         }
  258.     };
  259.