public void VerifyHandleInheritability(String strLoc, SafeMemoryMappedFileHandle handle, HandleInheritability inheritability) { if (Interop.PlatformDetection.OperatingSystem != Interop.OperatingSystem.Windows) { return; } uint expected; if (inheritability == HandleInheritability.Inheritable) { expected = HANDLE_FLAG_INHERIT; } else if (inheritability == HandleInheritability.None) { expected = 0; } else { throw new Exception("Test error! Invalid HandleInheritability passed to VerifyHandleInheritability"); } uint flags; bool result = GetHandleInformation(handle.DangerousGetHandle(), out flags); Eval(expected, (flags & HANDLE_FLAG_INHERIT), "ERROR, {0}: HandleInheritability was wrong.", strLoc); }
public MemoryMappedViewStream CreateViewStream(long offset, long size, MemoryMappedFileAccess access) { var view = MemoryMappedView.Create(handle.DangerousGetHandle(), offset, size, access); return(new MemoryMappedViewStream(view)); }