|
|
1.1 ! root 1: #include <stdlib.h> // exit ! 2: #include <windows.h> // Sleep... ! 3: #include <stdio.h> // printf... ! 4: #include <string.h> // strlen... ! 5: #include <ctype.h> ! 6: ! 7: #include <rpc.h> // RPC data structures and APIs ! 8: #include "mdlrpc.h" // interface ! 9: #include "mandel.h" ! 10: ! 11: ! 12: HANDLE hSharedBuf = NULL; ! 13: ! 14: void main(void) ! 15: { ! 16: RPC_HANDLE Server, Address, Interface; ! 17: RPC_STATUS status; ! 18: ! 19: ! 20: /* Select named pipes as the transport type and provide the */ ! 21: /* name of the named pipe that is used for RPC. */ ! 22: /* The server specifies the pipe name in the form: */ ! 23: /* \device\namedpipe\pipename */ ! 24: /* In this example, the pipename is "mdlrpc" */ ! 25: ! 26: mdlrpc_ProtocolStack.TransportType = RPC_TRANSPORT_NAMEPIPE; ! 27: mdlrpc_ProtocolStack.TransportInfo = "\\device\\namedpipe\\mdlrpc"; ! 28: mdlrpc_ProtocolStack.TransportInfoLength = \ ! 29: strlen(mdlrpc_ProtocolStack.TransportInfo) + 1; ! 30: ! 31: status = RpcCreateServer( (RPC_EVENT_HANDLERS *)0, ! 32: &Server); ! 33: if (status) { ! 34: printf("RpcCreateServer: 0x%x\n", status); ! 35: exit(2); ! 36: } ! 37: ! 38: status = RpcAddAddress(Server, ! 39: &mdlrpc_ProtocolStack, ! 40: 0, // address flags ! 41: &Address, ! 42: (void *) 0, // reserved ! 43: RpcNormalResourceUsage, ! 44: 0L); // timeout ! 45: if (status) { ! 46: printf("RpcAddAddress: 0x%x\n", status); ! 47: exit(2); ! 48: } ! 49: ! 50: status = RpcAddInterface(Server, ! 51: &mdlrpc_ProtocolStack, ! 52: &Interface, ! 53: (void *) 0, // reserved ! 54: &mdlrpc_DispatchTable); ! 55: if (status) { ! 56: printf("RpcAddInterface: 0x%x\n", status); ! 57: exit(2); ! 58: } ! 59: // do it once... ! 60: hSharedBuf = LocalAlloc(LMEM_MOVEABLE, MAX_BUFSIZE); ! 61: ! 62: printf("mdlrpc server started. Waiting for client requests...\n"); ! 63: ! 64: while (1) ! 65: Sleep(5000); ! 66: ! 67: } /* end main() */ ! 68: ! 69: /* end mdlrpc\server.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.