Created
February 7, 2020 22:29
-
-
Save hypeartist/b06c0c59d0e9d175efc199e0211ca867 to your computer and use it in GitHub Desktop.
CoreClrImageBase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApp1 | |
{ | |
internal static class Program | |
{ | |
private static unsafe void Main(string[] args) | |
{ | |
var tp = new ThreadPrivateAccessor {Thread = Thread.CurrentThread}; | |
var currentThreadHandle = (void**)tp.ThreadExposer._DONT_USE_InternalThread; | |
var someProcFromCoreClr = *currentThreadHandle; | |
var coreClrImageBase = (byte*)someProcFromCoreClr - 0x3ec4c0; | |
} | |
} | |
public sealed class ThreadExposer | |
{ | |
internal ExecutionContext? _executionContext; | |
internal SynchronizationContext? _synchronizationContext; | |
private string? _name; | |
private Delegate? _delegate; | |
private object? _threadStartArg; | |
public/*Sic!*/ IntPtr _DONT_USE_InternalThread; | |
} | |
[StructLayout(LayoutKind.Explicit)] | |
public struct ThreadPrivateAccessor | |
{ | |
[FieldOffset(0)] | |
public Thread Thread; | |
[FieldOffset(0)] | |
public ThreadExposer ThreadExposer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment