public RpcImpersonationContext(RpcClientInfo client)
 {
     _client = client;
 }
        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 (RpcClientInfo client = new RpcClientInfo(clientHandle))
                {
                    bytesOut = Execute(client, bytesIn);
                }
                if (bytesOut == null)
                {
                    return (uint) RpcError.RPC_S_NOT_LISTENING;
                }

                szOutput = (uint) bytesOut.Length;
                output = RpcApi.Alloc(szOutput);
                Marshal.Copy(bytesOut, 0, output, bytesOut.Length);

                return (uint) RpcError.RPC_S_OK;
            }
            catch (Exception ex)
            {
                RpcApi.Free(output);
                output = IntPtr.Zero;
                szOutput = 0;

                Log.Error(ex);
                return (uint) RpcError.RPC_E_FAIL;
            }
        }
 public RpcImpersonationContext(RpcClientInfo client)
 {
     _client = client;
 }