Environment Variables

MHS defines several environment variables and allows you to define your own additional ones. Environment variables can be used in several places. Environment variables are like basic macros that are replaced inside a string with a certain value. Some system environment variables have values that may change several times while MHS is running. Add, edit, or view environment variables by selecting the Tools/Options menu item and selecting the Env. Variables category.

 

Using Environment Variables

Environment variables can be used with the Preprocessor and inside the Disassembler path options. To use an environment variable inside a string, enclose the variable name inside percent signs (%…%) or inside dollar-sign prefixed parentheses ($(…)). For example, if the variable name is VCInstallDir, we can use it in a string by typing $(VCInstallDir)includes or %VCInstallDir%includes.

Names of environment variables can only contain numbers, letters, and underscores, and the first character of the name must not be a number.

 

System Environment Variables

The system defines several environment variables for you. These values change depending on certain things, and some of them change several times while MHS is running.

Variable

Meaning

MHSPath The fully qualified path to the MHS executable, including the file name.
MHSDir

The directory where the MHS executable resides.

MHSProfile The fully qualified path of the DefProf.ini file used by MHS to keep track of system-wide settings.
TargetName The name of the target process, or an empty string if there is no target process.
TargetPath

Fully qualified path to the target process, or an empty string if there is no target process.

TargetDir

The directory in which the target process resides, or an empty string if there is no target process.

 

User Environment Variables

Users may add their own environment variables, following the rules listed above. There are no restrictions on the values of the variables except that the length must be shorter than 2,048 characters. User environment variables are static and never change.

Users may not override system-defined environment variables. If the user defines the same variable twice, the previous definition is overwritten.

Selecting an environment variable from the list places its name and value into the edit boxes for ease in editing and for the ability to copy/paste the values elsewhere.

Copyright © 2006 Shawn (L. Spiro) Wilcoxen