what i saw in someones source code for a game was simply looking for a variable... dont have the actual code... so here is some psuedo-code
open key config file to read
keyForward = number from file
keyLeft = number from file
if keystate(keyForward) = 1 then move forward
if keystate(keyLeft) = 1 then move left
they didnt have anything in the game to change the keys... but you could easily do that... when they select what they want to change... have it look for the scancode() number...
open key config file for write
keyPressed = scancode()
write keyPressed into proper area in file
so this is actually fairly easy to do... if you need some code to write the file (in ini format) check in the codebase, i put some code in there that you can write to ini files... and you can add/change info without having to re-write the entire file over again... real easy to use... and has information on how to use it in the code