pcbob
Posts: 1
Joined: Sun May 01, 2005 11:29 am

Serial Number

hi all
this is my first topic

would any of you help me with a little problem i have.

i have downloaded the Serial Number Validation DLL Sample Project for the Advanced Installer program, and underneath it it says that i need to customize the DLL Validation function, because the one supplies is very naive and easy to break. But how do i customize so i can add my own serial number? :D
UdreaMihai
Posts: 90
Joined: Wed Mar 23, 2005 8:13 am

Hi,

If you open the SerialValidation project you will find in the validation function the following:

//the template we use is <###-####> = <XYZ-ABCD>; # digit between 0 and 9
//the algorithm is very simple (XY * Z + 7) * 13 = ABCD / 2
int xy = DIGIT(szPidKey[0]) * 10 + DIGIT(szPidKey[1]);
int z = DIGIT(szPidKey[2]);
int left = ((xy * z + 7) * 13 ) * 2;
int right = DIGIT(szPidKey[4]);
right = right * 10 + DIGIT(szPidKey[5]);
right = right * 10 + DIGIT(szPidKey[6]);
right = right * 10 + DIGIT(szPidKey[7]);
snIsValid = (left != 0) && (right != 0) && (left == right);


This is what you have to modify in order to implement your own algorithm.

I hope this helps you.

Best,
Mihai.
Udrea Mihai
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”