很不好意思,您还在发贴子,我居然给结了,很是抱歉,请您把没有发完的贴子发完好吗,谢谢
上篇您写到了“//读写物理内存 一………………//后接”

解决方案 »

  1.   

    //读写物理内存 二
     //上一篇是因为我不能连续发超过3次,所以我才没发的,我是想等人家up后我再发的,呵呵 !现//在接上
    function ReadWritePhyMem(ReadOrNot:boolean;Address,length:dword;buffer:pchar):boolean;
    var
       physmem: Thandle;
       vaddress: Pchar;
    begin
       result:=false;
       if not Assigned(ZwOpenSection) then exit;
       physmem := OpenPhysicalMemory(ReadOrNot);
       if (physmem = 0) then exit;   if not MapPhysicalMemory(ReadOrNot,physmem,address,Length,vaddress) then exit;
       try
         if ReadOrNot then
            move(vaddress^,buffer^,Length)
         else
            move(buffer^,vaddress^,Length);
         result:=true;
       except
         on e:exception do
         begin
            MessageDlg('缓中区长度不足或内存跨段。'+#$D+
               '每个内存段为4K的整数倍,每次读写不能跨越多个不同的内存段。',
               mtError, [mbok],0);
         end;
       end;
       UnmapPhysicalMemory(vaddress);
       zwClose(physmem);
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
       p:PBytearray;
       i, address, length, lines: DWORD;
       str: string;
    begin
        address := StrToInt('$'+edit1.Text);
        length := strToInt('$'+edit2.text);
        if length=0 then exit;
        getmem(p,length);
        if ReadWritePhyMem(true,address,length,pchar(p)) then
        begin
           str:='';
           lines:=0;
           for i:=0 to length-1 do
           begin
               str := str + format('%2.2X ',[p^[i]]);
               if(i mod 16=15)or(i=length-1)then
               begin
                  str:=str+#$D#$A;
                  inc(lines);
                  if (lines=16)or(i=length-1) then
                  begin
                     lines:=0;
                     if MessageDlg(str,mtconfirmation,[mbyes,mbno],0)<>mryes then
                        break;
                     str:='';
                  end;
               end;
           end;
        end;
        freemem(p,length);
    end;procedure TForm1.FormCreate(Sender: TObject);
    var
       p:Pchar;
       Length:DWORD;
       i:integer;
    begin
        if (not LocateNtdllEntryPoints) then
        begin
            showmessage('Unable to locate NTDLL entry points.');
            exit;
        end
        else begin
          length:=$B;
          getmem(p,length);
          if ReadWritePhyMem(true,$ffff5,length,p) then
          begin
              listbox1.Items.Add('BIOS日期:'+string(p));
          end;
          freemem(p,length);      Length:=$E;
          getmem(p,Length);
          if ReadWritePhyMem(true,$400,Length,p) then
          begin
             for i:=0 to 3 do
             begin
                listbox1.Items.add(format('串口%d输入/输出范围: %X',[i+1,pword(@p[i*2])^]));
             end;
             for i:=0 to 2 do
             begin
                listbox1.Items.add(format('并口%d输入/输出范围: %X',[i+1,pword(@p[8+i*2])^]));
             end;
          end;
          freemem(p,length);
        end;
    end;procedure TForm1.FormDestroy(Sender: TObject);
    begin
       FreeLibrary(NtLayer);
    end;end.
      

  2.   

    再次对xiangwangz 兄的帮助表示感谢 ^&^