Solved

HDD serial with DiskSerial.dll

Posted on 2004-09-03
3
1,430 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

739 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