Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Shared / MS / Win32 / WinInet.cs / 2 / 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. 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
- TextRange.cs
- InternalConfigRoot.cs
- SiteOfOriginContainer.cs
- ScrollPattern.cs
- ObjectDataSourceSelectingEventArgs.cs
- ServicesUtilities.cs
- DesignerPainter.cs
- RequestCache.cs
- DbDeleteCommandTree.cs
- SymDocumentType.cs
- HtmlHead.cs
- DifferencingCollection.cs
- CompleteWizardStep.cs
- KeyboardEventArgs.cs
- ActivityExecutionFilter.cs
- HandlerFactoryCache.cs
- FormViewPageEventArgs.cs
- QilTargetType.cs
- CodeIndexerExpression.cs
- SQLCharsStorage.cs
- CodePropertyReferenceExpression.cs
- GenericTypeParameterConverter.cs
- DecimalAnimationBase.cs
- XmlLanguage.cs
- DataBindingCollection.cs
- UserValidatedEventArgs.cs
- ResourceIDHelper.cs
- RoutedPropertyChangedEventArgs.cs
- ClipboardProcessor.cs
- SchemaCollectionCompiler.cs
- SchemaExporter.cs
- HttpApplicationFactory.cs
- BaseTypeViewSchema.cs
- XsdValidatingReader.cs
- Deflater.cs
- RotateTransform.cs
- securitymgrsite.cs
- SqlCommand.cs
- XmlAttributeCollection.cs
- UnsafeNativeMethodsCLR.cs
- PasswordRecoveryAutoFormat.cs
- PackagingUtilities.cs
- CounterCreationDataCollection.cs
- AttributeSetAction.cs
- DBPropSet.cs
- TimeIntervalCollection.cs
- DatePickerTextBox.cs
- FilterQueryOptionExpression.cs
- DocumentGridPage.cs
- EnlistmentTraceIdentifier.cs
- CollectionView.cs
- WorkflowPageSetupDialog.cs
- XmlNotation.cs
- ConnectionInterfaceCollection.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- TextAction.cs
- ListControlStringCollectionEditor.cs
- ADMembershipProvider.cs
- FusionWrap.cs
- DataServiceHost.cs
- TypeLibConverter.cs
- BuildResultCache.cs
- ColorAnimationUsingKeyFrames.cs
- AnimatedTypeHelpers.cs
- IHttpResponseInternal.cs
- PropertyInformationCollection.cs
- SQLConvert.cs
- TextViewSelectionProcessor.cs
- IdentifierService.cs
- ConcurrentQueue.cs
- RotateTransform3D.cs
- ToolBarButtonClickEvent.cs
- GeometryHitTestParameters.cs
- DateTimeFormat.cs
- StylusTouchDevice.cs
- TypeSystemProvider.cs
- SizeConverter.cs
- MultiSelector.cs
- HandlerWithFactory.cs
- NullableIntAverageAggregationOperator.cs
- ImageMap.cs
- ScrollBarAutomationPeer.cs
- SqlUserDefinedTypeAttribute.cs
- WindowsGraphicsCacheManager.cs
- SEHException.cs
- FormsAuthenticationConfiguration.cs
- EntityDataSourceContextCreatingEventArgs.cs
- Encoder.cs
- ComplexBindingPropertiesAttribute.cs
- InputScope.cs
- UnmanagedMemoryStream.cs
- SaveFileDialog.cs
- StringDictionaryEditor.cs
- BufferBuilder.cs
- DataSourceControlBuilder.cs
- SqlClientWrapperSmiStreamChars.cs
- ScriptingProfileServiceSection.cs
- _TimerThread.cs
- FontDifferentiator.cs
- HybridObjectCache.cs