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
- InfoCardXmlSerializer.cs
- WorkflowWebService.cs
- StringCollection.cs
- EncodingDataItem.cs
- DelayedRegex.cs
- OleDbEnumerator.cs
- FilteredReadOnlyMetadataCollection.cs
- QuadraticBezierSegment.cs
- CellParaClient.cs
- Vector3DKeyFrameCollection.cs
- DrawingGroupDrawingContext.cs
- CfgRule.cs
- BamlResourceContent.cs
- EnumBuilder.cs
- Transform3DCollection.cs
- DataListItemEventArgs.cs
- ObjectParameterCollection.cs
- DeviceContext2.cs
- ContextMenu.cs
- ManualResetEvent.cs
- _ConnectionGroup.cs
- InfoCardRSACryptoProvider.cs
- WSDualHttpSecurityElement.cs
- ipaddressinformationcollection.cs
- HierarchicalDataSourceConverter.cs
- UnknownWrapper.cs
- Stacktrace.cs
- HelpFileFileNameEditor.cs
- DrawingAttributes.cs
- EditingCommands.cs
- WebPartManager.cs
- DataGridViewRowsRemovedEventArgs.cs
- InstancePersistenceEvent.cs
- Listbox.cs
- DataTemplateSelector.cs
- ContextMenuStripActionList.cs
- SafeLocalAllocation.cs
- Matrix3DConverter.cs
- OdbcConnection.cs
- ProcessModelInfo.cs
- BindingOperations.cs
- JsonEncodingStreamWrapper.cs
- JsonFormatGeneratorStatics.cs
- TextUtf8RawTextWriter.cs
- DataListItem.cs
- AdPostCacheSubstitution.cs
- ExtenderControl.cs
- XomlCompilerResults.cs
- DmlSqlGenerator.cs
- BamlLocalizableResource.cs
- SingleConverter.cs
- ObjectViewEntityCollectionData.cs
- SqlFunctionAttribute.cs
- SqlCacheDependencySection.cs
- ControlPropertyNameConverter.cs
- ContentDesigner.cs
- CompletionCallbackWrapper.cs
- Byte.cs
- CodeAccessPermission.cs
- ConvertersCollection.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- ProbeMatches11.cs
- HttpCapabilitiesBase.cs
- PersianCalendar.cs
- DrawingVisualDrawingContext.cs
- FreeFormDesigner.cs
- ZipIOExtraFieldElement.cs
- ComplusEndpointConfigContainer.cs
- ObjectSecurity.cs
- SerializationEventsCache.cs
- OleStrCAMarshaler.cs
- DesignerTransaction.cs
- InfoCardKeyedHashAlgorithm.cs
- ProgressBarBrushConverter.cs
- HostVisual.cs
- CollectionContainer.cs
- TransformerConfigurationWizardBase.cs
- NetSectionGroup.cs
- DataFormats.cs
- ModifierKeysValueSerializer.cs
- _DisconnectOverlappedAsyncResult.cs
- SqlTriggerContext.cs
- UIServiceHelper.cs
- Application.cs
- ImageDrawing.cs
- WsiProfilesElement.cs
- RayMeshGeometry3DHitTestResult.cs
- DependencyStoreSurrogate.cs
- TextRunProperties.cs
- HMACRIPEMD160.cs
- CorrelationRequestContext.cs
- CustomCredentialPolicy.cs
- WebZoneDesigner.cs
- Pkcs7Recipient.cs
- ModelItemKeyValuePair.cs
- DataTableMappingCollection.cs
- SendOperation.cs
- StyleSheetComponentEditor.cs
- FixedPage.cs
- SHA512Managed.cs