Visual Assert – The Unit Testing Add-In for Visual C++
cfix – C/C++ Unit Testing for Win32 and NT
 
 

CfixCreateSystemThread

CfixCreateSystemThread

Synopsis

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.

[Note]Note
For user mode tests, use CfixCreateThread2 rather than CfixCreateThread2.
Declaration
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
    );
				
Parameters

[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.

Remarks

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.

Requirements

Table 7.16. 

 User ModeKernel Mode
Available sinceNot supported1.5
HeaderNot supportedDeclared in cfix.h
LibraryNot supportedLink to cfixkdrv.lib
IRQLN/ACallable at PASSIVE_LEVEL