' =- Ferramentas VB
'    http://www.geocities.com/SiliconValley/Sector/1496/
'
'    Retorna o nmero de srie do HD
'

' Num mdulo declare:

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


Function Get_Number_serie(unid As String) As String
    Dim lVSN As Long, n As Long, s1 As String, s2 As String
    Dim sTmp As String
    
    s1 = String$(255, Chr$(0))
    s2 = String$(255, Chr$(0))
    n = GetVolumeInformation(unid, s1, Len(s1), lVSN, 0, 0, s2, Len(s2))
    sTmp = Hex$(lVSN)
    Get_Number_serie = Left$(sTmp, 4) & "-" &  Right$(sTmp, 4)
End Function

' Para usar:
'
' MsgBox Get_Number_serie("C:\")