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
- UIntPtr.cs
- ManagementQuery.cs
- ExtractedStateEntry.cs
- FtpRequestCacheValidator.cs
- AtlasWeb.Designer.cs
- ResourcePool.cs
- MetaModel.cs
- CompoundFileIOPermission.cs
- UserPersonalizationStateInfo.cs
- GeometryDrawing.cs
- FileLevelControlBuilderAttribute.cs
- TableStyle.cs
- RegistrationServices.cs
- SerialReceived.cs
- CodeVariableReferenceExpression.cs
- ColorBlend.cs
- DocumentationServerProtocol.cs
- OrderByBuilder.cs
- Section.cs
- TemplateXamlParser.cs
- TextDpi.cs
- WsatConfiguration.cs
- SpeechRecognizer.cs
- XmlDataSourceView.cs
- GlyphRunDrawing.cs
- validationstate.cs
- StrongName.cs
- TextOutput.cs
- SystemException.cs
- ResourceBinder.cs
- Menu.cs
- HttpCachePolicyElement.cs
- PartitionedStream.cs
- SQLBinary.cs
- WebHttpBindingElement.cs
- CodeIdentifiers.cs
- EventLogTraceListener.cs
- GridItem.cs
- CompressEmulationStream.cs
- Wildcard.cs
- XmlSchemaCompilationSettings.cs
- PersonalizationStateInfo.cs
- TableCellsCollectionEditor.cs
- HttpInputStream.cs
- EventEntry.cs
- XmlSchemaValidator.cs
- LambdaCompiler.Statements.cs
- DependentTransaction.cs
- UdpSocket.cs
- OrderByBuilder.cs
- SoapDocumentMethodAttribute.cs
- ValueTable.cs
- DynamicMethod.cs
- DesignerTransactionCloseEvent.cs
- MemberJoinTreeNode.cs
- GeometryModel3D.cs
- DotExpr.cs
- StatusBarPanelClickEvent.cs
- UnmanagedMemoryStream.cs
- DocumentEventArgs.cs
- DataGridViewElement.cs
- AdornerDecorator.cs
- CaseInsensitiveOrdinalStringComparer.cs
- TrackingMemoryStream.cs
- ConfigPathUtility.cs
- BlobPersonalizationState.cs
- Double.cs
- FilterElement.cs
- EntityDesignerUtils.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- BezierSegment.cs
- QilScopedVisitor.cs
- ProcessThreadCollection.cs
- Table.cs
- ListDictionary.cs
- CompilationSection.cs
- Thread.cs
- EntityDataSourceColumn.cs
- IgnoreSectionHandler.cs
- DataControlPagerLinkButton.cs
- BadImageFormatException.cs
- OdbcEnvironment.cs
- TaskHelper.cs
- ProgressBarHighlightConverter.cs
- StyleCollection.cs
- ViewKeyConstraint.cs
- Rotation3DAnimationBase.cs
- ListItemCollection.cs
- FunctionDetailsReader.cs
- TextViewElement.cs
- WebBrowserHelper.cs
- AutomationPropertyInfo.cs
- FileInfo.cs
- BitmapData.cs
- NTAccount.cs
- ApplicationProxyInternal.cs
- UInt32Storage.cs
- DbConnectionOptions.cs
- ProfileSettingsCollection.cs
- ProgressChangedEventArgs.cs