dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosCreateCSAlias (1.2)
                                                      Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSMEMMGR
 
USHORT DosCreateCSAlias(selDataSegment, pselCodeSegment)
SEL selDataSegment;      /* data-segment selector            */
PSEL pselCodeSegment;    /* pointer to code-segment selector */
 
The DosCreateCSAlias function creates an aliased code-segment selector for a
specified memory segment. The aliased code-segment selector can be used to
pass control to machine instructions in a data segment.
 
The DosCreateCSAlias function is a family API function.
 
Parameter        Description
────────────────────────────────────────────────────────────────────────────
 
selDataSegment   Specifies the data-segment selector that identifies the
                 memory segment.
 
pselCodeSegment  Points to the variable that receives the aliased
                 code-segment selector.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be the following:
 
     ERROR_ACCESS_DENIED
 
Comments
 
Shared-memory segments, resource segments, segments in huge memory blocks,
and global data segments from dynamic-link libraries cannot be used to
create an aliased code segment.
 
If the process has copied valid machine instructions to the data segment,
the aliased code-segment selector can be combined with a segment offset to
pass control to the machine instructions. The instructions in the aliased
code segment can be called from privilege level 2 (input/output privilege)
or privilege level 3.
 
The DosFreeSeg function frees the aliased code-segment selector. Freeing the
data-segment selector does not affect the aliased code segment, or vice
versa. The segment is not removed from memory until both selectors have been
freed.
 
Restrictions
 
In real mode, the following restrictions apply to the DosCreateCSAlias
function:
 
♦  The selector returned is the code address.
 
♦  Freeing either the aliased selector or the original selector immediately
   frees the memory block.
 
See Also
 
DosAllocSeg, DosFreeSeg