1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Private Sub VerifLicence()
Dim BaseRegistre As New Regs
Dim md5Test As New MD5
Dim CodeProduit As String
Dim Licence As String
CodeProduit = BaseRegistre.Lit_Val("SOFTWARE\KEY_LOCAL_MICROSOT\1DA242EAF2A6EAF11937EE18311CD2FD", "Produit")
If CodeProduit = "" Then
CodeProduit = md5Test.DigestStrToHexStr(GetMACAddress & GetWinVer & Now & Environ("Username") & Environ("Userprofile"))
'BaseRegistre.CreateNewKey "SOFTWARE\KEY_LOCAL_MICROSOT"
BaseRegistre.CreateNewKey "SOFTWARE\KEY_LOCAL_MICROSOT\1DA242EAF2A6EAF11937EE18311CD2FD"
BaseRegistre.Enreg_Val "SOFTWARE\KEY_LOCAL_MICROSOT\1DA242EAF2A6EAF11937EE18311CD2FD", CodeProduit, ""
BaseRegistre.Enreg_Val "SOFTWARE\KEY_LOCAL_MICROSOT\1DA242EAF2A6EAF11937EE18311CD2FD", "Produit", CodeProduit
End If
Debug.Print CodeProduit
Licence = BaseRegistre.Lit_Val("SOFTWARE\KEY_LOCAL_MICROSOT\1DA242EAF2A6EAF11937EE18311CD2FD", CodeProduit)
If Licence = "" Then
BaseRegistre.Enreg_Val "SOFTWARE\KEY_LOCAL_MICROSOT\1DA242EAF2A6EAF11937EE18311CD2FD", CodeProduit, InputBox("Code Produit : " & CodeProduit & vbCrLf & "Entrez le N? de licence :" & vbCrLf & "Ou contactez votre agence commerciale.", "Gestionnaire de licence :")
End If
Licence = BaseRegistre.Lit_Val("SOFTWARE\KEY_LOCAL_MICROSOT\1DA242EAF2A6EAF11937EE18311CD2FD", CodeProduit)
If md5Test.DigestStrToHexStr("1DA242EAF2A6EAF11937EE18311CD2FD" & CodeProduit) <> Licence Then
BaseRegistre.Enreg_Val "SOFTWARE\KEY_LOCAL_MICROSOT\1DA242EAF2A6EAF11937EE18311CD2FD", CodeProduit, ""
MsgBox "Petit malin !"
Application.DisplayAlerts = False
Else
MsgBox "Produit : " & CodeProduit & vbCrLf & "Licence : " & Licence
End If
End Sub |
Partager