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 / inout / inoutp.c < prev    next >
C/C++ Source or Header  |  1996-06-11  |  2KB  |  60 lines

  1. /****************************************************************************
  2.                   Microsoft RPC Version 2.0
  3.            Copyright Microsoft Corp. 1992, 1993, 1994- 1996
  4.                        inout Example
  5.  
  6.     FILE:       inoutp.c
  7.  
  8.     PURPOSE:    Remote procedures that are linked with the server
  9.                 side of RPC distributed application
  10.  
  11.     FUNCTIONS:  InOutProc() - demonstrates in, out parameters
  12.  
  13.     COMMENTS:
  14.  
  15. ****************************************************************************/
  16.  
  17. #include <stdlib.h>
  18. #include <stdio.h>
  19. #include "inout.h"    // header file generated by MIDL compiler
  20.  
  21. #define CONSTANT 257
  22.  
  23. void InOutProc(short    s1,
  24.                short * ps2,
  25.                float * pf3)
  26. {
  27.     printf("on entry, *pf3 = %f\n", *pf3);
  28.  
  29.     *pf3 = (float) s1 / (float) *ps2;
  30.     printf("%d / %d = %0.3f\n", s1, *ps2, *pf3);
  31.  
  32.     *ps2 = (short)CONSTANT - s1;
  33.     printf("%d - %d = %d\n", CONSTANT, s1, *ps2);
  34.  
  35.     s1++;
  36.  
  37.     return;
  38. }
  39.  
  40. void Shutdown(void)
  41. {
  42.     RPC_STATUS status;
  43.  
  44.     printf("Calling RpcMgmtStopServerListening\n");
  45.     status = RpcMgmtStopServerListening(NULL);
  46.     printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
  47.     if (status) {
  48.         exit(status);
  49.     }
  50.  
  51.     printf("Calling RpcServerUnregisterIf\n");
  52.     status = RpcServerUnregisterIf(NULL, NULL, FALSE);
  53.     printf("RpcServerUnregisterIf returned 0x%x\n", status);
  54.     if (status) {
  55.         exit(status);
  56.     }
  57. }
  58.  
  59. /* end file inoutp.c */
  60.