Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Shared / MS / Win32 / WinInet.cs / 1305600 / 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); icci.dwStructSize = size; 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
- FileDialogCustomPlace.cs
- BaseValidator.cs
- ViewStateException.cs
- Application.cs
- InstanceKeyView.cs
- TextWriterTraceListener.cs
- WindowsPrincipal.cs
- WebPartConnectionsCancelVerb.cs
- GlyphCache.cs
- MappingSource.cs
- Publisher.cs
- ToolStripControlHost.cs
- SHA1Managed.cs
- GeneralTransform3D.cs
- ImageAttributes.cs
- ScrollChangedEventArgs.cs
- Parameter.cs
- KoreanCalendar.cs
- DecoderFallbackWithFailureFlag.cs
- TypeConverterHelper.cs
- AsymmetricSignatureDeformatter.cs
- IPEndPointCollection.cs
- WindowsComboBox.cs
- AccessText.cs
- ReadOnlyCollection.cs
- AudioSignalProblemOccurredEventArgs.cs
- Rss20FeedFormatter.cs
- DynamicValueConverter.cs
- SchemaNamespaceManager.cs
- XpsDigitalSignature.cs
- SqlHelper.cs
- SolidBrush.cs
- SchemaTableOptionalColumn.cs
- Tuple.cs
- ActivityFunc.cs
- RadioButtonBaseAdapter.cs
- CodeSubDirectory.cs
- PkcsUtils.cs
- Context.cs
- SchemaNotation.cs
- IriParsingElement.cs
- SocketInformation.cs
- PolyQuadraticBezierSegment.cs
- DataGridViewRowConverter.cs
- NetTcpBinding.cs
- HttpContextWrapper.cs
- StoreItemCollection.Loader.cs
- QueryableDataSourceHelper.cs
- TraceSwitch.cs
- EncoderNLS.cs
- ActivityInterfaces.cs
- OrderPreservingSpoolingTask.cs
- ellipse.cs
- Scanner.cs
- XmlCollation.cs
- SymbolResolver.cs
- BitmapEffectInput.cs
- AttachedPropertyBrowsableAttribute.cs
- AuthorizationRule.cs
- Bezier.cs
- ExtendedPropertyDescriptor.cs
- XpsFilter.cs
- XmlCharCheckingReader.cs
- FatalException.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TextDocumentView.cs
- IsolationInterop.cs
- DataIdProcessor.cs
- FormView.cs
- ListViewDeleteEventArgs.cs
- XslAst.cs
- BCLDebug.cs
- XmlAggregates.cs
- SocketStream.cs
- BitmapVisualManager.cs
- ToolStripPanelRow.cs
- WebPartUserCapability.cs
- SchemaImporter.cs
- PieceDirectory.cs
- DataGridViewRowConverter.cs
- ConfigXmlText.cs
- TextPointerBase.cs
- Transform.cs
- XmlStringTable.cs
- SQLMembershipProvider.cs
- SatelliteContractVersionAttribute.cs
- FaultDescription.cs
- RootBrowserWindowAutomationPeer.cs
- GPPOINT.cs
- WebPartCloseVerb.cs
- MatrixConverter.cs
- XmlWrappingReader.cs
- EditorPart.cs
- RemotingServices.cs
- SweepDirectionValidation.cs
- TextBox.cs
- ShaderEffect.cs
- XmlSortKeyAccumulator.cs
- WithStatement.cs
- InkCanvasSelection.cs