概述:通过 Omniover 来整理碎片知识

相关链接

Omnivore

个人配置

Article Template

# {{{title}}}
#Omnivore
 
[Read on Omnivore]({{{omnivoreUrl}}})
[Read Original]({{{originalUrl}}})
 
{{#highlights.length}}
## Highlights
 
{{#highlights}}
> {{{text}}} [⤴️]({{{highlightUrl}}}) {{#labels}} #{{name}} {{/labels}}
{{#note}}
 
{{{note}}}
{{/note}}
 
{{/highlights}}
{{/highlights.length}}
 
---
 
{{{content}}}

Front Matter

id: {{{id}}}
title: >
  {{{title}}}
{{#author}}
author: >
  {{{author}}}
{{/author}}
{{#labels.length}}
tags:
{{#labels}} - {{{name}}}
{{/labels}}
{{/labels.length}}
date_saved: {{{dateSaved}}}
{{#datePublished}}
date_published: {{{datePublished}}}
{{/datePublished}}
tags: [Omnivore,{{{labels}}}]
internal static class ModuleHelper
{
    private static IDictionary<IntPtr, Module>? _mapAddressToModule;
    private static readonly FieldInfo m_pData;
    private static readonly MethodInfo GetHInstance;
 
    private static readonly object LoadLock = new();
    private static readonly object LockSelfMapsLinux = new object();
 
    static ModuleHelper()
    {
        m_pData = Type.GetType("System.Reflection.RuntimeModule")
            .GetField("m_pData", BindingFlags.NonPublic | BindingFlags.Instance);
        GetHInstance = typeof(Marshal).GetMethod("GetHINSTANCE", new[] { typeof(Module) })!;
        LoadMapScopeToHandle();
    }
    
	public static IntPtr GetAddressFromModule(Module module)
	{
	    return (IntPtr)m_pData.GetValue(module);
	}
}