[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosVerifyAccess()             Get read/write/code/data flags for selector
------------------------------------------------------------------------------

 Function : Get the read/write/code/data flags for a selector

 Syntax   : USHORT BLXAPI DosVerifyAccess(SEL selector,
            PUSHORT flags);

 selector   Selector (or any unsigned value).

 flags      Pointer to an integer to receive the attribute flags.

 Return   : The segment flags.

 DosVerifyAccess() is used to determine if the specified selector value is a
 valid selector, and if so its type (code or data) and access rights (read or
 write).

 Example:

    #include <stdio.h>
    #include <blx286.h>
    void DumpFlags(SEL sel)
       {
       USHORT   flags;
       if (DosVerifyAccess(sel, &flags) == 0)
          if (flags & SEL_VALID) /* If a valid selector */
             {
             if (flags & SEL_WRITABLE) printf("WRITABLE ");
             if (flags & SEL_READABLE) printf("READABLE ");
             printf("%s\n", (flags & SEL_CODE) ? "CODE" : "DATA");
             }
          else
             printf("NOT A SELECTOR\n");
       }
    void main(void)
    {
    SEL         selector;
    if (DosLockSeg(SELECTOROF(main)) == 0)
       if (DosCreateDSAlias(SELECTOROF(main),&selector) == 0)
          {
          printf ("Code selector for main() is %04X\n",
             SELECTOROF (main));
          printf ("Data selector is  %04X\n", selector);
          printf ("Code selector flags : ");
          DumpFlags(SELECTOROF(main));
          printf ("Data selector flags : ");
          DumpFlags(selector);
          }
    }

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