Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / ArgIterator.cs / 1305376 / ArgIterator.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== namespace System { using System; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Diagnostics.Contracts; // This class will not be marked serializable [StructLayout(LayoutKind.Auto)] public struct ArgIterator { [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern ArgIterator(IntPtr arglist); // create an arg iterator that points at the first argument that // is not statically declared (that is the first ... arg) // 'arglist' is the value returned by the ARGLIST instruction [System.Security.SecuritySafeCritical] // auto-generated public ArgIterator(RuntimeArgumentHandle arglist) : this(arglist.Value) { } [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe extern ArgIterator(IntPtr arglist, void *ptr); // create an arg iterator that points just past 'firstArg'. // 'arglist' is the value returned by the ARGLIST instruction // This is much like the C va_start macro [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe ArgIterator(RuntimeArgumentHandle arglist, void* ptr) : this(arglist.Value, ptr) { } // Fetch an argument as a typed referece, advance the iterator. // Throws an exception if past end of argument list [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public TypedReference GetNextArg() { TypedReference result = new TypedReference (); // reference to TypedReference is banned, so have to pass result as pointer unsafe { FCallGetNextArg (&result); } return result; } [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as void pointer private unsafe extern void FCallGetNextArg(void * result); // Alternate version of GetNextArg() intended primarily for IJW code // generated by VC's "va_arg()" construct. [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public TypedReference GetNextArg(RuntimeTypeHandle rth) { if (sigPtr != IntPtr.Zero) { // This is an ordinary ArgIterator capable of determining // types from a signature. Just do a regular GetNextArg. return GetNextArg(); } else { // Prevent abuse of this API with a default ArgIterator (it // doesn't require permission to create a zero-inited value // type). Check that ArgPtr isn't zero or this API will allow a // malicious caller to increment the pointer to an arbitrary // location in memory and read the contents. if (ArgPtr == IntPtr.Zero) throw new ArgumentNullException(); TypedReference result = new TypedReference (); // reference to TypedReference is banned, so have to pass result as pointer unsafe { InternalGetNextArg(&result, rth.GetRuntimeType()); } return result; } } [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as void pointer private unsafe extern void InternalGetNextArg(void * result, RuntimeType rt); // This method should invalidate the iterator (va_end). It is not supported yet. public void End() { } // How many arguments are left in the list [System.Security.SecuritySafeCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern int GetRemainingCount(); // Gets the type of the current arg, does NOT advance the iterator [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern unsafe void* _GetNextArgType(); [System.Security.SecuritySafeCritical] // auto-generated public unsafe RuntimeTypeHandle GetNextArgType() { return new RuntimeTypeHandle(Type.GetTypeFromHandleUnsafe((IntPtr)_GetNextArgType())); } public override int GetHashCode() { return ValueType.GetHashCodeOfPtr(ArgCookie); } // Inherited from object public override bool Equals(Object o) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_NYI")); } private IntPtr ArgCookie; // Cookie from the EE. // The SigPtr structure consists of the following members private IntPtr sigPtr; // Pointer to remaining signature. private IntPtr sigPtrLen; // Remaining length of the pointer // Note, sigPtrLen is actually a DWORD, but on 64bit systems this structure becomes // 8-byte aligned, which requires us to pad it. private IntPtr ArgPtr; // Pointer to remaining args. private int RemainingArgs; // # of remaining args. } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== namespace System { using System; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Diagnostics.Contracts; // This class will not be marked serializable [StructLayout(LayoutKind.Auto)] public struct ArgIterator { [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern ArgIterator(IntPtr arglist); // create an arg iterator that points at the first argument that // is not statically declared (that is the first ... arg) // 'arglist' is the value returned by the ARGLIST instruction [System.Security.SecuritySafeCritical] // auto-generated public ArgIterator(RuntimeArgumentHandle arglist) : this(arglist.Value) { } [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private unsafe extern ArgIterator(IntPtr arglist, void *ptr); // create an arg iterator that points just past 'firstArg'. // 'arglist' is the value returned by the ARGLIST instruction // This is much like the C va_start macro [System.Security.SecurityCritical] // auto-generated [CLSCompliant(false)] public unsafe ArgIterator(RuntimeArgumentHandle arglist, void* ptr) : this(arglist.Value, ptr) { } // Fetch an argument as a typed referece, advance the iterator. // Throws an exception if past end of argument list [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public TypedReference GetNextArg() { TypedReference result = new TypedReference (); // reference to TypedReference is banned, so have to pass result as pointer unsafe { FCallGetNextArg (&result); } return result; } [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as void pointer private unsafe extern void FCallGetNextArg(void * result); // Alternate version of GetNextArg() intended primarily for IJW code // generated by VC's "va_arg()" construct. [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public TypedReference GetNextArg(RuntimeTypeHandle rth) { if (sigPtr != IntPtr.Zero) { // This is an ordinary ArgIterator capable of determining // types from a signature. Just do a regular GetNextArg. return GetNextArg(); } else { // Prevent abuse of this API with a default ArgIterator (it // doesn't require permission to create a zero-inited value // type). Check that ArgPtr isn't zero or this API will allow a // malicious caller to increment the pointer to an arbitrary // location in memory and read the contents. if (ArgPtr == IntPtr.Zero) throw new ArgumentNullException(); TypedReference result = new TypedReference (); // reference to TypedReference is banned, so have to pass result as pointer unsafe { InternalGetNextArg(&result, rth.GetRuntimeType()); } return result; } } [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as void pointer private unsafe extern void InternalGetNextArg(void * result, RuntimeType rt); // This method should invalidate the iterator (va_end). It is not supported yet. public void End() { } // How many arguments are left in the list [System.Security.SecuritySafeCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern int GetRemainingCount(); // Gets the type of the current arg, does NOT advance the iterator [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern unsafe void* _GetNextArgType(); [System.Security.SecuritySafeCritical] // auto-generated public unsafe RuntimeTypeHandle GetNextArgType() { return new RuntimeTypeHandle(Type.GetTypeFromHandleUnsafe((IntPtr)_GetNextArgType())); } public override int GetHashCode() { return ValueType.GetHashCodeOfPtr(ArgCookie); } // Inherited from object public override bool Equals(Object o) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_NYI")); } private IntPtr ArgCookie; // Cookie from the EE. // The SigPtr structure consists of the following members private IntPtr sigPtr; // Pointer to remaining signature. private IntPtr sigPtrLen; // Remaining length of the pointer // Note, sigPtrLen is actually a DWORD, but on 64bit systems this structure becomes // 8-byte aligned, which requires us to pad it. private IntPtr ArgPtr; // Pointer to remaining args. private int RemainingArgs; // # of remaining args. } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OracleConnectionFactory.cs
- Pool.cs
- ClipboardProcessor.cs
- RuntimeResourceSet.cs
- PathFigureCollectionConverter.cs
- VisualTreeUtils.cs
- InkCanvasSelection.cs
- SqlUserDefinedAggregateAttribute.cs
- ReadOnlyDictionary.cs
- IndependentAnimationStorage.cs
- PropertyChangingEventArgs.cs
- CacheDependency.cs
- ZipIOFileItemStream.cs
- SiteMapNode.cs
- PersonalizationStateInfo.cs
- ColumnCollection.cs
- TypeForwardedToAttribute.cs
- SimpleTypeResolver.cs
- ADConnectionHelper.cs
- DayRenderEvent.cs
- BufferBuilder.cs
- HtmlTextArea.cs
- ZoneMembershipCondition.cs
- TypeHelpers.cs
- VisualTreeFlattener.cs
- Pen.cs
- DispatcherOperation.cs
- BuiltInExpr.cs
- CompositeFontParser.cs
- MimeWriter.cs
- ExpressionDumper.cs
- ButtonChrome.cs
- WindowsTooltip.cs
- ObjectViewListener.cs
- TableCell.cs
- WmiEventSink.cs
- ParseChildrenAsPropertiesAttribute.cs
- TextServicesHost.cs
- DeadCharTextComposition.cs
- OuterGlowBitmapEffect.cs
- ConfigXmlSignificantWhitespace.cs
- DispatcherOperation.cs
- EqualityComparer.cs
- ConnectionStringSettings.cs
- OptionalColumn.cs
- SystemIcmpV4Statistics.cs
- HwndSourceKeyboardInputSite.cs
- InputBinding.cs
- AbsoluteQuery.cs
- iisPickupDirectory.cs
- IPEndPoint.cs
- ReadContentAsBinaryHelper.cs
- ApplicationTrust.cs
- FormViewCommandEventArgs.cs
- SqlDataRecord.cs
- Point.cs
- X509ChainPolicy.cs
- SqlNotificationEventArgs.cs
- UIElement3DAutomationPeer.cs
- SqlClientWrapperSmiStreamChars.cs
- TextParagraphView.cs
- RTLAwareMessageBox.cs
- MinimizableAttributeTypeConverter.cs
- WindowsToolbarItemAsMenuItem.cs
- MetadataCollection.cs
- DataSourceProvider.cs
- IncrementalCompileAnalyzer.cs
- CallbackValidatorAttribute.cs
- XhtmlBasicLiteralTextAdapter.cs
- DataServiceClientException.cs
- Memoizer.cs
- PackWebRequest.cs
- WindowsFormsDesignerOptionService.cs
- RuntimeConfig.cs
- ContainerTracking.cs
- SafeNativeMemoryHandle.cs
- SignatureDescription.cs
- SystemWebCachingSectionGroup.cs
- AxisAngleRotation3D.cs
- Geometry.cs
- DateTimeOffsetAdapter.cs
- RelOps.cs
- HotCommands.cs
- AsymmetricAlgorithm.cs
- TransformGroup.cs
- ScrollItemProviderWrapper.cs
- WebContext.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- XsltCompileContext.cs
- SafeFindHandle.cs
- KnownTypesProvider.cs
- Point3DKeyFrameCollection.cs
- AddingNewEventArgs.cs
- RuleSettingsCollection.cs
- DesignTimeParseData.cs
- BezierSegment.cs
- TrackBarRenderer.cs
- ConnectionsZone.cs
- ConnectionPoint.cs
- PostBackOptions.cs