求助,如何用汇编来获取磁盘序列号

我用的C++写的一个小驱动程序 里面要获取磁盘序列号 请问如何用汇编来写
我不熟悉汇编 麻烦谁有代码可以给我一段吗 能直接用的 小弟先谢谢了
[82 byte] By [wenyaner] at [2008-3-14]
# 1
win32汇编
yuzl32-有酒醉 at 2007-10-20 > top of Msdn China Tech,其他开发语言,汇编语言...
# 2
需要阅读ATAPI协议,可以参考 http://www.begin.org.cn/pascal/idhd.rar
zoologist-王朝 at 2007-10-20 > top of Msdn China Tech,其他开发语言,汇编语言...
# 3
Int 21 function 69h gets/sets the serial number. I think Borland has
a geninterrupt() function, but the easiest way is to use inline
assembly. From Ralf Brown's Interrupt List:

INT 21 U - DOS 4.0+ internal - GET/SET DISK SERIAL NUMBER
AH = 69h
AL = subfunction
00h get serial number
01h set serial number
BL = drive (0=default, 1=A, 2=B, etc)
BH = info level (00h only for DOS; OS/2 allows other levels)
DS:DX -> disk info (see #1455)
Return: CF set on error
AX = error code (see #1366 at AH=59h/BX=0000h)
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
this function is supported under Novell NetWare versions 2.0A
through
3.11; the returned serial number is the one a DIR would
display,
the volume label is the NetWare volume label, and the file
system
is set to "FAT16".
this function is not supported by Novell DOS 7 through Update
13, but
Personal NetWare 1.0 does support this function
the serial number is computed from the current date and time
when the
disk is created; the first part is the sum of the
seconds/hundredths
and month/day, the second part is the sum of the
hours/minutes and
year
the volume label which is read or set is the one stored in the
extended
BPB on disks formatted with DOS 4.0+, rather than the
special root
directory entry used by the DIR command in COMMAND.COM (use
AH=11h
to find that volume label)
SeeAlso: AX=440Dh"DOS 3.2+"

Format of disk info:
Offset Size Description (Table 1455)
00h WORD 0000h (info level)
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 (see #1456)
Note: under MS-DOS 7.0 or a Windows95 DOS box, the volume label
field can be
all blanks even when a volume label has been set (the Win95
installation seems to blank the volume label field in the
partition
boot sector; once LABEL has been run, the volume label is
reported
correctly)
SeeAlso: AH=4Eh

(Table 1456)
Values for filesystem type:
"FAT12 " 12-bit FAT
"FAT16 " 16-bit FAT
"CDROM " High-Sierra CD-ROM filesystem
"CD001 " ISO 9660 CD-ROM filesystem
"CDAUDIO " audio CD
SeeAlso: #1455
Peter_Cheung at 2007-10-20 > top of Msdn China Tech,其他开发语言,汇编语言...