ReactOS 0.4.15-dev-7942-gd23573b
MarshallUpStructuresArray.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Spooler Router API Tests
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Tests for MarshallUpStructuresArray
5 * COPYRIGHT: Copyright 2018 Colin Finck (colin@reactos.org)
6 */
7
8#include <apitest.h>
9
10#define WIN32_NO_STATUS
11#include <windef.h>
12#include <winbase.h>
14
15#define INVALID_POINTER ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL)
16
18{
19 // Setting cElements to zero should yield success.
20 SetLastError(0xDEADBEEF);
21 ok(MarshallUpStructuresArray(0, NULL, 0, NULL, 0, FALSE), "MarshallUpStructuresArray returns FALSE!\n");
22 ok(GetLastError() == 0xDEADBEEF, "GetLastError returns %lu!\n", GetLastError());
23
24 // Setting cElements non-zero should fail with ERROR_INVALID_PARAMETER.
25 SetLastError(0xDEADBEEF);
26 ok(!MarshallUpStructuresArray(0, NULL, 1, NULL, 0, FALSE), "MarshallUpStructuresArray returns TRUE!\n");
27 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError returns %lu!\n", GetLastError());
28
29 // This is triggered by both pStructuresArray and pInfo.
30 SetLastError(0xDEADBEEF);
31 ok(!MarshallUpStructuresArray(0, INVALID_POINTER, 1, NULL, 0, FALSE), "MarshallUpStructuresArray returns TRUE!\n");
32 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError returns %lu!\n", GetLastError());
33
34 SetLastError(0xDEADBEEF);
35 ok(!MarshallUpStructuresArray(0, NULL, 1, (const MARSHALLING_INFO*)INVALID_POINTER, 0, FALSE), "MarshallUpStructuresArray returns TRUE!\n");
36 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError returns %lu!\n", GetLastError());
37
38 // More testing is conducted in the MarshallDownStructuresArray test.
39}
#define INVALID_POINTER
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
BOOL WINAPI MarshallUpStructuresArray(DWORD cbSize, PVOID pStructuresArray, DWORD cElements, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
Definition: marshalling.c:202
DWORD WINAPI GetLastError(void)
Definition: except.c:1042