Configuration
[This is preliminary documentation and subject to change.]
When a client "xyz" calls TraceRegister(), the tracing DLL looks under the registry key
\SYSTEM\CURRENTCONTROLSET\SERVICES\TRACING\XYZ
for the following values:
-
EnableConsoleTracing: this is a REG_DWORD that defaults to 1; this enables tracing to the console if non-zero.
-
EnableFileTracing: this is a REG_DWORD that defaults to 1; this enables tracing to a file named XYZ.LOG if non-zero.
-
ConsoleTracingMask: this is a REG_DWORD that defaults to 0xFFFF0000; the bits in the high-order word correspond to components in the client. If a call to one of the extended output functions has the flag TRACE_USE_MASK set, this registry value is compared against the high-order word of the flag passed to the output function, to decide whether or not to send the output to the console.
-
FileTracingMask: this is a REG_DWORD that defaults to 0xFFFF0000; it operates similarly to ConsoleTracingMask.
-
MaxFileSize: this is a REG_DWORD that defaults to 0x10000; this is the maximum size a tracing file can grow to before it is renamed.
-
FileDirectory: this is a REG_EXPAND_SZ that defaults to %WINDIR%\TRACING; this is the directory in which the tracing file is created.
The defaults are used only if the key is found (or can be created) but some values are absent from the key. If the registry key is not found and cannot be created, the call to TraceRegister() fails.
Alternatively, a client "xyz" could call TraceRegisterEx(), which takes a flag allowing the caller to specify the settings to use. Thus, a client could use the tracing DLL without creating any key in the registry. For instance,
TraceRegisterEx("xyz", TRACE_USE_CONSOLE);
would register the client "xyz" to use the console for tracing, and the tracing DLL would not attempt to read the registry at all. Similarly,
TraceRegisterEx("abc", TRACE_USE_FILE);
would register the client "abc" to use a file for tracing, bypassing the registry.