From: hoffman@xdelta.zko.dec.nospam Sent: Tuesday, July 25, 2000 11:34 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: Corrupt 000000.DIR (was: RE: Help!) In article , "Yakov Lipkin" writes: :I used command "set file/nodir" on MicroVAX II and accidentally deleted root :folder ([000000]) on data disk. System in work condition right now. :"analyze/disk_structure/repaire" gave msg 'bad directory file format'. :I don't need to restore data, but I can not use this disk now. I don't :have documentation at all. Mount the disk, perform a full BACKUP/IMAGE (lest something else go wrong and you have no way back) and then tweak the attached program to target the 000000.DIR file... (I've updated the FID, as the FID of 000000.DIR is known. You will need to set the target device.) (BTW, it's been a long time since I've tested or built this tool, but it did work twelve years ago...) --------------------------- pure personal opinion --------------------------- Hoff (Stephen) Hoffman OpenVMS Engineering hoffman#xdelta.zko.dec.com -- .title SETDIRBIT fixes the DIRECTORY bit ; ; Copyright 2000 Compaq Computer Corporation ; ; this program is used to turn on the "DIRECTORY" bit in the ; file header. The file (more correctly directory) to be ; reset is specified by FID (file identification) and device. ; (The FID can be retrieved from a DIRECTORY/FULL command.) ; ; a) Put the FID into the "fid" buffer, below. ; ; b) The device the FID is from must also be plugged into ; the "dev" descriptor, below. ; ; The UCHAR field is protected -- see the I/O Abuser's Guide, ; Part I, ACP/QIO Interface. (SYSTEM or OWNER access to the ; file (directory) is required.) ; ; 11-Apr-1988 Stephen Hoffman, DIGITAL Equipment Corp. ; This was written up... No claims to style or content: ; intended simply to solve a one-shot problem. MINIMAL ; error checking and user-hostile! ; .library 'Sys$Library:LIB.Mlb' $atrdef ; File attribute definitions $fchdef ; File characteristics $fibdef ; File Information Block $iodef ; I/O definitions $ssdef ; System Service Definitions .psect data,wrt,noexe,long,noshr,usr fid: ; A file id (FID) looks like this: [NUM,SEQ,RVN] .word 4 ; file NUM .word 4 ; file SEQ .word 0 ; file RVN .word 0 ; (so we can use a MOVQ) ; dev: ; And the name of the disk the file id is from... .ascid /HSC000$DUA2:/ ; iosb: .blkw 4 ; garden variety IOSB ; fchan: .blkw 1 ; channel to the disk ; FIBSIZE=22 ; use the short FIB fibbuf: .blkb FIBSIZE ; here's the FIB itself fib: .long FIBSIZE ; here's the FIB descriptor .address fibbuf ; uchar: .blkb ATR$S_UCHAR ; the FAT characteristics buffer fat: ; The File Attributes itemlist follows: .word ATR$S_UCHAR ; length of the buffer .word ATR$C_UCHAR ; address of the buffer .address uchar ; where the UCHAR field is... .blkq 0 ; zero marks the end... ; .psect code,nowrt,exe,long,shr,usr .entry SETDIRBIT, ^M ; ; Get a channel to the device ; $ASSIGN_S - devnam=dev,- chan=fchan blbs r0,10$ ret ; 10$: ; ; Move the two important "bits" of trivia out to the FIB. ; moval fibbuf,R0 movq fid,FIB$W_FID(R0) movl #FIB$M_WRITE,FIB$L_ACCTL(R0) ; ; Access the file (directory) ; $QIOW_S - chan=fchan,- func=#,- iosb=IOSB,- p1=fib,- p5=#fat blbc r0,19$ blbs iosb,20$ 19$: ret ; 20$: ; ; Force the DIRECTORY bit on! ; bisl2 #FCH$M_DIRECTORY,uchar ; ; Write the modified characteristics out... ; $QIOW_S - chan=fchan,- func=#,- iosb=IOSB,- p1=fib,- p5=#fat blbc r0,29$ blbs iosb,30$ 29$: ret ; 30$: ; ; And deaccess the file (directory) ; $QIOW_S - chan=fchan,- func=#,- iosb=IOSB blbc r0,39$ blbs iosb,40$ 39$: ret ; 40$: ; ; Deassign the channel to the disk ; $DASSGN_S - chan=fchan movzwl #SS$_NORMAL,R0 ; ; And bail out... ; ret .END SETDIRBIT