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
- ScrollChrome.cs
- ValidatedControlConverter.cs
- ToolTipAutomationPeer.cs
- SelectionPattern.cs
- SmtpDigestAuthenticationModule.cs
- DocumentGrid.cs
- ServiceObjectContainer.cs
- HashAlgorithm.cs
- NetworkStream.cs
- _HeaderInfo.cs
- XmlSchemaAppInfo.cs
- ProxyWebPartManagerDesigner.cs
- SiteMapNodeItemEventArgs.cs
- X509Certificate2.cs
- FontSource.cs
- PasswordTextNavigator.cs
- PolyQuadraticBezierSegment.cs
- WindowProviderWrapper.cs
- XmlBindingWorker.cs
- ResourcePermissionBase.cs
- SqlVersion.cs
- PenLineCapValidation.cs
- AdornedElementPlaceholder.cs
- ListViewItem.cs
- DataSourceSelectArguments.cs
- FileUtil.cs
- BamlVersionHeader.cs
- DetailsViewActionList.cs
- UmAlQuraCalendar.cs
- TcpTransportBindingElement.cs
- FlowNode.cs
- TextBox.cs
- QueryCursorEventArgs.cs
- XmlByteStreamReader.cs
- CreateSequence.cs
- GroupedContextMenuStrip.cs
- TableHeaderCell.cs
- ScriptingJsonSerializationSection.cs
- SizeAnimationClockResource.cs
- COM2Properties.cs
- CommonDialog.cs
- BaseInfoTable.cs
- FileDialog_Vista.cs
- User.cs
- ImmComposition.cs
- HttpCookiesSection.cs
- DATA_BLOB.cs
- IpcClientManager.cs
- SiteMapSection.cs
- AesCryptoServiceProvider.cs
- TraceSection.cs
- SQLUtility.cs
- GPPOINT.cs
- CodeNamespace.cs
- IndependentAnimationStorage.cs
- GridViewSelectEventArgs.cs
- TextShapeableCharacters.cs
- ApplicationServiceManager.cs
- ApplicationServiceHelper.cs
- WindowsGraphics.cs
- NativeMethods.cs
- WindowsGraphicsCacheManager.cs
- ScrollItemPatternIdentifiers.cs
- ProviderIncompatibleException.cs
- BindingBase.cs
- PathFigure.cs
- ContactManager.cs
- PixelFormat.cs
- DesignerAutoFormatStyle.cs
- WebPartsPersonalizationAuthorization.cs
- RegistrySecurity.cs
- VisualBasicSettingsHandler.cs
- TemplateParser.cs
- DataSvcMapFile.cs
- BindValidator.cs
- ParserContext.cs
- RouteParser.cs
- ProfileEventArgs.cs
- WeakRefEnumerator.cs
- NumericUpDown.cs
- SessionState.cs
- EventLogPermissionEntryCollection.cs
- HtmlTernaryTree.cs
- Timer.cs
- ServiceCredentialsSecurityTokenManager.cs
- DataMemberFieldEditor.cs
- ComponentResourceManager.cs
- DispatcherExceptionFilterEventArgs.cs
- ProtocolsSection.cs
- FusionWrap.cs
- HorizontalAlignConverter.cs
- CodeIdentifier.cs
- HtmlEncodedRawTextWriter.cs
- SqlProcedureAttribute.cs
- XmlMembersMapping.cs
- SaveFileDialog.cs
- EventHandlingScope.cs
- ResourceLoader.cs
- ToolStripSeparatorRenderEventArgs.cs
- _ScatterGatherBuffers.cs