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
- DetailsViewPageEventArgs.cs
- RTLAwareMessageBox.cs
- EditorPartChrome.cs
- TreeNodeStyle.cs
- NumberAction.cs
- DesignTimeTemplateParser.cs
- EntitySet.cs
- IndentTextWriter.cs
- ImageFormat.cs
- TypeConverter.cs
- TableColumn.cs
- StrongTypingException.cs
- OracleInternalConnection.cs
- UnknownBitmapDecoder.cs
- NativeMethods.cs
- TemplateControlParser.cs
- StringSorter.cs
- SoapTypeAttribute.cs
- CopyOnWriteList.cs
- XmlSchemaSimpleTypeUnion.cs
- IsolatedStorageException.cs
- StringComparer.cs
- CodeGen.cs
- ElementHost.cs
- ReadingWritingEntityEventArgs.cs
- CultureData.cs
- BindingNavigator.cs
- BrowserCapabilitiesFactoryBase.cs
- SchemaEntity.cs
- NativeWindow.cs
- FileDialog.cs
- OdbcCommandBuilder.cs
- ClientType.cs
- DocumentSchemaValidator.cs
- BulletDecorator.cs
- PermissionRequestEvidence.cs
- SQLRoleProvider.cs
- InplaceBitmapMetadataWriter.cs
- DBSqlParserColumn.cs
- Compiler.cs
- OperationResponse.cs
- FieldToken.cs
- Rights.cs
- regiisutil.cs
- TreeNodeCollectionEditor.cs
- UdpDiscoveryEndpoint.cs
- Translator.cs
- NetSectionGroup.cs
- DataGridViewCellStyleChangedEventArgs.cs
- PolyBezierSegment.cs
- SQLString.cs
- smtppermission.cs
- RefreshPropertiesAttribute.cs
- NotifyParentPropertyAttribute.cs
- UnmanagedBitmapWrapper.cs
- DiscoveryDocumentReference.cs
- AbstractExpressions.cs
- SQLUtility.cs
- TypefaceMap.cs
- SynchronizingStream.cs
- LocalizabilityAttribute.cs
- AsyncOperationManager.cs
- FastEncoderWindow.cs
- WeakEventManager.cs
- ZipIOLocalFileBlock.cs
- Semaphore.cs
- MessageBox.cs
- RectangleGeometry.cs
- ExtendedProtectionPolicy.cs
- ToolStripButton.cs
- ToolStripSplitStackLayout.cs
- CompositeScriptReferenceEventArgs.cs
- ToolStripSeparatorRenderEventArgs.cs
- DesignerOptionService.cs
- AssemblyCache.cs
- ToolStripDropDownClosingEventArgs.cs
- CharAnimationUsingKeyFrames.cs
- BackgroundWorker.cs
- TimeSpanMinutesConverter.cs
- GraphicsState.cs
- SqlClientFactory.cs
- BasicHttpMessageCredentialType.cs
- httpapplicationstate.cs
- CommandConverter.cs
- CompModSwitches.cs
- Pens.cs
- FacetDescription.cs
- ExternalCalls.cs
- UniqueConstraint.cs
- Pkcs9Attribute.cs
- ContentValidator.cs
- Int64AnimationUsingKeyFrames.cs
- ValidationHelper.cs
- EmbeddedMailObjectCollectionEditor.cs
- ControlValuePropertyAttribute.cs
- Utils.cs
- PersistenceMetadataNamespace.cs
- ListViewSelectEventArgs.cs
- assertwrapper.cs
- ReadOnlyDataSource.cs