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
- UserMapPath.cs
- PersonalizationStateQuery.cs
- SpeakCompletedEventArgs.cs
- HttpClientCertificate.cs
- RNGCryptoServiceProvider.cs
- DataBindingList.cs
- _WebProxyDataBuilder.cs
- ThreadSafeList.cs
- Calendar.cs
- ClientSession.cs
- xml.cs
- TextSelectionHighlightLayer.cs
- DodSequenceMerge.cs
- MetadataArtifactLoaderCompositeResource.cs
- CodeGen.cs
- DateTimeSerializationSection.cs
- FileAuthorizationModule.cs
- Knowncolors.cs
- SafeCryptContextHandle.cs
- DictionaryManager.cs
- MediaTimeline.cs
- SecurityChannelFaultConverter.cs
- UIElementHelper.cs
- UnsafeNativeMethods.cs
- DatePickerAutomationPeer.cs
- FastEncoderWindow.cs
- Keyboard.cs
- UserControlAutomationPeer.cs
- TransactionFlowOption.cs
- AutomationProperties.cs
- TemplateApplicationHelper.cs
- PageSettings.cs
- ZipIOModeEnforcingStream.cs
- IUnknownConstantAttribute.cs
- Matrix.cs
- DynamicAttribute.cs
- OleDbSchemaGuid.cs
- XmlDataDocument.cs
- MatrixConverter.cs
- SafeNativeMethods.cs
- RequestQueryProcessor.cs
- CompoundFileReference.cs
- Model3D.cs
- RadialGradientBrush.cs
- RenderingBiasValidation.cs
- EncryptedPackageFilter.cs
- StateDesigner.TransitionInfo.cs
- RenamedEventArgs.cs
- UnknownWrapper.cs
- RuleRef.cs
- DataGridViewImageCell.cs
- ResXResourceReader.cs
- CommandBindingCollection.cs
- SecurityRuntime.cs
- PropertyInfoSet.cs
- DataGridViewDataConnection.cs
- Geometry.cs
- CallContext.cs
- PipelineModuleStepContainer.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- LogSwitch.cs
- PermissionSetTriple.cs
- ValueTypeFixupInfo.cs
- COM2Enum.cs
- Command.cs
- KeysConverter.cs
- ListenerAdaptersInstallComponent.cs
- WindowClosedEventArgs.cs
- PersonalizationDictionary.cs
- UnauthorizedAccessException.cs
- ObjectRef.cs
- XPathBuilder.cs
- ILGenerator.cs
- SQLUtility.cs
- CLSCompliantAttribute.cs
- AppDomainManager.cs
- IconBitmapDecoder.cs
- MSAAWinEventWrap.cs
- MappingMetadataHelper.cs
- DataListItem.cs
- ListViewTableRow.cs
- QilBinary.cs
- MediaElementAutomationPeer.cs
- EventDescriptor.cs
- ButtonChrome.cs
- DrawToolTipEventArgs.cs
- ActivityPreviewDesigner.cs
- ProviderCommandInfoUtils.cs
- PolyLineSegment.cs
- DocumentsTrace.cs
- PolyBezierSegment.cs
- AuthenticatedStream.cs
- FieldNameLookup.cs
- SamlAuthenticationClaimResource.cs
- FilteredXmlReader.cs
- SmtpCommands.cs
- ForeignKeyFactory.cs
- UnicodeEncoding.cs
- GACIdentityPermission.cs
- ContainerControlDesigner.cs