Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2004, 19:38
Darus
 
Posts: n/a
Delphi and section

Hello,
Is it possible to modify section characteristic in delphi like /SECTION with masm ???

bye
Darus
Reply With Quote
  #2  
Old 10-07-2004, 21:39
MARcoDEN
 
Posts: n/a
You can use PE-Editor for this.
Reply With Quote
  #3  
Old 10-08-2004, 15:48
redbull redbull is offline
Friend
 
Join Date: Mar 2004
Posts: 160
Rept. Given: 17
Rept. Rcvd 5 Times in 4 Posts
Thanks Given: 3
Thanks Rcvd at 6 Times in 6 Posts
redbull Reputation: 5
Im not sure if this is what you need.

I dont really use MASM and it has been a long time since i needed to power-use TASM.


This is from the delphi 6.0 help

Quote:
PE (portable executable) header flags


Type Flag
Syntax {$SetPEFlags <integer expression>}
{$SetPEOptFlags <integer expression>}
Scope Local
Microsoft relies on PE (portable executable) header flags to allow an application to indicate compatiblity with OS services or request advanced OS services. These directives provide powerful options for tuning your applications on high-end NT systems.

Warning: There is no error checking or masking of bit values specified by these directives. If you set the wrong combination of bits, you could corrupt your executable file.

These directives allow you to set flag bits in the PE file header Characteristics field and PE file optional header DLLCharacteristics field, respectively. Most of the Characteristics flags, set using $SetPEFlags, are specifically for object files and libraries. DLLCharacteristics, set using $SetPEOptFlags, are flags that describe when to call a DLL's entry point.

The <integer expression> in these directives can include Pascal constant identifiers, such as the IMAGE_FILE_xxxx constants defined in Windows.pas. Multiple constants should be OR'd together.

You can include these directives in source code multiple times. The flag values specified by multiple directives are strictly cumulative: if the first occurrence of the directive sets $03 and the second occurrence sets $10, the value written to the executable file at link time will be $13 (plus whatever bits the linker normally sets in the PE flag fields).

These directives only affect the output file if included in source code prior to linking. This means you should place these directives in a .dpr or .dpk file, not in a regular unit. Like the exe description directive, it's not an error to place these directives in unit source code, but these directives in unit source will not affect the output file (exe or dll) unless the unit source is recompiled at the time the output file is linked
Reply With Quote
  #4  
Old 10-09-2004, 18:22
TQN TQN is offline
VIP
 
Join Date: Apr 2003
Location: Vietnam
Posts: 358
Rept. Given: 143
Rept. Rcvd 24 Times in 13 Posts
Thanks Given: 196
Thanks Rcvd at 168 Times in 51 Posts
TQN Reputation: 24
Great informations, redbull. But I have search in Delphi help and google, and found that we can not rely on the Delphi directives or compiler options to change or modify the attributes of sections in the Delphi PE file. The only way is we must use a PE Editor to modify flags, attributes of Delphi PE sections or wrote our own tools. Two your directives only affect the Image file header and optional header.
Regards,
TQN
Reply With Quote
  #5  
Old 10-11-2004, 15:59
redbull redbull is offline
Friend
 
Join Date: Mar 2004
Posts: 160
Rept. Given: 17
Rept. Rcvd 5 Times in 4 Posts
Thanks Given: 3
Thanks Rcvd at 6 Times in 6 Posts
redbull Reputation: 5
yeah I have tried to do similar things in the past, with no luck ....

I ended up writing and app to patch the section headers of another exe after compiling ... that is the only way i debug with any speed.
Reply With Quote
  #6  
Old 10-11-2004, 18:02
Darus
 
Posts: n/a
ok, thx for your answer, i will make the modification with pe editor
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a section In an EXE netxman General Discussion 9 12-18-2004 11:22


All times are GMT +8. The time now is 23:40.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )