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);
* Success: PTR to printenv_t
*
* NOTES
* An empty string is handled the same way as NULL.
* SetLastEror(ERROR_INVALID_ENVIRONMENT) is called on Failure
*
*/
......@@ -218,7 +219,7 @@ static const printenv_t * validate_envW(LPCWSTR env)
unsigned int i;
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++)
{
......@@ -3399,9 +3400,7 @@ BOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment,
* "%winsysdir%" is the Value from GetSystemDirectoryW()
*
* FIXME
*- pName != NULL not supported
*- pEnvironment != NULL not supported
*- Current Implementation returns always "%winsysdir%"
*- Only NULL or "" is supported for pName
*
*/
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),
debugstr_w(pEnvironment), Level, pDriverDirectory, cbBuf, pcbNeeded);
if(pName != NULL) {
if(pName != NULL && pName[0]) {
FIXME("pName unsupported: %s\n", debugstr_w(pName));
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
......
......@@ -94,7 +94,7 @@ static LPSTR find_default_printer(VOID)
}
static void test_default_printer(void)
static void test_GetDefaultPrinter(void)
{
BOOL retval;
DWORD exact = DEFAULT_PRINTER_SIZE;
......@@ -171,8 +171,9 @@ static void test_default_printer(void)
exact, size);
}
static void test_printer_directory(void)
{ LPBYTE buffer = NULL;
static void test_GetPrinterDriverDirectory(void)
{
LPBYTE buffer = NULL;
DWORD cbBuf = 0, pcbNeeded = 0;
BOOL res;
......@@ -305,10 +306,23 @@ static void test_printer_directory(void)
"'len > 0' or '0' with ERROR_INVALID_ENVIRONMENT)\n",
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);
}
static void test_openprinter(void)
static void test_OpenPrinter(void)
{
PRINTER_DEFAULTSA defaults;
HANDLE hprinter;
......@@ -458,7 +472,7 @@ START_TEST(info)
find_default_printer();
test_default_printer();
test_printer_directory();
test_openprinter();
test_GetDefaultPrinter();
test_GetPrinterDriverDirectory();
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