Solved

Shareware

Posted on 2000-04-10
20
415 Views
Last Modified: 2010-05-02
Hi,
  I need to know how we can lock a pgm. for this one works only 30 days, to put it on Internet like shareware.

If there are more than one method i'like to know; else i'd like to have code because i have know idea how to do. I don't want, if the user change the date of his system the pgm. works.
0
Comment
Question by:dosyl
20 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2700475
look at www.bit-arts.com, product is softlocx, it can encapsulate existing executables or can be incorporated into VB.

There are many other similar products available, just look in www.davecentral.com or www.componentsource.com etc and look for protection
0
 

Expert Comment

by:Petertje
ID: 2700673
Just a couple of ideas:

Save the last date your program is run, so if somebody changes the system date to the past you will know.

Save the date of installation, so if somebody installs the program in the future you will know.

May be you can find a system file to check the last date it changed or the last date it was accessed.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2700698
Hello dosyl,

there are no ways to protect your software absolete, anyway one can format his HDD and reinstall system as fresh.
Previous answers acceptable, the only comment: you can save any parameters to registry usinng SaveSetting function (read with GetSetting), this way is easiest to crack for one who knows what is registry is. But, if one knows what is registry he will crack other protections also :))
So my suggestion - use registry, you will protect most part of your software.

Sincerely,

Crin
0
 
LVL 1

Author Comment

by:dosyl
ID: 2700736
Hi Crin
 With your suggestion(Using SaveSetting is there a way to put a code to unlock the pgm.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2701215
Hello dosyl

Yes, of course :)

Example:

You need a function that will take user name and return unique (or just large) number as password, otherwise pgm will lock after 30 days:

Easiest password generating function: just summarize symbols codes of username. (Let's name it MyFunction now)


Algorythm to lock/unlock pgm.


If MyFunction(GetSetting("MyPGM","Properties","UserName","Crin")) <> CLng(GetSetting("MyPGM","Properties","PasswordEntered","0")) then
  'check last start date (I recomend to save it as long, some countries have dd/mm/yyyy date format, some mm/dd/yyyy)
  if CLng(GetSetting("MyPGM","Properties","LastStart",Now))>CLng(Now) then
     msgbox "PIRACY!!!"
     end
  'now check 30 days
  elseif CLng(Now) - CLng(GetSetting("MyPGM","Properties","FirstStart",Now))>30 then
     msgbox "Expired"
     end
  else
    'check if it is the first time programm runs - then save current date
    if CLng(GetSetting("MyPGM","Properties","FirstStart",0))=0 then
     savesetting "MyPGM","Properties","FirstStart", CLng(Now)
    end if
    'now write LastStart setting
    savesetting "MyPGM","Properties","LastStart", CLng(Now)
   
  end if
end if





0
 
LVL 4

Expert Comment

by:dreamvb
ID: 2702126
Ok i don't now if this will work for you but any way have a go
 place a leble1 on a form and paste in the code below in the form_load
 Change the key.txt to something else so now one can see it


Dim Key As String
Dim fileNum As Integer
fileNum = FreeFile
x = Dir("C:\key.txt")
 If x = "" Then
 Open "C:\key.txt" For Output As #1
 Print #1, "30";
 Close #1
 MsgBox "You have 30 days to try out this program before it ends"
End If

Open "C:\key.txt" For Input As #fileNum
Key = Input(LOF(fileNum), fileNum)
Close #fileNum
Open "C:\key.txt" For Output As #2
Key = Key - 1
Print #2, Key
 If Key = 3 Then
 MsgBox "You are comming to the end of your tiral verision", vbInformation: End
 ElseIf Text1 < 1 Then
 MsgBox "You will now need to Register this program now", vbInformation
 End
 End If
 
Close 2#
Label1.Caption = "you have" & " " & Key & " " & "days left"
0
 
LVL 2

Expert Comment

by:Crin
ID: 2702200
dreamvb...
c:\key.txt is very simple to crack...
just open it and type the number of days you want... Also you have no way to be sure some directory exists on users HDD (except using registry :) so placing key.txt (or other way named) file to other directory will not help...

Hand working with registry is not usual task for most of users, so for lite commercial (or just regitrable) software registry way is some better...

More than it, registry will be kept until Windows re-installed so if one try to install demo after 30 days expired - it wil be denied...

Sincerely yours,

Crin
0
 
LVL 1

Author Comment

by:dosyl
ID: 2702281
Hi guys,
I search on internet and i find one on:
http://www.activelock.com/.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2702352
By the way, this OCX do EXACT what I supposed :)))
Cracked within 1 minute :)))
run Regedit and go to section HKEY_CURRENT_USER\Software\VB and VBA Program Settings\KeyGenerator\LastSettings

Just type new values and enjoy any programm, protected with ActiveLock :)) The only distinguish is that you will include OCX (100 Kb), one extra procedure will take about 1K.

Sincerely yours,

Crin
0
 
LVL 1

Author Comment

by:dosyl
ID: 2702378
Crin, maybe you have reason, i'm not an expert in this, it is for that i ask how to do. Now i don't know if i must buy a software without know if it is good, or put code in my pgm.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 2

Expert Comment

by:Crin
ID: 2702418
dosyl,

Ok, following WILL NOT fluent on your computer:
start sample activelock application
press Start->Run
Type "regedit" and press Ok
go to through treeview to the section HKEY_CURRENT_USER\Software\VB and VBA Program Settings\KeyGenerator\LastSettings

It is absolete open...

The only thing that will vary in my code: \KeyGenerator\LastSettings will be replaced with \MyPGM\Properties
that's all :)
Don't waste your money and time :))

Sincerely yours,

Crin


0
 
LVL 1

Author Comment

by:dosyl
ID: 2702501
In ActiveLock there is a LiberationKey in your code i didn't see one, is it a difference?
0
 
LVL 2

Expert Comment

by:Crin
ID: 2705629
Hello,
Ok, previous example was CHECKER example, now let's modify it for ASK functionality.

just add checking
if GetSetting("MyPGM","Properties","PasswordEntered","0") = "0" then
  SaveSetting "MyPGM","Properties","PasswordEntered", inputbox("Please enter password")
end if

also you can add this lines at the "Expired" section.

Sincerely yours,

Crin

PS. Please inform me if you REALLY need full code - example writting is not hard, but takes time :))))

0
 
LVL 1

Author Comment

by:dosyl
ID: 2708946
Crin i'd like to have full code, but what i give to you in return.
In passing, where i can find how to work with registry?
0
 
LVL 2

Expert Comment

by:Crin
ID: 2708996
Ok, then please describe (as detailed as possible please, also please don't forget english is not my language) how do you want your software check, register and message user about any variants.

It will be two-three-four (depends on your requirements) functions that you will need to place to your code and call in needed places.

Think 300 - 400 points will be ok, as soon as I'm new in EE and interested in earning points :)))))

The only thing you must know about registry: this is Windows system "black box" that keeps information and can transfer it between applications. For example when you click on the any document file - system looks what extention it has, looks to registry - what must be loaded to show this file.

Registry is a tree structure.

You also can store (and manage) some data in registry. You can get data from registry, save data to registry and delete data.

There is one 'special' leaf in registry for VB Application - every VB created software will store settings there (see previous message)

Sincerely yours,

Crin
0
 
LVL 1

Author Comment

by:dosyl
ID: 2709391
I don't know if it is what you want.
I need to check: if the user is register, the last run date, and the number of days uesed.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2709454
Ok. Sorry here is 3 AM, it's time to sleep :))
will write very soon.

It will be one function that you will need to insert in the very beginning of your code and check if this function returns true.

Also I'll send you little application that will generate registration codes using users names, so if one want to register your software, he send his username you type it and receive password - then you send it to costumer. Is this right?

Please leave comment to keep me informed.

Sincerely yours,

Crin
0
 
LVL 1

Author Comment

by:dosyl
ID: 2709818
What i want it is like ActiveLock if i can put it in my pgm.
0
 
LVL 2

Accepted Solution

by:
Crin earned 200 total points
ID: 2712641
Hello,

Add a form to your project and name it frmRegister, add two TextBoxes and two Command buttons to it and paste following code to form's code module:

---------------
Option Explicit

Public AllowWork As Boolean
Public Days As Single

'user name case sensitive

Const PasswordLen = 20
Const ExpPeriod = 30


Private Sub Command1_Click()
'check
If UCase(PWDGenerator(Me.Text1.Text)) = UCase(Me.Text2.Text) Then
  AllowWork = True
  SaveSetting "CRLCK", "Prop", "User", Me.Text1.Text
  SaveSetting "CRLCK", "Prop", "PWD", Me.Text2.Text
  Me.Hide
Else
  MsgBox "Wrong password", vbCritical
  AllowWork = False
End If
End Sub

Private Sub Command2_Click()
'user canceled
AllowWork = False
Me.Hide
End Sub

Private Sub Form_Load()
Dim CurDate As Long, CurTime As Long
Dim RegLastDate As Long, RegLastTime As Long
Dim PWD As String, UserName As String


CurDate = CLng(Now)
CurTime = CLng(1000000 / CSng(Time))

RegLastDate = CLng(GetSetting("CRLCK", "Prop", "DLS", "0"))
RegLastTime = CLng(GetSetting("CRLCK", "Prop", "TLS", "0"))

UserName = GetSetting("CRLCK", "Prop", "User", "")
PWD = GetSetting("CRLCK", "Prop", "PWD", "")


If UCase(PWDGenerator(UserName)) = UCase(PWD) Then
  'password is correct
  AllowWork = True
Else
  'check if there was FIRST start
  If CLng(GetSetting("CRLCK", "Prop", "DFS", "0")) = 0 Then
    'if no, save today as date
    SaveSetting "CRLCK", "Prop", "DFS", CLng(Now)
  End If
 
  'have one reset date? OR if there 30 days expired
  If RegLastDate > CurDate Or _
    (RegLastDate > CurDate And RegLastTime < CurTime) Or _
    CurDate - CLng(GetSetting("CRLCK", "Prop", "DFS", "0")) > ExpPeriod Then
    Me.Show vbModal
  Else
    'allow trial work and save current date and time
    SaveSetting "CRLCK", "Prop", "DLS", CStr(CurDate)
    SaveSetting "CRLCK", "Prop", "TLS", CStr(CurTime)
    AllowWork = True
  End If

End If
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
MsgBox UnloadMode
'prevent unload form while data is not processed
If UnloadMode = 0 Then
  Cancel = 1
End If
End Sub


Private Function PWDGenerator(UserName As String) As String
'this function will take username and return key.
Dim i As Long, Res As String, V1 As Integer, V2 As Integer

Res = ""

For i = 1 To Len(UserName) - 1
  Res = Res & Trim(CStr(Asc(Mid(UserName, i, 1)) Xor Asc(Mid(UserName, i + 1, 1)) Or 128 Xor 85 Xor (Len(Res) * 2)))
Next i

While Len(Res) < PasswordLen
  Res = Res & Trim(CStr(((Len(Res) Mod 10) Xor 5)))
Wend

While Len(Res) > PasswordLen
  i = i + 1
  If i > PasswordLen Then i = 1
  Mid(Res, i, 1) = (Val(Mid(Res, i, 1)) + Val(Mid(Res, PasswordLen + i, 1))) Mod 10
  Res = Left(Res, Len(Res) - 1)
Wend

PWDGenerator = Res

End Function

---------------

select 'Sub main' as startup in 'Project properties', here your sub main:


---------------
Public Sub main()
Load frmRegistrator
If frmRegistrator.AllowWork Then
  'place your code here
  MsgBox "this works!"
End If
Unload frmRegistrator
End Sub

---------------


to generate passwords just create new project, add frmRegister to it, set ExpPeriod to -1 and add code to frmRegister:

---------------
Private Sub Text1_Change()
Me.Text2.Text = PWDGenerator(Me.Text1.Text)
End Sub
---------------

Checked, works as you want, could be cracked by registry keys deletion only.


Sincerely yours,

Crin


0
 
LVL 1

Author Comment

by:dosyl
ID: 2714217
Crin do you want write to me, i have some questions for you.
dosyl@sympatico.ca
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now