1. Getting Disk Serial ID
Can anybody here clue me in on divining a disk's serial number id?
Thanks in advance!
< |<
P.S. That's the "ID" as in identification, not id/ego/super ego.
2. Re: Getting Disk Serial ID
The DOS 'vol' command will display the disk volume label and serial
number, if they exist.
Usage VOL [drive:]
-- Brian
(or are you looking for a specific access routine?)
On Thu, 9 Sep 1999, C. K. Lester wrote:
> Can anybody here clue me in on divining a disk's serial number id?
>
> Thanks in advance!
> < |<
>
> P.S. That's the "ID" as in identification, not id/ego/super ego.
>
3. Re: Getting Disk Serial ID
On Thu, 09 Sep 1999, you wrote:
> Can anybody here clue me in on divining a disk's serial number id?
>
> Thanks in advance!
> < |<
>
> P.S. That's the "ID" as in identification, not id/ego/super ego.
Here's code lifted from (Jacques?)
-- Get Disk Info
-- (Volume, SeriaL #, etc)
include machine.e
include wildcard.e
include commas.e
global function DiskFree(sequence drive)
-- returns the number of available bytes on a disk, 0 if drive not recognized
-- drive_num 0 is the default, 1 is a, etc...
sequence reg_list
reg_list = repeat(0, 10)
reg_list[REG_AX] = #3600 -- call DOS function 36H
reg_list[REG_DX] = upper(drive[1]) - '@'
reg_list = dos_interrupt(#21, reg_list)
-- BX: available clusters; CX: bytes per cluster; AX: sectors per cluster
-- Note: DX * CX * AX gives the total number of bytes on the disk
return reg_list[REG_BX] * reg_list[REG_CX] * reg_list[REG_AX]
end function -- dskspace
global function DriveInfo(sequence Drive)
atom ParaBlock, serNo
sequence reg, Serial, Volume, FileSy
object retVal
ParaBlock = allocate_low(25) -- Buffer for drive parameter block
lock_memory(ParaBlock,25) -- can't remember if this is necessary
-- with low memory but it doesn't seem
-- to hurt
poke(ParaBlock,repeat(0,25)) -- Information level always zero,
-- plus clear rest of block
reg = repeat(0,10)
reg[REG_AX] = #440D -- Generic IOCTL device request
if length(Drive) != 1 then -- If no drive specified
reg[REG_BX] = 0 -- then use default
else -- Otherwise convert
reg[REG_BX] = upper(Drive[1]) - '@'-- drive letter to number
end if -- A: = 1, B: = 2 etc
reg[REG_CX] = #866 -- Subfunction: get drive ID
reg[REG_DS] = floor(ParaBlock/16) -- Segment of buffer
reg[REG_DX] = remainder(ParaBlock,16) -- Offset of buffer
reg = dos_interrupt(#21,reg) -- Invoke DOS
if and_bits(1, reg[REG_FLAGS]) != 1 then -- everything OK
serNo = bytes_to_int(peek({ParaBlock+2,4}))
Serial = sprintf("%x",{serNo}) -- Get serial number
Volume = peek({ParaBlock+6,11}) -- Get volume label
FileSy = peek({ParaBlock+17,8}) -- Get file system type
retVal = {Serial, Volume, FileSy}
else
retVal = reg[REG_AX] -- DOS error code
end if
-- free_low(ParaBlock)
return retVal
end function
4. Re: Getting Disk Serial ID
C.K. Lester wrote:
>Can anybody here clue me in on divining a disk's serial number id?
>
>Thanks in advance!
>< |<
>
>P.S. That's the "ID" as in identification, not id/ego/super ego.
Aww, and I was SO looking forward to participating in Freudian discussions
on disk access and its relation to the operating system!
-- Gabriel Boehme