private static Ptr <RPC_SERVER_INTERFACE> Configure(MIDL_SERVER_INFO temp, RpcHandle handle, Ptr <MIDL_SERVER_INFO> me, Guid iid, Byte[] formatTypes, Byte[] formatProc, ExplicitBytesExecute fnExecute) { Ptr <RPC_SERVER_INTERFACE> svrIface = handle.CreatePtr(CreateExplicitBytesServer(handle, me, iid)); Ptr <MIDL_STUB_DESC> stub = handle.CreatePtr(new MIDL_STUB_DESC(handle, svrIface.Handle, formatTypes, true)); temp.pStubDesc = stub.Handle; IntPtr ptrFunction = handle.PinFunction(fnExecute); temp.DispatchTable = handle.Pin(ptrFunction); temp.ProcString = handle.Pin(formatProc); temp.FmtStringOffset = handle.Pin(new int[1] { 0 }); temp.ThunkTable = IntPtr.Zero; temp.pTransferSyntax = IntPtr.Zero; temp.nCount = IntPtr.Zero; temp.pSyntaxInfo = IntPtr.Zero; //Copy us back into the pinned address Marshal.StructureToPtr(temp, me.Handle, false); return(svrIface); }
public static Ptr<RPC_SERVER_INTERFACE> Create(RpcHandle handle, Guid iid, Byte[] formatTypes, Byte[] formatProc, ExplicitBytesExecute fnExecute) { Ptr<MIDL_SERVER_INFO> pServer = handle.CreatePtr(new MIDL_SERVER_INFO()); MIDL_SERVER_INFO temp = new MIDL_SERVER_INFO(); return Configure(temp,handle, pServer, iid, formatTypes, formatProc, fnExecute); }
public static Ptr <RPC_SERVER_INTERFACE> Create(RpcHandle handle, Guid iid, Byte[] formatTypes, Byte[] formatProc, ExplicitBytesExecute fnExecute) { Ptr <MIDL_SERVER_INFO> pServer = handle.CreatePtr(new MIDL_SERVER_INFO()); MIDL_SERVER_INFO temp = new MIDL_SERVER_INFO(); return(Configure(temp, handle, pServer, iid, formatTypes, formatProc, fnExecute)); }
public void RpcObjectSetType_serverInterfacesRegistered_OK() { ExplicitBytesExecute dummy = Dummy; var handle = new ServerRpcHandle(); var iid = Guid.NewGuid(); Ptr <RPC_SERVER_INTERFACE> sIf = ServerInterfaceFactory.Create(handle, iid, RpcRuntime.TYPE_FORMAT, RpcRuntime.FUNC_FORMAT, dummy); var mgr = Guid.NewGuid(); unsafe { var unmanaged = Marshal.AllocCoTaskMem(sizeof(Guid)); Marshal.StructureToPtr(mgr, unmanaged, false); var registerResult = NativeMethods.RpcServerRegisterIf(sIf.Handle, unmanaged, IntPtr.Zero); Assert.AreEqual(RPC_STATUS.RPC_S_OK, registerResult); var setTypeResult = NativeMethods.RpcObjectSetType(ref iid, ref mgr); Assert.AreEqual(RPC_STATUS.RPC_S_OK, setTypeResult); } }
private static Ptr<RPC_SERVER_INTERFACE> Configure(MIDL_SERVER_INFO temp, RpcHandle handle, Ptr<MIDL_SERVER_INFO> me, Guid iid, Byte[] formatTypes, Byte[] formatProc, ExplicitBytesExecute fnExecute) { Ptr<RPC_SERVER_INTERFACE> svrIface = handle.CreatePtr(CreateExplicitBytesServer(handle, me, iid)); Ptr<MIDL_STUB_DESC> stub = handle.CreatePtr(new MIDL_STUB_DESC(handle, svrIface.Handle, formatTypes, true)); temp.pStubDesc = stub.Handle; IntPtr ptrFunction = handle.PinFunction(fnExecute); temp.DispatchTable = handle.Pin(ptrFunction); temp.ProcString = handle.Pin(formatProc); temp.FmtStringOffset = handle.Pin(new int[1] { 0 }); temp.ThunkTable = IntPtr.Zero; temp.pTransferSyntax = IntPtr.Zero; temp.nCount = IntPtr.Zero; temp.pSyntaxInfo = IntPtr.Zero; //Copy us back into the pinned address Marshal.StructureToPtr( temp, me.Handle, false); return svrIface; }