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
- Empty.cs
- _UncName.cs
- PersonalizationStateQuery.cs
- CodeExpressionCollection.cs
- PaintValueEventArgs.cs
- WebPartVerbCollection.cs
- CLSCompliantAttribute.cs
- DynamicMethod.cs
- ToolStripDropDown.cs
- HtmlInputRadioButton.cs
- FeatureManager.cs
- WindowsStartMenu.cs
- FontUnitConverter.cs
- QilXmlWriter.cs
- TextFindEngine.cs
- ReadOnlyTernaryTree.cs
- QueueProcessor.cs
- ColumnCollection.cs
- TreeNodeClickEventArgs.cs
- ProviderConnectionPoint.cs
- SelectorAutomationPeer.cs
- WebUtil.cs
- LoginUtil.cs
- IdentityReference.cs
- AsymmetricSignatureDeformatter.cs
- BindableTemplateBuilder.cs
- DataErrorValidationRule.cs
- XhtmlBasicObjectListAdapter.cs
- XmlDataLoader.cs
- IIS7WorkerRequest.cs
- SelectionItemPattern.cs
- AssemblyBuilder.cs
- AuthorizationSection.cs
- DecoderFallbackWithFailureFlag.cs
- FontSourceCollection.cs
- SmtpMail.cs
- Attachment.cs
- StorageSetMapping.cs
- MediaElement.cs
- IconEditor.cs
- XmlDeclaration.cs
- SoapFormatterSinks.cs
- RuleSettingsCollection.cs
- DataFormat.cs
- Type.cs
- HiddenFieldPageStatePersister.cs
- ProtectedConfigurationSection.cs
- PropertyGridCommands.cs
- EntityDataSourceContextCreatedEventArgs.cs
- NotSupportedException.cs
- DataColumnMappingCollection.cs
- MinMaxParagraphWidth.cs
- LinqDataSourceContextEventArgs.cs
- HashSetDebugView.cs
- FrameworkContextData.cs
- XmlSerializerSection.cs
- ImageDrawing.cs
- DATA_BLOB.cs
- ReadContentAsBinaryHelper.cs
- Oid.cs
- ProvidersHelper.cs
- CodeComment.cs
- RectIndependentAnimationStorage.cs
- SafeBitVector32.cs
- ActivationWorker.cs
- LinqDataSourceUpdateEventArgs.cs
- XmlLangPropertyAttribute.cs
- ThreadPool.cs
- SqlGenericUtil.cs
- CircleHotSpot.cs
- MarginCollapsingState.cs
- ControlsConfig.cs
- ResourceDescriptionAttribute.cs
- CodeSnippetCompileUnit.cs
- TaskHelper.cs
- SmtpAuthenticationManager.cs
- SQLByteStorage.cs
- HelpProvider.cs
- DataChangedEventManager.cs
- XhtmlBasicPageAdapter.cs
- PassportAuthentication.cs
- IPAddressCollection.cs
- PtsHelper.cs
- RawStylusActions.cs
- glyphs.cs
- DataContractSerializerFaultFormatter.cs
- CategoryGridEntry.cs
- BitmapEffectDrawing.cs
- AxisAngleRotation3D.cs
- CodeGroup.cs
- Size3D.cs
- ByteStreamMessageEncoderFactory.cs
- ResourceProviderFactory.cs
- WorkItem.cs
- LineServices.cs
- BuildProvider.cs
- ConfigurationCollectionAttribute.cs
- CommandBinding.cs
- CorrelationManager.cs
- TypeExtensionConverter.cs