教初學(xué)者如何把執(zhí)行文件內(nèi)存中的DLL的代碼全部保存下來
發(fā)布日期:2021-12-16 08:15 | 文章來源:源碼中國
有時,有些軟件有保護,看不到他程序內(nèi)部是怎么一個樣,如果想簡單的把他的內(nèi)存保存下來!
我寫了一個簡單的函數(shù),調(diào)用一下就可以把DLL和EXE的內(nèi)存里的信息全部導(dǎo)到文件里!到時再慢慢查吧! uses
TlHelp32;
procedure GetDLLMemToFile;
var
PID: Dword;
Hand: THandle;
lppe: TModuleEntry32;
found: boolean;
File111: TFileStream;
dd, Add1, Add2, index: dword;
begin
Hand := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessID);
lppe.dwSize := SizeOf(lppe);
found := Module32First(Hand, lppe);
while found do
begin
File111 := TFileStream.Create('debug\'extractfilename(lppe.szExePath), $FFFF); Add1 := dword(lppe.modBaseAddr);
Add2 := Add1lppe.modBaseSize;
index := dword(lppe.modBaseAddr);
while true do
begin
dd := Pdword(index)^;
File111.WriteBuffer(dd, 4);
inc(index, 4);
if index >= Add2 - 4 then break;
end; File111.Destroy; found := Module32Next(Hand, lppe);
end;
CloseHandle(Hand); // 釋放快照句柄
end;
我寫了一個簡單的函數(shù),調(diào)用一下就可以把DLL和EXE的內(nèi)存里的信息全部導(dǎo)到文件里!到時再慢慢查吧! uses
TlHelp32;
procedure GetDLLMemToFile;
var
PID: Dword;
Hand: THandle;
lppe: TModuleEntry32;
found: boolean;
File111: TFileStream;
dd, Add1, Add2, index: dword;
begin
Hand := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessID);
lppe.dwSize := SizeOf(lppe);
found := Module32First(Hand, lppe);
while found do
begin
File111 := TFileStream.Create('debug\'extractfilename(lppe.szExePath), $FFFF); Add1 := dword(lppe.modBaseAddr);
Add2 := Add1lppe.modBaseSize;
index := dword(lppe.modBaseAddr);
while true do
begin
dd := Pdword(index)^;
File111.WriteBuffer(dd, 4);
inc(index, 4);
if index >= Add2 - 4 then break;
end; File111.Destroy; found := Module32Next(Hand, lppe);
end;
CloseHandle(Hand); // 釋放快照句柄
end;
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
相關(guān)文章
下一篇: