Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Shared / MS / Internal / SecurityCriticalDataForSet.cs / 1305600 / SecurityCriticalDataForSet.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description:
// This is a helper class to facilate the storage of data that's Critical for set.
// The data itself is not information disclosure but the value controls a critical
// operation.
//
// For example a filepath variable might control what part of the file system the
// code gets access to.
//
// History:
// 01/30/05 : [....] Created.
//
//---------------------------------------------------------------------------
using System ;
using System.Security ;
#if !SILVERLIGHTXAML
#if WINDOWS_BASE
using MS.Internal.WindowsBase;
#elif PRESENTATION_CORE
using MS.Internal.PresentationCore;
#elif PRESENTATIONFRAMEWORK
using MS.Internal.PresentationFramework;
#elif PRESENTATIONUI
using MS.Internal.PresentationUI;
#elif DRT
using MS.Internal.Drt;
#elif SYSTEM_XAML
using MS.Internal.WindowsBase;
#else
#error Attempt to use FriendAccessAllowedAttribute from an unknown assembly.
using MS.Internal.YourAssemblyName;
#endif
#if SYSTEM_XAML
namespace MS.Internal.Xaml
#else
namespace MS.Internal
#endif
{
[FriendAccessAllowed] // Built into Base, also used by Core and Framework.
[Serializable]
internal struct SecurityCriticalDataForSet
{
///
/// Critical - "by definition" - this class is intended only for data that's
/// Critical for setting.
///
[SecurityCritical]
internal SecurityCriticalDataForSet(T value)
{
_value = value;
}
///
/// Critical - Setter is Critical "by definition" - this class is intended only
/// for data that's Critical for setting.
/// Safe - get is safe by definition.
/// Not Safe - set is not safe by definition.
///
internal T Value
{
#if DEBUG
[System.Diagnostics.DebuggerStepThrough]
#endif
[SecurityCritical, SecurityTreatAsSafe]
get
{
return _value;
}
#if DEBUG
[System.Diagnostics.DebuggerStepThrough]
#endif
[SecurityCritical]
set
{
_value = value;
}
}
///
/// Critical - by definition as this data is Critical for set.
/// >
[SecurityCritical]
private T _value;
}
}
#endif
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description:
// This is a helper class to facilate the storage of data that's Critical for set.
// The data itself is not information disclosure but the value controls a critical
// operation.
//
// For example a filepath variable might control what part of the file system the
// code gets access to.
//
// History:
// 01/30/05 : [....] Created.
//
//---------------------------------------------------------------------------
using System ;
using System.Security ;
#if !SILVERLIGHTXAML
#if WINDOWS_BASE
using MS.Internal.WindowsBase;
#elif PRESENTATION_CORE
using MS.Internal.PresentationCore;
#elif PRESENTATIONFRAMEWORK
using MS.Internal.PresentationFramework;
#elif PRESENTATIONUI
using MS.Internal.PresentationUI;
#elif DRT
using MS.Internal.Drt;
#elif SYSTEM_XAML
using MS.Internal.WindowsBase;
#else
#error Attempt to use FriendAccessAllowedAttribute from an unknown assembly.
using MS.Internal.YourAssemblyName;
#endif
#if SYSTEM_XAML
namespace MS.Internal.Xaml
#else
namespace MS.Internal
#endif
{
[FriendAccessAllowed] // Built into Base, also used by Core and Framework.
[Serializable]
internal struct SecurityCriticalDataForSet
{
///
/// Critical - "by definition" - this class is intended only for data that's
/// Critical for setting.
///
[SecurityCritical]
internal SecurityCriticalDataForSet(T value)
{
_value = value;
}
///
/// Critical - Setter is Critical "by definition" - this class is intended only
/// for data that's Critical for setting.
/// Safe - get is safe by definition.
/// Not Safe - set is not safe by definition.
///
internal T Value
{
#if DEBUG
[System.Diagnostics.DebuggerStepThrough]
#endif
[SecurityCritical, SecurityTreatAsSafe]
get
{
return _value;
}
#if DEBUG
[System.Diagnostics.DebuggerStepThrough]
#endif
[SecurityCritical]
set
{
_value = value;
}
}
///
/// Critical - by definition as this data is Critical for set.
/// >
[SecurityCritical]
private T _value;
}
}
#endif
// 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
- WebPartsPersonalization.cs
- TransformerInfo.cs
- SQLDateTimeStorage.cs
- HotSpotCollection.cs
- Queue.cs
- LoginNameDesigner.cs
- GPRECT.cs
- x509utils.cs
- ObjectContext.cs
- Calendar.cs
- GridViewPageEventArgs.cs
- ProviderConnectionPoint.cs
- InvalidProgramException.cs
- ConsoleKeyInfo.cs
- RuleSetDialog.Designer.cs
- DBSchemaTable.cs
- Mutex.cs
- TransformerConfigurationWizardBase.cs
- ObjectManager.cs
- IfAction.cs
- WaveHeader.cs
- AuthenticationSection.cs
- ExtractCollection.cs
- ChangeProcessor.cs
- WsdlBuildProvider.cs
- SchemaTableOptionalColumn.cs
- XmlCodeExporter.cs
- SQLString.cs
- Authorization.cs
- StylusPointDescription.cs
- KeyValueConfigurationCollection.cs
- WebPartTransformerAttribute.cs
- XmlFormatExtensionAttribute.cs
- ObjectCache.cs
- ThemeInfoAttribute.cs
- Trace.cs
- UIElement3D.cs
- codemethodreferenceexpression.cs
- OrthographicCamera.cs
- AsyncCompletedEventArgs.cs
- Int16Converter.cs
- WebPartTracker.cs
- EmbeddedMailObject.cs
- DependencyPropertyChangedEventArgs.cs
- BamlRecords.cs
- RoutedCommand.cs
- PointConverter.cs
- HandlerFactoryWrapper.cs
- Transform.cs
- PenThreadWorker.cs
- Stylesheet.cs
- KeyValuePair.cs
- Camera.cs
- DataGridColumn.cs
- DescriptionAttribute.cs
- MessageQueueInstaller.cs
- BinaryParser.cs
- EncoderParameter.cs
- XsdDataContractImporter.cs
- FontWeightConverter.cs
- Bits.cs
- XmlTextAttribute.cs
- HtmlCommandAdapter.cs
- SqlInternalConnection.cs
- RolePrincipal.cs
- ToolboxItemCollection.cs
- StsCommunicationException.cs
- ContentValidator.cs
- StrokeCollectionDefaultValueFactory.cs
- TypeConstant.cs
- SpinWait.cs
- TextDocumentView.cs
- TransformGroup.cs
- BindUriHelper.cs
- DataGridClipboardCellContent.cs
- XmlConverter.cs
- TreeNodeBinding.cs
- BooleanSwitch.cs
- AuthenticateEventArgs.cs
- HotSpotCollection.cs
- NamespaceQuery.cs
- XamlPathDataSerializer.cs
- XmlSerializationWriter.cs
- XslTransformFileEditor.cs
- DuplicateWaitObjectException.cs
- BuildProvider.cs
- webproxy.cs
- securitycriticaldataClass.cs
- OleDbCommand.cs
- Property.cs
- ChannelFactoryRefCache.cs
- WindowsButton.cs
- RequiredAttributeAttribute.cs
- ObjectConverter.cs
- PropertyValueChangedEvent.cs
- DataGridViewRowConverter.cs
- ManipulationStartedEventArgs.cs
- MobileControlsSection.cs
- CalloutQueueItem.cs
- XmlWrappingWriter.cs