Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / MS / Internal / CheckedPointers.cs / 1 / CheckedPointers.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// Description: Checked pointers for various types
//
// History:
// 05/09/2005: Garyyang Created the file
//
//---------------------------------------------------------------------------
using System;
using System.Security;
using MS.Internal.Shaping;
using MS.Internal.FontCache;
//
// The file contains wrapper structs for various pointer types.
// This is to allow us passing these pointers safely in layout code and provides
// some bound checking. Only construction and probing into these pointers are security critical.
//
namespace MS.Internal
{
///
/// Checked pointer for (Char*)
///
internal struct CheckedCharPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedCharPointer(char * pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(char));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe char * Probe(int offset, int length)
{
return (char*) _checkedPointer.Probe(offset * sizeof(char), length * sizeof(char));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (int*)
///
internal struct CheckedIntPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedIntPointer(int * pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(int));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe int * Probe(int offset, int length)
{
return (int *) _checkedPointer.Probe(offset * sizeof(int), length * sizeof(int));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (ushort*)
///
internal struct CheckedUShortPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedUShortPointer(ushort * pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(ushort));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe ushort * Probe(int offset, int length)
{
return (ushort *) _checkedPointer.Probe(offset * sizeof(ushort), length * sizeof(ushort));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (GlyphOffset*)
///
internal struct CheckedGlyphOffsetPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedGlyphOffsetPointer(GlyphOffset* pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(GlyphOffset));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe GlyphOffset * Probe(int offset, int length)
{
return (GlyphOffset *) _checkedPointer.Probe(offset * sizeof(GlyphOffset), length * sizeof(GlyphOffset));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (GlyphShapingProperties*)
///
internal struct CheckedGlyphShapingPropertiesPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedGlyphShapingPropertiesPointer(GlyphShapingProperties* pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(GlyphShapingProperties));
}
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedGlyphShapingPropertiesPointer(uint* pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(GlyphShapingProperties));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe GlyphShapingProperties * Probe(int offset, int length)
{
return (GlyphShapingProperties *) _checkedPointer.Probe(offset * sizeof(GlyphShapingProperties), length * sizeof(GlyphShapingProperties));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (CharacterShapingProperties*)
///
internal struct CheckedCharacterShapingPropertiesPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedCharacterShapingPropertiesPointer(CharacterShapingProperties* pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(CharacterShapingProperties));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe CharacterShapingProperties * Probe(int offset, int length)
{
return (CharacterShapingProperties *) _checkedPointer.Probe(offset * sizeof(CharacterShapingProperties), length * sizeof(CharacterShapingProperties));
}
private CheckedPointer _checkedPointer;
}
}
// 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: Checked pointers for various types
//
// History:
// 05/09/2005: Garyyang Created the file
//
//---------------------------------------------------------------------------
using System;
using System.Security;
using MS.Internal.Shaping;
using MS.Internal.FontCache;
//
// The file contains wrapper structs for various pointer types.
// This is to allow us passing these pointers safely in layout code and provides
// some bound checking. Only construction and probing into these pointers are security critical.
//
namespace MS.Internal
{
///
/// Checked pointer for (Char*)
///
internal struct CheckedCharPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedCharPointer(char * pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(char));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe char * Probe(int offset, int length)
{
return (char*) _checkedPointer.Probe(offset * sizeof(char), length * sizeof(char));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (int*)
///
internal struct CheckedIntPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedIntPointer(int * pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(int));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe int * Probe(int offset, int length)
{
return (int *) _checkedPointer.Probe(offset * sizeof(int), length * sizeof(int));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (ushort*)
///
internal struct CheckedUShortPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedUShortPointer(ushort * pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(ushort));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe ushort * Probe(int offset, int length)
{
return (ushort *) _checkedPointer.Probe(offset * sizeof(ushort), length * sizeof(ushort));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (GlyphOffset*)
///
internal struct CheckedGlyphOffsetPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedGlyphOffsetPointer(GlyphOffset* pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(GlyphOffset));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe GlyphOffset * Probe(int offset, int length)
{
return (GlyphOffset *) _checkedPointer.Probe(offset * sizeof(GlyphOffset), length * sizeof(GlyphOffset));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (GlyphShapingProperties*)
///
internal struct CheckedGlyphShapingPropertiesPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedGlyphShapingPropertiesPointer(GlyphShapingProperties* pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(GlyphShapingProperties));
}
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedGlyphShapingPropertiesPointer(uint* pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(GlyphShapingProperties));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe GlyphShapingProperties * Probe(int offset, int length)
{
return (GlyphShapingProperties *) _checkedPointer.Probe(offset * sizeof(GlyphShapingProperties), length * sizeof(GlyphShapingProperties));
}
private CheckedPointer _checkedPointer;
}
///
/// Checked pointer for (CharacterShapingProperties*)
///
internal struct CheckedCharacterShapingPropertiesPointer
{
///
/// Critical - The method takes unsafe pointer
///
[SecurityCritical]
internal unsafe CheckedCharacterShapingPropertiesPointer(CharacterShapingProperties* pointer, int length)
{
_checkedPointer = new CheckedPointer(pointer, length * sizeof(CharacterShapingProperties));
}
///
/// Critical - The method returns unsafe pointer
///
[SecurityCritical]
internal unsafe CharacterShapingProperties * Probe(int offset, int length)
{
return (CharacterShapingProperties *) _checkedPointer.Probe(offset * sizeof(CharacterShapingProperties), length * sizeof(CharacterShapingProperties));
}
private CheckedPointer _checkedPointer;
}
}
// 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
- BamlLocalizationDictionary.cs
- TdsParameterSetter.cs
- ConnectionManagementSection.cs
- ManagedFilter.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- unsafenativemethodstextservices.cs
- LayoutTableCell.cs
- AuthenticationManager.cs
- FlagsAttribute.cs
- PopupRoot.cs
- MemberBinding.cs
- ParallelDesigner.cs
- XmlDocumentType.cs
- DebugView.cs
- FormsAuthenticationUserCollection.cs
- DSASignatureFormatter.cs
- GridViewUpdatedEventArgs.cs
- WebPartDescriptionCollection.cs
- IssuedTokenClientBehaviorsElementCollection.cs
- DataControlHelper.cs
- BinaryObjectWriter.cs
- ProcessThread.cs
- RoutedCommand.cs
- OperandQuery.cs
- UpnEndpointIdentityExtension.cs
- X509CertificateTrustedIssuerElement.cs
- SuppressMergeCheckAttribute.cs
- CertificateManager.cs
- ServiceReference.cs
- ElementNotAvailableException.cs
- Attributes.cs
- HMACSHA256.cs
- DataGridViewColumnCollection.cs
- BitmapEffectDrawingContent.cs
- ExceptionUtil.cs
- WindowsScroll.cs
- Keyboard.cs
- RowVisual.cs
- SpeakInfo.cs
- AsyncWaitHandle.cs
- WindowVisualStateTracker.cs
- AsymmetricKeyExchangeFormatter.cs
- Type.cs
- Knowncolors.cs
- HttpProfileGroupBase.cs
- FastEncoderWindow.cs
- SoapElementAttribute.cs
- ErrorEventArgs.cs
- Scene3D.cs
- CodeTypeReference.cs
- Component.cs
- InlineUIContainer.cs
- RelationshipWrapper.cs
- CommonXSendMessage.cs
- TagPrefixAttribute.cs
- CodeAttributeArgumentCollection.cs
- IERequestCache.cs
- Operand.cs
- VerificationAttribute.cs
- DataGridViewLinkColumn.cs
- entityreference_tresulttype.cs
- SystemGatewayIPAddressInformation.cs
- UpdateException.cs
- PropertyTab.cs
- DrawingCollection.cs
- BitVec.cs
- LinqDataSourceView.cs
- UnsafeNativeMethods.cs
- GACIdentityPermission.cs
- DefaultSettingsSection.cs
- xmlformatgeneratorstatics.cs
- QilInvokeLateBound.cs
- TransformerConfigurationWizardBase.cs
- DescendantQuery.cs
- SerTrace.cs
- UnknownBitmapDecoder.cs
- XmlSchemaSimpleType.cs
- HtmlInputCheckBox.cs
- XmlSchemaObjectCollection.cs
- TextServicesPropertyRanges.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- PrintPreviewControl.cs
- ActiveXHost.cs
- TextTreeText.cs
- WebCategoryAttribute.cs
- URIFormatException.cs
- LayoutExceptionEventArgs.cs
- WhereQueryOperator.cs
- XmlSchemaAll.cs
- Nullable.cs
- CodeDefaultValueExpression.cs
- DatePickerDateValidationErrorEventArgs.cs
- PassportAuthenticationEventArgs.cs
- WpfXamlType.cs
- SerializationStore.cs
- CommonDialog.cs
- PathFigureCollectionConverter.cs
- HatchBrush.cs
- EntityRecordInfo.cs
- FilterFactory.cs