mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 19:43:56 +00:00
Time to commit some Work-In-Progress stuff before my diff gets too large..
[LOCALSPL] - Begin work on the Local Spooler. Return a structure with function pointers in InitializePrintProvidor. - Design and document internal structures for managing LocalSpl Handles, Printer Handles, Printers, Print Jobs and Print Processors. Manage Printers and Print Processors in Generic Tables, with one Job Queue per Printer managed as a Doubly Linked List. - Implement LocalOpenPrinter, LocalEnumPrintProcessorDatatypes, LocalEnumPrintProcessors, LocalGetPrintProcessorDirectory, with focus on catching all corner cases. Currently working on LocalStartDocPrinter. - Build upon the documentation at http://www.undocprint.org/formats/winspool/shd to read and write .SHD files. [WINPRINT] Begin work on the Standard Print Processor. Implement EnumPrintProcessorDatatypesW. [WINSPOOL_APITEST] Add an API Test for winspool.drv, currently testing some corner cases of ClosePrinter, EnumPrintProcessorDatatypesW, GetPrintProcessorDirectoryW, OpenPrinterW, StartDocPrinterW. TODO: Find a way to actually test the localspl.dll functions instead of only winspool.drv. This DLL doesn't like to be tested standalone under Windows, e.g. without being used through spoolsv/spoolss. [SPOOLSS] Implement InitializeRouter by calling the InitializePrintProvidor function of localspl there. This function should later also initialize further Print Providers. [SPOOLSV] Call InitializeRouter when starting up the service. [WINSPOOL] Add dummy functions for EnumPrintProcessorDatatypesA/EnumPrintProcessorDatatypesW. [All modules] Fix printf format specifiers for errors (%lu) and statuses (%ld). svn path=/branches/colins-printing-for-freedom/; revision=67847
This commit is contained in:
parent
9a3f634ff7
commit
beaa69af38
27 changed files with 2413 additions and 43 deletions
|
@ -24,4 +24,5 @@ if(NOT ARCH STREQUAL "amd64")
|
|||
endif()
|
||||
add_subdirectory(winhttp)
|
||||
add_subdirectory(wininet)
|
||||
add_subdirectory(winspool)
|
||||
add_subdirectory(ws2_32)
|
||||
|
|
14
rostests/apitests/winspool/CMakeLists.txt
Normal file
14
rostests/apitests/winspool/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
list(APPEND SOURCE
|
||||
ClosePrinter.c
|
||||
EnumPrintProcessorDatatypes.c
|
||||
GetPrintProcessorDirectory.c
|
||||
OpenPrinter.c
|
||||
StartDocPrinter.c
|
||||
testlist.c)
|
||||
|
||||
add_executable(winspool_apitest ${SOURCE})
|
||||
target_link_libraries(winspool_apitest wine ${PSEH_LIB})
|
||||
set_module_type(winspool_apitest win32cui)
|
||||
add_importlibs(winspool_apitest winspool msvcrt kernel32 ntdll)
|
||||
add_cd_file(TARGET winspool_apitest DESTINATION reactos/bin FOR all)
|
21
rostests/apitests/winspool/ClosePrinter.c
Normal file
21
rostests/apitests/winspool/ClosePrinter.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Print Spooler DLL API Tests
|
||||
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||
* PURPOSE: Tests for ClosePrinter
|
||||
* COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wingdi.h>
|
||||
#include <winspool.h>
|
||||
|
||||
START_TEST(ClosePrinter)
|
||||
{
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!ClosePrinter(NULL), "ClosePrinter returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "ClosePrinter returns error %lu!\n", GetLastError());
|
||||
}
|
71
rostests/apitests/winspool/EnumPrintProcessorDatatypes.c
Normal file
71
rostests/apitests/winspool/EnumPrintProcessorDatatypes.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Print Spooler DLL API Tests
|
||||
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||
* PURPOSE: Tests for EnumPrintProcessorDatatypesA/EnumPrintProcessorDatatypesW
|
||||
* COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wingdi.h>
|
||||
#include <winspool.h>
|
||||
|
||||
START_TEST(EnumPrintProcessorDatatypes)
|
||||
{
|
||||
DWORD cbNeeded;
|
||||
DWORD dwReturned;
|
||||
PDATATYPES_INFO_1W pDatatypesInfo1;
|
||||
|
||||
// Try with an invalid level, this needs to be caught first.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!EnumPrintProcessorDatatypesW(NULL, NULL, 0, NULL, 0, NULL, NULL), "EnumPrintProcessorDatatypesW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_LEVEL, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Now try with valid level, but no pcbNeeded and no pcReturned.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!EnumPrintProcessorDatatypesW(NULL, NULL, 1, NULL, 0, NULL, NULL), "EnumPrintProcessorDatatypesW returns TRUE!\n");
|
||||
ok(GetLastError() == RPC_X_NULL_REF_POINTER, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Now try with pcbNeeded and pcReturned, but give no Print Processor.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!EnumPrintProcessorDatatypesW(NULL, NULL, 1, NULL, 0, &cbNeeded, &dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_UNKNOWN_PRINTPROCESSOR, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Same error has to occur when looking for an invalid Print Processor.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!EnumPrintProcessorDatatypesW(NULL, L"invalid", 1, NULL, 0, &cbNeeded, &dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_UNKNOWN_PRINTPROCESSOR, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Now get the required buffer size by supplying all information. This needs to fail with ERROR_INSUFFICIENT_BUFFER.
|
||||
// This also verifies that the function is really doing a case-insensitive lookup.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!EnumPrintProcessorDatatypesW(NULL, L"wInPrInT", 1, NULL, 0, &cbNeeded, &dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
ok(cbNeeded > 0, "cbNeeded is 0!\n");
|
||||
ok(dwReturned > 0, "dwReturned is 0!\n");
|
||||
|
||||
// Now provide the demanded size, but no buffer.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!EnumPrintProcessorDatatypesW(NULL, L"wInPrInT", 1, NULL, cbNeeded, &cbNeeded, &dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
|
||||
// This also has to fail the same way when no Print Processor was given at all.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!EnumPrintProcessorDatatypesW(NULL, NULL, 1, NULL, cbNeeded, &cbNeeded, &dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Same error has to occur with a valid Print Processor, but a size too small.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!EnumPrintProcessorDatatypesW(NULL, L"wInPrInT", 1, NULL, cbNeeded, &cbNeeded, &dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Finally use the function as intended and aim for success!
|
||||
pDatatypesInfo1 = HeapAlloc(GetProcessHeap(), 0, cbNeeded);
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(EnumPrintProcessorDatatypesW(NULL, L"wInPrInT", 1, (PBYTE)pDatatypesInfo1, cbNeeded, &cbNeeded, &dwReturned), "EnumPrintProcessorDatatypesW returns FALSE!\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "EnumPrintProcessorDatatypesW returns error %lu!\n", GetLastError());
|
||||
HeapFree(GetProcessHeap(), 0, pDatatypesInfo1);
|
||||
}
|
58
rostests/apitests/winspool/GetPrintProcessorDirectory.c
Normal file
58
rostests/apitests/winspool/GetPrintProcessorDirectory.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Print Spooler DLL API Tests
|
||||
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||
* PURPOSE: Tests for GetPrintProcessorDirectoryA/GetPrintProcessorDirectoryW
|
||||
* COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wingdi.h>
|
||||
#include <winspool.h>
|
||||
|
||||
START_TEST(GetPrintProcessorDirectory)
|
||||
{
|
||||
DWORD cbNeeded;
|
||||
PWSTR pwszBuffer;
|
||||
|
||||
// Try with an invalid level, this needs to be caught first.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!GetPrintProcessorDirectoryW(NULL, NULL, 0, NULL, 0, NULL), "GetPrintProcessorDirectoryW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_LEVEL, "GetPrintProcessorDirectoryW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Now try with valid level, but no pcbNeeded.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!GetPrintProcessorDirectoryW(NULL, NULL, 1, NULL, 0, NULL), "GetPrintProcessorDirectoryW returns TRUE!\n");
|
||||
ok(GetLastError() == RPC_X_NULL_REF_POINTER, "GetPrintProcessorDirectoryW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Now get the required buffer size by supplying pcbNeeded. This needs to fail with ERROR_INSUFFICIENT_BUFFER.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!GetPrintProcessorDirectoryW(NULL, NULL, 1, NULL, 0, &cbNeeded), "GetPrintProcessorDirectoryW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetPrintProcessorDirectoryW returns error %lu!\n", GetLastError());
|
||||
ok(cbNeeded > 0, "cbNeeded is 0!\n");
|
||||
|
||||
// Now provide the demanded size, but no buffer.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!GetPrintProcessorDirectoryW(NULL, NULL, 1, NULL, cbNeeded, &cbNeeded), "GetPrintProcessorDirectoryW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "GetPrintProcessorDirectoryW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Same error has to occur with a size too small.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!GetPrintProcessorDirectoryW(NULL, NULL, 1, NULL, 1, &cbNeeded), "GetPrintProcessorDirectoryW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "GetPrintProcessorDirectoryW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Try with an invalid environment as well.
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!GetPrintProcessorDirectoryW(NULL, L"invalid", 1, NULL, 0, &cbNeeded), "GetPrintProcessorDirectoryW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_ENVIRONMENT, "GetPrintProcessorDirectoryW returns error %lu!\n", GetLastError());
|
||||
|
||||
// Finally use the function as intended and aim for success!
|
||||
pwszBuffer = HeapAlloc(GetProcessHeap(), 0, cbNeeded);
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(GetPrintProcessorDirectoryW(NULL, NULL, 1, (PBYTE)pwszBuffer, cbNeeded, &cbNeeded), "GetPrintProcessorDirectoryW returns FALSE!\n");
|
||||
ok(GetLastError() == ERROR_SUCCESS, "GetPrintProcessorDirectoryW returns error %lu!\n", GetLastError());
|
||||
HeapFree(GetProcessHeap(), 0, pwszBuffer);
|
||||
}
|
27
rostests/apitests/winspool/OpenPrinter.c
Normal file
27
rostests/apitests/winspool/OpenPrinter.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Print Spooler DLL API Tests
|
||||
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||
* PURPOSE: Tests for OpenPrinterA/OpenPrinterW
|
||||
* COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wingdi.h>
|
||||
#include <winspool.h>
|
||||
|
||||
START_TEST(OpenPrinter)
|
||||
{
|
||||
HANDLE hPrinter;
|
||||
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!OpenPrinterW(NULL, NULL, NULL), "OpenPrinterW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "OpenPrinterW returns error %lu!\n", GetLastError());
|
||||
|
||||
SetLastError(0xDEADBEEF);
|
||||
ok(!OpenPrinterW(NULL, &hPrinter, NULL), "OpenPrinterW returns TRUE!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "OpenPrinterW returns error %lu!\n", GetLastError());
|
||||
}
|
42
rostests/apitests/winspool/StartDocPrinter.c
Normal file
42
rostests/apitests/winspool/StartDocPrinter.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Print Spooler DLL API Tests
|
||||
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||
* PURPOSE: Tests for StartDocPrinterA/StartDocPrinterW
|
||||
* COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wingdi.h>
|
||||
#include <winspool.h>
|
||||
|
||||
START_TEST(StartDocPrinter)
|
||||
{
|
||||
DWORD dwResult;
|
||||
DOCINFOW docInfo = { 0 };
|
||||
|
||||
SetLastError(0xDEADBEEF);
|
||||
dwResult = StartDocPrinterW(NULL, 0, NULL);
|
||||
ok(dwResult == 0, "StartDocPrinterW returns %lu!\n", dwResult);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "StartDocPrinter returns error %lu!\n", GetLastError());
|
||||
|
||||
SetLastError(0xDEADBEEF);
|
||||
dwResult = StartDocPrinterW(NULL, 1, NULL);
|
||||
ok(dwResult == 0, "StartDocPrinterW returns %lu!\n", dwResult);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "StartDocPrinter returns error %lu!\n", GetLastError());
|
||||
|
||||
SetLastError(0xDEADBEEF);
|
||||
dwResult = StartDocPrinterW(NULL, 0, (LPBYTE)&docInfo);
|
||||
ok(dwResult == 0, "StartDocPrinterW returns %lu!\n", dwResult);
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "StartDocPrinter returns error %lu!\n", GetLastError());
|
||||
|
||||
SetLastError(0xDEADBEEF);
|
||||
dwResult = StartDocPrinterW(NULL, 1, (LPBYTE)&docInfo);
|
||||
ok(dwResult == 0, "StartDocPrinterW returns %lu!\n", dwResult);
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "StartDocPrinter returns error %lu!\n", GetLastError());
|
||||
|
||||
/// ERROR_INVALID_LEVEL with correct handle but invalid Level
|
||||
}
|
28
rostests/apitests/winspool/testlist.c
Normal file
28
rostests/apitests/winspool/testlist.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Print Spooler DLL API Tests
|
||||
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||
* PURPOSE: Test list
|
||||
* COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
||||
*/
|
||||
|
||||
#define __ROS_LONG64__
|
||||
|
||||
#define STANDALONE
|
||||
#include <apitest.h>
|
||||
|
||||
extern void func_ClosePrinter(void);
|
||||
extern void func_EnumPrintProcessorDatatypes(void);
|
||||
extern void func_GetPrintProcessorDirectory(void);
|
||||
extern void func_OpenPrinter(void);
|
||||
extern void func_StartDocPrinter(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "ClosePrinter", func_ClosePrinter },
|
||||
{ "EnumPrintProcessorDatatypes", func_EnumPrintProcessorDatatypes },
|
||||
{ "GetPrintProcessorDirectory", func_GetPrintProcessorDirectory },
|
||||
{ "OpenPrinter", func_OpenPrinter },
|
||||
{ "StartDocPrinter", func_StartDocPrinter },
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue