Update of /cvsroot/activelock/activelock2/src
In directory sc8-pr-cvs1:/tmp/cvs-serv5916
Modified Files:
ActiveLock.cls Globals.cls ActiveLock2.dll ActiveLock2.vbp
Log Message:
Fixed problem found by Dan where it crashed on Acquire() if SoftwareCode has not been set.
Need to make sure we're properly initialized.
Index: ActiveLock.cls
===================================================================
RCS file: /cvsroot/activelock/activelock2/src/ActiveLock.cls,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ActiveLock.cls 31 Jul 2003 15:49:54 -0000 1.9
+++ ActiveLock.cls 1 Aug 2003 06:13:27 -0000 1.10
@@ -85,10 +85,15 @@
Private mKeyStorePath As String
Private MyNotifier As New ActiveLockEventNotifier
Private MyGlobals As New Globals
+
' Registry hive used to store Active Lock settings.
Private Const AL_REGISTRY_HIVE$ = "Software\ActiveLock Software Group\ActiveLock2"
+' Transients
+Private mfInit As Boolean ' flag to indicate that ActiveLock has been initialized
+
+
'''
' IActiveLock Interface implementations
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -100,20 +105,21 @@
Private Sub IActiveLock_Init(Arg1 As Variant, ParamArray OtherArgs() As Variant)
' Checksum ALCrypto.dll
Const ALCRYPTO_MD5$ = "ac0dd6351905e6d688199146165170c4"
- Dim strData As String, strMD5 As String
- Call modActiveLock.ReadFile(App.Path & "\ALCrypto.Dll", strData)
- strMD5 = modMD5.Hash(strData) ' use our own MD5 hashing routine instead of ALCrypto's md5_hash() function.
+ Dim strdata As String, strMD5 As String
+ Call modActiveLock.ReadFile(App.path & "\ALCrypto.Dll", strdata)
+ strMD5 = modMD5.Hash(strdata) ' use our own MD5 hashing routine instead of ALCrypto's md5_hash() function.
If strMD5 <> ALCRYPTO_MD5 Then
Err.Raise ActiveLockErrCodeConstants.alerrFileTampered, "IActiveLock_Acquire", "ALCrypto.dll has been tampered."
End If
+ mfInit = True
End Sub
Private Sub IActiveLock_Acquire()
If mKeyStore Is Nothing Then
Err.Raise ActiveLockErrCodeConstants.alerrKeyStoreInvalid, "IActiveLock_Acquire", "Key Store Provider hasn't been initialized yet."
End If
+
Dim Lic As ProductLicense
-
Set Lic = mKeyStore.Retrieve(mSoftwareName)
If Lic Is Nothing Then
Err.Raise ActiveLockErrCodeConstants.alerrNoLicense, "IActiveLock_Acquire", "No valid license"
@@ -137,6 +143,11 @@
' Validate the License Key using RSA signature verification.
' License key contains the RSA signature of IActiveLock_LockCode.
Private Sub ValidateKey(Lic As ProductLicense)
+ ' make sure software code is set
+ If mSoftwareCode = "" Then
+ Err.Raise ActiveLockErrCodeConstants.alerrNotInitialized, "ActiveLock2", "Software Code has not been set."
+ End If
+
Dim Key As RSAKey
Dim strPubKey As String
strPubKey = mSoftwareCode
@@ -163,6 +174,11 @@
' Validate the entire license (including lastused, etc...)
'
Private Sub ValidateLic(Lic As ProductLicense)
+ ' make sure we're initialized.
+ If Not mfInit Then
+ Err.Raise ActiveLockErrCodeConstants.alerrNotInitialized, "ActiveLock2", "ActiveLock has not been initialized."
+ End If
+
' validate license key first
ValidateKey Lic
Dim strEncrypted As String, strHash As String
Index: Globals.cls
===================================================================
RCS file: /cvsroot/activelock/activelock2/src/Globals.cls,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Globals.cls 31 Jul 2003 07:04:53 -0000 1.9
+++ Globals.cls 1 Aug 2003 06:13:27 -0000 1.10
@@ -96,6 +96,7 @@
alerrLockChanged = &H80040005
alerrKeyStoreInvalid = &H80040010
alerrFileTampered = &H80040011
+ alerrNotInitialized = &H80040012
End Enum
''
Index: ActiveLock2.dll
===================================================================
RCS file: /cvsroot/activelock/activelock2/src/ActiveLock2.dll,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
Binary files /tmp/cvswO8sTM and /tmp/cvsamVv3s differ
Index: ActiveLock2.vbp
===================================================================
RCS file: /cvsroot/activelock/activelock2/src/ActiveLock2.vbp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ActiveLock2.vbp 31 Jul 2003 15:49:54 -0000 1.9
+++ ActiveLock2.vbp 1 Aug 2003 06:13:27 -0000 1.10
@@ -1,5 +1,5 @@
Type=OleDll
-Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\system32\STDOLE2.TLB#OLE Automation
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#STDOLE2.TLB#OLE Automation
Class=ActiveLock; ActiveLock.cls
Class=IActiveLock; IActiveLock.cls
Class=Globals; Globals.cls
|