MrLot
October 23, 2019, 6:53am
1
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.
Admin
October 23, 2019, 8:01am
2
How would I get a string to be added to user data?
It seems your forgot to specify “HAS_USER_DATA” in si.flags:
si.flags := ... or HAS_USER_DATA;
How would I set statement:
si.dwExpDate := Cardinal(DateTimePicker1.Date);
You have to use the following code for it:
#define MAKEDATE(y, m, d) (DWORD)((y << 16) + (m <<8) + d)
Where “y” = “year”, “m” = “month”, “d” = “day” and “<<” = “shl”. Also don’t forget to specify “HAS_EXP_DATE” in si.flags.
MrLot
October 23, 2019, 9:10am
3
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.
Admin
October 23, 2019, 11:43am
4
var
y, m, d : Word;
begin
DecodeDate(DateTimePicker1.Date, y, m, d);
si.dwExpDate := (y shl 16) + (m shl 8) + d;
MrLot
December 1, 2019, 11:51pm
5
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.
Admin
December 2, 2019, 8:38am
6
“UserData” is just a byte array. You can store any data in this field.
MrLot
December 2, 2019, 4:42pm
7
No matter what I do, it’s not in the right format and is giving me errors.
Incompatible types: ‘PByte’ and ‘System.TArray’
or
Incompatible types: ‘PByte’ and ‘System.String’
I am using:
si.PUserData := TEncoding.UTF8.GetBytes(mystring);
Admin
December 3, 2019, 12:21pm
8
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);
MrLot
January 22, 2020, 1:16am
9
Thank you, this works great.
However, what if you have a string in which you want to place into user data?
Admin
January 22, 2020, 6:06am
10
I recommend to store such string in UTF8/Base64 and decode it in a protected program.