Commit 366f452b authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

winspool: Empty string as environment is valid, with tests.

parent c30ac077
...@@ -204,6 +204,7 @@ static DWORD WINSPOOL_GetOpenedPrinterRegKey(HANDLE hPrinter, HKEY *phkey); ...@@ -204,6 +204,7 @@ static DWORD WINSPOOL_GetOpenedPrinterRegKey(HANDLE hPrinter, HKEY *phkey);
* Success: PTR to printenv_t * Success: PTR to printenv_t
* *
* NOTES * NOTES
* An empty string is handled the same way as NULL.
* SetLastEror(ERROR_INVALID_ENVIRONMENT) is called on Failure * SetLastEror(ERROR_INVALID_ENVIRONMENT) is called on Failure
* *
*/ */
...@@ -218,7 +219,7 @@ static const printenv_t * validate_envW(LPCWSTR env) ...@@ -218,7 +219,7 @@ static const printenv_t * validate_envW(LPCWSTR env)
unsigned int i; unsigned int i;
TRACE("testing %s\n", debugstr_w(env)); TRACE("testing %s\n", debugstr_w(env));
if (env) if (env && env[0])
{ {
for (i = 0; i < sizeof(all_printenv)/sizeof(all_printenv[0]); i++) for (i = 0; i < sizeof(all_printenv)/sizeof(all_printenv[0]); i++)
{ {
...@@ -3399,9 +3400,7 @@ BOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, ...@@ -3399,9 +3400,7 @@ BOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment,
* "%winsysdir%" is the Value from GetSystemDirectoryW() * "%winsysdir%" is the Value from GetSystemDirectoryW()
* *
* FIXME * FIXME
*- pName != NULL not supported *- Only NULL or "" is supported for pName
*- pEnvironment != NULL not supported
*- Current Implementation returns always "%winsysdir%"
* *
*/ */
BOOL WINAPI GetPrinterDriverDirectoryW(LPWSTR pName, LPWSTR pEnvironment, BOOL WINAPI GetPrinterDriverDirectoryW(LPWSTR pName, LPWSTR pEnvironment,
...@@ -3413,7 +3412,7 @@ BOOL WINAPI GetPrinterDriverDirectoryW(LPWSTR pName, LPWSTR pEnvironment, ...@@ -3413,7 +3412,7 @@ BOOL WINAPI GetPrinterDriverDirectoryW(LPWSTR pName, LPWSTR pEnvironment,
TRACE("(%s, %s, %ld, %p, %ld, %p)\n", debugstr_w(pName), TRACE("(%s, %s, %ld, %p, %ld, %p)\n", debugstr_w(pName),
debugstr_w(pEnvironment), Level, pDriverDirectory, cbBuf, pcbNeeded); debugstr_w(pEnvironment), Level, pDriverDirectory, cbBuf, pcbNeeded);
if(pName != NULL) { if(pName != NULL && pName[0]) {
FIXME("pName unsupported: %s\n", debugstr_w(pName)); FIXME("pName unsupported: %s\n", debugstr_w(pName));
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
......
...@@ -94,7 +94,7 @@ static LPSTR find_default_printer(VOID) ...@@ -94,7 +94,7 @@ static LPSTR find_default_printer(VOID)
} }
static void test_default_printer(void) static void test_GetDefaultPrinter(void)
{ {
BOOL retval; BOOL retval;
DWORD exact = DEFAULT_PRINTER_SIZE; DWORD exact = DEFAULT_PRINTER_SIZE;
...@@ -171,8 +171,9 @@ static void test_default_printer(void) ...@@ -171,8 +171,9 @@ static void test_default_printer(void)
exact, size); exact, size);
} }
static void test_printer_directory(void) static void test_GetPrinterDriverDirectory(void)
{ LPBYTE buffer = NULL; {
LPBYTE buffer = NULL;
DWORD cbBuf = 0, pcbNeeded = 0; DWORD cbBuf = 0, pcbNeeded = 0;
BOOL res; BOOL res;
...@@ -305,10 +306,23 @@ static void test_printer_directory(void) ...@@ -305,10 +306,23 @@ static void test_printer_directory(void)
"'len > 0' or '0' with ERROR_INVALID_ENVIRONMENT)\n", "'len > 0' or '0' with ERROR_INVALID_ENVIRONMENT)\n",
res, GetLastError(), lstrlenA((char *)buffer)); res, GetLastError(), lstrlenA((char *)buffer));
/* A Setup-Programm (PDFCreator_0.8.0) use empty strings */
SetLastError(MAGIC_DEAD);
res = GetPrinterDriverDirectoryA("", "", 1, buffer, cbBuf*2, &pcbNeeded);
ok(res, "returned %d with %ld (expected '!=0')\n", res, GetLastError() );
SetLastError(MAGIC_DEAD);
res = GetPrinterDriverDirectoryA(NULL, "", 1, buffer, cbBuf*2, &pcbNeeded);
ok(res, "returned %d with %ld (expected '!=0')\n", res, GetLastError() );
SetLastError(MAGIC_DEAD);
res = GetPrinterDriverDirectoryA("", NULL, 1, buffer, cbBuf*2, &pcbNeeded);
ok(res, "returned %d with %ld (expected '!=0')\n", res, GetLastError() );
HeapFree( GetProcessHeap(), 0, buffer); HeapFree( GetProcessHeap(), 0, buffer);
} }
static void test_openprinter(void) static void test_OpenPrinter(void)
{ {
PRINTER_DEFAULTSA defaults; PRINTER_DEFAULTSA defaults;
HANDLE hprinter; HANDLE hprinter;
...@@ -458,7 +472,7 @@ START_TEST(info) ...@@ -458,7 +472,7 @@ START_TEST(info)
find_default_printer(); find_default_printer();
test_default_printer(); test_GetDefaultPrinter();
test_printer_directory(); test_GetPrinterDriverDirectory();
test_openprinter(); test_OpenPrinter();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment