Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> dosverifyaccess()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosVerifyAccess()
------------------------------------------------------------------------------
 Purpose:
 Get the read/write/code/data flags for a selector.

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

 Parameters:
 selector  Selector (or any unsigned value).
 flags     Pointer to an integer to receive the attribute flags.

 Returns:
 The segment flags.

 Description:
 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()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson