[INHERIT('sys$library:starlet', 'sys$library:pascal$lib_routines')] PROGRAM Use_Check_Access(INPUT,OUTPUT); TYPE Item_List_Cell = RECORD CASE INTEGER OF 1: ( { Normal Cell } Buffer_Length : [WORD] 0..65535; Item_Code : [WORD] 0..65535; Buffer_Addr : UNSIGNED; Return_Addr : UNSIGNED ); 2:( { Terminator } Terminator : UNSIGNED ); END; Item_List_Template(Count:INTEGER) = ARRAY [1..Count] OF Item_List_Cell; VAR Item_List : Item_List_Template(2); File_Name : VARYING [132] OF CHAR; Status : INTEGER; Privs_Used : [VOLATILE] Privs_Used_Bits$type; BEGIN { Ask for filename to check access on } WRITE('Input the name of the file: '); READLN(file_name); { Ask for any privileges used to access file } Item_List[1].Buffer_Length := SIZE(Privs_Used); Item_List[1].Item_Code := CHP$_Privused; Item_List[1].Buffer_Addr := IADDRESS(Privs_Used); Item_List[1].Return_Addr := 0; { Terminate the item list } Item_List[2].Terminator := 0; { See if SYSTEM can access the file } Status := $check_access( Objtyp := ACL$C_File, Objnam := File_Name, Usrnam := 'SYSTEM', Itmlst := Item_List); IF Status = SS$_NOPRIV THEN WRITELN('SYS$CHECK_ACCESS returned SS$_NOPRIV') ELSE IF Status = SS$_NORMAL THEN BEGIN WRITELN('SYS$CHECK_ACCESS returned SS$_NORMAL'); WRITELN('Privileges used: '); WRITELN(' SYSPRV : ',Privs_Used.CHP$V_Sysprv); WRITELN(' GRPPRV : ',Privs_Used.CHP$V_Grpprv); WRITELN(' BYPASS : ',Privs_Used.CHP$V_Bypass); WRITELN(' READALL : ',Privs_Used.CHP$V_Readall); END ELSE LIB$Stop(Status); END.