ehardin
Posts: 85
Joined: Fri Jul 13, 2007 8:10 pm

GetPropertyValue return values

Fri Jul 05, 2019 5:59 pm

In your article
https://www.advancedinstaller.com/user- ... perty.html
you list the return values for GetPropertyValue as:
0 (ERROR_SUCCESS) - The function succeeded
234 (ERROR_MORE_DATA) - The provided buffer was too small to hold the entire value and the terminating null character
13 (ERROR_INVALID_DATA) - The specified property is not defined. More details about available properties you can find in the Trial and Licensing Properties article.
5 (ERROR_ACCESS_DENIED) - The function call was made before the licensing initialization was performed or the trail has expired. To see how to integrate the licensing library into your application follow our licensing articles.

When using this line in a C++ project that has been registered
int iLicenseKey = GetPropertyValue(L"LicenseKey", cswLicKey.GetBuffer(), len);

I'm getting a return of 100 and and the cswLicKey string is empty.

What does the return == 100 mean?

Ed

ehardin
Posts: 85
Joined: Fri Jul 13, 2007 8:10 pm

Re: GetPropertyValue return values

Fri Jul 05, 2019 6:51 pm

PS...sorry about that. MissingTrialDll was enumerated as 100.

Odd however, since the Trial.dll was loaded and other functions found it.

Oh well.

Ed

ehardin
Posts: 85
Joined: Fri Jul 13, 2007 8:10 pm

Re: GetPropertyValue return values

Fri Jul 05, 2019 7:15 pm

OK...I fixed the problem in GetPropertyValue() but now I get a return of
5 (ERROR_ACCESS_DENIED)-The function call was made before the licensing initialization was performed or the trail has expired.

In the InitLicensingSupport(), which was run before the call to GetPropertyValue(), I had run
TrialFcn readSettingsProc = reinterpret_cast<TrialFcn>(
::GetProcAddress(hModule, "ReadSettingsRetStr"));

So, thinking that I maybe needed to run that again I ran that specific ReadSettingsRetStr right before the call to GetPropertyValue() but still got the return of 5.

This brings me back to another post I have pending. viewtopic.php?f=2&t=39730
Per that post I had setup a trial for 15 days but during the fist day I got the Trial Dialog message that my 135 days trial has expired.

No matter what I did I could not get rid of that so I just figured while I was waiting to hear back about that problem I would just go ahead and register my app.
I entered on of the registration strings and the Trial Dialog said that I successfully registered. But I'm getting this return 5 and if I have eliminated the 1st possible reason that the licensing initialization was performed, that leaves the 2nd possibility that the trial has expired.

Theoretically the trial did expire 135 days ago but shouldn't the fact that it is now registered make that point moot? Can't I get a LicenseKey or TrialName now that the app is registered regardless of the fact that it was registered before or after the trial expired???

Ed

ehardin
Posts: 85
Joined: Fri Jul 13, 2007 8:10 pm

Re: GetPropertyValue return values

Fri Jul 05, 2019 9:09 pm

OK, I finally got the app back to trial version
see post viewtopic.php?f=2&t=39730

But now I am still having the problem with the return
5 (ERROR_ACCESS_DENIED)-The function call was made before the licensing initialization was performed or the trail has expired.

int ret = InitLicensingSupport(kLibraryKey, parentWnd);
returns 2 meaning trail copy but when I run
CStringW cswTrialLeft;
DWORD len = cswTrialLeft.GetAllocLength();
int iTrialLeft = GetPropertyValue(L"TrialLeft", cswTrialLeft.GetBuffer(), len);
iTrialLeft is returned as 5.......

What is the problem here. No matter what mode I am in no matter what I do I have yet to be able to return a property value.

Any hints? Is it really possible to get property values? Are there rules about when or how to get property values that are not posted?

Ed

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: GetPropertyValue return values

Mon Jul 08, 2019 4:17 pm

Hello Ed,

I cannot say why this happens. Could you please try to isolate the behavior in a small sample (setup project + small app solution) that replicates the behavior and forward it to us by email to support at advancedinstaller dot com so we can fully test this on our side?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ehardin
Posts: 85
Joined: Fri Jul 13, 2007 8:10 pm

Re: GetPropertyValue return values

Mon Jul 08, 2019 4:56 pm

What I have discovered by trial and error is this:

On your help web page at https://www.advancedinstaller.com/user- ... using.html
it shows an InitLicensingSupport(LPCSTR aKeyCode, HWND aHWnd) function that calls ReadSettingsStr.

In another help page at https://www.advancedinstaller.com/user- ... perty.html# it just shows the syntax.

Soooo... in my App's InitApp() I put a call to InitLicensingSupport() and below that I put a call to GetPropertyValue and got a return of 5 ERROR_ACCESS_DENIED.

So the error says there are 2 possibilities one of which is "The function call was made before the licensing initialization was performed". Of course I had to then research what "licensing initialization" was and fond in the forum that it was a call to ReadSettingsStr.

OK, so I'm thinking, that call was already made in InitLicensingSupport(). So, just to see, I put a second call to ReadSettingStr in my InitApp below the call to IniticensingSupport() and above the call to ReadSettingsStr but still got the return of 5 ERROR_ACCESS_DENIED.

I spend hours going through the forum and there was nothing that insinuated that I was doing anything wrong or that there was any other way to do it. Finally, on a hunch, I put the GetPropertyValue() call inside of the InitLicensingSupport() function and, voila, I got the correct returns.

It would have been nice to have at least a comment inside of the sample code of InitLicensingSupport() saying
// Put call to GetPropertyValue here if needed //

Hopefully my comments will help someone else going through the same thing.

Ed

Return to “Common Problems”