Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!coherent!dplatt From: dplatt@coherent.com (Dave Platt) Newsgroups: comp.sys.mac.programmer Subject: Re: help Message-ID: <23315@coherent.com> Date: 7 Apr 89 17:40:42 GMT References: <3369@nunki.usc.edu> <11251@well.UUCP> Reply-To: dplatt@coherent.com (Dave Platt) Organization: Coherent Thought Inc., Palo Alto CA Lines: 37 In article <11251@well.UUCP> svc@well.UUCP (Leonard Rosenthol) writes: > In article <3369@nunki.usc.edu>, anthonyt@castor.usc.edu (Anthony Tieu) writes: > > I am writing an init to keep users from writing on to the hard disk. > > I would like to know how to detect and obtain the last file or folder > > that was created, so I can delete it. Any comments is welcome.. > > > > It seems to me that is the DEFINATELY the wrong approch to the problem! > If I were doing this (which I am not, thank god) I would simply patch > _Open and _Create so that if a appl tries to open a file it is returned > ReadOnly and _Create always returns an error so no files are created. > You might be careful with these as this would mean that NOTHING could > write to the disk (including the OS, Inits, DA's ,etc.) Another approach would be to do as Jeff Shulman's "DiskLock" desk accessory does... set the software-lock bit in the disk's HFS volume structure. This has the same effect (from the user's point of view) as setting the write-protect tab on a floppy disk... the Finder will display the little padlock icon in the disk and folder windows. Of course, a sufficiently-knowledgeable user armed with the right tools could undo the locking... but the same user could defeat Anthony's original idea simply by booting from a floppy disk and bypassing the INIT entirely. Locking an entire hard-disk will render many of the applications on it entirely unusable. Any application that wishes to create a scratch-file will be unable to run (I'm thinking of MS Word in particular). Any application that tries to save the Clipboard to disk will have problems. The same sort of problems will occur with Anthony's "delete the last file created" approach, too... and perhaps even more severely. Imagine what Word might do if it were to create a temp file, and then (several seconds later) find that the file had mysteriously disappeared. Not good... -- Dave Platt FIDONET: Dave Platt on 1:204/444 VOICE: (415) 493-8805 UUCP: ...!{ames,sun,uunet}!coherent!dplatt DOMAIN: dplatt@coherent.com INTERNET: coherent!dplatt@ames.arpa, ...@uunet.uu.net USNAIL: Coherent Thought Inc. 3350 West Bayshore #205 Palo Alto CA 94303