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> dossetsegattrib()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosSetSegAttrib()
------------------------------------------------------------------------------
 Purpose:
 Set segment attributes for a selector.

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

 Parameters:
 selector  Selector of segment to modify.
 attr      New attributes for segment.

 Returns:
 None.

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

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