public RpcImpersonationContext(RpcCallInfo call) { _call = call; }
private uint RpcEntryPoint(IntPtr clientHandle, uint szInput, IntPtr input, out uint szOutput, out IntPtr output) { output = IntPtr.Zero; szOutput = 0; try { byte[] bytesIn = new byte[szInput]; Marshal.Copy(input, bytesIn, 0, bytesIn.Length); byte[] bytesOut; using (RpcCallInfo call = new RpcCallInfo(clientHandle)) { bytesOut = Execute(call, bytesIn); } if (bytesOut == null) { return (uint)RPC_STATUS.RPC_S_NOT_LISTENING; } szOutput = (uint)bytesOut.Length; output = RpcRuntime.Alloc(szOutput); Marshal.Copy(bytesOut, 0, output, bytesOut.Length); return (uint)RPC_STATUS.RPC_S_OK; } catch (Exception ex) { RpcRuntime.Free(output); output = IntPtr.Zero; szOutput = 0; RpcTrace.Error(ex); return (uint)RPC_STATUS.RPC_E_FAIL; } }