コード例 #1
0
        public void NtConnectPort()
        {
            var    handle           = new AlpcPortHandle();
            var    name             = "\\" + this.GetType().Name + MethodBase.GetCurrentMethod().Name;
            IntPtr optional         = IntPtr.Zero;
            uint   maxMessageLenght = 100;
            var    SecurityQos      = new SECURITY_QUALITY_OF_SERVICE();
            int    status           = NativeMethods.NtConnectPort(out handle, name, ref SecurityQos, out optional, out optional, ref maxMessageLenght, out optional, out optional);

            AlpcErrorHandler.Check(status);
        }
コード例 #2
0
        public void NtListenPort()
        {
            var handle = new AlpcPortHandle();
            var msg    = new MY_TRANSFERRED_MESSAGE();
            var wait   = Task.Factory.StartNew(() =>
            {
                var status = NativeMethods.NtListenPort(handle, ref msg.Header);
                Assert.AreNotEqual(0, status);
            });
            var listenBlocksThread = wait.Wait(100);

            Assert.IsTrue(listenBlocksThread);
        }