/********************************************************************/ /** Copyright(c) 1989 Microsoft Corporation. **/ /********************************************************************/ //*** // // Filename: rpcutil.c // // Description: Contains RPC utiliry routines. // // History: May 11,1995. NarenG Created original version. // #include #include // For ASSERT #include // needed for winbase.h #include // Win32 base API's #include #include #include // For DIM_SERVICE_NAME #include #include #include #include #include #include #include #include //** // // Call: DimRPCBind // // Returns: NO_ERROR - success // non-sero returns from RPC calls. // // Description: This routine is called when it is necessary to bind to a server. // The binding is done to allow impersonation by the server since // that is necessary for the API calls. // DWORD DimRPCBind( IN LPWSTR lpwsServerName, OUT HANDLE * phDimServer ) { RPC_STATUS RpcStatus; LPWSTR lpwsStringBinding; RpcStatus = RpcStringBindingCompose( NULL, TEXT("ncacn_np"), lpwsServerName, TEXT("\\PIPE\\ROUTER"), TEXT("Security=Impersonation Static True"), &lpwsStringBinding); if ( RpcStatus != RPC_S_OK ) { return( RpcStatus ); } RpcStatus = RpcBindingFromStringBinding( lpwsStringBinding, (handle_t *)phDimServer ); RpcStringFree( &lpwsStringBinding ); if ( RpcStatus != RPC_S_OK ) { return( RpcStatus ); } return( NO_ERROR ); }