CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Aug 2001
    Posts
    60

    serial number Not Volumn Serial Number

    I need to know sourcecode about getting "serial number" of harddisk. Please help me.
    note:
    1. "serial number" NOT "Volumn Serial Number"
    2. each harddisk has id called serial number
    3. Volumn Serial Number is generated by "format" command


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: serial number Not Volumn Serial Number

    'ref to Microsoft Scripting Runtime

    Sub ShowDriveInfo(drvpath)

    Dim fs, d, s, t
    set fs = CreateObject("Scripting.FileSystemObject")
    set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))

    Select Case d.DriveType
    Case 0: t = "Unknown"
    Case 1: t = "Removable"
    Case 2: t = "Fixed"
    Case 3: t = "Network"
    Case 4: t = "CD-ROM"
    Case 5: t = "RAM Disk"
    End Select

    s = "Drive " & d.DriveLetter & ": - " & t
    s = s & vbCrLf & "SN: " & d.SerialNumber
    MsgBox s
    End Sub




    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Aug 2001
    Posts
    60

    Re: serial number Not Volumn Serial Number

    Hello, Iouri.
    The source code you have posted is "Volumn Serial Number" not "Serial Number" and i need " Harddisk Serial Number".
    Thank You.


  4. #4
    Join Date
    Aug 2001
    Posts
    60

    Re: serial number Not Volumn Serial Number

    Who know? Please.


  5. #5
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: serial number Not Volumn Serial Number

    I used to write a prog that modifies hard drive or floppy Serial Number. The code that I gave you read this number correctly.

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  6. #6
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: serial number Not Volumn Serial Number

    I tried Iouris coed and it returned the drive serial number for me NOT its volume serial number.

    Code output, in my case was
    '
    Drive C: - Fixed
    SN: 982263575
    '
    '
    My C: drives volume Serno is "Production"

    John G

  7. #7
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: serial number Not Volumn Serial Number

    Thank you John. At least now I know that I am not going bananas.

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  8. #8
    Join Date
    Aug 2001
    Posts
    60

    Re: serial number Not Volumn Serial Number

    I tried Iouris coed and it returned the volume serial number.
    Code output, in my case was
    Drive C: - Fixed
    SN: 220795131
    Drive D: - Fixed
    SN: 142088909

    But my drive c and d are on the same harddisk (my harddisk has partioned to drive c and d)
    the searial number i mean is unique Serial ID


  9. #9
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: serial number Not Volumn Serial Number


    'even this will bring up same result:
    'you will get two different serail number for the two drives.
    'It seems as if logical drives get their own serial number...

    private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (byval lpRootPathName as string, byval lpVolumeNameBuffer as string, byval nVolumeNameSize as Long, lpVolumeSerialNumber as Long, lpMaximumComponentLength as Long, lpFileSystemFlags as Long, byval lpFileSystemNameBuffer as string, byval nFileSystemNameSize as Long) as Long
    private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    Dim Serial as Long, VName as string, FSName as string
    'Create buffers
    VName = string$(255, Chr$(0))
    FSName = string$(255, Chr$(0))
    'get the volume information
    GetVolumeInformation "C:\", VName, 255, Serial, 0, 0, FSName, 255
    'Strip the extra chr$(0)'s
    VName = Left$(VName, InStr(1, VName, Chr$(0)) - 1)
    FSName = Left$(FSName, InStr(1, FSName, Chr$(0)) - 1)
    MsgBox "The Volume name of C:\ is '" + VName + "', the File system name of C:\ is '" + FSName + "' and the serial number of C:\ is '" + Trim(Str$(Serial)) + "'", vbInformation + vbOKOnly, App.Title
    End Sub





    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  10. #10
    Join Date
    Jan 2003
    Location
    Bulgaria
    Posts
    75

    Thumbs down That's not correct

    There are thousands of questions and answers in the forum that looks to me the same:

    "Get an unique PC number that doesn't change even if you reinstall Windows, format the drive or something like this."

    And most of the answers aren't even close to this.

    The Iouri's code returns Volume Serial Number that is generated when you format the volume. That means tha if you format your C: it will change his number!!!

    I'm searching for a way (like Phogang does) to get the hardware's serial number. That mean the number that manufacturer of the HDD is give to it.

    So, please stop posting messages with "GetVolumeInformation", "Scripting.FileSystemObject", etc.

    That doesn't work the way we (me and probably Phogang) expect.
    That mean Cimperiali too. Understand - this is not we looking for.
    .:: ::.

  11. #11
    Join Date
    Jan 2003
    Location
    Bulgaria
    Posts
    75

    Thumbs up Finally i have got something usefull

    Hi to all,

    yestarday i finally got something that is most like the HDD serial number (not the volume ser. num.)

    Sorry but i have not enough time to check and test this but i hope it is what we looking for.

    I found it on another vb source page, but i can't remember now (yestarday i browse more then 1000 pages ).

    Ok. Bye.
    Attached Files Attached Files
    .:: ::.

  12. #12
    Join Date
    Feb 2009
    Posts
    4

    Re: Finally i have got something usefull

    Quote Originally Posted by nikidd View Post
    Hi to all,

    yestarday i finally got something that is most like the HDD serial number (not the volume ser. num.)

    Sorry but i have not enough time to check and test this but i hope it is what we looking for.

    I found it on another vb source page, but i can't remember now (yestarday i browse more then 1000 pages ).

    Ok. Bye.
    Can this program be updated to read Sata I and II drives along with any
    USB type drives that are used on Sata, IDE/ATAPI adaptors and perhaps flash drives
    to get the firmware version along with the serial number and drive model number?

    Thanks.

  13. #13
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: serial number Not Volumn Serial Number

    This thread is too old. You've already posted a question. Don't double post.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  14. #14
    Join Date
    Feb 2009
    Posts
    4

    Re: serial number Not Volumn Serial Number

    well, I've looked at the source code for this program based on a referal to this thread.
    The source code doesn't look for SATA I/II drives. The person who wrote the original
    program before my post is NIKIDD. Thus, I thought he/she would see it and maybe
    update their software they linked to along time ago. Particuliarily since in 2003
    they didn't have SATA drives.

  15. #15
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: serial number Not Volumn Serial Number

    Quote Originally Posted by mikesw View Post
    well, I've looked at the source code for this program based on a referal to this thread.
    The source code doesn't look for SATA I/II drives. The person who wrote the original
    program before my post is NIKIDD. Thus, I thought he/she would see it and maybe
    update their software they linked to along time ago. Particuliarily since in 2003
    they didn't have SATA drives.
    Nikidd has not been online since March 31st, 2006 (according to his profile). And he did not write the source, he found it elsewhere... However it is a good start.. have you even tried to modify it to read USB and Sata drives...

    Gremmy
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured