Announcement

Collapse
No announcement yet.

HDD Serial and model

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HDD Serial and model

    I have seen many people asking the same question without a solution..


    I have found this code in delphi and I was wondering is someone would like to try to convert it to PB

    http://homepages.mtgroup.ru/alexk/delphi_components.htm

    The name of the programs are:

    IDESN.zip and SCSISN.zip

    Thanks

    Pedro




    ------------------
    Pedro Camargo
    Pedro Camargo

  • #2
    I'm not 100% certain if the volume serial# is the same as the HD serial number, in which case it does not matter if it is SCSI or IDE...

    Hope these help, I'll see waht I can do, if time permits..

    Code:
    Function CCSDriveSerialNumber Alias "CCSDriveSerialNumber"(Drive As String)Export As String
    Local HWord As Word
    Local LWord As Word
    Local Volname As Asciiz * 16
    Local VolBuffer As Asciiz * 255
    Local lpVolumeSerialNumber As Long
    Local lpMaximumComponentLength As Long
    Local lpFileSystemFlags As Long
    Local FileSysBuffer As Asciiz * 255
    
    If GetVolumeInformation (ByCopy Drive, VolBuffer, SizeOf(VolBuffer), lpVolumeSerialNumber , lpMaximumComponentLength, _
    lpFileSystemFlags , FilesysBuffer, SizeOf(FilesysBuffer)) <> 0 Then
        HWord = HiWrd(lpVolumeSerialNumber)
        LWord = LoWrd(lpVolumeSerialNumber)
        Function = Right$("0000000"+Hex$(HWord), 4) + "-" + Right$("0000000"+Hex$(LWord), 4)
    Else
        Function = "Cannot Read Drive.."
    End If
    
    End Function
    '------------------------------------------------------------------------------------------
    Function CCSGetDriveLabel Alias "CCSGetDriveLabel"(Drive As String)Export As String
    Local Volname As Asciiz * 16
    Local VolBuffer As Asciiz * 255
    Local lpVolumeSerialNumber As Long
    Local lpMaximumComponentLength As Long
    Local lpFileSystemFlags As Long
    Local FileSysBuffer As Asciiz * 255
    
    If GetVolumeInformation (ByCopy Drive, VolBuffer, SizeOf(VolBuffer), lpVolumeSerialNumber , lpMaximumComponentLength, _
    lpFileSystemFlags , FilesysBuffer, SizeOf(FilesysBuffer)) <> 0 Then
        Function = VolBuffer
    Else
        Function = "Cannot Read Drive.."
    End If
    End Function
    '------------------------------------------------------------------------------------------
    Function CCSDriveType Alias "CCSDriveType"(sDrive As String) Export As Long
    Local Result As Long
    Result = GetDriveType(ByVal StrPtr(sDrive))
    Function = Result
    '    Case %DRIVE_TYPE_UNDTERMINED
    '    Case %DRIVE_ROOT_NOT_EXIST
    '    Case %DRIVE_CDROM
    '    Case %DRIVE_FIXED
    '    Case %DRIVE_RAMDISK
    '    Case %DRIVE_REMOTE
    '    Case %DRIVE_REMOVABLE
    End Function
    '----------------------------------------------------------------------------------------
    ------------------
    Scott
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      Scott:

      It is not the same thing.

      The volumen serial is lost when you format the hard disk, the hd serial will be always the same for the hard disk.

      Thanks

      Pedro

      ------------------
      Pedro Camargo
      Pedro Camargo

      Comment


      • #4
        The translation looks pretty straightforward. Did you have some specific question,
        or were you just hoping for someone else to do the work?

        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment


        • #5
          Tom, it may seem "straight forward" from your perspective but
          from the stand point of a person trying to learn a new language
          or just muck around in the API for the first time, it could be a
          rather daunting experience. I think he just wanted someone to
          give him a clue, I really don't think he wanted a "freebie" here.

          I'll take a look, time permitting, and if I can help you out in
          translating I will.., caveat *I **** AT DELPHI* but it may be as
          Tom said, self evident.

          [This message has been edited by John McWilliams (edited May 24, 2001).]

          Comment


          • #6
            This is very confusing for me, there are not even dll declarations


            Nothing makes any sense except for the writeln statement.

            I know this might be easy for someone with experiance on API's.

            If someone can help me I do not mind paying a fair amount for its time.


            Thanks



            ------------------
            Pedro Camargo
            Pedro Camargo

            Comment


            • #7
              Ok. These programs are copyrighted, so I am not going to touch them without permission.
              I have written to the author to see if it's ok to translate them to PowerBASIC. If he
              allows, I will do the translation. It could be a useful example of how to convert from
              Delphi to PowerBASIC.

              ------------------
              Tom Hanlin
              PowerBASIC Staff

              Comment

              Working...
              X