English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 12 October 2009, 10:19   #1
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Question Need sufficient condition for "is a NDOS disk"

Hi coders,

I've stumbled on a very special disk. (in the zone)

It's 99% NDOS, but unfortunately meets all my criteria for an AmigaDOS disk, thus it is detected as such (remember computers and programs are dumb )

- DOS0 OFS boot block
- Boot program pointer @ 0x370 in BOOT block
- VALID ADOS disk name (even though it's "Lazarus" from DiskDestro...er...-Doctor)
- Primary type 0x02 AND secondary type 0x01 in ROOT block; checksum is OK
- longword #03 from ROOT block must be 0x48

My problem is that it is described as a SADDAM virus suspect (Which it is not, because Saddam does not infect NDOS disks)
Unfortunately, said SADDAM virus does the rest to get a proper misdetection:

- it clears both the bitmap flag (previously 0xFFFFFFFF, @0x78) and the bitmap ptr (@0x79) as well as (normally (!)) backs up the bitmap ptr by relocating it to 0x80.

BUT: some SADDAM clones may also clear the backed-up bitmap ptr again sometime later!!
So you guessed it: it will look the same as our NDOS disk: 0x78 - 0x80 is 0.

Because of that, I need a sufficient condition to determine the disk being NDOS.
Is there anything else I could check additionally to the things mentioned?
Well, I could try reading the beginning of a selection of blocks and if it's 0x08 it's AmigaDOS data. Uh, no way, scratch that thought.

So any ideas?

Last edited by andreas; 13 October 2009 at 08:16.
andreas is offline  
Old 12 October 2009, 10:35   #2
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by andreas View Post
It's 99% NDOS, but unfortunately meets all my criteria for an AmigaDOS disk, thus it is detected as such (remember computers and programs are dumb )
How can this be detected as DOS disk when it clearly does trackloading in the bootblock? Apparently your bootblock check is not correct as this is a custom bootblock.
StingRay is offline  
Old 12 October 2009, 10:50   #3
dlfrsilver
CaptainM68K-SPS France
 
dlfrsilver's Avatar
 
Join Date: Dec 2004
Location: Melun nearby Paris/France
Age: 46
Posts: 10,413
Send a message via MSN to dlfrsilver
Yep Dragon Ninja is a NDOS RNC disk. It uses a trackloader.
dlfrsilver is offline  
Old 12 October 2009, 11:50   #4
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Arrow

Quote:
Originally Posted by StingRay View Post
How can this be detected as DOS disk when it clearly does trackloading in the bootblock? Apparently your bootblock check is not correct as this is a custom bootblock.
Um, frankly I did not make a deep bootblock check, because I did not assume it would be necessary.
Only basic criteria so far (root block ptr must be $370 for ADOS in long word 02 (successor of boot checksum), etc.)

Well OK, how could I start at best?
In theory, I could be checking for some "typical" opcodes used in track loaders, for instance.
Should ideally be generic and fit to a couple of known track loaders in the end.

Trackloader signatures (i. e. whole byte sequences memcmp()'d in the same way as virus signatures) only if I must, please. Since this would mean doing a sort of brain file with "signatures" stored for a few known TLs. Cumbersome, yeah, but if there's no other way...so be it.

Any further ideas?

Last edited by andreas; 12 October 2009 at 11:58.
andreas is offline  
Old 12 October 2009, 12:11   #5
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
You could include a standard bootblock (i.e. one created by the install command) in your program, since a standard bootblock doesn't do much it's only a few bytes you need to compare. If the compare fails -> non standard bootblock and you can do further checks.
StingRay is offline  
Old 12 October 2009, 12:19   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,507
There are too many variants of "no virus found"/disable extra drives bootblocks that make this kind of comparison pointless..

I guess you can look for trackdisk.device DoIO()/SendIO() calls but there are also demo packs that trackload the menu but use normal dos filesystem and startup-sequence..

Just forget it
Toni Wilen is offline  
Old 12 October 2009, 12:21   #7
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Toni Wilen View Post
There are too many variants of "no virus found"/disable extra drives bootblocks that make this kind of comparison pointless..
I disagree. He said he's checking for "normal OFS" bootblock, as such, the comparison with a standard bootblock makes perfect sense. If he wants to have a 100% reliable check he needs to do much more anyway.
StingRay is offline  
Old 12 October 2009, 12:25   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,507
Quote:
Originally Posted by StingRay View Post
I disagree. He said he's checking for "normal OFS" bootblock, as such, the comparison with a standard bootblock makes perfect sense. If he wants to have a 100% reliable check he needs to do much more anyway.
I read/assumed/whatever his question as: how to detect between disk that can boot to dos (even if it has not exactly standard bootblock) and disk that has dos-like format but actually uses only trackloader.
Toni Wilen is offline  
Old 12 October 2009, 12:29   #9
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Quote:
Originally Posted by Toni Wilen View Post
I read/assumed/whatever his question as: how to detect between disk that can boot to dos (even if it has not exactly standard bootblock) and disk that has dos-like format but actually uses only trackloader.
Yup. That's why I didn't think of boot block checking in the first place.

Quote:
Originally Posted by StingRay View Post
You could include a standard bootblock (i.e. one created by the install command) in your program, since a standard bootblock doesn't do much it's only a few bytes you need to compare. If the compare fails -> non standard bootblock and you can do further checks.
Basically good idea, but too vague
Because:

There are lots of true ADOS disks (e. g. PD software from known publishers ) whose distributors put a boot-intro in the boot block which can usually be quit with the mouse. Or ancient BootGirl (& friends) were involved.
[edit] Toni said it above already, just in other words [/edit]

These disks normally do not include any NDOS sectors...and will make another brain file necessary: known boot (loader) blocks with a flag whether they're used on NDOS or DOS disks

Toni seems right: too much diversity / variety

Thanks anyway for your reactions...

Last edited by andreas; 12 October 2009 at 12:35.
andreas is offline  
Old 12 October 2009, 13:16   #10
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,987
Coincidentally I just read this thread and this description. So what about just searching for "dos.library". If it's not present, it's an NDOS disk for sure.
thomas is offline  
Old 12 October 2009, 18:19   #11
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
Agreed. And if you want an extra check for OFS, you must compare with an OFS bootblock.
Photon is offline  
Old 12 October 2009, 18:35   #12
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,987
There is no such thing like an "OFS bootblock". OFS/FFS/INTL/DirCache are derived from the DosType stored in the first four bytes of the boot block. The boot code is always the same (or can even be custom).
thomas is offline  
Old 13 October 2009, 08:21   #13
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Quote:
Originally Posted by thomas View Post
Coincidentally I just read this thread and this description.
Doesn't seem too much related to my determination problem, sorry

Speaking about DosType:

doing a "(first word) & 1" operation in the bootblock should be a 100% safe method to detect FFS, for instance?
andreas is offline  
Old 13 October 2009, 08:45   #14
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,987
Quote:
Originally Posted by andreas View Post
Doesn't seem too much related to my determination problem, sorry
It is related. It says it does not infect NDOS disks and it describes how to determine if it is a NDOS disk. You want to find out NDOS disks, so you can use the same method.


Quote:
Speaking about DosType:

doing a "(first word) & 1" operation in the bootblock should be a 100% safe method to detect FFS, for instance?
No. First word == DosType:

0x444F5300 = OFS
0x444F5301 = FFS
0x444F5302 = OFS INTL
0x444F5303 = FFS INTL
0x444F5304 = OFS INTL DirCache
0x444F5305 = FFS INTL DirCache
thomas is offline  
Old 14 October 2009, 00:03   #15
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Uh. I should have been more precise: "& 1" *IS* enough to detect "FFS family".
FFS has *always* odd LSB.

1st bit is SET = is_FFS ; CLR = is_OFS

INTL or not INTL (...that's the question ) is determined by bit 2.
I prefer to test such stuff in a loop, the "DosType & (1 << n)" way.
More generic; and keeps me from #defining every value by hand.
andreas is offline  
Old 15 October 2009, 20:15   #16
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
Quote:
Originally Posted by thomas View Post
There is no such thing like an "OFS bootblock". OFS/FFS/INTL/DirCache are derived from the DosType stored in the first four bytes of the boot block. The boot code is always the same (or can even be custom).
What I meant was, if he doesn't want custom bootblocks, he'll have to compare the whole bootblock.
Photon is offline  
Old 16 October 2009, 08:25   #17
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,987
But he does want custom bootblocks. That's all of the problem. He only wants to distinguish between DOS and NDOS disks, but DOS disks with custom bootblock (i.e. boot intro or virus) should be accepted, too, while NDOS disks with DOS filesystem should be identified as such.

A DOS disk by this definition is a disk which can be written to by the means of AmigaDOS copy, rename, delete commands without destroying the game/software which originally was on the disk.

An NDOS disk can still look like an empty or partially filled DOS disk when inserted after booting, but writing to it will destroy the software because it is hidden in unallocated tracks. The bootblock of such disk will take over the system early and will not initialize AmigaDOS, but rather use a trackloader routine to load the software.

Currently the absence of the string "dos.library" in the bootblock is the best method to identify an NDOS disk.
thomas is offline  
Old 20 October 2009, 16:55   #18
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Quote:
Originally Posted by thomas View Post
A DOS disk by this definition is a disk which can be written to by the means of AmigaDOS copy, rename, delete commands without destroying the game/software which originally was on the disk.
Bingo. And this is, by design, also possible for ADOS disks with boot-intros. Gladly! For if it was not, PD vendors could scratch the thought of booting their disks into WB

Quote:
Currently the absence of the string "dos.library" in the bootblock is the best method to identify an NDOS disk.
Agree, thanks everybody for your insights.
andreas is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Lincs Amiga User Group aka "LAG" Meeting Confirmed for Sat 2nd of March" rockape News 2 21 February 2013 22:46
"Reminder "Lincs Amiga User Group aka "LAG" Meet Sat 5th of January 2013" rockape News 4 30 January 2013 00:06
CD32 Image-Name-Bug: "...(bla)[!].zip" -> "...(bla)[" / "...[test].zip" -> "...[tes" cfTrio support.WinUAE 8 18 December 2012 16:31
Problems with "Thespywholovedme", "Flood", "Shinobi" sareks support.Games 12 03 May 2006 14:52
"Read only" and "Disk swapper" Ulric support.WinUAE 4 11 July 2004 14:17

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:17.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09832 seconds with 15 queries