View previous topic :: View next topic |
Author |
Message |
alanmcd
Joined: 07 Jan 2007 Posts: 8
|
Posted: Sat Jan 13, 2007 5:50 am Post subject: Key Generation |
|
|
I'm just testing the manual key generation process.
If I edit an order and go to Registration Info, and I have ensured that rkkeygen.dll is compiled as sample supplied (no change) and it resides next to regkeeper.exe.
Then I click the generate button.
Shouldn't I see 'SomeGeneratedKey' in the Registration Ket (UnlockCode) edit box?
What else do I need to get this test working?
Alan |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Sat Jan 13, 2007 8:34 am Post subject: |
|
|
Yes, you must see the generated key in the Registration Key field. If it is not there then it looks like something wrong. Please check:
1. There is no Custom Key Generator defined for the order product.
2. Order contains product listed.
If this still fails please let me know what sample DLL did you compile, may be there is something wrong with code.
Thank you. |
|
Back to top |
|
 |
alanmcd
Joined: 07 Jan 2007 Posts: 8
|
Posted: Sat Jan 13, 2007 10:12 am Post subject: |
|
|
I found one thing wrong with the sample code
procedure GenerateKey(KeyGenInfo: PKeyGenRecord;UnlockCode: PChar; var FileToAttach: PChar); export; stdcall;
insteads of this:
procedure GenerateKey(KeyGenInfo: PKeyGenRecord;var UnlockCode: PChar; var FileToAttach: PChar); export; stdcall;
i.e. no var for UnlockCode
but still no joy - I get a pointer back now - not the key string
I've tried nothing in the custom key generator field and I've also specified the default one to amke sure - no difference.
The order does indeed contain product listed.
no joy yet.
Alan |
|
Back to top |
|
 |
alanmcd
Joined: 07 Jan 2007 Posts: 8
|
Posted: Sat Jan 13, 2007 11:48 am Post subject: |
|
|
I've re-written the implementation to write the UnLockCode to a file. So I know my code works, but no matter what I try, the UnLockCode or the AttachFilename does not get returned, just what looks like a 4 byte pointer is returned (as per the procedure call) but it isn't getting read properly from RegKeeper as the appropriate string values.
(I think)
Alan |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Sat Jan 13, 2007 5:35 pm Post subject: |
|
|
The following code works just fine:
library testkeygen;
uses
SysUtils,
Classes,
Windows,
DateUtils;
type
PKeyGenRecord = ^TKeyGenRecord;
TKeyGenRecord = packed record
ProductID,
ProductName,
UserFName,
UserMName,
UserLName,
UserCompany,
UserEmail,
RegistrationName: PChar;
Quantity: Integer;
AllFields: PChar;
FieldsToModify: PChar;
FailOrder: Boolean;
end;
procedure GenerateKey(KeyGenInfo: PKeyGenRecord; var UnlockCode: PChar; var FileToAttach: PChar); export; stdcall;
const
SWarning = 'WARNING: This is a test warning message!'#13#10;
begin
Move(SWarning[1], UnlockCode, Length(SWarning));
end;
exports GenerateKey;
{$R *.res}
begin
end.
If it still doesn't work please try to specify the DLL for specific product and check if it works.
Please let me know if this helps. |
|
Back to top |
|
 |
alanmcd
Joined: 07 Jan 2007 Posts: 8
|
Posted: Sat Jan 13, 2007 10:42 pm Post subject: |
|
|
I was assigning
UnLockCode := PChar(mygeneratedkey);
this isn't the same as
Move(mygeneratedkey[1], UnlockCode, Length(mygeneratedkey));
I'm used to that method.
Alan |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Sun Jan 14, 2007 6:14 am Post subject: |
|
|
Yes, this was wrong because UnlockCode is already allocated buffer and you need just to fill it. When you assign it to some value Delphi just assigns new pointer. |
|
Back to top |
|
 |
|