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
- ScriptModule.cs
- BooleanFunctions.cs
- SpellerError.cs
- QilLoop.cs
- ResourceReferenceExpressionConverter.cs
- ScriptRef.cs
- ApplicationSecurityInfo.cs
- TableProvider.cs
- DataGridViewColumnHeaderCell.cs
- RoleManagerSection.cs
- SizeChangedEventArgs.cs
- ErrorHandler.cs
- SelectionPattern.cs
- EnumBuilder.cs
- EventMap.cs
- GridViewHeaderRowPresenter.cs
- GenericTypeParameterConverter.cs
- ParsedAttributeCollection.cs
- RepeaterItemCollection.cs
- PtsCache.cs
- WsatTransactionHeader.cs
- TargetFrameworkUtil.cs
- UnsafeNativeMethodsMilCoreApi.cs
- EventProviderTraceListener.cs
- RelationshipEnd.cs
- AdobeCFFWrapper.cs
- Tile.cs
- NamedPermissionSet.cs
- PersonalizationState.cs
- DataGridViewAdvancedBorderStyle.cs
- XmlSchemaSubstitutionGroup.cs
- COM2AboutBoxPropertyDescriptor.cs
- ListViewTableRow.cs
- GeneralTransform3DTo2DTo3D.cs
- UnicodeEncoding.cs
- CodeCastExpression.cs
- XpsS0ValidatingLoader.cs
- SqlTriggerAttribute.cs
- StoreContentChangedEventArgs.cs
- CustomLineCap.cs
- SystemColors.cs
- Matrix.cs
- SspiSafeHandles.cs
- DoubleAnimationUsingKeyFrames.cs
- ObjectDataSourceEventArgs.cs
- HtmlControlDesigner.cs
- XXXOnTypeBuilderInstantiation.cs
- ColorContextHelper.cs
- DiagnosticsConfiguration.cs
- SqlDataReaderSmi.cs
- ExtensionMethods.cs
- DaylightTime.cs
- DataGridViewRowCancelEventArgs.cs
- ObjectStateManagerMetadata.cs
- ToolStripContainerActionList.cs
- TextViewBase.cs
- TheQuery.cs
- _PooledStream.cs
- RequestDescription.cs
- WrappedDispatcherException.cs
- SendMailErrorEventArgs.cs
- InkPresenterAutomationPeer.cs
- SqlMethodCallConverter.cs
- HttpStreamXmlDictionaryReader.cs
- ArraySortHelper.cs
- Statements.cs
- PointLightBase.cs
- OpCopier.cs
- QuaternionRotation3D.cs
- CollectionType.cs
- AsyncStreamReader.cs
- TypeUtil.cs
- ServerIdentity.cs
- ReferencedType.cs
- WebServiceResponse.cs
- HtmlTextArea.cs
- RequestContext.cs
- LineBreakRecord.cs
- WebCategoryAttribute.cs
- DatagridviewDisplayedBandsData.cs
- MergablePropertyAttribute.cs
- ConfigurationConverterBase.cs
- EntityParameterCollection.cs
- Scene3D.cs
- CryptoHelper.cs
- PeerCollaborationPermission.cs
- WebPartAddingEventArgs.cs
- NetSectionGroup.cs
- VirtualDirectoryMapping.cs
- WasHttpHandlersInstallComponent.cs
- WindowsNonControl.cs
- Shape.cs
- XmlSchemaException.cs
- ConnectionInterfaceCollection.cs
- Container.cs
- MaskedTextProvider.cs
- EntryIndex.cs
- PreDigestedSignedInfo.cs
- DiscoveryDocumentReference.cs
- JsonCollectionDataContract.cs