ไลบรารีนี้ไม่ทำงานใน Windows 11 เวอร์ชัน 24H2 อีกต่อไป การปรับปรุงความปลอดภัยใหม่ทำให้ไม่สามารถใช้งานได้ ฉันยังไม่พบการแก้ไข!

หน่วย MemoryDll ให้ฟังก์ชั่นขั้นสูงสำหรับการโหลดไลบรารี Dynamic-Link (DLLs) โดยตรงจากหน่วยความจำในสภาพแวดล้อม Win64 ซึ่งแตกต่างจากวิธีการดั้งเดิมที่เกี่ยวข้องกับการโหลด DLLs จากระบบไฟล์ MemoryDll ช่วยให้คุณโหลด DLL จากอาร์เรย์ไบต์หรือสตรีมหน่วยความจำได้หรือไม่ ห้องสมุดนี้เหมาะสำหรับนักพัฒนา Delphi/Freepascal ที่ต้องการจัดการ DLLs โดยไม่ต้องพึ่งพาระบบไฟล์เพิ่มประสิทธิภาพทั้งประสิทธิภาพและความปลอดภัย
MemoryDll เปิดใช้งานการโหลด DLL ในหน่วยความจำและการเปลี่ยนเส้นทางโดยใช้ตัวยึด DLLS และการโหลดตามตะขอเพื่อข้ามการโหลด DLL แบบดั้งเดิมตามไฟล์:
advapi32res.dll ) DLL นี้ทำหน้าที่เป็นทริกเกอร์สำหรับตะขอเพื่อสกัดกั้นและจัดการการเปลี่ยนเส้นทางไปยัง DLL ในหน่วยความจำ ความเข้ากันได้? : หน่วย MemoryDLL เข้ากันได้กับอินเทอร์เฟซ DLL มาตรฐานช่วยให้สามารถรวมเข้ากับแอปพลิเคชันที่มีอยู่ได้ง่าย วิธีการเปลี่ยนเส้นทางในหน่วยความจำยังช่วยลดความเสี่ยงด้านความปลอดภัยเช่นการฉีดรหัสหรือไม่เสนอทางเลือกที่ปลอดภัยสำหรับการจัดการ DLL
โหลดโมดูลจากอิมเมจหน่วยความจำเลียนแบบพฤติกรรมของฟังก์ชั่น LoadLibrary Windows API มันแยกวิเคราะห์รูปแบบ PE ดำเนินการย้ายที่จำเป็นแก้ไขการนำเข้าและเริ่มต้นโมดูล
Data: Pointer - ตัวชี้ไปยังอิมเมจหน่วยความจำที่สอดคล้องกับรูปแบบ PETHandle แทนโมดูลที่โหลดหรือ 0 เมื่อความล้มเหลวหากต้องการรวม MemoryDll เข้ากับโครงการของคุณได้อย่างประสบความสำเร็จโปรดทำตามขั้นตอนเหล่านี้:
ดาวน์โหลดเวอร์ชันล่าสุด?
เปิดซิปแพ็คเกจ
เพิ่ม MemoryDll ลงในโครงการของคุณ➕
uses ของโครงการของคุณ การรวมนี้จะทำให้หน่วย MemoryDll พร้อมใช้งานในแอปพลิเคชันของคุณ ตรวจสอบให้แน่ใจว่าพา ธ ไปยังไฟล์ต้นฉบับ MemoryDll ได้รับการกำหนดค่าอย่างถูกต้องในการตั้งค่าโครงการของคุณเพื่อหลีกเลี่ยงข้อผิดพลาดในการรวบรวมการรวมเข้าด้วยกันอย่างราบรื่นกับความเข้ากันได้ของ Windows API
MemoryLoadLibrary เพื่อโหลด DLL โดยตรงจากหน่วยความจำ เมื่อโหลดแล้วการโทร Windows API มาตรฐานเช่น FreeLibrary และ GetProcAddress สามารถใช้ในการจัดการ DLL ในหน่วยความจำราวกับว่ามันถูกโหลดจากระบบไฟล์ การออกแบบนี้ช่วยให้มั่นใจได้ว่าการเปลี่ยนแปลงรหัสที่มีอยู่น้อยที่สุดรักษาความเข้ากันได้กับการประชุม Windows API ในขณะที่เปิดใช้งานการจัดการ DLL ในหน่วยความจำที่มีประสิทธิภาพทดสอบการรวม✅
ในการสร้างอินสแตนซ์ MemoryDll ให้รวมรหัสต่อไปนี้ที่ส่วนท้ายของส่วนการใช้งานของหน่วย รหัสนี้พยายามโหลด DLL เป็นทรัพยากรที่ฝังอยู่:
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();
หน่วยนี้ขึ้นอยู่กับโครงการ MemoryDll-Dllredirect ดั้งเดิมโดย A-Normal-user เรารับทราบถึงงานพื้นฐานที่หน่วยนี้สร้างขึ้น
โครงการนี้ได้รับใบอนุญาตภายใต้ ใบอนุญาต BSD-3-Clause ? มันสร้างความสมดุลระหว่างการอนุญาตและการปกป้องสิทธิของผู้มีส่วนร่วม
การมีส่วนร่วมใน MemoryDll ได้รับการสนับสนุนอย่างสูง โปรดส่งปัญหาแนะนำคุณสมบัติใหม่หรือสร้างคำขอดึงเพื่อขยายขีดความสามารถและความแข็งแกร่ง

ทำด้วย❤ใน Delphi