现在的位置: 首页 > 综合 > 正文

RPC学习

2012年11月13日 ⁄ 综合 ⁄ 共 728字 ⁄ 字号 评论关闭

http://www.codeproject.com/KB/IP/rpcintro1.aspx

http://www.codeproject.com/KB/IP/rpcintro2.aspx

在Windows XP SP2版本时,需要将RpcServerRegisterIf替换成RpcServerRegisterIf2。

使用如下:

Have a global function called SecurityCallback like this:

RPC_STATUS CALLBACK SecurityCallback(RPC_IF_HANDLE Interface, void* Context)
{
// this method will be invoked whenever a client tries to access the
// interface. If you want to fail the client connection, return
//anything other than RPC_S_OK. If you want to let the client connect,
// return RPC_S_OK.
return RPC_S_OK;
}

 

Use the API RpcServerRegisterIf2 instead of RpcServerRegisterIf like this:

status = RpcServerRegisterIf2(m_hInterface, pUUID, NULL, RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH, 
m_nMaxCalls, RPC_MAX_NAMESIZE, SecurityCallback);
 
如果RpcMgmtIsServerListening调用失败,则屏蔽掉这个函数。

抱歉!评论已关闭.