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
- DataSourceHelper.cs
- MetadataArtifactLoaderFile.cs
- ReadOnlyDataSource.cs
- QEncodedStream.cs
- RepeatBehavior.cs
- ProfileSettingsCollection.cs
- ZipIOBlockManager.cs
- ForwardPositionQuery.cs
- ClickablePoint.cs
- ColumnResult.cs
- PolicyImporterElementCollection.cs
- StructureChangedEventArgs.cs
- ArraySubsetEnumerator.cs
- ScriptComponentDescriptor.cs
- SizeKeyFrameCollection.cs
- X509Utils.cs
- DockProviderWrapper.cs
- VectorKeyFrameCollection.cs
- Table.cs
- FileDataSourceCache.cs
- _DigestClient.cs
- TreeViewImageIndexConverter.cs
- RichTextBox.cs
- CodeTypeConstructor.cs
- TextReader.cs
- DataGridState.cs
- TimeSpanStorage.cs
- AutomationPropertyInfo.cs
- InputScopeManager.cs
- SystemThemeKey.cs
- GridViewSelectEventArgs.cs
- Configuration.cs
- SymLanguageVendor.cs
- SignatureToken.cs
- SelectionRangeConverter.cs
- Table.cs
- AppDomain.cs
- XdrBuilder.cs
- TPLETWProvider.cs
- ProbeMatchesApril2005.cs
- XNodeValidator.cs
- DictionarySectionHandler.cs
- LightweightEntityWrapper.cs
- PeerCollaboration.cs
- InternalMappingException.cs
- Padding.cs
- DataGridViewCellConverter.cs
- KeyTimeConverter.cs
- WindowsFormsHelpers.cs
- RotateTransform3D.cs
- SizeAnimationUsingKeyFrames.cs
- CodeCatchClause.cs
- XsltSettings.cs
- GB18030Encoding.cs
- FixedTextView.cs
- SafeEventLogReadHandle.cs
- GuidelineCollection.cs
- Int32CollectionValueSerializer.cs
- MergeFailedEvent.cs
- ReflectPropertyDescriptor.cs
- EmissiveMaterial.cs
- SaveWorkflowAsyncResult.cs
- SystemInfo.cs
- UnionExpr.cs
- TextShapeableCharacters.cs
- StringValidator.cs
- TreeNodeCollection.cs
- VersionPair.cs
- TaskHelper.cs
- TableColumn.cs
- ValidationRuleCollection.cs
- WhitespaceRuleLookup.cs
- ChoiceConverter.cs
- OLEDB_Enum.cs
- EmptyEnumerator.cs
- ProcessHostServerConfig.cs
- OneOfTypeConst.cs
- DefinitionBase.cs
- KnownColorTable.cs
- TextEffect.cs
- FtpRequestCacheValidator.cs
- StringDictionaryCodeDomSerializer.cs
- StsCommunicationException.cs
- TableSectionStyle.cs
- PrintControllerWithStatusDialog.cs
- CacheMode.cs
- ListChangedEventArgs.cs
- Filter.cs
- TogglePattern.cs
- SqlBulkCopy.cs
- WindowsFormsHostPropertyMap.cs
- ParameterToken.cs
- ComponentDispatcher.cs
- MediaElement.cs
- IncrementalReadDecoders.cs
- BamlLocalizableResource.cs
- ScriptModule.cs
- EnumUnknown.cs
- XmlTypeMapping.cs
- UnitySerializationHolder.cs