Tutorials:Key Change Scripts

From LANCommander

Overview

Key change scripts are executed on the client's machine whenever they install a game from the Playnite extension or by clicking the "Change Game Key" action under the More button. When a client requests a key from LANCommander, they are given a key that is not currently allocated. If the client machine already has been allocated a key, the original key is released and a new key will be allocated. Keys are currently only allocated by the MAC address of the client's network adapter.

Handling a key change can vary from game to game. Many games opt to store their key in the registry. It was popular for publishers to work with developers to implement keys into games. As such, game published under companies like EA or Activision often used a standardized format to store keys on a machine. For instance, EA games made from 2002-2008 would store the game's CD key in the registry under a path of:

HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\<Game>\ergc

This can be seen in games such as The Lord of the Rings: The Battle for Middle-earth II - The Rise of the Witch-King and Command & Conquer: Generals

There are a few outliers that would store their CD key in plain text somewhere in the games installation directory. Or there are games such as StarCraft or Warcraft III: The Frozen Throne that would store the keys in a proprietary config file that could only be read or written to by the installers. For games like these you'll often find small tools dedicated to changing the key without reinstalling the game. For these key changing tools, it is recommended to use AutoHotkey to help automate the process.

Arguments

When executing a key change script, the new key is passed in as the first argument and may be accessed using $args[0].

For a list of documented key change scripts, see Category:Games With Key Change Scripts.