Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / MS / Internal / AppModel / ProgressPage.cs / 1 / ProgressPage.cs
//+------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: // Deployment progress page. This is primarily a proxy to the native progress page, which supersedes // the managed one from up to v3.5. See Host\DLL\ProgressPage.hxx for details. // // History: // 2007/12/xx ChangoV Created // //----------------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Windows.Interop; using System.Windows.Threading; using System.Security; namespace MS.Internal.AppModel { ////// Critical due to SUC. /// Even if a partilar method is considered safe, applying [SecurityTreatAsSafe] to it here won't help /// much, because the transparency model still requires SUC-d methods to be called only from /// SecurityCritical ones. /// [ComImport, Guid("1f681651-1024-4798-af36-119bbe5e5665")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [SecurityCritical, SuppressUnmanagedCodeSecurity] interface INativeProgressPage { void Show(); void Hide(); void ShowProgressMessage(string message); void SetApplicationName(string appName); void SetPublisherName(string publisherName); void OnDownloadProgress(ulong bytesDownloaded, ulong bytesTotal); }; ////// IProgressPage is public. It was introduced for the Media Center integration, which is now considered /// deprecated, but we have to support it at least for as long as we keep doing in-place upgrades. /// interface IProgressPage2 : IProgressPage { void ShowProgressMessage(string message); }; class NativeProgressPageProxy : IProgressPage2 { internal NativeProgressPageProxy(INativeProgressPage npp) { _npp = npp; } ////// Critical: Calls a SUC'd COM interface method. /// TreatAsSafe: No concern about "spoofing" progress messages. A web site could just render an HTML /// page that looks like our progress page. /// [SecurityCritical, SecurityTreatAsSafe] public void ShowProgressMessage(string message) { _npp.ShowProgressMessage(message); } public Uri DeploymentPath { set { } get { throw new System.NotImplementedException(); } } /// /// The native progress page sends a stop/cancel request to its host object, which then calls /// IBrowserHostServices.ExecCommand(OLECMDID_STOP). /// public DispatcherOperationCallback StopCallback { set { } get { throw new System.NotImplementedException(); } } ////// The native progress page sends a Refresh request to its host object, which then calls /// IBrowserHostServices.ExecCommand(OLECMDID_REFRESH). /// public System.Windows.Threading.DispatcherOperationCallback RefreshCallback { set { } get { return null; } } ////// Critical: Calls a SUC'd COM interface method. /// TreatAsSafe: 1) The application name is coming from the manifest, so it could be anything. /// This means the input doesn't need to be trusted. /// 2) Setting arbitrary application/publisher can be considered spoofing, but a malicious website /// could fake the whole progress page and still achieve the same. /// public string ApplicationName { [SecurityCritical, SecurityTreatAsSafe] set { _npp.SetApplicationName(value); } get { throw new System.NotImplementedException(); } } ////// Critical: Calls a SUC'd COM interface method. /// TreatAsSafe: 1) The publisher name is coming from the manifest, so it could be anything. /// This means the input doesn't need to be trusted. /// 2) Setting arbitrary application/publisher can be considered spoofing, but a malicious website /// could fake the whole progress page and still achieve the same. /// public string PublisherName { [SecurityCritical, SecurityTreatAsSafe] set { _npp.SetPublisherName(value); } get { throw new System.NotImplementedException(); } } /// /// Critical: Calls a SUC'd COM interface method. /// TreatAsSafe: Sending even arbitrary progress updates not considered harmful. /// [SecurityCritical, SecurityTreatAsSafe] public void UpdateProgress(long bytesDownloaded, long bytesTotal) { _npp.OnDownloadProgress((ulong)bytesDownloaded, (ulong)bytesTotal); } INativeProgressPage _npp; }; } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //+------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: // Deployment progress page. This is primarily a proxy to the native progress page, which supersedes // the managed one from up to v3.5. See Host\DLL\ProgressPage.hxx for details. // // History: // 2007/12/xx ChangoV Created // //----------------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Windows.Interop; using System.Windows.Threading; using System.Security; namespace MS.Internal.AppModel { /// /// Critical due to SUC. /// Even if a partilar method is considered safe, applying [SecurityTreatAsSafe] to it here won't help /// much, because the transparency model still requires SUC-d methods to be called only from /// SecurityCritical ones. /// [ComImport, Guid("1f681651-1024-4798-af36-119bbe5e5665")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [SecurityCritical, SuppressUnmanagedCodeSecurity] interface INativeProgressPage { void Show(); void Hide(); void ShowProgressMessage(string message); void SetApplicationName(string appName); void SetPublisherName(string publisherName); void OnDownloadProgress(ulong bytesDownloaded, ulong bytesTotal); }; ////// IProgressPage is public. It was introduced for the Media Center integration, which is now considered /// deprecated, but we have to support it at least for as long as we keep doing in-place upgrades. /// interface IProgressPage2 : IProgressPage { void ShowProgressMessage(string message); }; class NativeProgressPageProxy : IProgressPage2 { internal NativeProgressPageProxy(INativeProgressPage npp) { _npp = npp; } ////// Critical: Calls a SUC'd COM interface method. /// TreatAsSafe: No concern about "spoofing" progress messages. A web site could just render an HTML /// page that looks like our progress page. /// [SecurityCritical, SecurityTreatAsSafe] public void ShowProgressMessage(string message) { _npp.ShowProgressMessage(message); } public Uri DeploymentPath { set { } get { throw new System.NotImplementedException(); } } /// /// The native progress page sends a stop/cancel request to its host object, which then calls /// IBrowserHostServices.ExecCommand(OLECMDID_STOP). /// public DispatcherOperationCallback StopCallback { set { } get { throw new System.NotImplementedException(); } } ////// The native progress page sends a Refresh request to its host object, which then calls /// IBrowserHostServices.ExecCommand(OLECMDID_REFRESH). /// public System.Windows.Threading.DispatcherOperationCallback RefreshCallback { set { } get { return null; } } ////// Critical: Calls a SUC'd COM interface method. /// TreatAsSafe: 1) The application name is coming from the manifest, so it could be anything. /// This means the input doesn't need to be trusted. /// 2) Setting arbitrary application/publisher can be considered spoofing, but a malicious website /// could fake the whole progress page and still achieve the same. /// public string ApplicationName { [SecurityCritical, SecurityTreatAsSafe] set { _npp.SetApplicationName(value); } get { throw new System.NotImplementedException(); } } ////// Critical: Calls a SUC'd COM interface method. /// TreatAsSafe: 1) The publisher name is coming from the manifest, so it could be anything. /// This means the input doesn't need to be trusted. /// 2) Setting arbitrary application/publisher can be considered spoofing, but a malicious website /// could fake the whole progress page and still achieve the same. /// public string PublisherName { [SecurityCritical, SecurityTreatAsSafe] set { _npp.SetPublisherName(value); } get { throw new System.NotImplementedException(); } } /// /// Critical: Calls a SUC'd COM interface method. /// TreatAsSafe: Sending even arbitrary progress updates not considered harmful. /// [SecurityCritical, SecurityTreatAsSafe] public void UpdateProgress(long bytesDownloaded, long bytesTotal) { _npp.OnDownloadProgress((ulong)bytesDownloaded, (ulong)bytesTotal); } INativeProgressPage _npp; }; } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Int32AnimationBase.cs
- IndexerNameAttribute.cs
- ControlAdapter.cs
- QilCloneVisitor.cs
- InputLanguageProfileNotifySink.cs
- DataGridViewCellMouseEventArgs.cs
- ParserHooks.cs
- DuplicateWaitObjectException.cs
- Attributes.cs
- WebServiceResponse.cs
- XmlElementAttributes.cs
- _TLSstream.cs
- ObjectSpanRewriter.cs
- UnauthorizedWebPart.cs
- ResourcesChangeInfo.cs
- InfiniteIntConverter.cs
- ExtentCqlBlock.cs
- GridView.cs
- DependencyPropertyChangedEventArgs.cs
- TypeSystem.cs
- UnsafeNativeMethods.cs
- ApplicationFileCodeDomTreeGenerator.cs
- CSharpCodeProvider.cs
- XmlNodeList.cs
- StringValueConverter.cs
- SafeReadContext.cs
- ApplicationServiceHelper.cs
- ColumnReorderedEventArgs.cs
- StringHelper.cs
- Misc.cs
- PortCache.cs
- RenderCapability.cs
- IPAddressCollection.cs
- EventLogPermissionHolder.cs
- IndexedGlyphRun.cs
- AlphaSortedEnumConverter.cs
- Viewport3DAutomationPeer.cs
- ItemsChangedEventArgs.cs
- log.cs
- CngUIPolicy.cs
- HttpRawResponse.cs
- ClientTargetCollection.cs
- AppSettingsExpressionBuilder.cs
- Win32Interop.cs
- SingleConverter.cs
- BindableTemplateBuilder.cs
- ImageListImageEditor.cs
- ScrollData.cs
- ClientData.cs
- CodeMethodInvokeExpression.cs
- CompilerInfo.cs
- ConstantProjectedSlot.cs
- FrugalList.cs
- DataSourceCacheDurationConverter.cs
- ActivityCodeDomSerializationManager.cs
- DefinitionBase.cs
- ReadOnlyCollectionBuilder.cs
- TypeToken.cs
- DoubleLinkList.cs
- PrintDialog.cs
- LocatorManager.cs
- NotificationContext.cs
- CookieParameter.cs
- EdgeModeValidation.cs
- QilSortKey.cs
- QueryExecutionOption.cs
- ConversionContext.cs
- PipelineComponent.cs
- HandlerFactoryWrapper.cs
- GenericEnumerator.cs
- LookupTables.cs
- XmlSchemaSimpleTypeList.cs
- CmsUtils.cs
- ManagedWndProcTracker.cs
- TypeLoadException.cs
- XmlAttributeOverrides.cs
- ListItem.cs
- FixedSOMLineRanges.cs
- LogEntrySerialization.cs
- MultipleViewPattern.cs
- SiteMapHierarchicalDataSourceView.cs
- ToolStripContainer.cs
- KeyValueConfigurationCollection.cs
- LabelLiteral.cs
- TextServicesCompartmentEventSink.cs
- HotCommands.cs
- UnsafeNativeMethods.cs
- MaskedTextBox.cs
- WindowsUserNameCachingSecurityTokenAuthenticator.cs
- XsdValidatingReader.cs
- StrokeCollection2.cs
- QilGenerator.cs
- RuleInfoComparer.cs
- XmlSchemaAttributeGroup.cs
- TreeViewImageKeyConverter.cs
- EventLogPermission.cs
- TableItemPattern.cs
- UnsafeNativeMethods.cs
- Double.cs
- ObjectQueryState.cs