|
|
1.1.1.2 ! root 1: /* ! 2: //+------------------------------------------------------------------------- ! 3: // ! 4: // Microsoft RPC Version 1.0 ! 5: // Copyright (C) Microsoft Corporation, 1990 - 1992. ! 6: // ! 7: // File: mandel\server.c ! 8: // ! 9: // Contents: Mandelbrot sample program ! 10: // ! 11: // Functions: main - register interface and listen for clients ! 12: // ! 13: //-------------------------------------------------------------------------- ! 14: */ ! 15: 1.1 root 16: #include <stdlib.h> // exit 1.1.1.2 ! root 17: #include <windows.h> // HANDLE 1.1 root 18: #include <stdio.h> // printf... 19: #include <ctype.h> 20: 1.1.1.2 ! root 21: #include <rpc.h> // RPC data structures and APIs 1.1 root 22: #include "mdlrpc.h" // interface 23: #include "mandel.h" 24: 25: HANDLE hSharedBuf = NULL; 26: 27: void main(void) 28: { 29: RPC_STATUS status; 1.1.1.2 ! root 30: char * pszEndpoint = "\\pipe\\mandel"; 1.1 root 31: 1.1.1.2 ! root 32: hSharedBuf = GlobalAlloc(GMEM_FIXED, MAX_BUFSIZE); 1.1 root 33: 34: /* Select named pipes as the transport type and provide the */ 35: /* name of the named pipe that is used for RPC. */ 36: 1.1.1.2 ! root 37: status = RpcServerUseProtseqEp("ncacn_np", ! 38: 1, // maximum concurrent calls ! 39: pszEndpoint, ! 40: 0); ! 41: printf("RpcServerUseProtseqEp returned 0x%x\n", status); 1.1 root 42: if (status) { 43: exit(2); 44: } 45: 1.1.1.2 ! root 46: status = RpcServerRegisterIf(mdlrpc_ServerIfHandle, 0, 0); ! 47: printf("RpcServerRegisterIf returned 0x%x\n", status); 1.1 root 48: if (status) { 49: exit(2); 50: } 1.1.1.2 ! root 51: printf("Calling RpcServerListen\n"); 1.1 root 52: 1.1.1.2 ! root 53: status = RpcServerListen(1, ! 54: 200); // a very large number 1.1 root 55: 1.1.1.2 ! root 56: } /* end main() */ 1.1 root 57: 1.1.1.2 ! root 58: static HANDLE hMidlUserFunc; 1.1 root 59: 1.1.1.2 ! root 60: void * MIDL_user_allocate(size_t len) ! 61: { ! 62: hMidlUserFunc = GlobalAlloc(GMEM_FIXED, len); ! 63: return(PDWORD) (GlobalLock(hMidlUserFunc)); ! 64: } ! 65: ! 66: void MIDL_user_free(void * ptr) ! 67: { ! 68: GlobalUnlock(hMidlUserFunc); ! 69: GlobalFree(hMidlUserFunc); ! 70: } 1.1 root 71: 1.1.1.2 ! root 72: /* end server.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.