Board index » delphi » Reading disk serial number...

Reading disk serial number...

Hi there,

I'm having trouble reading the disk serial number on some machines. At home on
my two computers it works fine but at work on 2 different machines the
following function returns nothing

        function GetSerialInfo: Byte; assembler;
        asm
          mov AL, 00h
          mov AH, 69h
          mov BL, 03h
          mov BH, 00h
          mov DX, OFFSET [SPacket]
          Call Dos3Call
        end;

SPacket is of this type:

        TSerPacket = record
          Info:Word;
          SerNoA, SerNoB, SerNoC, SerNoD: Byte;
          Vol: Array[1..11] of char;
          FileType: Array[1..8] of char;
        end;

This is in Delphi, does anyone know why it's not always working? (home cpus are
on win95 and job cpus are on dos 6.0 and 6.2)

Thanks!

Eric

 

Re:Reading disk serial number...


Quote
>>I'm having trouble reading the disk serial number on some machines

So too am I. Same code (basically) and win95 on one machine, 6.2 on the
other. Serialized on win95, reads fine, dos 6.2/wfw3.11, doesn't recognize
serial...if you find out what's going on, I'd love to hear about it...

Grant Carpenter
===============
pinnacl...@aol.com
gr...@pinadvgrp.com

Re:Reading disk serial number...


Quote
le...@IRO.UMontreal.CA (Eric Levac) writes:
> Hi there,

> I'm having trouble reading the disk serial number on some machines. At home on
> my two computers it works fine but at work on 2 different machines the
> following function returns nothing

>    function GetSerialInfo: Byte; assembler;
>    asm
>      mov AL, 00h
>      mov AH, 69h
>      mov BL, 03h
>      mov BH, 00h
>      mov DX, OFFSET [SPacket]
>      Call Dos3Call
>    end;

> SPacket is of this type:

>    TSerPacket = record
>      Info:Word;
>      SerNoA, SerNoB, SerNoC, SerNoD: Byte;
>      Vol: Array[1..11] of char;
>      FileType: Array[1..8] of char;
>    end;

> This is in Delphi, does anyone know why it's not always working? (home cpus are
> on win95 and job cpus are on dos 6.0 and 6.2)

> Thanks!

> Eric

With Win3, you need to use GlobalDosAlloc to alloc the memory and put that
pointer in the DX register.

This should work in Win/95 too.  Its win3 that has the restriction due to the
segmented memory space and protected mode -vs- real mode thing.

Regards,
Don.

Other Threads