Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / MS / Internal / CheckedPointers.cs / 1305600 / 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; } } // 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; } } // 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
- Permission.cs
- ListView.cs
- SizeAnimationClockResource.cs
- BooleanConverter.cs
- StylusButtonCollection.cs
- ServiceContractAttribute.cs
- XmlSchemaGroupRef.cs
- PropertyNames.cs
- PenLineJoinValidation.cs
- ServiceMemoryGates.cs
- ComponentEditorPage.cs
- WebBrowserPermission.cs
- TreeNodeCollectionEditor.cs
- ProfessionalColors.cs
- VirtualizingStackPanel.cs
- UpdateProgress.cs
- PageCatalogPart.cs
- MediaContext.cs
- SecurityStandardsManager.cs
- WindowsToolbar.cs
- Memoizer.cs
- UpdatePanelTriggerCollection.cs
- XmlDataSource.cs
- FixedFindEngine.cs
- ByteFacetDescriptionElement.cs
- RootBrowserWindowAutomationPeer.cs
- NavigatorOutput.cs
- ObjectDataSourceStatusEventArgs.cs
- _NativeSSPI.cs
- COSERVERINFO.cs
- FormParameter.cs
- BindableTemplateBuilder.cs
- Lease.cs
- ProfileBuildProvider.cs
- ClusterSafeNativeMethods.cs
- ReferenceSchema.cs
- DefaultValueTypeConverter.cs
- XDeferredAxisSource.cs
- TableRow.cs
- GacUtil.cs
- MenuCommand.cs
- NullableConverter.cs
- InputBindingCollection.cs
- BStrWrapper.cs
- DiffuseMaterial.cs
- DispatcherTimer.cs
- WinFormsSecurity.cs
- DataGridViewCellValidatingEventArgs.cs
- ArcSegment.cs
- DomNameTable.cs
- ControlPersister.cs
- MDIWindowDialog.cs
- SortQuery.cs
- XhtmlBasicValidatorAdapter.cs
- EventPrivateKey.cs
- Repeater.cs
- WebConvert.cs
- RtfControls.cs
- XmlQueryOutput.cs
- FrameworkTemplate.cs
- MsmqAppDomainProtocolHandler.cs
- XmlSortKey.cs
- CompositeDuplexBindingElement.cs
- Margins.cs
- NCryptNative.cs
- CreateUserErrorEventArgs.cs
- ByteConverter.cs
- AutomationIdentifierGuids.cs
- SymmetricAlgorithm.cs
- EntityClassGenerator.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- SHA1Cng.cs
- SchemaImporterExtensionElement.cs
- ObjectQuery.cs
- DataGridViewCellStyleConverter.cs
- SplineKeyFrames.cs
- ControlAdapter.cs
- StackSpiller.Temps.cs
- ScriptingJsonSerializationSection.cs
- XPathAxisIterator.cs
- DataGridDesigner.cs
- DefaultBinder.cs
- OdbcReferenceCollection.cs
- ObjectManager.cs
- TriggerCollection.cs
- ProcessHostFactoryHelper.cs
- DotAtomReader.cs
- SqlAliaser.cs
- ResourceWriter.cs
- WorkflowInstanceAbortedRecord.cs
- DebugManager.cs
- DbProviderFactoriesConfigurationHandler.cs
- FontStretch.cs
- mansign.cs
- Common.cs
- QueryCacheManager.cs
- MethodImplAttribute.cs
- UiaCoreTypesApi.cs
- Optimizer.cs
- RegexGroup.cs