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
- TagPrefixInfo.cs
- FontSource.cs
- DisplayInformation.cs
- WindowsListViewScroll.cs
- SqlDataRecord.cs
- DeploymentSection.cs
- HijriCalendar.cs
- RelatedImageListAttribute.cs
- HelpInfo.cs
- DoubleConverter.cs
- OpenTypeLayout.cs
- FileUpload.cs
- SharedUtils.cs
- GPRECT.cs
- SmiSettersStream.cs
- ZipIOFileItemStream.cs
- DiagnosticTraceSource.cs
- ComponentChangingEvent.cs
- MessageDirection.cs
- ApplicationInterop.cs
- XamlStream.cs
- SoapAttributeOverrides.cs
- FakeModelPropertyImpl.cs
- SizeChangedInfo.cs
- Stylesheet.cs
- TypeLibConverter.cs
- WmlValidatorAdapter.cs
- DesignTimeDataBinding.cs
- ClientFormsIdentity.cs
- MatrixAnimationUsingPath.cs
- AtomServiceDocumentSerializer.cs
- RenderTargetBitmap.cs
- Subset.cs
- CacheMemory.cs
- StringResourceManager.cs
- ObjectAnimationBase.cs
- DataContractSerializerOperationGenerator.cs
- ReflectionServiceProvider.cs
- xmlformatgeneratorstatics.cs
- UnsafeNativeMethods.cs
- WindowsGraphicsWrapper.cs
- SizeAnimationClockResource.cs
- SqlUtils.cs
- FileVersionInfo.cs
- BuildProviderCollection.cs
- DomainLiteralReader.cs
- SR.cs
- PointAnimation.cs
- CroppedBitmap.cs
- TrustLevelCollection.cs
- SafeSystemMetrics.cs
- TextComposition.cs
- AnnotationHighlightLayer.cs
- XsltInput.cs
- LogExtentCollection.cs
- SoundPlayerAction.cs
- ProtocolsConfigurationEntry.cs
- UInt16Converter.cs
- NamespaceMapping.cs
- DateTimeSerializationSection.cs
- WriteFileContext.cs
- DESCryptoServiceProvider.cs
- GridViewSortEventArgs.cs
- DispatcherHookEventArgs.cs
- ConfigXmlSignificantWhitespace.cs
- SessionStateContainer.cs
- AddInIpcChannel.cs
- ObjectItemAttributeAssemblyLoader.cs
- BitmapEffectInput.cs
- EmptyReadOnlyDictionaryInternal.cs
- ScriptResourceHandler.cs
- WebPartChrome.cs
- SynchronizedDispatch.cs
- XmlILTrace.cs
- FontCacheLogic.cs
- QueryTreeBuilder.cs
- SspiWrapper.cs
- CapabilitiesSection.cs
- DataBoundControlHelper.cs
- QilExpression.cs
- Exceptions.cs
- NameValueCache.cs
- UrlPath.cs
- EventSinkHelperWriter.cs
- FullTextBreakpoint.cs
- Margins.cs
- AssertFilter.cs
- basenumberconverter.cs
- HotCommands.cs
- GenerateHelper.cs
- XsltOutput.cs
- SafeLocalMemHandle.cs
- Pointer.cs
- IRCollection.cs
- SchemaTableColumn.cs
- StreamGeometryContext.cs
- DataListItem.cs
- RequestStatusBarUpdateEventArgs.cs
- View.cs
- FormViewPageEventArgs.cs