winspool: Return ERROR_MORE_DATA, when the app probe for the needed buffer size.
This commit is contained in:
parent
8e151f5126
commit
18193b193b
|
@ -5367,6 +5367,8 @@ DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName,
|
||||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters);
|
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters);
|
||||||
if (ret) return ret;
|
if (ret) return ret;
|
||||||
|
|
||||||
|
TRACE("printer->name: %s\n", debugstr_w(printer->name));
|
||||||
|
|
||||||
if (printer->name) {
|
if (printer->name) {
|
||||||
|
|
||||||
ret = RegOpenKeyW(hkeyPrinters, printer->name, &hkeyPrinter);
|
ret = RegOpenKeyW(hkeyPrinters, printer->name, &hkeyPrinter);
|
||||||
|
@ -5385,9 +5387,13 @@ DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName,
|
||||||
ret = RegQueryValueExA(printer->name ? hkeySubkey : hkeyPrinters, pValueName,
|
ret = RegQueryValueExA(printer->name ? hkeySubkey : hkeyPrinters, pValueName,
|
||||||
0, pType, pData, pcbNeeded);
|
0, pType, pData, pcbNeeded);
|
||||||
|
|
||||||
|
if (!ret && !pData) ret = ERROR_MORE_DATA;
|
||||||
|
|
||||||
RegCloseKey(hkeySubkey);
|
RegCloseKey(hkeySubkey);
|
||||||
RegCloseKey(hkeyPrinter);
|
RegCloseKey(hkeyPrinter);
|
||||||
RegCloseKey(hkeyPrinters);
|
RegCloseKey(hkeyPrinters);
|
||||||
|
|
||||||
|
TRACE("--> %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5411,6 +5417,8 @@ DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName,
|
||||||
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters);
|
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters);
|
||||||
if (ret) return ret;
|
if (ret) return ret;
|
||||||
|
|
||||||
|
TRACE("printer->name: %s\n", debugstr_w(printer->name));
|
||||||
|
|
||||||
if (printer->name) {
|
if (printer->name) {
|
||||||
|
|
||||||
ret = RegOpenKeyW(hkeyPrinters, printer->name, &hkeyPrinter);
|
ret = RegOpenKeyW(hkeyPrinters, printer->name, &hkeyPrinter);
|
||||||
|
@ -5429,9 +5437,13 @@ DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName,
|
||||||
ret = RegQueryValueExW(printer->name ? hkeySubkey : hkeyPrinters, pValueName,
|
ret = RegQueryValueExW(printer->name ? hkeySubkey : hkeyPrinters, pValueName,
|
||||||
0, pType, pData, pcbNeeded);
|
0, pType, pData, pcbNeeded);
|
||||||
|
|
||||||
|
if (!ret && !pData) ret = ERROR_MORE_DATA;
|
||||||
|
|
||||||
RegCloseKey(hkeySubkey);
|
RegCloseKey(hkeySubkey);
|
||||||
RegCloseKey(hkeyPrinter);
|
RegCloseKey(hkeyPrinter);
|
||||||
RegCloseKey(hkeyPrinters);
|
RegCloseKey(hkeyPrinters);
|
||||||
|
|
||||||
|
TRACE("--> %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2364,6 +2364,14 @@ static void test_GetPrinterData(void)
|
||||||
ok( !res && (type == REG_SZ) && ((needed == len) || (needed == (len * sizeof(WCHAR)))),
|
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",
|
"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));
|
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_* */
|
/* ToDo: test SPLREG_* */
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
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",
|
"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));
|
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);
|
SetLastError(0xdeadbeef);
|
||||||
res = ClosePrinter(hprn);
|
res = ClosePrinter(hprn);
|
||||||
ok(res, "ClosePrinter error %d\n", GetLastError());
|
ok(res, "ClosePrinter error %d\n", GetLastError());
|
||||||
|
|
Loading…
Reference in New Issue