- UID
- 55231
注册时间2008-9-2
阅读权限20
最后登录1970-1-1
以武会友
TA的每日心情 | 开心 2021-10-9 09:15 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
尝试写loader,不知道为什么修改地址$004B82B6总是Bytes don 't match ,希望各老师指点- var
- i: Integer;
- cl: PChar;
- si: TStartupInfo;
- pi: PROCESS_INFORMATION;
- Buffer: array[0..5] of Byte;
- nByteRead, nByteWrite: Cardinal;
- NewBytes: array[0..5] of Byte;
- const
- BaseAddress: Pointer = Pointer($004B82B6);
- Original: array[0..5] of Byte = ($8B,$80,$C4,$04,$00,$00);
- FName = 'MP3.exe';
- Err1 = 'Can ''t CreateProcess';
- Err2 = 'Can ''t ReadProcessMemory';
- Err3 = 'Bytes don ''t match ';
- Err4 = 'Can ''t WriteProcessMemory';
- begin
- NewBytes[0] := $8B;
- NewBytes[1] := $C2;
- for i := 2 to 5 do
- NewBytes[i] := $90;
- ZeroMemory(@si, SizeOf(si));
- si.cb := SizeOf(si);
- cl := GetCommandLine;
- if CreateProcess(FName, cl, nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, si, pi) then
- begin
- WaitForInputIdle(pi.hProcess,INFINITE);
- if ReadProcessMemory(pi.hProcess, BaseAddress, @NewBytes, 6, nByteRead) then
- begin
- for i := 0 to 5 do
- if Buffer[i] <> Original[i] then Break;
- if i = 5 then
- begin
- if not WriteProcessMemory(pi.hProcess, BaseAddress, @NewBytes, 6, nByteWrite) then ShowMessage(Err4)
- end else ShowMessage(Err3);
- end else ShowMessage(Err2);
- CloseHandle(pi.hProcess);
- CloseHandle(pi.hThread);
- end else ShowMessage(Err1);
- end;
复制代码 |
|