[ActiveLock-Development] CVS: activelock/examples/example1 frmMain.frm,1.5,1.6 modMain.bas,1.6,1.7
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2003-11-04 07:49:33
|
Update of /cvsroot/activelock/activelock/examples/example1 In directory sc8-pr-cvs1:/tmp/cvs-serv9163 Modified Files: frmMain.frm modMain.bas Log Message: See internal Change Logs for details Index: frmMain.frm =================================================================== RCS file: /cvsroot/activelock/activelock/examples/example1/frmMain.frm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- frmMain.frm 13 Oct 2003 07:45:31 -0000 1.5 +++ frmMain.frm 4 Nov 2003 07:49:29 -0000 1.6 @@ -1,7 +1,7 @@ VERSION 5.00 Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX" -Begin VB.Form frmMain +Begin VB.Form frmMain BorderStyle = 3 'Fixed Dialog Caption = "ActiveLock2 Test App" ClientHeight = 6615 @@ -15,7 +15,7 @@ ScaleHeight = 6615 ScaleWidth = 8025 StartUpPosition = 3 'Windows Default - Begin ComctlLib.StatusBar sbStatus + Begin ComctlLib.StatusBar sbStatus Align = 2 'Align Bottom Height = 255 Left = 0 @@ -27,15 +27,15 @@ Style = 1 SimpleText = "Ready" _Version = 327682 - BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} + BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} NumPanels = 1 - BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} + BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} Key = "" Object.Tag = "" EndProperty EndProperty End - Begin TabDlg.SSTab SSTab1 + Begin TabDlg.SSTab SSTab1 Height = 6255 Left = 0 TabIndex = 3 @@ -58,20 +58,20 @@ TabCaption(1) = "Sample App" TabPicture(1) = "frmMain.frx":0CE6 Tab(1).ControlEnabled= 0 'False - Tab(1).Control(0)= "lblLockStatus" - Tab(1).Control(1)= "lblLockStatus2" + Tab(1).Control(0)= "fraViewport" + Tab(1).Control(1)= "fraTicker" Tab(1).Control(2)= "Frame1" - Tab(1).Control(3)= "fraTicker" - Tab(1).Control(4)= "fraViewport" + Tab(1).Control(3)= "lblLockStatus2" + Tab(1).Control(4)= "lblLockStatus" Tab(1).ControlCount= 5 - Begin VB.Frame fraViewport + Begin VB.Frame fraViewport BorderStyle = 0 'None Height = 400 Left = -74950 TabIndex = 35 Top = 5510 Width = 7850 - Begin ALTestApp.atViewPort atViewPort1 + Begin ALTestApp.atViewPort atViewPort1 Height = 375 Left = 0 Top = 0 @@ -89,14 +89,14 @@ BalloonTipText = "No Messages" End End - Begin VB.Frame fraTicker + Begin VB.Frame fraTicker Caption = "Message" Height = 1890 Left = -74880 TabIndex = 32 Top = 780 Width = 7575 - Begin VB.TextBox txtTicker + Begin VB.TextBox txtTicker Height = 1200 Left = 30 MultiLine = -1 'True @@ -106,7 +106,7 @@ Top = 240 Width = 7425 End - Begin VB.CommandButton cmdTest + Begin VB.CommandButton cmdTest Caption = "&Update Ticker" Height = 315 Left = 5730 @@ -115,14 +115,14 @@ Width = 1710 End End - Begin VB.Frame Frame1 + Begin VB.Frame Frame1 BorderStyle = 0 'None Height = 2535 Left = -74865 TabIndex = 20 Top = 2820 Width = 6615 - Begin VB.OptionButton optForm + Begin VB.OptionButton optForm Caption = "System Tray" Height = 225 Index = 1 @@ -131,7 +131,7 @@ Top = 1245 Width = 1395 End - Begin VB.OptionButton optForm + Begin VB.OptionButton optForm Caption = "Form" Height = 225 Index = 0 @@ -141,7 +141,7 @@ Value = -1 'True Width = 1395 End - Begin VB.ComboBox cboSpeed + Begin VB.ComboBox cboSpeed Height = 315 ItemData = "frmMain.frx":0D74 Left = 2070 @@ -151,7 +151,7 @@ Top = 270 Width = 1635 End - Begin VB.CheckBox chkBlackout + Begin VB.CheckBox chkBlackout Caption = "Black Out Ticker" Height = 420 Left = 0 @@ -159,7 +159,7 @@ Top = 645 Width = 1590 End - Begin VB.CheckBox chkSound + Begin VB.CheckBox chkSound Caption = "Play Sound On New Message" Height = 495 Left = 0 @@ -167,7 +167,7 @@ Top = 1590 Width = 1470 End - Begin VB.CheckBox chkPause + Begin VB.CheckBox chkPause Caption = "Pause Ticker" Height = 315 Left = 0 @@ -175,7 +175,7 @@ Top = 300 Width = 1365 End - Begin VB.CheckBox chkFlash + Begin VB.CheckBox chkFlash Caption = "Flash Ticker On New Message" Height = 495 Left = 0 @@ -183,7 +183,7 @@ Top = 1080 Width = 1470 End - Begin VB.CheckBox chkScroll + Begin VB.CheckBox chkScroll Caption = "Scroll Ticker" Height = 225 Left = 15 @@ -192,7 +192,7 @@ Value = 1 'Checked Width = 1275 End - Begin VB.CheckBox chkEnable + Begin VB.CheckBox chkEnable Caption = "Enable Balloon Tooltip" Height = 495 Left = 15 @@ -200,7 +200,7 @@ Top = 2115 Width = 1755 End - Begin VB.Label lblHost + Begin VB.Label lblHost Caption = "Ticker Host:" Height = 255 Left = 2055 @@ -208,7 +208,7 @@ Top = 705 Width = 990 End - Begin VB.Label lblSpeed + Begin VB.Label lblSpeed Caption = "Scroll Speed:" Height = 255 Left = 2070 @@ -217,22 +217,22 @@ Width = 1245 End End - Begin VB.Frame fraReg + Begin VB.Frame fraReg Caption = "Register" Height = 3255 Left = 120 TabIndex = 11 Top = 2580 Width = 7695 - Begin VB.TextBox txtUser + Begin VB.TextBox txtUser Height = 285 - Left = 1320 + Left = 1440 TabIndex = 16 Text = "Thanh Tran" Top = 240 - Width = 5055 + Width = 4935 End - Begin VB.CommandButton cmdReqGen + Begin VB.CommandButton cmdReqGen Caption = "&Generate" Height = 255 Left = 6480 @@ -240,16 +240,16 @@ Top = 600 Width = 1095 End - Begin VB.TextBox txtReqCodeGen + Begin VB.TextBox txtReqCodeGen BackColor = &H80000013& Height = 285 - Left = 1320 + Left = 1440 Locked = -1 'True TabIndex = 14 Top = 600 - Width = 5055 + Width = 4935 End - Begin VB.CommandButton cmdRegister + Begin VB.CommandButton cmdRegister Caption = "&Register" Enabled = 0 'False Height = 255 @@ -258,14 +258,25 @@ Top = 960 Width = 1095 End - Begin VB.TextBox txtLibKeyIn - Height = 285 - Left = 1320 + Begin VB.TextBox txtLibKeyIn + BeginProperty Font + Name = "Courier New" + Size = 8.25 + Charset = 0 + Weight = 400 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 2085 + Left = 1440 + MultiLine = -1 'True + ScrollBars = 3 'Both TabIndex = 12 Top = 960 - Width = 5055 + Width = 4935 End - Begin VB.Label Label13 + Begin VB.Label Label13 Caption = "User Name:" Height = 255 Left = 120 @@ -273,15 +284,15 @@ Top = 240 Width = 1335 End - Begin VB.Label Label11 - Caption = "Request Code:" + Begin VB.Label Label11 + Caption = "Installation Code:" Height = 255 Left = 120 TabIndex = 18 Top = 600 Width = 1335 End - Begin VB.Label Label4 + Begin VB.Label Label4 Caption = "Liberation Key:" Height = 255 Left = 120 @@ -290,14 +301,14 @@ Width = 1335 End End - Begin VB.Frame fraRegStatus + Begin VB.Frame fraRegStatus Caption = "Status" Height = 2055 Left = 120 TabIndex = 4 Top = 420 Width = 7695 - Begin VB.TextBox txtChecksum + Begin VB.TextBox txtChecksum BackColor = &H80000013& Height = 285 Left = 1560 @@ -306,7 +317,7 @@ Top = 1680 Width = 4335 End - Begin VB.TextBox txtVersion + Begin VB.TextBox txtVersion BackColor = &H80000013& Height = 285 Left = 1560 @@ -316,7 +327,7 @@ Top = 480 Width = 4335 End - Begin VB.TextBox txtName + Begin VB.TextBox txtName BackColor = &H80000013& Height = 285 Left = 1560 @@ -326,7 +337,7 @@ Top = 240 Width = 4335 End - Begin VB.TextBox txtExpiration + Begin VB.TextBox txtExpiration BackColor = &H80000013& Height = 285 Left = 1560 @@ -335,7 +346,7 @@ Top = 1320 Width = 4335 End - Begin VB.TextBox txtUsedDays + Begin VB.TextBox txtUsedDays BackColor = &H80000013& Height = 285 Left = 1560 @@ -344,7 +355,7 @@ Top = 1080 Width = 4335 End - Begin VB.TextBox txtRegStatus + Begin VB.TextBox txtRegStatus BackColor = &H80000013& Height = 285 Left = 1560 @@ -353,7 +364,7 @@ Top = 840 Width = 4335 End - Begin VB.Label Label3 + Begin VB.Label Label3 Caption = "DLL Checksum:" Height = 255 Left = 120 @@ -361,7 +372,7 @@ Top = 1680 Width = 1335 End - Begin VB.Label Label2 + Begin VB.Label Label2 Caption = "App Version:" Height = 255 Left = 120 @@ -369,7 +380,7 @@ Top = 480 Width = 975 End - Begin VB.Label Label1 + Begin VB.Label Label1 Caption = "App Name:" Height = 255 Left = 120 @@ -377,7 +388,7 @@ Top = 240 Width = 975 End - Begin VB.Label Label8 + Begin VB.Label Label8 Caption = "Expiry Date:" Height = 255 Left = 120 @@ -385,7 +396,7 @@ Top = 1320 Width = 975 End - Begin VB.Label Label7 + Begin VB.Label Label7 Caption = "Days Used:" Height = 255 Left = 120 @@ -393,7 +404,7 @@ Top = 1080 Width = 975 End - Begin VB.Label Label6 + Begin VB.Label Label6 Caption = "Registered:" Height = 255 Left = 120 @@ -402,9 +413,9 @@ Width = 975 End End - Begin VB.Label lblLockStatus2 + Begin VB.Label lblLockStatus2 Caption = "Disabled" - BeginProperty Font + BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 @@ -419,7 +430,7 @@ Top = 480 Width = 975 End - Begin VB.Label lblLockStatus + Begin VB.Label lblLockStatus Caption = "Application Functionalities Are Currently: " Height = 375 Left = -74880 @@ -496,6 +507,9 @@ ' by ALUGEN. ' 10.13.03 - th2tran - Added simple Encrypt routine to illustrate handling of ' ActiveLockEventNotifier.ValidateValue() event. +' 11.02.03 - th2tran - Store message box messages in encrypted format to elude hex editors. +' - txtLibKeyIn is now MultiLine-enabled +' - Terminology change: RequestCode is now known as InstallationCode ' /////////////////////////////////////////////////////////////////////// ' / MODULE CODE BEGINS BELOW THIS LINE / ' /////////////////////////////////////////////////////////////////////// @@ -520,7 +534,7 @@ .SoftwareCode = PUB_KEY .LockType = lockHD End With - + ' 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. @@ -530,7 +544,7 @@ #If AL_DEBUG <> 1 Then txtChecksum = modMain.VerifyActiveLockdll(New ActiveLock2.Globals) #End If - + ' Initialize the keystore. We use a File keystore in this case. MyActiveLock.KeyStoreType = alsFile MyActiveLock.KeyStorePath = App.Path & "\al.lic" @@ -548,7 +562,7 @@ End With txtVersion = App.Major & "." & App.Minor & "." & App.Revision cboSpeed = cboSpeed.List(2) - + '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 @@ -557,7 +571,7 @@ '****************************************************************** '* Don't Forget This!!!!!!!! * '****************************************************************** - + ' Check registration status On Error GoTo NotRegistered MyActiveLock.Acquire @@ -568,7 +582,7 @@ Exit Sub NotRegistered: MsgBox Err.Number & ": " & Err.Description - txtRegStatus = "Not Registered" + txtRegStatus = modMain.Dec("35A.4C5.4FC.160.386.457.46D.483.4F1.4FC.457.4E6.457.44C") ' "Not Registered" End Sub @@ -616,7 +630,7 @@ On Error GoTo errHandler ' Register this key MyActiveLock.Register txtLibKeyIn - MsgBox "Registration successful!" + MsgBox modMain.Dec("386.457.46D.483.4F1.4FC.4E6.42B.4FC.483.4C5.4BA.160.4F1.507.441.441.457.4F1.4F1.462.507.4A4.16B") ' "Registration successful!" Exit Sub errHandler: MsgBox Err.Number & ": " & Err.Description Index: modMain.bas =================================================================== RCS file: /cvsroot/activelock/activelock/examples/example1/modMain.bas,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- modMain.bas 13 Oct 2003 07:45:31 -0000 1.6 +++ modMain.bas 4 Nov 2003 07:49:29 -0000 1.7 @@ -56,6 +56,7 @@ ' 09.21.03 - th2tran - Dumped PRIV_KEY. PRIV_KEY should only be accessible to ALUGEN. ' 10.13.03 - th2tran - Copied a small number of functions from modActiveLock.bas into here ' so that our test app doesn't need to depend on modActiveLock. +' 11.02.03 - th2tran - Added simple encrypt/decrypt routines to be used by frmMain ' </pre> '* /////////////////////////////////////////////////////////////////////// @@ -273,7 +274,7 @@ ' that you generate your own set of keys to use before deploying your app. 'Public Const PRIV_KEY$ = "???" Public Const PUB_KEY$ = "AAAAB3NzaC1yc2EAAAABJQAAAIBmyH+sZ9eXI33MbVFWR85fsHLXndX2WaNokSaqxYltluQx2sX4T81r7jazTFxcczllwuMEauhL1rTqXCma0uA6xAQGajRorXeLcrW5OHIut7+HprXy9MTUp0SwsVFJJjDaRmodPaCBTUPD006lG7LNN5/jO/Cj8dNf6lVHy+VnIQ==" - + 'Commented out Encrypt() for now. Have to think about using some other means, ' because PRIV_KEY is no longer accessible to us. 'Public Function Encrypt(strData As String) As String @@ -309,16 +310,47 @@ crc = CRCCheckSumTypeLib(obj) Debug.Print "Hash: " & crc If crc <> Value Then - MsgBox "activelock2.dll has been corrupted. If you were running a real application, it should terminate at this point." + ' Encrypted version of "activelock2.dll has been corrupted. If you were running a real application, it should terminate at this point." + MsgBox Dec("42B.441.4FC.483.512.457.4A4.4C5.441.499.226.1FA.44C.4A4.4A4.160.478.42B.4F1.160.436.457.457.4BA.160.441.4C5.4E6.4E6.507.4D0.4FC.457.44C.1FA.160.160.323.462.160.533.4C5.507.160.51D.457.4E6.457.160.4E6.507.4BA.4BA.483.4BA.46D.160.42B.160.4E6.457.42B.4A4.160.42B.4D0.4D0.4A4.483.441.42B.4FC.483.4C5.4BA.1E4.160.483.4FC.160.4F1.478.4C5.507.4A4.44C.160.4FC.457.4E6.4AF.483.4BA.42B.4FC.457.160.42B.4FC.160.4FC.478.483.4F1.160.4D0.4C5.483.4BA.4FC.1FA") End If VerifyActiveLockdll = CStr(crc) End Function '' +' Simple encrypt of a string +Public Function Enc(strData As String) As String + Dim i&, n& + Dim sResult$ + n = Len(strData) + Dim l As Long + For i = 1 To n + l = Asc(Mid$(strData, i, 1)) * 11 + If sResult = "" Then + sResult = Hex(l) + Else + sResult = sResult & "." & Hex(l) + End If + Next i + Enc = sResult +End Function + +Public Function Dec(strData As String) As String + Dim arr() As String + arr = Split(strData, ".") + Dim sRes As String + Dim i& + For i = LBound(arr) To UBound(arr) + sRes = sRes & Chr$(CLng("&h" & arr(i)) / 11) + Next + Dec = sRes +End Function + + +'' ' Returns the expected CRC value of ActiveLock2.dll ' Private Property Get Value() As Long - Value = 176794 + 1856 ' 178650 - computed so that it can't be easily spotted via a Hex Editor + Value = 121711 + 8516 ' compute it so that it can't be easily spotted via a Hex Editor End Property '' |