1 /*
2  * PROJECT:     ReactOS kernel-mode tests
3  * LICENSE:     LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4  * PURPOSE:     Kernel-Mode Test Suite test framework user declarations
5  * COPYRIGHT:   Copyright 2011-2018 Thomas Faber <thomas.faber@reactos.org>
6  */
7 
8 #ifndef _KMTEST_TEST_USER_H_
9 #define _KMTEST_TEST_USER_H_
10 
11 #if !defined _KMTEST_TEST_H_
12 #error include kmt_test.h instead of including kmt_test_user.h
13 #endif /* !defined _KMTEST_TEST_H_ */
14 
15 static PKMT_RESULTBUFFER KmtAllocateResultBuffer(SIZE_T ResultBufferSize)
16 {
17     PKMT_RESULTBUFFER Buffer = HeapAlloc(GetProcessHeap(), 0, ResultBufferSize);
18     if (!Buffer)
19         return NULL;
20 
21     Buffer->Successes = 0;
22     Buffer->Failures = 0;
23     Buffer->Skipped = 0;
24     Buffer->LogBufferLength = 0;
25     Buffer->LogBufferMaxLength = (ULONG)ResultBufferSize - FIELD_OFFSET(KMT_RESULTBUFFER, LogBuffer);
26 
27     return Buffer;
28 }
29 
30 static VOID KmtFreeResultBuffer(PKMT_RESULTBUFFER Buffer)
31 {
32     HeapFree(GetProcessHeap(), 0, Buffer);
33 }
34 
35 #define KmtVSNPrintF vsnprintf
36 
37 #endif /* !defined _KMTEST_TEST_USER_H_ */
38