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_s.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  6.0 KB  |  242 lines

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