You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 1. check if auth code existsHKEYhKey;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\NGD Studios\\RegnumOnline", 0, KEY_READ, &hKey) ==0) {
if (RegQueryValueExA(hKey, "AuthCode", 0, &type, (LPBYTE)data, &cbData) ==0) {
// if it was found then it will use it
}
RegCloseKey(hKey);
}
// if not found check HKCUif (!found) {
RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\NGD Studios\\RegnumOnline", ...);
RegQueryValueExA(hKey, "AuthCode", ...);
}
// if still not found it will generate a new codeif (!found) {
srand(time(0)); // seed with current Unix time (seconds)for (inti=0; i<32; i++) {
inttype=rand() % 3; // 0, 1, or 2if (type==0) {
code[i] =rand() % 26+'A'; // uppercase letters A-Z
} elseif (type==1) {
code[i] =rand() % 26+'a'; // lowercase letters a-z
} else {
code[i] =rand() % 10+'0'; // digits from 0-9
}
}
// saves to registryRegSetValueExA(hKey, "AuthCode", 0, REG_BINARY, (BYTE*)code_unicode, 64);
}