Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/CorApi
diff options
context:
space:
mode:
authorMichael Hutchinson <mhutch@xamarin.com>2013-09-08 05:40:27 +0400
committerMichael Hutchinson <mhutch@xamarin.com>2013-09-08 05:40:27 +0400
commit56944529ba1e639aa07ff49bc083b1fe8b1aa72c (patch)
tree0186413b5f1484736b447a0ef9da6c856f6e0ee3 /CorApi
Move MS.NET debugger into Main
So we can easily debug when developing MD on Windows
Diffstat (limited to 'CorApi')
-rw-r--r--CorApi/CorApi.csproj66
-rw-r--r--CorApi/ICorDebugWrappers.cs1906
-rw-r--r--CorApi/ICorPublishWrappers.cs123
-rw-r--r--CorApi/IMetadataImport.cs1405
-rw-r--r--CorApi/RawAssemblyAttributes.cs12
-rw-r--r--CorApi/WindowsImports.cs117
6 files changed, 3629 insertions, 0 deletions
diff --git a/CorApi/CorApi.csproj b/CorApi/CorApi.csproj
new file mode 100644
index 0000000..5d0bfc1
--- /dev/null
+++ b/CorApi/CorApi.csproj
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9FBCC262-10DC-4E84-A5C4-17230BBF8862}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>CorApi</RootNamespace>
+ <AssemblyName>CorApi</AssemblyName>
+ <RunPostBuildEvent>Always</RunPostBuildEvent>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="IMetadataImport.cs" />
+ <Compile Include="ICorDebugWrappers.cs" />
+ <Compile Include="ICorPublishWrappers.cs" />
+ <Compile Include="RawAssemblyAttributes.cs" />
+ <Compile Include="WindowsImports.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/CorApi/ICorDebugWrappers.cs b/CorApi/ICorDebugWrappers.cs
new file mode 100644
index 0000000..5f8f793
--- /dev/null
+++ b/CorApi/ICorDebugWrappers.cs
@@ -0,0 +1,1906 @@
+//---------------------------------------------------------------------
+// This file is part of the CLR Managed Debugger (mdbg) Sample.
+//
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// Imports ICorDebug interface from CorDebug.idl into managed code.
+//---------------------------------------------------------------------
+
+
+using System;
+using System.Text;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+using IStream = System.Runtime.InteropServices.ComTypes.IStream;
+using Microsoft.Samples.Debugging.CorMetadata.NativeApi;
+using Microsoft.Win32.SafeHandles;
+
+namespace Microsoft.Samples.Debugging.CorDebug.NativeApi
+{
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ public struct _COR_VERSION
+ {
+ public uint dwMajor;
+ public uint dwMinor;
+ public uint dwBuild;
+ public uint dwSubBuild;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 8)]
+ public struct _LARGE_INTEGER
+ {
+ public long QuadPart;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ public struct _SECURITY_ATTRIBUTES
+ {
+ public uint nLength;
+ public IntPtr lpSecurityDescriptor;
+ public int bInheritHandle;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 8)]
+ public struct _ULARGE_INTEGER
+ {
+ public ulong QuadPart;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ public struct COR_IL_MAP
+ {
+ public uint oldOffset;
+ public uint newOffset;
+ public int fAccurate;
+ }
+
+ public enum CorDebugCreateProcessFlags
+ {
+ DEBUG_NO_SPECIAL_OPTIONS
+ }
+
+ public enum CorDebugExceptionCallbackType
+ {
+ // Fields
+ DEBUG_EXCEPTION_CATCH_HANDLER_FOUND = 3,
+ DEBUG_EXCEPTION_FIRST_CHANCE = 1,
+ DEBUG_EXCEPTION_UNHANDLED = 4,
+ DEBUG_EXCEPTION_USER_FIRST_CHANCE = 2
+ }
+
+ public enum CorDebugExceptionUnwindCallbackType
+ {
+ // Fields
+ DEBUG_EXCEPTION_INTERCEPTED = 2,
+ DEBUG_EXCEPTION_UNWIND_BEGIN = 1
+ }
+
+
+ public enum CorDebugRegister
+ {
+ // Fields
+ REGISTER_AMD64_R10 = 11,
+ REGISTER_AMD64_R11 = 12,
+ REGISTER_AMD64_R12 = 13,
+ REGISTER_AMD64_R13 = 14,
+ REGISTER_AMD64_R14 = 15,
+ REGISTER_AMD64_R15 = 0x10,
+ REGISTER_AMD64_R8 = 9,
+ REGISTER_AMD64_R9 = 10,
+ REGISTER_AMD64_RAX = 3,
+ REGISTER_AMD64_RBP = 2,
+ REGISTER_AMD64_RBX = 6,
+ REGISTER_AMD64_RCX = 4,
+ REGISTER_AMD64_RDI = 8,
+ REGISTER_AMD64_RDX = 5,
+ REGISTER_AMD64_RIP = 0,
+ REGISTER_AMD64_RSI = 7,
+ REGISTER_AMD64_RSP = 1,
+ REGISTER_AMD64_XMM0 = 0x11,
+ REGISTER_AMD64_XMM1 = 0x12,
+ REGISTER_AMD64_XMM10 = 0x1b,
+ REGISTER_AMD64_XMM11 = 0x1c,
+ REGISTER_AMD64_XMM12 = 0x1d,
+ REGISTER_AMD64_XMM13 = 30,
+ REGISTER_AMD64_XMM14 = 0x1f,
+ REGISTER_AMD64_XMM15 = 0x20,
+ REGISTER_AMD64_XMM2 = 0x13,
+ REGISTER_AMD64_XMM3 = 20,
+ REGISTER_AMD64_XMM4 = 0x15,
+ REGISTER_AMD64_XMM5 = 0x16,
+ REGISTER_AMD64_XMM6 = 0x17,
+ REGISTER_AMD64_XMM7 = 0x18,
+ REGISTER_AMD64_XMM8 = 0x19,
+ REGISTER_AMD64_XMM9 = 0x1a,
+ REGISTER_FRAME_POINTER = 2,
+ REGISTER_IA64_BSP = 2,
+ REGISTER_IA64_F0 = 0x83,
+ REGISTER_IA64_R0 = 3,
+ REGISTER_INSTRUCTION_POINTER = 0,
+ REGISTER_STACK_POINTER = 1,
+ REGISTER_X86_EAX = 3,
+ REGISTER_X86_EBP = 2,
+ REGISTER_X86_EBX = 6,
+ REGISTER_X86_ECX = 4,
+ REGISTER_X86_EDI = 8,
+ REGISTER_X86_EDX = 5,
+ REGISTER_X86_EIP = 0,
+ REGISTER_X86_ESI = 7,
+ REGISTER_X86_ESP = 1,
+ REGISTER_X86_FPSTACK_0 = 9,
+ REGISTER_X86_FPSTACK_1 = 10,
+ REGISTER_X86_FPSTACK_2 = 11,
+ REGISTER_X86_FPSTACK_3 = 12,
+ REGISTER_X86_FPSTACK_4 = 13,
+ REGISTER_X86_FPSTACK_5 = 14,
+ REGISTER_X86_FPSTACK_6 = 15,
+ REGISTER_X86_FPSTACK_7 = 0x10
+ }
+
+
+
+
+
+ [Flags]
+ public enum CorDebugUserState
+ {
+ // Fields
+ USER_STOP_REQUESTED = 0x01,
+ USER_SUSPEND_REQUESTED = 0x02,
+ USER_BACKGROUND = 0x04,
+ USER_UNSTARTED = 0x08,
+ USER_STOPPED = 0x10,
+ USER_WAIT_SLEEP_JOIN = 0x20,
+ USER_SUSPENDED = 0x40,
+ USER_UNSAFE_POINT = 0x80
+ }
+
+ // [Xamarin] Expression evaluator.
+ [CLSCompliant(true)]
+ [Flags]
+ public enum CorElementType
+ {
+ // Fields
+ ELEMENT_TYPE_ARRAY = 20,
+ ELEMENT_TYPE_BOOLEAN = 2,
+ ELEMENT_TYPE_BYREF = 0x10,
+ ELEMENT_TYPE_CHAR = 3,
+ ELEMENT_TYPE_CLASS = 0x12,
+ ELEMENT_TYPE_CMOD_OPT = 0x20,
+ ELEMENT_TYPE_CMOD_REQD = 0x1f,
+ ELEMENT_TYPE_END = 0,
+ ELEMENT_TYPE_FNPTR = 0x1b,
+ ELEMENT_TYPE_GENERICINST = 0x15,
+ ELEMENT_TYPE_I = 0x18,
+ ELEMENT_TYPE_I1 = 4,
+ ELEMENT_TYPE_I2 = 6,
+ ELEMENT_TYPE_I4 = 8,
+ ELEMENT_TYPE_I8 = 10,
+ ELEMENT_TYPE_INTERNAL = 0x21,
+ ELEMENT_TYPE_MAX = 0x22,
+ ELEMENT_TYPE_MODIFIER = 0x40,
+ ELEMENT_TYPE_MVAR = 0x1e,
+ ELEMENT_TYPE_OBJECT = 0x1c,
+ ELEMENT_TYPE_PINNED = 0x45,
+ ELEMENT_TYPE_PTR = 15,
+ ELEMENT_TYPE_R4 = 12,
+ ELEMENT_TYPE_R8 = 13,
+ ELEMENT_TYPE_SENTINEL = 0x41,
+ ELEMENT_TYPE_STRING = 14,
+ ELEMENT_TYPE_SZARRAY = 0x1d,
+ ELEMENT_TYPE_TYPEDBYREF = 0x16,
+ ELEMENT_TYPE_U = 0x19,
+ ELEMENT_TYPE_U1 = 5,
+ ELEMENT_TYPE_U2 = 7,
+ ELEMENT_TYPE_U4 = 9,
+ ELEMENT_TYPE_U8 = 11,
+ ELEMENT_TYPE_VALUETYPE = 0x11,
+ ELEMENT_TYPE_VAR = 0x13,
+ ELEMENT_TYPE_VOID = 1
+ }
+
+ #region Top-level interfaces
+ [ComImport, Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF"), InterfaceType(1)]
+ public interface ICorDebug
+ {
+ //
+ void Initialize();
+ //
+ void Terminate();
+ //
+ void SetManagedHandler([In, MarshalAs(UnmanagedType.Interface)] ICorDebugManagedCallback pCallback);
+ //
+ void SetUnmanagedHandler([In, MarshalAs(UnmanagedType.Interface)] ICorDebugUnmanagedCallback pCallback);
+ //
+ void CreateProcess([In, MarshalAs(UnmanagedType.LPWStr)] string lpApplicationName, [In, MarshalAs(UnmanagedType.LPWStr)] string lpCommandLine, [In] SECURITY_ATTRIBUTES lpProcessAttributes, [In] SECURITY_ATTRIBUTES lpThreadAttributes, [In] int bInheritHandles, [In] uint dwCreationFlags, [In] IntPtr lpEnvironment, [In, MarshalAs(UnmanagedType.LPWStr)] string lpCurrentDirectory, [In] STARTUPINFO lpStartupInfo, [In] PROCESS_INFORMATION lpProcessInformation, [In] CorDebugCreateProcessFlags debuggingFlags, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+ //
+ void DebugActiveProcess([In] uint id, [In] int win32Attach, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+ //
+ void EnumerateProcesses([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcessEnum ppProcess);
+ //
+ void GetProcess([In] uint dwProcessId, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+ //
+ void CanLaunchOrAttach([In] uint dwProcessId, [In] int win32DebuggingEnabled);
+ }
+
+ [ComImport, CoClass(typeof(CorDebugClass)), Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF")]
+ public interface CorDebug : ICorDebug
+ {
+ }
+
+
+
+ [ComImport, ClassInterface((short)0), Guid("6fef44d0-39e7-4c77-be8e-c9f8cf988630"), TypeLibType((short)2)]
+ public class CorDebugClass : ICorDebug, CorDebug
+ {
+ // Methods
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void CanLaunchOrAttach([In] uint dwProcessId, [In] int win32DebuggingEnabled);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void CreateProcess([In, MarshalAs(UnmanagedType.LPWStr)] string lpApplicationName, [In, MarshalAs(UnmanagedType.LPWStr)] string lpCommandLine, [In] SECURITY_ATTRIBUTES lpProcessAttributes, [In] SECURITY_ATTRIBUTES lpThreadAttributes, [In] int bInheritHandles, [In] uint dwCreationFlags, [In] IntPtr lpEnvironment, [In, MarshalAs(UnmanagedType.LPWStr)] string lpCurrentDirectory, [In] STARTUPINFO lpStartupInfo, [In] PROCESS_INFORMATION lpProcessInformation, [In] CorDebugCreateProcessFlags debuggingFlags, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void DebugActiveProcess([In] uint id, [In] int win32Attach, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void EnumerateProcesses([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcessEnum ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void GetProcess([In] uint dwProcessId, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Initialize();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetManagedHandler([In, MarshalAs(UnmanagedType.Interface)] ICorDebugManagedCallback pCallback);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetUnmanagedHandler([In, MarshalAs(UnmanagedType.Interface)] ICorDebugUnmanagedCallback pCallback);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Terminate();
+ }
+
+ [ComImport, Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF"), CoClass(typeof(CorDebugManagerClass))]
+ public interface CorDebugManager : ICorDebug
+ {
+ }
+
+ [ComImport, ClassInterface((short)0), TypeLibType((short)2), Guid("B76B17EF-16FA-43A3-BABF-DB6E59439EB0")]
+ public class CorDebugManagerClass : ICorDebug, CorDebugManager
+ {
+ // Methods
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void CanLaunchOrAttach([In] uint dwProcessId, [In] int win32DebuggingEnabled);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void CreateProcess([In, MarshalAs(UnmanagedType.LPWStr)] string lpApplicationName, [In, MarshalAs(UnmanagedType.LPWStr)] string lpCommandLine, [In] SECURITY_ATTRIBUTES lpProcessAttributes, [In] SECURITY_ATTRIBUTES lpThreadAttributes, [In] int bInheritHandles, [In] uint dwCreationFlags, [In] IntPtr lpEnvironment, [In, MarshalAs(UnmanagedType.LPWStr)] string lpCurrentDirectory, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] STARTUPINFO lpStartupInfo, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] PROCESS_INFORMATION lpProcessInformation, [In] CorDebugCreateProcessFlags debuggingFlags, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void DebugActiveProcess([In] uint id, [In] int win32Attach, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void EnumerateProcesses([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcessEnum ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void GetProcess([In] uint dwProcessId, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Initialize();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetManagedHandler([In, MarshalAs(UnmanagedType.Interface)] ICorDebugManagedCallback pCallback);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetUnmanagedHandler([In, MarshalAs(UnmanagedType.Interface)] ICorDebugUnmanagedCallback pCallback);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Terminate();
+ }
+
+ [ComImport, Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF"), CoClass(typeof(EmbeddedCLRCorDebugClass))]
+ public interface EmbeddedCLRCorDebug : ICorDebug
+ {
+ }
+
+ [ComImport, TypeLibType(2), Guid("211F1254-BC7E-4AF5-B9AA-067308D83DD1"), ClassInterface((short)0)]
+ public class EmbeddedCLRCorDebugClass : ICorDebug, EmbeddedCLRCorDebug
+ {
+ // Methods
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void CanLaunchOrAttach([In] uint dwProcessId, [In] int win32DebuggingEnabled);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void CreateProcess([In, MarshalAs(UnmanagedType.LPWStr)] string lpApplicationName, [In, MarshalAs(UnmanagedType.LPWStr)] string lpCommandLine, [In] SECURITY_ATTRIBUTES lpProcessAttributes, [In] SECURITY_ATTRIBUTES lpThreadAttributes, [In] int bInheritHandles, [In] uint dwCreationFlags, [In] IntPtr lpEnvironment, [In, MarshalAs(UnmanagedType.LPWStr)] string lpCurrentDirectory, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] STARTUPINFO lpStartupInfo, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] PROCESS_INFORMATION lpProcessInformation, [In] CorDebugCreateProcessFlags debuggingFlags, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void DebugActiveProcess([In] uint id, [In] int win32Attach, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void EnumerateProcesses([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcessEnum ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void GetProcess([In] uint dwProcessId, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Initialize();
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetManagedHandler([In, MarshalAs(UnmanagedType.Interface)] ICorDebugManagedCallback pCallback);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void SetUnmanagedHandler([In, MarshalAs(UnmanagedType.Interface)] ICorDebugUnmanagedCallback pCallback);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void Terminate();
+ }
+ #endregion // Top-level interfaces
+
+ #region AppDomain, Process
+ public enum CorDebugThreadState
+ {
+ THREAD_RUN,
+ THREAD_SUSPEND
+ }
+
+ [ComImport, Guid("3D6F5F62-7538-11D3-8D5B-00104B35E7EF"), InterfaceType(1)]
+ public interface ICorDebugController
+ {
+
+ void Stop([In] uint dwTimeout);
+
+ void Continue([In] int fIsOutOfBand);
+
+ void IsRunning([Out] out int pbRunning);
+
+ void HasQueuedCallbacks([In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [Out] out int pbQueued);
+
+ void EnumerateThreads([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugThreadEnum ppThreads);
+
+ void SetAllThreadsDebugState([In] CorDebugThreadState state, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pExceptThisThread);
+
+ void Detach();
+
+ void Terminate([In] uint exitCode);
+
+ void CanCommitChanges([In] uint cSnapshots, [In, MarshalAs(UnmanagedType.Interface)] ref ICorDebugEditAndContinueSnapshot pSnapshots, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugErrorInfoEnum pError);
+
+ void CommitChanges([In] uint cSnapshots, [In, MarshalAs(UnmanagedType.Interface)] ref ICorDebugEditAndContinueSnapshot pSnapshots, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugErrorInfoEnum pError);
+ }
+
+ [ComImport, ComConversionLoss, InterfaceType(1), Guid("3D6F5F64-7538-11D3-8D5B-00104B35E7EF")]
+ public interface ICorDebugProcess : ICorDebugController
+ {
+
+ new void Stop([In] uint dwTimeout);
+
+ new void Continue([In] int fIsOutOfBand);
+
+ new void IsRunning([Out] out int pbRunning);
+
+ new void HasQueuedCallbacks([In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [Out] out int pbQueued);
+
+ new void EnumerateThreads([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugThreadEnum ppThreads);
+
+ new void SetAllThreadsDebugState([In] CorDebugThreadState state, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pExceptThisThread);
+
+ new void Detach();
+
+ new void Terminate([In] uint exitCode);
+
+ new void CanCommitChanges([In] uint cSnapshots, [In, MarshalAs(UnmanagedType.Interface)] ref ICorDebugEditAndContinueSnapshot pSnapshots, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugErrorInfoEnum pError);
+
+ new void CommitChanges([In] uint cSnapshots, [In, MarshalAs(UnmanagedType.Interface)] ref ICorDebugEditAndContinueSnapshot pSnapshots, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugErrorInfoEnum pError);
+
+
+
+ void GetID([Out] out uint pdwProcessId);
+
+ void GetHandle([Out, ComAliasName("HPROCESS*")] out IntPtr phProcessHandle);
+
+ void GetThread([In] uint dwThreadId, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugThread ppThread);
+
+ void EnumerateObjects([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugObjectEnum ppObjects);
+
+ void IsTransitionStub([In] ulong address, [Out] out int pbTransitionStub);
+
+ void IsOSSuspended([In] uint threadID, [Out] out int pbSuspended);
+
+ void GetThreadContext([In] uint threadID, [In] uint contextSize, [In, ComAliasName("BYTE*")] IntPtr context);
+
+ void SetThreadContext([In] uint threadID, [In] uint contextSize, [In, ComAliasName("BYTE*")] IntPtr context);
+
+ void ReadMemory([In] ulong address, [In] uint size, [Out, MarshalAs(UnmanagedType.LPArray)] byte[] buffer, [Out, ComAliasName("SIZE_T*")] out IntPtr read);
+
+ void WriteMemory([In] ulong address, [In] uint size, [In, MarshalAs(UnmanagedType.LPArray)] byte[] buffer, [Out, ComAliasName("SIZE_T*")] out IntPtr written);
+
+ void ClearCurrentException([In] uint threadID);
+
+ void EnableLogMessages([In] int fOnOff);
+
+ void ModifyLogSwitch([In, MarshalAs(UnmanagedType.LPWStr)] string pLogSwitchName, [In] int lLevel);
+
+ void EnumerateAppDomains([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugAppDomainEnum ppAppDomains);
+
+ void GetObject([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppObject);
+
+ void ThreadForFiberCookie([In] uint fiberCookie, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugThread ppThread);
+
+ void GetHelperThreadID([Out] out uint pThreadID);
+ }
+
+ [ComImport, Guid("AD1B3588-0EF0-4744-A496-AA09A9F80371"), InterfaceType(1), ComConversionLoss]
+ public interface ICorDebugProcess2
+ {
+
+ void GetThreadForTaskID([In] ulong taskid, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugThread2 ppThread);
+
+ void GetVersion([Out] out _COR_VERSION version);
+
+ void SetUnmanagedBreakpoint([In] ulong address, [In] uint bufsize, [Out, MarshalAs(UnmanagedType.LPArray)] byte[] buffer, [Out] out uint bufLen);
+
+ void ClearUnmanagedBreakpoint([In] ulong address);
+
+ void SetDesiredNGENCompilerFlags([In] uint pdwFlags);
+
+ void GetDesiredNGENCompilerFlags([Out] out uint pdwFlags);
+
+ void GetReferenceValueFromGCHandle([In] IntPtr handle, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugReferenceValue pOutValue);
+ }
+
+
+ [ComImport, ComConversionLoss, InterfaceType(1), Guid("CC7BCB05-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugProcessEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugProcess[] processes, [Out] out uint pceltFetched);
+ }
+
+
+
+
+ [ComImport, ComConversionLoss, InterfaceType(1), Guid("3D6F5F63-7538-11D3-8D5B-00104B35E7EF")]
+ public interface ICorDebugAppDomain : ICorDebugController
+ {
+
+ new void Stop([In] uint dwTimeout);
+
+ new void Continue([In] int fIsOutOfBand);
+
+ new void IsRunning([Out] out int pbRunning);
+
+ new void HasQueuedCallbacks([In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [Out] out int pbQueued);
+
+ new void EnumerateThreads([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugThreadEnum ppThreads);
+
+ new void SetAllThreadsDebugState([In] CorDebugThreadState state, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pExceptThisThread);
+
+ new void Detach();
+
+ new void Terminate([In] uint exitCode);
+
+ new void CanCommitChanges([In] uint cSnapshots, [In, MarshalAs(UnmanagedType.Interface)] ref ICorDebugEditAndContinueSnapshot pSnapshots, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugErrorInfoEnum pError);
+
+ new void CommitChanges([In] uint cSnapshots, [In, MarshalAs(UnmanagedType.Interface)] ref ICorDebugEditAndContinueSnapshot pSnapshots, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugErrorInfoEnum pError);
+
+
+
+ void GetProcess([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ void EnumerateAssemblies([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugAssemblyEnum ppAssemblies);
+
+ void GetModuleFromMetaDataInterface([In, MarshalAs(UnmanagedType.IUnknown)] object pIMetaData, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugModule ppModule);
+
+ void EnumerateBreakpoints([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugBreakpointEnum ppBreakpoints);
+
+ void EnumerateSteppers([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugStepperEnum ppSteppers);
+
+ void IsAttached([Out] out int pbAttached);
+
+ void GetName([In] uint cchName, [Out] out uint pcchName, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName);
+
+ void GetObject([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppObject);
+
+ void Attach();
+
+ void GetID([Out] out uint pId);
+ }
+
+ [ComImport, InterfaceType(1), Guid("096E81D5-ECDA-4202-83F5-C65980A9EF75")]
+ public interface ICorDebugAppDomain2
+ {
+
+ void GetArrayOrPointerType([In] CorElementType elementType, [In] uint nRank, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugType pTypeArg, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugType ppType);
+
+ void GetFunctionPointerType([In] uint nTypeArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] ICorDebugType[] ppTypeArgs, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugType ppType);
+ }
+
+ [ComImport, InterfaceType(1), Guid("63CA1B24-4359-4883-BD57-13F815F58744"), ComConversionLoss]
+ public interface ICorDebugAppDomainEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugAppDomain[] values, [Out] out uint pceltFetched);
+ }
+
+ #endregion // AppDomain, Process
+
+
+ #region Assembly
+
+ [ComImport, ComConversionLoss, Guid("DF59507C-D47A-459E-BCE2-6427EAC8FD06"), InterfaceType(1)]
+ public interface ICorDebugAssembly
+ {
+
+ void GetProcess([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ void GetAppDomain([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugAppDomain ppAppDomain);
+
+ void EnumerateModules([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugModuleEnum ppModules);
+
+ void GetCodeBase([In] uint cchName, [Out] out uint pcchName, [MarshalAs(UnmanagedType.LPArray)] char[] szName);
+
+ void GetName([In] uint cchName, [Out] out uint pcchName, [MarshalAs(UnmanagedType.LPArray)] char[] szName);
+ }
+
+ [ComImport, InterfaceType(1), Guid("426D1F9E-6DD4-44C8-AEC7-26CDBAF4E398")]
+ public interface ICorDebugAssembly2
+ {
+
+ void IsFullyTrusted([Out] out int pbFullyTrusted);
+ }
+
+ [ComImport, Guid("4A2A1EC9-85EC-4BFB-9F15-A89FDFE0FE83"), ComConversionLoss, InterfaceType(1)]
+ public interface ICorDebugAssemblyEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugAssembly[] values, [Out] out uint pceltFetched);
+ }
+ #endregion Assembly
+
+
+ #region Execution Control
+
+ #region Breakpoints
+ [ComImport, InterfaceType(1), Guid("CC7BCAE8-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugBreakpoint
+ {
+
+ void Activate([In] int bActive);
+
+ void IsActive([Out] out int pbActive);
+ }
+
+ [ComImport, Guid("CC7BCB03-8A68-11D2-983C-0000F808342D"), ComConversionLoss, InterfaceType(1)]
+ public interface ICorDebugBreakpointEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugBreakpoint[] breakpoints, [Out] out uint pceltFetched);
+ }
+
+ [ComImport, Guid("CC7BCAE9-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugFunctionBreakpoint : ICorDebugBreakpoint
+ {
+
+ new void Activate([In] int bActive);
+
+ new void IsActive([Out] out int pbActive);
+
+
+ void GetFunction([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ void GetOffset([Out] out uint pnOffset);
+ }
+
+ #endregion Breakpoints
+
+ #region Stepping
+ [Flags]
+ public enum CorDebugUnmappedStop
+ {
+ // Fields
+ STOP_ALL = 0xffff,
+ STOP_NONE = 0,
+ STOP_PROLOG = 1,
+ STOP_EPILOG = 2,
+ STOP_NO_MAPPING_INFO = 4,
+ STOP_OTHER_UNMAPPED = 8,
+ STOP_UNMANAGED = 0x10
+ }
+
+ public enum CorDebugStepReason
+ {
+ STEP_NORMAL,
+ STEP_RETURN,
+ STEP_CALL,
+ STEP_EXCEPTION_FILTER,
+ STEP_EXCEPTION_HANDLER,
+ STEP_INTERCEPT,
+ STEP_EXIT
+ }
+ [Flags]
+ public enum CorDebugIntercept
+ {
+ // Fields
+ INTERCEPT_NONE = 0,
+ INTERCEPT_ALL = 0xffff,
+ INTERCEPT_CLASS_INIT = 1,
+ INTERCEPT_EXCEPTION_FILTER = 2,
+ INTERCEPT_SECURITY = 4,
+ INTERCEPT_CONTEXT_POLICY = 8,
+ INTERCEPT_INTERCEPTION = 0x10,
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ public struct COR_DEBUG_STEP_RANGE
+ {
+ public uint startOffset;
+ public uint endOffset;
+ }
+
+ [ComImport, Guid("CC7BCAEC-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugStepper
+ {
+
+ void IsActive([Out] out int pbActive);
+
+ void Deactivate();
+
+ void SetInterceptMask([In] CorDebugIntercept mask);
+
+ void SetUnmappedStopMask([In] CorDebugUnmappedStop mask);
+
+ void Step([In] int bStepIn);
+
+ void StepRange([In] int bStepIn, [In, MarshalAs(UnmanagedType.LPArray)] COR_DEBUG_STEP_RANGE[] ranges, [In] uint cRangeCount);
+
+ void StepOut();
+
+ void SetRangeIL([In] int bIL);
+ }
+
+ [ComImport, Guid("C5B6E9C3-E7D1-4A8E-873B-7F047F0706F7"), InterfaceType(1)]
+ public interface ICorDebugStepper2
+ {
+
+ void SetJMC([In] int fIsJMCStepper);
+ }
+
+ [ComImport, ComConversionLoss, Guid("CC7BCB04-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugStepperEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugStepper[] steppers, [Out] out uint pceltFetched);
+ }
+
+ #endregion
+
+ #endregion Execution Control
+
+
+ #region Class, Type
+
+ [ComImport, Guid("CC7BCAF5-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugClass
+ {
+
+ void GetModule([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugModule pModule);
+
+ void GetToken([Out] out uint pTypeDef);
+
+ void GetStaticFieldValue([In] uint fieldDef, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugFrame pFrame, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+ }
+
+ [ComImport, Guid("B008EA8D-7AB1-43F7-BB20-FBB5A04038AE"), InterfaceType(1)]
+ public interface ICorDebugClass2
+ {
+
+ void GetParameterizedType([In] CorElementType elementType, [In] uint nTypeArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ICorDebugType[] ppTypeArgs, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugType ppType);
+
+ void SetJMCStatus([In] int bIsJustMyCode);
+ }
+
+ [ComImport, Guid("D613F0BB-ACE1-4C19-BD72-E4C08D5DA7F5"), InterfaceType(1)]
+ public interface ICorDebugType
+ {
+
+ void GetType([Out] out CorElementType ty);
+
+
+ void GetClass([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugClass ppClass);
+
+
+ void EnumerateTypeParameters([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugTypeEnum ppTyParEnum);
+
+ void GetFirstTypeParameter([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugType value);
+
+ void GetBase([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugType pBase);
+
+ void GetStaticFieldValue([In] uint fieldDef, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugFrame pFrame, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetRank([Out] out uint pnRank);
+ }
+
+ [ComImport, Guid("10F27499-9DF2-43CE-8333-A321D7C99CB4"), InterfaceType(1), ComConversionLoss]
+ public interface ICorDebugTypeEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugType[] values, [Out] out uint pceltFetched);
+ }
+
+
+ #endregion // Class, Type
+
+
+ #region Code and Function
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ public struct COR_DEBUG_IL_TO_NATIVE_MAP
+ {
+ public uint ilOffset;
+ public uint nativeStartOffset;
+ public uint nativeEndOffset;
+ }
+
+ [ComImport, InterfaceType(1), Guid("CC7BCAF4-8A68-11D2-983C-0000F808342D"), ComConversionLoss]
+ public interface ICorDebugCode
+ {
+
+ void IsIL([Out] out int pbIL);
+
+ void GetFunction([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ void GetAddress([Out] out ulong pStart);
+
+ void GetSize([Out] out uint pcBytes);
+
+ void CreateBreakpoint([In] uint offset, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunctionBreakpoint ppBreakpoint);
+
+
+ void GetCode([In] uint startOffset, [In] uint endOffset, [In] uint cBufferAlloc, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] byte[] buffer, [Out] out uint pcBufferSize);
+
+ void GetVersionNumber([Out] out uint nVersion);
+
+ void GetILToNativeMapping([In] uint cMap, [Out] out uint pcMap, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] COR_DEBUG_IL_TO_NATIVE_MAP[] map);
+
+ void GetEnCRemapSequencePoints([In] uint cMap, [Out] out uint pcMap, [Out, MarshalAs(UnmanagedType.LPArray)] uint[] offsets);
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 8)]
+ public struct _CodeChunkInfo
+ {
+ public ulong startAddr;
+ public uint length;
+ }
+
+ [ComImport, ComConversionLoss, Guid("5F696509-452F-4436-A3FE-4D11FE7E2347"), InterfaceType(1)]
+ public interface ICorDebugCode2
+ {
+
+ void GetCodeChunks([In] uint cbufSize, [Out] out uint pcnumChunks, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] _CodeChunkInfo[] chunks);
+
+ void GetCompilerFlags([Out] out uint pdwFlags);
+ }
+
+ [ComImport, Guid("55E96461-9645-45E4-A2FF-0367877ABCDE"), InterfaceType(1), ComConversionLoss]
+ public interface ICorDebugCodeEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugCode[] values, [Out] out uint pceltFetched);
+ }
+
+ [ComImport, Guid("CC7BCAF3-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugFunction
+ {
+
+ void GetModule([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugModule ppModule);
+
+ void GetClass([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugClass ppClass);
+
+ void GetToken([Out] out uint pMethodDef);
+
+ void GetILCode([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugCode ppCode);
+
+ void GetNativeCode([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugCode ppCode);
+
+ void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunctionBreakpoint ppBreakpoint);
+
+ void GetLocalVarSigToken([Out] out uint pmdSig);
+
+ void GetCurrentVersionNumber([Out] out uint pnCurrentVersion);
+ }
+
+ [ComImport, InterfaceType(1), Guid("EF0C490B-94C3-4E4D-B629-DDC134C532D8")]
+ public interface ICorDebugFunction2
+ {
+
+ void SetJMCStatus([In] int bIsJustMyCode);
+
+ void GetJMCStatus([Out] out int pbIsJustMyCode);
+
+ void EnumerateNativeCode([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugCodeEnum ppCodeEnum);
+
+ void GetVersionNumber([Out] out uint pnVersion);
+ }
+
+
+ #endregion Code and Function
+
+
+ #region Deprecated
+ //
+ // These interfaces are not used
+ //
+
+ [ComImport, InterfaceType(1), Guid("CC7BCB00-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugContext : ICorDebugObjectValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ new void GetClass([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugClass ppClass);
+
+ new void GetFieldValue([In, MarshalAs(UnmanagedType.Interface)] ICorDebugClass pClass, [In] uint fieldDef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ new void GetVirtualMethod([In] uint memberRef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ new void GetContext([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugContext ppContext);
+
+ new void IsValueClass([Out] out int pbIsValueClass);
+
+ new void GetManagedCopy([Out, MarshalAs(UnmanagedType.IUnknown)] out object ppObject);
+
+ new void SetFromManagedCopy([In, MarshalAs(UnmanagedType.IUnknown)] object pObject);
+ }
+
+ [ComImport, InterfaceType(1), Guid("6DC3FA01-D7CB-11D2-8A95-0080C792E5D8")]
+ public interface ICorDebugEditAndContinueSnapshot
+ {
+
+ void CopyMetaData([In, MarshalAs(UnmanagedType.Interface)] IStream pIStream, [Out] out Guid pMvid);
+
+ void GetMvid([Out] out Guid pMvid);
+
+ void GetRoDataRVA([Out] out uint pRoDataRVA);
+
+ void GetRwDataRVA([Out] out uint pRwDataRVA);
+
+ void SetPEBytes([In, MarshalAs(UnmanagedType.Interface)] IStream pIStream);
+
+ void SetILMap([In] uint mdFunction, [In] uint cMapSize, [In] ref COR_IL_MAP map);
+
+ void SetPESymbolBytes([In, MarshalAs(UnmanagedType.Interface)] IStream pIStream);
+ }
+
+ [ComImport, ComConversionLoss, InterfaceType(1), Guid("F0E18809-72B5-11D2-976F-00A0C9B4D50C")]
+ public interface ICorDebugErrorInfoEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, ComAliasName("ICorDebugEditAndContinueErrorInfo**")] IntPtr errors, [Out] out uint pceltFetched);
+ }
+ #endregion Deprecated
+
+
+
+ [ComImport, InterfaceType(1), Guid("CC7BCB01-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugEnum
+ {
+
+ void Skip([In] uint celt);
+
+ void Reset();
+
+ void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ void GetCount([Out] out uint pcelt);
+ }
+
+
+
+ #region Function Evaluation
+ [ComImport, InterfaceType(1), Guid("CC7BCAF6-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugEval
+ {
+
+ void CallFunction([In, MarshalAs(UnmanagedType.Interface)] ICorDebugFunction pFunction, [In] uint nArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ICorDebugValue[] ppArgs);
+
+ void NewObject([In, MarshalAs(UnmanagedType.Interface)] ICorDebugFunction pConstructor, [In] uint nArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ICorDebugValue[] ppArgs);
+
+ void NewObjectNoConstructor([In, MarshalAs(UnmanagedType.Interface)] ICorDebugClass pClass);
+
+ void NewString([In, MarshalAs(UnmanagedType.LPWStr)] string @string);
+
+ void NewArray([In] CorElementType elementType, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugClass pElementClass, [In] uint rank, [In] ref uint dims, [In] ref uint lowBounds);
+
+ void IsActive([Out] out int pbActive);
+
+ void Abort();
+
+ void GetResult([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppResult);
+
+ void GetThread([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugThread ppThread);
+
+ void CreateValue([In] CorElementType elementType, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugClass pElementClass, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+ }
+
+ [ComImport, Guid("FB0D9CE7-BE66-4683-9D32-A42A04E2FD91"), InterfaceType(1)]
+ public interface ICorDebugEval2
+ {
+
+ void CallParameterizedFunction([In, MarshalAs(UnmanagedType.Interface)] ICorDebugFunction pFunction, [In] uint nTypeArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ICorDebugType[] ppTypeArgs, [In] uint nArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] ICorDebugValue[] ppArgs);
+
+ void CreateValueForType([In, MarshalAs(UnmanagedType.Interface)] ICorDebugType pType, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void NewParameterizedObject([In, MarshalAs(UnmanagedType.Interface)] ICorDebugFunction pConstructor, [In] uint nTypeArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ICorDebugType[] ppTypeArgs, [In] uint nArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] ICorDebugValue[] ppArgs);
+
+ void NewParameterizedObjectNoConstructor([In, MarshalAs(UnmanagedType.Interface)] ICorDebugClass pClass, [In] uint nTypeArgs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] ICorDebugType[] ppTypeArgs);
+
+ void NewParameterizedArray([In, MarshalAs(UnmanagedType.Interface)] ICorDebugType pElementType, [In] uint rank, [In] ref uint dims, [In] ref uint lowBounds);
+
+ void NewStringWithLength([In, MarshalAs(UnmanagedType.LPWStr)] string @string, [In] uint uiLength);
+
+ void RudeAbort();
+ }
+ #endregion Function Evaluation
+
+
+
+ #region ICorDebugValue
+
+ [ComImport, Guid("CC7BCAF7-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugValue
+ {
+
+ void GetType([Out] out CorElementType pType);
+
+ void GetSize([Out] out uint pSize);
+
+ void GetAddress([Out] out ulong pAddress);
+
+ void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+ }
+
+ [ComImport, Guid("5E0B54E7-D88A-4626-9420-A691E0A78B49"), InterfaceType(1)]
+ public interface ICorDebugValue2
+ {
+
+ void GetExactType([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugType ppType);
+ }
+
+ [ComImport, InterfaceType(1), Guid("CC7BCAF8-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugGenericValue : ICorDebugValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ void GetValue([Out] IntPtr pTo);
+
+ void SetValue([In] IntPtr pFrom);
+ }
+
+ [ComImport, InterfaceType(1), Guid("CC7BCAF9-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugReferenceValue : ICorDebugValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ void IsNull([Out] out int pbNull);
+
+ void GetValue([Out] out ulong pValue);
+
+ void SetValue([In] ulong value);
+
+ void Dereference([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void DereferenceStrong([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+ }
+
+
+ public enum CorDebugHandleType
+ {
+ // Fields
+ HANDLE_STRONG = 1,
+ HANDLE_WEAK_TRACK_RESURRECTION = 2
+ }
+
+ [ComImport, Guid("029596E8-276B-46A1-9821-732E96BBB00B"), InterfaceType(1)]
+ public interface ICorDebugHandleValue : ICorDebugReferenceValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ new void IsNull([Out] out int pbNull);
+
+ new void GetValue([Out] out ulong pValue);
+
+ new void SetValue([In] ulong value);
+
+ new void Dereference([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ new void DereferenceStrong([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+
+ void GetHandleType([Out] out CorDebugHandleType pType);
+
+ void Dispose();
+ }
+
+ [ComImport, Guid("CC7BCAFA-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugHeapValue : ICorDebugValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+
+ void IsValid([Out] out int pbValid);
+
+ void CreateRelocBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+ }
+
+ [ComImport, InterfaceType(1), Guid("E3AC4D6C-9CB7-43E6-96CC-B21540E5083C")]
+ public interface ICorDebugHeapValue2
+ {
+
+ void CreateHandle([In] CorDebugHandleType type, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugHandleValue ppHandle);
+ }
+
+ [ComImport, InterfaceType(1), Guid("CC7BCAFC-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugBoxValue : ICorDebugHeapValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ new void IsValid([Out] out int pbValid);
+
+
+ new void CreateRelocBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ void GetObject([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugObjectValue ppObject);
+ }
+
+ [ComImport, ComConversionLoss, Guid("0405B0DF-A660-11D2-BD02-0000F80849BD"), InterfaceType(1)]
+ public interface ICorDebugArrayValue : ICorDebugHeapValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ new void IsValid([Out] out int pbValid);
+
+
+ new void CreateRelocBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ void GetElementType([Out] out CorElementType pType);
+
+ void GetRank([Out] out uint pnRank);
+
+ void GetCount([Out] out uint pnCount);
+
+ void GetDimensions([In] uint cdim, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] dims);
+
+ void HasBaseIndicies([Out] out int pbHasBaseIndicies);
+
+ void GetBaseIndicies([In] uint cdim, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] indicies);
+
+ void GetElement([In] uint cdim, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] int[] indices, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetElementAtPosition([In] uint nPosition, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+ }
+
+
+
+
+ [ComImport, InterfaceType(1), Guid("CC7BCAEB-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugValueBreakpoint : ICorDebugBreakpoint
+ {
+
+ new void Activate([In] int bActive);
+
+ new void IsActive([Out] out int pbActive);
+
+
+ void GetValue([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+ }
+
+ [ComImport, ComConversionLoss, Guid("CC7BCB0A-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugValueEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugValue[] values, [Out] out uint pceltFetched);
+ }
+
+
+ [ComImport, Guid("CC7BCAFD-8A68-11D2-983C-0000F808342D"), ComConversionLoss, InterfaceType(1)]
+ public interface ICorDebugStringValue : ICorDebugHeapValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ new void IsValid([Out] out int pbValid);
+
+ new void CreateRelocBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ void GetLength([Out] out uint pcchString);
+
+ void GetString([In] uint cchString, [Out] out uint pcchString, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szString);
+ }
+
+
+
+ [ComImport, InterfaceType(1), Guid("18AD3D6E-B7D2-11D2-BD04-0000F80849BD")]
+ public interface ICorDebugObjectValue : ICorDebugValue
+ {
+
+ new void GetType([Out] out CorElementType pType);
+
+ new void GetSize([Out] out uint pSize);
+
+ new void GetAddress([Out] out ulong pAddress);
+
+ new void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueBreakpoint ppBreakpoint);
+
+
+ void GetClass([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugClass ppClass);
+
+ void GetFieldValue([In, MarshalAs(UnmanagedType.Interface)] ICorDebugClass pClass, [In] uint fieldDef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetVirtualMethod([In] uint memberRef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ void GetContext([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugContext ppContext);
+
+ void IsValueClass([Out] out int pbIsValueClass);
+
+ void GetManagedCopy([Out, MarshalAs(UnmanagedType.IUnknown)] out object ppObject);
+
+ void SetFromManagedCopy([In, MarshalAs(UnmanagedType.IUnknown)] object pObject);
+ }
+
+ [ComImport, Guid("49E4A320-4A9B-4ECA-B105-229FB7D5009F"), InterfaceType(1)]
+ public interface ICorDebugObjectValue2
+ {
+
+ void GetVirtualMethodAndType([In] uint memberRef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugType ppType);
+ }
+
+ [ComImport, ComConversionLoss, Guid("CC7BCB02-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugObjectEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ulong[] objects, [Out] out uint pceltFetched);
+ }
+
+ #endregion // ICorDebugValue
+
+ #region Frames and Chains
+
+ #region Chains
+ public enum CorDebugChainReason
+ {
+ // Fields
+ CHAIN_CLASS_INIT = 1,
+ CHAIN_CONTEXT_POLICY = 8,
+ CHAIN_CONTEXT_SWITCH = 0x400,
+ CHAIN_DEBUGGER_EVAL = 0x200,
+ CHAIN_ENTER_MANAGED = 0x80,
+ CHAIN_ENTER_UNMANAGED = 0x100,
+ CHAIN_EXCEPTION_FILTER = 2,
+ CHAIN_FUNC_EVAL = 0x800,
+ CHAIN_INTERCEPTION = 0x10,
+ CHAIN_NONE = 0,
+ CHAIN_PROCESS_START = 0x20,
+ CHAIN_SECURITY = 4,
+ CHAIN_THREAD_START = 0x40
+ }
+
+ [ComImport, Guid("CC7BCAEE-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugChain
+ {
+
+ void GetThread([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugThread ppThread);
+
+ void GetStackRange([Out] out ulong pStart, [Out] out ulong pEnd);
+
+ void GetContext([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugContext ppContext);
+
+ void GetCaller([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ void GetCallee([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ void GetPrevious([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ void GetNext([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ void IsManaged([Out] out int pManaged);
+
+ void EnumerateFrames([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrameEnum ppFrames);
+
+ void GetActiveFrame([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ void GetRegisterSet([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugRegisterSet ppRegisters);
+
+ void GetReason([Out] out CorDebugChainReason pReason);
+ }
+
+ [ComImport, InterfaceType(1), ComConversionLoss, Guid("CC7BCB08-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugChainEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugChain[] chains, [Out] out uint pceltFetched);
+ }
+ #endregion // end Chains
+
+
+
+
+ [ComImport, Guid("CC7BCAEF-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugFrame
+ {
+
+ void GetChain([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ void GetCode([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugCode ppCode);
+
+ void GetFunction([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ void GetFunctionToken([Out] out uint pToken);
+
+ void GetStackRange([Out] out ulong pStart, [Out] out ulong pEnd);
+
+ void GetCaller([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ void GetCallee([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ void CreateStepper([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugStepper ppStepper);
+ }
+
+ [ComImport, ComConversionLoss, Guid("CC7BCB07-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugFrameEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugFrame[] frames, [Out] out uint pceltFetched);
+ }
+
+
+ [ComImport, InterfaceType(1), Guid("03E26314-4F76-11D3-88C6-006097945418")]
+ public interface ICorDebugNativeFrame : ICorDebugFrame
+ {
+
+ new void GetChain([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ new void GetCode([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugCode ppCode);
+
+ new void GetFunction([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ new void GetFunctionToken([Out] out uint pToken);
+
+ new void GetStackRange([Out] out ulong pStart, [Out] out ulong pEnd);
+
+ new void GetCaller([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ new void GetCallee([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ new void CreateStepper([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugStepper ppStepper);
+
+
+
+ void GetIP([Out] out uint pnOffset);
+
+ void SetIP([In] uint nOffset);
+
+ void GetRegisterSet([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugRegisterSet ppRegisters);
+
+ void GetLocalRegisterValue([In] CorDebugRegister reg, [In] uint cbSigBlob, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] uint pvSigBlob, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetLocalDoubleRegisterValue([In] CorDebugRegister highWordReg, [In] CorDebugRegister lowWordReg, [In] uint cbSigBlob, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] uint pvSigBlob, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetLocalMemoryValue([In] ulong address, [In] uint cbSigBlob, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] uint pvSigBlob, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetLocalRegisterMemoryValue([In] CorDebugRegister highWordReg, [In] ulong lowWordAddress, [In] uint cbSigBlob, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] uint pvSigBlob, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetLocalMemoryRegisterValue([In] ulong highWordAddress, [In] CorDebugRegister lowWordRegister, [In] uint cbSigBlob, [In, ComAliasName("Microsoft.Debugging.CorDebug.NativeApi.ULONG_PTR")] uint pvSigBlob, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int CanSetIP([In] uint nOffset);
+ }
+
+
+ public enum CorDebugMappingResult
+ {
+ // Fields
+ MAPPING_APPROXIMATE = 0x20,
+ MAPPING_EPILOG = 2,
+ MAPPING_EXACT = 0x10,
+ MAPPING_NO_INFO = 4,
+ MAPPING_PROLOG = 1,
+ MAPPING_UNMAPPED_ADDRESS = 8
+ }
+
+
+ [ComImport, InterfaceType(1), Guid("03E26311-4F76-11D3-88C6-006097945418")]
+ public interface ICorDebugILFrame : ICorDebugFrame
+ {
+
+ new void GetChain([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ new void GetCode([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugCode ppCode);
+
+ new void GetFunction([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ new void GetFunctionToken([Out] out uint pToken);
+
+ new void GetStackRange([Out] out ulong pStart, [Out] out ulong pEnd);
+
+ new void GetCaller([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ new void GetCallee([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+
+ new void CreateStepper([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugStepper ppStepper);
+
+
+ void GetIP([Out] out uint pnOffset, [Out] out CorDebugMappingResult pMappingResult);
+
+ void SetIP([In] uint nOffset);
+
+ void EnumerateLocalVariables([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueEnum ppValueEnum);
+
+ void GetLocalVariable([In] uint dwIndex, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void EnumerateArguments([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValueEnum ppValueEnum);
+
+ void GetArgument([In] uint dwIndex, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetStackDepth([Out] out uint pDepth);
+
+ void GetStackValue([In] uint dwIndex, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int CanSetIP([In] uint nOffset);
+ }
+
+ [ComImport, InterfaceType(1), Guid("5D88A994-6C30-479B-890F-BCEF88B129A5")]
+ public interface ICorDebugILFrame2
+ {
+
+ void RemapFunction([In] uint newILOffset);
+
+ void EnumerateTypeParameters([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugTypeEnum ppTyParEnum);
+ }
+
+ public enum CorDebugInternalFrameType
+ {
+ STUBFRAME_NONE,
+ STUBFRAME_M2U,
+ STUBFRAME_U2M,
+ STUBFRAME_APPDOMAIN_TRANSITION,
+ STUBFRAME_LIGHTWEIGHT_FUNCTION,
+ STUBFRAME_FUNC_EVAL,
+ STUBFRAME_INTERNALCALL,
+ }
+
+ [ComImport, InterfaceType(1), Guid("B92CC7F7-9D2D-45C4-BC2B-621FCC9DFBF4")]
+ public interface ICorDebugInternalFrame : ICorDebugFrame
+ {
+
+ new void GetChain([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ new void GetCode([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugCode ppCode);
+
+ new void GetFunction([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ new void GetFunctionToken([Out] out uint pToken);
+
+ new void GetStackRange([Out] out ulong pStart, [Out] out ulong pEnd);
+
+ new void GetCaller([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ new void GetCallee([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ new void CreateStepper([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugStepper ppStepper);
+
+ void GetFrameType([Out] out CorDebugInternalFrameType pType);
+ }
+
+ #endregion // Frames
+
+ #region Callbacks
+
+ // Unmanaged callback is only used for Interop-debugging to dispatch native debug events.
+ [ComImport, Guid("5263E909-8CB5-11D3-BD2F-0000F80849BD"), InterfaceType(1)]
+ public interface ICorDebugUnmanagedCallback
+ {
+ void DebugEvent([In] IntPtr pDebugEvent, [In] int fOutOfBand);
+ }
+
+ [ComImport, Guid("3D6F5F60-7538-11D3-8D5B-00104B35E7EF"), InterfaceType(1)]
+ public interface ICorDebugManagedCallback
+ {
+
+ void Breakpoint([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugBreakpoint pBreakpoint);
+
+
+ void StepComplete([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugStepper pStepper, [In] CorDebugStepReason reason);
+
+
+ void Break([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread thread);
+
+
+ void Exception([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In] int unhandled);
+
+
+ void EvalComplete([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugEval pEval);
+
+
+ void EvalException([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugEval pEval);
+
+
+ void CreateProcess([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess);
+
+
+ void ExitProcess([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess);
+
+
+ void CreateThread([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread thread);
+
+
+ void ExitThread([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread thread);
+
+
+ void LoadModule([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugModule pModule);
+
+
+ void UnloadModule([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugModule pModule);
+
+
+ void LoadClass([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugClass c);
+
+
+ void UnloadClass([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugClass c);
+
+
+ void DebuggerError([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess, [In, MarshalAs(UnmanagedType.Error)] int errorHR, [In] uint errorCode);
+
+
+ void LogMessage([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In] int lLevel, [In, MarshalAs(UnmanagedType.LPWStr)] string pLogSwitchName, [In, MarshalAs(UnmanagedType.LPWStr)] string pMessage);
+
+
+ void LogSwitch([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In] int lLevel, [In] uint ulReason, [In, MarshalAs(UnmanagedType.LPWStr)] string pLogSwitchName, [In, MarshalAs(UnmanagedType.LPWStr)] string pParentName);
+
+
+ void CreateAppDomain([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain);
+
+
+ void ExitAppDomain([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain);
+
+
+ void LoadAssembly([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugAssembly pAssembly);
+
+
+ void UnloadAssembly([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugAssembly pAssembly);
+
+
+ void ControlCTrap([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess);
+
+
+ void NameChange([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread);
+
+
+ void UpdateModuleSymbols([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugModule pModule, [In, MarshalAs(UnmanagedType.Interface)] IStream pSymbolStream);
+
+
+ void EditAndContinueRemap([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugFunction pFunction, [In] int fAccurate);
+
+
+ void BreakpointSetError([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugBreakpoint pBreakpoint, [In] uint dwError);
+ }
+
+ [ComImport, Guid("250E5EEA-DB5C-4C76-B6F3-8C46F12E3203"), InterfaceType(1)]
+ public interface ICorDebugManagedCallback2
+ {
+
+ void FunctionRemapOpportunity([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugFunction pOldFunction, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugFunction pNewFunction, [In] uint oldILOffset);
+
+
+ void CreateConnection([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess, [In] uint dwConnectionId, [In] ref ushort pConnName);
+
+
+ void ChangeConnection([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess, [In] uint dwConnectionId);
+
+
+ void DestroyConnection([In, MarshalAs(UnmanagedType.Interface)] ICorDebugProcess pProcess, [In] uint dwConnectionId);
+
+
+ void Exception([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugFrame pFrame, [In] uint nOffset, [In] CorDebugExceptionCallbackType dwEventType, [In] uint dwFlags);
+
+
+ void ExceptionUnwind([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In] CorDebugExceptionUnwindCallbackType dwEventType, [In] uint dwFlags);
+
+
+ void FunctionRemapComplete([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugFunction pFunction);
+
+
+ void MDANotification([In, MarshalAs(UnmanagedType.Interface)] ICorDebugController pController, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugMDA pMDA);
+ }
+#endregion // Callbacks
+
+ #region Module
+ [ComImport, ComConversionLoss, InterfaceType(1), Guid("DBA2D8C1-E5C5-4069-8C13-10A7C6ABF43D")]
+ public interface ICorDebugModule
+ {
+
+ void GetProcess([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ void GetBaseAddress([Out] out ulong pAddress);
+
+ void GetAssembly([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugAssembly ppAssembly);
+
+ void GetName([In] uint cchName, [Out] out uint pcchName, [MarshalAs(UnmanagedType.LPArray)] char[] szName);
+
+ void EnableJITDebugging([In] int bTrackJITInfo, [In] int bAllowJitOpts);
+
+ void EnableClassLoadCallbacks([In] int bClassLoadCallbacks);
+
+ void GetFunctionFromToken([In] uint methodDef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ void GetFunctionFromRVA([In] ulong rva, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFunction ppFunction);
+
+ void GetClassFromToken([In] uint typeDef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugClass ppClass);
+
+ void CreateBreakpoint([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugModuleBreakpoint ppBreakpoint);
+
+ void GetEditAndContinueSnapshot([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEditAndContinueSnapshot ppEditAndContinueSnapshot);
+
+
+
+ void GetMetaDataInterface([In, ComAliasName("REFIID")] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IMetadataImport ppObj);
+
+
+ void GetToken([Out] out uint pToken);
+
+ void IsDynamic([Out] out int pDynamic);
+
+ void GetGlobalVariableValue([In] uint fieldDef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppValue);
+
+ void GetSize([Out] out uint pcBytes);
+
+ void IsInMemory([Out] out int pInMemory);
+ }
+
+ [ComImport, InterfaceType(1), Guid("7FCC5FB5-49C0-41DE-9938-3B88B5B9ADD7")]
+ public interface ICorDebugModule2
+ {
+
+ void SetJMCStatus([In] int bIsJustMyCode, [In] uint cTokens, [In] ref uint pTokens);
+
+ void ApplyChanges([In] uint cbMetadata, [In, MarshalAs(UnmanagedType.LPArray)] byte[] pbMetadata, [In] uint cbIL, [In, MarshalAs(UnmanagedType.LPArray)] byte[] pbIL);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int SetJITCompilerFlags([In] uint dwFlags);
+
+ void GetJITCompilerFlags([Out] out uint pdwFlags);
+
+ void ResolveAssembly([In] uint tkAssemblyRef, [Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugAssembly ppAssembly);
+ }
+
+ [ComImport, Guid("CC7BCAEA-8A68-11D2-983C-0000F808342D"), InterfaceType(1)]
+ public interface ICorDebugModuleBreakpoint : ICorDebugBreakpoint
+ {
+
+ new void Activate([In] int bActive);
+
+ new void IsActive([Out] out int pbActive);
+
+
+ void GetModule([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugModule ppModule);
+ }
+
+ [ComImport, InterfaceType(1), ComConversionLoss, Guid("CC7BCB09-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugModuleEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugModule[] modules, [Out] out uint pceltFetched);
+ }
+
+
+ #endregion Module
+
+
+
+
+ #region MDA
+ [CLSCompliant(true)]
+ [Flags]
+ public enum CorDebugMDAFlags
+ {
+ // Fields
+ None = 0,
+ MDA_FLAG_SLIP = 2
+ }
+
+ [ComImport, Guid("CC726F2F-1DB7-459B-B0EC-05F01D841B42"), InterfaceType(1)]
+ public interface ICorDebugMDA
+ {
+
+ void GetName([In] uint cchName, [Out] out uint pcchName, [MarshalAs(UnmanagedType.LPArray)] char[] szName);
+
+
+ void GetDescription([In] uint cchName, [Out] out uint pcchName, [MarshalAs(UnmanagedType.LPArray)] char[] szName);
+
+
+ void GetXML([In] uint cchName, [Out] out uint pcchName, [MarshalAs(UnmanagedType.LPArray)] char[] szName);
+
+
+ void GetFlags([Out] out CorDebugMDAFlags pFlags);
+
+
+ void GetOSThreadId([Out] out uint pOsTid);
+ }
+ #endregion // MDA
+
+ [ComImport, Guid("CC7BCB0B-8A68-11D2-983C-0000F808342D"), ComConversionLoss, InterfaceType(1)]
+ public interface ICorDebugRegisterSet
+ {
+
+ void GetRegistersAvailable([Out] out ulong pAvailable);
+
+
+ void GetRegisters([In] ulong mask, [In] uint regCount, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] ulong[] regBuffer);
+
+
+ void SetRegisters([In] ulong mask, [In] uint regCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] ulong[] regBuffer);
+
+
+ void GetThreadContext([In] uint contextSize, [In, ComAliasName("BYTE*")] IntPtr context);
+
+
+ void SetThreadContext([In] uint contextSize, [In, ComAliasName("BYTE*")] IntPtr context);
+ }
+
+ #region Threads
+ [ComImport, Guid("938C6D66-7FB6-4F69-B389-425B8987329B"), InterfaceType(1)]
+ public interface ICorDebugThread
+ {
+
+ void GetProcess([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugProcess ppProcess);
+
+ void GetID([Out] out uint pdwThreadId);
+
+ void GetHandle([Out] out IntPtr phThreadHandle);
+
+ void GetAppDomain([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugAppDomain ppAppDomain);
+
+ void SetDebugState([In] CorDebugThreadState state);
+
+ void GetDebugState([Out] out CorDebugThreadState pState);
+
+ void GetUserState([Out] out CorDebugUserState pState);
+
+ void GetCurrentException([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppExceptionObject);
+
+ void ClearCurrentException();
+
+ void CreateStepper([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugStepper ppStepper);
+
+ void EnumerateChains([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChainEnum ppChains);
+
+ void GetActiveChain([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugChain ppChain);
+
+ void GetActiveFrame([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugFrame ppFrame);
+
+ void GetRegisterSet([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugRegisterSet ppRegisters);
+
+ void CreateEval([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEval ppEval);
+
+ void GetObject([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugValue ppObject);
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 4)]
+ public struct COR_ACTIVE_FUNCTION
+ {
+ public ICorDebugAppDomain pAppDomain;
+ public ICorDebugModule pModule;
+ public ICorDebugFunction2 pFunction;
+ public uint ilOffset;
+ public uint Flags;
+ }
+
+
+ [ComImport, Guid("2BD956D9-7B07-4BEF-8A98-12AA862417C5"), ComConversionLoss, InterfaceType(1)]
+ public interface ICorDebugThread2
+ {
+
+ void GetActiveFunctions([In] uint cFunctions, [Out] out uint pcFunctions, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] COR_ACTIVE_FUNCTION[] pFunctions);
+
+ void GetConnectionID([Out] out uint pdwConnectionId);
+
+ void GetTaskID([Out] out ulong pTaskId);
+
+ void GetVolatileOSThreadID([Out] out uint pdwTid);
+
+ void InterceptCurrentException([In, MarshalAs(UnmanagedType.Interface)] ICorDebugFrame pFrame);
+ }
+
+
+ [ComImport, InterfaceType(1), ComConversionLoss, Guid("CC7BCB06-8A68-11D2-983C-0000F808342D")]
+ public interface ICorDebugThreadEnum : ICorDebugEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorDebugEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] ICorDebugThread[] threads, [Out] out uint pceltFetched);
+ }
+
+ #endregion Threads
+
+}
+
+
diff --git a/CorApi/ICorPublishWrappers.cs b/CorApi/ICorPublishWrappers.cs
new file mode 100644
index 0000000..e61539b
--- /dev/null
+++ b/CorApi/ICorPublishWrappers.cs
@@ -0,0 +1,123 @@
+//---------------------------------------------------------------------
+// This file is part of the CLR Managed Debugger (mdbg) Sample.
+//
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// Imports ICorPublish interface from CorPublish.idl into managed code
+//---------------------------------------------------------------------
+
+using System;
+using System.Text;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+using IStream=System.Runtime.InteropServices.ComTypes.IStream;
+using Microsoft.Win32.SafeHandles;
+
+namespace Microsoft.Samples.Debugging.CorPublish.NativeApi
+{
+ public enum __MIDL___MIDL_itf_corpub_0000_0001
+ {
+ // Fields
+ COR_PUB_MANAGEDONLY = 1
+ }
+
+ public enum COR_PUB_ENUMPROCESS
+ {
+ // Fields
+ COR_PUB_MANAGEDONLY = 1
+ }
+
+ [ComImport, Guid("9613A0E7-5A68-11D3-8F84-00A0C9B4D50C"), CoClass(typeof(CorpubPublishClass))]
+ public interface CorpubPublish : ICorPublish
+ {
+ }
+
+ [ComImport, TypeLibType(2), Guid("047a9a40-657e-11d3-8d5b-00104b35e7ef"), ClassInterface(ClassInterfaceType.None)]
+ public class CorpubPublishClass : ICorPublish, CorpubPublish
+ {
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void EnumProcesses(
+ [In, ComAliasName("CorpubProcessLib.COR_PUB_ENUMPROCESS")] COR_PUB_ENUMPROCESS Type,
+ [Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishProcessEnum ppIEnum);
+
+ [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
+ public virtual extern void GetProcess([In] uint pid, [Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishProcess ppProcess);
+ }
+
+ [ComImport, Guid("9613A0E7-5A68-11D3-8F84-00A0C9B4D50C"), InterfaceType(1)]
+ public interface ICorPublish
+ {
+
+ void EnumProcesses([In, ComAliasName("CorpubProcessLib.COR_PUB_ENUMPROCESS")] COR_PUB_ENUMPROCESS Type, [Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishProcessEnum ppIEnum);
+
+ void GetProcess([In] uint pid, [Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishProcess ppProcess);
+ }
+
+ [ComImport, Guid("D6315C8F-5A6A-11D3-8F84-00A0C9B4D50C"), InterfaceType(1)]
+ public interface ICorPublishAppDomain
+ {
+
+ void GetID([Out] out uint puId);
+
+ void GetName([In] uint cchName, [Out] out uint pcchName, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName);
+ }
+
+ [ComImport, InterfaceType(1), Guid("9F0C98F5-5A6A-11D3-8F84-00A0C9B4D50C")]
+ public interface ICorPublishAppDomainEnum : ICorPublishEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishAppDomain objects, [Out] out uint pceltFetched);
+ }
+
+ [ComImport, InterfaceType(1), Guid("C0B22967-5A69-11D3-8F84-00A0C9B4D50C")]
+ public interface ICorPublishEnum
+ {
+
+ void Skip([In] uint celt);
+
+ void Reset();
+
+ void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishEnum ppEnum);
+
+ void GetCount([Out] out uint pcelt);
+ }
+
+ [ComImport, InterfaceType(1), Guid("18D87AF1-5A6A-11D3-8F84-00A0C9B4D50C")]
+ public interface ICorPublishProcess
+ {
+
+ void IsManaged([Out] out int pbManaged);
+
+ void EnumAppDomains([Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishAppDomainEnum ppEnum);
+
+ void GetProcessID([Out] out uint pid);
+
+ void GetDisplayName([In] uint cchName, [Out] out uint pcchName, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName);
+ }
+
+ [ComImport, InterfaceType(1), Guid("A37FBD41-5A69-11D3-8F84-00A0C9B4D50C")]
+ public interface ICorPublishProcessEnum : ICorPublishEnum
+ {
+
+ new void Skip([In] uint celt);
+
+ new void Reset();
+
+ new void Clone([Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishEnum ppEnum);
+
+ new void GetCount([Out] out uint pcelt);
+ [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
+ int Next([In] uint celt, [Out, MarshalAs(UnmanagedType.Interface)] out ICorPublishProcess objects, [Out] out uint pceltFetched);
+ }
+}
+
+
diff --git a/CorApi/IMetadataImport.cs b/CorApi/IMetadataImport.cs
new file mode 100644
index 0000000..2e41ce7
--- /dev/null
+++ b/CorApi/IMetadataImport.cs
@@ -0,0 +1,1405 @@
+//---------------------------------------------------------------------
+// This file is part of the CLR Managed Debugger (mdbg) Sample.
+//
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//---------------------------------------------------------------------
+using System;
+using System.Reflection;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Globalization;
+using System.Diagnostics;
+
+// NOTE: For MDBG_FAKE_COM we compile this file by itself into a .dll, disassemble to IL, and then strip
+// the assembly header out and include the il along with the others in the interop assembly
+namespace Microsoft.Samples.Debugging.CorMetadata.NativeApi
+{
+
+ // GUID Copied from Cor.h
+ [Guid("7DAC8207-D3AE-4c75-9B67-92801A497D44"),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)
+ ] // IID_IMetadataImport from cor.h
+
+ // This should be a private interface, but
+ // we cannot do that becuase we are then getting an exception
+ // "The specified type must be visible from COM." @ CorMetadataImport::GetRawInterface
+ [CLSCompliant(false)]
+ public interface IMetadataImport
+ {
+ //STDMETHOD_(void, CloseEnum)(HCORENUM hEnum) PURE;
+ [PreserveSig] void CloseEnum(IntPtr hEnum);
+
+ //STDMETHOD(CountEnum)(HCORENUM hEnum, ULONG *pulCount) PURE;
+ void CountEnum(IntPtr hEnum, [ComAliasName("ULONG*")] out int pulCount);
+
+ //STDMETHOD(ResetEnum)(HCORENUM hEnum, ULONG ulPos) PURE;
+ void ResetEnum(IntPtr hEnum, int ulPos);
+
+ //STDMETHOD(EnumTypeDefs)(HCORENUM *phEnum, mdTypeDef rTypeDefs[],ULONG cMax, ULONG *pcTypeDefs) PURE;
+ //void EnumTypeDefs(out IntPtr phEnum,int[] rTypeDefs,uint cMax, out uint pcTypeDefs);
+ void EnumTypeDefs(
+ ref IntPtr phEnum,
+ [ComAliasName("mdTypeDef*")] out int rTypeDefs,
+ uint cMax /*must be 1*/,
+ [ComAliasName("ULONG*")] out uint pcTypeDefs);
+#if !MDBG_FAKE_COM
+ //STDMETHOD(EnumInterfaceImpls)(HCORENUM *phEnum, mdTypeDef td, mdInterfaceImpl rImpls[], ULONG cMax, ULONG* pcImpls) PURE;
+ void EnumInterfaceImpls_(IntPtr phEnum, int td);
+
+ //STDMETHOD(EnumTypeRefs)(HCORENUM *phEnum, mdTypeRef rTypeRefs[], ULONG cMax, ULONG* pcTypeRefs) PURE;
+ void EnumTypeRefs_();
+#endif
+ // STDMETHOD(FindTypeDefByName)( // S_OK or error.
+ // LPCWSTR szTypeDef, // [IN] Name of the Type.
+ // mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
+ // mdTypeDef *ptd) PURE; // [OUT] Put the TypeDef token here.
+ void FindTypeDefByName(
+ [In, MarshalAs(UnmanagedType.LPWStr)] string szTypeDef,
+ [In] int tkEnclosingClass,
+ [ComAliasName("mdTypeDef*")] [Out] out int token
+ );
+
+ // STDMETHOD(GetScopeProps)( // S_OK or error.
+ // LPWSTR szName, // [OUT] Put the name here.
+ // ULONG cchName, // [IN] Size of name buffer in wide chars.
+ // ULONG *pchName, // [OUT] Put size of name (wide chars) here.
+ // GUID *pmvid) PURE; // [OUT, OPTIONAL] Put MVID here.
+ void GetScopeProps(
+ [Out,MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,
+ [In] int cchName,
+ [ComAliasName("ULONG*")] out int pchName,
+ out Guid mvid
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetModuleFromScope)( // S_OK.
+ // mdModule *pmd) PURE; // [OUT] Put mdModule token here.
+ void GetModuleFromScope_();
+#endif
+ // STDMETHOD(GetTypeDefProps)( // S_OK or error.
+ // mdTypeDef td, // [IN] TypeDef token for inquiry.
+ // LPWSTR szTypeDef, // [OUT] Put name here.
+ // ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
+ // ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
+ // DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
+ // mdToken *ptkExtends) PURE; // [OUT] Put base class TypeDef/TypeRef here.
+ void GetTypeDefProps([In] int td,
+ [Out, MarshalAs( UnmanagedType.LPWStr)] StringBuilder szTypeDef,
+ [In] int cchTypeDef,
+ [ComAliasName("ULONG*")] [Out] out int pchTypeDef,
+ [Out, MarshalAs(UnmanagedType.U4)] out System.Reflection.TypeAttributes pdwTypeDefFlags,
+ [ComAliasName("mdToken*")] [Out] out int ptkExtends
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetInterfaceImplProps)( // S_OK or error.
+ // mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
+ // mdTypeDef *pClass, // [OUT] Put implementing class token here.
+ // mdToken *ptkIface) PURE; // [OUT] Put implemented interface token here.
+ void GetInterfaceImplProps_();
+#endif
+ // STDMETHOD(GetTypeRefProps)( // S_OK or error.
+ // mdTypeRef tr, // [IN] TypeRef token.
+ // mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
+ // LPWSTR szName, // [OUT] Name of the TypeRef.
+ // ULONG cchName, // [IN] Size of buffer.
+ // ULONG *pchName) PURE; // [OUT] Size of Name.
+ void GetTypeRefProps(
+ int tr,
+ [ComAliasName("mdToken*")] [Out] out int ptkResolutionScope,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,
+ [In] int cchName,
+ [ComAliasName("ULONG*")] out int pchName
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(ResolveTypeRef)(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd) PURE;
+ void ResolveTypeRef_();
+
+ // STDMETHOD(EnumMembers)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // mdToken rMembers[], // [OUT] Put MemberDefs here.
+ // ULONG cMax, // [IN] Max MemberDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumMembers_();
+
+ // STDMETHOD(EnumMembersWithName)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // LPCWSTR szName, // [IN] Limit results to those with this name.
+ // mdToken rMembers[], // [OUT] Put MemberDefs here.
+ // ULONG cMax, // [IN] Max MemberDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumMembersWithName_();
+#endif
+ // STDMETHOD(EnumMethods)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
+ // ULONG cMax, // [IN] Max MethodDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumMethods(ref IntPtr phEnum,
+ int cl,
+ [ComAliasName("mdMethodDef*")] out int mdMethodDef,
+ int cMax, /*must be 1*/
+ [ComAliasName("ULONG*")] out int pcTokens
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumMethodsWithName)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // LPCWSTR szName, // [IN] Limit results to those with this name.
+ // mdMethodDef rMethods[], // [OU] Put MethodDefs here.
+ // ULONG cMax, // [IN] Max MethodDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumMethodsWithName_();
+#endif
+ // STDMETHOD(EnumFields)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // mdFieldDef rFields[], // [OUT] Put FieldDefs here.
+ // ULONG cMax, // [IN] Max FieldDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ //void EnumFields_();
+ /*[PreserveSig]*/
+ void EnumFields(ref IntPtr phEnum,
+ int cl,
+ [ComAliasName("mdFieldDef*")] out int mdFieldDef,
+ int cMax /*must be 1*/,
+ [ComAliasName("ULONG*")] out uint pcTokens);
+
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumFieldsWithName)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // LPCWSTR szName, // [IN] Limit results to those with this name.
+ // mdFieldDef rFields[], // [OUT] Put MemberDefs here.
+ // ULONG cMax, // [IN] Max MemberDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumFieldsWithName_();
+#endif
+ // STDMETHOD(EnumParams)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
+ // mdParamDef rParams[], // [OUT] Put ParamDefs here.
+ // ULONG cMax, // [IN] Max ParamDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumParams(ref IntPtr phEnum,
+ int mdMethodDef,
+ [ComAliasName("mdParamDef*")] out int mdParamDef,
+ int cMax /*must be 1*/,
+ [ComAliasName("ULONG*")] out uint pcTokens);
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumMemberRefs)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdToken tkParent, // [IN] Parent token to scope the enumeration.
+ // mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
+ // ULONG cMax, // [IN] Max MemberRefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumMemberRefs_();
+
+ // STDMETHOD(EnumMethodImpls)( // S_OK, S_FALSE, or error
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ // mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
+ // mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
+ // ULONG cMax, // [IN] Max tokens to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumMethodImpls_();
+
+ // STDMETHOD(EnumPermissionSets)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdToken tk, // [IN] if !NIL, token to scope the enumeration.
+ // DWORD dwActions, // [IN] if !0, return only these actions.
+ // mdPermission rPermission[], // [OUT] Put Permissions here.
+ // ULONG cMax, // [IN] Max Permissions to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumPermissionSets_();
+
+ // STDMETHOD(FindMember)(
+ // mdTypeDef td, // [IN] given typedef
+ // LPCWSTR szName, // [IN] member name
+ // PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ // ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ // mdToken *pmb) PURE; // [OUT] matching memberdef
+ void FindMember_();
+
+ // STDMETHOD(FindMethod)(
+ // mdTypeDef td, // [IN] given typedef
+ // LPCWSTR szName, // [IN] member name
+ // PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ // ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ // mdMethodDef *pmb) PURE; // [OUT] matching memberdef
+ void FindMethod_();
+
+ // STDMETHOD(FindField)(
+ // mdTypeDef td, // [IN] given typedef
+ // LPCWSTR szName, // [IN] member name
+ // PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ // ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ // mdFieldDef *pmb) PURE; // [OUT] matching memberdef
+ void FindField_();
+
+ // STDMETHOD(FindMemberRef)(
+ // mdTypeRef td, // [IN] given typeRef
+ // LPCWSTR szName, // [IN] member name
+ // PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ // ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ // mdMemberRef *pmr) PURE; // [OUT] matching memberref
+ void FindMemberRef_();
+#endif
+ // STDMETHOD (GetMethodProps)(
+ // mdMethodDef mb, // The method for which to get props.
+ // mdTypeDef *pClass, // Put method's class here.
+ // LPWSTR szMethod, // Put method's name here.
+ // ULONG cchMethod, // Size of szMethod buffer in wide chars.
+ // ULONG *pchMethod, // Put actual size here
+ // DWORD *pdwAttr, // Put flags here.
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ // ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ // ULONG *pulCodeRVA, // [OUT] codeRVA
+ // DWORD *pdwImplFlags) PURE; // [OUT] Impl. Flags
+ void GetMethodProps([In] uint md,
+ [ComAliasName("mdTypeDef*")] [Out] out int pClass,
+ [Out, MarshalAs( UnmanagedType.LPWStr)] StringBuilder szMethod,
+ [In] int cchMethod,
+ [ComAliasName("ULONG*")] [Out] out int pchMethod,
+ [ComAliasName("DWORD*")] [Out] out uint pdwAttr,
+ [ComAliasName("PCCOR_SIGNATURE*")] [Out] out IntPtr ppvSigBlob,
+ [ComAliasName("ULONG*")] [Out] out uint pcbSigBlob,
+ [ComAliasName("ULONG*")] [Out] out uint pulCodeRVA,
+ [ComAliasName("DWORD*")] [Out] out uint pdwImplFlags
+ );
+
+ // STDMETHOD(GetMemberRefProps)( // S_OK or error.
+ // mdMemberRef mr, // [IN] given memberref
+ // mdToken *ptk, // [OUT] Put classref or classdef here.
+ // LPWSTR szMember, // [OUT] buffer to fill for member's name
+ // ULONG cchMember, // [IN] the count of char of szMember
+ // ULONG *pchMember, // [OUT] actual count of char in member name
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
+ // ULONG *pbSig) PURE; // [OUT] actual size of signature blob
+ void GetMemberRefProps([In] uint mr,
+ [ComAliasName("mdMemberRef*")] [Out] out int ptk,
+ [Out,MarshalAs(UnmanagedType.LPWStr)] StringBuilder szMember,
+ [In] int cchMember,
+ [ComAliasName("ULONG*")] [Out] out uint pchMember,
+ [ComAliasName("PCCOR_SIGNATURE*")] [Out] out IntPtr ppvSigBlob,
+ [ComAliasName("ULONG*")] [Out] out int pbSig
+ );
+
+ // STDMETHOD(EnumProperties)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ // mdProperty rProperties[], // [OUT] Put Properties here.
+ // ULONG cMax, // [IN] Max properties to put.
+ // ULONG *pcProperties) PURE; // [OUT] Put # put here.
+ void EnumProperties(ref IntPtr phEnum,
+ int td,
+ [ComAliasName("mdProperty*")] out int mdProperty,
+ int cMax /*must be 1*/,
+ [ComAliasName("ULONG*")] out uint pcProperties);
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumEvents)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ // mdEvent rEvents[], // [OUT] Put events here.
+ // ULONG cMax, // [IN] Max events to put.
+ // ULONG *pcEvents) PURE; // [OUT] Put # put here.
+ void EnumEvents_();
+
+ // STDMETHOD(GetEventProps)( // S_OK, S_FALSE, or error.
+ // mdEvent ev, // [IN] event token
+ // mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
+ // LPCWSTR szEvent, // [OUT] Event name
+ // ULONG cchEvent, // [IN] the count of wchar of szEvent
+ // ULONG *pchEvent, // [OUT] actual count of wchar for event's name
+ // DWORD *pdwEventFlags, // [OUT] Event flags.
+ // mdToken *ptkEventType, // [OUT] EventType class
+ // mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
+ // mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
+ // mdMethodDef *pmdFire, // [OUT] Fire method of the event
+ // mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
+ // ULONG cMax, // [IN] size of rmdOtherMethod
+ // ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this event
+ void GetEventProps_();
+
+ // STDMETHOD(EnumMethodSemantics)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
+ // mdToken rEventProp[], // [OUT] Put Event/Property here.
+ // ULONG cMax, // [IN] Max properties to put.
+ // ULONG *pcEventProp) PURE; // [OUT] Put # put here.
+ void EnumMethodSemantics_();
+
+ // STDMETHOD(GetMethodSemantics)( // S_OK, S_FALSE, or error.
+ // mdMethodDef mb, // [IN] method token
+ // mdToken tkEventProp, // [IN] event/property token.
+ // DWORD *pdwSemanticsFlags) PURE; // [OUT] the role flags for the method/propevent pair
+ void GetMethodSemantics_();
+
+ // STDMETHOD(GetClassLayout) (
+ // mdTypeDef td, // [IN] give typedef
+ // DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
+ // COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
+ // ULONG cMax, // [IN] size of the array
+ // ULONG *pcFieldOffset, // [OUT] needed array size
+ // ULONG *pulClassSize) PURE; // [OUT] the size of the class
+ void GetClassLayout_();
+
+ // STDMETHOD(GetFieldMarshal) (
+ // mdToken tk, // [IN] given a field's memberdef
+ // PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
+ // ULONG *pcbNativeType) PURE; // [OUT] the count of bytes of *ppvNativeType
+ void GetFieldMarshal_();
+
+ // STDMETHOD(GetRVA)( // S_OK or error.
+ // mdToken tk, // Member for which to set offset
+ // ULONG *pulCodeRVA, // The offset
+ // DWORD *pdwImplFlags) PURE; // the implementation flags
+ void GetRVA_();
+
+ // STDMETHOD(GetPermissionSetProps) (
+ // mdPermission pm, // [IN] the permission token.
+ // DWORD *pdwAction, // [OUT] CorDeclSecurity.
+ // void const **ppvPermission, // [OUT] permission blob.
+ // ULONG *pcbPermission) PURE; // [OUT] count of bytes of pvPermission.
+ void GetPermissionSetProps_();
+
+ // STDMETHOD(GetSigFromToken)( // S_OK or error.
+ // mdSignature mdSig, // [IN] Signature token.
+ // PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
+ // ULONG *pcbSig) PURE; // [OUT] return size of signature.
+ void GetSigFromToken_();
+
+ // STDMETHOD(GetModuleRefProps)( // S_OK or error.
+ // mdModuleRef mur, // [IN] moduleref token.
+ // LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
+ // ULONG cchName, // [IN] size of szName in wide characters.
+ // ULONG *pchName) PURE; // [OUT] actual count of characters in the name.
+ void GetModuleRefProps_();
+
+ // STDMETHOD(EnumModuleRefs)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ // mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
+ // ULONG cmax, // [IN] max memberrefs to put.
+ // ULONG *pcModuleRefs) PURE; // [OUT] put # put here.
+ void EnumModuleRefs_();
+
+ // STDMETHOD(GetTypeSpecFromToken)( // S_OK or error.
+ // mdTypeSpec typespec, // [IN] TypeSpec token.
+ // PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
+ // ULONG *pcbSig) PURE; // [OUT] return size of signature.
+ void GetTypeSpecFromToken_();
+
+ // STDMETHOD(GetNameFromToken)( // Not Recommended! May be removed!
+ // mdToken tk, // [IN] Token to get name from. Must have a name.
+ // MDUTF8CSTR *pszUtf8NamePtr) PURE; // [OUT] Return pointer to UTF8 name in heap.
+ void GetNameFromToken_();
+
+
+ // STDMETHOD(EnumUnresolvedMethods)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdToken rMethods[], // [OUT] Put MemberDefs here.
+ // ULONG cMax, // [IN] Max MemberDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ void EnumUnresolvedMethods_();
+#endif
+ // STDMETHOD(GetUserString)( // S_OK or error.
+ // mdString stk, // [IN] String token.
+ // LPWSTR szString, // [OUT] Copy of string.
+ // ULONG cchString, // [IN] Max chars of room in szString.
+ // ULONG *pchString) PURE; // [OUT] How many chars in actual string.
+ void GetUserString([In] int stk,
+ [Out,MarshalAs(UnmanagedType.LPWStr)] StringBuilder szString,
+ [In] int cchString,
+ [ComAliasName("ULONG*")] out int pchString
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetPinvokeMap)( // S_OK or error.
+ // mdToken tk, // [IN] FieldDef or MethodDef.
+ // DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
+ // LPWSTR szImportName, // [OUT] Import name.
+ // ULONG cchImportName, // [IN] Size of the name buffer.
+ // ULONG *pchImportName, // [OUT] Actual number of characters stored.
+ // mdModuleRef *pmrImportDLL) PURE; // [OUT] ModuleRef token for the target DLL.
+ void GetPinvokeMap_();
+
+ // STDMETHOD(EnumSignatures)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ // mdSignature rSignatures[], // [OUT] put signatures here.
+ // ULONG cmax, // [IN] max signatures to put.
+ // ULONG *pcSignatures) PURE; // [OUT] put # put here.
+ void EnumSignatures_();
+
+ // STDMETHOD(EnumTypeSpecs)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ // mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
+ // ULONG cmax, // [IN] max TypeSpecs to put.
+ // ULONG *pcTypeSpecs) PURE; // [OUT] put # put here.
+ void EnumTypeSpecs_();
+
+ // STDMETHOD(EnumUserStrings)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
+ // mdString rStrings[], // [OUT] put Strings here.
+ // ULONG cmax, // [IN] max Strings to put.
+ // ULONG *pcStrings) PURE; // [OUT] put # put here.
+ void EnumUserStrings_();
+
+ // STDMETHOD(GetParamForMethodIndex)( // S_OK or error.
+ // mdMethodDef md, // [IN] Method token.
+ // ULONG ulParamSeq, // [IN] Parameter sequence.
+ // mdParamDef *ppd) PURE; // [IN] Put Param token here.
+ void GetParamForMethodIndex_();
+#endif
+ // STDMETHOD(EnumCustomAttributes)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN, OUT] COR enumerator.
+ // mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
+ // mdToken tkType, // [IN] Type of interest, 0 for all.
+ // mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here.
+ // ULONG cMax, // [IN] Size of rCustomAttributes.
+ // ULONG *pcCustomAttributes) PURE; // [OUT, OPTIONAL] Put count of token values here.
+ void EnumCustomAttributes(ref IntPtr phEnum,
+ int tk,
+ int tkType,
+ [ComAliasName("mdCustomAttribute*")]out int mdCustomAttribute,
+ uint cMax /*must be 1*/,
+ [ComAliasName("ULONG*")]out uint pcTokens
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetCustomAttributeProps)( // S_OK or error.
+ // mdCustomAttribute cv, // [IN] CustomAttribute token.
+ // mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
+ // mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
+ // void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
+ // ULONG *pcbSize) PURE; // [OUT, OPTIONAL] Put size of date here.
+ void GetCustomAttributeProps_();
+
+ // STDMETHOD(FindTypeRef)(
+ // mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
+ // LPCWSTR szName, // [IN] TypeRef Name.
+ // mdTypeRef *ptr) PURE; // [OUT] matching TypeRef.
+ void FindTypeRef_();
+
+ // STDMETHOD(GetMemberProps)(
+ // mdToken mb, // The member for which to get props.
+ // mdTypeDef *pClass, // Put member's class here.
+ // LPWSTR szMember, // Put member's name here.
+ // ULONG cchMember, // Size of szMember buffer in wide chars.
+ // ULONG *pchMember, // Put actual size here
+ // DWORD *pdwAttr, // Put flags here.
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ // ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ // ULONG *pulCodeRVA, // [OUT] codeRVA
+ // DWORD *pdwImplFlags, // [OUT] Impl. Flags
+ // DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ // void const **ppValue, // [OUT] constant value
+ // ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+ void GetMemberProps_();
+#endif
+ // STDMETHOD(GetFieldProps)(
+ // mdFieldDef mb, // The field for which to get props.
+ // mdTypeDef *pClass, // Put field's class here.
+ // LPWSTR szField, // Put field's name here.
+ // ULONG cchField, // Size of szField buffer in wide chars.
+ // ULONG *pchField, // Put actual size here
+ // DWORD *pdwAttr, // Put flags here.
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ // ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ // DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ // void const **ppValue, // [OUT] constant value
+ // ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+ void GetFieldProps(int mb,
+ [ComAliasName("mdTypeDef*")] out int mdTypeDef,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szField,
+ int cchField,
+ [ComAliasName("ULONG*")] out int pchField,
+ [ComAliasName("DWORD*")] out int pdwAttr,
+ [ComAliasName("PCCOR_SIGNATURE*")] out IntPtr ppvSigBlob,
+ [ComAliasName("ULONG*")] out int pcbSigBlob,
+ [ComAliasName("DWORD*")] out int pdwCPlusTypeFlab,
+ [ComAliasName("UVCP_CONSTANT*")] out IntPtr ppValue,
+ [ComAliasName("ULONG*")] out int pcchValue
+ );
+
+ // STDMETHOD(GetPropertyProps)( // S_OK, S_FALSE, or error.
+ // mdProperty prop, // [IN] property token
+ // mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
+ // LPCWSTR szProperty, // [OUT] Property name
+ // ULONG cchProperty, // [IN] the count of wchar of szProperty
+ // ULONG *pchProperty, // [OUT] actual count of wchar for property name
+ // DWORD *pdwPropFlags, // [OUT] property flags.
+ // PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
+ // ULONG *pbSig, // [OUT] count of bytes in *ppvSig
+ // DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ // void const **ppDefaultValue, // [OUT] constant value
+ // ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings.
+ // mdMethodDef *pmdSetter, // [OUT] setter method of the property
+ // mdMethodDef *pmdGetter, // [OUT] getter method of the property
+ // mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
+ // ULONG cMax, // [IN] size of rmdOtherMethod
+ // ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this property
+ void GetPropertyProps(int prop,
+ [ComAliasName ("mdTypeDef*")] out int mdTypeDef,
+ [Out, MarshalAs (UnmanagedType.LPWStr)] StringBuilder szProperty,
+ int cchProperty,
+ [ComAliasName ("ULONG*")] out int pchProperty,
+ [ComAliasName ("DWORD*")] out int pdwPropFlags,
+ [ComAliasName ("PCCOR_SIGNATURE*")] out IntPtr ppvSig,
+ [ComAliasName ("ULONG*")] out int pbSig,
+ [ComAliasName ("DWORD*")] out int pdwCPlusTypeFlag,
+ [ComAliasName ("UVCP_CONSTANT*")] out IntPtr ppDefaultValue,
+ [ComAliasName ("ULONG*")] out int pcchDefaultValue,
+ [ComAliasName ("mdMethodDef*")] out int pmdSetter,
+ [ComAliasName ("mdMethodDef*")] out int pmdGetter,
+ [ComAliasName ("mdMethodDef*")] out int rmdOtherMethod,
+ [ComAliasName ("ULONG*")] int cMax, /* must be 1 */
+ [ComAliasName ("ULONG*")] out int pcOtherMethod
+ );
+
+ // STDMETHOD(GetParamProps)( // S_OK or error.
+ // mdParamDef tk, // [IN]The Parameter.
+ // mdMethodDef *pmd, // [OUT] Parent Method token.
+ // ULONG *pulSequence, // [OUT] Parameter sequence.
+ // LPWSTR szName, // [OUT] Put name here.
+ // ULONG cchName, // [OUT] Size of name buffer.
+ // ULONG *pchName, // [OUT] Put actual size of name here.
+ // DWORD *pdwAttr, // [OUT] Put flags here.
+ // DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*.
+ // void const **ppValue, // [OUT] Constant value.
+ // ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+ void GetParamProps(int tk,
+ [ComAliasName("mdMethodDef*")] out int pmd,
+ [ComAliasName("ULONG*")] out uint pulSequence,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,
+ uint cchName,
+ [ComAliasName("ULONG*")] out uint pchName,
+ [ComAliasName("DWORD*")] out uint pdwAttr,
+ [ComAliasName("DWORD*")] out uint pdwCPlusTypeFlag,
+ [ComAliasName("UVCP_CONSTANT*")] out IntPtr ppValue,
+ [ComAliasName("ULONG*")] out uint pcchValue
+ );
+
+ // STDMETHOD(GetCustomAttributeByName)( // S_OK or error.
+ // mdToken tkObj, // [IN] Object with Custom Attribute.
+ // LPCWSTR szName, // [IN] Name of desired Custom Attribute.
+ // const void **ppData, // [OUT] Put pointer to data here.
+ // ULONG *pcbData) PURE; // [OUT] Put size of data here.
+ [PreserveSig]
+ int GetCustomAttributeByName(
+ int tkObj,
+ [MarshalAs(UnmanagedType.LPWStr)]string szName,
+ out IntPtr ppData,
+ out uint pcbData);
+
+ // STDMETHOD_(BOOL, IsValidToken)( // True or False.
+ // mdToken tk) PURE; // [IN] Given token.
+ [PreserveSig] bool IsValidToken([In, MarshalAs(UnmanagedType.U4)] uint tk);
+
+ // STDMETHOD(GetNestedClassProps)( // S_OK or error.
+ // mdTypeDef tdNestedClass, // [IN] NestedClass token.
+ // mdTypeDef *ptdEnclosingClass) PURE; // [OUT] EnclosingClass token.
+ void GetNestedClassProps(int tdNestedClass, [ComAliasName("mdTypeDef*")] out int tdEnclosingClass);
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetNativeCallConvFromSig)( // S_OK or error.
+ // void const *pvSig, // [IN] Pointer to signature.
+ // ULONG cbSig, // [IN] Count of signature bytes.
+ // ULONG *pCallConv) PURE; // [OUT] Put calling conv here (see CorPinvokemap).
+ void GetNativeCallConvFromSig_();
+
+ // STDMETHOD(IsGlobal)( // S_OK or error.
+ // mdToken pd, // [IN] Type, Field, or Method token.
+ // int *pbGlobal) PURE; // [OUT] Put 1 if global, 0 otherwise.
+ void IsGlobal_();
+#endif
+ } // IMetadataImport
+
+
+
+ // IMetaDataImport2
+ [Guid("FCE5EFA0-8BBA-4f8e-A036-8F2022B08466"),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)
+ ]
+ [CLSCompliant(false)]
+ public interface IMetadataImport2 : IMetadataImport
+ {
+
+ // Need imports from IMetaDataImport to adjust IM2 vtable slots.
+
+ //STDMETHOD_(void, CloseEnum)(HCORENUM hEnum) PURE;
+ [PreserveSig] new void CloseEnum(IntPtr hEnum);
+
+ //STDMETHOD(CountEnum)(HCORENUM hEnum, ULONG *pulCount) PURE;
+ new void CountEnum(IntPtr hEnum, [ComAliasName("ULONG*")] out int pulCount);
+
+ //STDMETHOD(ResetEnum)(HCORENUM hEnum, ULONG ulPos) PURE;
+ new void ResetEnum(IntPtr hEnum, int ulPos);
+
+ //STDMETHOD(EnumTypeDefs)(HCORENUM *phEnum, mdTypeDef rTypeDefs[],ULONG cMax, ULONG *pcTypeDefs) PURE;
+ //void EnumTypeDefs(out IntPtr phEnum,int[] rTypeDefs,uint cMax, out uint pcTypeDefs);
+ new void EnumTypeDefs(
+ ref IntPtr phEnum,
+ [ComAliasName("mdTypeDef*")] out int rTypeDefs,
+ uint cMax /*must be 1*/,
+ [ComAliasName("ULONG*")] out uint pcTypeDefs);
+#if !MDBG_FAKE_COM
+ //STDMETHOD(EnumInterfaceImpls)(HCORENUM *phEnum, mdTypeDef td, mdInterfaceImpl rImpls[], ULONG cMax, ULONG* pcImpls) PURE;
+ new void EnumInterfaceImpls_(IntPtr phEnum, int td);
+
+ //STDMETHOD(EnumTypeRefs)(HCORENUM *phEnum, mdTypeRef rTypeRefs[], ULONG cMax, ULONG* pcTypeRefs) PURE;
+ new void EnumTypeRefs_();
+#endif
+ // STDMETHOD(FindTypeDefByName)( // S_OK or error.
+ // LPCWSTR szTypeDef, // [IN] Name of the Type.
+ // mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
+ // mdTypeDef *ptd) PURE; // [OUT] Put the TypeDef token here.
+ new void FindTypeDefByName(
+ [In, MarshalAs(UnmanagedType.LPWStr)] string szTypeDef,
+ [In] int tkEnclosingClass,
+ [ComAliasName("mdTypeDef*")] [Out] out int token
+ );
+
+ // STDMETHOD(GetScopeProps)( // S_OK or error.
+ // LPWSTR szName, // [OUT] Put the name here.
+ // ULONG cchName, // [IN] Size of name buffer in wide chars.
+ // ULONG *pchName, // [OUT] Put size of name (wide chars) here.
+ // GUID *pmvid) PURE; // [OUT, OPTIONAL] Put MVID here.
+ new void GetScopeProps(
+ [Out,MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,
+ [In] int cchName,
+ [ComAliasName("ULONG*")] out int pchName,
+ out Guid mvid
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetModuleFromScope)( // S_OK.
+ // mdModule *pmd) PURE; // [OUT] Put mdModule token here.
+ new void GetModuleFromScope_();
+#endif
+ // STDMETHOD(GetTypeDefProps)( // S_OK or error.
+ // mdTypeDef td, // [IN] TypeDef token for inquiry.
+ // LPWSTR szTypeDef, // [OUT] Put name here.
+ // ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
+ // ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
+ // DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
+ // mdToken *ptkExtends) PURE; // [OUT] Put base class TypeDef/TypeRef here.
+ new void GetTypeDefProps([In] int td,
+ [Out, MarshalAs( UnmanagedType.LPWStr)] StringBuilder szTypeDef,
+ [In] int cchTypeDef,
+ [ComAliasName("ULONG*")] [Out] out int pchTypeDef,
+ [Out, MarshalAs(UnmanagedType.U4)] out System.Reflection.TypeAttributes pdwTypeDefFlags,
+ [ComAliasName("mdToken*")] [Out] out int ptkExtends
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetInterfaceImplProps)( // S_OK or error.
+ // mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
+ // mdTypeDef *pClass, // [OUT] Put implementing class token here.
+ // mdToken *ptkIface) PURE; // [OUT] Put implemented interface token here.
+ new void GetInterfaceImplProps_();
+#endif
+ // STDMETHOD(GetTypeRefProps)( // S_OK or error.
+ // mdTypeRef tr, // [IN] TypeRef token.
+ // mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
+ // LPWSTR szName, // [OUT] Name of the TypeRef.
+ // ULONG cchName, // [IN] Size of buffer.
+ // ULONG *pchName) PURE; // [OUT] Size of Name.
+ new void GetTypeRefProps(
+ int tr,
+ [ComAliasName("mdToken*")] [Out] out int ptkResolutionScope,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,
+ [In] int cchName,
+ [ComAliasName("ULONG*")] out int pchName
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(ResolveTypeRef)(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd) PURE;
+ new void ResolveTypeRef_();
+
+ // STDMETHOD(EnumMembers)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // mdToken rMembers[], // [OUT] Put MemberDefs here.
+ // ULONG cMax, // [IN] Max MemberDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumMembers_();
+
+ // STDMETHOD(EnumMembersWithName)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // LPCWSTR szName, // [IN] Limit results to those with this name.
+ // mdToken rMembers[], // [OUT] Put MemberDefs here.
+ // ULONG cMax, // [IN] Max MemberDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumMembersWithName_();
+#endif
+ // STDMETHOD(EnumMethods)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
+ // ULONG cMax, // [IN] Max MethodDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumMethods(ref IntPtr phEnum,
+ int cl,
+ [ComAliasName("mdMethodDef*")] out int mdMethodDef,
+ int cMax, /*must be 1*/
+ [ComAliasName("ULONG*")] out int pcTokens
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumMethodsWithName)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // LPCWSTR szName, // [IN] Limit results to those with this name.
+ // mdMethodDef rMethods[], // [OU] Put MethodDefs here.
+ // ULONG cMax, // [IN] Max MethodDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumMethodsWithName_();
+#endif
+ // STDMETHOD(EnumFields)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // mdFieldDef rFields[], // [OUT] Put FieldDefs here.
+ // ULONG cMax, // [IN] Max FieldDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ /*[PreserveSig]*/
+ new void EnumFields(ref IntPtr phEnum,
+ int cl,
+ [ComAliasName("mdFieldDef*")] out int mdFieldDef,
+ int cMax /*must be 1*/,
+ [ComAliasName("ULONG*")] out uint pcTokens);
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumFieldsWithName)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ // LPCWSTR szName, // [IN] Limit results to those with this name.
+ // mdFieldDef rFields[], // [OUT] Put MemberDefs here.
+ // ULONG cMax, // [IN] Max MemberDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumFieldsWithName_();
+#endif
+ // STDMETHOD(EnumParams)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
+ // mdParamDef rParams[], // [OUT] Put ParamDefs here.
+ // ULONG cMax, // [IN] Max ParamDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumParams(ref IntPtr phEnum,
+ int mdMethodDef,
+ [ComAliasName("mdParamDef*")] out int mdParamDef,
+ int cMax /*must be 1*/,
+ [ComAliasName("ULONG*")] out uint pcTokens);
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumMemberRefs)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdToken tkParent, // [IN] Parent token to scope the enumeration.
+ // mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
+ // ULONG cMax, // [IN] Max MemberRefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumMemberRefs_();
+
+ // STDMETHOD(EnumMethodImpls)( // S_OK, S_FALSE, or error
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ // mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
+ // mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
+ // ULONG cMax, // [IN] Max tokens to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumMethodImpls_();
+
+ // STDMETHOD(EnumPermissionSets)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdToken tk, // [IN] if !NIL, token to scope the enumeration.
+ // DWORD dwActions, // [IN] if !0, return only these actions.
+ // mdPermission rPermission[], // [OUT] Put Permissions here.
+ // ULONG cMax, // [IN] Max Permissions to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumPermissionSets_();
+
+ // STDMETHOD(FindMember)(
+ // mdTypeDef td, // [IN] given typedef
+ // LPCWSTR szName, // [IN] member name
+ // PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ // ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ // mdToken *pmb) PURE; // [OUT] matching memberdef
+ new void FindMember_();
+
+ // STDMETHOD(FindMethod)(
+ // mdTypeDef td, // [IN] given typedef
+ // LPCWSTR szName, // [IN] member name
+ // PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ // ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ // mdMethodDef *pmb) PURE; // [OUT] matching memberdef
+ new void FindMethod_();
+
+ // STDMETHOD(FindField)(
+ // mdTypeDef td, // [IN] given typedef
+ // LPCWSTR szName, // [IN] member name
+ // PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ // ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ // mdFieldDef *pmb) PURE; // [OUT] matching memberdef
+ new void FindField_();
+
+ // STDMETHOD(FindMemberRef)(
+ // mdTypeRef td, // [IN] given typeRef
+ // LPCWSTR szName, // [IN] member name
+ // PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ // ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ // mdMemberRef *pmr) PURE; // [OUT] matching memberref
+ new void FindMemberRef_();
+#endif
+ // STDMETHOD (GetMethodProps)(
+ // mdMethodDef mb, // The method for which to get props.
+ // mdTypeDef *pClass, // Put method's class here.
+ // LPWSTR szMethod, // Put method's name here.
+ // ULONG cchMethod, // Size of szMethod buffer in wide chars.
+ // ULONG *pchMethod, // Put actual size here
+ // DWORD *pdwAttr, // Put flags here.
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ // ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ // ULONG *pulCodeRVA, // [OUT] codeRVA
+ // DWORD *pdwImplFlags) PURE; // [OUT] Impl. Flags
+ new void GetMethodProps([In] uint md,
+ [ComAliasName("mdTypeDef*")] [Out] out int pClass,
+ [Out, MarshalAs( UnmanagedType.LPWStr)] StringBuilder szMethod,
+ [In] int cchMethod,
+ [ComAliasName("ULONG*")] [Out] out int pchMethod,
+ [ComAliasName("DWORD*")] [Out] out uint pdwAttr,
+ [ComAliasName("PCCOR_SIGNATURE*")] [Out] out IntPtr ppvSigBlob,
+ [ComAliasName("ULONG*")] [Out] out uint pcbSigBlob,
+ [ComAliasName("ULONG*")] [Out] out uint pulCodeRVA,
+ [ComAliasName("DWORD*")] [Out] out uint pdwImplFlags
+ );
+
+ // STDMETHOD(GetMemberRefProps)( // S_OK or error.
+ // mdMemberRef mr, // [IN] given memberref
+ // mdToken *ptk, // [OUT] Put classref or classdef here.
+ // LPWSTR szMember, // [OUT] buffer to fill for member's name
+ // ULONG cchMember, // [IN] the count of char of szMember
+ // ULONG *pchMember, // [OUT] actual count of char in member name
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
+ // ULONG *pbSig) PURE; // [OUT] actual size of signature blob
+ new void GetMemberRefProps([In] uint mr,
+ [ComAliasName("mdMemberRef*")] [Out] out int ptk,
+ [Out,MarshalAs(UnmanagedType.LPWStr)] StringBuilder szMember,
+ [In] int cchMember,
+ [ComAliasName("ULONG*")] [Out] out uint pchMember,
+ [ComAliasName("PCCOR_SIGNATURE*")] [Out] out IntPtr ppvSigBlob,
+ [ComAliasName("ULONG*")] [Out] out int pbSig
+ );
+
+ // STDMETHOD(EnumProperties)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ // mdProperty rProperties[], // [OUT] Put Properties here.
+ // ULONG cMax, // [IN] Max properties to put.
+ // ULONG *pcProperties) PURE; // [OUT] Put # put here.
+ new void EnumProperties(ref IntPtr phEnum,
+ int td,
+ [ComAliasName("mdProperty*")] out int mdProperty,
+ int cMax /*must be 1*/,
+ [ComAliasName("ULONG*")] out uint pcProperties);
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumEvents)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ // mdEvent rEvents[], // [OUT] Put events here.
+ // ULONG cMax, // [IN] Max events to put.
+ // ULONG *pcEvents) PURE; // [OUT] Put # put here.
+ new void EnumEvents_();
+
+ // STDMETHOD(GetEventProps)( // S_OK, S_FALSE, or error.
+ // mdEvent ev, // [IN] event token
+ // mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
+ // LPCWSTR szEvent, // [OUT] Event name
+ // ULONG cchEvent, // [IN] the count of wchar of szEvent
+ // ULONG *pchEvent, // [OUT] actual count of wchar for event's name
+ // DWORD *pdwEventFlags, // [OUT] Event flags.
+ // mdToken *ptkEventType, // [OUT] EventType class
+ // mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
+ // mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
+ // mdMethodDef *pmdFire, // [OUT] Fire method of the event
+ // mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
+ // ULONG cMax, // [IN] size of rmdOtherMethod
+ // ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this event
+ new void GetEventProps_();
+
+ // STDMETHOD(EnumMethodSemantics)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
+ // mdToken rEventProp[], // [OUT] Put Event/Property here.
+ // ULONG cMax, // [IN] Max properties to put.
+ // ULONG *pcEventProp) PURE; // [OUT] Put # put here.
+ new void EnumMethodSemantics_();
+
+ // STDMETHOD(GetMethodSemantics)( // S_OK, S_FALSE, or error.
+ // mdMethodDef mb, // [IN] method token
+ // mdToken tkEventProp, // [IN] event/property token.
+ // DWORD *pdwSemanticsFlags) PURE; // [OUT] the role flags for the method/propevent pair
+ new void GetMethodSemantics_();
+
+ // STDMETHOD(GetClassLayout) (
+ // mdTypeDef td, // [IN] give typedef
+ // DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
+ // COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
+ // ULONG cMax, // [IN] size of the array
+ // ULONG *pcFieldOffset, // [OUT] needed array size
+ // ULONG *pulClassSize) PURE; // [OUT] the size of the class
+ new void GetClassLayout_();
+
+ // STDMETHOD(GetFieldMarshal) (
+ // mdToken tk, // [IN] given a field's memberdef
+ // PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
+ // ULONG *pcbNativeType) PURE; // [OUT] the count of bytes of *ppvNativeType
+ new void GetFieldMarshal_();
+
+ // STDMETHOD(GetRVA)( // S_OK or error.
+ // mdToken tk, // Member for which to set offset
+ // ULONG *pulCodeRVA, // The offset
+ // DWORD *pdwImplFlags) PURE; // the implementation flags
+ new void GetRVA_();
+
+ // STDMETHOD(GetPermissionSetProps) (
+ // mdPermission pm, // [IN] the permission token.
+ // DWORD *pdwAction, // [OUT] CorDeclSecurity.
+ // void const **ppvPermission, // [OUT] permission blob.
+ // ULONG *pcbPermission) PURE; // [OUT] count of bytes of pvPermission.
+ new void GetPermissionSetProps_();
+
+ // STDMETHOD(GetSigFromToken)( // S_OK or error.
+ // mdSignature mdSig, // [IN] Signature token.
+ // PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
+ // ULONG *pcbSig) PURE; // [OUT] return size of signature.
+ new void GetSigFromToken_();
+
+ // STDMETHOD(GetModuleRefProps)( // S_OK or error.
+ // mdModuleRef mur, // [IN] moduleref token.
+ // LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
+ // ULONG cchName, // [IN] size of szName in wide characters.
+ // ULONG *pchName) PURE; // [OUT] actual count of characters in the name.
+ new void GetModuleRefProps_();
+
+ // STDMETHOD(EnumModuleRefs)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ // mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
+ // ULONG cmax, // [IN] max memberrefs to put.
+ // ULONG *pcModuleRefs) PURE; // [OUT] put # put here.
+ new void EnumModuleRefs_();
+
+ // STDMETHOD(GetTypeSpecFromToken)( // S_OK or error.
+ // mdTypeSpec typespec, // [IN] TypeSpec token.
+ // PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
+ // ULONG *pcbSig) PURE; // [OUT] return size of signature.
+ new void GetTypeSpecFromToken_();
+
+ // STDMETHOD(GetNameFromToken)( // Not Recommended! May be removed!
+ // mdToken tk, // [IN] Token to get name from. Must have a name.
+ // MDUTF8CSTR *pszUtf8NamePtr) PURE; // [OUT] Return pointer to UTF8 name in heap.
+ new void GetNameFromToken_();
+
+
+ // STDMETHOD(EnumUnresolvedMethods)( // S_OK, S_FALSE, or error.
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdToken rMethods[], // [OUT] Put MemberDefs here.
+ // ULONG cMax, // [IN] Max MemberDefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+ new void EnumUnresolvedMethods_();
+#endif
+ // STDMETHOD(GetUserString)( // S_OK or error.
+ // mdString stk, // [IN] String token.
+ // LPWSTR szString, // [OUT] Copy of string.
+ // ULONG cchString, // [IN] Max chars of room in szString.
+ // ULONG *pchString) PURE; // [OUT] How many chars in actual string.
+ new void GetUserString([In] int stk,
+ [Out,MarshalAs(UnmanagedType.LPWStr)] StringBuilder szString,
+ [In] int cchString,
+ [ComAliasName("ULONG*")] out int pchString
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetPinvokeMap)( // S_OK or error.
+ // mdToken tk, // [IN] FieldDef or MethodDef.
+ // DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
+ // LPWSTR szImportName, // [OUT] Import name.
+ // ULONG cchImportName, // [IN] Size of the name buffer.
+ // ULONG *pchImportName, // [OUT] Actual number of characters stored.
+ // mdModuleRef *pmrImportDLL) PURE; // [OUT] ModuleRef token for the target DLL.
+ new void GetPinvokeMap_();
+
+ // STDMETHOD(EnumSignatures)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ // mdSignature rSignatures[], // [OUT] put signatures here.
+ // ULONG cmax, // [IN] max signatures to put.
+ // ULONG *pcSignatures) PURE; // [OUT] put # put here.
+ new void EnumSignatures_();
+
+ // STDMETHOD(EnumTypeSpecs)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ // mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
+ // ULONG cmax, // [IN] max TypeSpecs to put.
+ // ULONG *pcTypeSpecs) PURE; // [OUT] put # put here.
+ new void EnumTypeSpecs_();
+
+ // STDMETHOD(EnumUserStrings)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
+ // mdString rStrings[], // [OUT] put Strings here.
+ // ULONG cmax, // [IN] max Strings to put.
+ // ULONG *pcStrings) PURE; // [OUT] put # put here.
+ new void EnumUserStrings_();
+
+ // STDMETHOD(GetParamForMethodIndex)( // S_OK or error.
+ // mdMethodDef md, // [IN] Method token.
+ // ULONG ulParamSeq, // [IN] Parameter sequence.
+ // mdParamDef *ppd) PURE; // [IN] Put Param token here.
+ new void GetParamForMethodIndex_();
+#endif
+ // STDMETHOD(EnumCustomAttributes)( // S_OK or error.
+ // HCORENUM *phEnum, // [IN, OUT] COR enumerator.
+ // mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
+ // mdToken tkType, // [IN] Type of interest, 0 for all.
+ // mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here.
+ // ULONG cMax, // [IN] Size of rCustomAttributes.
+ // ULONG *pcCustomAttributes) PURE; // [OUT, OPTIONAL] Put count of token values here.
+ new void EnumCustomAttributes(ref IntPtr phEnum,
+ int tk,
+ int tkType,
+ [ComAliasName("mdCustomAttribute*")]out int mdCustomAttribute,
+ uint cMax /*must be 1*/,
+ [ComAliasName("ULONG*")]out uint pcTokens
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetCustomAttributeProps)( // S_OK or error.
+ // mdCustomAttribute cv, // [IN] CustomAttribute token.
+ // mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
+ // mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
+ // void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
+ // ULONG *pcbSize) PURE; // [OUT, OPTIONAL] Put size of date here.
+ new void GetCustomAttributeProps_();
+
+ // STDMETHOD(FindTypeRef)(
+ // mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
+ // LPCWSTR szName, // [IN] TypeRef Name.
+ // mdTypeRef *ptr) PURE; // [OUT] matching TypeRef.
+ new void FindTypeRef_();
+
+ // STDMETHOD(GetMemberProps)(
+ // mdToken mb, // The member for which to get props.
+ // mdTypeDef *pClass, // Put member's class here.
+ // LPWSTR szMember, // Put member's name here.
+ // ULONG cchMember, // Size of szMember buffer in wide chars.
+ // ULONG *pchMember, // Put actual size here
+ // DWORD *pdwAttr, // Put flags here.
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ // ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ // ULONG *pulCodeRVA, // [OUT] codeRVA
+ // DWORD *pdwImplFlags, // [OUT] Impl. Flags
+ // DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ // void const **ppValue, // [OUT] constant value
+ // ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+ new void GetMemberProps_();
+#endif
+ // STDMETHOD(GetFieldProps)(
+ // mdFieldDef mb, // The field for which to get props.
+ // mdTypeDef *pClass, // Put field's class here.
+ // LPWSTR szField, // Put field's name here.
+ // ULONG cchField, // Size of szField buffer in wide chars.
+ // ULONG *pchField, // Put actual size here
+ // DWORD *pdwAttr, // Put flags here.
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ // ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ // DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ // void const **ppValue, // [OUT] constant value
+ // ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+ new void GetFieldProps(int mb,
+ [ComAliasName("mdTypeDef*")] out int mdTypeDef,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szField,
+ int cchField,
+ [ComAliasName("ULONG*")] out int pchField,
+ [ComAliasName("DWORD*")] out int pdwAttr,
+ [ComAliasName("PCCOR_SIGNATURE*")] out IntPtr ppvSigBlob,
+ [ComAliasName("ULONG*")] out int pcbSigBlob,
+ [ComAliasName("DWORD*")] out int pdwCPlusTypeFlab,
+ [ComAliasName("UVCP_CONSTANT*")] out IntPtr ppValue,
+ [ComAliasName("ULONG*")] out int pcchValue
+ );
+
+ // STDMETHOD(GetPropertyProps)( // S_OK, S_FALSE, or error.
+ // mdProperty prop, // [IN] property token
+ // mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
+ // LPCWSTR szProperty, // [OUT] Property name
+ // ULONG cchProperty, // [IN] the count of wchar of szProperty
+ // ULONG *pchProperty, // [OUT] actual count of wchar for property name
+ // DWORD *pdwPropFlags, // [OUT] property flags.
+ // PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
+ // ULONG *pbSig, // [OUT] count of bytes in *ppvSig
+ // DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ // void const **ppDefaultValue, // [OUT] constant value
+ // ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings.
+ // mdMethodDef *pmdSetter, // [OUT] setter method of the property
+ // mdMethodDef *pmdGetter, // [OUT] getter method of the property
+ // mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
+ // ULONG cMax, // [IN] size of rmdOtherMethod
+ // ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this property
+ new void GetPropertyProps(int prop,
+ [ComAliasName ("mdTypeDef*")] out int mdTypeDef,
+ [Out, MarshalAs (UnmanagedType.LPWStr)] StringBuilder szProperty,
+ int cchProperty,
+ [ComAliasName ("ULONG*")] out int pchProperty,
+ [ComAliasName ("DWORD*")] out int pdwPropFlags,
+ [ComAliasName ("PCCOR_SIGNATURE*")] out IntPtr ppvSig,
+ [ComAliasName ("ULONG*")] out int pbSig,
+ [ComAliasName ("DWORD*")] out int pdwCPlusTypeFlag,
+ [ComAliasName ("UVCP_CONSTANT*")] out IntPtr ppDefaultValue,
+ [ComAliasName ("ULONG*")] out int pcchDefaultValue,
+ [ComAliasName ("mdMethodDef*")] out int pmdSetter,
+ [ComAliasName ("mdMethodDef*")] out int pmdGetter,
+ [ComAliasName ("mdMethodDef*")] out int rmdOtherMethod,
+ [ComAliasName ("ULONG*")] int cMax, /* must be 1 */
+ [ComAliasName ("ULONG*")] out int pcOtherMethod
+ );
+
+ // STDMETHOD(GetParamProps)( // S_OK or error.
+ // mdParamDef tk, // [IN]The Parameter.
+ // mdMethodDef *pmd, // [OUT] Parent Method token.
+ // ULONG *pulSequence, // [OUT] Parameter sequence.
+ // LPWSTR szName, // [OUT] Put name here.
+ // ULONG cchName, // [OUT] Size of name buffer.
+ // ULONG *pchName, // [OUT] Put actual size of name here.
+ // DWORD *pdwAttr, // [OUT] Put flags here.
+ // DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*.
+ // void const **ppValue, // [OUT] Constant value.
+ // ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+ new void GetParamProps(int tk,
+ [ComAliasName("mdMethodDef*")] out int pmd,
+ [ComAliasName("ULONG*")] out uint pulSequence,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName,
+ uint cchName,
+ [ComAliasName("ULONG*")] out uint pchName,
+ [ComAliasName("DWORD*")] out uint pdwAttr,
+ [ComAliasName("DWORD*")] out uint pdwCPlusTypeFlag,
+ [ComAliasName("UVCP_CONSTANT*")] out IntPtr ppValue,
+ [ComAliasName("ULONG*")] out uint pcchValue
+ );
+
+ // STDMETHOD(GetCustomAttributeByName)( // S_OK or error.
+ // mdToken tkObj, // [IN] Object with Custom Attribute.
+ // LPCWSTR szName, // [IN] Name of desired Custom Attribute.
+ // const void **ppData, // [OUT] Put pointer to data here.
+ // ULONG *pcbData) PURE; // [OUT] Put size of data here.
+ [PreserveSig]
+ new int GetCustomAttributeByName(
+ int tkObj,
+ [MarshalAs(UnmanagedType.LPWStr)]string szName,
+ out IntPtr ppData,
+ out uint pcbData);
+
+ // STDMETHOD_(BOOL, IsValidToken)( // True or False.
+ // mdToken tk) PURE; // [IN] Given token.
+ [PreserveSig] new bool IsValidToken([In, MarshalAs(UnmanagedType.U4)] uint tk);
+
+ // STDMETHOD(GetNestedClassProps)( // S_OK or error.
+ // mdTypeDef tdNestedClass, // [IN] NestedClass token.
+ // mdTypeDef *ptdEnclosingClass) PURE; // [OUT] EnclosingClass token.
+ new void GetNestedClassProps(int tdNestedClass, [ComAliasName("mdTypeDef*")] out int tdEnclosingClass);
+#if !MDBG_FAKE_COM
+ // STDMETHOD(GetNativeCallConvFromSig)( // S_OK or error.
+ // void const *pvSig, // [IN] Pointer to signature.
+ // ULONG cbSig, // [IN] Count of signature bytes.
+ // ULONG *pCallConv) PURE; // [OUT] Put calling conv here (see CorPinvokemap).
+ new void GetNativeCallConvFromSig_();
+
+
+ // STDMETHOD(IsGlobal)( // S_OK or error.
+ // mdToken pd, // [IN] Type, Field, or Method token.
+ // int *pbGlobal) PURE; // [OUT] Put 1 if global, 0 otherwise.
+ new void IsGlobal_();
+#endif
+ //-----------------------------------------------------------------------------
+ // Begin IMetaDataImport2
+ //-----------------------------------------------------------------------------
+
+ /*
+ STDMETHOD(EnumGenericParams)(
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdToken tk, // [IN] TypeDef or MethodDef whose generic parameters are requested
+ mdGenericParam rGenericParams[], // [OUT] Put GenericParams here.
+ ULONG cMax, // [IN] Max GenericParams to put.
+ ULONG *pcGenericParams) PURE; // [OUT] Put # put here.
+ */
+ void EnumGenericParams(
+ ref IntPtr hEnum,
+ int tk,
+ [ComAliasName("mdGenericParam*")] out int rGenericParams,
+ uint cMax, // must be 1
+ [ComAliasName("ULONG*")] out uint pcGenericParams
+ );
+
+ // STDMETHOD(GetGenericParamProps)( // S_OK or error.
+ // mdGenericParam gp, // [IN] GenericParam
+ // ULONG *pulParamSeq, // [OUT] Index of the type parameter
+ // DWORD *pdwParamFlags, // [OUT] Flags, for future use (e.g. variance)
+ // mdToken *ptOwner, // [OUT] Owner (TypeDef or MethodDef)
+ // mdToken *ptkKind, // [OUT] For future use (e.g. non-type parameters)
+ // LPWSTR wzname, // [OUT] Put name here
+ // ULONG cchName, // [IN] Size of buffer
+ // ULONG *pchName) PURE; // [OUT] Put size of name (wide chars) here.
+ void GetGenericParamProps(int gp,
+ [ComAliasName("ULONG*")] out uint pulParamSeq,
+ [ComAliasName("DWORD*")] out int pdwParamFlags,
+ [ComAliasName("mdToken*")] out int ptOwner,
+ [ComAliasName("mdToken*")] out int ptkKind,
+ [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder wzName,
+ ulong cchName,
+ [ComAliasName("ULONG*")] out ulong pchName
+ );
+
+ // STDMETHOD(GetMethodSpecProps)(
+ // mdMethodSpec mi, // [IN] The method instantiation
+ // mdToken *tkParent, // [OUT] MethodDef or MemberRef
+ // PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ // ULONG *pcbSigBlob) PURE; // [OUT] actual size of signature blob
+
+ void GetMethodSpecProps([ComAliasName("mdMethodSpec")] int mi,
+ [ComAliasName("mdToken*")] out int tkParent,
+ [ComAliasName("PCCOR_SIGNATURE*")] out IntPtr ppvSigBlob,
+ [ComAliasName("ULONG*")] out int pcbSigBlob
+ );
+#if !MDBG_FAKE_COM
+ // STDMETHOD(EnumGenericParamConstraints)(
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdGenericParam tk, // [IN] GenericParam whose constraints are requested
+ // mdGenericParamConstraint rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here.
+ // ULONG cMax, // [IN] Max GenericParamConstraints to put.
+ // ULONG *pcGenericParamConstraints) PURE; // [OUT] Put # put here.
+ void EnumGenericParamConstraints_();
+
+ // STDMETHOD(GetGenericParamConstraintProps)( // S_OK or error.
+ // mdGenericParamConstraint gpc, // [IN] GenericParamConstraint
+ // mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained
+ // mdToken *ptkConstraintType) PURE; // [OUT] TypeDef/Ref/Spec constraint
+ void GetGenericParamConstraintProps_();
+
+ // STDMETHOD(GetPEKind)( // S_OK or error.
+ // DWORD* pdwPEKind, // [OUT] The kind of PE (0 - not a PE)
+ // DWORD* pdwMAchine) PURE; // [OUT] Machine as defined in NT header
+ void GetPEKind_();
+
+ // STDMETHOD(GetVersionString)( // S_OK or error.
+ // LPWSTR pwzBuf, // [OUT[ Put version string here.
+ // DWORD ccBufSize, // [IN] size of the buffer, in wide chars
+ // DWORD *pccBufSize) PURE; // [OUT] Size of the version string, wide chars, including terminating nul.
+ void GetVersionString_();
+
+ // STDMETHOD(EnumMethodSpecs)(
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested
+ // mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here.
+ // ULONG cMax, // [IN] Max tokens to put.
+ // ULONG *pcMethodSpecs) PURE; // [OUT] Put actual count here.
+ void EnumMethodSpecs_();
+#endif
+ }
+
+ // GUID Copied from Cor.h
+ [Guid("EE62470B-E94B-424e-9B7C-2F00C9249F93"),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)
+ ] // IID_IMetadataAssemblyImport from cor.h
+
+ // This should be a private interface, but
+ // we cannot do that becuase we are then getting an exception
+ // "The specified type must be visible from COM." @ CorMetadataImport::GetRawInterface
+ [CLSCompliant(false)]
+ public interface IMetadataAssemblyImport
+ {
+ // STDMETHOD(GetAssemblyProps)( // S_OK or error.
+ // mdAssembly mda, // [IN] The Assembly for which to get the properties.
+ // const void **ppbPublicKey, // [OUT] Pointer to the public key.
+ // ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key.
+ // ULONG *pulHashAlgId, // [OUT] Hash Algorithm.
+ // LPWSTR szName, // [OUT] Buffer to fill with assembly's simply name.
+ // ULONG cchName, // [IN] Size of buffer in wide chars.
+ // ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ // ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
+ // DWORD *pdwAssemblyFlags) PURE; // [OUT] Flags.
+
+ // STDMETHOD(GetAssemblyRefProps)( // S_OK or error.
+ // mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties.
+ // const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token.
+ // ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token.
+ // LPWSTR szName, // [OUT] Buffer to fill with name.
+ // ULONG cchName, // [IN] Size of buffer in wide chars.
+ // ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ // ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
+ // const void **ppbHashValue, // [OUT] Hash blob.
+ // ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob.
+ // DWORD *pdwAssemblyRefFlags) PURE; // [OUT] Flags.
+
+ // STDMETHOD(GetFileProps)( // S_OK or error.
+ // mdFile mdf, // [IN] The File for which to get the properties.
+ // LPWSTR szName, // [OUT] Buffer to fill with name.
+ // ULONG cchName, // [IN] Size of buffer in wide chars.
+ // ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ // const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob.
+ // ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob.
+ // DWORD *pdwFileFlags) PURE; // [OUT] Flags.
+
+ // STDMETHOD(GetExportedTypeProps)( // S_OK or error.
+ // mdExportedType mdct, // [IN] The ExportedType for which to get the properties.
+ // LPWSTR szName, // [OUT] Buffer to fill with name.
+ // ULONG cchName, // [IN] Size of buffer in wide chars.
+ // ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ // mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType.
+ // mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file.
+ // DWORD *pdwExportedTypeFlags) PURE; // [OUT] Flags.
+
+ // STDMETHOD(GetManifestResourceProps)( // S_OK or error.
+ // mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties.
+ // LPWSTR szName, // [OUT] Buffer to fill with name.
+ // ULONG cchName, // [IN] Size of buffer in wide chars.
+ // ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ // mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ManifestResource.
+ // DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file.
+ // DWORD *pdwResourceFlags) PURE;// [OUT] Flags.
+
+ // STDMETHOD(EnumAssemblyRefs)( // S_OK or error
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here.
+ // ULONG cMax, // [IN] Max AssemblyRefs to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ // STDMETHOD(EnumFiles)( // S_OK or error
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdFile rFiles[], // [OUT] Put Files here.
+ // ULONG cMax, // [IN] Max Files to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ // STDMETHOD(EnumExportedTypes)( // S_OK or error
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here.
+ // ULONG cMax, // [IN] Max ExportedTypes to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ // STDMETHOD(EnumManifestResources)( // S_OK or error
+ // HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ // mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here.
+ // ULONG cMax, // [IN] Max Resources to put.
+ // ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ // STDMETHOD(GetAssemblyFromScope)( // S_OK or error
+ // mdAssembly *ptkAssembly) PURE; // [OUT] Put token here.
+
+ // STDMETHOD(FindExportedTypeByName)( // S_OK or error
+ // LPCWSTR szName, // [IN] Name of the ExportedType.
+ // mdToken mdtExportedType, // [IN] ExportedType for the enclosing class.
+ // mdExportedType *ptkExportedType) PURE; // [OUT] Put the ExportedType token here.
+
+ // STDMETHOD(FindManifestResourceByName)( // S_OK or error
+ // LPCWSTR szName, // [IN] Name of the ManifestResource.
+ // mdManifestResource *ptkManifestResource) PURE; // [OUT] Put the ManifestResource token here.
+
+ // STDMETHOD_(void, CloseEnum)(
+ // HCORENUM hEnum) PURE; // Enum to be closed.
+
+ // STDMETHOD(FindAssembliesByName)( // S_OK or error
+ // LPCWSTR szAppBase, // [IN] optional - can be NULL
+ // LPCWSTR szPrivateBin, // [IN] optional - can be NULL
+ // LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
+ // IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here
+ // ULONG cMax, // [IN] The max number to put
+ // ULONG *pcAssemblies) PURE; // [OUT] The number of assemblies returned.
+ // }; // IMetaDataAssemblyImport
+ }
+}
diff --git a/CorApi/RawAssemblyAttributes.cs b/CorApi/RawAssemblyAttributes.cs
new file mode 100644
index 0000000..2f02b53
--- /dev/null
+++ b/CorApi/RawAssemblyAttributes.cs
@@ -0,0 +1,12 @@
+//---------------------------------------------------------------------
+// This file is part of the CLR Managed Debugger (mdbg) Sample.
+//
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// Imports ICorDebug interface into managed code
+//---------------------------------------------------------------------
+
+
+// Assembly attributes for Raw native imports.
+using System;
+[assembly:CLSCompliant(false)]
diff --git a/CorApi/WindowsImports.cs b/CorApi/WindowsImports.cs
new file mode 100644
index 0000000..756f85c
--- /dev/null
+++ b/CorApi/WindowsImports.cs
@@ -0,0 +1,117 @@
+//---------------------------------------------------------------------
+// This file is part of the CLR Managed Debugger (mdbg) Sample.
+//
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//
+// Imports the win32 structures needed by the ICorDebug interfaces.
+//---------------------------------------------------------------------
+
+using System;
+using System.Text;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+using Microsoft.Samples.Debugging.CorMetadata.NativeApi;
+using Microsoft.Win32.SafeHandles;
+
+
+namespace Microsoft.Samples.Debugging.CorDebug.NativeApi
+{
+ #region X86 Context
+ [StructLayout(LayoutKind.Sequential)]
+ public struct WIN32_CONTEXT
+ {
+ public uint ContextFlags;
+ public uint Dr0;
+ public uint Dr1;
+ public uint Dr2;
+ public uint Dr3;
+ public uint Dr6;
+ public uint Dr7;
+ public WIN32_FLOATING_SAVE_AREA FloatSave;
+ public uint SegGs;
+ public uint SegFs;
+ public uint SegEs;
+ public uint SegDs;
+ public uint Edi;
+ public uint Esi;
+ public uint Ebx;
+ public uint Edx;
+ public uint Ecx;
+ public uint Eax;
+ public uint Ebp;
+ public uint Eip;
+ public uint SegCs;
+ public uint EFlags;
+ public uint Esp;
+ public uint SegSs;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x200)]
+ public byte[] ExtendedRegisters;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct WIN32_FLOATING_SAVE_AREA
+ {
+ public uint ControlWord;
+ public uint StatusWord;
+ public uint TagWord;
+ public uint ErrorOffset;
+ public uint ErrorSelector;
+ public uint DataOffset;
+ public uint DataSelector;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]
+ public byte[] RegisterArea;
+ public uint Cr0NpxState;
+ }
+
+ #endregion // X86 Context
+
+
+ #region Structures for CreateProcess
+ [StructLayout(LayoutKind.Sequential, Pack = 8), ComVisible(false)]
+ public class PROCESS_INFORMATION
+ {
+ public IntPtr hProcess;
+ public IntPtr hThread;
+ public int dwProcessId;
+ public int dwThreadId;
+ public PROCESS_INFORMATION() { }
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 8), ComVisible(false)]
+ public class SECURITY_ATTRIBUTES
+ {
+ public int nLength;
+ public IntPtr lpSecurityDescriptor;
+ public bool bInheritHandle;
+ public SECURITY_ATTRIBUTES() { }
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 8), ComVisible(false)]
+ public class STARTUPINFO
+ {
+ public int cb;
+ public string lpReserved;
+ public string lpDesktop;
+ public string lpTitle;
+ public int dwX;
+ public int dwY;
+ public int dwXSize;
+ public int dwYSize;
+ public int dwXCountChars;
+ public int dwYCountChars;
+ public int dwFillAttribute;
+ public int dwFlags;
+ public short wShowWindow;
+ public short cbReserved2;
+ public IntPtr lpReserved2;
+ public SafeFileHandle hStdInput;
+ public SafeFileHandle hStdOutput;
+ public SafeFileHandle hStdError;
+ public STARTUPINFO() { }
+ }
+
+ #endregion // Structures for CreateProcess
+
+
+} // Microsoft.Samples.Debugging.CorDebug.NativeApi \ No newline at end of file