|
|
1.1 ! root 1: /**************************************************************************** ! 2: Microsoft RPC Version 1.0 ! 3: Copyright Microsoft Corp. 1992 ! 4: Cluuid Example ! 5: ! 6: FILE: cluuidp.c ! 7: ! 8: PURPOSE: Remote procedures that are linked with the server ! 9: side of RPC distributed application ! 10: ! 11: FUNCTIONS: HelloProc() - prints "hello, world" or other string ! 12: HelloProc2() - prints string backwards ! 13: ! 14: COMMENTS: This sample program demonstrates how to supply ! 15: multiple implementations of the remote procedure ! 16: specified in the interface. It also demonstrates ! 17: how the client selects among the implementations ! 18: by providing a client object uuid. ! 19: ! 20: The server calls RpcObjectSetType to associate a ! 21: client object uuid with the object uuid in the ! 22: Object Registry Table. The server initializes a ! 23: manager entry point vector (manager epv) and ! 24: then calls RpcRegisterIf to associate the interface ! 25: uuid and the object uuid with the manager epv in the ! 26: Interface Registry Table. ! 27: ! 28: When the client makes a remote procedure call, ! 29: the client object uuid is mapped to the object uuid ! 30: in the Object Registry Table. The resulting ! 31: object uuid and the interface uuid are mapped to ! 32: a manager entry point vector in the Interface ! 33: Registry Table. ! 34: ! 35: By default, in this example, the server registers ! 36: two implementations of the "hello, world" function ! 37: HelloProc and HelloProc2. The HelloProc2 ! 38: implementation is associated with the object uuid ! 39: "11111111-1111-1111-1111-111111111111". When ! 40: the client makes a procedure call with a null ! 41: uuid, the client's request is mapped to the ! 42: original HelloProc. When the client makes a ! 43: procedure call with the client object uuid ! 44: "11111111-1111-1111-1111-11111111111", the ! 45: client's request is mapped to HelloProc2 (which ! 46: prints the string in reverse). ! 47: ! 48: ****************************************************************************/ ! 49: ! 50: #include <stdlib.h> ! 51: #include <stdio.h> ! 52: #include <string.h> ! 53: #include "cluuid.h" // header file generated by MIDL compiler ! 54: ! 55: void HelloProc(unsigned char * pszString) ! 56: { ! 57: printf("%s\n", pszString); ! 58: } ! 59: ! 60: void HelloProc2(unsigned char * pszString) ! 61: { ! 62: printf("%s\n", strrev(pszString)); ! 63: } ! 64: ! 65: void Shutdown(void) ! 66: { ! 67: RPC_STATUS status; ! 68: ! 69: printf("Calling RpcMgmtStopServerListening\n"); ! 70: status = RpcMgmtStopServerListening(NULL); ! 71: printf("RpcMgmtStopServerListening returned: 0x%x\n", status); ! 72: if (status) { ! 73: exit(status); ! 74: } ! 75: ! 76: printf("Calling RpcServerUnregisterIf\n"); ! 77: status = RpcServerUnregisterIf(NULL, NULL, FALSE); ! 78: printf("RpcServerUnregisterIf returned 0x%x\n", status); ! 79: if (status) { ! 80: exit(status); ! 81: } ! 82: } ! 83: ! 84: /* end of file cluuidp.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.