Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi 2007 : How to Set TSAWARE?

In Delphi 2009 and up you can add this line to your project .dpr to set the TSAWARE PE flag in your application executable:

{$SetPEOptFlags  IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE}

I thought (wrongly) that this syntax is not supported in Delphi 2007. I have an application that I cannot port from 2007 to a newer Delphi version just yet (the task is underway, but it will not be done in the next few months).

Update it was simply that Windows must be added to the project .dpr also.

like image 721
Warren P Avatar asked Nov 19 '12 16:11

Warren P


Video Answer


2 Answers

My guess is that you are missing the Windows unit from your .dpr file's uses clause. Add that and you will be able to write:

{$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE}

in your .dpr file. Although clearly you need to write it after the uses clause.

The $SetPEOptFlags feature was added a few versions before Delphi 2007. And so the error that you are presumably seeing is simply that IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE is not declared. And that is solved by making sure that the symbol is visible in the .dpr file. Clearly you can do that by declaring a constant in the .dpr file, but to avoid duplication I always prefer to add the Windows unit.

like image 161
David Heffernan Avatar answered Oct 12 '22 23:10

David Heffernan


compiles under D7

const

IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = $8000;

{$SetPEOptFlags  IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE}
like image 35
bummi Avatar answered Oct 12 '22 23:10

bummi