線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2321
推到 Plurk!
推到 Facebook!

請教記憶體寫入問題WriteProcessMemory

尚未結案
kakene
一般會員


發表:22
回覆:52
積分:19
註冊:2003-01-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-03-16 01:07:36 IP:203.204.xxx.xxx 未訂閱
之前參考 http://delphi.ktop.com.tw/topic.php?topic_id=56568 不過只有提到讀取,沒有寫入    我想在記憶體區間尋找某字串  找到後再作修改  不知道可不可以給個範例參考
 hWnd :=FindWindow(nil, PChar('FileZilla server')); 
  GetWindowThreadProcessId(hWnd , ProcessID); 
  hProcess := OpenProcess(PROCESS_ALL_ACCESS, True, ProcessID); 
  nSize:=4; 
  lpBuffer:=AllocMem(nSize);       for i:=$00450001 to $0046005f do//目前是在固定區間尋找 
  begin 
    ReadProcessMemory(hProcess,Pointer(i),lpBuffer,nSize,lpNumberOfBytesRead); 
    s:=s intTohex(lpBuffer^,2) ' ';        t:=t intTohex(lpBuffer^,2); 
    if Length(t)>8then 
      t := copy( t , 3 , 8 ) ; 
    if t ='8B4DF8BA'then//找到固定字 
    begin  //請問這裡怎麼寫入記憶體?這是我亂寫的      
      lpBuffer^ := '123456789';
      WriteProcessMemory(hProcess,Pointer(i),lpBuffer,nSize,lpNumberOfBytesWritten); 
    end; 
  end; 
發表人 - kakene 於 2005/03/17 00:42:15
kakene
一般會員


發表:22
回覆:52
積分:19
註冊:2003-01-07

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-03-18 13:27:12 IP:203.204.xxx.xxx 未訂閱
我在此篇文章找到 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=30640
begin
  const
  ResourceOffset: dword = $004219F4;
  resource: dword = 3113226621;
  ResourceOffset1: dword = $004219F8;
  resource1: dword = 1940000000;
  ResourceOffset2: dword = $0043FA50;
  resource2: dword = 1280185;
  ResourceOffset3: dword = $0043FA54;
  resource3: dword = 3163064576;
  ResourceOffset4: dword = $0043FA58;
  resource4: dword = 2298478592;
var
  hw: HWND;
  pid: dword;
  h: THandle;
  tt: Cardinal;
begin
  hw := FindWindow('XX', nil);
  if hw = 0 then
    Exit;
  GetWindowThreadProcessId(hw, @pid);
  h := OpenProcess(PROCESS_ALL_ACCESS, false, pid);
  if h = 0 then
    Exit;
  if flatcheckbox1.Checked=true then
  begin
    WriteProcessMemory(h, Pointer(ResourceOffset), @Resource, sizeof(Resource), tt);
    WriteProcessMemory(h, Pointer(ResourceOffset1), @Resource1, sizeof(Resource1), tt);
  end;
  if flatcheckbox2.Checked=true then
  begin
    WriteProcessMemory(h, Pointer(ResourceOffset2), @Resource2, sizeof(Resource2), tt);
    WriteProcessMemory(h, Pointer(ResourceOffset3), @Resource3, sizeof(Resource3), tt);
    WriteProcessMemory(h, Pointer(ResourceOffset4), @Resource4, sizeof(Resource4), tt);
  end;
  MessageBeep(0);
  CloseHandle(h);
  close;
end;
系統時間:2024-05-01 15:20:52
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!