Here's the interop code for your above example:
class Rpc
{
[DllImport("Rpcrt4.dll", CharSet = CharSet.Auto)]
public static extern int RpcStringBindingCompose(
string ObjUuid,
string ProtSeq,
string NetworkAddr,
string EndPoint,
string Options,
out string StringBinding);
[DllImport("Rpcrt4.dll", CharSet = CharSet.Auto)]
public static extern int RpcBindingFromStringBinding(
string StringBinding,
out IntPtr Binding);
[DllImport("Rpcrt4.dll", CharSet = CharSet.Auto)]
public static extern int RpcBindingFree(
ref IntPtr Binding);
public Rpc()
{
string stringBinding = null;
int retCode = RpcStringBindingCompose(
null, // Object UUID
"ncacn_ip_tcp", // Protocol sequence to use
"MyServer.MyCompany.com", // Server DNS or Netbios Name
null,
null,
out stringBinding );
IntPtr bindingHandle = IntPtr.Zero;
retCode = RpcBindingFromStringBinding(stringBinding, out bindingHandle);
retCode = RpcBindingFree(ref bindingHandle);
}
}
GalacticJello
2009-12-22 18:57:18