--- mstools/samples/rpc/data/xmit/xmitp.c 2018/08/09 18:20:59 1.1 +++ mstools/samples/rpc/data/xmit/xmitp.c 2018/08/09 18:24:25 1.1.1.2 @@ -1,25 +1,27 @@ /**************************************************************************** - Microsoft RPC Version 1.0 - Copyright Microsoft Corp. 1992 - xmit Example + Microsoft RPC Version 1.0 + Copyright Microsoft Corp. 1992 + xmit Example - FILE: xmitp.c + FILE: xmitp.c + PURPOSE: Remote procedures that are linked with the server - side of RPC distributed application - FUNCTIONS: ModifyListProc() - changes the doubly-linked list - Shutdown() - shuts down the server side - COMMENTS: Linked with xmits.c + side of RPC distributed application + + FUNCTIONS: ModifyListProc() - changes the doubly-linked list + Shutdown() - shuts down the server side + + COMMENTS: Related to xmits.c ****************************************************************************/ + #include #include - -#include -#include -#include "xmit.h" // header file generated by MIDL compiler +#include "xmit.h" // header file generated by MIDL compiler /**************************************************************************** + Function: ModifyListProc Parameters: pFirst : Pointer to the head of a doubly-linked list. @@ -27,39 +29,51 @@ Parameters: pFirst : Pointer to the head Returns: none Purpose: Display the list passed to the function. - For each element in the list, add another element. - Display the modified list. + For each element in the list, add another element. + Display the modified list. Comments: This sample is meant to demonstrate a typical use of the - transmit_as attribute: A complex data structure is simplified - for transmission over the network, restored on the server, - then manipulated by the remote function on the server. - The modified data is returned to the client. - - Calls InsertNewNode(param1, param2), a utility routine - in xmits.c that creates a new node, assigns to it the - value param1, and inserts it into the list after param2. + transmit_as attribute: A complex data structure is simplified + for transmission over the network, restored on the server, + then manipulated by the remote function on the server. + The modified data is returned to the client. + + Calls InsertNewNode(param1, param2), a utility routine + in xmits.c that creates a new node, assigns to it the + value param1, and inserts it into the list after param2. + ****************************************************************************/ + DOUBLE_LINK_TYPE * InsertNewNode(short sValue, DOUBLE_LINK_TYPE * pPrevious); void ModifyListProc(DOUBLE_LINK_TYPE * pFirst) { - DOUBLE_LINK_TYPE * pList = pFirst; + DOUBLE_LINK_TYPE * pList = pFirst; + short newNumber; + printf("ModifyListProc: Display contents of doubly linked list:\n"); while (pList != NULL) { - printf("pList @0x%x = %d, Next = 0x%x\n", pList, pList->sNumber, pList->pNext); - pList = pList->pNext; + printf("pList @0x%x = %d, Next = 0x%x\n", + pList, pList->sNumber, pList->pNext); + pList = pList->pNext; } + printf("ModifyListProc: Add one node for every node in tree\n"); for (pList = pFirst; pList != NULL; pList = pList->pNext) { - pList = InsertNewNode(pList->sNumber + (short) 1, pList); + newNumber = pList->sNumber + 1; + pList = InsertNewNode(newNumber, pList); } + printf("ModifyListProc: Display modified contents of doubly linked list:\n"); - for (pList = pFirst; pList != NULL; pList = pList->pNext) - printf("pList @0x%x = %d, Next = 0x%x\n", pList, pList->sNumber, pList->pNext); + for (pList = pFirst; pList != NULL; pList = pList->pNext) { + printf("pList @0x%x = %d, Next = 0x%x\n", + pList, pList->sNumber, pList->pNext); + } } + /**************************************************************************** + Function: Shutdown Parameters: none @@ -67,12 +81,13 @@ Parameters: none Returns: none Purpose: Make the server stop listening for client applications. + Comments: The two NULL parameters passed to RpcServerUnregisterIf are - a show of brute force: they tell the function to turn - off all registered interfaces. See the RPC API function - reference for more information about these functions. -****************************************************************************/ + a show of brute force: they tell the function to turn + off all registered interfaces. See the RPC API function + reference for more information about these functions. +****************************************************************************/ void Shutdown(void) { @@ -82,15 +97,15 @@ void Shutdown(void) status = RpcMgmtStopServerListening(NULL); printf("RpcMgmtStopServerListening returned: 0x%x\n", status); if (status) { - exit(2); + exit(status); } printf("Calling RpcServerUnregisterIf\n"); status = RpcServerUnregisterIf(NULL, NULL, FALSE); printf("RpcServerUnregisterIf returned 0x%x\n", status); if (status) { - exit(2); + exit(status); } } -/* end of file xmitp.c */ +/* end file xmitp.c */