How do you detect the home drive(where windows is installed)

Use the Environ function searching for the "SystemDrive". (see this)
Also you can use the System.Environment.SystemDirectory to get the full path (see there)