[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosSetSegAttrib()             Set segment attributes for selector
------------------------------------------------------------------------------

 Function : Set segment attributes for a selector

 Syntax   : USHORT BLXAPI DosSetSegAttrib(SEL selector, USHORT attr);

 selector   Selector of segment to modify.

 attr       New attributes for segment.

 DosSetSegAttrib() can be used to alter the type of a segment from code to
 data or from data to code, and also to modify the read/write/execute
 attributes of the segment. The allowable attributes are declared in
 BLX286.H.

 Unlike DosCreateCSAlias() and DosCreateDSAlias(), DosSetSegAttrib() does NOT
 create a new descriptor - instead the existing descriptor is modified
 directly.

 Example:

    #include <stdio.h>
    #include <blx286.h>
    unsigned char far array[] = { 1, 2, 3, 4};
    void main(void)
    {
    /* Set array segment to read only */
    if (DosSetSegAttrib(SELECTOROF(array[0]), DATA16_NOWRITE) == 0)
       printf("Segment containing array is now read only\n");
    /* Put it back */
    if (DosSetSegAttrib(SELECTOROF(array[0]), DATA16) == 0)
       printf("Segment is now read/write\n");
    }

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