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 / pipes / pipe_c.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  6.1 KB  |  234 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:08:39 1998
  6.  */
  7. /* Compiler settings for pipe.idl:
  8.     Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext
  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 "pipe.h"
  19.  
  20. #define TYPE_FORMAT_STRING_SIZE   15                                
  21. #define PROC_FORMAT_STRING_SIZE   27                                
  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: pipe_sample, ver. 1.0,
  40.    GUID={0x60ceb4a0,0xc2f1,0x11cf,{0x95,0x56,0x00,0xaa,0x00,0x37,0x4e,0x69}} */
  41.  
  42. handle_t global_pipe_sample_handle;
  43.  
  44.  
  45. static const RPC_CLIENT_INTERFACE pipe_sample___RpcClientInterface =
  46.     {
  47.     sizeof(RPC_CLIENT_INTERFACE),
  48.     {{0x60ceb4a0,0xc2f1,0x11cf,{0x95,0x56,0x00,0xaa,0x00,0x37,0x4e,0x69}},{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.     RPC_INTERFACE_HAS_PIPES
  56.     };
  57. RPC_IF_HANDLE pipe_sample_v1_0_c_ifspec = (RPC_IF_HANDLE)& pipe_sample___RpcClientInterface;
  58.  
  59. extern const MIDL_STUB_DESC pipe_sample_StubDesc;
  60.  
  61. static RPC_BINDING_HANDLE pipe_sample__MIDL_AutoBindHandle;
  62.  
  63.  
  64. void ScrambleFile( 
  65.     /* [in] */ unsigned long Action,
  66.     /* [out][in] */ CHAR_PIPE_TYPE __RPC_FAR *pipe_data)
  67. {
  68.  
  69.     
  70. #if defined( _ALPHA_ )
  71.     va_list vlist;
  72. #endif
  73.     
  74. #if defined( _ALPHA_ )
  75.     va_start(vlist,pipe_data);
  76.     NdrClientCall2(
  77.                   ( PMIDL_STUB_DESC  )&pipe_sample_StubDesc,
  78.                   (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0],
  79.                   vlist.a0);
  80. #elif defined( _PPC_ ) || defined( _MIPS_ )
  81.  
  82.     NdrClientCall2(
  83.                   ( PMIDL_STUB_DESC  )&pipe_sample_StubDesc,
  84.                   (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0],
  85.                   ( unsigned char __RPC_FAR * )&Action,
  86.                   ( unsigned char __RPC_FAR * )&pipe_data);
  87. #else
  88.     NdrClientCall2(
  89.                   ( PMIDL_STUB_DESC  )&pipe_sample_StubDesc,
  90.                   (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0],
  91.                   ( unsigned char __RPC_FAR * )&Action);
  92. #endif
  93.     
  94. }
  95.  
  96.  
  97. void ShutDown( void)
  98. {
  99.  
  100.     RPC_BINDING_HANDLE _Handle    =    0;
  101.     
  102.     RPC_MESSAGE _RpcMessage;
  103.     
  104.     MIDL_STUB_MESSAGE _StubMsg;
  105.     
  106.     RpcTryFinally
  107.         {
  108.         NdrClientInitializeNew(
  109.                           ( PRPC_MESSAGE  )&_RpcMessage,
  110.                           ( PMIDL_STUB_MESSAGE  )&_StubMsg,
  111.                           ( PMIDL_STUB_DESC  )&pipe_sample_StubDesc,
  112.                           1);
  113.         
  114.         
  115.         _Handle = global_pipe_sample_handle;
  116.         
  117.         
  118.         _StubMsg.BufferLength = 0U;
  119.         NdrGetBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg, _StubMsg.BufferLength, _Handle );
  120.         
  121.         NdrSendReceive( (PMIDL_STUB_MESSAGE) &_StubMsg, (unsigned char __RPC_FAR *) _StubMsg.Buffer );
  122.         
  123.         }
  124.     RpcFinally
  125.         {
  126.         NdrFreeBuffer( (PMIDL_STUB_MESSAGE) &_StubMsg );
  127.         
  128.         }
  129.     RpcEndFinally
  130.     
  131. }
  132.  
  133.  
  134. static const MIDL_STUB_DESC pipe_sample_StubDesc = 
  135.     {
  136.     (void __RPC_FAR *)& pipe_sample___RpcClientInterface,
  137.     MIDL_user_allocate,
  138.     MIDL_user_free,
  139.     &global_pipe_sample_handle,
  140.     0,
  141.     0,
  142.     0,
  143.     0,
  144.     __MIDL_TypeFormatString.Format,
  145.     0, /* -error bounds_check flag */
  146.     0x20000, /* Ndr library version */
  147.     0,
  148.     0x303006e, /* MIDL Version 3.3.110 */
  149.     0,
  150.     0,
  151.     0,  /* Reserved1 */
  152.     0,  /* Reserved2 */
  153.     0,  /* Reserved3 */
  154.     0,  /* Reserved4 */
  155.     0   /* Reserved5 */
  156.     };
  157.  
  158. #if !defined(__RPC_WIN32__)
  159. #error  Invalid build platform for this stub.
  160. #endif
  161.  
  162. #if !(TARGET_IS_NT40_OR_LATER)
  163. #error You need a Windows NT 4.0 or later to run this stub because it uses these features:
  164. #error   -Oif or -Oicf, idl pipes.
  165. #error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
  166. #error This app will die there with the RPC_X_WRONG_STUB_VERSION error.
  167. #endif
  168.  
  169.  
  170. static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
  171.     {
  172.         0,
  173.         {
  174.  
  175.     /* Procedure ScrambleFile */
  176.  
  177.             0x32,        /* FC_BIND_PRIMITIVE */
  178.             0x40,        /* 64 */
  179. /*  2 */    NdrFcShort( 0x0 ),    /* 0 */
  180. #ifndef _ALPHA_
  181. /*  4 */    NdrFcShort( 0x8 ),    /* x86, MIPS, PPC Stack size/offset = 8 */
  182. #else
  183.             NdrFcShort( 0x10 ),    /* Alpha Stack size/offset = 16 */
  184. #endif
  185. /*  6 */    NdrFcShort( 0x8 ),    /* 8 */
  186. /*  8 */    NdrFcShort( 0x0 ),    /* 0 */
  187. /* 10 */    0x8,        /* 8 */
  188.             0x2,        /* 2 */
  189.  
  190.     /* Parameter Action */
  191.  
  192. /* 12 */    NdrFcShort( 0x48 ),    /* 72 */
  193. #ifndef _ALPHA_
  194. /* 14 */    NdrFcShort( 0x0 ),    /* x86, MIPS, PPC Stack size/offset = 0 */
  195. #else
  196.             NdrFcShort( 0x0 ),    /* Alpha Stack size/offset = 0 */
  197. #endif
  198. /* 16 */    0x8,        /* FC_LONG */
  199.             0x0,        /* 0 */
  200.  
  201.     /* Parameter pipe_data */
  202.  
  203. /* 18 */    NdrFcShort( 0x11c ),    /* 284 */
  204. #ifndef _ALPHA_
  205. /* 20 */    NdrFcShort( 0x4 ),    /* x86, MIPS, PPC Stack size/offset = 4 */
  206. #else
  207.             NdrFcShort( 0x8 ),    /* Alpha Stack size/offset = 8 */
  208. #endif
  209. /* 22 */    NdrFcShort( 0x6 ),    /* Type Offset=6 */
  210. /* 24 */    0x5b,        /* FC_END */
  211.             0x5c,        /* FC_PAD */
  212.  
  213.             0x0
  214.         }
  215.     };
  216.  
  217. static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
  218.     {
  219.         0,
  220.         {
  221.             0x11, 0x0,    /* FC_RP */
  222. /*  2 */    NdrFcShort( 0x4 ),    /* Offset= 4 (6) */
  223. /*  4 */    0x2,        /* FC_CHAR */
  224.             0x5c,        /* FC_PAD */
  225. /*  6 */    0xb5,        /* FC_PIPE */
  226.             0x0,        /* 0 */
  227. /*  8 */    NdrFcShort( 0xfffffffc ),    /* Offset= -4 (4) */
  228. /* 10 */    NdrFcShort( 0x1 ),    /* 1 */
  229. /* 12 */    NdrFcShort( 0x1 ),    /* 1 */
  230.  
  231.             0x0
  232.         }
  233.     };
  234.