-
How do i make my program work for 5 times and then Expire
How do i make my program work for 5 times and then Expire and will never work again ? In which i'll have to rebuild a new one using VB so that it will work for another 5 times more.The approach i used is as follows.
I created a text file with the name zxs.txt and set it as a counter for the program:
http://www.vbforums.com/
http://www.vbforums.com/
http://www.vbforums.com/
http://www.vbforums.com/
http://www.vbforums.com/
http://www.vbforums.com/
So now to make the program open i'll have to open that text file and set the value to zero. Now what im after is:
I want the program to run for 5 times, when it expires i want to manually create the zxs.txt file run the program so that the number of trials is back to zero."Then i run the program so that it resets the trial from the text file".Then safely i can delete the text file , moreover i want to make this step as a secret. Now what happens when i run the program without that file is:
http://www.vbforums.com/
Instead i want the program to run and make the zxs.txt a secret way to reset the program. If anyone how any idea how to do so please come forward. Any other suggestions are welcomed.
-
Re: How do i make my program work for 5 times and then Expire
I would use the registry, it's a more difficult place to find, but if you want to use a file, then you can simply change the txt files value back to 0?
Instead of deleting it, and re-creating it?
I don't quite get the problem?
Cheers
-
Re: How do i make my program work for 5 times and then Expire
Thanx. Let me rephrase what i said.
Situation: Program is working fine for 5 times then it expires. zxs.txt is a must for the program to run.
What i want:Program to work for 5 times and expires. zxs.txt is optional for the program to run.
So basically when the program runs for the first 5 trials i want it to run without the zxs.txt file. When the program expires. I want the only way to get it back to work is this:
create a file with the name zxs.txt.
set the value to 0.
run the program.
delete the zxs.txt file again.
I need this for a presentation im selling nothing. Generating ideas and this part particulary i'll include in my conclusion where i can show the examiners what i can do with the program i built so i dont need to do it in the registery.
-
Re: How do i make my program work for 5 times and then Expire
What would stop the user from changing the textfiles content back to 0?
-
Re: How do i make my program work for 5 times and then Expire
Quote:
Originally Posted by uaeXuae
Thanx. Let me rephrase what i said.
Situation: Program is working fine for 5 times then it expires. zxs.txt is a must for the program to run.
What i want:Program to work for 5 times and expires. zxs.txt is optional for the program to run.
So basically when the program runs for the first 5 trials i want it to run without the zxs.txt file. When the program expires. I want the only way to get it back to work is this:
create a file with the name zxs.txt.
set the value to 0.
run the program.
delete the zxs.txt file again.
I need this for a presentation im selling nothing. Generating ideas and this part particulary i'll include in my conclusion where i can show the examiners what i can do with the program i built so i dont need to do it in the registery.
zxs.txt is moreover like the only solution. If i give the exe file to someone and he runs it till it expires. He/She would never know how to get it work again (which leaves them with no choise but buying the software). So the user would not know what technique ive used to let the software expire which means he will not be able to create the correct textfile. Which explains he wont be able to set it back to zero.
-
Re: How do i make my program work for 5 times and then Expire
I see..
But you would still need to save the 'Trial count' somewhere...
So all that would do would create another file...
I think using the registry is good, hard to find, and if you mask the name of your file, you don't know what your touching..
Cheers
-
Re: How do i make my program work for 5 times and then Expire
how would i be able to do so may you guide me through the resigtery steps ?
-
Re: How do i make my program work for 5 times and then Expire
Registry is bad because values can still be changed and found easily. Plus there may be permissions issues during installation.
Registry keys can be exported and reimported or even shared.
Using a config file with encryption is the best solution as the user tampers with it and it will no longer checksum correctly and become invalid causing the rest of the trial runs to become invalidated. Create the key based upon the system hardware so it can not be transmitted to others/shared.
-
Re: How do i make my program work for 5 times and then Expire
Actually there is software for this:
http://www.infralution.com/licensing.html
Give it a good read, its a full licensing product for $90! Thats all. Dont just glance, have a full read of it and try the demo, your a smart one you will figure it out, enjoy!
-
Re: How do i make my program work for 5 times and then Expire
-
Re: How do i make my program work for 5 times and then Expire
Quote:
Originally Posted by CodedFire
Actually there is software for this:
http://www.infralution.com/licensing.html
Give it a good read, its a full licensing product for $90! Thats all. Dont just glance, have a full read of it and try the demo, your a smart one you will figure it out, enjoy!
Thanx Powerful TOOL :-). I dont want to use it cause its not free. I want to code it. So in the final presentation it will show the examing comunitee that i put some effort and its not a program that does it for me and O its a trial :-). Thanx again.
-
Re: How do i make my program work for 5 times and then Expire
Quote:
Originally Posted by toecutter
Quote:
Originally Posted by uniquegodwin
Heres my ugly commented neat proggy : Made it a function and easier to read and use
VB Code:
Dim filenumber As Integer 'This is a variable were delcaring to get in the value of freefile function.It assigns automatically the value which represents the file
Dim times_used As Integer = 1 'here,our program sets how many times used so far..were initializing it here
Dim max_limit As Integer = 5 'Set the maximum number of times he can use here..
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
demosoft()
End Sub
Private Sub demosoft()
filenumber = FreeFile() 'We assign the number which represents which file to open
If IO.File.Exists(Application.StartupPath & "\check.myext") Then 'Checking if file exists..
FileOpen(filenumber, Application.StartupPath & "\check.myext", OpenMode.Random, OpenAccess.ReadWrite) 'If exists,were opening it in readwrite mode.
FileGet(filenumber, times_used) 'Were reading from the file the value thats stored..ie the number of times he has used
MsgBox("You have executed this software " & (times_used) & " times") 'hmmm,were displaying it here..:)
FileClose(filenumber) 'Lets close the file now.
If times_used >= max_limit Then 'Were checking if the user has used the software more than the limit specified
MsgBox("Sorry,Your trial period is over!!Please purchase this software ;-) ") 'oops,if it has exceeded,then,he cant use it :p ;)
Application.Exit() 'Say Goodbye to the user..cos,he needs to purchase..We exit our app here.
End If
times_used = times_used + 1 'if he has used it once before,lets make it 2 now since this is the 2nd time
FileOpen(filenumber, Application.StartupPath & "\check.myext", OpenMode.Random, OpenAccess.ReadWrite) 'storing the value back here :)
FilePut(filenumber, times_used)
Else
'This part is if the user is using the software for the 1st time.The file has to be created
FileOpen(filenumber, Application.StartupPath & "\check.myext", OpenMode.Random, OpenAccess.ReadWrite)
FilePut(filenumber, times_used) 'ok,now he has opened and used once,so,lets write it in here.
End If
End Sub
Thanx this is similar to my code. Whats the diff here ?
-
Re: How do i make my program work for 5 times and then Expire
I remember correctly Martin Liss has a link in his signature for this. Its written in VB6 but shouldnt be too difficult to convert to .NET?
-
Re: How do i make my program work for 5 times and then Expire
-
Re: How do i make my program work for 5 times and then Expire
A member on the forum. Do a search.
-
Re: How do i make my program work for 5 times and then Expire
wouldnt it be easier to do a time trial instead.
perhapse time the exe was created-current date = some test
just an idea
you can also encrypt and decrypt files but i havnet ever tried it so im not sure how you would go about that.
-
Re: How do i make my program work for 5 times and then Expire
you could always obsfuticate the count in the text file with a couple of xor's, so xor it with say 65 then xor that result with some other number say 88, then when you read the file xor the number there with 88 then 65 and it will return the needed value. the code is kept in the proggy and unless someone has time to figure it out with a calculator will probably not know how to put it back to 1 :)
-
Re: How do i make my program work for 5 times and then Expire
Quote:
Originally Posted by DirtyHowi
you could always obsfuticate the count in the text file with a couple of xor's, so xor it with say 65 then xor that result with some other number say 88, then when you read the file xor the number there with 88 then 65 and it will return the needed value. the code is kept in the proggy and unless someone has time to figure it out with a calculator will probably not know how to put it back to 1 :)
Good one there.
-
Re: How do i make my program work for 5 times and then Expire
Xoring by 65 and then 88 is the same as Xoring by 25
-
Re: How do i make my program work for 5 times and then Expire
I might have a simple idea : compress zxs and put a password to it.
BTW i'd like to do the same thing to my program but i don't know how to make it count the days with a .txt file, may i ask how you did this? (Send me an e-mail at [email protected] with explanation/code plz)
-
Re: How do i make my program work for 5 times and then Expire
Quote:
Originally Posted by GlueyMcGee
I might have a simple idea : compress zxs and put a password to it.
BTW i'd like to do the same thing to my program but i don't know how to make it count the days with a .txt file, may i ask how you did this? (Send me an e-mail at
[email protected] with explanation/code plz)
Sure man heres my code:
Code:
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Dim SR As New StreamReader(Application.StartupPath & "\zxs.txt")
Dim s As Integer = CInt(SR.ReadLine)
s += 1
If s <= 5 Then
MsgBox("This is Try #" & s & " of 5.", MsgBoxStyle.Information)
SR.Dispose()
Dim SW As New StreamWriter(Application.StartupPath & "\zxs.txt", False)
SW.WriteLine(s)
SW.Close()
SW.Dispose()
Else
MsgBox("Your trial has expired!", MsgBoxStyle.Exclamation)
Application.Exit()
End If
End Sub
End Class
Just make sure you create the zxs.txt file in the debug folder so the program can read from it. GreEtz.
-
Re: How do i make my program work for 5 times and then Expire
-
Re: How do i make my program work for 5 times and then Expire
OK take an easy situation, assuming you may/maynot have used some sort of encryption.
How do you stop a person from doing this thing:
1. I install your appliacation.
2. Copy your zxs.txt to some other location on my computer (say desktop).
3. Run your application 4/5 times or maybe until it expires.
4. Replace your zxs.txt with the original copy (saved on desktop).
5. Run your application again.
6. Repeat this for ever :)
Pradeep :)
-
Re: How do i make my program work for 5 times and then Expire
There is no secure way to do this but I highly suggest not putting your text file in the same execution path as the application. If you do so and install under Vista, it will not work. It will also not work on 2000, XP, 2003 or 2008 depending on the security settings of the OS.
As for a good way of doing this? I would say creating an application that launches your standard application. This "launcher" would pass data to the application telling it if it can launch or not (perhaps a salted hash with partial time?). Once the launcher determines that the trial has expired, it replaces' the executable with a permenantly locked-in-expired-trial version of it so once it expires, someone can't just change a value and fix it.
Again, all of these options have tradeoffs and someone can easily use a profiler and figure out what text file your application modifies on launch.
-
Re: How do i make my program work for 5 times and then Expire
Quote:
Originally Posted by Pradeep1210
OK take an easy situation, assuming you may/maynot have used some sort of encryption.
How do you stop a person from doing this thing:
1. I install your appliacation.
2. Copy your zxs.txt to some other location on my computer (say desktop).
3. Run your application 4/5 times or maybe until it expires.
4. Replace your zxs.txt with the original copy (saved on desktop).
5. Run your application again.
6. Repeat this for ever :)
Pradeep :)
there are also a bunch of programs out there that reset your computer date to the same date to launch a program and then set it back.
-
Re: How do i make my program work for 5 times and then Expire
Quote:
Originally Posted by Pradeep1210
OK take an easy situation, assuming you may/maynot have used some sort of encryption.
How do you stop a person from doing this thing:
1. I install your appliacation.
2. Copy your zxs.txt to some other location on my computer (say desktop).
3. Run your application 4/5 times or maybe until it expires.
4. Replace your zxs.txt with the original copy (saved on desktop).
5. Run your application again.
6. Repeat this for ever :)
Pradeep :)
nothing stops you from doing that now
I have shareware that is made by a company that is not longer in existence. I have a virtual machine devoted entirely to going back to a snapshot after i reach my limit. Ive been keeping that up for almost 2 years now
the only way to make this pretty much bullet proof is that your program would take some sort of metric and call home and register the computer each time and after the 5th time it wouldn't get a response back from the server.
the problem with that is the added complexity and if something goes wrong then the user will blame you ( ie if there internet is down or if your server blows up)
I still like the idea of a time limited trial ( ie 3 weeks)
where when starting up the last good date would be put into a file and encrypted as part of the install process.
that way even if they reproduce the file it will only recreate the deadline.
-
Re: How do i make my program work for 5 times and then Expire
Also remember... not all computers are on the internet or can even get to the internet. A lot of companies restrict their employees to the corporate "intranet" with no means of going beyond without a privileged account.
-
Re: How do i make my program work for 5 times and then Expire
Actually there is no stopping a person when you give the same executable as the paid one to the end user. It is just a matter of how far you can think of restricting him and how far he can think of how he is being restricted.
What I do and suggest others to do is just create separate demo and paid version executables. The demo version should be limited by the functionality it provides. You may additionally add any of the trial expiration techniques to it.
In the demo replace some important forms with a nag screen saying "you should pay to use this feature.. blah.. blah.."
This way it would at-least make it tougher for them to use your program without paying you.
Pradeep :)
-
Re: How do i make my program work for 5 times and then Expire
Yup, use some precompiler conditionals:
#If DEMO Then
Msgbox("Buy the FULL version now!")
#Else
...
...{complex functions goes here}
...
#End If
Basically, if the compiler flag "DEMO" is set, it only compiles the first chunk. In the final program, there's no trace of the "real" code. You can create your own compiler flags in the Advanced Compile options and you switch between them with the Build Configuration Manager. Basically, you're making a "Demo-Release" and "Demo-Debug" build that are exactly like your "Release" and "Debug" build, except they have the "DEMO" flag on.
-
Re: How do i make my program work for 5 times and then Expire
you could use debug and release modes if you wanted to make life easy
i always use this code at form load (its in c#)
but you could use this to enable a bool that would disable some subrutines and just display a message that the feature is not aviable and to buy the real deal
#if (DEBUG)
// debug mode
this.Text = this.Text + " debug-" + this.ProductVersion;
#else
// Release mode
this.Text = this.Text + " " + this.ProductVersion;
#endif
-
Re: How do i make my program work for 5 times and then Expire
I found an Application Trial Maker about how to create the trial application. This article supplies serial maker dll for the application. I got the source code about how to use it. It is a C# example. Is there any software for converting the code to get VB.Net code?
-
Re: How do i make my program work for 5 times and then Expire
Post some of it in VB forums and ask for a conversion, we might help..
Cheers
Icyculyr
-
Re: How do i make my program work for 5 times and then Expire
Sorry, this might sound a bit n00b-ish, but how about using My.Settings? The resx file that stores the settings is encrypted by default as far as I know and it would be far easier to manipulate from inside your app, but difficult from outside.
-
Re: How do i make my program work for 5 times and then Expire
One point made, was you could copy the file when you initially install the program, when it's set to "zero"
and then replace it when the trial runs out...
So you'd have the original code encryption when it was set to "0" for example, and you could replace it every time it says trial has run out.
Cheers
Icyculyr
-
Re: How do i make my program work for 5 times and then Expire
Using my code in post # 21.
Now for the trial version when i try change the value from "5" to "0" i am not able to overwrite the same file because it seems the application is still running. Although i used
For that Exit button. But seems its not completely quit running.
http://img293.imageshack.us/img293/1050/15459854eh0.jpg
http://img413.imageshack.us/img413/771/61588838an7.jpg
http://img187.imageshack.us/img187/170/70020822ur7.jpg
http://img169.imageshack.us/img169/8817/27824815yt4.jpg
After i end the process for my program using (Alt+Ctrl+Delete) I am able to modify the value in the text file. Any recommendations to workaround this issue ?
-
Re: How do i make my program work for 5 times and then Expire
Don't use a text file. Kasracer has suggested the best option but none are fool proof.
-
Re: How do i make my program work for 5 times and then Expire
When you use the textfile in your application you must close the handle to the file when you're done using it or you won't be able to overwrite it like you're trying to do.
It's impossible for us to tell why your application is hanging without more information (code, etc).
-
Re: How do i make my program work for 5 times and then Expire
at the very least, make the file hidden. Most people have explorer set so it doesn't show hidden files.
-
Re: How do i make my program work for 5 times and then Expire
Quote:
Originally Posted by uaeXuae
I found an
Application Trial Maker about how to create the trial application. This article supplies serial maker dll for the application. I got the source code about how to use it. It is a C# example. Is there any software for converting the code to get VB.Net code?
google c# to vb conversion, and have fun, cause there are like 1.7 million of them....all free too :)