What error are you getting with what function?
Also, it’s better to just integrate TA in your app and skip the installer.
I have been playing with TurboActivate to try to get my app protected via an installer. I know I must be missing something! My .exe installs correctly, but not getting any of the LimeLM or TA protection to show. Using Inno Setup as I was having issues with NSIS. (BTW. I Got NSIS to pull up the TA protection, but never got a code to properly validate.) So if some kind soul is willing to look at my files and point out what I did wrong, it would be very appreciated. I am including the .iss and .nsi in case one solution is easier than the other. BTW - yes I double checked that I put the GUID code in the files.
.nsi
;Basic TurboActivate Example Script
;--------------------------------
;Include Modern UI, Logic Library,
!include "MUI2.nsh"
!include LogicLib.nsh
!include nsDialogs.nsh
!include WinVer.nsh
!define MUI_ICON "C:\Users\tonic\Documents\lucky_pucks.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "C:\Users\tonic\Documents\lucky_pucks.bmp"
!define MUI_HEADERIMAGE_RIGHT
; TODO: paste your version GUID here
!define VersionGUID 'yqhnx4ltxrb36a73zzrqlqrso2yxipy'
; Comment out the next 1 or 2 lines
; if you don't want to require the user enter
; their product key or activate before they can
; install your app.
!define REQUIRE_ACT
!define REQUIRE_PKEY
;--------------------------------
;General
;Name and file
Name "Lucky Pucks"
OutFile "Lucky Pucks.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\LuckyPucks"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\LuckyPucks" ""
;Request application privileges for Windows Vista+
RequestExecutionLevel admin
; best compression
SetCompressor /SOLID lzma
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
Page custom PagePKey PagePKeyLeave
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
; "Reserve" TurboActivate (thus put them at the top of the compressed block)
; This speeds up installer.
ReserveFile "TurboActivate.dll"
ReserveFile "TurboActivate.dat"
Function .onInit
; TurboActivate requires at least Windows XP
${IfNot} ${AtLeastWinXP}
MessageBox MB_OK "Windows XP (or newer) is required to run $(^NameDA)."
Quit
${EndIf}
; create the plugins folder
InitPluginsDir
; extract the TurboActivate files to the plugns folder
File /oname=$PLUGINSDIR\TurboActivate.dll "TurboActivate.dll"
File /oname=$PLUGINSDIR\TurboActivate.dat "TurboActivate.dat"
FunctionEnd
;--------------------------------
;Installer Sections
Section "Lucky Pucks" SecDummy
SetOutPath "$INSTDIR"
File "TurboActivate.dll"
File "TurboActivate.dat"
File /r "C:\Users\tonic\Desktop\Turbo Activate\API\Installers\*"
;ADD YOUR OWN FILES HERE...
;Store installation folder
WriteRegStr HKCU "Software\LuckyPucks" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "Lucky Pucks Game"
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
; Product key page
Var txtPKey
Function PagePKey
; TurboActivate is in the plugins directory.
; Setting the output path ensures we can call it.
SetOutPath $PLUGINSDIR
; Check if we're activated
System::Call "TurboActivate::IsActivated(w'${VersionGUID}') i.r2 ? c"
; Skip this page if we're already activated
${If} $2 == 0
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "Type your product key" ""
nsDialogs::Create 1018
Pop $0
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 30 "You can find the $(^NameDA) product key in the email we sent you. Activation will register the product key to this computer."
Pop $0
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 50 100% 20 "Product Key:"
Pop $0
nsDialogs::CreateControl EDIT ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${ES_AUTOHSCROLL}|${WS_TABSTOP} ${WS_EX_CLIENTEDGE} 0 75 100% 12u ""
Pop $txtPKey
; focus the product key box
SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $txtPKey 1
nsDialogs::Show
FunctionEnd
Function PagePKeyLeave
; TurboActivate is in the plugins directory.
; Setting the output path ensures we can call it.
SetOutPath $PLUGINSDIR
; get the product key in WCHAR * form, put on $0
System::Call user32::GetWindowTextW(i$txtPKey,w.r0,i${NSIS_MAX_STRLEN})
; check if the product key is valid
System::Call "TurboActivate::CheckAndSavePKey(wr0, i1) i.r2 ? c"
; require the product key if we're requiring the activation
!ifdef REQUIRE_ACT
!ifndef REQUIRE_PKEY
!define REQUIRE_PKEY
!endif
!endif
${If} $2 == 0
; try to activate, show a specific error if it fails
System::Call "TurboActivate::Activate() i.r2 ? c"
!ifdef REQUIRE_ACT
${Switch} $2
${Case} 0 ; successful
Goto actSuccess
${Case} 2 ; TA_E_PKEY
MessageBox MB_OK|MB_ICONSTOP "The product key is invalid or there's no product key."
${Break}
${Case} 4 ; TA_E_INET
MessageBox MB_OK|MB_ICONSTOP "Connection to the server failed."
${Break}
${Case} 5 ; TA_E_INUSE
MessageBox MB_OK|MB_ICONSTOP "The product key has already been activated with the maximum number of computers."
${Break}
${Case} 6 ; TA_E_REVOKED
MessageBox MB_OK|MB_ICONSTOP "The product key has been revoked."
${Break}
${Case} 8 ; TA_E_PDETS
MessageBox MB_OK|MB_ICONSTOP "The product details file 'TurboActivate.dat' failed to load. It's either missing or corrupt."
${Break}
${Case} 11 ; TA_E_COM
MessageBox MB_OK|MB_ICONSTOP "CoInitializeEx failed."
${Break}
${Case} 13 ; TA_E_EXPIRED
MessageBox MB_OK|MB_ICONSTOP "Failed because your system date and time settings are incorrect. Fix your date and time settings, restart your computer, and try to activate again."
${Break}
${Case} 17 ; TA_E_IN_VM
MessageBox MB_OK|MB_ICONSTOP "Failed to activate because this instance of your program if running inside a virtual machine or hypervisor."
${Break}
${Case} 20 ; TA_E_KEY_FOR_TURBOFLOAT
MessageBox MB_OK|MB_ICONSTOP "The product key used is for TurboFloat, not TurboActivate."
${Break}
${Default}
MessageBox MB_OK|MB_ICONSTOP "Failed to activate."
${Break}
${EndSwitch}
!endif
${Else}
!ifdef REQUIRE_PKEY
MessageBox MB_OK|MB_ICONSTOP "You must enter a valid product key."
; focus the product key box
SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $txtPKey 1
Abort
!endif
${EndIf}
actSuccess:
FunctionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
; Set the output path to the installation directory so we can call TurboActivate
SetOutPath $INSTDIR
; check if activated
System::Call "TurboActivate::IsActivated(w'${VersionGUID}') i.r2 ? cu"
; deactivate if activated
${If} $2 == 0
System::Call "TurboActivate::Deactivate(i1) i.r2 ? cu"
${EndIf}
; Set the output directory to the temp folder where this uninstaller resides
; so we can delete the '$INSTDIR'. Otherwise the earlier "SetOutPath" locks the
; "$INSTDIR" making it impossible to delete.
SetOutPath $EXEDIR
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\TurboActivate.dll"
Delete "$INSTDIR\TurboActivate.dat"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\UckyPucks"
SectionEnd
.iss
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Lucky Pucks"
#define MyAppVersion "2.0"
#define MyAppPublisher "Randomish Gaming (ToNic Innovations)"
#define MyAppExeName "Lucky Pucks.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={{FDD2E57A-7C8A-432E-AA49-A376C00DFD9C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=C:\Users\tonic\Desktop\Lucky Pucks
OutputBaseFilename=Lucky Pucks Installer
SetupIconFile=C:\Users\tonic\Downloads\lucky_pucks.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Users\tonic\Desktop\Lucky Pucks\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\tonic\Desktop\Lucky Pucks\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Code]
//TODO: go to the version page in your LimeLM account and paste this GUID here
const
VERSION_GUID = 'yqhnx4ltxrb36a73zzrqlqrso2yxipy';
TA_SYSTEM = 1;
TA_USER = 2;
/// <summary>
/// Use the TA_DISALLOW_VM in UseTrial() to disallow trials in virtual machines.
/// If you use this flag in UseTrial() and the customer's machine is a Virtual
/// Machine, then UseTrial() will throw VirtualMachineException.
/// </summary>
TA_DISALLOW_VM = 4;
/// <summary>
/// Use this flag in TA_UseTrial() to tell TurboActivate to use client-side
/// unverified trials. For more information about verified vs. unverified trials,
/// see here: https://wyday.com/limelm/help/trials/
/// Note: unverified trials are unsecured and can be reset by malicious customers.
/// </summary>
TA_UNVERIFIED_TRIAL = 16;
/// <summary>
/// Use the TA_VERIFIED_TRIAL flag to use verified trials instead
/// of unverified trials. This means the trial is locked to a particular computer.
/// The customer can't reset the trial.
/// </summary>
TA_VERIFIED_TRIAL = 32;
TA_HAS_NOT_EXPIRED = 1;
TA_OK = $00;
TA_FAIL = $01;
TA_E_PKEY = $02;
TA_E_ACTIVATE = $03;
TA_E_INET = $04;
TA_E_INUSE = $05;
TA_E_REVOKED = $06;
TA_E_PDETS = $08;
TA_E_TRIAL = $09;
TA_E_COM = $0B;
TA_E_TRIAL_EUSED = $0C;
TA_E_TRIAL_EEXP = $0D;
TA_E_EXPIRED = $0D;
TA_E_INSUFFICIENT_BUFFER = $0E;
TA_E_PERMISSION = $0F;
TA_E_INVALID_FLAGS = $10;
TA_E_IN_VM = $11;
TA_E_EDATA_LONG = $12;
TA_E_INVALID_ARGS = $13;
TA_E_KEY_FOR_TURBOFLOAT = $14;
TA_E_INET_DELAYED = $15;
TA_E_FEATURES_CHANGED = $16;
TA_E_NO_MORE_DEACTIVATIONS = $18;
TA_E_ACCOUNT_CANCELED = $19;
TA_E_ALREADY_ACTIVATED = $1A;
TA_E_INVALID_HANDLE = $1B;
TA_E_ENABLE_NETWORK_ADAPTERS = $1C;
TA_E_ALREADY_VERIFIED_TRIAL = $1D;
TA_E_TRIAL_EXPIRED = $1E;
TA_E_MUST_SPECIFY_TRIAL_TYPE = $1F;
TA_E_MUST_USE_TRIAL = $20;
// functions for activation
function TA_GetHandle(versionGUID: WideString): longint;
external 'TA_GetHandle@files:TurboActivate.dll,TurboActivate.dat cdecl setuponly';
function TA_IsActivated(handle: longint): longint;
external 'TA_IsActivated@files:TurboActivate.dll,TurboActivate.dat cdecl setuponly';
function TA_CheckAndSavePKey(handle: longint; productKey: WideString; flags: UINT): longint;
external 'TA_CheckAndSavePKey@files:TurboActivate.dll,TurboActivate.dat cdecl setuponly';
function TA_Activate(handle: longint; options: cardinal): longint;
external 'TA_Activate@files:TurboActivate.dll,TurboActivate.dat cdecl setuponly';
// functions for the uninstaller
function TA_GetHandleUninstall(versionGUID: WideString): longint;
external 'TA_GetHandle@{app}\TurboActivate.dll cdecl uninstallonly';
function TA_IsActivatedUninstall(handle: longint): longint;
external 'TA_IsActivated@{app}\TurboActivate.dll cdecl uninstallonly';
function TA_Deactivate(handle: longint; erasePkey: boolean): longint;
external 'TA_Deactivate@{app}\TurboActivate.dll cdecl uninstallonly';
function TA_Cleanup(): longint;
external 'TA_Cleanup@{app}\TurboActivate.dll cdecl uninstallonly';
var
PkeyPage: TInputQueryWizardPage;
activated: Boolean;
taHandle: longint;
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
// get the handle for your version GUID
taHandle := TA_GetHandle(VERSION_GUID);
// error handling code
if taHandle = 0 then begin
MsgBox('Failed to get the TurboActivate handle. Make sure the TurboActivate.dat file is included with your installer and you''re using the correct VersionGUID.', mbError, MB_OK);
Result := False;
exit;
end;
// after the welcome page, check if we're activated
ret := TA_IsActivated(taHandle);
if ret = TA_OK then begin
activated := true;
end;
Result := True;
end else if CurPage = PkeyPage.ID then begin
// check if the product key is valid
ret := TA_CheckAndSavePKey(taHandle, PkeyPage.Values[0], TA_SYSTEM);
if ret = TA_OK then begin
// try to activate, show a specific error if it fails
ret := TA_Activate(taHandle, 0);
case ret of
TA_E_PKEY:
MsgBox('The product key is invalid or there''s no product key.', mbError, MB_OK);
TA_E_INET:
MsgBox('Connection to the servers failed.', mbError, MB_OK);
TA_E_INUSE:
MsgBox('The product key has already been activated with the maximum number of computers.', mbError, MB_OK);
TA_E_REVOKED:
MsgBox('The product key has been revoked.', mbError, MB_OK);
TA_E_INVALID_HANDLE:
MsgBox('The handle is not valid. You must set the VersionGUID property.', mbError, MB_OK);
TA_E_COM:
MsgBox('CoInitializeEx failed. Re-enable Windows Management Instrumentation (WMI) service. Contact your system admin for more information.', mbError, MB_OK);
TA_E_ENABLE_NETWORK_ADAPTERS:
MsgBox('There are network adapters on the system that are disabled and TurboActivate couldn''t read their hardware properties (even after trying and failing to enable the adapters automatically).' + ' Enable the network adapters, re-run the function, and TurboActivate will be able to "remember" the adapters even if the adapters are disabled in the future.', mbError, MB_OK);
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);
TA_E_IN_VM:
MsgBox('Failed to activate because this instance of your program if running inside a virtual machine or hypervisor.', mbError, MB_OK);
TA_E_INVALID_ARGS:
MsgBox('The arguments passed to the function are invalid. Double check your logic.', mbError, MB_OK);
TA_E_KEY_FOR_TURBOFLOAT:
MsgBox('The product key used is for TurboFloat, not TurboActivate.', mbError, MB_OK);
TA_E_ACCOUNT_CANCELED:
MsgBox('Can''t activate because the LimeLM account is cancelled.', mbError, MB_OK);
TA_OK: // successful
begin
activated := true;
Result := True
exit;
end
else
MsgBox('Failed to activate. Error code: ' + IntToStr(ret), mbError, MB_OK);
end;
Result := False
end else begin
MsgBox('You must enter a valid product key. Error code: ' + IntToStr(ret), 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
// get the handle for your version GUID
taHandle := TA_GetHandleUninstall(VERSION_GUID);
// error handling code
if taHandle = 0 then begin
MsgBox('Failed to get the TurboActivate handle. Make sure the TurboActivate.dat file is included with your installer and you''re using the correct VersionGUID.', mbError, MB_OK);
end else begin // valid handle
// deactivate if activated
if TA_IsActivatedUninstall(taHandle) = TA_OK then begin
// change the second parameter to "True" if you want to
// delete the product key from the computer after your app is deactivated
ret := TA_Deactivate(taHandle, False);
end;
end;
TA_Cleanup();
// 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;
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
What error are you getting with what function?
Also, it’s better to just integrate TA in your app and skip the installer.
“You must enter a valid product key.” As far as skipping the installer, I could not even begin to know how to do that. Not a coder. Just a internet marketer that needs to protect my investment.
Ok, so the error is telling you exactly what needs to be done: enter a valid product key (which you get from LimeLM).
Integrating LimeLM into an app has a learning curve and set minimum level of skills needed to use it. I'd hire a programmer to get you up to speed.
I have created 5 keys total an NONE of them worked.
Integrating LimeLM into an app has a learning curve and set minimum level of skills needed to use it. I'd hire a programmer to get you up to speed.
Or I could just find another solution since nobody is willing to help here!
We don’t provide development services. This is a debuggable problem with a programmer. Hire a programmer.
I am not asking for you to provide dev services. I am asking if you see any obvious errors in the code, and for you to provide support for your product. I you don't advise using with an installer, then you should remove that option. That would have saved both of us time!
Our installer scripts work out of the box. We know that and we've confirmed it.
Once you start modifying it, this is where you need a developer. Asking us to read over code or to debug code is asking for development services. The price of our products is such that we cannot and will not provide development services.