Hello, here are some tests for GetPrinterDriverDirectoryA. They should pass on NT4 and hopefully win95 too. Thanks to Francois Gouget for testing. Stefan ChangeLog ------------- added tests for GetPrinterDriverDirectoryA Index: configure.ac =================================================================== RCS file: /home/wine/wine/configure.ac,v retrieving revision 1.116 diff -u -r1.116 configure.ac --- configure.ac 4 Jan 2003 02:52:05 -0000 1.116 +++ configure.ac 5 Jan 2003 16:05:33 -0000 @@ -1472,6 +1472,7 @@ dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile +dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile Index: dlls/winspool/Makefile.in =================================================================== RCS file: /home/wine/wine/dlls/winspool/Makefile.in,v retrieving revision 1.22 diff -u -r1.22 Makefile.in --- dlls/winspool/Makefile.in 12 Nov 2002 02:22:24 -0000 1.22 +++ dlls/winspool/Makefile.in 5 Jan 2003 16:07:17 -0000 @@ -13,6 +13,8 @@ info.c \ wspool.c +SUBDIRS = tests + @MAKE_DLL_RULES@ ### Dependencies: --- /dev/null Mon Sep 24 03:54:15 2001 +++ dlls/winspool/tests/Makefile.in Sun Jan 5 16:56:25 2003 @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = winspool.drv +IMPORTS = winspool kernel32 ntdll + +CTESTS = \ + info.c + +@MAKE_TEST_RULES@ + +### Dependencies: --- /dev/null Mon Sep 24 03:54:15 2001 +++ dlls/winspool/tests/info.c Tue Jan 7 10:25:05 2003 @@ -0,0 +1,83 @@ +#include "wine/test.h" +#include "winbase.h" +#include "winerror.h" +#include "wingdi.h" +#include "winspool.h" + +static void test_printer_directory(ivoid) +{ LPBYTE buffer = NULL; + DWORD cbBuf, pcbNeeded; + BOOL res; + OSVERSIONINFOA ver; + + ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); + if(!GetVersionExA( &ver)) { + ok( 0, "GetVersionExA failed!"); + return ; + } + + (void) GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, 0, &cbBuf); + + buffer = HeapAlloc( GetProcessHeap(), 0, cbBuf*2); + + res = GetPrinterDriverDirectoryA(NULL, NULL, 1, buffer, cbBuf, &pcbNeeded); + ok( res, "expected result != 0, got %d", res); + ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld", + pcbNeeded, cbBuf); + + res = GetPrinterDriverDirectoryA(NULL, NULL, 1, buffer, cbBuf*2, &pcbNeeded); + ok( res, "expected result != 0, got %d", res); + ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld", + pcbNeeded, cbBuf); + + res = GetPrinterDriverDirectoryA( NULL, NULL, 1, buffer, cbBuf-1, &pcbNeeded); + ok( !res , "expected result == 0, got %d", res); + ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld", + pcbNeeded, cbBuf); + ok( ERROR_INSUFFICIENT_BUFFER == GetLastError(), + "last error set to %ld instead of ERROR_INSUFFICIENT_BUFFER", + GetLastError()); + + res = GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, cbBuf, &pcbNeeded); + if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + ok( !res , "expected result == 0, got %d", res); + ok( ERROR_INVALID_USER_BUFFER == GetLastError(), + "last error set to %ld instead of ERROR_INVALID_USER_BUFFER", + GetLastError()); + } else { + ok( res , "expected result != 0, got %d", res); + ok( ERROR_INVALID_PARAMETER == GetLastError(), + "last error set to %ld instead of ERROR_INVALID_PARAMETER", + GetLastError()); + } + + res = GetPrinterDriverDirectoryA( NULL, NULL, 1, buffer, cbBuf, NULL); + if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + ok( !res , "expected result == 0, got %d", res); + ok( RPC_X_NULL_REF_POINTER == GetLastError(), + "last error set to %ld instead of RPC_X_NULL_REF_POINTER", + GetLastError()); + } else { + ok( res , "expected result != 0, got %d", res); + } + + res = GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, cbBuf, NULL); + if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + ok( !res , "expected result == 0, got %d", res); + ok( RPC_X_NULL_REF_POINTER == GetLastError(), + "last error set to %ld instead of RPC_X_NULL_REF_POINTER", + GetLastError()); + } else { + ok( res , "expected result != 0, got %d", res); + ok( ERROR_INVALID_PARAMETER == GetLastError(), + "last error set to %ld instead of ERROR_INVALID_PARAMETER", + GetLastError()); + } + + HeapFree( GetProcessHeap(), 0, buffer); +} + +START_TEST(info) +{ + test_printer_directory(); +}