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 / repas / repasp.c < prev    next >
C/C++ Source or Header  |  1996-06-11  |  4KB  |  109 lines

  1. /****************************************************************************
  2.                    Microsoft RPC Version 2.0
  3.            Copyright Microsoft Corp. 1992, 1993, 1994- 1996
  4.                          repas Example
  5.  
  6.     FILE:       repasp.c
  7.  
  8.     PURPOSE:    Remote procedures that are linked with the server
  9.                 side of RPC distributed application
  10.  
  11.     FUNCTIONS:  ModifyListProc() - changes the doubly-linked list
  12.                 Shutdown() - shuts down the server side
  13.  
  14.     COMMENTS:   Related to repass.c
  15.  
  16. ****************************************************************************/
  17.  
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. #include "repass.h"    // header file generated by MIDL compiler
  21.  
  22.  
  23. /****************************************************************************
  24.  
  25. Function:   ModifyMyWString
  26.  
  27. Parameters: pStr : Pointer to pointer to UNICODE string
  28.  
  29. Returns:    none
  30.  
  31. Purpose:    Display the string passed in, modify it, and return
  32.  
  33. Comments:   This sample is meant to demonstrate a typical use of the
  34.             represent_as attribute:  The client and server have different
  35.             local views of the data, although the IDL file describes the
  36.             wire contract.
  37.  
  38. ****************************************************************************/
  39. void ModifyMyWString(WCHAR_STRING * pStr)
  40. {
  41.     wprintf(L"\nModifyMyWString: received UNICODE string:\n%s\n\n", *pStr );
  42.     wcscpy(*pStr, L"This string comes back on the wire as UNICODE");
  43.     wprintf(L"ModifyMyWString: sending UNICODE string:\n%s\n\n", *pStr );
  44.  
  45. }
  46.  
  47. /****************************************************************************
  48.  
  49. Function:   ModifyMyString
  50.  
  51. Parameters: pStr : Pointer to pointer to UNICODE string
  52.  
  53. Returns:    none
  54.  
  55. Purpose:    Display the string passed in, modify it, and return
  56.  
  57. Comments:   This sample is meant to demonstrate a typical use of the
  58.             represent_as attribute:  The client and server have different
  59.             local views of the data, although the IDL file describes the
  60.             wire contract.
  61.  
  62. ****************************************************************************/
  63. void ModifyMyString(WCHAR_STRING * pStr)
  64. {
  65.     wprintf(L"\nModifyMyString: received UNICODE string:\n%s\n\n", *pStr );
  66.     wcscpy(*pStr, L"This UNICODE string comes back on the wire as ASCII");
  67.     wprintf(L"ModifyMyString: sending UNICODE string:\n%s\n\n", *pStr );
  68.  
  69. }
  70.  
  71.  
  72. /****************************************************************************
  73.  
  74. Function:   Shutdown
  75.  
  76. Parameters: none
  77.  
  78. Returns:    none
  79.  
  80. Purpose:    Make the server stop listening for client applications.
  81.  
  82. Comments:   The two NULL parameters passed to RpcServerUnregisterIf are
  83.             a show of brute force:  they tell the function to turn
  84.             off all registered interfaces.  See the RPC API function
  85.             reference for more information about these functions.
  86.  
  87. ****************************************************************************/
  88.  
  89. void Shutdown(void)
  90. {
  91.     RPC_STATUS status;
  92.  
  93.     printf("Calling RpcMgmtStopServerListening\n");
  94.     status = RpcMgmtStopServerListening(NULL);
  95.     printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
  96.     if (status) {
  97.         exit(status);
  98.     }
  99.  
  100.     printf("Calling RpcServerUnregisterIf\n");
  101.     status = RpcServerUnregisterIf(NULL, NULL, FALSE);
  102.     printf("RpcServerUnregisterIf returned 0x%x\n", status);
  103.     if (status) {
  104.         exit(status);
  105.     }
  106. }
  107.  
  108. /* end file repasp.c */
  109.