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
- TraceSection.cs
- ServicePointManagerElement.cs
- TextRangeEdit.cs
- ThumbButtonInfo.cs
- NullableDecimalAverageAggregationOperator.cs
- MetadataFile.cs
- HtmlTableRowCollection.cs
- UnsafeNativeMethods.cs
- FieldAccessException.cs
- HandlerWithFactory.cs
- FormsAuthenticationCredentials.cs
- CharUnicodeInfo.cs
- XmlJsonReader.cs
- Label.cs
- SqlGenericUtil.cs
- FormsAuthentication.cs
- PackageRelationshipSelector.cs
- Duration.cs
- Lasso.cs
- RectConverter.cs
- CompensationExtension.cs
- WebPartConnectionsDisconnectVerb.cs
- SmiRequestExecutor.cs
- KeyValuePair.cs
- CellLabel.cs
- DataPointer.cs
- PropertyChangedEventManager.cs
- ConversionValidationRule.cs
- ListBindableAttribute.cs
- StringCollectionEditor.cs
- TextReader.cs
- HtmlPageAdapter.cs
- MessageCredentialType.cs
- BufferedResponseStream.cs
- BindingEntityInfo.cs
- FlowDocumentPage.cs
- MessagePropertyAttribute.cs
- SizeAnimation.cs
- IndicFontClient.cs
- BridgeDataReader.cs
- DecimalFormatter.cs
- AssemblyAttributesGoHere.cs
- Color.cs
- MemberPath.cs
- DebugViewWriter.cs
- Exceptions.cs
- PointLightBase.cs
- CapabilitiesUse.cs
- ProbeMatches11.cs
- FormsAuthenticationModule.cs
- XPathExpr.cs
- Parameter.cs
- StrokeRenderer.cs
- DesignerCatalogPartChrome.cs
- ContentType.cs
- UnknownWrapper.cs
- RadioButtonList.cs
- FileChangeNotifier.cs
- ProviderConnectionPoint.cs
- KeyFrames.cs
- Quaternion.cs
- BamlRecords.cs
- CacheRequest.cs
- HttpContextServiceHost.cs
- SerializationUtilities.cs
- SiteMapHierarchicalDataSourceView.cs
- StickyNoteAnnotations.cs
- WmlValidatorAdapter.cs
- DateTimeParse.cs
- WebPartZoneBaseDesigner.cs
- ConnectionInterfaceCollection.cs
- FunctionMappingTranslator.cs
- CategoryGridEntry.cs
- ArithmeticException.cs
- ImageCollectionEditor.cs
- RouteParser.cs
- mda.cs
- NativeMethods.cs
- SecureStringHasher.cs
- ExpressionConverter.cs
- PropertyGroupDescription.cs
- XPathExpr.cs
- SplitterPanel.cs
- SqlUnionizer.cs
- UIHelper.cs
- DesignerActionPanel.cs
- unitconverter.cs
- ModuleBuilder.cs
- AuthorizationSection.cs
- WrappedIUnknown.cs
- EDesignUtil.cs
- TypeGeneratedEventArgs.cs
- ParameterCollectionEditorForm.cs
- OptionUsage.cs
- WebEventTraceProvider.cs
- EndOfStreamException.cs
- TabControl.cs
- ListItemParagraph.cs
- X509ChainElement.cs
- StdValidatorsAndConverters.cs