Compartir a través de


Setting Initial Debug Zones (Windows CE 5.0)

Send Feedback

You can set initial debug zones in the registry on the development workstation or on the target device. In addition, you can set debug zones in your code, from the kernel debugger, and from the Target Control window.

If you set the registry value in the registries of both the development workstation and the target device, the value on the development workstation takes precedence over the value on the target device. The caller queries the value on the target device if it cannot reach the development workstation or if the registry on the development workstation does not contain a value for the module.

  • Development workstation registry

    Routines on the development workstation read the registry key HKEY_CURRENT_USER\Pegasus\Zones and search for the module name, specified in the DBGPARAM macro.

    If the key exists, SetDbgZone uses the stored debug zone mask to update the debug zone name in the DBGPARAM macro.

  • Target device registry

    You can also set the initial debug zones of a specific module on the target device by modifying the registry of the target device to override the default value of the zone mask.

    In the HKEY_LOCAL_MACHINE\DebugZones registry key on the target device, create a registry entry with the name of the debug zone and a DWORD value equal to a zone mask.

    For example, to turn on the first five debug zones for a module named VoIPPhone, create a VoIPPhone entry with DWORD value 0x001F.

    When you set the registry value on the target device, use the same registry value that you use on the development workstation.

  • Within code

    From within a module, you can change the zone settings during run-time from code. For more information about the existing zones, see Viewing Debug Zones for a Module.

    For example, the following code line changes the zone settings from within a module:

      dpCurSettings.ulZoneMask = 0x00000001
    

    If you want to change the zones for one module using code that is inside another application or module, use the SetDbgZone.

      DBGPARAM dbg;  // OK uninitialized, receives new settings
      SetDbgZone(hProcess, hModule, 0, dwZone, &dbg);
    

    Use hProcess=0 if you are controlling a DLL; use hModule=0 if you are controlling a process.

  • Kernel debugger

    You can change zone settings from the debugger at a breakpoint by opening a watch window and typing

      {,,myapp.exe}dpCurSettings.ulZoneMask
    

    - OR -

      {,,mydll.dll}dpCurSettings.ulZoneMask
    

    And then modifying the value. When you continue execution, the new debug zones will be used.

    For more information, see Watch Window.

Example

The following code example shows how to associate a bitmask with a debug zone. In this example, an application header file defines 16 (0–15) debug zones.

#define ZONEID_INIT    0
#define ZONEID_SECOND  1
#define ZONEID_EXCEPT  2
.
#define ZONEID_ERROR      15

After defining a debug zone to a bitmask, associate a debug zone mask name with the defined bitmask. A debug zone mask is a named bitmask that is used to turn a debug zone on or off.

The following code example shows how to associate debug zone mask names with the 16 previously defined debug zones.

#define ZONEMASK_INIT      (1<<ZONEID_INIT)
#define ZONEMASK_SECOND    (1<<ZONEID_SECOND)
#define ZONEMASK_EXCEPT    (1<<ZONEID_EXCEPT)
.
#define ZONEMASK_ERROR     (1<<ZONEID_ERROR)

See Also

Understanding the Debug Zones Dialog Box | Debug Zone Registration

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.