[comp.os.msdos.programmer] How to get Volume Serial Number MSDOS 4.0?

kji@vpnet.chi.il.us (Ken Isacson) (04/18/91)

In article <1991Apr13.200405.7276@occrsh.att.com> mjw@occrsh.att.com (Mike_Wood(NAOC307670)) writes:
>My documentation is pre-MSDOS 4.0 and am using MS-C 5.1 which doesn't
>show how to retrieve the Volume serial number of a diskette formatted
>from 4.0 FORMAT command.  I am able to get the volume name, via a
>C program, but have seen nothing about the serial number. 
>
>Anyone got any ideas?
>
>I would gladly accept C or assembly source code or just a tip on
>the DOS call. It must be portable! 
>
>Thanks
>
>_______________________________________________ AT&T Network Systems _________
>Oklahoma City 3b2/usr/group
>$USR/okc    $USR/tulsa
>D.P.M.A Member
>______________________________________________________________________________
>
>       "If you can't get ahead, then you're bringing up the rear"
>                       ______     ___           ___
>        /|   /|       (    //    (_ |    /|    //    Mike Wood - NAOC307670
>       //|  //|        \__//_//     |   //|   //     AT&T Switching Systems
>   _  // | // |  _   ____//__       |  // |  //       Oklahoma City Works
>  ( |//  |//  | /   (   //          | //  | //       Human Resources  IM&M
>   \//   //   |/ o   \_// o         |//   |// o    att!mwood!mjw   attmail!mjw
>                                                        (405)491-3233
>______________________________________________________________________________

Here is some info that I saved in March...

----------------------------------------------------------------------------

From tellab5!nucsrl!casbah.acns.nwu.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!abvax!iccgcc!walters Sat Mar 16 10:24:05 CST 1991
Article: 2052 of comp.sys.ibm.pc.misc
Xref: vpnet comp.misc:593 comp.sys.ibm.pc.misc:2052
Path: vpnet!tellab5!nucsrl!casbah.acns.nwu.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!abvax!iccgcc!walters
From: walters@iccgcc.decnet.ab.com
Newsgroups: comp.misc,comp.sys.ibm.pc.misc
Subject: Re: DOS 4.0 Volume Serial Numbers
Message-ID: <3632.27d510c4@iccgcc.decnet.ab.com>
Date: 6 Mar 91 20:54:42 GMT
References: <12818@hubcap.clemson.edu> <1991Mar5.033219.369@nuchat.sccsi.com>
Lines: 42

In article <1991Mar5.033219.369@nuchat.sccsi.com>, paul@nuchat.sccsi.com (Paul Hutmacher) writes:
> In article <12818@hubcap.clemson.edu> chrisb@hubcap.clemson.edu (Chris Behrens) writes:
>>Is there a way to access these ??  Or is there a way to change them ??
> 

Here is how you get/set the volume serial number.
Others have already posted with regard to the serial numbers usefullness.
Hope this helps!!!!


 INT 21 - DOS 4.0 internal
     AH = 69h
     AL = subfunction
         00h get serial number
         01h set serial number
     BL = drive (0=default, 1=A, 2=B, etc)
     DS:DX -> disk info (see below)

 Return: CF set on error
         AX = error code (see AH=59h)
     CF clear if successful
         AX destroyed
         (AL = 00h) buffer filled with appropriate values from extended BPB
         (AL = 01h) extended BPB on disk set to values from buffer

 Notes:  does not generate a critical error; all errors are returned in AX
     error 0005h given if no extended BPB on disk
     does not work on network drives (error 0001h)
     buffer after first two bytes is exact copy of bytes 27h thru 3Dh of
        extended BPB on disk

 Format of disk info:
 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   "


Tom
No Sig Yet


-- 
__________________________________________________________
Ken Isacson         Sysop - Board Of Trade BBS  GT 016/001
kji@vpnet.chi.il.us         (815) 753 - 0042
----------------------------------------------------------