Diese Bibliothek funktioniert nicht mehr in Windows 11 Version 24H2. Die neuen Sicherheitsverbesserungen machen es nicht funktionsfähig. Ich habe noch keine Lösung gefunden!

Die MemoryDLL- Einheit bietet erweiterte Funktionen für das Laden von Dynamic-Link-Bibliotheken (DLLs) direkt aus dem Speicher in Win64-Umgebungen. Im Gegensatz zu herkömmlichen Methoden, bei denen DLLs aus dem Dateisystem geladen werden, können Sie mit MEMAMETDLL DLLs aus Byte-Arrays oder Speicherströmen laden, Funktionadressen abrufen und diese entladen-all-in-Memory. Diese Bibliothek ist ideal für Delphi/Freepascal -Entwickler, die DLLs verwalten müssen, ohne sich auf das Dateisystem zu verlassen und sowohl die Leistung als auch die Sicherheit zu verbessern.
MEMEMEDLL ermöglicht das Laden und Umleitungen von DLL in der Memory, indem sie Placeholder-DLLs und Hook-basierte Laden verwenden, um die herkömmliche dateibasierte DLL-Lade zu umgehen:
advapi32res.dll ) geladen werden. Diese DLL fungiert als Auslöser für den Haken, um die Umleitung zu einer In-Memory-DLL abzufangen und umzugehen. Kompatibilität? : Die MemoryDLL -Einheit ist mit Standard -DLL -Schnittstellen kompatibel und ermöglicht eine einfache Integration in vorhandene Anwendungen. Die In-Memory-Umleitungsmethode reduziert auch die Sicherheitsrisiken wie die Code-Injektion und bietet eine sichere Alternative für das DLL-Management.
Lädt ein Modul aus einem Speicherbild und ahmt das Verhalten der Windows -API LoadLibrary -Funktion nach. Es analysiert das PE -Format, führt die notwendigen Umzugsumlösungen aus, löst Importe auf und initialisiert das Modul.
Data: Pointer - Ein Zeiger auf das Speicherbild, das dem PE -Format entspricht.THandle das das geladene Modul oder 0 beim Fehler darstellt.Um MemoryDll erfolgreich in Ihr Projekt zu integrieren, befolgen Sie bitte die folgenden Schritte:
Die neueste Version herunterladen?
Das Paket entpacken
Fügen Sie Ihrem Projekt MemoryDll hinzu ➕
uses Ihres Projekts MemoryDLL hinzu. Mit dieser Aufnahme wird die MEAMMEDLL -Einheit für die Verwendung in Ihrer Anwendung verfügbar. Stellen Sie sicher, dass der Pfad zur MEMAMEDDLL -Quelldatei in Ihren Projekteinstellungen korrekt konfiguriert ist, um Kompilierungsfehler zu vermeiden.Nahtlose Integration in die Windows -API -Kompatibilität
MemoryLoadLibrary zum Laden von DLLs direkt aus dem Speicher bereitgestellt wird. Nach dem Laden können Standard-Windows-API-Aufrufe wie FreeLibrary und GetProcAddress verwendet werden, um die In-Memory-DLL so zu verwalten, als ob sie aus dem Dateisystem geladen worden wäre. Dieses Design sorgt für minimale Änderungen am vorhandenen Code und sorgt für die Kompatibilität mit Windows-API-Konventionen und ermöglicht gleichzeitig eine effiziente In-Memory-DLL-Handhabung.Testen Sie die Integration ✅
Fügen Sie zum Instanziieren von Speicherdll den folgenden Code am Ende des Abschnitts der Implementierung der Einheit hinzu. Dieser Code versucht, die DLL als eingebettete Ressource zu laden:
uses
Windows,
MemoryDLL;
...
implementation
{
This code is an example of using MemoryDLL to load an embedded a DLL directly
from an embedded resource in memory, ensuring that no filesystem access is
required. It includes methods for loading, initializing, and unloading the
DLL. The DLL is loaded from a resource with a GUID name, providing a measure
of security by obfuscating the resource’s identity.
Variables:
- DLLHandle: THandle
- A handle to the loaded DLL. Initialized to 0, indicating the DLL has
not been loaded. It is updated with the handle returned from
LoadLibrary when the DLL is successfullyloaded from memory.
Functions:
- LoadDLL: Boolean
- Loads the DLL from an embedded resource and initializes it by
retrieving necessary exported functions. Returns True if the DLL is
loaded successfully, otherwise False.
- b6eb28fd6ebe48359ef93aef774b78d1: string
- A GUID-named helper function that returns the resource name for the DLL.
This GUID-like name helps avoid easy detection of the resource.
- UnloadDLL: procedure
- Unloads the DLL by freeing the library associated with DLLHandle. Resets
DLLHandle to 0 to indicate the DLL is unloaded.
Initialization:
- The LoadDLL function is called during initialization, and the program will
terminate with code 1 if the DLL fails to load.
Finalization:
- The UnloadDLL procedure is called upon finalization, ensuring the DLL is
unloaded before program termination.
}
var
DLLHandle: THandle = 0 ; // Global handle to the loaded DLL, 0 when not loaded.
{
LoadDLL
--------
Attempts to load a DLL directly from a resource embedded within the executable
file. This DLL is expected to be stored as an RCDATA resource under a specific
GUID-like name.
Returns:
Boolean - True if the DLL is successfully loaded, False otherwise.
}
function LoadDLL (): Boolean;
var
LResStream: TResourceStream; // Stream to access the DLL data stored in the
resource.
{
b6eb28fd6ebe48359ef93aef774b78d1
---------------------------------
Returns the name of the embedded DLL resource. Uses a GUID-like name for
obfuscation.
Returns:
string - The name of the resource containing the DLL data.
}
function b6eb28fd6ebe48359ef93aef774b78d1 (): string;
const
// GUID-like resource name for the embedded DLL.
CValue = ' b87deef5bbfd43c3a07379e26f4dec9b ' ;
begin
Result := CValue;
end ;
begin
Result := False;
// Check if the DLL is already loaded.
if DLLHandle <> 0 then Exit;
// Ensure the DLL resource exists.
if not Boolean((FindResource(HInstance,
PChar(b6eb28fd6ebe48359ef93aef774b78d1()), RT_RCDATA) <> 0 )) then Exit;
// Create a stream for the DLL resource data.
LResStream := TResourceStream.Create(HInstance,
b6eb28fd6ebe48359ef93aef774b78d1(), RT_RCDATA);
try
// Attempt to load the DLL from the resource stream.
DLLHandle := MemoryLoadLibrary(LResStream.Memory);
if DLLHandle = 0 then Exit; // Loading failed.
// Retrieve and initialize any necessary function exports from the DLL.
GetExports(DLLHandle);
Result := True; // Successful load and initialization.
finally
LResStream.Free(); // Release the resource stream.
end ;
end ;
{
UnloadDLL
---------
Frees the loaded DLL, releasing any resources associated with DLLHandle,
and resets DLLHandle to 0.
}
procedure UnloadDLL ();
begin
if DLLHandle <> 0 then
begin
FreeLibrary(DLLHandle); // Unload the DLL.
DLLHandle := 0 ; // Reset DLLHandle to indicate the DLL is no longer loaded.
end ;
end ;
initialization
// Attempt to load the DLL upon program startup. Halt execution with error
// code 1 if it fails.
if not LoadDLL() then
begin
Halt( 1 );
end ;
finalization
// Ensure the DLL is unloaded upon program termination.
UnloadDLL();
Diese Einheit basiert auf dem ursprünglichen MemoryDll-Dllredirect- Projekt von A-Normal-User. Wir danken für die grundlegenden Arbeit, auf der diese Einheit aufbaut.
Dieses Projekt ist unter der BSD-3-Klausel-Lizenz lizenziert? Dies ermöglicht eine Umverteilung und Verwendung in Quellen- und Binärformen mit oder ohne Änderung, sofern bestimmte Bedingungen erfüllt sind. Es schafft ein Gleichgewicht zwischen Erlaubnis und Schutz der Rechte von Mitwirkenden.
Beiträge zu MemoryDll sind sehr gefördert. Bitte zögern Sie nicht, Probleme einzureichen, neue Funktionen vorzuschlagen oder Pull -Anfragen zu erstellen, um seine Funktionen und Robustheit zu erweitern.

Hergestellt mit ❤️ in Delphi