reactos/modules/rostests/apitests/spoolss/MarshallUpStructuresArray.c
Colin Finck f3ea8225cb [PRINTING] Implement the undocumented MarshallDownStructure, MarshallDownStructuresArray, MarshallUpStructure, and MarshallUpStructuresArray to the extent I need and could find out through black-box testing.
PDBs reveal that these functions are also used in winspool.drv, but not imported from spoolss.dll to retain the client/server architecture.
As winspool.drv highly benefits from the MarshallUp* functions, I put them in a source file shared between spoolss.dll and winspool.drv.

The added API Tests cover my testing and all implemented features.
One more item done from https://reactos.org/wiki/Printing !
2018-01-17 10:13:25 +01:00

38 lines
1.6 KiB
C

/*
* PROJECT: ReactOS Spooler Router API Tests
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Tests for MarshallUpStructuresArray
* COPYRIGHT: Copyright 2018 Colin Finck (colin@reactos.org)
*/
#include <apitest.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <marshalling/marshalling.h>
START_TEST(MarshallUpStructuresArray)
{
// Setting cElements to zero should yield success.
SetLastError(0xDEADBEEF);
ok(MarshallUpStructuresArray(0, NULL, 0, NULL, 0, FALSE), "MarshallUpStructuresArray returns FALSE!\n");
ok(GetLastError() == 0xDEADBEEF, "GetLastError returns %lu!\n", GetLastError());
// Setting cElements non-zero should fail with ERROR_INVALID_PARAMETER.
SetLastError(0xDEADBEEF);
ok(!MarshallUpStructuresArray(0, NULL, 1, NULL, 0, FALSE), "MarshallUpStructuresArray returns TRUE!\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError returns %lu!\n", GetLastError());
// This is triggered by both pStructuresArray and pInfo.
SetLastError(0xDEADBEEF);
ok(!MarshallUpStructuresArray(0, (PVOID)0xDEADDEAD, 1, NULL, 0, FALSE), "MarshallUpStructuresArray returns TRUE!\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError returns %lu!\n", GetLastError());
SetLastError(0xDEADBEEF);
ok(!MarshallUpStructuresArray(0, NULL, 1, (const MARSHALLING_INFO*)0xDEADDEAD, 0, FALSE), "MarshallUpStructuresArray returns TRUE!\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError returns %lu!\n", GetLastError());
// More testing is conducted in the MarshallDownStructuresArray test.
}