Debugging Tools for Windows

Using the DECLARE_API Macro

Each extension command in a WdbgExts extension DLL is declared using the DECLARE_API macro. This macro is defined in wdbgexts.h.

The basic format of the code for an extension command is:

DECLARE_API( myextension )
{
    code for myextension
}

The DECLARE_API macro sets up a standard interface for extension commands. For example, if the user passed any arguments to the extension command, the entire argument string will be stored as a string, and a pointer to this string (PCSTR) will be passed to the extension function as args.

If you are using 64-bit pointers, the DECLARE_API macro is defined as follows:

#define DECLARE_API(s)                             \
    CPPMOD VOID                                    \
    s(                                             \
        HANDLE                 hCurrentProcess,    \
        HANDLE                 hCurrentThread,     \
        ULONG64                dwCurrentPc,        \
        ULONG                  dwProcessor,        \
        PCSTR                  args                \
     )

If you are using 32-bit pointers, DECLARE_API remains the same, except that dwCurrentPc will be of the type ULONG instead of ULONG64. However, 64-bit pointers are recommended for any extension that you are writing. See 32-Bit Pointers and 64-Bit Pointers for details.

Build machine: CAPEBUILD