10-02-2010, 11:06 PM
السلام عليكم
كتبت بالأمس إجراء يقوم بعمل Patch لموضع محدد من ذاكرة ملف أثناء تشغيله:
الإجراء لا شيء فيه جديد غير أنه سهل الاستخدام، ربما يفيد من يستخدمه بكثرة
يصلح لعمل Loader لبرنامجك، أو أحيانا لبرنامج آخر :bones:
مثال Aimersoft Video Converter Ultimate v3.2.0.3ـ:
لأجل:
تحياتي.
كتبت بالأمس إجراء يقوم بعمل Patch لموضع محدد من ذاكرة ملف أثناء تشغيله:
PHP كود :
uses
Windows;
procedure MemoryPatch(sExecutableFilePath :string; Patch: Byte; BaseAddress: Integer; nSize, BytesCount: Cardinal);
var
ProcessInfo: TProcessInformation;
StpInfo: TStartupInfo;
buf: PChar;
begin
buf := nil;
FillMemory(@StpInfo, sizeof( StpInfo ), 0 );
StpInfo.cb := sizeof( StpInfo );
if not CreateProcess(Nil, PChar( sExecutableFilePath ),
Nil, Nil, False, NORMAL_PRIORITY_CLASS,
Nil, Nil, StpInfo, ProcessInfo ) then
MessageBox(0, 'Program not found!', '', MB_OK + MB_ICONWARNING)
else begin
GetMem(buf, 1);
buf^ := Chr(Patch);
WriteProcessMemory(ProcessInfo.hProcess, Ptr(BaseAddress), buf, nSize, BytesCount);
FreeMem(buf);
end;
CloseHandle( ProcessInfo.hProcess );
CloseHandle( ProcessInfo.hThread );
end;
يصلح لعمل Loader لبرنامجك، أو أحيانا لبرنامج آخر :bones:
مثال Aimersoft Video Converter Ultimate v3.2.0.3ـ:
كود :
MemoryPatch('VideoConverterUltimate.exe', $DE, $0050F44D, 1, 1);كود :
http://www.aimersoft.com/video-converter-ultimate.html