Reactos
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>
13#include <marshalling/marshalling.h>
14
15#define INVALID_POINTER ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL)
16
17START_TEST(MarshallUpStructuresArray)
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}