Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How the AuthCode works in Champions of Regnum

// 1. check if auth code exists
HKEY hKey;
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 HKCU
if (!found) {
    RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\NGD Studios\\RegnumOnline", ...);
    RegQueryValueExA(hKey, "AuthCode", ...);
}

// if still not found it will generate a new code
if (!found) {
    srand(time(0));  // seed with current Unix time (seconds)
    
    for (int i = 0; i < 32; i++) {
        int type = rand() % 3;  // 0, 1, or 2
        if (type == 0) {
            code[i] = rand() % 26 + 'A';  // uppercase letters A-Z
        } else if (type == 1) {
            code[i] = rand() % 26 + 'a';  // lowercase letters a-z
        } else {
            code[i] = rand() % 10 + '0';  // digits from 0-9
        }
    }
    
    // saves to registry
    RegSetValueExA(hKey, "AuthCode", 0, REG_BINARY, (BYTE*)code_unicode, 64);
}

About

Find out when your AuthCode was generated. As example when you want to find out when you first time launched Regnum on a PC. (Idk why you would do that)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages