BullseyeCoverage Up Contents Search

Windows Kernel Mode

To comply with driver package isolation requirements, all files accessed by BullseyeCoverage at run-time are located on the target system in the directory DriverData\BullseyeCoverage. The DriverData directory is accessed in user mode with the %DriverData% environment variable and in kernel mode with the \DriverData symbolic link.

Create the directory DriverData\BullseyeCoverage at the command prompt in administrator mode:

C:\>cd %DriverData%
C:\Windows\System32\drivers\DriverData>mkdir BullseyeCoverage

Copy the coverage file from the host system to this directory whenever you install your driver.

The BullseyeCoverage run-time searches for environment variables in the file DriverData\BullseyeCoverage\env.txt, if it exists. This ASCII file has the format below.

name1=value1
name2=value2

Filenames are relative to the DriverData\BullseyeCoverage directory. For example, COVFILE=test1.cov means DriverData\BullseyeCoverage\test1.cov. Do not specify an absolute path for any filename.

The default value for COVFILE is test.cov which means DriverData\BullseyeCoverage\test.cov.

Run-time error messages are normally displayed in the host debugger Command window (using the kernel mode support routine DbgPrintEx). If no debugger is connected and environment variable COVERR is unset, run-time error messages are lost.

Your entry point function name must end with DriverEntry. For example, DriverEntry, FxDriverEntry, or GsDriverEntry.

Native Mode

Because native mode drivers may run before the \DriverData symbolic link is established, if files cannot be found as described above, the run-time looks for them relative to the root directory of the first volume. Each partition \Device\Harddisk0\PartitionN is checked, where N is 1 to 9.

Export Drivers

For an export driver, you must add a call to the BullseyeCoverage run-time function cov_term in your DllUnload function. For example:

void __cdecl cov_term(void);
NTSTATUS DllUnload()
{
    #if _BullseyeCoverage
        cov_term();
    #endif
    return STATUS_SUCCESS;
}

Updated: 7 May 2025