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
- ControlIdConverter.cs
- FolderBrowserDialog.cs
- FontCollection.cs
- SubMenuStyleCollectionEditor.cs
- HwndProxyElementProvider.cs
- ZipFileInfo.cs
- ProcessThread.cs
- DataMemberFieldEditor.cs
- LinkedList.cs
- BitmapFrameEncode.cs
- FloaterBaseParaClient.cs
- OrthographicCamera.cs
- KerberosRequestorSecurityToken.cs
- DirtyTextRange.cs
- SamlAdvice.cs
- EntitySet.cs
- TrackingExtract.cs
- TemplatedMailWebEventProvider.cs
- DataBindingExpressionBuilder.cs
- Guid.cs
- SQLMoneyStorage.cs
- ParallelTimeline.cs
- controlskin.cs
- BaseAutoFormat.cs
- MethodBody.cs
- EntitySetRetriever.cs
- ConfigXmlAttribute.cs
- Debug.cs
- MailDefinitionBodyFileNameEditor.cs
- FileStream.cs
- ProviderSettings.cs
- OracleConnection.cs
- ParseNumbers.cs
- StoreContentChangedEventArgs.cs
- GeneralTransformCollection.cs
- CategoryGridEntry.cs
- ProcessHostFactoryHelper.cs
- TextFindEngine.cs
- XPathEmptyIterator.cs
- TdsValueSetter.cs
- HTMLTextWriter.cs
- SpotLight.cs
- EventLogPermissionEntryCollection.cs
- DesignerOptionService.cs
- WorkflowControlClient.cs
- SqlDataSourceSummaryPanel.cs
- CompilationUtil.cs
- Guid.cs
- MetadataHelper.cs
- DoubleLink.cs
- FixedTextContainer.cs
- ScriptResourceHandler.cs
- MultiBinding.cs
- DeclarationUpdate.cs
- ResXResourceSet.cs
- COM2ExtendedUITypeEditor.cs
- WinEventQueueItem.cs
- HuffCodec.cs
- Border.cs
- SplineKeyFrames.cs
- ApplicationSecurityInfo.cs
- TreeNodeBinding.cs
- SecurityTokenResolver.cs
- StreamSecurityUpgradeAcceptor.cs
- SQLInt32Storage.cs
- HttpDateParse.cs
- DataDesignUtil.cs
- EditingScope.cs
- NetDataContractSerializer.cs
- EntityTransaction.cs
- ListViewSelectEventArgs.cs
- InstalledVoice.cs
- WmiEventSink.cs
- PointLightBase.cs
- Monitor.cs
- SelectionItemProviderWrapper.cs
- XamlTemplateSerializer.cs
- MaskInputRejectedEventArgs.cs
- ColorMatrix.cs
- RepeatInfo.cs
- ActivityCollectionMarkupSerializer.cs
- AddressHeaderCollectionElement.cs
- SqlNotificationRequest.cs
- ConfigurationElementProperty.cs
- IfJoinedCondition.cs
- XmlSchemaObjectCollection.cs
- PropertyFilterAttribute.cs
- SafeViewOfFileHandle.cs
- FontResourceCache.cs
- OutKeywords.cs
- Util.cs
- ISO2022Encoding.cs
- CorruptStoreException.cs
- WebPartActionVerb.cs
- HyperLinkField.cs
- CharacterString.cs
- PixelFormats.cs
- FontEditor.cs
- MimeMapping.cs
- CodeExporter.cs