Jump to content

Licence Key


pbreda
 Share

Recommended Posts

Boas;

Faz um algoritmo que se baseie no ID de algum hardware..

Foi o que fiz em algumas das soluções que criei..

Aqui tens um exemplo de uma keygen:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1411&lngWId=10

Adaptas o projecto no user name.. substituis por algo como referi a cima.. HID..

Caso queiras usar este código que desenvolvi.. serve para obter o ID baseado no Hard Disc..

    'API para ler o numero de serie do disc rigido..
    Private Declare Function GetVolumeInformation _
            Lib "Kernel32" Alias "GetVolumeInformationA" ( _
                ByVal lpRootPathName As String, _
                ByVal lpVolumeNameBuffer As String, _
                ByVal nVolumeNameSize As Integer, _
                ByRef lpVolumeSerialNumber As Integer, _
                ByRef lpMaximumComponentLength As Integer, _
                ByRef lpFileSystemFlags As Integer, _
                ByVal lpFileSystemNameBuffer As String, _
                ByVal nFileSystemNameSize As Integer _
            ) As Integer
    'Função para ler o nº de serie do hard disc 
    '(valor em Hex Decimal)
    Public Function HDSerialNumber() As String
        Try
            Dim Serial As Integer              'Serial numero
            Dim VName, FSName As String

            'Cria buffers
            VName = New String(Chr(0), 255)    'Volume nome
            FSName = New String(Chr(0), 255)   'File system

            'Volume informação
            GetVolumeInformation(GetCurrentDrive(), VName, 255, Serial, 0, 0, FSName, 255)

            'Elemina chr$(0)'s
            VName = Left(VName, InStr(1, VName, Chr(0)) - 1)
            FSName = Left(FSName, InStr(1, FSName, Chr(0)) - 1)

            'Converte valor long para hex
            Return Hex(Serial)
        Catch ex As Exception
            g_objLog.AddErr(ex)
            Return ""
        End Try
    End Function

    Public ReadOnly Property GetCurrentDrive() As String
        Get
            Try
                Return Left(My.Application.Info.DirectoryPath(), 3)
            Catch ex As Exception
                Return "C:\"
            End Try
        End Get
    End Property

Compr.

Making the impossible possible and pwing the world on db at a time.

Link to comment
Share on other sites

se for algo profissional podes-te basear num servidor que por exemplo assim que arranque na primeira vez gere umas 500 000 keys.

Na aplicação verificas se a key está livre, caso esteja altera o valor correspondente da variável 👍

Bem, afinal estou só a pensar 🙂 porque eu próprio não sei se o conseguiria fazer mas penso que seja possível

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.