Muokkaa

Jaa


!for_each_module

The !for_each_module extension executes a debugger command one time for each loaded module.

!for_each_module ["CommandString"]
!for_each_module -?

<Parameters

CommandString
Specifies the debugger commands to execute one time for each module in the debugger's module list. If CommandString includes multiple commands, you must separate them with semicolons and enclose CommandString in quotation marks. If you include multiple commands, the individual commands within CommandString cannot contain quotation marks.

You can use the following aliases in CommandString or in any script that the commands in CommandString executes.

Alias Data type Value

@#FileVersion

string

The file version of the module.

@#ProductVersion

string

The product version of the module.

@#ModuleIndex

ULONG

The module number. Modules are enumerated consecutively, starting with zero.

@#ModuleName

string

The module name. This name is typically the file name without the file name extension. In some situations, the module name differs significantly from the file name.

@#ImageName

string

The name of the executable file, including the file name extension. Typically, the full path is included in user mode but not in kernel mode.

@#LoadedImageName

string

Unless Microsoft CodeView symbols are present, this alias is the same as the image name.

@#MappedImageName

string

In most situations, this alias is NULL. If the debugger is mapping an image file (for example, during minidump debugging), this alias is the name of the mapped image.

@#SymbolFileName

string

The path and name of the symbol file. If you have not loaded any symbols, this alias is the name of the executable file instead.

@#ModuleNameSize

ULONG

The string length of the module name string, plus one.

@#ImageNameSize

ULONG

The string length of the image name string, plus one.

@#LoadedImageNameSize

ULONG

The string length of the loaded image name string, plus one.

@#MappedImageNameSize

ULONG

The string length of the mapped image name string, plus one.

@#SymbolFileNameSize

ULONG

The string length of the symbol file name string, plus one.

@#Base

ULONG64

The address of the start of the image.

@#Size

ULONG

The size of the image, in bytes.

@#End

ULONG64

The address of the end of the image.

@#TimeDateStamp

ULONG

The time and date stamp of the image. If you want to expand this time and date stamp into a readable date, use the .formats (Show Number Formats) command.

@#Checksum

ULONG

The checksum of the module.

@#Flags

ULONG

The module flags. For a list of the DEBUG_MODULE_Xxx values, see Dbgeng.h.

@#SymbolType

USHORT

The symbol type. For a list of the DEBUG_SYMTYPE_Xxx values, see Dbgeng.h.

These aliases are all replaced before CommandString is executed for each module and before any other parsing occurs. These aliases are case sensitive. You must add a space before the alias and a space after it, even if the alias is enclosed in parentheses. If you use C++ expression syntax, you must reference these aliases as @@( @#alias).

These aliases are available only during the lifetime of the call to !for_each_module. Do not confuse them with pseudo-registers, fixed-name aliases, or user-named aliases.

-?
Displays some Help text for this extension in the Debugger Command window.

DLL

Ext.dll

Additional Information

For more information about how to define and use aliases as shortcuts for entering character strings (including use of the ${ } token), see Using Aliases.

Remarks

If you do not specify any arguments, the !for_each_module extension displays general information about the loaded modules. This information is similar to the information that the following command shows.

!for_each_module .echo @#ModuleIndex : @#Base @#End @#ModuleName @#ImageName  @#LoadedImageName

For more information about loaded and unloaded modules, use the lm (List Loaded Modules) command.

If you enable verbose debugger output, the debugger displays the total number of loaded and unloaded modules when the extension is called, and the debugger displays detailed information about each module (including the values of each available alias) before CommandString is executed for that module.

The following examples show how to use the !for_each_module extension. The following commands display the global debug flags.

!for_each_module x ${@#ModuleName}!*Debug*Flag*
!for_each_module x ${@#ModuleName}!g*Debug*

The following command checks for binary corruption in every loaded module, by using the !chkimg extension:

!for_each_module !chkimg @#ModuleName

The following command searches for the pattern "MZ" in every loaded image.

!for_each_module s-a @#Base @#End "MZ"

The following example demonstrates the use of @#FileVersion and @#ProductVersion for each module name:

0:000> !for_each_module .echo @#ModuleName fver = @#FileVersion pver = @#ProductVersion 
USER32 fver = 6.0.6000.16438 (vista_gdr.070214-1610) pver = 6.0.6000.16438
kernel32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
ntdll fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
notepad fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
WINSPOOL fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
COMCTL32 fver = 6.10 (vista_rtm.061101-2205) pver = 6.0.6000.16386
SHLWAPI fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
msvcrt fver = 7.0.6000.16386 (vista_rtm.061101-2205) pver = 7.0.6000.16386
GDI32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
RPCRT4 fver = 6.0.6000.16525 (vista_gdr.070716-1600) pver = 6.0.6000.16525
SHELL32 fver = 6.0.6000.16513 (vista_gdr.070626-1505) pver = 6.0.6000.16513
ole32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
ADVAPI32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386
COMDLG32 fver = 6.0.6000.16386 (vista_rtm.061101-2205) pver = 6.0.6000.16386