Solved

HDD serial with DiskSerial.dll

Posted on 2004-09-03
3
1,408 Views
Last Modified: 2008-01-09
I am using diskserial.dll to access serial and manufacturer information about hdd. All went well until i logged in a limited acount in winXP. It doesn't seem to read the serial at all.

Does winXP block the disk serial information when you log into windows as a limited user?

Are there any other solutioins that work for reading serial of hdd?
0
Comment
3 Comments
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 80 total points
ID: 12003717
This answer is assuming you are using visual basic 6.0 !!

ok Insert this code in to a module :

'-------------------------------------------------------------------------------------

Private Declare Function GetVolumeInformation _
    Lib "kernel32" Alias "GetVolumeInformationA" _
    (ByVal lpRootPathName As String, _
    ByVal pVolumeNameBuffer 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

Public Function GetSerialNumber( _
    ByVal sDrive As String) As Long

    If Len(sDrive) Then
        If InStr(sDrive, "\\") = 1 Then
            ' Make sure we end in backslash for UNC
            If Right$(sDrive, 1) <> "\" Then
                sDrive = sDrive & "\"
            End If
        Else
            ' If not UNC, take first letter as drive
            sDrive = Left$(sDrive, 1) & ":\"
        End If
    Else
        ' Else just use current drive
        sDrive = vbNullString
    End If
   
    ' Grab S/N -- Most params can be NULL
    Call GetVolumeInformation( _
        sDrive, vbNullString, 0, GetSerialNumber, _
        ByVal 0&, ByVal 0&, vbNullString, 0)
End Function

'------------------------------------------------------------------------------------------
'ok now insert this coding into a forms control, ie a button or where ever you want to call it
'Drive1.Drive is the drive control within visual basic !!
'------------------------------------------------------------------------------------------

Form1.Caption = Hex$(GetSerialNumber(Drive1.Drive))

'you can also just put C: or what ever the drive partition letter is instead, upto you !
'For example:

Form1.Caption = Hex$(GetSerialNumber(C:))

'You can also assign the serial number to a variable or a message box or what ever you want !

I hope this helps !!

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Arduino EDI - Programming language 3 80
White board coding practice 3 80
When i run adoquery my application freezes 26 152
Basic Java Case or If-Else statement... 3 43
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now