The Labs \ Source Viewer \ SSCLI \ System \ FastArrayHandle

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. #define DEBUG_PTRS
  16. namespace System
  17. {
  18.     using System;
  19.     using System.Reflection;
  20.     using System.Reflection.Emit;
  21.     using System.Runtime.ConstrainedExecution;
  22.     using System.Diagnostics;
  23.     using System.Runtime.Serialization;
  24.     using System.Runtime.CompilerServices;
  25.     using System.Runtime.InteropServices;
  26.     using System.Text;
  27.     using System.Globalization;
  28.     using Microsoft.Win32.SafeHandles;
  29.     using StackCrawlMark = System.Threading.StackCrawlMark;
  30.    
  31.     unsafe internal struct MethodDescChunkHandle
  32.     {
  33.         private IntPtr m_ptr;
  34.        
  35.         internal MethodDescChunkHandle(void* ptr)
  36.         {
  37.             m_ptr = new IntPtr(ptr);
  38.         }
  39.        
  40.         internal bool IsNullHandle()
  41.         {
  42.             return m_ptr.ToPointer() == null;
  43.         }
  44.        
  45.         [MethodImplAttribute(MethodImplOptions.InternalCall)]
  46.         private extern void* _GetNextMethodDescChunk();
  47.         internal MethodDescChunkHandle GetNextMethodDescChunk()
  48.         {
  49.             return new MethodDescChunkHandle(_GetNextMethodDescChunk());
  50.         }
  51.        
  52.         [MethodImplAttribute(MethodImplOptions.InternalCall)]
  53.         private extern void* _GetMethodAt(int index);
  54.         internal RuntimeMethodHandle GetMethodAt(int index)
  55.         {
  56.             return new RuntimeMethodHandle(_GetMethodAt(index));
  57.         }
  58.        
  59.         [MethodImplAttribute(MethodImplOptions.InternalCall)]
  60.         internal extern int GetMethodCount();
  61.     }
  62.    
  63.     internal struct FastArrayHandle
  64.     {
  65.         [MethodImplAttribute(MethodImplOptions.InternalCall)]
  66.         static internal extern void SetValueAt(Array target, int index, object element);
  67.         /*       
  68.         [MethodImplAttribute(MethodImplOptions.InternalCall)]           
  69.         internal static extern void CopyArray (Array soruce, Array destination);
  70. */       
  71.     }
  72.    
  73.     [Serializable()]
  74.     [System.Runtime.InteropServices.ComVisible(true)]
  75.     unsafe public struct RuntimeTypeHandle : ISerializable
  76.     {
  77.         [MethodImplAttribute(MethodImplOptions.InternalCall)]
  78.         internal extern bool IsInstanceOfType(object o);
  79.        
  80.         unsafe static internal IntPtr GetTypeHelper(IntPtr th, IntPtr pGenericArgs, int cGenericArgs, IntPtr pModifiers, int cModifiers)
  81.         {
  82.             RuntimeTypeHandle typeHandle = new RuntimeTypeHandle(th.ToPointer());
  83.             Type type = typeHandle.GetRuntimeType();
  84.             if (type == null)
  85.                 return th;
  86.            
  87.             if (cGenericArgs > 0) {
  88.                 Type[] genericArgs = new Type[cGenericArgs];
  89.             }
  90.         }
  91.         void** arGenericArgs = (void**)pGenericArgs.ToPointer();
  92.     }
  93. }

Developer Fusion