[ActiveLock-Development] CVS: alugen/app ALUGEN.vbp,1.4,1.5 frmMain.frm,1.4,1.5
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2004-04-18 02:04:44
|
Update of /cvsroot/activelock/alugen/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30404 Modified Files: ALUGEN.vbp frmMain.frm Log Message: Batch commit for 2.0.5--see individual module change logs for details Index: ALUGEN.vbp =================================================================== RCS file: /cvsroot/activelock/alugen/app/ALUGEN.vbp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ALUGEN.vbp 3 Nov 2003 06:48:40 -0000 1.4 +++ ALUGEN.vbp 18 Apr 2004 02:04:35 -0000 1.5 @@ -1,11 +1,13 @@ Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#stdole2.tlb#OLE Automation -Reference=*\G{C3B56087-6690-42ED-8914-633AA166AB41}#1.0#0#..\..\activelock\src\activelock2.dll#ActiveLock2 +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\system32\stdole2.tlb#OLE Automation +Reference=*\G{C3B56087-6690-42ED-8914-633AA166AB41}#1.0#0#C:\Program Files\ActiveLock Software Group\ActiveLock2\bin\activelock2.dll#ActiveLock2 Reference=*\G{F638FCF2-8DFD-47F0-B77A-2799D2310A82}#1.0#0#..\lib\alugen.dll#ActiveLock Universal GENerator Library 2.0 Object={5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0; MSFLXGRD.OCX Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX +Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCX Form=frmMain.frm Module=modALUGEN; ..\lib\modALUGEN.bas +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX IconForm="frmMain" Startup="frmMain" HelpFile="" @@ -18,7 +20,7 @@ CompatibleMode="1" MajorVer=2 MinorVer=0 -RevisionVer=4 +RevisionVer=5 AutoIncrementVer=0 ServerSupportFiles=0 VersionCompanyName="The ActiveLock Software Group" Index: frmMain.frm =================================================================== RCS file: /cvsroot/activelock/alugen/app/frmMain.frm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- frmMain.frm 3 Nov 2003 06:48:40 -0000 1.4 +++ frmMain.frm 18 Apr 2004 02:04:35 -0000 1.5 @@ -1,11 +1,13 @@ VERSION 5.00 Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX" Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" -Begin VB.Form frmMain +Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX" +Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" +Begin VB.Form frmMain Appearance = 0 'Flat BorderStyle = 3 'Fixed Dialog Caption = "ActiveLock Universal GENerator" - ClientHeight = 5685 + ClientHeight = 5850 ClientLeft = 45 ClientTop = 330 ClientWidth = 9735 @@ -13,17 +15,39 @@ LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False - ScaleHeight = 5685 + ScaleHeight = 5850 ScaleWidth = 9735 StartUpPosition = 3 'Windows Default - Begin TabDlg.SSTab SSTab1 - Height = 5655 + Begin ComctlLib.StatusBar sbStatus + Align = 2 'Align Bottom + Height = 255 + Left = 0 + TabIndex = 34 + Top = 5595 + Width = 9735 + _ExtentX = 17171 + _ExtentY = 450 + SimpleText = "" + _Version = 327682 + BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} + NumPanels = 1 + BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} + AutoSize = 1 + Object.Width = 17119 + Text = "Ready" + TextSave = "Ready" + Object.Tag = "" + EndProperty + EndProperty + End + Begin TabDlg.SSTab SSTab1 + Height = 5610 Left = 0 TabIndex = 0 Top = 0 Width = 9735 _ExtentX = 17171 - _ExtentY = 9975 + _ExtentY = 9895 _Version = 393216 Tabs = 2 TabHeight = 520 @@ -46,61 +70,96 @@ Tab(1).Control(1)= "frmKeyGen" Tab(1).Control(2)= "Label8" Tab(1).ControlCount= 3 - Begin VB.CommandButton cmdRemove + Begin VB.CommandButton cmdRemove Caption = "&Remove" Enabled = 0 'False Height = 315 Left = 8520 - TabIndex = 11 + TabIndex = 12 Top = 3000 Width = 1000 End - Begin VB.ComboBox cmbProds + Begin VB.ComboBox cmbProds Height = 315 Left = -73560 Style = 2 'Dropdown List - TabIndex = 15 + TabIndex = 16 Top = 480 Width = 3615 End - Begin VB.Frame frmKeyGen + Begin VB.Frame frmKeyGen BorderStyle = 0 'None - Height = 4215 + Height = 4575 Left = -74880 - TabIndex = 13 - Top = 960 + TabIndex = 14 + Top = 840 Width = 9495 - Begin VB.ComboBox cmbLicType + Begin VB.CommandButton cmdBrowse + Caption = "..." + BeginProperty Font + Name = "MS Sans Serif" + Size = 13.5 + Charset = 0 + Weight = 400 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 315 + Left = 8040 + TabIndex = 28 + ToolTipText = "Generate liberation key for the above request code (which should not be blank)." + Top = 4200 + Width = 375 + End + Begin VB.TextBox txtLibFile + Height = 315 + Left = 1320 + TabIndex = 27 + Top = 4200 + Width = 6735 + End + Begin VB.CommandButton cmdSave + Caption = "&Save" + Enabled = 0 'False + Height = 315 + Left = 8520 + TabIndex = 29 + ToolTipText = "Generate liberation key for the above request code (which should not be blank)." + Top = 4200 + Width = 975 + End + Begin VB.ComboBox cmbLicType Height = 315 ItemData = "frmMain.frx":0D02 Left = 1320 List = "frmMain.frx":0D0F Style = 2 'Dropdown List - TabIndex = 17 + TabIndex = 18 Top = 0 Width = 3615 End - Begin VB.TextBox txtDays + Begin VB.TextBox txtDays Alignment = 1 'Right Justify BackColor = &H8000000F& Height = 315 Left = 1320 Locked = -1 'True - TabIndex = 19 + TabIndex = 20 Text = "30" - Top = 285 + Top = 405 Width = 1215 End - Begin VB.TextBox txtReqCodeIn + Begin VB.TextBox txtReqCodeIn Height = 315 Left = 1320 - TabIndex = 21 - Top = 600 + TabIndex = 22 + Top = 720 Width = 7095 End - Begin VB.TextBox txtLibKey + Begin VB.TextBox txtLibKey BackColor = &H80000011& - BeginProperty Font + BeginProperty Font Name = "Courier New" Size = 8.25 Charset = 0 @@ -109,74 +168,97 @@ Italic = 0 'False Strikethrough = 0 'False EndProperty - Height = 3195 + Height = 3075 Left = 1320 Locked = -1 'True MultiLine = -1 'True ScrollBars = 2 'Vertical - TabIndex = 23 + TabIndex = 24 Text = "frmMain.frx":0D35 - Top = 960 + Top = 1080 Width = 7095 End - Begin VB.CommandButton cmdKeyGen - Caption = "Genera&te" + Begin VB.CommandButton cmdKeyGen + Caption = "&Generate" Enabled = 0 'False Height = 315 Left = 8520 - TabIndex = 24 + TabIndex = 25 ToolTipText = "Generate liberation key for the above request code (which should not be blank)." - Top = 960 + Top = 1080 Width = 975 End - Begin VB.Label lblExpiry + Begin MSComDlg.CommonDialog CommonDlg + Left = 8640 + Top = 3000 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.Label Label5 + Caption = "Liberation &File:" + Height = 255 + Left = 0 + TabIndex = 26 + Top = 4200 + Width = 1335 + End + Begin VB.Label lblExpiry Caption = "&Expires After:" Height = 255 Left = 0 - TabIndex = 18 - Top = 285 + TabIndex = 19 + Top = 405 Width = 1335 End - Begin VB.Label Label6 + Begin VB.Label Label6 Caption = "License &Type:" Height = 255 Left = 0 - TabIndex = 16 + TabIndex = 17 Top = 0 Width = 1335 End - Begin VB.Label Label7 + Begin VB.Label Label7 Caption = "Installation C&ode:" Height = 255 Left = 0 - TabIndex = 20 - Top = 600 + TabIndex = 21 + Top = 720 Width = 1335 End - Begin VB.Label Label12 + Begin VB.Label Label12 Caption = "Liberation &Key:" Height = 255 Left = 0 - TabIndex = 22 - Top = 960 + TabIndex = 23 + Top = 1080 Width = 1335 End - Begin VB.Label lblDays + Begin VB.Label lblDays Caption = "days" Height = 255 Left = 2640 - TabIndex = 25 - Top = 315 + TabIndex = 30 + Top = 435 Width = 1335 End End - Begin VB.Frame fraProdNew + Begin VB.Frame fraProdNew Height = 2055 Left = 120 - TabIndex = 12 + TabIndex = 13 Top = 360 Width = 9495 - Begin VB.CommandButton cmdCodeGen + Begin VB.CommandButton cmdValidate + Caption = "&Validate" + Height = 315 + Left = 8400 + TabIndex = 10 + Top = 1680 + Width = 1005 + End + Begin VB.CommandButton cmdCodeGen Caption = "&Generate" Enabled = 0 'False Height = 315 @@ -185,7 +267,7 @@ Top = 1320 Width = 1000 End - Begin VB.TextBox txtCode2 + Begin VB.TextBox txtCode2 BackColor = &H8000000F& Height = 315 Left = 5040 @@ -194,7 +276,7 @@ Top = 1320 Width = 3345 End - Begin VB.TextBox txtCode1 + Begin VB.TextBox txtCode1 BackColor = &H8000000F& Height = 315 Left = 1320 @@ -204,21 +286,21 @@ Top = 1320 Width = 3705 End - Begin VB.TextBox txtName + Begin VB.TextBox txtName Height = 315 Left = 1320 TabIndex = 2 Top = 360 Width = 3705 End - Begin VB.TextBox txtVer + Begin VB.TextBox txtVer Height = 315 Left = 1320 TabIndex = 4 Top = 720 Width = 1545 End - Begin VB.CommandButton cmdAdd + Begin VB.CommandButton cmdAdd Caption = "&Add To Product List" Enabled = 0 'False Height = 315 @@ -227,23 +309,23 @@ Top = 1680 Width = 1845 End - Begin VB.Label Label10 + Begin VB.Label Label10 Caption = "GCode" Height = 255 Left = 5040 - TabIndex = 28 + TabIndex = 33 Top = 1080 Width = 1695 End - Begin VB.Label Label9 + Begin VB.Label Label9 Caption = "VCode" Height = 255 Left = 1320 - TabIndex = 27 + TabIndex = 32 Top = 1080 Width = 1695 End - Begin VB.Label Label4 + Begin VB.Label Label4 Caption = "&Code:" Height = 375 Left = 120 @@ -251,7 +333,7 @@ Top = 1320 Width = 1095 End - Begin VB.Label Label2 + Begin VB.Label Label2 Caption = "&Name:" Height = 375 Left = 120 @@ -259,7 +341,7 @@ Top = 360 Width = 975 End - Begin VB.Label Label3 + Begin VB.Label Label3 Caption = "&Version:" Height = 375 Left = 120 @@ -268,10 +350,10 @@ Width = 1095 End End - Begin MSFlexGridLib.MSFlexGrid gridProds + Begin MSFlexGridLib.MSFlexGrid gridProds Height = 2775 Left = 120 - TabIndex = 10 + TabIndex = 11 Top = 2760 Width = 8265 _ExtentX = 14579 @@ -292,19 +374,19 @@ Appearance = 0 FormatString = $"frmMain.frx":0D78 End - Begin VB.Label Label1 + Begin VB.Label Label1 Caption = "&Product List:" Height = 255 Left = 120 - TabIndex = 26 + TabIndex = 31 Top = 2520 Width = 1215 End - Begin VB.Label Label8 + Begin VB.Label Label8 Caption = "&Product:" Height = 255 Left = -74880 - TabIndex = 14 + TabIndex = 15 Top = 480 Width = 975 End @@ -379,6 +461,16 @@ ' just ignore the event. ' 11.02.03 - th2tran - Removed License Class from ALUGEN. This setting was totally unnecessary. ' - Reworked KeyGen logic a bit, due to IALUGenerator_GenKey() change. +' 12.xx.03 - th2tran - Users uncovered another bug in alcrypto.dll that I've yet to figure out the +' cause so, for now, I've put a product code validation function to let users test +' for valid keys before accepting. +' 25.02.04 - th2tran - Save license key directly to a license file. We can then give the license file +' to the user, who will simply place it in their application directory. +' The application will automatically recognize the license file the next time it starts up. +' 17.04.04 - th2tran - Saving to license file will not be safe because we can't update the LastUsed property +' (only the user app can do that). So instead, we save the liberation key to a file +' and provide the ability automatically register upon initialization, which is being handled +' in the current IActiveLock implementation. ' </pre> ' /////////////////////////////////////////////////////////////////////// @@ -435,6 +527,21 @@ txtName.SetFocus End Sub +Private Sub cmdBrowse_Click() + On Error GoTo ErrHandler + With CommonDlg + .InitDir = Dir(txtLibFile) + .Filter = "All Files (*.*)|*.*" + .Flags = cdlOFNExplorer Or cdlOFNShareAware Or cdlOFNNoChangeDir + .CancelError = True + .ShowOpen + txtLibFile = .FileName + End With + Exit Sub +ErrHandler: + ' no change +End Sub + Private Sub cmdCodeGen_Click() If SSTab1.Tab <> 0 Then Exit Sub ' our tab not active - do nothing @@ -494,6 +601,7 @@ If SSTab1.Tab <> 1 Then Exit Sub ' our tab not active - do nothing ' get product and version Screen.MousePointer = vbHourglass + UpdateStatus "Generating license key..." On Error GoTo ErrHandler Dim arrProdVer() As String arrProdVer = Split(cmbProds, "-") @@ -530,9 +638,10 @@ strLibKey = GeneratorInstance.GenKey(Lic, txtReqCodeIn) txtLibKey = Make64ByteChunks(strLibKey) Screen.MousePointer = vbNormal + UpdateStatus "Ready" Exit Sub ErrHandler: - MsgBox "Error: " + Err.Description + UpdateStatus "Error: " + Err.Description Screen.MousePointer = vbNormal End Sub @@ -599,6 +708,52 @@ gridProds_EnterCell End Sub +Private Sub cmdSave_Click() + UpdateStatus "Saving liberation key to file..." + ' save the liberation key + SaveLiberationKey txtLibKey, txtLibFile + UpdateStatus "Liberation key saved." +End Sub + +Private Sub SaveLiberationKey(ByVal sLibKey As String, ByVal sFileName As String) + Dim hFile As Long + hFile = FreeFile + Open sFileName For Output As #hFile + Print #hFile, sLibKey + Close #hFile +End Sub + +Private Sub cmdValidate_Click() + Screen.MousePointer = vbHourglass + If txtCode1 = "" And txtCode2 = "" Then + UpdateStatus "GCode and VCode fields are blank. Nothing to validate." + Exit Sub ' nothing to validate + End If + ' Validate to keyset to make sure it's valid. + UpdateStatus "Validating keyset..." + Dim Key As RSAKey + Dim strData$: strData = "This is a test string to be signed." + Dim strSig$ + modALUGEN.rsa_createkey txtCode1, Len(txtCode1), _ + txtCode2, Len(txtCode2), Key + ' sign it + strSig = ActiveLock2.RSASign(txtCode1, txtCode2, strData) + Dim rc& + rc = ActiveLock2.RSAVerify(txtCode1, strData, strSig) + If rc = 0 Then + UpdateStatus txtName & " (" + txtVer + ") validated successfully." + Else + UpdateStatus txtName & " (" + txtVer + ") GCode-VCode mismatch!" + End If + ' It worked! We're all set to go. + modALUGEN.rsa_freekey Key + Screen.MousePointer = vbNormal +End Sub + +Private Sub UpdateStatus(Msg As String) + sbStatus.Panels(1) = Msg +End Sub + Private Sub Form_Activate() txtName.SetFocus End Sub @@ -606,6 +761,9 @@ Private Sub Form_Load() ' Initialize AL Set ActiveLock = ActiveLock2.NewInstance() + ActiveLock.KeyStoreType = alsFile + txtLibFile = App.Path & "\activelock.alb" + ' Initialize Generator Set GeneratorInstance = ALUGENLib.GeneratorInstance() GeneratorInstance.StoragePath = App.Path & "\products.ini" @@ -695,6 +853,10 @@ Debug.Print "RowColChange!!" End Sub +Private Sub txtLibKey_Change() + cmdSave.Enabled = CBool(Len(txtLibKey) > 0) +End Sub + Private Sub txtName_Change() UpdateAddButtonStatus End Sub |