I have si.pUserData set to what I want but it doesn't show up in license once it has been generated.
I can't seem to get the user data to be added. What am I missing?
How would I get a string to be added to user data?
Also how would I have a DateTimePicker1.Date to be set as expiration date in keygen?
How would I set statement:
si.dwExpDate := Cardinal(DateTimePicker1.Date);
^^ this doesn't work... looking for solution.
I am using Delphi to program.
UserData and Expiration Date
Re: UserData and Expiration Date
It seems your forgot to specify "HAS_USER_DATA" in si.flags:How would I get a string to be added to user data?
Code: Select all
si.flags := ... or HAS_USER_DATA;
You have to use the following code for it:How would I set statement:
si.dwExpDate := Cardinal(DateTimePicker1.Date);
Code: Select all
#define MAKEDATE(y, m, d) (DWORD)((y << 16) + (m <<8) + d)
Re: UserData and Expiration Date
How do I get a datetimepicker to get correct value? MAKEDATE is not a function or string anywhere. Even if I made it, that only allows for static input not dynamic from a datetimepicker in delphi.
I have a DateTimePicker that I want to pull the date from and set as expiration date.
I have a DateTimePicker that I want to pull the date from and set as expiration date.
Re: UserData and Expiration Date
Code: Select all
var
y, m, d : Word;
begin
DecodeDate(DateTimePicker1.Date, y, m, d);
si.dwExpDate := (y shl 16) + (m shl 8) + d;
Re: UserData and Expiration Date
Thank you, this is working now. However, is the UserData supposed to be in a specific format or char type? I've specified it, but it's not being added to the license. I have the flag specified, so that's not the problem.
Re: UserData and Expiration Date
"UserData" is just a byte array. You can store any data in this field.
Re: UserData and Expiration Date
No matter what I do, it's not in the right format and is giving me errors.
Incompatible types: 'PByte' and 'System.TArray<SystemBytes>'
or
Incompatible types: 'PByte' and 'System.String'
I am using:
si.PUserData := TEncoding.UTF8.GetBytes(mystring);
Incompatible types: 'PByte' and 'System.TArray<SystemBytes>'
or
Incompatible types: 'PByte' and 'System.String'
I am using:
si.PUserData := TEncoding.UTF8.GetBytes(mystring);
Re: UserData and Expiration Date
Code: Select all
var user_data: array [0..20] of Byte;
...
user_data[0] := 1;
user_data[2] := 2;
..
user_data[19] := 20;
si.pUserData := @user_data[0];
si.nUserDataLength:= SizeOf(user_data);
Re: UserData and Expiration Date
Thank you, this works great.
However, what if you have a string in which you want to place into user data?
However, what if you have a string in which you want to place into user data?
Re: UserData and Expiration Date
I recommend to store such string in UTF8/Base64 and decode it in a protected program.