Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit
Zones Registration
Zones Registration
To use debug zones, you must define a global DBGPARAM variable with three fields that specify the module name, the names of the debug zones you want to register, and a field for the current zone mask, as summarized in Table 4-2.
Table 4-2 DBGPARAM elements
Field | Description | Example |
---|---|---|
lpszName | Defines the name of the module with a maximum length of 32 characters. | TEXT("ModuleName") |
rglpszZones | Defines an array of 16 names for the debug zones. Each name can be up to 32 characters long. Platform Builder displays this information to the user when selecting the active zones in the module. | { TEXT("Init"), TEXT("Deinit"), TEXT("On"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"), TEXT("Failure"), TEXT("Warning"), TEXT("Error") } |
ulZoneMask | The current zone mask used in the DEBUGZONE macro to determine the currently selected debug zone. | MASK_INIT | MASK_ON | MASK_ERROR |
NOTE
Debug zones
Windows Embedded CE supports a total of 16 named debug zones, yet not all have to be defined if the module doesn’t require them. Each module uses a separate set of zone names that should clearly reflect the purpose of each implemented zone.
The Dbgapi.h header file defines the DBGPARAM structure and debugging macros. Because these macros use a predefined DBGPARAM variable named dpCurSettings, it is important that you use the same name in your source code as well, as illustrated in the following code snippet.
#include <DBGAPI.H>
// A macro to increase the readability of zone mask definitions
#define DEBUGMASK(n) (0x00000001<<n)
// Definition of zone masks supported in this module
#define MASK_INIT DEBUGMASK(0)
#define MASK_DEINIT DEBUGMASK(1)
#define MASK_ON DEBUGMASK(2)
#define MASK_FAILURE DEBUGMASK(13)
#define MASK_WARNING DEBUGMASK(14)
#define MASK_ERROR DEBUGMASK(15)
// Definition dpCurSettings variable with the initial debug zone state
// set to Failure, Warning, and Error.
DBGPARAM dpCurSettings = {
TEXT("ModuleName"), // Specify the actual module name for clarity!
{
TEXT("Init"), TEXT("Deinit"), TEXT("On"), TEXT("Undefined"),
TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"),
TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"),
TEXT("Undefined"), TEXT("Undefined"), TEXT("Undefined"),
TEXT("Failure"), TEXT("Warning"), TEXT("Error")
},
MASK_INIT | MASK_ON | MASK_ERROR
};
// Main entry point into DLL
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call, LPVOID lpReserved) {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
// Register with the Debug Message service each time
// the DLL is loaded into the address space of a process.
DEBUGREGISTER((HMODULE)hModule);
}
return TRUE;
}
- Debug Zones
- Overriding Debug Zones at Startup
- Using DNSSEC and Signing Zones
- Creating child domains within zones
- Creating child domains in separate zones
- Enabling and Disabling Debug Zones
- ? Enable KITL and Use Debug Zones
- Lab 4: System Debugging and Testing based on KITL, Debug Zones, and CETK Tools