.ocommand (Expect Commands from Target)
The .ocommand command enables the target application to send commands to the debugger.
.ocommand String .ocommand -d .ocommand
Specifies the command prefix string. String can include spaces, but you cannot use C-style control characters such as \" and \n. You can also enclose String in quotation marks. However, if String includes a semicolon, leading spaces, or trailing spaces, you must enclose String in quotation marks.
Deletes the command prefix string.
User mode only
Live debugging only
For more information about OutputDebugString and other user-mode functions that communicate with a debugger, see the Microsoft Windows SDK documentation.
If you use the .ocommand command without parameters, the debugger displays the current command prefix string. To clear the existing string, use .ocommand -d.
When you have set a command prefix string, any target output (such as the contents of an OutputDebugString command) is scanned. If this output begins with the command prefix string, the text of the output that follows the prefix string is treated as a debugger command string and is run. When this text is executed, the command string is not displayed.
The target can include an .echo (Echo Comment) command in the output string if you want additional messages. Target output that does not begin with the prefix string is displayed in the typical manner.
After the commands within the command string have been executed, the target remains broken into the debugger, unless the final command is g (Go).
The comparison between the command prefix string and the target output is not case sensitive. (However, subsequent uses of .ocommand display the string that you entered with the case preserved).
For this example, assume that you enter the following command in the debugger.
0:000> .ocommand magiccommand
Then, the target application executes the following line.
The debugger recognizes the command string prefix and executes kb;g immediately.
However, the following line does not cause any commands to be executed.
OutputDebugString("Command on next line.\nmagiccommand kb;g");
There are no commands executed from the preceding example because the command string prefix is not at the beginning of the output, even though it does begin a new line.