🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #6447

Re: FileInfoBlock

#6447
From: Doug Walker
Date: Thu, 08 Nov 1990 15:39
63 lines
2711 bytes
In article <phil.656904446@adam.adelaide.edu.au> phil@adam.adelaide.edu.au (Phil Kernick) writes:
>If I use the following stub of code:
>
>getinfo()
>{
>  BPTR fred;
>  struct FileInfoBlock *fib;
>
>  lock = Lock("fred", ACCESS_READ);
>  Examine(lock, fib);
>}
>
>I can get information on the file protection from fib->fib_Protection and
>date from fib->fib_FileDate (this is from my memory, ie don't tell me that
>I have the structure members wrong :-), but how can I set them?

This code WILL NOT WORK.  You'd better actually allocate the FileInfoBlock,
or declare an instance using the __aligned keyword in 5.10 SAS/C:

struct FileInfoBlock __aligned fib;
lock=Lock...
Examine(lock, &fib);

or

struct FileInfoBlock *fib;
fib = (struct FileInfoBlock *)AllocMem(sizeof(struct FileInfoBlock), 0);
lock = Lock...
Examine(lock, fib);



>
>I wan't to know how the programs "protect" from WB 1.3.2 and "touch"
>from the SAS C 5.05 work.  It would seem that they simply change the
>fields that they want in the fib and then write it back.  How is this
>done?  I have the RKM but it is *very* old (only deals with KS 1.1).
>
>Thanks,
>
>Phil.

To set the fields, you have to call the appropriate DOS functions
(SetProtection, SetDate) or send DOS packets to the file system
instructing it to do this.  You can't just 'write back' the FIB.
Get a copy of the AmigaDOS programmer's guide for the version of
the operating system you are running on and read up on the other
DOS calls.
 
Actually, after a quick look at the prototypes in my 1.3 include files,
it looks like SetProtection exists in 1.3, but SetFileDate doesn't
get added until 2.0.  You'll have to look into the DOS packet interface
to set the file date under 1.3.  Alternatively, you could just open
the file for read/write, read a byte, and write it back if you just
want to set the file date to the current date like touch.
 

  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||                                          1200/2400/9600 Dual
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: ...mcnc!rti!sas!walker   plink: dwalker  bix: djwalker 
Technical Details
Message-ID: <1990Nov08.153931.23518@unx.sas.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!ncar!gatech!mcnc!rti!mozart!walker
References: <phil.656904446@adam.adelaide.edu.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!ncar!gatech!mcnc!rti!mozart!walker
From: walker@unx.sas.com (Doug Walker)
Newsgroups: comp.sys.amiga.tech
Subject: Re: FileInfoBlock
Keywords: FileInfoBlock write protection date
Message-ID: <1990Nov08.153931.23518@unx.sas.com>
Date: 8 Nov 90 15:39:31 GMT
References: <phil.656904446@adam.adelaide.edu.au>
Distribution: comp
Organization: SAS Institute Inc.
Lines: 63