one time use software

Hello I am a bit of a newb when it comes to coding but I am trying to set up a system to allow a piece of software to be used one time

Basically what I need is for when someone buys a Product Key through Paypal (using the example script in the webapi) the key will automatically revoked itself in 24 hours AFTER it has been activated.

I appreciate any help you can offer

This is possible with LimeLM, but it's an odd thing to do. You can accomplish it in part by using custom license features.

Is there any reason you want to do this? Can you clarify why you want to do this, and maybe I'll be able to give you better help. Why can't a user buy your software and use it for as long as they want?

I owner a Computer Repair business and over te years have developed an automated program to automate the repair/cleanup of a computers. I am looking to sell the program as a alternative to a tech visit so I would only want it to be used once as the software would be at dramatically cheaper prices then a tech visit while taking care of most of your problems. I will also be setting it up so that if the program doesn't fix your issue the money toward that key will go towards a tech visit.

Ok, the way you'd do this (have an app that expires in 24 hours) is to create a license feature like "expires_on", then when you generate a product key for a customer, set it to 1 day after the person orders your software.

Then, in your app, use the GetFeatureValue("expires_on") to read the feature value (after the user has activated) and use IsDateValid() to verify the "expires_on" value hasn't expired. If it has, don't let the user use your app.

Tell me if that helps.

Sam thank you this was extremely helpful.

I have run into two problems, right now the program is a very elaborate .bat file converted into .exe (I am working on converting it into VB.net but am not a programer by trade and barely know how to get by lol) because of this I am calling turbo activate from inno setup. my first problem is after uninstalling the product and the key being deactivated by the uninstaller the computer still thinks it is activated bypassing the the pkey page even if I revoke or delete the key. this brings me to my second problem I want setup to run IsGenuine() first but it does not seem to be checking it as it keeps bypassing the pkey page. Below is my Inno Setup Script

#define MyAppName "Pistone Computer LLC"#define MyAppVersion "0.3.1"#define MyAppPublisher "Pistone Computer LLC"#define MyAppURL "http://www.PistoneComputers.com/Repairs"#define MyAppExeName "ComputerRepair.exe"

[Setup]; NOTE: The value of AppId uniquely identifies this application.; Do not use the same AppId value in installers for other applications.; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)AppId={{13DC3E52-0888-4732-A8A1-FC55E87D9AE9}AppName={#MyAppName}AppVersion={#MyAppVersion};AppVerName={#MyAppName} {#MyAppVersion}AppPublisher={#MyAppPublisher}AppPublisherURL={#MyAppURL}AppSupportURL={#MyAppURL}AppUpdatesURL={#MyAppURL}DefaultDirName={pf}\{#MyAppName}DefaultGroupName={#MyAppName}DisableProgramGroupPage=yesOutputDir=C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\InstallerOutputBaseFilename=setupSetupIconFile=C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\ComputerRepair.icoCompression=lzmaSolidCompression=yesPrivilegesRequired=adminAlwaysRestart=yesLicenseFile=C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\EULA.txt

[Icons] Name: "{commonstartup}\Computer Repair Unistall"; Filename: "{uninstallexe}"

[Files]; Install TurboActivate to {app} so we can access it at uninstall time; Also, notice we're putting the TurboActivate files at the top of the file; list. This is so that if you're using "SolidCompression=yes" your installer; can still start relatively quickly.Source: "C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\TurboActivate.dll"; DestDir: "{app}"; Flags: ignoreversionSource: "C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\TurboActivate.dat"; DestDir: "{app}"; Flags: ignoreversion

;TODO: add your files that you'll be installing Source: "C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\ComputerRepair.exe"; DestDir: "{app}"; Flags: ignoreversionSource: "C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\EULA.txt"; DestDir: "{app}"; Flags: ignoreversionSource: "C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\ComputerRepair.ico"; DestDir: "{app}"; Flags: ignoreversionSource: "C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\WizApp.exe"; DestDir: "{app}"; Flags: ignoreversionSource: "C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\images\*"; DestDir: "{app}\images"; Flags: ignoreversion recursesubdirs createallsubdirsSource: "C:\Users\bpistone\Desktop\Remote Repair Script\0.3.1\Files\reg\*"; DestDir: "{app}\reg"; Flags: ignoreversion recursesubdirs createallsubdirs

//TODO: go to the version page in your LimeLM account and paste this GUID hereconst  VERSION_GUID = '191736692850459de55065e0.22107638';


// functions for activationfunction IsGenuine(versionGUID: WideString): longint; external 'IsGenuine@files:TurboActivate.dll,TurboActivate.dat cdecl setuponly';


function IsActivated(versionGUID: WideString): longint;external 'IsActivated@files:TurboActivate.dll,TurboActivate.dat cdecl setuponly';


function CheckAndSavePKey(productKey: WideString; flags: UINT): longint;external 'CheckAndSavePKey@files:TurboActivate.dll,TurboActivate.dat cdecl setuponly';


function Activate(): longint;external 'Activate@files:TurboActivate.dll,TurboActivate.dat cdecl setuponly';




// functions for the uninstallerfunction IsActivatedUninstall(versionGUID: WideString): longint;external 'IsActivated@{app}\TurboActivate.dll cdecl uninstallonly';


function Deactivate(erasePkey: boolean): longint;external 'Deactivate@{app}\TurboActivate.dll cdecl uninstallonly';




var  PkeyPage: TInputQueryWizardPage;  activated: Boolean;


procedure InitializeWizard;begin    // create the product key page    PkeyPage := CreateInputQueryPage(wpWelcome,        'Type your product key', '',        'You can find the {#SetupSetting("AppName")} product key in the email we sent you. Activation will register the product key to this computer.');    PkeyPage.Add('Product Key:', False);end;




function NextButtonClick(CurPage: Integer): Boolean;var  ret: LongInt;begin    if CurPage = wpWelcome then begin


        // after the welcome page, check if we're activated        ret := IsActivated(VERSION_GUID);


        if ret = 0 then begin            activated := true;        end;        Result := True;    end else if CurPage = PkeyPage.ID then begin


        // check if the product key is valid        ret := CheckAndSavePKey(PkeyPage.Values[0], 1);        if ret = 0 then begin


            // try to activate, show a specific error if it fails            ret := Activate();


            case ret of              2: // TA_E_PKEY                MsgBox('The product key is invalid or there''s no product key.', mbError, MB_OK);              4: // TA_E_INET                MsgBox('Connection to the server failed.', mbError, MB_OK);              5: // TA_E_INUSE                MsgBox('The product key has already been activated with the maximum number of computers.', mbError, MB_OK);              6: // TA_E_REVOKED                MsgBox('The product key has been revoked.', mbError, MB_OK);              8: // TA_E_PDETS                MsgBox('The product details file "TurboActivate.dat" failed to load. It''s either missing or corrupt.', mbError, MB_OK);              11: // TA_E_COM                MsgBox('CoInitializeEx failed.', mbError, MB_OK);              13: // TA_E_EXPIRED                MsgBox('Failed because your system date and time settings are incorrect. Fix your date and time settings, restart your computer, and try to activate again.', mbError, MB_OK);              0: // successful              begin                activated := true;                Result := True                exit;              end else                MsgBox('Failed to activate.', mbError, MB_OK);            end;            Result := False        end else begin            MsgBox('You must enter a valid product key.', mbError, MB_OK);            Result := False;        end;    end else        Result := True;end;


function ShouldSkipPage(PageID: Integer): Boolean;begin    // skip the "Pkey" page if were already activated    if (PageID = PkeyPage.ID) and activated then        Result := True    else        Result := False;end;


procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);var  ret: LongInt;begin    // Call our function just before the actual uninstall process begins    if CurUninstallStep = usUninstall then begin


        // check if activated        ret := IsActivatedUninstall(VERSION_GUID);        // deactivate if activated        if ret = 0 then begin            ret := Deactivate(True);        end;


        // Now that we're finished with it, unload TurboActivate.dll from memory.        // We have to do this so that the uninstaller will be able to remove the DLL and the {app} directory.        UnloadDLL(ExpandConstant('{app}\TurboActivate.dll'));    end;end;




Please let me know if you have any suggestions as I can not move forward with making it work as one time use software until I fix this

The InnoSetup installer example was made for more traditional apps (ones that user can use for as long as they'd like).

You'd have to modify in the following ways:

  1. Force the users to activate before they can continue.
  2. Upon successful activation (or if they're already activated), call GetFeatureValue("expires_on")
  3. See if the "expires_on" date has already passed.
  4. If not, let the user run your bat file. If so, tell the user to buy an extension from you.

Does that make sense?

After looking over everything I realized I am going to have to change how I planned on doing this. Doing as described would work for a customer that purchases, downloads, and installs the software immediately. However it will not work for the software sold in store since I have to bulk create pkeys and include them in the packaging I have no idea when they will be used. I am starting to think the better way of handling this would be to somehow use the API to check and see which keys where activated 24 hours or more ago and revoke them if not already revoked. Is this even possible?

Also doing it with the API I would still need to force user to activate each time they install but when I remove the code to skip the pkey page if already activated it will not accept any pkeys and states they are all invalid

Well, they way to handle this is the first time a user enters the product key in your installer, have your installer call a script on your website. Then, this script on your website will take the product key, see if it has an "expires_on" value set, and if not set it to "current date + 1 day".

Use the limelm.pkey.setDetails function.

Does that make sense?

Yes it does. Thank you for all your help