Locked values are values that are prevented from changing, or are allowed to change only under certain circumstances. Other software sometimes call this freezing. MHS has 4 built-in locking modes and a script lock to allow any other type of locking the user would like.
The 4 main locking modes are on the Main tab of the Modify Address dialog.
The value specified in Exact Value is written to RAM repeatedly at the final address.
If the value at the final address goes below the Low value, the Low value is written to RAM. If the value at the final address goes higher than the High value, the High value is written to RAM.
No Lower Than
If the value at the final address goes below the Minimum Value value, the Minimum Value value is written to RAM.
No Greater Than
If the value at the final address goes above the Maximum Value value, the Maximum Value value is written to RAM.
Script locks allow you to create any type of lock you wish. Because script locks are run by scripts, you can incorporate any kind of logic you need, access any area in RAM you desire, and even perform other actions not necessarily related to the locking functionality. It is even possible to lock multiple addresses at once within a single script lock for a single stored address. To create a script lock, simply write the Lock() function in the Script Lock tab editor and check the Use Script to Apply Lock check.
Typically the lock is performed by using extern variables (see Externals) declared at the address passed to the function and modified as desired. In this image, e_dwVal is declared at the address given to the function, then checked for being under 100, in which case e_dwVal is set to 100, which modifies the RAM in the target process respectively.
aAddress is the final address calculated by any of the 3 methods for calculating addresses (see Address Modifications).
iItemSize is the size of the item. If the stored value is a standard type, such as float, unsigned long, char, etc., this is the standard size of that type. If the stored value is a non-standard or string type, this value is the length of the non-standard type or string. Strings are always binary, so this length includes any NULL characters within the string.
iItemSize is typically ignored in the script, especially when the stored value is a standard type and the size is always known beforehand.
If the script lock is enabled, the script is used instead of the other lock modes. However, the data for the other lock modes is valid and will be used again if the script lock is disabled.
When stored values are locked, the icon next to them appears green.
You can lock and unlock multiple stored addresses at once by selecting them and then hitting either the Lock or Unlock toolbar button.