需要用C#编写的RPC调用示例
我正在处理 WMI 连接错误和超时,并将首先尝试检查 RPC 堆栈。我找到了以下 C 代码片段,但不明白它是否以及如何工作以及在哪里可以找到更多信息甚至示例。
RPC_STATUS status; unsigned short *StringBinding; RPC_BINDING_HANDLE BindingHandle; status = RpcStringBindingCompose ( NULL, // Object UUID L"ncacn_ip_tcp", // Protocol sequence to use L"MyServer.MyCompany.com", // Server DNS or Netbios Name NULL, NULL, &StringBinding ); // Error checking ommitted. If no error, we proceed below status = RpcBindingFromStringBinding(StringBinding, &BindingHandle); // free string regardless of errors from RpcBindingFromStringBinding RpcStringFree(&StringBinding);
这段代码真的能建立联系吗? 有人有 C# 的互操作声明吗?
到目前为止谢谢。
br--马布拉
I am dealing with WMI connection errors and timeouts and will try to check the RPC stack first. I found the following C code snippet, but do not understand if and how it works and where I may find further informations or even a sample.
RPC_STATUS status; unsigned short *StringBinding; RPC_BINDING_HANDLE BindingHandle; status = RpcStringBindingCompose ( NULL, // Object UUID L"ncacn_ip_tcp", // Protocol sequence to use L"MyServer.MyCompany.com", // Server DNS or Netbios Name NULL, NULL, &StringBinding ); // Error checking ommitted. If no error, we proceed below status = RpcBindingFromStringBinding(StringBinding, &BindingHandle); // free string regardless of errors from RpcBindingFromStringBinding RpcStringFree(&StringBinding);
Does this code really make a connection?
Does someone has a interop declartion for C#?
Thanks so far.
br--mabra
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是上面示例的互操作代码:
Here's the interop code for your above example: