Key Generation

Forum designated to discuss the RegKeeper- e-Sales Tracking Software.
Locked
alanmcd
Posts: 8
Joined: Sun Jan 07, 2007 4:41 pm

Key Generation

Post by alanmcd »

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

isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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.

alanmcd
Posts: 8
Joined: Sun Jan 07, 2007 4:41 pm

Post by alanmcd »

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

alanmcd
Posts: 8
Joined: Sun Jan 07, 2007 4:41 pm

Post by alanmcd »

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

isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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.

alanmcd
Posts: 8
Joined: Sun Jan 07, 2007 4:41 pm

Post by alanmcd »

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

isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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.

Locked