Author: cfinck
Date: Sun May 24 16:55:20 2015
New Revision: 67884
URL:
http://svn.reactos.org/svn/reactos?rev=67884&view=rev
Log:
[WINSPOOL_APITEST]
Make the tests actually succeed under Windows Server 2003.
Modified:
branches/colins-printing-for-freedom/rostests/apitests/winspool/EnumPrintProcessorDatatypes.c
branches/colins-printing-for-freedom/rostests/apitests/winspool/GetPrintProcessorDirectory.c
branches/colins-printing-for-freedom/rostests/apitests/winspool/OpenPrinter.c
branches/colins-printing-for-freedom/rostests/apitests/winspool/StartDocPrinter.c
Modified:
branches/colins-printing-for-freedom/rostests/apitests/winspool/EnumPrintProcessorDatatypes.c
URL:
http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/ros…
==============================================================================
---
branches/colins-printing-for-freedom/rostests/apitests/winspool/EnumPrintProcessorDatatypes.c [iso-8859-1]
(original)
+++
branches/colins-printing-for-freedom/rostests/apitests/winspool/EnumPrintProcessorDatatypes.c [iso-8859-1]
Sun May 24 16:55:20 2015
@@ -16,6 +16,7 @@
START_TEST(EnumPrintProcessorDatatypes)
{
DWORD cbNeeded;
+ DWORD cbTemp;
DWORD dwReturned;
PDATATYPES_INFO_1W pDatatypesInfo1;
@@ -45,22 +46,28 @@
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");
+ ok(dwReturned == 0, "dwReturned is %lu!\n", dwReturned);
// 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(!EnumPrintProcessorDatatypesW(NULL, L"wInPrInT", 1, NULL, cbNeeded,
&cbTemp, &dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "EnumPrintProcessorDatatypesW
returns error %lu!\n", GetLastError());
+ ok(cbTemp == 0, "cbTemp is %lu!\n", cbTemp);
+ ok(dwReturned == 0, "dwReturned is %lu!\n", dwReturned);
// 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(!EnumPrintProcessorDatatypesW(NULL, NULL, 1, NULL, cbNeeded, &cbTemp,
&dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "EnumPrintProcessorDatatypesW
returns error %lu!\n", GetLastError());
+ ok(cbTemp == 0, "cbTemp is %lu!\n", cbTemp);
+ ok(dwReturned == 0, "dwReturned is %lu!\n", dwReturned);
// 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(!EnumPrintProcessorDatatypesW(NULL, L"wInPrInT", 1, NULL, cbNeeded,
&cbTemp, &dwReturned), "EnumPrintProcessorDatatypesW returns TRUE!\n");
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "EnumPrintProcessorDatatypesW
returns error %lu!\n", GetLastError());
+ ok(cbTemp == 0, "cbTemp is %lu!\n", cbTemp);
+ ok(dwReturned == 0, "dwReturned is %lu!\n", dwReturned);
// Finally use the function as intended and aim for success!
pDatatypesInfo1 = HeapAlloc(GetProcessHeap(), 0, cbNeeded);
Modified:
branches/colins-printing-for-freedom/rostests/apitests/winspool/GetPrintProcessorDirectory.c
URL:
http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/ros…
==============================================================================
---
branches/colins-printing-for-freedom/rostests/apitests/winspool/GetPrintProcessorDirectory.c [iso-8859-1]
(original)
+++
branches/colins-printing-for-freedom/rostests/apitests/winspool/GetPrintProcessorDirectory.c [iso-8859-1]
Sun May 24 16:55:20 2015
@@ -16,6 +16,7 @@
START_TEST(GetPrintProcessorDirectory)
{
DWORD cbNeeded;
+ DWORD cbTemp;
PWSTR pwszBuffer;
// Try with an invalid level, this needs to be caught first.
@@ -28,6 +29,12 @@
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());
+ // 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());
+ ok(cbNeeded == 0, "cbNeeded is %lu!\n", cbNeeded);
+
// 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");
@@ -36,18 +43,15 @@
// Now provide the demanded size, but no buffer.
SetLastError(0xDEADBEEF);
- ok(!GetPrintProcessorDirectoryW(NULL, NULL, 1, NULL, cbNeeded, &cbNeeded),
"GetPrintProcessorDirectoryW returns TRUE!\n");
+ ok(!GetPrintProcessorDirectoryW(NULL, NULL, 1, NULL, cbNeeded, &cbTemp),
"GetPrintProcessorDirectoryW returns TRUE!\n");
ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "GetPrintProcessorDirectoryW
returns error %lu!\n", GetLastError());
+ ok(cbTemp == 0, "cbNeeded is %lu!\n", cbNeeded);
// 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(!GetPrintProcessorDirectoryW(NULL, NULL, 1, NULL, 1, &cbTemp),
"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());
+ ok(cbTemp == 0, "cbNeeded is %lu!\n", cbNeeded);
// Finally use the function as intended and aim for success!
pwszBuffer = HeapAlloc(GetProcessHeap(), 0, cbNeeded);
Modified: branches/colins-printing-for-freedom/rostests/apitests/winspool/OpenPrinter.c
URL:
http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/ros…
==============================================================================
---
branches/colins-printing-for-freedom/rostests/apitests/winspool/OpenPrinter.c [iso-8859-1]
(original)
+++
branches/colins-printing-for-freedom/rostests/apitests/winspool/OpenPrinter.c [iso-8859-1]
Sun May 24 16:55:20 2015
@@ -17,11 +17,14 @@
{
HANDLE hPrinter;
+ // Give no handle at all, this has to fail
SetLastError(0xDEADBEEF);
ok(!OpenPrinterW(NULL, NULL, NULL), "OpenPrinterW returns TRUE!\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "OpenPrinterW returns error
%lu!\n", GetLastError());
+ // Open a handle to the local print server
SetLastError(0xDEADBEEF);
- ok(!OpenPrinterW(NULL, &hPrinter, NULL), "OpenPrinterW returns
TRUE!\n");
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "OpenPrinterW returns error
%lu!\n", GetLastError());
+ ok(OpenPrinterW(NULL, &hPrinter, NULL), "OpenPrinterW returns
FALSE!\n");
+ ok(GetLastError() == ERROR_SUCCESS, "OpenPrinterW returns error %lu!\n",
GetLastError());
+ ClosePrinter(hPrinter);
}
Modified:
branches/colins-printing-for-freedom/rostests/apitests/winspool/StartDocPrinter.c
URL:
http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/ros…
==============================================================================
---
branches/colins-printing-for-freedom/rostests/apitests/winspool/StartDocPrinter.c [iso-8859-1]
(original)
+++
branches/colins-printing-for-freedom/rostests/apitests/winspool/StartDocPrinter.c [iso-8859-1]
Sun May 24 16:55:20 2015
@@ -21,12 +21,12 @@
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());
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "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());
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "StartDocPrinter returns error
%lu!\n", GetLastError());
SetLastError(0xDEADBEEF);
dwResult = StartDocPrinterW(NULL, 0, (LPBYTE)&docInfo);