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
- CompositeFontInfo.cs
- XsltException.cs
- OrderedDictionary.cs
- SafeNativeMethods.cs
- AppDomainCompilerProxy.cs
- SurrogateSelector.cs
- Drawing.cs
- AddInDeploymentState.cs
- SqlCommand.cs
- SystemInfo.cs
- SqlDataSourceCommandEventArgs.cs
- ScaleTransform3D.cs
- ButtonFieldBase.cs
- CqlLexer.cs
- ValidatorCollection.cs
- InvalidFilterCriteriaException.cs
- NetDataContractSerializer.cs
- ConnectionOrientedTransportManager.cs
- Part.cs
- TransformedBitmap.cs
- ContentDesigner.cs
- XmlEncoding.cs
- BitmapEffectCollection.cs
- SmiContextFactory.cs
- LoginViewDesigner.cs
- BrowsableAttribute.cs
- EdmFunction.cs
- UnaryQueryOperator.cs
- Substitution.cs
- XmlReflectionImporter.cs
- ThemeableAttribute.cs
- UnsafeNativeMethods.cs
- ProfileEventArgs.cs
- LinearKeyFrames.cs
- CallbackHandler.cs
- Transform3DGroup.cs
- MeasureItemEvent.cs
- CommentEmitter.cs
- HierarchicalDataBoundControl.cs
- CompressEmulationStream.cs
- SqlDataSourceEnumerator.cs
- TextSelectionHelper.cs
- XomlCompilerParameters.cs
- DataContractSerializerSection.cs
- TileModeValidation.cs
- ProcessModelSection.cs
- TextInfo.cs
- NativeMethods.cs
- dataprotectionpermission.cs
- Config.cs
- WorkflowServiceHost.cs
- TabControlToolboxItem.cs
- EditingScopeUndoUnit.cs
- ComponentEditorForm.cs
- WindowProviderWrapper.cs
- BypassElement.cs
- TimeEnumHelper.cs
- DataServiceRequest.cs
- TraceLog.cs
- Trace.cs
- DisplayInformation.cs
- Graph.cs
- SQLBoolean.cs
- OleDbInfoMessageEvent.cs
- Missing.cs
- NullToBooleanConverter.cs
- sqlstateclientmanager.cs
- QilInvokeEarlyBound.cs
- TriggerCollection.cs
- EventProvider.cs
- DbConnectionHelper.cs
- OracleNumber.cs
- XmlIncludeAttribute.cs
- CollectionChangedEventManager.cs
- UInt16Converter.cs
- WorkflowExecutor.cs
- TextServicesPropertyRanges.cs
- HttpValueCollection.cs
- TypedLocationWrapper.cs
- SQLDecimal.cs
- SecurityResources.cs
- OleDbStruct.cs
- PipeException.cs
- OutputCacheSection.cs
- XmlSchemaSet.cs
- ImagingCache.cs
- HtmlImage.cs
- ProfileInfo.cs
- Recipient.cs
- SessionParameter.cs
- EntityObject.cs
- DeviceFilterEditorDialog.cs
- InputBuffer.cs
- DataContext.cs
- ServiceDefaults.cs
- HtmlControl.cs
- EmptyImpersonationContext.cs
- ServerValidateEventArgs.cs
- ParserStreamGeometryContext.cs
- VersionPair.cs