Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / IO / MemoryMappedFiles / MemoryMappedViewStream.cs / 1305376 / MemoryMappedViewStream.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: MemoryMappedViewStream ** ** Purpose: View stream for managed MemoryMappedFiles. ** ** Date: February 7, 2007 ** ===========================================================*/ using System; using System.Diagnostics; using System.Security.Permissions; using Microsoft.Win32.SafeHandles; namespace System.IO.MemoryMappedFiles { public sealed class MemoryMappedViewStream : UnmanagedMemoryStream { private MemoryMappedView m_view; //// [System.Security.SecurityCritical] internal unsafe MemoryMappedViewStream(MemoryMappedView view) { Debug.Assert(view != null, "view is null"); m_view = view; Initialize(m_view.ViewHandle, m_view.PointerOffset, m_view.Size, MemoryMappedFile.GetFileAccess(m_view.Access)); } public SafeMemoryMappedViewHandle SafeMemoryMappedViewHandle { //// // [System.Security.SecurityCritical] [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] get { return m_view != null ? m_view.ViewHandle : null; } } public override void SetLength(long value) { throw new NotSupportedException(SR.GetString(SR.NotSupported_MMViewStreamsFixedLength)); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing && m_view != null && !m_view.IsClosed) { Flush(); } } finally { try { if (m_view != null) { m_view.Dispose(); } } finally { base.Dispose(disposing); } } } // Flushes the changes such that they are in [....] with the FileStream bits (ones obtained // with the win32 ReadFile and WriteFile functions). Need to call FileStream's Flush to // flush to the disk. // NOTE: This will flush all bytes before and after the view up until an offset that is a // multiple of SystemPageSize. //// // [System.Security.SecurityCritical] public override void Flush() { if (!CanSeek) { __Error.StreamIsClosed(); } unsafe { if (m_view != null) { m_view.Flush((IntPtr)Capacity); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.//
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Effect.cs
- X509ChainElement.cs
- CommandLibraryHelper.cs
- DBBindings.cs
- TraceSwitch.cs
- ElementAction.cs
- DataKey.cs
- EdmItemCollection.OcAssemblyCache.cs
- CookieProtection.cs
- UserPreferenceChangingEventArgs.cs
- TextTreeObjectNode.cs
- XPathBinder.cs
- ProfilePropertySettingsCollection.cs
- AdjustableArrowCap.cs
- PipelineModuleStepContainer.cs
- ArraySet.cs
- SQLString.cs
- XmlAtomErrorReader.cs
- FormViewDeleteEventArgs.cs
- Itemizer.cs
- XmlAnyAttributeAttribute.cs
- PageSetupDialog.cs
- SiteMapDataSourceView.cs
- HoistedLocals.cs
- TextEditorSpelling.cs
- Cursors.cs
- SplashScreenNativeMethods.cs
- WindowAutomationPeer.cs
- GuidelineCollection.cs
- DbException.cs
- NativeObjectSecurity.cs
- XmlQualifiedName.cs
- WebEventTraceProvider.cs
- TableParagraph.cs
- xmlfixedPageInfo.cs
- ProxyHwnd.cs
- AttributeProviderAttribute.cs
- ListView.cs
- SymLanguageType.cs
- TreeBuilder.cs
- MetabaseSettingsIis7.cs
- ObjectPersistData.cs
- PermissionSetEnumerator.cs
- HttpClientProtocol.cs
- ClientSponsor.cs
- Vector.cs
- AuthenticationConfig.cs
- AttachInfo.cs
- ConstructorExpr.cs
- ReturnType.cs
- ProgressBarHighlightConverter.cs
- ConsoleKeyInfo.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- sitestring.cs
- TextContainerHelper.cs
- BasicBrowserDialog.designer.cs
- SingleAnimationUsingKeyFrames.cs
- BamlResourceContent.cs
- CodeIdentifiers.cs
- BuildProviderAppliesToAttribute.cs
- ArgumentNullException.cs
- OracleLob.cs
- DocumentViewer.cs
- XmlTypeAttribute.cs
- Vector3D.cs
- InternalsVisibleToAttribute.cs
- XmlPreloadedResolver.cs
- Closure.cs
- ConstraintStruct.cs
- Point3DCollectionConverter.cs
- GenericAuthenticationEventArgs.cs
- ListBase.cs
- DataSpaceManager.cs
- XmlDownloadManager.cs
- Membership.cs
- EntityPropertyMappingAttribute.cs
- ResourceContainer.cs
- PageRequestManager.cs
- ManagedWndProcTracker.cs
- ProcessModuleDesigner.cs
- Normalization.cs
- DataObject.cs
- ParserContext.cs
- UnsafeNativeMethods.cs
- ContentOperations.cs
- FilteredAttributeCollection.cs
- BehaviorEditorPart.cs
- XmlNamedNodeMap.cs
- DetailsViewUpdateEventArgs.cs
- SystemResources.cs
- PropertyEmitterBase.cs
- RequestQueryParser.cs
- PrePrepareMethodAttribute.cs
- DateTimeParse.cs
- GridViewCancelEditEventArgs.cs
- ModuleConfigurationInfo.cs
- Int16AnimationBase.cs
- SocketSettings.cs
- SettingsAttributes.cs
- WebScriptEnablingBehavior.cs