MemoryModule
Table of Contents
About Memory Module
MemoryModule
was developed by Joachim Bauch and is released under MPL 2.0.
The default windows API functions to load external libraries into a program
(LoadLibrary, LoadLibraryEx) only work with files on the filesystem. MemoryModule is a library that can be used to load a DLL completely from
memory - without storing on the disk first.
Load a dll
multiple times: AutoHotkey is not designed for multi-threading
naturally and most likely it will be never implemented. Using AutoHotkey.dll
we can stil run multiple scripts in one process, on a
multi-core system we can even run multiple scripts at the same time. To do so,
AutoHotkey module also needs to be loaded multiple times. Instead of using
multiple dlls by copying and renaming them we can use Memory Module.
COM support: AutoHotkey_H additionally supports loading unregistered dlls using ComObjDll.
Internally AutoHotkey.dll COM Interface always uses MemoryModule to create a new thread, this allows loading the same module multiple times. AutoHotkey.dll automatically frees the module when COM object is released.
Functions: Following functions are available
- MemoryLoadLibrary - Load a dll from Memory, similar to LoadLibrary.
- MemoryGetProcAddress - Get address of a function in dll, similar to GetProcAddress
- MemoryFreeLibrary - Free dll, similar to FreeLibrary
- MemoryFindResource - Find Resource in a dll, similar to FindResource and FindResourceEx
- MemorySizeofResource - Retrieves the size in bytes, of the specified resource in a dll, similar to SizeOfResource
- MemoryLoadResource - Load the specified resource in a dll, similar to LoadResource
- MemoryLoadString - Load the specified String resource in a dll, similar to LoadString