public RPC_CLIENT_INTERFACE(Guid iid)
 {
     Length = (uint) Marshal.SizeOf(typeof (RPC_CLIENT_INTERFACE));
     InterfaceId = new RPC_SYNTAX_IDENTIFIER() {SyntaxGUID = iid, SyntaxVersion = RPC_VERSION.INTERFACE_VERSION};
     TransferSyntax = new RPC_SYNTAX_IDENTIFIER()
                          {SyntaxGUID = IID_SYNTAX, SyntaxVersion = RPC_VERSION.SYNTAX_VERSION};
     DispatchTable = IntPtr.Zero;
     RpcProtseqEndpointCount = 0u;
     RpcProtseqEndpoint = IntPtr.Zero;
     Reserved = IntPtr.Zero;
     InterpreterInfo = IntPtr.Zero;
     Flags = 0u;
 }
        public RPC_SERVER_INTERFACE(RpcHandle handle, Ptr<MIDL_SERVER_INFO> pServer, Guid iid)
        {
            Length = (uint)Marshal.SizeOf(typeof(RPC_SERVER_INTERFACE));
            InterfaceId = new RPC_SYNTAX_IDENTIFIER() {SyntaxGUID = iid, SyntaxVersion = RPC_VERSION.INTERFACE_VERSION};
            TransferSyntax = new RPC_SYNTAX_IDENTIFIER()
                                 {SyntaxGUID = IID_SYNTAX, SyntaxVersion = RPC_VERSION.SYNTAX_VERSION};

            RPC_DISPATCH_TABLE fnTable = new RPC_DISPATCH_TABLE();
            fnTable.DispatchTableCount = 2;
            fnTable.DispatchTable =
                handle.Pin(new RPC_DISPATCH_TABLE_Entry() {
                  DispatchMethod = RpcApi.ServerEntry.Handle,
                  DispatchAsyncMethod = RpcApi.AsyncServerEntry.Handle,
                  Zero = IntPtr.Zero
                });
            fnTable.Reserved = IntPtr.Zero;

            DispatchTable = handle.Pin(fnTable);
            RpcProtseqEndpointCount = 0u;
            RpcProtseqEndpoint = IntPtr.Zero;
            DefaultManagerEpv = IntPtr.Zero;
            InterpreterInfo = pServer.Handle;
            Flags = 0x04000000u;
        }