4.10 Modifying Application Data

You can easily change the values of variables, memory locations, or registers displayed in the Watch, Memory, Reg, or 8087 window. Simply position the cursor at the value you want to change, and type the appropriate value. If you change your mind, press ALT+BACKSPACE to undo the last change you made.

The Memory window displays the starting address of each line in segment:offset form. Altering the address automatically shifts the display to the corresponding section of memory. If that section is not used by your application, memory locations are displayed as double question marks (??). You cannot change memory that is displayed as question marks.

You can also change the values of memory locations by modifying the right side of the memory display, which shows memory values in ASCII form. For example, you can change a byte from decimal value 75 (ASCII value for uppercase K) to decimal value 85 (ASCII value for uppercase U). To do so, place the cursor over the letter K, which corresponds to the position where the memory value is 75, and type U.

To change a processor flag, you can click its mnemonic or you can position the cursor on a mnemonic and press any key (except TAB or SPACEBAR). Repeat these operations to restore the flag to its previous setting.

Although you can alter most items from the Watch window, sometimes it is useful to modify a register or memory directly. For example, if a function returns a value in the AX register, you can modify the AX register to change a returned value without executing the function.

Caution:

You should be especially cautious when altering machine-level values. The effect of changing a register, flag, or memory location may vary from having no effect at all to causing the operating system to crash.