Platform SDK: Debugging and Error Handling

StatusRoutine

The StatusRoutine function is an application-defined callback function used with the BindImageEx function. The status routine is called during the process of the image binding.

The PIMAGEHLP_STATUS_ROUTINE type defines a pointer to this callback function. StatusRoutine is a placeholder for the application-defined function name.

BOOL StatusRoutine(
  IMAGEHLP_STATUS_REASON Reason,
  PSTR ImageName,
  PSTR DllName,
  ULONG_PTR Va,
  ULONG_PTR Parameter
);

Parameters

Reason
[in] Specifies the current status of the bind operation. This parameter can be one of the following values.
Value Meaning
BindOutOfMemory Out of memory. The Parameter value is the number of bytes in the allocation attempt.
BindRvaToVaFailed The relative virtual address is invalid for the image. The Parameter value is not used.
BindNoRoomInImage No room in the image for new format import table. The Parameter value is not used.
BindImportModuleFailed Module import failed. The Parameter value is not used.
BindImportProcedureFailed Procedure import failed. The Parameter value is the name of the function.
BindImportModule Module import is starting. The Parameter value is not used.
BindImportProcedure Procedure import is starting. The Parameter value is the name of the function.
BindForwarder The Parameter value is the name of the function forwarded.
BindForwarderNOT The Parameter value is the name of the function not forwarded.
BindImageModified Image modified. The Parameter value is not used.
BindExpandFileHeaders File headers expanded. The Parameter value is the number of bytes
BindImageComplete Binding is complete. For more information on the Parameter value, see the following Remarks section.
BindMismatchedSymbols Checksum did not match. The Parameter value is the name of the symbol file.
BindSymbolsNotUpdated Symbol file was not updated. The Parameter value is the name of the symbol file not updated.

ImageName
[in] Pointer to a null-terminated string that specifies the name of the file to be bound. This value can be a file name, a partial path, or a full path.
DllName
[in] Pointer to a null-terminated string that specifies the name of the DLL.
Va
[in] Specifies the computed virtual address.
Parameter
[in] Specifies additional status information. This value depends on the value of the Reason parameter. For more information, see the code fragment in the following Remarks section.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError.

Remarks

The following code fragment describes the contents of the Parameter value when the status is BindImageComplete.

case BindImageComplete:
    if (fVerbose) {
        fprintf(stderr, "BIND: Details of binding %s\n", ImageName );
        NewImports = (PIMAGE_BOUND_IMPORT_DESCRIPTOR)Va;
        NewImport = NewImports;
        while (NewImport->OffsetModuleName) {
            fprintf( stderr, "    Import from %s [%x]",
                     (LPSTR)NewImports + NewImport->OffsetModuleName,
                     NewImport->TimeDateStamp
                   );
            if (NewImport->NumberOfModuleForwarderRefs != 0) {
                fprintf( stderr, " with %u forwarders", NewImport-> 
                         NumberOfModuleForwarderRefs );
            }
            fprintf( stderr, "\n" );
            NewForwarder = (PIMAGE_BOUND_FORWARDER_REF)(NewImport+1);
            for (i=0; i<NewImport->NumberOfModuleForwarderRefs; i++) {
                fprintf( stderr, "        Forward to %s [%x]\n",
                   (LPSTR)NewImports + NewForwarder->OffsetModuleName,
                   NewForwarder->TimeDateStamp);
                NewForwarder += 1;
            }
            NewImport = (PIMAGE_BOUND_IMPORT_DESCRIPTOR)NewForwarder;
        }
    }
    break;

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Imagehlp.h.

See Also

Image Help Library Overview, ImageHlp Functions, BindImageEx