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
- TransformerInfoCollection.cs
- _ServiceNameStore.cs
- XhtmlStyleClass.cs
- SchemaLookupTable.cs
- mediapermission.cs
- ThicknessKeyFrameCollection.cs
- CharAnimationBase.cs
- ThicknessConverter.cs
- __FastResourceComparer.cs
- DefaultHttpHandler.cs
- NativeMethods.cs
- HtmlInputPassword.cs
- SqlOuterApplyReducer.cs
- RangeValueProviderWrapper.cs
- DBSchemaRow.cs
- EventRoute.cs
- AmbiguousMatchException.cs
- TreeNodeSelectionProcessor.cs
- WebColorConverter.cs
- RemotingServices.cs
- DataMemberConverter.cs
- PassportPrincipal.cs
- ExtenderProvidedPropertyAttribute.cs
- ViewStateModeByIdAttribute.cs
- ClientCultureInfo.cs
- XPathDocumentBuilder.cs
- PathSegmentCollection.cs
- FullTrustAssembliesSection.cs
- XamlTypeMapper.cs
- KerberosSecurityTokenProvider.cs
- PropertyEmitterBase.cs
- SymbolEqualComparer.cs
- ServiceModelEnumValidatorAttribute.cs
- Helper.cs
- GetBrowserTokenRequest.cs
- SaveCardRequest.cs
- TemplatePropertyEntry.cs
- WindowsButton.cs
- DefaultValueAttribute.cs
- TypeInitializationException.cs
- DefaultParameterValueAttribute.cs
- UserControl.cs
- WebPartCatalogCloseVerb.cs
- RootBrowserWindowProxy.cs
- SchemaCollectionCompiler.cs
- Command.cs
- SqlWebEventProvider.cs
- __TransparentProxy.cs
- LingerOption.cs
- LogExtent.cs
- XmlWriterSettings.cs
- SystemIcmpV4Statistics.cs
- HorizontalAlignConverter.cs
- ManualResetEventSlim.cs
- ConfigXmlCDataSection.cs
- DisplayMemberTemplateSelector.cs
- NameScope.cs
- MouseGestureConverter.cs
- ValidationEventArgs.cs
- IPHostEntry.cs
- ToolZone.cs
- GreaterThanOrEqual.cs
- InProcStateClientManager.cs
- XmlAtomicValue.cs
- ToolBarOverflowPanel.cs
- ConfigurationStrings.cs
- DataGridCell.cs
- LeaseManager.cs
- SafeProcessHandle.cs
- OverrideMode.cs
- SimpleWebHandlerParser.cs
- XmlSchemaSet.cs
- WebPartConnectionsEventArgs.cs
- AsyncCompletedEventArgs.cs
- GenericTypeParameterBuilder.cs
- WorkflowViewService.cs
- SpellerInterop.cs
- EventRouteFactory.cs
- CustomBinding.cs
- FacetEnabledSchemaElement.cs
- OutputCacheSettingsSection.cs
- DataGridCell.cs
- TileModeValidation.cs
- NavigationWindowAutomationPeer.cs
- IncrementalReadDecoders.cs
- StylusPointProperties.cs
- ComboBoxAutomationPeer.cs
- dbenumerator.cs
- HtmlImageAdapter.cs
- ServiceProviders.cs
- Decimal.cs
- XpsFilter.cs
- GraphicsContext.cs
- DesignSurfaceServiceContainer.cs
- LateBoundChannelParameterCollection.cs
- EntityType.cs
- TextServicesLoader.cs
- Binding.cs
- Enum.cs
- ConfigurationProperty.cs