Use CfixCreateSystemThread whenever you need to create a thread from within a kernel mode test case and intend to call cfix APIs (i.e. CFIX_ASSERT etc) on this thread. CfixCreateSystemThread is a wrapper for PsCreateSystemThread with the added functionality that the thread is registered so that cfix can properly relate any assertions etc. raised on this thread to the current test case.
|For user mode tests, use CfixCreateThread2 rather than CfixCreateThread2.|
NTSTATUS CFIXCALLTYPE CfixCreateSystemThread( __out PHANDLE ThreadHandle, __in ULONG DesiredAccess, __in_opt POBJECT_ATTRIBUTES ObjectAttributes, __in_opt HANDLE ProcessHandle, __out_opt PCLIENT_ID ClientId, __in PKSTART_ROUTINE StartRoutine, __in PVOID StartContext, __in ULONG Flags );
[in] Flags: If set to 0, PsCreateSystemThread is called from the current context (i.e. the process context of cfix). If set to CFIX_SYSTEM_THREAD_FLAG_SYSTEM_CONTEXT, PsCreateSystemThread is called from system context.
Invoking PsCreateSystemThread from non-system context is not supported on Windows 2000. Therefore, CFIX_SYSTEM_THREAD_FLAG_SYSTEM_CONTEXT is implied when running on Windows 2000.
See WDK for a discussion of remaining parameters.
If you spawn up a new thread using CfixCreateSystemThread, this thread should terminate before the current test case ends -- otherwise, any further assertions generated by such a thread cannot be properly associated with the test case any more. As of cfix 1.5, this behavior is automatically enforced: After a test case ends, cfix will check the status of all child threads and, if necessary, will wait for their termination before continuing execution.