Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / infocard / Client / System / IdentityModel / Selectors / NativeMethods.cs / 1305376 / NativeMethods.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Selectors { using System; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.ComponentModel; using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // For common & resources // using Microsoft.InfoCards; internal static class NativeMethods { public static IntPtr GetProcAddressWrapper( SafeLibraryHandle implDll, string procName ) { IntPtr procaddr = NativeMethods.GetProcAddress( implDll, procName ); if ( IntPtr.Zero == procaddr ) { // // We'll get the last error's message using Win32Exception // Adding the procName gives more context. // ThrowWin32ExceptionWithContext( new Win32Exception(), procName ); } return procaddr; } public static Win32Exception ThrowWin32ExceptionWithContext( Win32Exception wex, string context ) { throw IDT.ThrowHelperError( new Win32Exception( wex.NativeErrorCode, SR.GetString( SR.ClientAPIDetailedExceptionMessage, wex.Message, context ) ) ); } [DllImport( "kernel32.dll" , CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true, CallingConvention = CallingConvention.StdCall )] private static extern IntPtr GetProcAddress( SafeLibraryHandle hModule, [MarshalAs( UnmanagedType.LPStr )] string procname ); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Selectors { using System; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.ComponentModel; using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // For common & resources // using Microsoft.InfoCards; internal static class NativeMethods { public static IntPtr GetProcAddressWrapper( SafeLibraryHandle implDll, string procName ) { IntPtr procaddr = NativeMethods.GetProcAddress( implDll, procName ); if ( IntPtr.Zero == procaddr ) { // // We'll get the last error's message using Win32Exception // Adding the procName gives more context. // ThrowWin32ExceptionWithContext( new Win32Exception(), procName ); } return procaddr; } public static Win32Exception ThrowWin32ExceptionWithContext( Win32Exception wex, string context ) { throw IDT.ThrowHelperError( new Win32Exception( wex.NativeErrorCode, SR.GetString( SR.ClientAPIDetailedExceptionMessage, wex.Message, context ) ) ); } [DllImport( "kernel32.dll" , CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true, CallingConvention = CallingConvention.StdCall )] private static extern IntPtr GetProcAddress( SafeLibraryHandle hModule, [MarshalAs( UnmanagedType.LPStr )] string procname ); } } // 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
- OpenFileDialog.cs
- GeometryDrawing.cs
- FreezableDefaultValueFactory.cs
- TextRenderer.cs
- Native.cs
- ZipIOExtraFieldElement.cs
- XmlWellformedWriter.cs
- EmptyStringExpandableObjectConverter.cs
- OuterGlowBitmapEffect.cs
- SettingsPropertyIsReadOnlyException.cs
- dataprotectionpermission.cs
- Journal.cs
- CollectionChangeEventArgs.cs
- shaperfactoryquerycacheentry.cs
- ImageMap.cs
- ReturnType.cs
- MemoryStream.cs
- XdrBuilder.cs
- CommandEventArgs.cs
- AnnotationAdorner.cs
- SQLResource.cs
- PackageStore.cs
- Table.cs
- WebPartTransformerCollection.cs
- ReliabilityContractAttribute.cs
- InvokeCompletedEventArgs.cs
- MessageFormatterConverter.cs
- InputReferenceExpression.cs
- ZoomingMessageFilter.cs
- ConfigurationLocationCollection.cs
- AnnotationDocumentPaginator.cs
- DataKey.cs
- SparseMemoryStream.cs
- DateTimeOffset.cs
- XmlDocumentType.cs
- InstancePersistence.cs
- ValueOfAction.cs
- DockPanel.cs
- ObjectPersistData.cs
- AssemblyInfo.cs
- Vector3DKeyFrameCollection.cs
- PropertyTabChangedEvent.cs
- ManifestResourceInfo.cs
- InstanceStore.cs
- Validator.cs
- AsyncOperationLifetimeManager.cs
- FieldTemplateUserControl.cs
- StrongBox.cs
- HttpResponseHeader.cs
- DataGridViewHeaderCell.cs
- SecurityTokenAuthenticator.cs
- RemoteWebConfigurationHost.cs
- XmlSchemaComplexContent.cs
- TimelineCollection.cs
- IdnElement.cs
- BitmapEffectvisualstate.cs
- QueueProcessor.cs
- Exceptions.cs
- BindingListCollectionView.cs
- Vector3DAnimationBase.cs
- MouseGesture.cs
- Stream.cs
- Speller.cs
- Accessible.cs
- GrammarBuilderDictation.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- BinaryUtilClasses.cs
- WindowsStatusBar.cs
- OverflowException.cs
- DataGridViewCellPaintingEventArgs.cs
- CharacterString.cs
- SecurityContext.cs
- TrackingMemoryStream.cs
- TemplateXamlTreeBuilder.cs
- CollectionDataContractAttribute.cs
- WindowsListViewGroupHelper.cs
- OrderedHashRepartitionEnumerator.cs
- __Filters.cs
- BitmapPalettes.cs
- SuppressIldasmAttribute.cs
- GPPOINTF.cs
- TreeViewTemplateSelector.cs
- XmlTextReaderImpl.cs
- HtmlToClrEventProxy.cs
- DefaultBindingPropertyAttribute.cs
- BrushMappingModeValidation.cs
- FileUpload.cs
- HttpWebResponse.cs
- TableLayoutPanelDesigner.cs
- TreeNode.cs
- RepeaterItemCollection.cs
- NetworkCredential.cs
- WindowsTokenRoleProvider.cs
- XmlEnumAttribute.cs
- UriExt.cs
- NamespaceCollection.cs
- QueryAccessibilityHelpEvent.cs
- Buffer.cs
- FullTextState.cs
- WeakHashtable.cs