Exemplo n.º 1
0
 internal static bool PollRpc(bool blocking, TimeSpan timeout, out RpcCallInfo callInfo)
 {
     if (Interop.NT_PollRpcTimeout(blocking ? 1 : 0, timeout.TotalSeconds, out NtRpcCallInfo nativeInfo) == 0)
     {
         callInfo = new RpcCallInfo();
         return(false);
     }
     callInfo = nativeInfo.ToManaged();
     return(true);
 }
Exemplo n.º 2
0
        internal static bool PollRpc(bool blocking, out RpcCallInfo callInfo)
        {
            int retVal = Interop.NT_PollRpc(blocking ? 1 : 0, out var nativeInfo);

            if (retVal == 0)
            {
                callInfo = new RpcCallInfo();
                return(false);
            }
            callInfo = nativeInfo.ToManaged();
            return(true);
        }
Exemplo n.º 3
0
        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);
            }
        }
 /// <inheritdoc cref="RemoteProcedureCall.PollRpc(bool, out RpcCallInfo)"/>
 public bool PollRpc(bool blocking, out RpcCallInfo callInfo)
 {
     return(m_ntCore.m_rpcServer.PollRpc(blocking, out callInfo));
 }