Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HDD serial with DiskSerial.dll

Posted on 2004-09-03
3
Medium Priority
?
1,447 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 320 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
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 …
Simple Linear Regression

670 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