[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SEGMENTS
------------------------------------------------------------------------------
Purpose:
Set attributes for specific segments
Syntax:
SEGMENTS [']segname['] [CLASS 'classname'] [attribute [attribute ...]]
Example:
SEGMENTS
seg1 CLASS 'mycode' EXECUTEONLY
seg2 CLASS 'mydata' PRELOAD
This command sets attributes for one or more segments on a segment by
segment basis, overriding the defaults set by the CODE and DATA commands.
The sequence of specified segments establishes their order in the output
file. The segment class defaults to 'CODE' if CLASS 'classname' is not
specified.
For 32 bit Windows programs, the attributes can be one or more of EXECUTE,
READ, SHARED and WRITE.
For 16 bit Windows programs, the following attributes may be specified, with
the defaults shown first and in bold for each attribute:
discard [NONDISCARDABLE | DISCARDABLE]
This is used only for CODE and SEGMENTS commands. It determines whether a
code segment in a real mode Windows program can be discarded from memory to
fill a different memory request.
execute [EXECUTEREAD | EXECUTEONLY]
This is used only for CODE and SEGMENTS commands. It determines whether a
code segment can be read as well as executed. The EXECUTEREAD option is
required for a program to run under a debugger which processes CodeView
information.
instance [MULTIPLE | SINGLE | NONE]
This is used for the DATA command only. It affects the sharing attributes of
DGROUP, the default data segment. This option interacts with the shared
attribute.
MULTIPLE, which is the default for programs, specifies that DGROUP is copied
for each instance of the program.
SINGLE, which is the default for DLLs, specifies that one DGROUP is shared
by all instances of the DLL or program.
NONE tells the loader not to allocate DGROUP. This is used when a DLL has no
data and uses the program's DGROUP.
This option interacts with the shared attribute for data segments.
load [LOADONCALL | PRELOAD]
This is used for CODE, DATA and SEGMENTS commands. It determines when a
segment is loaded. LOADONCALL specifies that the segment should not be
loaded until accessed, and only if not already loaded. PRELOAD specifies
that the segment should be loaded when the program starts.
moveable [MOVEABLE | FIXED]
This is used for CODE, DATA and SEGMENTS commands. It determines whether a
segment of a real mode Windows program can be moved in memory. In a DOS
extended program the FIXED attribute forces the extender to load the .EXE or
.DLL segment into conventional memory rather than extended memory, which
allows it to be accessed from real mode as well as protected mode.
Conventional memory is a limited resource, however, so this option should
only be used where necessary, such as for bimodal interrupt handlers.
read [READWRITE | READONLY]
This is used for DATA and SEGMENTS commands only. It determines access
rights to a data segment.
shared [NONSHARED | SHARED]
This is used for real-mode Windows sessions only. It determines whether all
instances of the program can share EXECUTEREAD and READWRITE segments.
NONSHARED, which is the default for programs, specifies that the segment
must be loaded separately for each process. An alternative keyword is
IMPURE.
SHARED, which is the default for DLLs, specifies that only one copy of the
segment should be loaded and shared among all processes that access the
program or DLL. This setting saves memory and can be used for code that is
not self-modifying. An alternative keyword is PURE. This option interacts
with the instance attribute for data segments.
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson