~ruther/csharp-dll-injector

ref: f606b7433c934d799b2c94bf8caf1a6f3bd38c13 csharp-dll-injector/DllUtils/Modules/InjectedModule.cs -rw-r--r-- 805 bytes
f606b743 — František Boháček chore: add license 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DllUtils.Interop;
using DllUtils.Memory;
using DllUtils.Process;

namespace DllUtils.Modules
{
    public class InjectedModule : RemoteModule
    {
        public InjectedModule(IntPtr remoteHandle, IntPtr localHandle, RemoteProcessHandle processHandle, string dllPath)
            : base(remoteHandle, localHandle, processHandle)
        {
            DllPath = dllPath;
        }

        public string DllPath { get; }

        public bool FreeLibrary()
        {
            RemoteModule kernel32 = Process.GetRemoteKernel32();
            FunctionResult result = kernel32.ExecuteFunction("FreeLibrary", RemoteHandle);

            return result.To<bool>();
        }
    }
}
Do not follow this link