[ActiveLock-Development] CVS: activelock2/test ALTestApp.vbp,1.5,1.6 frmMain.frm,1.7,1.8
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2003-08-03 09:26:24
|
Update of /cvsroot/activelock/activelock2/test In directory sc8-pr-cvs1:/tmp/cvs-serv13660 Modified Files: ALTestApp.vbp frmMain.frm Log Message: Updated code comments. Index: ALTestApp.vbp =================================================================== RCS file: /cvsroot/activelock/activelock2/test/ALTestApp.vbp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ALTestApp.vbp 1 Aug 2003 23:43:31 -0000 1.5 +++ ALTestApp.vbp 3 Aug 2003 09:26:21 -0000 1.6 @@ -1,5 +1,5 @@ Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\WINNT\system32\STDOLE2.TLB#OLE Automation +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#stdole2.tlb#OLE Automation Reference=*\G{AAED8AB4-AC83-4C51-93EE-64664DB96265}#7.0#0#..\src\ActiveLock2.dll#ActiveLock2 Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX Form=frmMain.frm Index: frmMain.frm =================================================================== RCS file: /cvsroot/activelock/activelock2/test/frmMain.frm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- frmMain.frm 2 Aug 2003 07:18:17 -0000 1.7 +++ frmMain.frm 3 Aug 2003 09:26:21 -0000 1.8 @@ -66,15 +66,15 @@ TabCaption(1) = "Registration" TabPicture(1) = "frmMain.frx":001C Tab(1).ControlEnabled= 0 'False - Tab(1).Control(0)= "fraRegStatus" - Tab(1).Control(1)= "fraReg" + Tab(1).Control(0)= "fraReg" + Tab(1).Control(1)= "fraRegStatus" Tab(1).ControlCount= 2 TabCaption(2) = "Sample App" TabPicture(2) = "frmMain.frx":0038 Tab(2).ControlEnabled= 0 'False - Tab(2).Control(0)= "Frame1" + Tab(2).Control(0)= "fraTicker" Tab(2).Control(1)= "fraViewport" - Tab(2).Control(2)= "fraTicker" + Tab(2).Control(2)= "Frame1" Tab(2).ControlCount= 3 Begin VB.TextBox txtChecksum BackColor = &H80000011& @@ -301,17 +301,17 @@ Left = 0 Top = 0 Width = 7850 - _extentx = 13838 - _extenty = 661 - tickerscaleheight= 21 - tickerscalewidth= 519 - tickerfontbold = -1 'True - tickerfontsize = 11.25 - tickerflash = 0 'False - tickerplaysound = 0 'False - tickerscrollx = 123 - balloontipicon = 0 - balloontiptext = "No Messages" + _ExtentX = 13838 + _ExtentY = 661 + TickerScaleHeight= 21 + TickerScaleWidth= 519 + TickerFontBold = -1 'True + TickerFontSize = 11.25 + TickerFlash = 0 'False + TickerPlaySound = 0 'False + TickerScrollX = 518 + BalloonTipIcon = 0 + BalloonTipText = "No Messages" End End Begin VB.Frame fraTicker @@ -625,27 +625,78 @@ Private WithEvents ActiveLockEventSink As ActiveLockEventNotifier Attribute ActiveLockEventSink.VB_VarHelpID = -1 + ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' -' Key Validation Functionalities +' ActiveLock Initialization ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' +Private Sub Form_Load() + FunctionalitiesEnabled = False ' Disable functionalities by default + ' Initialize AL + Set MyActiveLock = ActiveLock2.NewInstance() + ' Verify AL's authenticity + ' VerifyActiveLockdll requires a public-creatable object to be passed in so that it can + ' determine the Type Library DLL on which to perform the checksum. + ' So can't use MyActiveLock object to authenticate since it is not a public creatable object. + ' So we'll use ActiveLock2.Globals, which is just as good because they are in the same DLL. + txtChecksum = modMain.VerifyActiveLockdll(New ActiveLock2.Globals) + + ' Initialize the keystore. We use a File keystore in this case. + MyActiveLock.KeyStoreType = alsFile + MyActiveLock.KeyStorePath = App.Path & "\al.lic" + ' Obtain the EventNotifier so that we can receive notifications from AL. + Set ActiveLockEventSink = MyActiveLock.EventNotifier + + ' Initialize other application settings + With atViewPort1 + .BalloonTipEnabled = chkEnable + .BalloonTipText = .TickerText + .TickerBlackout = chkBlackout + .TickerFlash = chkFlash + .TickerPlaySound = chkSound + .TickerScroll = chkScroll + End With + txtName = App.EXEName + txtVersion = App.Major & "." & App.Minor & "." & App.Revision + cboSpeed = cboSpeed.List(2) + txtSoftwareCodePriv = modMain.PRIV_KEY + txtSoftwareCodePub = modMain.PUB_KEY + + 'These MUST to be set BEFORE you generate the reg code + 'or the app will fail to register properly on the next run + 'I am going to add lots of comments here so that people + ' will find it because it messed me up for hours. + ' + '****************************************************************** + '* Don't Forget This!!!!!!!! * + '****************************************************************** + + cmbLicType = "Permanent" + cmbLicClass = "Class 4 - Lock To Hard Drive Serial" + + ' Check registration status + On Error GoTo NotRegistered + MyActiveLock.Acquire + txtRegStatus = "Registered" + txtUsedDays = MyActiveLock.UsedDays + txtExpiration = MyActiveLock.ExpirationDate + FunctionalitiesEnabled = True + Exit Sub +NotRegistered: + MsgBox Err.Number & ": " & Err.Description + txtRegStatus = "Not Registered" +End Sub -'Private Sub ActiveLockEventSink_ValidateKey(ByVal strLic As String, Result As Variant) -' ' Decrypt LicenseKey using our private key -' strKey = modMain.Decrypt(strKey) -'Debug.Print "ActiveLockEventSink_Validate key: " & vbCrLf & strKey -' Dim strKey2$ -'' Dim arrBytes() As Byte -'' arrBytes = StrConv(strKey, vbFromUnicode) -' strKey2 = TrimNulls(strKey) ' trim nulls -' ' Compare for a match against Lic.ToString() -' ' If matched return YES; otherwise return NO -' If strLic = strKey2 Then -' Result = modActiveLock.MAGICNUMBER_YES -' Else -' Result = modActiveLock.MAGICNUMBER_NO -' End If -'End Sub + +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' +' Key Validation Functionalities +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +'' +' ActiveLock raises this event typically when it needs a value to be encrypted. +' We can use any kind of encryption we'd like here, as long as it's deterministic. +' i.e. there's a one-to-one correspondence between unencrypted value and encrypted value. +' NOTE: BlowFish is NOT an example of deterministic encryption so you can't use it here. Private Sub ActiveLockEventSink_ValidateValue(ByVal Value As String, Result As String) Result = modMain.Encrypt(Value) End Sub @@ -849,58 +900,6 @@ atViewPort1.BalloonTipText = atViewPort1.TickerText atViewPort1.BalloonTipIcon = InfoIcon atViewPort1.BalloonTipTitle = "ActiveTicker Says:" -End Sub - -Private Sub Form_Load() - FunctionalitiesEnabled = False ' Disable functionalities by default - ' Initialize AL - Set MyActiveLock = ActiveLock2.NewInstance() - ' Verify AL's authenticity - txtChecksum = modMain.VerifyActiveLockdll(New ActiveLock2.Globals) - - MyActiveLock.KeyStoreType = alsFile - MyActiveLock.KeyStorePath = App.Path & "\al.lic" - - Set ActiveLockEventSink = MyActiveLock.EventNotifier - - ' Initialize other application settings - With atViewPort1 - .BalloonTipEnabled = chkEnable - .BalloonTipText = .TickerText - .TickerBlackout = chkBlackout - .TickerFlash = chkFlash - .TickerPlaySound = chkSound - .TickerScroll = chkScroll - End With - txtName = App.EXEName - txtVersion = App.Major & "." & App.Minor & "." & App.Revision - cboSpeed = cboSpeed.List(2) - txtSoftwareCodePriv = modMain.PRIV_KEY - txtSoftwareCodePub = modMain.PUB_KEY - - 'These MUST to be set BEFORE you generate the reg code - 'or the app will fail to register properly on the next run - 'I am going to add lots of comments here so that people - ' will find it because it messed me up for hours. - ' - '****************************************************************** - '* Don't Forget This!!!!!!!! * - '****************************************************************** - - cmbLicType = "Permanent" - cmbLicClass = "Class 4 - Lock To Hard Drive Serial" - - ' Check registration status - On Error GoTo NotRegistered - MyActiveLock.Acquire - txtRegStatus = "Registered" - txtUsedDays = MyActiveLock.UsedDays - txtExpiration = MyActiveLock.ExpirationDate - FunctionalitiesEnabled = True - Exit Sub -NotRegistered: - MsgBox Err.Number & ": " & Err.Description - txtRegStatus = "Not Registered" End Sub Private Property Let FunctionalitiesEnabled(flag As Boolean) |