Results 1 to 6 of 6

Thread: [RESOLVED] VB6 & win7 issues

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Resolved [RESOLVED] VB6 & win7 issues

    Hi

    I made a small app that has a very basic copy protection system (it checks for the local systemdrive serial). It works OK on my WinXP but when I tried to pass it another laptop with Win7 I couldnt "activate it" because it doesnt recognize the password as it was wrong !

    Anyone else had similar issues ?

    thanks

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 & win7 issues

    Are you looking at the "soft" drive serial number that anyone can change or the hardware serial number?

    Access to the hardware serial number requires full admin rights, even on XP (but people run as admin when they shouldn't on XP all the time too).

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Re: VB6 & win7 issues

    I'm using the API getvolumeinformation so I think it's the "soft serial number".

    Anyhow I'm not worried for the "hackability" of my software , my main concern is making a simple copy protection that works for all windows platforms no matter if the pc is being used as admin or guest.

    What can I use ... I was so happy with my xor encription of the serian n°...

    any ideas ?

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 & win7 issues

    If somebody were to buy 5 of the same PC from the same vendor there are very high odds all of them will have the same volume serial number for the C: drive. If that's not an issue for you then go ahead and use it.

    Just tested though and it works fine on Vista and Win7 w/o elevation:
    Code:
    Option Explicit
    
    Private Const MAX_PATH = 260
    
    Private Declare Function GetVolumeInformation Lib "kernel32" _
        Alias "GetVolumeInformationW" ( _
        ByVal lpRootPathName As Long, _
        ByVal lpVolumeNameBuffer As Long, _
        ByVal nVolumeNameSize As Long, _
        ByRef lpVolumeSerialNumber As Long, _
        ByRef lpMaximumComponentLength As Long, _
        ByRef lpFileSystemFlags As Long, _
        ByVal lpFileSystemNameBuffer As Long, _
        ByVal nFileSystemNameSize As Long) As Long
    
    Private Sub Form_Load()
        Dim Result As Long
        Dim Name As String
        Dim SerialRaw As Long
        Dim MaxComponentLength As Long
        Dim FSFlags As Long
        Dim FSName As String
        Dim SerialHex As String
        
        AutoRedraw = True
        Name = Space$(MAX_PATH)
        FSName = Space$(MAX_PATH)
        Result = GetVolumeInformation(StrPtr("C:\"), _
                                      StrPtr(Name), _
                                      Len(Name) + 1, _
                                      SerialRaw, _
                                      MaxComponentLength, _
                                      FSFlags, _
                                      StrPtr(FSName), _
                                      Len(FSName) + 1)
        If Result = 0 Then
            Print "System error"; Err.LastDllError
        Else
            Print "Volume:"
            Print
            Print Tab(5); "Name"; Tab(26); Left$(Name, InStr(Name, vbNullChar) - 1)
            SerialHex = Right$("0000000" & Hex$(SerialRaw), 8)
            Print Tab(5); "Serial"; Tab(26); Left$(SerialHex, 4); "-"; Mid$(SerialHex, 5)
            Print Tab(5); "Max Component Length"; Tab(26); CStr(MaxComponentLength)
            Print Tab(5); "Filesystem Flags"; Tab(26); Right$("0000000" & Hex$(FSFlags), 8)
            Print Tab(5); "Filesystem"; Tab(26); Left$(FSName, InStr(FSName, vbNullChar) - 1)
        End If
    End Sub

  5. #5
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    Re: VB6 & win7 issues

    does this work it looks some what easier to hack down in size

    it is infact from vba, but I think it works in vb6 ( cant check not at home )

    Code:
    Sub ShowDriveInfo(drvpath)
        Dim fs, d, s, t
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
        Select Case d.DriveType
            Case 0: t = "Unknown"
            Case 1: t = "Removable"
            Case 2: t = "Fixed"
            Case 3: t = "Network"
            Case 4: t = "CD-ROM"
            Case 5: t = "RAM Disk"
        End Select
        s = "Drive " & d.DriveLetter & ": - " & t
        s = s & vbCrLf & "SN: " & d.SerialNumber
        MsgBox s
    End Sub

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 & win7 issues

    The downside of using the FSO is that some users will have anti-virus or system policy settings that block its use. This is rarer now, but it still happens.

    You're better off figuring out your bug in calling GetVolumeInformation... or wherever else you've gone wrong.

    Amateur "encryption" is often a trouble spot. It is very easy to go wrong with small errors or false assumptions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width