tags:

views:

507

answers:

1
+1  A: 

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
Thanks a lot, I'll give it a try !
mabra