Binarysharp.MemoryManagement.Modules.RemoteModule.InternalEject C# (CSharp) Method

InternalEject() static private method

Frees the loaded dynamic-link library (DLL) module and, if necessary, decrements its reference count.
static private InternalEject ( MemorySharp memorySharp, RemoteModule module ) : void
memorySharp MemorySharp The reference of the object.
module RemoteModule The module to eject.
return void
        internal static void InternalEject(MemorySharp memorySharp, RemoteModule module)
        {
            // Call FreeLibrary remotely
            memorySharp.Threads.CreateAndJoin(memorySharp["kernel32"]["FreeLibrary"].BaseAddress, module.BaseAddress);
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        ///     Frees the loaded dynamic-link library (DLL) module and, if necessary, decrements its reference count.
        /// </summary>
        /// <param name="module">The module to eject.</param>
        public void Eject(RemoteModule module)
        {
            // If the module is valid
            if (!module.IsValid)
            {
                return;
            }

            // Find if the module is an injected one
            var injected = InternalInjectedModules.FirstOrDefault(m => m.Equals(module));

            if (injected != null)
            {
                InternalInjectedModules.Remove(injected);
            }

            // Eject the module
            RemoteModule.InternalEject(MemorySharp, module);
        }