2 * Copyright (C) 2003 Stefan Leichter
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "wine/test.h"
25 static void test_printer_directory(ivoid)
26 { LPBYTE buffer = NULL;
27 DWORD cbBuf, pcbNeeded;
31 ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
32 if(!GetVersionExA( &ver)) {
33 ok( 0, "GetVersionExA failed!");
37 (void) GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, 0, &cbBuf);
39 buffer = HeapAlloc( GetProcessHeap(), 0, cbBuf*2);
41 res = GetPrinterDriverDirectoryA(NULL, NULL, 1, buffer, cbBuf, &pcbNeeded);
42 ok( res, "expected result != 0, got %d", res);
43 ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld",
46 res = GetPrinterDriverDirectoryA(NULL, NULL, 1, buffer, cbBuf*2, &pcbNeeded);
47 ok( res, "expected result != 0, got %d", res);
48 ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld",
51 res = GetPrinterDriverDirectoryA( NULL, NULL, 1, buffer, cbBuf-1, &pcbNeeded);
52 ok( !res , "expected result == 0, got %d", res);
53 ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld",
55 ok( ERROR_INSUFFICIENT_BUFFER == GetLastError(),
56 "last error set to %ld instead of ERROR_INSUFFICIENT_BUFFER",
59 res = GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, cbBuf, &pcbNeeded);
60 if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
61 ok( !res , "expected result == 0, got %d", res);
62 ok( ERROR_INVALID_USER_BUFFER == GetLastError(),
63 "last error set to %ld instead of ERROR_INVALID_USER_BUFFER",
66 ok( res , "expected result != 0, got %d", res);
67 ok( ERROR_INVALID_PARAMETER == GetLastError(),
68 "last error set to %ld instead of ERROR_INVALID_PARAMETER",
72 res = GetPrinterDriverDirectoryA( NULL, NULL, 1, buffer, cbBuf, NULL);
73 if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
74 ok( !res , "expected result == 0, got %d", res);
75 ok( RPC_X_NULL_REF_POINTER == GetLastError(),
76 "last error set to %ld instead of RPC_X_NULL_REF_POINTER",
79 ok( res , "expected result != 0, got %d", res);
82 res = GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, cbBuf, NULL);
83 if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
84 ok( !res , "expected result == 0, got %d", res);
85 ok( RPC_X_NULL_REF_POINTER == GetLastError(),
86 "last error set to %ld instead of RPC_X_NULL_REF_POINTER",
89 ok( res , "expected result != 0, got %d", res);
90 ok( ERROR_INVALID_PARAMETER == GetLastError(),
91 "last error set to %ld instead of ERROR_INVALID_PARAMETER",
95 HeapFree( GetProcessHeap(), 0, buffer);
100 test_printer_directory();