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
- KeyValueConfigurationCollection.cs
- PropertyPushdownHelper.cs
- RecordConverter.cs
- TypedDataSourceCodeGenerator.cs
- TextParagraphView.cs
- SettingsAttributeDictionary.cs
- SystemUdpStatistics.cs
- SectionInput.cs
- BackgroundWorker.cs
- ComponentCollection.cs
- BoolExpression.cs
- AttributeTable.cs
- Util.cs
- DrawingContext.cs
- transactioncontext.cs
- DBSchemaRow.cs
- ManagementObjectSearcher.cs
- PostBackOptions.cs
- EntityParameter.cs
- COM2ColorConverter.cs
- PickDesigner.xaml.cs
- RootProfilePropertySettingsCollection.cs
- RightsManagementEncryptedStream.cs
- CodeAttributeDeclaration.cs
- DataRecordInternal.cs
- UrlMappingsModule.cs
- ResourceExpression.cs
- EasingKeyFrames.cs
- DaylightTime.cs
- RawTextInputReport.cs
- SqlBuilder.cs
- TextServicesProperty.cs
- LicenseManager.cs
- ContextMenuStrip.cs
- SystemWebExtensionsSectionGroup.cs
- PartitionerStatic.cs
- WebPartDisplayModeCollection.cs
- OrderPreservingMergeHelper.cs
- MobileCategoryAttribute.cs
- WindowsStatusBar.cs
- TypeGenericEnumerableViewSchema.cs
- DynamicResourceExtension.cs
- SEHException.cs
- Rotation3DAnimation.cs
- Light.cs
- HostedNamedPipeTransportManager.cs
- XmlSignificantWhitespace.cs
- ActivityStatusChangeEventArgs.cs
- FullTextState.cs
- DocComment.cs
- DrawingAttributeSerializer.cs
- NavigationProperty.cs
- BuilderPropertyEntry.cs
- SymbolMethod.cs
- UriTemplateCompoundPathSegment.cs
- ArrangedElement.cs
- DateTimeFormat.cs
- XmlSchemaComplexContentExtension.cs
- AssertSection.cs
- Rect3D.cs
- SchemaNames.cs
- ResourcePart.cs
- Int64Converter.cs
- WebServiceFaultDesigner.cs
- CharUnicodeInfo.cs
- SchemaTableColumn.cs
- HealthMonitoringSectionHelper.cs
- PathSegmentCollection.cs
- DiscreteKeyFrames.cs
- BitStack.cs
- ManagementObjectSearcher.cs
- WorkflowPageSetupDialog.cs
- Msec.cs
- RelationshipEndCollection.cs
- KeyFrames.cs
- DataGridViewSelectedRowCollection.cs
- SizeFConverter.cs
- AnonymousIdentificationModule.cs
- ScriptControlManager.cs
- AttachedAnnotationChangedEventArgs.cs
- EmptyReadOnlyDictionaryInternal.cs
- SuspendDesigner.cs
- ApplicationBuildProvider.cs
- SchemaNotation.cs
- MouseEvent.cs
- MsmqInputMessagePool.cs
- VectorCollection.cs
- DispatcherTimer.cs
- ReadOnlyNameValueCollection.cs
- ProcessRequestAsyncResult.cs
- WebPartDescriptionCollection.cs
- ChannelEndpointElementCollection.cs
- TabItemWrapperAutomationPeer.cs
- Encoder.cs
- ServiceEndpoint.cs
- TypeSystemHelpers.cs
- CheckedListBox.cs
- WeakHashtable.cs
- ObjRef.cs
- DoubleAnimationBase.cs