; /sl/utl/volid/volid.asm - Set the C drive serial number
;
; Use DOS function "Get Media ID", 440Dh, minor 66h to read volume
; information and use DOS function "Set Media ID", 440Dh, minor 46h
; to write volume info back to disk with a modified serial number.
;
; This x86 program runs under DOS and Windows 95 in DOS mode. It is untested on
; win98 and will not work under NT or much of anything else.
;
; Ref: Microsoft MS-DOS Programmer's Reference, Version 5, ISBN 1-55615-329-5
; Pages 314, 319
;
; D. Edwards <david@dee-engineering.com> 6/11/2000 5:27PM
;
; :set ts=8
DOSSEG
include z:\sl\dosasm\struc500.inc
.MODEL SMALL
.STACK 100h
.DATA
MediaID MID <>
str1 DB 'INVALID FUNCTION',13,10,'$'
str2 DB 'FILE NOT FOUND',13,10,'$'
str3 DB 'ACCESS DENIED',13,10,'$'
.CODE
mov ax,@data
mov ds,ax ;Set DS to point to the data segment
; Get Disk Volume information
; 0=def, 1=A, 3=C, 4=D, 5=E, 6=F, 7=G, 8=H, 9=I, 10=J
mov bx,3 ;Set drive number
mov ch,08h ;Device category (always 08h)
mov cl,66h ;Get Media ID minor code
mov dx,OFFSET MediaID ;DS:DX points to MID struc
mov ax,440Dh ;IOCTL for block devices
int 21h ;Fill the MID struc
; Modify the volume ID in the MID structure and write it out to disk
mov si,OFFSET MediaID.midSerialNum ;Point to the DWord result
mov [si],15F1h ;Bultaco VolID LSW
mov [si+2],096Bh ;Bultaco VolID MSW
mov bx,3 ;Set drive number
mov ch,08h ;Device category (always 08h)
mov cl,46h ;Get Media ID minor code
mov dx,OFFSET MediaID ;DS:DX points to MID struc
mov ax,440Dh ;IOCTL for block devices
int 21h ;Write the MID struc out to disk
jnc ok ;Carry flag is set on error
mov ah,9 ;DOS print string function
mov dx,OFFSET str3 ;point to str3
int 21h ;display str3
ok:
; All done, exit
mov ah,4ch ;DOS terminate program function
int 21h ;terminate the program
END