Commit 18193b19 authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

winspool: Return ERROR_MORE_DATA, when the app probe for the needed buffer size.

parent 8e151f51
......@@ -5367,6 +5367,8 @@ DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName,
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters);
if (ret) return ret;
TRACE("printer->name: %s\n", debugstr_w(printer->name));
if (printer->name) {
ret = RegOpenKeyW(hkeyPrinters, printer->name, &hkeyPrinter);
......@@ -5385,9 +5387,13 @@ DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName,
ret = RegQueryValueExA(printer->name ? hkeySubkey : hkeyPrinters, pValueName,
0, pType, pData, pcbNeeded);
if (!ret && !pData) ret = ERROR_MORE_DATA;
RegCloseKey(hkeySubkey);
RegCloseKey(hkeyPrinter);
RegCloseKey(hkeyPrinters);
TRACE("--> %d\n", ret);
return ret;
}
......@@ -5411,6 +5417,8 @@ DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName,
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters);
if (ret) return ret;
TRACE("printer->name: %s\n", debugstr_w(printer->name));
if (printer->name) {
ret = RegOpenKeyW(hkeyPrinters, printer->name, &hkeyPrinter);
......@@ -5429,9 +5437,13 @@ DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName,
ret = RegQueryValueExW(printer->name ? hkeySubkey : hkeyPrinters, pValueName,
0, pType, pData, pcbNeeded);
if (!ret && !pData) ret = ERROR_MORE_DATA;
RegCloseKey(hkeySubkey);
RegCloseKey(hkeyPrinter);
RegCloseKey(hkeyPrinters);
TRACE("--> %d\n", ret);
return ret;
}
......
......@@ -2364,6 +2364,14 @@ static void test_GetPrinterData(void)
ok( !res && (type == REG_SZ) && ((needed == len) || (needed == (len * sizeof(WCHAR)))),
"got %d, type %d, needed: %d and '%s' (expected ERROR_SUCCESS, REG_SZ and %d or %d)\n",
res, type, needed, buffer, len, len * sizeof(WCHAR));
needed = 0xdeadbeef;
SetLastError(0xdeadbeef);
res = GetPrinterDataA(hprn, defaultspooldirectory, NULL, NULL, 0, &needed);
ok( (res == ERROR_MORE_DATA) && ((needed == len) || (needed == (len * sizeof(WCHAR)))),
"got %d, needed: %d (expected ERROR_MORE_DATA and %d or %d)\n",
res, needed, len, len * sizeof(WCHAR));
/* ToDo: test SPLREG_* */
SetLastError(0xdeadbeef);
......@@ -2451,6 +2459,13 @@ static void test_GetPrinterDataEx(void)
"got %d, type %d, needed: %d and '%s' (expected ERROR_SUCCESS, REG_SZ and %d or %d)\n",
res, type, needed, buffer, len, len * sizeof(WCHAR));
needed = 0xdeadbeef;
SetLastError(0xdeadbeef);
res = pGetPrinterDataExA(hprn, NULL, defaultspooldirectory, NULL, NULL, 0, &needed);
ok( (res == ERROR_MORE_DATA) && ((needed == len) || (needed == (len * sizeof(WCHAR)))),
"got %d, needed: %d (expected ERROR_MORE_DATA and %d or %d)\n",
res, needed, len, len * sizeof(WCHAR));
SetLastError(0xdeadbeef);
res = ClosePrinter(hprn);
ok(res, "ClosePrinter error %d\n", GetLastError());
......
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