var
  sizeVirtual: Cardinal = 4000;
  lpRound: Pointer;
  mbi: MEMORY_BASIC_INFORMATION;
  lpAddress: Pointer;
  lpStr: PAnsiChar;
  dwOldAddr: PDWORD;
begin
  lpRound := Pointer($100000FF);
  lpAddress := VirtualAlloc(lpRound, sizeVirtual, MEM_COMMIT or MEM_RESERVE, PAGE_READWRITE);
  if lpAddress = nil then
  begin
    WriteLn(format('VirtualAlloc error: %d', [GetLastError()]));
    Exit;
  end;
  lpStr := 'hello';
  WriteLn('Alloc:MEM_COMMIT|MEM_RESERVE');
  CopyMemory(lpAddress, lpStr, lstrlen(lpStr));
  WriteLn(format('分配,复制成功,地址:0x%.8x, 内容:%s', [DWORD(lpAddress), PAnsiChar(lpAddress)]));
  VirtualQuery(lpAddress, mbi, SizeOf(mbi));
  WriteLn(format('使用 VirtualQuery 获得的信息:'+#13#10+
                 'BaseAddress:0x%.8x  AllocationBase:0x%.8x  AlloctionProtect:0x%.8x  RegionSize:%u  State:0x%.8x  Protect:0x%.8x  Type:0x%.8x', [DWORD(mbi.BaseAddress), DWORD(mbi.AllocationBase), mbi.AllocationProtect, mbi.RegionSize, mbi.State, mbi.Protect, mbi.Type_9]));  if not (VirtualProtect(lpAddress, 0, PAGE_READONLY, nil)) then
  begin
    WriteLn(format('VirtualProtect error: %d', [GetLastError()]));
    Exit;
  end;
在翻译一个VC例子,但VirtualProtect无法修改内存页属性,求解释.
VirtualProtect error: 998 (内存分配访问无效。)