function NtOpenSection(var Handle: Cardinal; Access: Cardinal; const Section): Cardinal; stdcall external 'ntdll';
procedure TForm1.Button1Click(Sender: TObject);
const Section: array [0..7] of PWideChar = (Ptr(24), nil, @Section[6], Ptr(64), nil, nil, Ptr(3014700), '\Device\PhysicalMemory');
var
Handle: Cardinal;
lpBuffer: PChar;
begin
if NtOpenSection(Handle, 4, Section) = 0 then
begin
lpBuffer := MapViewOfFile(Handle, 4, 0, $FC000, $1000);
if Assigned(lpBuffer) then
begin
ShowMessage(TrimRight(PChar(@lpBuffer[$2B7])) + #13 +
TrimRight(PChar(@lpBuffer[$2D7])) + #13 +
TrimRight(PChar(@lpBuffer[$2F7])) + #13 +
TrimRight(PChar(@lpBuffer[$30F])));
UnmapViewOfFile(lpBuffer);
end;
CloseHandle(Handle);
end;
end;