Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / SafeSecurityHandles.cs / 1305376 / SafeSecurityHandles.cs
//[....] namespace Microsoft.Win32.SafeHandles { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; using System.Security; #if !FEATURE_PAL [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLocalAllocHandle : SafeBuffer { private SafeLocalAllocHandle () : base(true) {} // 0 is an Invalid Handle internal SafeLocalAllocHandle (IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLocalAllocHandle InvalidHandle { get { return new SafeLocalAllocHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LocalFree(handle) == IntPtr.Zero; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaLogonProcessHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeLsaLogonProcessHandle() : base (true) {} // 0 is an Invalid Handle internal SafeLsaLogonProcessHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLsaLogonProcessHandle InvalidHandle { get { return new SafeLsaLogonProcessHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { // LsaDeregisterLogonProcess returns an NTSTATUS return Win32Native.LsaDeregisterLogonProcess(handle) >= 0; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaMemoryHandle : SafeBuffer { private SafeLsaMemoryHandle() : base(true) {} // 0 is an Invalid Handle internal SafeLsaMemoryHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLsaMemoryHandle InvalidHandle { get { return new SafeLsaMemoryHandle( IntPtr.Zero ); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LsaFreeMemory(handle) == 0; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaPolicyHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeLsaPolicyHandle() : base(true) {} // 0 is an Invalid Handle internal SafeLsaPolicyHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLsaPolicyHandle InvalidHandle { get { return new SafeLsaPolicyHandle( IntPtr.Zero ); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LsaClose(handle) == 0; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaReturnBufferHandle : SafeBuffer { private SafeLsaReturnBufferHandle() : base (true) {} // 0 is an Invalid Handle internal SafeLsaReturnBufferHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLsaReturnBufferHandle InvalidHandle { get { return new SafeLsaReturnBufferHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { // LsaFreeReturnBuffer returns an NTSTATUS return Win32Native.LsaFreeReturnBuffer(handle) >= 0; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeProcessHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeProcessHandle() : base (true) {} // 0 is an Invalid Handle internal SafeProcessHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeProcessHandle InvalidHandle { get { return new SafeProcessHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeThreadHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeThreadHandle() : base (true) {} // 0 is an Invalid Handle internal SafeThreadHandle(IntPtr handle) : base (true) { SetHandle(handle); } [System.Security.SecurityCritical] [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeTokenHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeTokenHandle() : base (true) {} // 0 is an Invalid Handle internal SafeTokenHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeTokenHandle InvalidHandle { get { return new SafeTokenHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } #endif // !FEATURE_PAL } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //[....] namespace Microsoft.Win32.SafeHandles { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; using System.Security; #if !FEATURE_PAL [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLocalAllocHandle : SafeBuffer { private SafeLocalAllocHandle () : base(true) {} // 0 is an Invalid Handle internal SafeLocalAllocHandle (IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLocalAllocHandle InvalidHandle { get { return new SafeLocalAllocHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LocalFree(handle) == IntPtr.Zero; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaLogonProcessHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeLsaLogonProcessHandle() : base (true) {} // 0 is an Invalid Handle internal SafeLsaLogonProcessHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLsaLogonProcessHandle InvalidHandle { get { return new SafeLsaLogonProcessHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { // LsaDeregisterLogonProcess returns an NTSTATUS return Win32Native.LsaDeregisterLogonProcess(handle) >= 0; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaMemoryHandle : SafeBuffer { private SafeLsaMemoryHandle() : base(true) {} // 0 is an Invalid Handle internal SafeLsaMemoryHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLsaMemoryHandle InvalidHandle { get { return new SafeLsaMemoryHandle( IntPtr.Zero ); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LsaFreeMemory(handle) == 0; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaPolicyHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeLsaPolicyHandle() : base(true) {} // 0 is an Invalid Handle internal SafeLsaPolicyHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLsaPolicyHandle InvalidHandle { get { return new SafeLsaPolicyHandle( IntPtr.Zero ); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { return Win32Native.LsaClose(handle) == 0; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeLsaReturnBufferHandle : SafeBuffer { private SafeLsaReturnBufferHandle() : base (true) {} // 0 is an Invalid Handle internal SafeLsaReturnBufferHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeLsaReturnBufferHandle InvalidHandle { get { return new SafeLsaReturnBufferHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] override protected bool ReleaseHandle() { // LsaFreeReturnBuffer returns an NTSTATUS return Win32Native.LsaFreeReturnBuffer(handle) >= 0; } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeProcessHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeProcessHandle() : base (true) {} // 0 is an Invalid Handle internal SafeProcessHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeProcessHandle InvalidHandle { get { return new SafeProcessHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeThreadHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeThreadHandle() : base (true) {} // 0 is an Invalid Handle internal SafeThreadHandle(IntPtr handle) : base (true) { SetHandle(handle); } [System.Security.SecurityCritical] [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } [System.Security.SecurityCritical] // auto-generated internal sealed class SafeTokenHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeTokenHandle() : base (true) {} // 0 is an Invalid Handle internal SafeTokenHandle(IntPtr handle) : base (true) { SetHandle(handle); } internal static SafeTokenHandle InvalidHandle { get { return new SafeTokenHandle(IntPtr.Zero); } } [System.Security.SecurityCritical] [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] override protected bool ReleaseHandle() { return Win32Native.CloseHandle(handle); } } #endif // !FEATURE_PAL } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LocatorManager.cs
- DebugView.cs
- ToolStripDropDownClosedEventArgs.cs
- Scheduling.cs
- QilInvoke.cs
- BasePropertyDescriptor.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- X509Chain.cs
- MetadataPropertyCollection.cs
- ByteAnimation.cs
- WebPartsSection.cs
- NestedContainer.cs
- TextServicesDisplayAttributePropertyRanges.cs
- OleStrCAMarshaler.cs
- PropertyIDSet.cs
- MetadataArtifactLoaderCompositeResource.cs
- DataSourceProvider.cs
- WorkflowInstanceProvider.cs
- HttpDictionary.cs
- ClockController.cs
- DataTableNameHandler.cs
- AssemblyUtil.cs
- ToolStripDropDownClosingEventArgs.cs
- VirtualDirectoryMapping.cs
- HealthMonitoringSectionHelper.cs
- SecureEnvironment.cs
- ConfigXmlWhitespace.cs
- TextDecorationCollectionConverter.cs
- CodeAttributeArgumentCollection.cs
- ContentType.cs
- XmlSerializationWriter.cs
- MsmqReceiveHelper.cs
- CmsInterop.cs
- PolyLineSegmentFigureLogic.cs
- safemediahandle.cs
- DbModificationCommandTree.cs
- WebUtility.cs
- XPathPatternParser.cs
- ConfigErrorGlyph.cs
- ValidatorCollection.cs
- ProviderSettings.cs
- WinFormsSpinner.cs
- Number.cs
- ClientRuntimeConfig.cs
- DetailsViewModeEventArgs.cs
- ModifierKeysValueSerializer.cs
- COM2PictureConverter.cs
- SchemaElementDecl.cs
- StickyNoteContentControl.cs
- BezierSegment.cs
- TextServicesHost.cs
- SchemaSetCompiler.cs
- GridViewRowPresenter.cs
- ArglessEventHandlerProxy.cs
- SqlCacheDependency.cs
- ClientRoleProvider.cs
- ToolStripContentPanel.cs
- HierarchicalDataBoundControl.cs
- SrgsText.cs
- GridErrorDlg.cs
- HashSetEqualityComparer.cs
- EncoderFallback.cs
- GlobalEventManager.cs
- ContainerUIElement3D.cs
- DispatchWrapper.cs
- HelpEvent.cs
- XmlQueryType.cs
- BrushConverter.cs
- SqlTypeSystemProvider.cs
- SubMenuStyleCollection.cs
- Freezable.cs
- NumberFormatInfo.cs
- DataGridItemEventArgs.cs
- oledbmetadatacolumnnames.cs
- UpdateProgress.cs
- DATA_BLOB.cs
- DataSysAttribute.cs
- RemoteWebConfigurationHost.cs
- CodeTypeDelegate.cs
- ProcessInfo.cs
- InternalDispatchObject.cs
- StringPropertyBuilder.cs
- TagElement.cs
- SingleAnimationBase.cs
- PageThemeBuildProvider.cs
- TypedOperationInfo.cs
- ScriptMethodAttribute.cs
- _ConnectOverlappedAsyncResult.cs
- MethodBuilder.cs
- CodeTypeParameterCollection.cs
- HwndSource.cs
- RenderData.cs
- WindowsTooltip.cs
- MgmtConfigurationRecord.cs
- LookupBindingPropertiesAttribute.cs
- BamlBinaryWriter.cs
- HttpWebRequest.cs
- FontCollection.cs
- HttpProtocolImporter.cs
- XsdDateTime.cs