Get CDRom Info (Using MSCDEX) In QB/ASM 
Author Message
 Get CDRom Info (Using MSCDEX) In QB/ASM

Hi All,

I'm trying to write a simple prog in QuickBasic (using assembler routines)
to retrive a drive's label and serial number.

It works for all my hard drive partitions & also floppies, but when I try
getting the media info for a CDROM drive, the serial number is returned ok,
but the label contains null characters between letters.?

ie....my C: drive is called "BOOTDRIVE" and my CDROM is called
"CHOONS".....but this is what it returns....

info for C:
Serial: 1234-5678
Label:  BOOTDRIVE

info for H:  (CDROM - using MSCDEX)
Serial: 23AE-834C
Label: " C h o o n "  (note that "CHOONS" is missing the "S" and is
seperated by null characters)?????

Is there a way around this?????....any advice or examples in Assembler or
QuickBASIC muchly appreciated.

Thanks,
Andy :o)

Here's the code I'm using in QuickBASIC
'$INCLUDE: 'QBX.BI'

TYPE ParaBlock
    Info AS INTEGER
    SerNo AS LONG
    Label AS STRING * 11
    FlSys AS STRING * 8
END TYPE

DIM Para AS ParaBlock
DIM InRegs AS RegTypeX, OutRegs AS RegTypeX

    Para.Info = 0                       ' Information level always zero

    InRegs.AX = &H440D          '  Function 440DH
    InRegs.BX = 8                     '  Drive 'H'
    InRegs.CX = &H866             '  Device Cat: 8H; Minor Code 66H
    InRegs.DS = VARSEG(Para)  ' Segment address for storage
    InRegs.DX = VARPTR(Para)  ' Segment pointer

    CALL InterruptX(&H21, InRegs, OutRegs)

    Serial$ = HEX$(Para.SerNo)          ' Get serial number
    Volume$ = Para.Label                  ' Get volume label
    FileSys$ = Para.FlSys                    ' File System

    Ready% = (OutRegs.Flags AND 1) = 0  ' Device ready?



Wed, 24 Jul 2002 03:00:00 GMT  
 Get CDRom Info (Using MSCDEX) In QB/ASM
On Sat, 05 Feb 2000 17:53:41 GMT, "Andy Mullen :o)"

Quote:

>Hi All,

>I'm trying to write a simple prog in QuickBasic (using assembler routines)
>to retrive a drive's label and serial number.

>It works for all my hard drive partitions & also floppies, but when I try
>getting the media info for a CDROM drive, the serial number is returned ok,
>but the label contains null characters between letters.?

>ie....my C: drive is called "BOOTDRIVE" and my CDROM is called
>"CHOONS".....but this is what it returns....

>info for C:
>Serial: 1234-5678
>Label:  BOOTDRIVE

>info for H:  (CDROM - using MSCDEX)
>Serial: 23AE-834C
>Label: " C h o o n "  (note that "CHOONS" is missing the "S" and is
>seperated by null characters)?????

The UTF-16 format (found on many Unicode systems) places what look
like nulls between text characters, but they are actually the high
byte of a 2-byte character.  The same thing happens when you look for
text strings in many Windows apps (you have to look for the
S\0t\0a\0r\0t menu if you're hacking explorer.exe).

--
Damian Yerrick  http://yerricde.tripod.com/
Comment on story ideas: http://home1.gte.net/frodo/quickjot.html
AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/
View full sig: http://www.rose-hulman.edu/~yerricde/sig.html



Wed, 24 Jul 2002 03:00:00 GMT  
 Get CDRom Info (Using MSCDEX) In QB/ASM
It looks like unicode to my untrained eye. Every character in unicode is
represented by 2 bytes. The nulls will just be the high order byte from that
pair. This might seem stupid and inconsistent, but notice that the CD-ROM
spec is much newer and more flexible. For one thing it accepts mixed case
names and for another it accepts longer names (perhaps still only 16 chars,
but I don't know for sure.)

As far as translating the unicode string to something you can use in
QuickBasic, that shouldn't take you too long.

hope I've helped
haydens



Wed, 24 Jul 2002 03:00:00 GMT  
 Get CDRom Info (Using MSCDEX) In QB/ASM

Hi Everyone.

Thank's for all your help and suggestions everyone!
After working on it for a while, I finally managed to get it sorted.

I tried pulling each character off from the registers, although it still
seemed there were a couple of bytes missing?....I tried seperating the
lo-byte from the hi-byte, but still no luck....(pah!) :o\

Then it occured to me that there's 2 volume labels on a disk/drive,
etc......there's one in the Boot Sector (which function 69h picks up along
with the serial number), and there's also a label in the root directory.

After sifting through the net, I finally found out that the dos commands
"DIR & VOL" pull the serial number from the bootsector using 69h (get media
id), but they both pull the label from the root directory using the
DTA/ExtFCB and the function 4Eh (search).  (which is how I managed to do
it).

Weird.......
Anyway,.....I'm now working on a library of these functions in QuickBASIC,
along with some other functions....

If anyone else is pulling their hair out, then then drop me an email and
I'll send u a copy. :o)

Thanks again.
Andy :o)



Thu, 25 Jul 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Get CDRom Info (Using MSCDEX) In QB/ASM

2. Help! ASM Programming MSCDEX

3. multi-dimensional arrays from qb to asm

4. QB asm debugger

5. Getting the name of a device (esp. CDROM)

6. ASM Source/Utility Shareware CDROM

7. Getting CDROM name problem

8. Aug'95 ASM Shareware CDROM

9. CDROM info??

10. Need info on CDROM commands

11. INFO ON CDROM NEEDED

12. Need info on Walnut Creek ADA cdrom

 

 
Powered by phpBB® Forum Software