我的是DLL注入到某进程里然后pi2 := pointer(strtoint(Edit1.Text));    if VirtualProtect(pI2, SizeOf(pI2),PAGE_EXECUTE_READWRITE, @lp) = true then
    begin
      Edit28.Text := '成功';
    end
    else
    begin
      Edit28.Text := inttostr(getlasterror())
    end;
返回错误是5请教如何解决?谢谢!

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    procedure TForm1.Button1Click(Sender: TObject);
    var
      h:longword; //放句柄
      pid:longword;//放PID
      tmp:longword;//这个专门来占格式收集垃圾
      DllName:pchar;//注入的dll的文件名
      Mysize:longword;//放字符串长度
      Parameter:pointer;//放那个参数的指针(位置在目标进程内)
    begin
     DLLName:='dlltest.dll';
     Mysize:=strlen(Dllname)+1;
     winexec('notepad',1);
     GetWindowThreadProcessId(FindWindow('notepad', nil), @pid);
     h:=openProcess(PROCESS_ALL_ACCESS, False, pid);
     Parameter:= VirtualAllocEx(h, nil, Mysize, MEM_COMMIT, PAGE_READWRITE);
     WriteProcessMemory(h, Parameter, Pointer(DllName), MySize, tmp);
     CreateRemoteThread(h,nil,  0, GetProcAddress(GetModuleHandle('KERNEL32.DLL'), 'LoadLibraryA'), Parameter, 0 , tmp);
    end;end.
      

  2.   

    请问楼上两星星发的是什么...
    请看问题
    to bdmh 我知道不可访问,怎么解决呢,
    我想修改那个地址的值,绝对不是系统的,是0400000前面的