SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Key Generation

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> RegKeeper
View previous topic :: View next topic  
Author Message
alanmcd



Joined: 07 Jan 2007
Posts: 8

PostPosted: Sat Jan 13, 2007 5:50 am    Post subject: Key Generation Reply with quote

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
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Sat Jan 13, 2007 8:34 am    Post subject: Reply with quote

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
View user's profile Send private message
alanmcd



Joined: 07 Jan 2007
Posts: 8

PostPosted: Sat Jan 13, 2007 10:12 am    Post subject: Reply with quote

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
View user's profile Send private message
alanmcd



Joined: 07 Jan 2007
Posts: 8

PostPosted: Sat Jan 13, 2007 11:48 am    Post subject: Reply with quote

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
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Sat Jan 13, 2007 5:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
alanmcd



Joined: 07 Jan 2007
Posts: 8

PostPosted: Sat Jan 13, 2007 10:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Sun Jan 14, 2007 6:14 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> RegKeeper All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group