Solved

HDD serial with DiskSerial.dll

Posted on 2004-09-03
3
1,396 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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

5 Experts available now in Live!

Get 1:1 Help Now