Dec 282017
 
Text file describing more than you want to know about diskette serial numbers.
File VSERIAL.ZIP from The Programmer’s Corner in
Category Tutorials + Patches
Text file describing more than you want to know about diskette serial numbers.
File Name File Size Zip Size Zip Type
VSERIAL.TXT 4134 1697 deflated

Download File VSERIAL.ZIP Here

Contents of the VSERIAL.TXT file


From time to time I have seen messages on various bulletin boards complaining
about and questioning the volume serial numbers used in DOS for versions 4 and
5. Here's the full scoop on diskette serial numbers:

The volume serial number was introduced with DOS 4.0 as part of an extended
boot record and is created through either FORMAT or DISKCOPY. The serial
number is a function of the time/date of formatting.

The first part of the serial number is equal to the sum of the time (seconds
and hundredths of a second) and the date (month and day); The second part of
the serial number is equal to the sum of the time (hours and minutes) and date
(year), where all numbers are in hex. For example, a diskette formatted at
8:32:43.65 on 7/21/1991, will contain a serial number of 3256:0FE7, derived as
follows:

the first part of the serial number will be
Time 43.65 2B41 (43 decimal = 2B hex; 65 decimal = 41 hex)
+ Date 7/21 0715 ( 7 decimal = 07 hex; 21 decimal = 15 hex)
3256

the second part of the serial number will be
Time 8:32 0820 ( 8 decimal = 08 hex; 32 decimal = 20 hex)
+ Date 1991 07C7 ( 1991 decimal = 07C7 hex)
0FE7

There is nothing unique about the serial number. It is possible to have
different diskettes, which were formatted at wildly different times contain
the same serial number. However the probability of such an occurrence is very
small.

The following DOS INT 21h functions may be used to set or determine the serial
number (taken from Ralf Brown's INTERRUPT listing):

INT 21 - DOS 3.2+ - IOCTL - GENERIC BLOCK DEVICE REQUEST
AX = 440Dh
BL = drive number (00h=default,01h=A:,etc)
CX = 0846h - set volume serial number
CX = 0866h - get volume serial number

DS:DX
Offset Size Description
00h WORD info level (00h)
02h DWORD disk serial number (binary)
06h 11 BYTEs volume label or "NO NAME "
11h 8 BYTEs file system type "FAT12 " or "FAT16 " (CL=66h only)

Return: CF set on error AX = error code
CF clear if successful

-------------------------------------------------------------------------
INT 21 - DOS 4.0 internal - GET/SET DISK SERIAL NUMBER
AX = 6900h - get serial number
AX = 6901h - set serial number
BL = drive (0=default, 1=A, 2=B, etc)

DS:DX
Offset Size Description
00h WORD info level (zero)
02h DWORD disk serial number (binary)
06h 11 BYTEs volume label or "NO NAME " if none present
11h 8 BYTEs (AL=00h only) filesystem type--string "FAT12" or "FAT16"

Return: CF set on error AX = error code
CF clear if successful
-------------------------------------------------------------------------
NOTE -- DON'T TRY THESE PATCHES UNLESS YOU HAVE EXPERIENCE WITH DEBUG AND
KNOW EXACTLY WHAT YOU'RE DOING.

Patching FORMAT.COM (DOS 5.0) to create a serial number of 0000-0000 on
your diskette requires changing bytes at
DEBUG offset 4B91 from 03 C2 (ADD AX,DX) to 31 C0 (XOR AX,AX) and at
DEBUG offset 4B9C from 03 C1 (ADD AX,CX) to 31 C0 (XOR AX,AX).

The same patch can be applied to DISKCOPY.COM (DOS 5.0) using DEBUG byte
addresses at 0B2C and 0B36.

Byte 26h of the diskette boot record determines whether or not the volume
serial number will be displayed by the DOS DIR command. A value of 29h in
this byte will display the volume serial number; any other value causes DIR to
ignore the volume serial number (my diskettes contain the value 2Ah).

If you want to eliminate the serial number from ever being displayed by the
DOS DIR command (regardless of byte 26h in the diskette boot record), and you
really want to live dangerously, you can patch the DOS 5.0 COMMAND.COM file by
replacing the byte at DEBUG offset 40A0 (currently 72h) to EBh. This will
change the instruction from JB 40AD to JMP 40AD.

Les Moskowitz
11/23/91


 December 28, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)