The FSO returns some good information about the disks on a system, including the disk serial numbers. Can anybody tell me how to set the serial number with VB?
Such a thing was very simple using earlier versions of BASIC. In Quick Basic, or even VB for DOS (if I remember correctly), you could set the serial number or volume label with just a few lines of code:
[tt]
DIM InRegs AS RegTypeX, OutRegs AS RegTypeX
InfoBuffer$ = STRING$(25, 0)[/tt]
' Get current info for a disk
' (BX=1 points to the A: drive)
' and place it in a buffer.[tt]
InRegs.Ds = VARSEG(InfoBuffer$)
InRegs.DX = SADD(InfoBuffer$)
InRegs.AX = &H6900
InRegs.BX = &H1
CALL INTERRUPTX(&H21, InRegs, OutRegs)[/tt]
' Set a new serial number in the buffer
' and write it to the disk.[tt]
NewSerial& = 9112001
MID$(InfoBuffer$, 3, 4) = MKL$(NewSerial&)
InRegs.Ds = VARSEG(InfoBuffer$)
InRegs.DX = SADD(InfoBuffer$)
InRegs.AX = &H6901
InRegs.BX = &H1
CALL INTERRUPTX(&H21, InRegs, OutRegs)
[/tt]
Does anybody know a way, with or without the API, to do this from VB6? (Naturally, I'm not interested in shelling to a 16-bit app or trying to write a C++ device driver. LOL)
Such a thing was very simple using earlier versions of BASIC. In Quick Basic, or even VB for DOS (if I remember correctly), you could set the serial number or volume label with just a few lines of code:
[tt]
DIM InRegs AS RegTypeX, OutRegs AS RegTypeX
InfoBuffer$ = STRING$(25, 0)[/tt]
' Get current info for a disk
' (BX=1 points to the A: drive)
' and place it in a buffer.[tt]
InRegs.Ds = VARSEG(InfoBuffer$)
InRegs.DX = SADD(InfoBuffer$)
InRegs.AX = &H6900
InRegs.BX = &H1
CALL INTERRUPTX(&H21, InRegs, OutRegs)[/tt]
' Set a new serial number in the buffer
' and write it to the disk.[tt]
NewSerial& = 9112001
MID$(InfoBuffer$, 3, 4) = MKL$(NewSerial&)
InRegs.Ds = VARSEG(InfoBuffer$)
InRegs.DX = SADD(InfoBuffer$)
InRegs.AX = &H6901
InRegs.BX = &H1
CALL INTERRUPTX(&H21, InRegs, OutRegs)
[/tt]
Does anybody know a way, with or without the API, to do this from VB6? (Naturally, I'm not interested in shelling to a 16-bit app or trying to write a C++ device driver. LOL)
