IMAGE_FILE_NET_RUN_FROM_SWAP in Delphi XE7

2019-09-05 02:41发布

问题:

By writing a portable WIn32 app I want to make sure that all the proper settings are done.

I googled for it and found the compiler IMAGE_FILE_NET_RUN_FROM_SWAP switch.

I tried to include it in my dpr file just like this:

{$SetPEFlags IMAGE_FILE_NET_RUN_FROM_SWAP} // THIS ONE!
{$R *.dres}
{$R *.res}

Anyway Delphi XE7 says

[dcc32 Error] Project1.dpr(330): E2003 Undeclared identifier: 'IMAGE_FILE_NET_RUN_FROM_SWAP'

Anyway by reading Embarcaero wiki it seems the name is fine.

Any suggestion?

回答1:

Just include Winapi.Windows in your uses clause (this is where IMAGE_FILE_NET_RUN_FROM_SWAP is declared):

uses
  Winapi.Windows, ...

{$R *.dres}
{$R *.res}
{$SetPEFlags IMAGE_FILE_NET_RUN_FROM_SWAP}