Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Shared / MS / Win32 / WinInet.cs / 1 / WinInet.cs
using System; using System.Security; using System.Runtime.InteropServices; namespace MS.Win32 { internal static class WinInet { ////// Will return the location of the internet cache folder. /// ///The location of the internet cache folder. ////// Critical: /// 1) Calls several Marshal methods which have a link demand on them. /// 2) Calls NativeMethods.GetUrlCacheConfigInfo which is SecurityCritical. /// Not Safe: /// 2) Returns a Path that may leak information about the system. /// internal static Uri InternetCacheFolder { [SecurityCritical] get { // copied value 260 from orginal implementation in BitmapDownload.cs const int maxPathSize = 260; const UInt32 fieldControl = (UInt32)maxPathSize; NativeMethods.InternetCacheConfigInfo icci = new NativeMethods.InternetCacheConfigInfo(); icci.CachePath = new string(new char[maxPathSize]); UInt32 size = (UInt32)Marshal.SizeOf(icci); bool passed = UnsafeNativeMethods.GetUrlCacheConfigInfo( ref icci, ref size, fieldControl); if (!passed) { int hr = Marshal.GetHRForLastWin32Error(); if (hr != 0) { Marshal.ThrowExceptionForHR(hr); } } return new Uri(icci.CachePath); } } } } // 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
- MonthChangedEventArgs.cs
- FileFormatException.cs
- TiffBitmapDecoder.cs
- DataServiceProcessingPipelineEventArgs.cs
- EditorZoneAutoFormat.cs
- LateBoundBitmapDecoder.cs
- TextPatternIdentifiers.cs
- InsufficientMemoryException.cs
- RangeValidator.cs
- RegistryPermission.cs
- XmlNode.cs
- Operators.cs
- DataTablePropertyDescriptor.cs
- SymLanguageType.cs
- CodeGenerationManager.cs
- XmlWrappingReader.cs
- oledbmetadatacollectionnames.cs
- XamlToRtfWriter.cs
- ObjectCache.cs
- X509Extension.cs
- MaskDescriptors.cs
- AsyncInvokeContext.cs
- AdapterUtil.cs
- AuthenticationManager.cs
- HttpWebRequestElement.cs
- ContentOperations.cs
- OdbcStatementHandle.cs
- ClientSection.cs
- ScalarRestriction.cs
- StreamResourceInfo.cs
- EntityClassGenerator.cs
- BindingRestrictions.cs
- ObjectDataSourceView.cs
- HttpCapabilitiesEvaluator.cs
- ClientSettingsSection.cs
- SqlProviderUtilities.cs
- CryptoProvider.cs
- SourceFileInfo.cs
- XmlSortKeyAccumulator.cs
- InternalCache.cs
- ListSortDescriptionCollection.cs
- MessageHeader.cs
- SoapInteropTypes.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ReferenceEqualityComparer.cs
- QueryCacheManager.cs
- WinInetCache.cs
- TransportBindingElementImporter.cs
- DragStartedEventArgs.cs
- SystemResources.cs
- SmiContext.cs
- PrimitiveSchema.cs
- ExpressionList.cs
- Misc.cs
- WpfWebRequestHelper.cs
- XmlLinkedNode.cs
- HttpApplication.cs
- JsonServiceDocumentSerializer.cs
- PermissionRequestEvidence.cs
- CategoryNameCollection.cs
- DateTimeValueSerializerContext.cs
- StringFunctions.cs
- SevenBitStream.cs
- BindingCollection.cs
- UnicodeEncoding.cs
- tibetanshape.cs
- StyleSelector.cs
- RTLAwareMessageBox.cs
- UnsafeMethods.cs
- LocalizableAttribute.cs
- GcSettings.cs
- RootBrowserWindowAutomationPeer.cs
- SharedConnectionWorkflowTransactionService.cs
- Function.cs
- CharAnimationBase.cs
- DataTablePropertyDescriptor.cs
- HttpHandlersSection.cs
- WorkflowPrinting.cs
- ParenthesizePropertyNameAttribute.cs
- SubMenuStyleCollection.cs
- QueueProcessor.cs
- SignatureDescription.cs
- CustomError.cs
- DataSourceDescriptorCollection.cs
- GridToolTip.cs
- DataExpression.cs
- CodeMethodInvokeExpression.cs
- SiteMapDataSource.cs
- TargetControlTypeCache.cs
- ConnectionManagementElementCollection.cs
- GridProviderWrapper.cs
- RelOps.cs
- DataGridViewCellParsingEventArgs.cs
- Encoder.cs
- DbConnectionPoolGroup.cs
- CellLabel.cs
- Helpers.cs
- TypeInitializationException.cs
- DrawingGroup.cs
- CircleHotSpot.cs