[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosCreateDSAlias()            Create data selector corresponding to executable (code) selector.
------------------------------------------------------------------------------

 Function : Create a data selector corresponding to an executable (code)
            selector.

 Syntax   : USHORT BLXAPI DosCreateDSAlias( SEL codesel,
            PSEL datasel);

 codesel    Code selector to be aliased.

 datasel    Pointer to an integer to receive the data selector (alias).

 Return   : Data selector corresponding to an executable code selector. The
            returned selector has the same linear base address and limit as
            the original code selector, but has a read / write code
            attribute.

 Note: The original code selector should be locked in memory (using
 DosLockSeg()) prior to creating the alias selector. This ensures that the
 original selector will not be swapped out of memory, which could later cause
 the linear base address of the segment to change when the segment is
 subsequently reloaded from disk. This is necessary because alias selectors
 do not track changes to the original selector. The original code selector
 may be unlocked by calling DosUnlockSeg() after the alias selector has been
 freed using DosFreeSelector().

 This function allows code segments to be written to.

 Example:

    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <blx286.h>
    void main(void)
    {
    SEL      datasel
    /* Lock the segment first */
    DosLockSeg(SELECTOROF(test));
    if (DosCreateDSAlias (SELECTOROF (test), &datasel) != 0)
       {
       printf ("DosCreateDSAlias() failed\n");
       exit (255);
       }
    printf ("Code selector for test() is %04X\n",   
       SELECTOROF (test));
    printf ("Data selector is %04X\n",datasel);
    DosFreeSelector(datasel);
    }

See Also: DosCreateCSAlias() DosLockSeg()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson