Jump to content

Recommended Posts

Posted

I'm trying to write some macros for some environment variables that might not always exist on the system. For example, the macro @HomeShare, which refers to the environment variable %HOMESHARE% returns a user's home directory share if it is on a network share. If not, this environment won't exist. The following code seems to work, but I wanted to get some opinions on this. Also, I think this sort of checking might be a good idea for all macros that get their data from environment variables, such as @ComSpec. Here's the code, please pick it apart and make it better:

case M_HOMESHARE:
     if (GetEnvironmentVariable("HOMESHARE", szValue, _MAX_PATH))
    vResult = szValue;
     else
    vResult = "";
     break;

Also, I can get these values from the registry in Windows XP, but can any of you networking people with home drives/shares tell me if the values in the following registry key for HOMEPATH, HOMEDRIVE, and HOMESHARE exist:

HKEY_CURRENT_USER\Volatile Environment

Sincerely yours,Jeremy Landesjlandes@landeserve.com

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...