Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / System.ServiceModel.Activation / System / ServiceModel / Activation / Interop / SafeNativeMethods.cs / 1305376 / SafeNativeMethods.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Activation.Interop { using System; using System.Security; using System.Runtime.InteropServices; using System.Security.Principal; using System.Runtime.Versioning; using System.Runtime; [SuppressUnmanagedCodeSecurity] static class SafeNativeMethods { public const int ERROR_NO_TOKEN = 1008; const string ADVAPI32 = "advapi32.dll"; const string KERNEL32 = "kernel32.dll"; [DllImport(ADVAPI32, SetLastError = true, EntryPoint = "OpenThreadToken")] [ResourceExposure(ResourceScope.None)] static extern bool OpenThreadTokenCritical( [In] IntPtr ThreadHandle, [In] TokenAccessLevels DesiredAccess, [In] bool OpenAsSelf, [Out] out SafeCloseHandleCritical TokenHandle); [DllImport(KERNEL32, SetLastError = true)] [ResourceExposure(ResourceScope.None)] static extern IntPtr GetCurrentThread(); [Fx.Tag.SecurityNote(Critical = "Calls two safe native methods: GetCurrentThread and OpenThreadToken." + "Marshal.GetLastWin32Error captures current thread token in a SecurityCritical field.")] [SecurityCritical] internal static bool OpenCurrentThreadTokenCritical(TokenAccessLevels desiredAccess, bool openAsSelf, out SafeCloseHandleCritical tokenHandle, out int error) { bool result = OpenThreadTokenCritical(GetCurrentThread(), desiredAccess, openAsSelf, out tokenHandle); error = Marshal.GetLastWin32Error(); return result; } } } // 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
- ProcessThreadCollection.cs
- Expression.cs
- XmlMembersMapping.cs
- ColorTranslator.cs
- CollaborationHelperFunctions.cs
- HtmlTableCell.cs
- _ProxyChain.cs
- WebPartVerbCollection.cs
- Enum.cs
- Byte.cs
- IdnMapping.cs
- TreeViewAutomationPeer.cs
- AuthorizationSection.cs
- SettingsBase.cs
- CultureMapper.cs
- TypeConverterHelper.cs
- TextDecorations.cs
- ProfessionalColorTable.cs
- HeaderCollection.cs
- DesignerOptionService.cs
- DecoderReplacementFallback.cs
- PathSegment.cs
- DataTableClearEvent.cs
- Validator.cs
- EntityProviderServices.cs
- XamlSerializerUtil.cs
- OrderPreservingMergeHelper.cs
- TypeConverterValueSerializer.cs
- ZipPackagePart.cs
- LinkTarget.cs
- altserialization.cs
- CommandBindingCollection.cs
- ImportCatalogPart.cs
- clipboard.cs
- DispatcherSynchronizationContext.cs
- FileDialog_Vista_Interop.cs
- MailWebEventProvider.cs
- ToolStripItemDataObject.cs
- CorrelationToken.cs
- RewritingPass.cs
- GeometryHitTestParameters.cs
- CoordinationService.cs
- WebPartDeleteVerb.cs
- InputDevice.cs
- LineGeometry.cs
- ArgumentException.cs
- Attachment.cs
- UrlMappingCollection.cs
- Transform.cs
- fixedPageContentExtractor.cs
- StdRegProviderWrapper.cs
- IndexOutOfRangeException.cs
- XmlTextAttribute.cs
- SvcMapFileSerializer.cs
- MultiView.cs
- SchemaReference.cs
- WebPartEditorCancelVerb.cs
- BrowserDefinition.cs
- FunctionQuery.cs
- _StreamFramer.cs
- XmlSchemaSequence.cs
- DbProviderFactories.cs
- SqlDataSourceFilteringEventArgs.cs
- XsdBuildProvider.cs
- MimeFormatExtensions.cs
- RowsCopiedEventArgs.cs
- SiteMapProvider.cs
- EntityDataSourceWrapper.cs
- EncryptedType.cs
- EdgeProfileValidation.cs
- ObjectComplexPropertyMapping.cs
- NativeCppClassAttribute.cs
- ToolBarTray.cs
- WebEvents.cs
- TcpHostedTransportConfiguration.cs
- PathStreamGeometryContext.cs
- TextEncodedRawTextWriter.cs
- Thread.cs
- Column.cs
- Mappings.cs
- VisualStateGroup.cs
- FormCollection.cs
- UrlMappingsSection.cs
- XamlTemplateSerializer.cs
- SHA256Cng.cs
- CodeTypeDelegate.cs
- HintTextConverter.cs
- XamlTemplateSerializer.cs
- ScrollEventArgs.cs
- SingleAnimationUsingKeyFrames.cs
- PropertyPushdownHelper.cs
- RsaElement.cs
- VirtualPathProvider.cs
- SqlDataSourceCache.cs
- SecurityAppliedMessage.cs
- CollectionChangeEventArgs.cs
- Selection.cs
- ContextMenu.cs
- RTTypeWrapper.cs
- X509Certificate2Collection.cs