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
- QuaternionAnimation.cs
- RepeatBehaviorConverter.cs
- ReadOnlyMetadataCollection.cs
- ColorBlend.cs
- GridErrorDlg.cs
- ProfileSection.cs
- SimpleFileLog.cs
- XmlSchemaObjectTable.cs
- DataSourceCache.cs
- DatagridviewDisplayedBandsData.cs
- ValueUtilsSmi.cs
- RegularExpressionValidator.cs
- AppearanceEditorPart.cs
- EmptyEnumerable.cs
- StorageInfo.cs
- ProbeMatchesApril2005.cs
- Point3DConverter.cs
- PackageRelationship.cs
- EncryptedKey.cs
- WorkflowServiceHostFactory.cs
- ArgumentOutOfRangeException.cs
- ImagingCache.cs
- KeyValuePairs.cs
- XmlMtomReader.cs
- DynamicQueryableWrapper.cs
- BindingOperations.cs
- DesignerDeviceConfig.cs
- DataList.cs
- OpenTypeCommon.cs
- SessionEndingEventArgs.cs
- ReferentialConstraint.cs
- XmlLangPropertyAttribute.cs
- VectorValueSerializer.cs
- EventDescriptor.cs
- IDReferencePropertyAttribute.cs
- MembershipValidatePasswordEventArgs.cs
- Typography.cs
- _NegoStream.cs
- BitmapEffectDrawingContent.cs
- Utils.cs
- GenericTypeParameterBuilder.cs
- SubtreeProcessor.cs
- QilReference.cs
- DeclarativeCatalogPart.cs
- HandleCollector.cs
- WorkflowDebuggerSteppingAttribute.cs
- FileClassifier.cs
- InOutArgumentConverter.cs
- AuthorizationRuleCollection.cs
- EFColumnProvider.cs
- FontDialog.cs
- PropertyChangeTracker.cs
- SecurityHelper.cs
- FileDialogCustomPlacesCollection.cs
- FormattedText.cs
- Encoder.cs
- ColorConvertedBitmapExtension.cs
- ping.cs
- CaretElement.cs
- SharedConnectionWorkflowTransactionService.cs
- InstanceKeyView.cs
- ConnectionManagementElement.cs
- LongValidatorAttribute.cs
- ObjectManager.cs
- TrailingSpaceComparer.cs
- BaseDataBoundControl.cs
- OptimizedTemplateContent.cs
- EnlistmentState.cs
- TypeTypeConverter.cs
- LinkConverter.cs
- RenderContext.cs
- TextTreeTextNode.cs
- PagerSettings.cs
- Point3DAnimation.cs
- WbmpConverter.cs
- DispatchWrapper.cs
- WebPartDisplayModeEventArgs.cs
- ActivityBindForm.Designer.cs
- InvalidProgramException.cs
- TypefaceMap.cs
- DateTimeParse.cs
- CounterSetInstanceCounterDataSet.cs
- MetadataCache.cs
- ConsoleTraceListener.cs
- PriorityItem.cs
- FileChangesMonitor.cs
- RegexCaptureCollection.cs
- TextDecorations.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- SrgsGrammar.cs
- XamlReaderConstants.cs
- WebRequestModuleElementCollection.cs
- SignatureHelper.cs
- ImageListUtils.cs
- SByte.cs
- SyndicationDeserializer.cs
- Point3DAnimationBase.cs
- WmlImageAdapter.cs
- StringConverter.cs
- FixedDocumentSequencePaginator.cs