Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / MS / Internal / SplashScreenNativeMethods.cs / 1305600 / SplashScreenNativeMethods.cs
using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Security; using System.Windows; using Microsoft.Internal; namespace MS.Win32 { internal sealed partial class UnsafeNativeMethods { [SecurityCritical(SecurityCriticalScope.Everything), SuppressUnmanagedCodeSecurity] internal class WIC { #region Constants internal const int WINCODEC_SDK_VERSION = 0x0236; internal static readonly Guid WICPixelFormat32bppPBGRA = new Guid(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x10); #endregion [DllImport(DllImport.WindowsCodecs, EntryPoint = "WICCreateImagingFactory_Proxy")] internal static extern int CreateImagingFactory( UInt32 SDKVersion, out IntPtr ppICodecFactory); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICImagingFactory_CreateStream_Proxy")] internal static extern int /* HRESULT */ CreateStream( IntPtr pICodecFactory, out IntPtr /* IWICBitmapStream */ ppIStream); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICStream_InitializeFromMemory_Proxy")] internal static extern int /*HRESULT*/ InitializeStreamFromMemory( IntPtr pIWICStream, IntPtr pbBuffer, uint cbSize); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICImagingFactory_CreateDecoderFromStream_Proxy")] internal static extern int /*HRESULT*/ CreateDecoderFromStream( IntPtr pICodecFactory, IntPtr /* IStream */ pIStream, ref Guid guidVendor, UInt32 metadataFlags, out IntPtr /* IWICBitmapDecoder */ ppIDecode); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICBitmapDecoder_GetFrame_Proxy")] internal static extern int /* HRESULT */ GetFrame( IntPtr /* IWICBitmapDecoder */ THIS_PTR, UInt32 index, out IntPtr /* IWICBitmapFrameDecode */ ppIFrameDecode); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICImagingFactory_CreateFormatConverter_Proxy")] internal static extern int /* HRESULT */ CreateFormatConverter( IntPtr pICodecFactory, out IntPtr /* IWICFormatConverter */ ppFormatConverter); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICFormatConverter_Initialize_Proxy")] internal static extern int /* HRESULT */ InitializeFormatConverter( IntPtr /* IWICFormatConverter */ THIS_PTR, IntPtr /* IWICBitmapSource */ source, ref Guid dstFormat, int dither, IntPtr /* IWICBitmapPalette */ bitmapPalette, double alphaThreshold, WICPaletteType paletteTranslate); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICImagingFactory_CreateBitmapFlipRotator_Proxy")] internal static extern int /* HRESULT */ CreateBitmapFlipRotator( IntPtr pICodecFactory, out IntPtr /* IWICBitmapFlipRotator */ ppBitmapFlipRotator); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICBitmapFlipRotator_Initialize_Proxy")] internal static extern int /* HRESULT */ InitializeBitmapFlipRotator( IntPtr /* IWICBitmapFlipRotator */ THIS_PTR, IntPtr /* IWICBitmapSource */ source, WICBitmapTransformOptions options); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICBitmapSource_GetSize_Proxy")] internal static extern int /* HRESULT */ GetBitmapSize( IntPtr /* IWICBitmapSource */ THIS_PTR, out Int32 puiWidth, out Int32 puiHeight); [DllImport(DllImport.WindowsCodecs, EntryPoint = "IWICBitmapSource_CopyPixels_Proxy")] internal static extern int /* HRESULT */ CopyPixels( IntPtr /* IWICBitmapSource */ THIS_PTR, ref Int32Rect prc, Int32 cbStride, Int32 cbBufferSize, IntPtr /* BYTE* */ pvPixels); #region enums internal enum WICBitmapTransformOptions { WICBitmapTransformRotate0 = 0, WICBitmapTransformRotate90 = 0x1, WICBitmapTransformRotate180 = 0x2, WICBitmapTransformRotate270 = 0x3, WICBitmapTransformFlipHorizontal = 0x8, WICBitmapTransformFlipVertical = 0x10 } internal enum WICPaletteType { WICPaletteTypeCustom = 0, WICPaletteTypeOptimal = 1, WICPaletteTypeFixedBW = 2, WICPaletteTypeFixedHalftone8 = 3, WICPaletteTypeFixedHalftone27 = 4, WICPaletteTypeFixedHalftone64 = 5, WICPaletteTypeFixedHalftone125 = 6, WICPaletteTypeFixedHalftone216 = 7, WICPaletteTypeFixedWebPalette = 7, WICPaletteTypeFixedHalftone252 = 8, WICPaletteTypeFixedHalftone256 = 9, WICPaletteTypeFixedGray4 = 10, WICPaletteTypeFixedGray16 = 11, WICPaletteTypeFixedGray256 = 12 }; #endregion } internal class HRESULT { ////// Critical: This calls into Marshal.ThrowExceptionForHR which has a link demand /// Safe: Throwing an exception is deemed as a safe operation (throwing exceptions is allowed in Partial Trust). /// We ensure the call to ThrowExceptionForHR is safe since we pass an IntPtr that has a value of -1 so that /// ThrowExceptionForHR ignores IErrorInfo of the current thread, which could reveal critical information otherwise. /// [SecuritySafeCritical] public static void Check(int hr) { if (hr >= 0) { return; } else { // PresentationCore (wgx_render.cs) has a more complete system // for converting hresults to exceptions for MIL and windows codecs // but for splash screen we don't want to take a dependency on core. Marshal.ThrowExceptionForHR(hr, (IntPtr)(-1)); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SrgsGrammarCompiler.cs
- GridView.cs
- ContractHandle.cs
- EventBindingService.cs
- TriggerActionCollection.cs
- PopupControlService.cs
- DictionaryMarkupSerializer.cs
- DataViewListener.cs
- ManualResetEvent.cs
- TimerElapsedEvenArgs.cs
- AccessibilityHelperForVista.cs
- PointConverter.cs
- SqlNode.cs
- InfoCardSchemas.cs
- RawUIStateInputReport.cs
- PartitionResolver.cs
- ExpandSegmentCollection.cs
- FragmentQueryProcessor.cs
- FrameworkPropertyMetadata.cs
- OdbcCommandBuilder.cs
- ButtonFieldBase.cs
- FtpRequestCacheValidator.cs
- CalendarDataBindingHandler.cs
- WmpBitmapEncoder.cs
- SectionInformation.cs
- DisplayInformation.cs
- XmlWellformedWriter.cs
- XamlSerializer.cs
- CallTemplateAction.cs
- ActivatedMessageQueue.cs
- DataGridViewCellMouseEventArgs.cs
- CapabilitiesRule.cs
- ConnectionManagementElement.cs
- SoapEnvelopeProcessingElement.cs
- ISFTagAndGuidCache.cs
- Transform3DGroup.cs
- WorkflowControlClient.cs
- ToolStripComboBox.cs
- PerformanceCounterLib.cs
- regiisutil.cs
- OdbcConnectionStringbuilder.cs
- DateTimeStorage.cs
- FontWeights.cs
- PageSetupDialog.cs
- QuotaExceededException.cs
- SerialPort.cs
- TreeViewImageKeyConverter.cs
- ProxySimple.cs
- WebPartHelpVerb.cs
- Globals.cs
- TimeSpan.cs
- EventLogQuery.cs
- EditorAttribute.cs
- XmlSchemaProviderAttribute.cs
- MetadataArtifactLoaderFile.cs
- ValidationErrorCollection.cs
- XmlWellformedWriter.cs
- WebPartRestoreVerb.cs
- CacheHelper.cs
- EncoderBestFitFallback.cs
- ApplicationServiceHelper.cs
- TreeBuilder.cs
- CodeExpressionCollection.cs
- LogEntryHeaderDeserializer.cs
- PeerEndPoint.cs
- BinaryCommonClasses.cs
- XmlAttributes.cs
- ComponentRenameEvent.cs
- AnimatedTypeHelpers.cs
- MouseCaptureWithinProperty.cs
- FixedBufferAttribute.cs
- RequestResizeEvent.cs
- Point3D.cs
- TextWriter.cs
- FrameworkElement.cs
- VirtualPathProvider.cs
- RowCache.cs
- DesignerSelectionListAdapter.cs
- NominalTypeEliminator.cs
- BrowserDefinitionCollection.cs
- UInt16Converter.cs
- FrameworkTextComposition.cs
- SizeLimitedCache.cs
- NavigationPropertyAccessor.cs
- GreenMethods.cs
- XPathQueryGenerator.cs
- CachedResourceDictionaryExtension.cs
- PositiveTimeSpanValidator.cs
- MetadataReference.cs
- localization.cs
- OLEDB_Enum.cs
- ValidatorCompatibilityHelper.cs
- RowUpdatedEventArgs.cs
- StylusPlugInCollection.cs
- SizeKeyFrameCollection.cs
- SecureStringHasher.cs
- Attributes.cs
- XmlIgnoreAttribute.cs
- TextViewSelectionProcessor.cs
- StorageComplexPropertyMapping.cs