Hard Drive Serial Number & Stuff 
Author Message
 Hard Drive Serial Number & Stuff

greetings!
        I am looking for information on how to obtain the serial number for the
local hard drive and possibly CMOS information from the PC. If anyone
knows how to do this please let me know. Thank you.

        Later...

        kurtt



Wed, 15 Sep 1999 03:00:00 GMT  
 Hard Drive Serial Number & Stuff

Hi Kurt,

   I'm not sure what info you want from CMOS, if you can tell me what
you're looking for I can probably help you out.  As far as the HD serial
number goes...  in 32 bit mode you would want to use the
IOCTL_DISK_GET_DRIVE_LAYOUT function (sorry, I do not have a prototype for
it)...  in 16 bit mode you can use the code and prototypes below.  Please
keep in mind that this serial number is not the hard drives firmware
number, but the number assigned when the drive was formatted and is subject
to change.

MODULE('CW2RUN16.LIB')
    INT86X(ushort,*string,*string,*string),ushort,raw,name('_int86x')
END

DISKINFO    BYTE,DIM(50)      
SERNUMB   ULONG

inRegs        GROUP,PRE(inReg)
WordRegs   GROUP
AX              USHORT
BX              USHORT
CX              USHORT
DX              USHORT
SI                USHORT
DI                USHORT
CFlag           USHORT
Flags            USHORT
                END
ByteRegs     GROUP,OVER(WordRegs)
AL                BYTE
AH                BYTE
BL                BYTE
BH                BYTE
CL                BYTE
CH                BYTE
DL                BYTE
DH                BYTE
                END
              END
outRegs       GROUP,PRE(outReg)
WordRegs     GROUP
AX                USHORT
BX                USHORT
CX                USHORT
DX                USHORT
SI                USHORT
DI                USHORT
CFlag             USHORT
Flags             USHORT
                END
ByteRegs      GROUP,OVER(WordRegs)
AL                BYTE
AH                BYTE
BL                BYTE
BH                BYTE
CL                BYTE
CH                BYTE
DL                BYTE
DH                BYTE
             END
        END
SRegs         GROUP,PRE(SReg)
ES              USHORT
CS              USHORT
SS              USHORT
DS              USHORT
              END
result   ushort

   inreg:ah=6900h    
   inreg:bl=drivenum
   !*where drivenum={0=default,1=A:, 2=B:, etc}
   inreg:dx=band(address(DISKINFO),0000FFFFh)
   !*put offset of address in DX
   sreg:ds=bshift(band(address(DISKINFO),0FFFF0000h),-16)
   !*put selector in DS
   result=int86x(21h,inregs,outregs,sregs)
   if ~band(outreg:flags,001h) and outreg:al=00h
      !*carry flag clear and outreg:al=00h - no errors
      SERNUMB=DISKINFO[2:5]
   end

Hope this helps,

-Jeff



Quote:
> greetings!
>    I am looking for information on how to obtain the serial number for the
> local hard drive and possibly CMOS information from the PC. If anyone
> knows how to do this please let me know. Thank you.

>    Later...

>    kurtt



Sat, 18 Sep 1999 03:00:00 GMT  
 Hard Drive Serial Number & Stuff

Hi Kurt,



Quote:
> greetings!
>    I am looking for information on how to obtain the serial number for the
> local hard drive and possibly CMOS information from the PC. If anyone
> knows how to do this please let me know. Thank you.

Under Windows 95 much detail is kept on devices etc.. in the Windows
Registry. Run RegEdit and poke around under Local_Machine.

If there is something you are after in the Windows Registry I have a cheap
set of Templates that will give you easy access to the registry.

Regards

--
joe van niekerk
------------------------
Topspeed Corporation
Cape Town
South Africa


Home of the MAPI \ ezHelp and CWWinReg Templates



Sat, 18 Sep 1999 03:00:00 GMT  
 Hard Drive Serial Number & Stuff

Hi Don,

Quote:

>Get a copy of disktool.zip, available at icetips. It does everything
>you want to do and then some!

Just a warning:  There MAY be a bug in the disktool.dll that is on
Icetips, which may/will result in a GPF when the serial string is
retrieved.  This bug has been fixed, but I'm NOT sure if the corrected
version is on Icetips.  I will upload it as soon as I have time to
make sure there aren't more bugs like that in the code:(

Best regards,

Arnor Baldvinsson
Allerup Edb
Tel: +45 4675 7122
Fax: +45 4675 7144
Denmark


http://www.icetips.com



Wed, 22 Sep 1999 03:00:00 GMT  
 Hard Drive Serial Number & Stuff

Arnor,
        I was able to test DISKTOOL.DLL, and found that in my system (I
develope in Windows NT), although I can get the volume name okay, I
can't seem to get the serial number. This is, of course, running 16 bit
mode. I don't know if it is something to do with NT, but I suspect so. I
know there is another way to get this in 32 bit mode (an API call?), but
I am unfamiliar with that. I suppose I could try one (in the program),
and, failing that, try an other way. I there a way to detect the
operatin system at run time?
        At any rate, it seems that this should have worked under NT
(compatibility and all). Any other suggestions would be appreciated.
        Another question: Can I get the creation time and date of the disk? I
know I can get it for a subdirectory or file, but, for the root drive?
This would do as well for my purposes. Thanks.
        Later...

        kurtt



Thu, 23 Sep 1999 04:00:00 GMT  
 Hard Drive Serial Number & Stuff

Joe,
        "A cheeps set of templates... acces to the rgistry."
        How cheep?

        Thanks.

        Later...

        kurtt



Thu, 23 Sep 1999 04:00:00 GMT  
 Hard Drive Serial Number & Stuff

Jeff,
        Thanks again for your help. I was able to get your code to run, but,
unfourtunately could not obtain the drive serial number in my system
(Windows NT). I will look for more information on the
IOCTL_DISK_GET_DRIVE_LAYOUT function. I was also wondering if you knew
anything about getting the drive creation time and date (this would do
as well for my purposes). If I have to use different methods for
different machines, I will have to find some way of being able to detect
the operating system at run time. Another fine mess I'm in Ollie!
        Thanks again for your help.

        Later...

        kurtt



Thu, 23 Sep 1999 04:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. How can I read the Hard drive's Serial Number

2. Hard drive serial numbers

3. Hard drive serial numbers

4. code to read hard disk serial number

5. Hard Disk Serial Number

6. Read HARD DISK ID or serial number

7. Hard disc serial number

8. Hard disk serial Number

9. hard disk serial number?

10. Hard Disk Serial Number

11. Hard disk serial number

12. Cobol and hard disk serial number

 

 
Powered by phpBB® Forum Software