一个关于RPC返回值的问题!!!
在我的文件idl中:
//file myrpc.idl
[
uuid(150c18d3-b475-450d-980a-ebeafe2afb07),
version(1.0),
pointer_default(unique)
]
interface myrpc
{
void myfun([in, string] unsigned char *pszIN,
[out] unsigned char *pszOUT);
void Shutdown(void);
}
想根据pszIN来判断用户是否存在,如果存在则pszOUT = "yes",否则为"no".
实现是这样的:
//file myrpcp.c
void myfun(
/* [string][in] */ unsigned char *pszIN,
/* [out] */ unsigned char *pszOUT)
{
printf("Income user is:%s\n",pszIN);
if (!strcmp(pszIN,"wuzhiyong"))
{
strcpy(pszOUT,"yes");
}
else
{
strcpy(pszOUT,"no");
}
printf("Out-->%s\n",pszOUT);
}
但在客户端myrpcC.c中调用:
printf("say %s to server",pszInString);
/* rpc */
myfun(pszInString,pszOutString);
printf("The Server say:%s\n",pszOutString);
但运行结果却是:
客户端
c:\>myrpcc
RpcStringBindingCompose returned 0x0
pszStringBinding = ncacn_np:[\\pipe\\hello]
RpcBindingFromStringBinding returned 0x0
Calling the remote procedure 'myfun'
Print the string 'wuzhiyong' on the server
say wuzhiyong to serverThe Server say:y
RpcStringFree returned 0x0
RpcBindingFree returned 0x0
服务端
c:\>myrpcs
RpcServerUseProtseqEp returned 0x0
RpcServerRegisterIf returned 0x0
Calling RpcServerListen
Income user is:wuzhiyong
Out-->yes
请帮助解答。