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
- RenderData.cs
- NativeMethods.cs
- ToolConsole.cs
- Adorner.cs
- BookmarkNameHelper.cs
- CmsInterop.cs
- GeneralTransform3DGroup.cs
- webeventbuffer.cs
- RuntimeHelpers.cs
- mda.cs
- ListBox.cs
- SqlUdtInfo.cs
- SystemException.cs
- CodeChecksumPragma.cs
- IndentTextWriter.cs
- Soap.cs
- UnregisterInfo.cs
- DBParameter.cs
- UxThemeWrapper.cs
- RoamingStoreFile.cs
- MailHeaderInfo.cs
- DesignerAutoFormatCollection.cs
- COM2ExtendedTypeConverter.cs
- recordstatefactory.cs
- FileDialog_Vista.cs
- CancellationScope.cs
- DynamicScriptObject.cs
- ComEventsSink.cs
- TemplateInstanceAttribute.cs
- KeyValuePairs.cs
- LinkedResourceCollection.cs
- HideDisabledControlAdapter.cs
- ButtonFieldBase.cs
- HtmlUtf8RawTextWriter.cs
- WebScriptEnablingBehavior.cs
- PrinterSettings.cs
- ColumnClickEvent.cs
- MouseActionConverter.cs
- MailDefinition.cs
- EntityProxyTypeInfo.cs
- regiisutil.cs
- List.cs
- CatalogZone.cs
- WindowsListViewItemStartMenu.cs
- Thread.cs
- SecureStringHasher.cs
- XsdDataContractImporter.cs
- SpellerHighlightLayer.cs
- PaintEvent.cs
- ScrollProviderWrapper.cs
- OdbcError.cs
- HashMembershipCondition.cs
- ValueSerializer.cs
- XmlByteStreamReader.cs
- ArrangedElement.cs
- DSASignatureDeformatter.cs
- SingleConverter.cs
- MultiTouchSystemGestureLogic.cs
- RemotingService.cs
- TraceUtility.cs
- GridViewActionList.cs
- remotingproxy.cs
- EventlogProvider.cs
- ServicePoint.cs
- MaskedTextProvider.cs
- PublisherIdentityPermission.cs
- UTF8Encoding.cs
- CompiledQueryCacheKey.cs
- PrintingPermissionAttribute.cs
- UriTemplateTableMatchCandidate.cs
- FontDialog.cs
- RtfControlWordInfo.cs
- QueryInterceptorAttribute.cs
- ArgumentValidation.cs
- TextContainerChangeEventArgs.cs
- FormViewCommandEventArgs.cs
- DirectionalLight.cs
- DataGridViewCellFormattingEventArgs.cs
- ErrorHandlingAcceptor.cs
- StringInfo.cs
- XslAst.cs
- HorizontalAlignConverter.cs
- _NestedSingleAsyncResult.cs
- UnsafeNativeMethods.cs
- ScalarOps.cs
- WebServiceFault.cs
- XLinq.cs
- View.cs
- ClientSideProviderDescription.cs
- NumericUpDown.cs
- QilDataSource.cs
- _BasicClient.cs
- IgnorePropertiesAttribute.cs
- AdPostCacheSubstitution.cs
- XmlWrappingWriter.cs
- IDispatchConstantAttribute.cs
- BaseHashHelper.cs
- CollectionExtensions.cs
- TypeInfo.cs
- ParameterRetriever.cs