[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Part3 - Single Page

Top Document: x86 Assembly Language FAQ - General Part 3/3
Previous Document: 27. Common Reason Why Memory Allocation Fails
Next Document: 29. .obj File Format


28. Volume Serial Numbers


28.1  VOLUME SERIAL NUMBER FORMAT

The volume serial number was introduced with DOS 4.0 as part of an
extended boot record and is created through you either FORMAT a disk or
use DISKCOPY to create another disk.  The serial number is a function of
the time/date of the formatting or the diskcopying.  Note that DISCOPY
generates a new volume serial number so a DISKCOPY is not an exact image
of the source diskette.

28.2  CALCULATING THE VOLUME SERIAL NUMBER

For example, say a disk was formatted on 26 Dec 95 at 9:55 PM and 41.94
seconds.  DOS takes the date and time just before it writes it to the
disk.

Low order word is calculated:               Volume Serial Number is:
    Month & Day         12/26   0c1ah
    Sec & Hundrenths    41:94   295eh               3578:1d02
                                -----
                                3578h

High order word is calculated:
    Hours & Minutes     21:55   1537h
    Year                1995    07cbh
                                -----
                                1d02h

Note that DOS interrupt 21h Functions 2ah, Get DOS Date, and 2ch, Get
DOS Time, are particularly suited to getting the date and time for
calculating the Volume Serial Number.

28.3 READING AND SETTING THE VOLUME SERIAL NUMBER

To read the Volume Serial Number, use the IOCTL call, Int 21h function
440dh Minor Code 66h, Get Media ID.  To write the Volume Serial Number,
use the IOCTL call, Int 21h function 440dh Minor Code 46h, Set Media ID.

WARNING!  These IOCTL calls use a structure that also contains the
volume label and file system type.  So that you do not create errors
with these values, I recommend that you always Minor Code 66h to
initialize the structure before setting the Volume Serial Number to a
new value and writing it back to the disk.

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 17 Feb 96



Top Document: x86 Assembly Language FAQ - General Part 3/3
Previous Document: 27. Common Reason Why Memory Allocation Fails
Next Document: 29. .obj File Format

Part1 - Part2 - Part3 - Single Page


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
raymoon@moonware.dgsys.com

Last Update December 03 2008 @ 00:10 AM

© 2008 FAQS.ORG. All rights reserved.