Solved

HDD serial with DiskSerial.dll

Posted on 2004-09-03
3
1,428 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Beginner to Unreal Engine 4 5 105
C# application error "Parameter Is Not Valid". 3 133
storing csv file in table variable in Python 2 62
Programming Language for Wordpress 7 63
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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…

749 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