Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ViewStateModeByIdAttribute.cs
- RecommendedAsConfigurableAttribute.cs
- ControlPropertyNameConverter.cs
- WizardStepBase.cs
- SuppressMessageAttribute.cs
- DataTable.cs
- DefaultShape.cs
- PointHitTestResult.cs
- RadioButtonRenderer.cs
- SecurityContext.cs
- PerspectiveCamera.cs
- HeaderedItemsControl.cs
- DetailsViewCommandEventArgs.cs
- ScriptRegistrationManager.cs
- WindowsListBox.cs
- AppearanceEditorPart.cs
- ContainsSearchOperator.cs
- WebReferencesBuildProvider.cs
- StreamSecurityUpgradeInitiator.cs
- EncodingDataItem.cs
- BulletedListDesigner.cs
- DataGridItemEventArgs.cs
- UnsafeNativeMethodsMilCoreApi.cs
- GlobalProxySelection.cs
- CustomError.cs
- FromRequest.cs
- WmlPanelAdapter.cs
- TextViewSelectionProcessor.cs
- objectquery_tresulttype.cs
- EditCommandColumn.cs
- StorageInfo.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- ReadOnlyCollectionBase.cs
- Rotation3DKeyFrameCollection.cs
- WorkflowDebuggerSteppingAttribute.cs
- basecomparevalidator.cs
- DataControlField.cs
- TemplatedEditableDesignerRegion.cs
- SqlTriggerAttribute.cs
- SerializationInfo.cs
- AppearanceEditorPart.cs
- BasicKeyConstraint.cs
- ToolboxItemAttribute.cs
- RegexMatch.cs
- diagnosticsswitches.cs
- SrgsSubset.cs
- SupportingTokenSpecification.cs
- ComponentCodeDomSerializer.cs
- UriTemplatePathPartiallyEquivalentSet.cs
- TraceSection.cs
- GacUtil.cs
- ReachPageContentSerializer.cs
- FileResponseElement.cs
- HttpStreamMessage.cs
- QilCloneVisitor.cs
- IntSecurity.cs
- WindowsSecurityTokenAuthenticator.cs
- RsaSecurityToken.cs
- XmlSchemaSet.cs
- BitmapMetadataBlob.cs
- initElementDictionary.cs
- BrowserTree.cs
- CodeIdentifiers.cs
- SqlWriter.cs
- documentsequencetextcontainer.cs
- ExeContext.cs
- RecommendedAsConfigurableAttribute.cs
- NativeMethods.cs
- shaper.cs
- WorkflowTransactionService.cs
- CompleteWizardStep.cs
- ObjectHandle.cs
- UxThemeWrapper.cs
- DATA_BLOB.cs
- ProofTokenCryptoHandle.cs
- Control.cs
- ElementInit.cs
- HttpWebResponse.cs
- ConfigurationErrorsException.cs
- SR.cs
- FlowDocumentPaginator.cs
- SecurityElement.cs
- Geometry3D.cs
- RectangleGeometry.cs
- AssociationEndMember.cs
- Single.cs
- ContourSegment.cs
- CannotUnloadAppDomainException.cs
- FixedSOMFixedBlock.cs
- XPathDocumentBuilder.cs
- DesignerActionVerbItem.cs
- GraphicsContainer.cs
- TreeNode.cs
- WorkflowMarkupSerializer.cs
- AstNode.cs
- GeneralTransform3DTo2D.cs
- RtfFormatStack.cs
- TextSpan.cs
- Compilation.cs
- DataGridViewTextBoxCell.cs