Esempio n. 1
0
            public unsafe void Read()
            {
                var iterator = Channel.BeginWrite(2048);

                var data  = iterator.Block.DataArrayPtr + iterator.Block.End;
                var count = iterator.Block.Data.Offset + iterator.Block.Data.Count - iterator.Block.End;

                var overlapped = Handle.AllocateNativeOverlapped(IOCallback, this, iterator.Block.DataArrayPtr);

                overlapped->OffsetLow = Offset;

                Iterator = new Box <MemoryPoolIterator>(iterator);

                int r = ReadFile(FileHandle, data, count, IntPtr.Zero, overlapped);

                // 997
                int hr = Marshal.GetLastWin32Error();

                if (hr != 997)
                {
                    Channel.CompleteWriting(Marshal.GetExceptionForHR(hr));
                }
            }