This I wrote down in 1998 while still playing with VSN.
I had created a little assembler program to change the VSN on harddisks
in the early 90's but adapted it later for FAT32.
Never did anything with the VSN on CD's!
<QUOTE>
The Volume Serial Number appeared first in MS-Dos 5.0 (Not counting 4.x)
It is used by MS-Dos to identify removable media.
In Windows 95/98 Volume Tracking is used instead, unless the removable media
is write protected or Volume Tracking has been switched off in the Registry.
Volume Tracking writes a different string to the OEM field in the bootsector
each time the removable media is inserted and assessed.
Identification of removable media change is therefore much more reliable
with
Volume Tracking than using the Volume Serial Number.
When Volume Tracking has been switched off the disk's label, serial
number and
BPB will be used by Windows to identify the disk.
See Article ID: Q148637 in MicroSoft Knowledge Base
Windows 95/98 Overwrites Boot-Sector Field on Floppy Disks.
A VSN is generated by Format.COM and DiskCopy.Com from Dos date and Dos
time.
It is a double word (4 bytes) value stored in reverse notation on disk.
The VSN is stored at offset 0027h (FAT12 and FAT16) or 0043h (FAT32) in the
bootsector.
The routines used to generate a VSN stayed the same from Dos 5.0 - Dos 7.1
Routines in Format.Com and DiskCopy differ slightly.
Compared with Format.COM the High and Low word have changed place
Format: [Seconds/Hundredth] + [Month/Day of mo] = High word of VSN
[Hour/Minutes] + [Year] = Low word of VSN
DiskCopy: [Seconds/Hundredth] + [Month/Day of mo] = Low word of VSN
[Hour/Minutes] + [Year] = High word of VSN
Create Volume Serial Number
Dos 5.0 Format.Com
0DA4:4B84 B42A MOV AH,2A ;Get date
0DA4:4B86 CD21 INT 21
0DA4:4B88 51 PUSH CX ;Year
0DA4:4B89 52 PUSH DX ;DH=month, DL=day of month
0DA4:4B8A B42C MOV AH,2C ;Get time
0DA4:4B8C CD21 INT 21
0DA4:4B8E 8BC2 MOV AX,DX ;AH=seconds, AL=hundredths/sec
0DA4:4B90 5A POP DX ;DH=month, DL=day of month
0DA4:4B91 03C2 ADD AX,DX ;Get High word of VSN
0DA4:4B93 A3A815 MOV [15A8],AX
0DA4:4B96 A37E0F MOV [0F7E],AX
0DA4:4B99 8BC1 MOV AX,CX ;AH=hour, AL=minutes
0DA4:4B9B 59 POP CX ;Year
0DA4:4B9C 03C1 ADD AX,CX ;Get Low word of VSN
0DA4:4B9E A3A615 MOV [15A6],AX
0DA4:4BA1 A3800F MOV [0F80],AX
0DA4:4BA4 C3 RET
Dos 7.1 Format.Com (Windows 98)
0DA7:83E4 B42A MOV AH,2A ;Get date
0DA7:83E6 CD21 INT 21
0DA7:83E8 51 PUSH CX ;Year
0DA7:83E9 52 PUSH DX ;DH=month, DL=day of month
0DA7:83EA B42C MOV AH,2C ;Get time
0DA7:83EC CD21 INT 21
0DA7:83EE 8BC2 MOV AX,DX ;AH=seconds, AL=hundredths/sec
0DA7:83F0 5A POP DX ;DH=month, DL=day of month
0DA7:83F1 03C2 ADD AX,DX ;Get High word of VSN
0DA7:83F3 A3014B MOV [4B01],AX
0DA7:83F6 A3C632 MOV [32C6],AX
0DA7:83F9 8BC1 MOV AX,CX ;AH=hour, AL=minutes
0DA7:83FB 59 POP CX ;Year
0DA7:83FC 03C1 ADD AX,CX ;Get Low word of VSN
0DA7:83FE A3FF4A MOV [4AFF],AX
0DA7:8401 A3C832 MOV [32C8],AX
0DA7:8404 C3 RET
Dos 5.0 DiskCopy.Com
0DA4:0B21 B42A MOV AH,2A ;Get date
0DA4:0B23 CD21 INT 21
0DA4:0B25 51 PUSH CX ;Year
0DA4:0B26 52 PUSH DX ;DH=month, DL=day of month
0DA4:0B27 B42C MOV AH,2C ;Get time
0DA4:0B29 CD21 INT 21 ;DH=seconds, DL=hundredths/sec
0DA4:0B2B 58 POP AX ;AH=month, AL=day of month
0DA4:0B2C 03C2 ADD AX,DX ;Get Low word of VSN
0DA4:0B2E A35603 MOV [0356],AX
0DA4:0B31 26 ES:
0DA4:0B32 894727 MOV [BX+27],AX
0DA4:0B35 58 POP AX ;Year
0DA4:0B36 03C1 ADD AX,CX ;CH=hour, CL=minutes
0DA4:0B38 A35803 MOV [0358],AX ;Hi word of VSN
0DA4:0B3B 26 ES:
0DA4:0B3C 894729 MOV [BX+29],AX
0DA4:0B3F C606550301 MOV BYTE PTR [0355],01
0DA4:0B44 5E POP SI
0DA4:0B45 5B POP BX
0DA4:0B46 07 POP ES
0DA4:0B47 C3 RET
Dos 7.1 DiskCopy.Com (Windows 98)
0DA7:0B7E B42A MOV AH,2A ;Get date
0DA7:0B80 CD21 INT 21
0DA7:0B82 51 PUSH CX ;Year
0DA7:0B83 52 PUSH DX ;DH=month, DL=day of month
0DA7:0B84 B42C MOV AH,2C ;Get time
0DA7:0B86 CD21 INT 21 ;DH=seconds, DL=hundredths/sec
0DA7:0B88 58 POP AX ;AH=month, AL=day of month
0DA7:0B89 03C2 ADD AX,DX ;Get Low word of VSN
0DA7:0B8B A35703 MOV [0357],AX
0DA7:0B8E 26 ES:
0DA7:0B8F 894727 MOV [BX+27],AX
0DA7:0B92 58 POP AX ;Year
0DA7:0B93 03C1 ADD AX,CX ;CH=hour, CL=minutes
0DA7:0B95 A35903 MOV [0359],AX ;Hi word of VSN
0DA7:0B98 26 ES:
0DA7:0B99 894729 MOV [BX+29],AX
0DA7:0B9C C606560301 MOV BYTE PTR [0356],01
0DA7:0BA1 5E POP SI
0DA7:0BA2 5B POP BX
0DA7:0BA3 07 POP ES
0DA7:0BA4 C3 RET
</QUOTE>
Eric P. said:
Format: [Seconds/Hundredth] + [Month/Day of mo] = High word
[Hour/Minutes] + [Year] = Low word
Eric,
Could you clarify what you mean by "format"? For example, is [Hour/Minutes]
and [Year] separate bytes of a word? Or is [Hour/Minutes] converted and
arithmetically added with [Year] to form a very large number that is
converted to a hexadecimal word? Perhaps a brief example of the conversion
would help illustrate the formula.
What I'm wondering here, is whether Gutek might be able to determine which
form of the VSN is being used by assuming the year 2005 is in there
somewhere.