How can I enable my 32-bit Delphi application to use 4gb of memory on 64-bit windows (via Wow64.exe)?

后端 未结 4 1789
情话喂你
情话喂你 2020-12-10 04:00

According to this MSDN page:

WOW64 enables 32-bit applications to take advantage of the 64-bit kernel. Therefore, 32-bit applications can use a

4条回答
  •  有刺的猬
    2020-12-10 04:54

    Use the linker directive $SetPEFlags:

    {$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
    

    The IMAGE_FILE_LARGE_ADDRESS_AWARE constant is defined in Windows.pas. I don't remember which Delphi version first included it, though.

    In Delphi 2007, you'll find SetPEFlags documented in "PE (portable executable) header flags (Delphi)".

    Some useful IMAGE_FILE_HEADER flags:

    • {$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} //$0020

      Application can handle addresses larger than 2 GB.

    • {$SetPEFlags IMAGE_FILE_NET_RUN_FROM_SWAP} //$0800

      If the image is on the network, copy it to and run it from the swap file.

    • {$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP} //$0400

      If the image is on removable media, copy it to and run it from the swap file.

    Some IMAGE_FILE_HEADER flags:

    • {$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_NX_COMPAT} //$0100

      The image is compatible with data execution prevention (DEP).

    • {$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE} //$0040

      The DLL can be relocated at load time. (aka ASLR - Address Space Layout Randomization)

    • {$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE} //$8000

      The image is terminal server aware.

提交回复
热议问题