Activelock
September 05, 2010, 02:18:25 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Latest version of Activelock is v3.6.1
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Registered Successfully!!  (Read 255 times)
totorufo
Newbie
*
Posts: 4


View Profile Email
« on: March 09, 2010, 05:57:08 AM »

  I am working with Activelock_Setup_VBNET_3.5.0_Full and ALTestApp3.5.Net example, my problem is that:

  When i put license key (generated by Alugen3_5NET.exe) in the register form it said that "Application is Registered Successfully"

  But when I load again    MyActiveLock.Acquire(ref strMsg)   the license isn't valid!!!

  Any idea?

  Thank you very much

  "Application.lic" is generated and the paths are well.

  The code it is like a example:

Code:

private void frmMain_Load(object sender, System.EventArgs e)
{
//ActiveLock Initialization
string autoRegisterKey=null;
bool boolAutoRegisterKeyPath = false;
string[] A;

string strMsg=null;
try
{
Globals_Renamed MyAL = new Globals_Renamed();
//wrong way
MyActiveLock = MyAL.NewInstance();
//right way
//MyActiveLock =(ActiveLock)MyAL.NewInstance();

MyActiveLock.SoftwareName = modMain.SOFTWARENAME;
txtName.Text = MyActiveLock.SoftwareName;

// Note: Do not use (App.Major & "." & App.Minor & "." & App.Revision)
                // since the license will fail with version incremented exe builds
MyActiveLock.SoftwareVersion = "1.0"; // WARNING *** WARNING *** DO NOT USE App.Major & "." & App.Minor & "." & App.Revision
txtVersion.Text = MyActiveLock.SoftwareVersion;

// This should be set to protect yourself against ResetTrial abuse
MyActiveLock.SoftwarePassword = Convert.ToChar(99).ToString() + Convert.ToChar(111).ToString() + Convert.ToChar(111).ToString() + Convert.ToChar(108).ToString();

                // This should be set to protect yourself against ResetTrial abuse
                // The password is also used by the short keys
                MyActiveLock.LicenseKeyType = IActiveLock.ALLicenseKeyTypes.alsRSA;

// Trial Feature
MyActiveLock.TrialType = IActiveLock.ALTrialTypes.trialDays;
MyActiveLock.TrialLength = 15;
if (MyActiveLock.TrialType != IActiveLock.ALTrialTypes.trialNone & MyActiveLock.TrialLength == 0)
{
    /*
    *  Do Nothing
                        *  In such cases Activelock automatically generates errors -11001100 or -11001101
                        *  to indicate that you're using the trial feature but, trial length was not specified
    */
}

// Uncomment the following statement to use a certain trial data hiding technique
                // Use | to combine one or more trial hiding techniques
                // or don't use this property to use ALL techniques
MyActiveLock.TrialHideType = IActiveLock.ALTrialHideTypes.trialHiddenFolder | IActiveLock.ALTrialHideTypes.trialRegistry | IActiveLock.ALTrialHideTypes.trialSteganography;

MyActiveLock.SoftwareCode = modMain.Dec(modMain.PUB_KEY);

//MyActiveLock.LockType = IActiveLock.ALLockTypes.lockHDFirmware;

                strAutoRegisterKeyPath = modMain.AppPath() + "\\" + modMain.SOFTWARENAME + ".all";
                MyActiveLock.AutoRegister = IActiveLock.ALAutoRegisterTypes.alsEnableAutoRegistration;
MyActiveLock.AutoRegisterKeyPath = strAutoRegisterKeyPath;

if (File.Exists(strAutoRegisterKeyPath))
{
boolAutoRegisterKeyPath = true;
}

                MyActiveLock.CheckTimeServerForClockTampering = IActiveLock.ALTimeServerTypes.alsDontCheckTimeServer;   
                MyActiveLock.CheckSystemFilesForClockTampering = IActiveLock.ALSystemFilesTypes.alsDontCheckSystemFiles; 
                MyActiveLock.LicenseFileType = IActiveLock.ALLicenseFileTypes.alsLicenseFileEncrypted;

// Verify AL's authenticity
txtChecksum.Text = modMain.VerifyActiveLockNETdll();

// Initialize the keystore. We use a File keystore in this case.
MyActiveLock.KeyStoreType = IActiveLock.LicStoreType.alsFile;

// Path to the license file
strKeyStorePath = modMain.AppPath() + "\\" + modMain.SOFTWARENAME + ".lic";
System.Diagnostics.Debug.WriteLine("License path is " + strKeyStorePath);
MyActiveLock.KeyStorePath = strKeyStorePath;

// Obtain the EventNotifier so that we can receive notifications from AL.
ActiveLockEventSink = MyActiveLock.EventNotifier;

// Initialize AL
                // Important: If you're not going to put Alcrypto3NET.dll under
                // the system32 directory, you should pass the path of the exe
                // to the Init() method otherwise this call will fail
                // Putting Alcrypto3NET.dll under the system32 is a problem with ASP.NET apps
                // since Activelock3NET is shared between .NET apps.
                // Use the following with ASP.NET applications
                // MyActiveLock.Init(Application.StartupPath & "\bin");
                // Use the following with C# applications

MyActiveLock.Init(Application.StartupPath,ref strKeyStorePath);
if (File.Exists(strKeyStorePath) && boolAutoRegisterKeyPath == true && autoRegisterKey.Length>0)
{
// This means, an ALL file existed and was used to create a LIC file
                  // Init() method successfully registered the ALL file
                  // and returned the license key
                  // You can process that key here to see if there is any abuse, etc.
                  // ie. whether the key was used before, etc.
}
//set dummy test combo
cboSpeed.Text = cboSpeed.Items[2].ToString();

// Check registration status
MyActiveLock.Acquire(ref strMsg);
if (strMsg!=null && strMsg.Length>0) //There's a trial
{
A = strMsg.Split(new char[] {Convert.ToChar(13)});
txtRegStatus.Text = A[0];
txtUsedDays.Text = A[1].Replace("\n","");
SetFunctionalities(true);
frmSplash mfrmsplash = new frmSplash();
mfrmsplash.lblInfo.Text = "\r\n" + strMsg;
mfrmsplash.Visible = true;
mfrmsplash.Refresh();
Thread.Sleep(3000); //wait about 3 seconds
mfrmsplash.Close();
cmdKillTrial.Visible = true;
cmdResetTrial.Visible = true;
txtLicenseType.Text = "Free Trial";
this.Refresh();
return;
}
else
{
cmdKillTrial.Visible = false;
cmdResetTrial.Visible = false;
}
txtRegStatus.Text = "Registered";
txtUsedDays.Text = MyActiveLock.UsedDays.ToString();
txtExpiration.Text = MyActiveLock.ExpirationDate;
if (txtExpiration.Text.Length == 0)
{
txtExpiration.Text = "Permanent"; // App has a permanent license
}
txtUser.Text = MyActiveLock.RegisteredUser;
txtRegisteredLevel.Text = MyActiveLock.RegisteredLevel;
//Read the license file into a string to determine the license type
string strBuff;
strBuff = modMain.ReadFile(strKeyStorePath);
if (strBuff.IndexOf("LicenseType=3")>=0)
{
txtLicenseType.Text = "Time Limited";
}
else if (strBuff.IndexOf("LicenseType=1")>=0)
{
txtLicenseType.Text = "Periodic";
}
else if (strBuff.IndexOf("LicenseType=2")>=0)
{
txtLicenseType.Text = "Permanent";
}
SetFunctionalities(true);
return;
}
catch (Exception ex)
{
//not registered
SetFunctionalities(false);
if ((ex.Message.ToLower().IndexOf("no valid license")>=0) == false && noTrialThisTime == false)
{
MessageBox.Show(ex.Message, modMain.MSGBOXCAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
txtRegStatus.Text = ex.Message;
txtLicenseType.Text = "None";
if (strMsg!=null && strMsg.Length>0)
{
MessageBox.Show(strMsg, modMain.MSGBOXCAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
return;
}





Logged
ismail
Administrator
Hero Member
*****
Posts: 862


Administrator


View Profile Email
« Reply #1 on: March 09, 2010, 08:10:14 AM »

Activelock.NET v3.5 is not supported. Sorry.
Download the current version 3.6.0.5 and try again.
Logged

Ismail
Activelock Project Admin
totorufo
Newbie
*
Posts: 4


View Profile Email
« Reply #2 on: March 09, 2010, 10:04:51 AM »

Thanks, but I have the same error.

The strange thing is that the ".Lic" file has created well (Registration successful!) but then -> " No valid license."

i forgot something!!!

... One small question  Sad  can i take "Activelock3_6NET.dll" from "ALTestApp3.6 NET" and input in my project if i working with C# ?

If I can't, where can i take it?

Thank you very much.

Logged
ismail
Administrator
Hero Member
*****
Posts: 862


Administrator


View Profile Email
« Reply #3 on: March 09, 2010, 12:07:23 PM »

Yes you can. Just reference the new DLL.

Also test the VB2008 sample app to see if it displays the exact same behavior.
If it doesn't, then you did something wrong.
If it does, you've discovered a bug (not likely). Debug the DLL and tell me what's wrong.
Logged

Ismail
Activelock Project Admin
totorufo
Newbie
*
Posts: 4


View Profile Email
« Reply #4 on: March 09, 2010, 01:33:11 PM »

Not likely, The samples works very well Grin

So my problem continue  Angry

I can said what i'm doing, maybe ... i lost something:

 1. Create one Product in Activelock3.6 VB2008 Key Generator.
 2. Copy VCode and add product to products list
 3. Create project in .NET
 4. Copy Activelock3_6NET.dll to project "bin\Release\"
 5. Add Activelock3_6NET.dll to project Reference
 6. Add VCode to modMain
 7. Load Form:

Code:
private void frmMain_Load(object sender, System.EventArgs e)
{
            //ActiveLock Initialization
            string autoRegisterKey = null;
            bool boolAutoRegisterKeyPath = false;
            string[] A;

            string strMsg = null;
            string strRemainingTrialDays = null;
            string strRemainingTrialRuns = null;
            string strTrialLength = null;
            string strUsedDays = null;
            string strExpirationDate = null;
            string strRegisteredUser = null;
            string strRegisteredLevel = null;
            string strLicenseClass = null;
            string strMaxCount = null;
            string strLicenseFileType = null;
            string strLicenseType = null;

            try
            {
                Globals MyAL = new Globals();

                //wrong way
                MyActiveLock = MyAL.NewInstance();

                MyActiveLock.SoftwareName = modMain.SOFTWARENAME;
                txtName.Text = MyActiveLock.SoftwareName;

                // Note: Do not use (App.Major & "." & App.Minor & "." & App.Revision)
                // since the license will fail with version incremented exe builds
                MyActiveLock.SoftwareVersion = "1.0"; // WARNING *** WARNING *** DO NOT USE App.Major & "." & App.Minor & "." & App.Revision
                txtVersion.Text = MyActiveLock.SoftwareVersion;

                // This should be set to protect yourself against ResetTrial abuse
                MyActiveLock.SoftwarePassword = Convert.ToChar(99).ToString() + Convert.ToChar(111).ToString() + Convert.ToChar(111).ToString() + Convert.ToChar(108).ToString();

                MyActiveLock.LicenseKeyType = IActiveLock.ALLicenseKeyTypes.alsRSA;

                // Trial Feature
                MyActiveLock.TrialType = IActiveLock.ALTrialTypes.trialDays;
                MyActiveLock.TrialLength = 15;

                if (MyActiveLock.TrialType != IActiveLock.ALTrialTypes.trialNone & MyActiveLock.TrialLength == 0)
                {
                    /*
                    *  Do Nothing
                    *  In such cases Activelock automatically generates errors -11001100 or -11001101
                    *  to indicate that you're using the trial feature but, trial length was not specified
                    */
                }

                // Uncomment the following statement to use a certain trial data hiding technique
                // Use | to combine one or more trial hiding techniques
                // or don't use this property to use ALL techniques
                MyActiveLock.TrialHideType = IActiveLock.ALTrialHideTypes.trialHiddenFolder | IActiveLock.ALTrialHideTypes.trialRegistryPerUser | IActiveLock.ALTrialHideTypes.trialSteganography;

                MyActiveLock.TrialWarning = IActiveLock.ALTrialWarningTypes.trialWarningPersistent;



                // Paste VCode
                // Encode later
                // MyActiveLock.SoftwareCode = modMain.Dec(modMain.PUB_KEY);
                MyActiveLock.SoftwareCode = modMain.Dec(modMain.PUB_KEY);


                //MyActiveLock.LockType = IActiveLock.ALLockTypes.lockHDFirmware | IActiveLock.ALLockTypes.lockComp | IActiveLock.ALLockTypes.lockMotherboard;
                MyActiveLock.LockType = IActiveLock.ALLockTypes.lockNone;

                if (!Directory.Exists("c:\\temp"))
                {
                    Directory.CreateDirectory("c:\\temp");
                }

                strAutoRegisterKeyPath = "c:\\temp\\" + MyActiveLock.SoftwareName + MyActiveLock.SoftwareVersion + ".all";
                MyActiveLock.AutoRegisterKeyPath =  strAutoRegisterKeyPath;
               
                if (File.Exists(strAutoRegisterKeyPath))
                {
                    boolAutoRegisterKeyPath = true;
                }

                MyActiveLock.AutoRegister = IActiveLock.ALAutoRegisterTypes.alsEnableAutoRegistration;
                MyActiveLock.CheckTimeServerForClockTampering = IActiveLock.ALTimeServerTypes.alsDontCheckTimeServer;
                MyActiveLock.CheckSystemFilesForClockTampering = IActiveLock.ALSystemFilesTypes.alsDontCheckSystemFiles;   

                MyActiveLock.LicenseFileType = IActiveLock.ALLicenseFileTypes.alsLicenseFilePlain;

                // Verify AL's authenticity
                txtChecksum.Text = modMain.VerifyActiveLockNETdll();

                // Initialize the keystore. We use a File keystore in this case.
                MyActiveLock.KeyStoreType = IActiveLock.LicStoreType.alsFile;

                if(!Directory.Exists(modMain.AppPath() + "\\" + MyActiveLock.SoftwareName + "\\" + MyActiveLock.SoftwareVersion))
                {
                    Directory.CreateDirectory(modMain.AppPath() + "\\" + MyActiveLock.SoftwareName + "\\" + MyActiveLock.SoftwareVersion);
                }

                // Path to the license file
                strKeyStorePath = modMain.AppPath() + "\\" + MyActiveLock.SoftwareName + "\\" + MyActiveLock.SoftwareVersion + "\\" + MyActiveLock.SoftwareName + MyActiveLock.SoftwareVersion + ".lic";
                System.Diagnostics.Debug.WriteLine("License path is " + strKeyStorePath);
                MyActiveLock.KeyStorePath = strKeyStorePath;

                // Obtain the EventNotifier so that we can receive notifications from AL.
                ActiveLockEventSink = MyActiveLock.EventNotifier;

                // Initialize AL
                // Important: If you're not going to put Alcrypto3NET.dll under
                // the system32 directory, you should pass the path of the exe
                // to the Init() method otherwise this call will fail
                // Putting Alcrypto3NET.dll under the system32 is a problem with ASP.NET apps
                // since Activelock3NET is shared between .NET apps.
                // Use the following with ASP.NET applications
                // MyActiveLock.Init(Application.StartupPath & "\bin");
                // Use the following with C# applications

                MyActiveLock.Init(Application.StartupPath, ref strKeyStorePath);

                if (File.Exists(strKeyStorePath) && boolAutoRegisterKeyPath == true && autoRegisterKey.Length > 0)
                {
                    // This means, an ALL file existed and was used to create a LIC file
                    // Init() method successfully registered the ALL file
                    // and returned the license key
                    // You can process that key here to see if there is any abuse, etc.
                    // ie. whether the key was used before, etc.
                }

                // Check registration status
                MyActiveLock.Acquire(ref strMsg, ref strRemainingTrialDays, ref strRemainingTrialRuns, ref strTrialLength, ref strUsedDays, ref strExpirationDate, ref strRegisteredUser, ref strRegisteredLevel, ref strLicenseClass, ref strMaxCount, ref strLicenseFileType, ref strLicenseType);
                if (strMsg != null && strMsg.Length > 0) //There's a trial
                {
                    A = strMsg.Split(new char[] { Convert.ToChar(13) });
                    txtRegStatus.Text = A[0];
                    txtUsedDays.Text = A[1].Replace("\n", "");
                    frmSplash mfrmsplash = new frmSplash();
                    mfrmsplash.lblInfo.Text = "\r\n" + strMsg;
                    mfrmsplash.Visible = true;
                    mfrmsplash.Refresh();
                    Thread.Sleep(3000); //wait about 3 seconds
                    mfrmsplash.Close();
                    txtLicenseType.Text = "Free Trial";
                    this.Refresh();
                    return;
                }

                txtRegStatus.Text = "Registered";
                txtUsedDays.Text = MyActiveLock.UsedDays.ToString();
                txtExpiration.Text = MyActiveLock.ExpirationDate;
                if (txtExpiration.Text.Length == 0)
                {
                    txtExpiration.Text = "Permanent"; // App has a permanent license
                }
                txtUser.Text = MyActiveLock.RegisteredUser;
                txtRegisteredLevel.Text = MyActiveLock.RegisteredLevel;
                //Read the license file into a string to determine the license type
                string strBuff;
                strBuff = modMain.ReadFile(strKeyStorePath);
                if (strBuff.IndexOf("LicenseType=3") >= 0)
                {
                    txtLicenseType.Text = "Time Limited";
                }
                else if (strBuff.IndexOf("LicenseType=1") >= 0)
                {
                    txtLicenseType.Text = "Periodic";
                }
                else if (strBuff.IndexOf("LicenseType=2") >= 0)
                {
                    txtLicenseType.Text = "Permanent";
                }
                return;
            }
            catch (Exception ex)
            {
                //not registered
                m_bRegistered = false;

                if ((ex.Message.ToLower().IndexOf("no valid license") >= 0) == false && noTrialThisTime == false)
                {
                    MessageBox.Show(ex.Message, modMain.MSGBOXCAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                txtRegStatus.Text = ex.Message;
                txtLicenseType.Text = "None";
                if (strMsg != null && strMsg.Length > 0)
                {
                    MessageBox.Show(strMsg, modMain.MSGBOXCAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            return;
}

    8.Register Buttom:

Code:
private void cmdRegister_Click(object sender, System.EventArgs e)
{
//Register this key
try
{
string userStr = txtUser.Text;
                string LibKey = txtLibKeyIn.Text;

                MyActiveLock.Register(LibKey, ref userStr);

MessageBox.Show(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"), modMain.MSGBOXCAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmMain_Load(this, new System.EventArgs());

                // If the Register is OK start with Template_Editor
                //Load_Template_Editor();
}
catch (SystemException ex)
{
MessageBox.Show(ex.Message + ": " + ex.StackTrace, modMain.MSGBOXCAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}


Thanks for your time.

Logged
ismail
Administrator
Hero Member
*****
Posts: 862


Administrator


View Profile Email
« Reply #5 on: March 09, 2010, 01:37:56 PM »

You're most likely missing some properties. You must set all properties.
LIC file path is for example very important.

Look at the VB2008 sample app, Form_Load event. Set all the properties you see there exactly the same way but with your own data.
Logged

Ismail
Activelock Project Admin
totorufo
Newbie
*
Posts: 4


View Profile Email
« Reply #6 on: March 10, 2010, 10:57:46 AM »

Thanks!

Now it's OK!

I'm not sure what is the error Cry           (I have made many changes to work with C#)

Sorry.
Logged
ismail
Administrator
Hero Member
*****
Posts: 862


Administrator


View Profile Email
« Reply #7 on: March 10, 2010, 11:03:56 AM »

We also have a C# sample in the downloads area.
Didn't you try that one?
Logged

Ismail
Activelock Project Admin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!