/* Bonus code calculator for Race Driver 1 and 2 by Luigi Auriemma e-mail: aluigi@autistici.org web: aluigi.org pid is your ProductId HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\ProductID The function returns your bonus code */ int rdbonuscode(char *pid) { int tmp, num, i, len; len = strlen(pid); num = 0; for(i = 0; i < len; i++, pid++) { tmp = *pid % 10; switch((num + i) % 3) { case 1: tmp *= 2345; break; case 2: tmp *= 3456; break; case 3: tmp *= 4567; break; default: tmp *= 1234; break; } num += tmp; } return(num % 1000); }