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
- SqlUtil.cs
- BindingSource.cs
- SqlVersion.cs
- EncoderBestFitFallback.cs
- DynamicMetaObject.cs
- ManagementBaseObject.cs
- EventWaitHandle.cs
- ExpandCollapsePattern.cs
- PropertyState.cs
- CookielessData.cs
- XmlSchemaAny.cs
- MemberPathMap.cs
- ExportOptions.cs
- remotingproxy.cs
- BindingMemberInfo.cs
- MetadataCollection.cs
- TreeNodeStyle.cs
- SystemFonts.cs
- SrgsOneOf.cs
- OleCmdHelper.cs
- DataGridBoolColumn.cs
- CodePageEncoding.cs
- DbMetaDataCollectionNames.cs
- ModuleConfigurationInfo.cs
- Selector.cs
- IMembershipProvider.cs
- FixedFindEngine.cs
- ExceptionHelpers.cs
- XmlAtomicValue.cs
- DataTemplateKey.cs
- metadatamappinghashervisitor.cs
- SchemaAttDef.cs
- Page.cs
- Translator.cs
- BufferCache.cs
- PersonalizationDictionary.cs
- Instrumentation.cs
- PasswordValidationException.cs
- TdsParserSessionPool.cs
- ParallelTimeline.cs
- XmlCharacterData.cs
- CommentEmitter.cs
- CachedBitmap.cs
- MergeLocalizationDirectives.cs
- ConfigsHelper.cs
- RolePrincipal.cs
- SqlDataSourceStatusEventArgs.cs
- FileDialogCustomPlace.cs
- EventLogTraceListener.cs
- PathFigureCollection.cs
- COM2IDispatchConverter.cs
- ActivationWorker.cs
- TemplatePropertyEntry.cs
- cookie.cs
- PeerCollaboration.cs
- ViewDesigner.cs
- AnnotationDocumentPaginator.cs
- ServiceCredentialsElement.cs
- IdSpace.cs
- ExpressionPrefixAttribute.cs
- JsonReader.cs
- ChannelSinkStacks.cs
- CodeValidator.cs
- DocumentAutomationPeer.cs
- MenuCommandsChangedEventArgs.cs
- JsonStringDataContract.cs
- ConnectAlgorithms.cs
- StringAnimationUsingKeyFrames.cs
- WinEventQueueItem.cs
- EdmPropertyAttribute.cs
- RowToFieldTransformer.cs
- BaseTemplateParser.cs
- QilInvokeEarlyBound.cs
- FeatureSupport.cs
- ConsoleKeyInfo.cs
- ValidationHelper.cs
- Group.cs
- AssemblyEvidenceFactory.cs
- RenderingEventArgs.cs
- SiteMapDataSource.cs
- PrivateFontCollection.cs
- RectangleF.cs
- SqlGatherProducedAliases.cs
- SessionStateModule.cs
- SectionXmlInfo.cs
- SoapTypeAttribute.cs
- WebConfigurationManager.cs
- CodeSubDirectory.cs
- ToolBarButtonClickEvent.cs
- MenuItemCollection.cs
- InputBinding.cs
- UriSection.cs
- DataGridViewImageCell.cs
- ListViewUpdateEventArgs.cs
- CommunicationObjectAbortedException.cs
- RightsManagementInformation.cs
- CompilerState.cs
- IdentifierCreationService.cs
- ClientScriptManagerWrapper.cs
- BuildProviderCollection.cs