There is a registry key that points to the install, and $DOCUMENTS points to mydocuments folder, it's windows thing that will always return the right/current one for this user. Drive letters will not matter here, the registry keys return full paths that all include a drive letter, your installer will find the folders all right.
In the code you posted there is no progams dir variable, and why would there be? It would make sense to check if installdir is a child of programsdir AND if windows version is bigger than 6.0, and if not, just skip all this splitting into mod and usersettings and install everything to the mod folder. But that's not what your script does.
I am so sure that it will install usersettings to mydocuments that I see no point in actually installing, sorry.
edit: Thx for the headsup though,
I have my own installer now, which only looks for mydocuments for settings when it detects vista/7.