|
|
1.1 root 1: /**************************************************************************** 1.1.1.2 ! root 2: Microsoft RPC Version 1.0 ! 3: Copyright Microsoft Corp. 1992 ! 4: xmit Example 1.1 root 5: 1.1.1.2 ! root 6: FILE: xmitp.c ! 7: 1.1 root 8: PURPOSE: Remote procedures that are linked with the server 1.1.1.2 ! root 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 xmits.c 1.1 root 15: 16: ****************************************************************************/ 1.1.1.2 ! root 17: 1.1 root 18: #include <stdlib.h> 19: #include <stdio.h> 1.1.1.2 ! root 20: #include "xmit.h" // header file generated by MIDL compiler 1.1 root 21: 22: 23: /**************************************************************************** 1.1.1.2 ! root 24: 1.1 root 25: Function: ModifyListProc 26: 27: Parameters: pFirst : Pointer to the head of a doubly-linked list. 28: 29: Returns: none 30: 31: Purpose: Display the list passed to the function. 1.1.1.2 ! root 32: For each element in the list, add another element. ! 33: Display the modified list. 1.1 root 34: 35: Comments: This sample is meant to demonstrate a typical use of the 1.1.1.2 ! root 36: transmit_as attribute: A complex data structure is simplified ! 37: for transmission over the network, restored on the server, ! 38: then manipulated by the remote function on the server. ! 39: The modified data is returned to the client. ! 40: ! 41: Calls InsertNewNode(param1, param2), a utility routine ! 42: in xmits.c that creates a new node, assigns to it the ! 43: value param1, and inserts it into the list after param2. ! 44: 1.1 root 45: ****************************************************************************/ 1.1.1.2 ! root 46: 1.1 root 47: DOUBLE_LINK_TYPE * InsertNewNode(short sValue, DOUBLE_LINK_TYPE * pPrevious); 48: 49: void ModifyListProc(DOUBLE_LINK_TYPE * pFirst) 50: { 1.1.1.2 ! root 51: DOUBLE_LINK_TYPE * pList = pFirst; ! 52: short newNumber; ! 53: 1.1 root 54: printf("ModifyListProc: Display contents of doubly linked list:\n"); 55: while (pList != NULL) { 1.1.1.2 ! root 56: printf("pList @0x%x = %d, Next = 0x%x\n", ! 57: pList, pList->sNumber, pList->pNext); ! 58: pList = pList->pNext; 1.1 root 59: } 1.1.1.2 ! root 60: 1.1 root 61: printf("ModifyListProc: Add one node for every node in tree\n"); 62: for (pList = pFirst; pList != NULL; pList = pList->pNext) { 1.1.1.2 ! root 63: newNumber = pList->sNumber + 1; ! 64: pList = InsertNewNode(newNumber, pList); 1.1 root 65: } 1.1.1.2 ! root 66: 1.1 root 67: printf("ModifyListProc: Display modified contents of doubly linked list:\n"); 1.1.1.2 ! root 68: for (pList = pFirst; pList != NULL; pList = pList->pNext) { ! 69: printf("pList @0x%x = %d, Next = 0x%x\n", ! 70: pList, pList->sNumber, pList->pNext); ! 71: } 1.1 root 72: } 73: 1.1.1.2 ! root 74: 1.1 root 75: /**************************************************************************** 1.1.1.2 ! root 76: 1.1 root 77: Function: Shutdown 78: 79: Parameters: none 80: 81: Returns: none 82: 83: Purpose: Make the server stop listening for client applications. 1.1.1.2 ! root 84: 1.1 root 85: Comments: The two NULL parameters passed to RpcServerUnregisterIf are 1.1.1.2 ! root 86: a show of brute force: they tell the function to turn ! 87: off all registered interfaces. See the RPC API function ! 88: reference for more information about these functions. 1.1 root 89: 1.1.1.2 ! root 90: ****************************************************************************/ 1.1 root 91: 92: void Shutdown(void) 93: { 94: RPC_STATUS status; 95: 96: printf("Calling RpcMgmtStopServerListening\n"); 97: status = RpcMgmtStopServerListening(NULL); 98: printf("RpcMgmtStopServerListening returned: 0x%x\n", status); 99: if (status) { 1.1.1.2 ! root 100: exit(status); 1.1 root 101: } 102: 103: printf("Calling RpcServerUnregisterIf\n"); 104: status = RpcServerUnregisterIf(NULL, NULL, FALSE); 105: printf("RpcServerUnregisterIf returned 0x%x\n", status); 106: if (status) { 1.1.1.2 ! root 107: exit(status); 1.1 root 108: } 109: } 110: 1.1.1.2 ! root 111: /* end file xmitp.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.