winspool: Support the spooler in GetPrinterData.
This commit is contained in:
parent
ec25a446cd
commit
ce51d9d0c9
|
@ -5354,27 +5354,40 @@ DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter, LPCSTR pKeyName,
|
||||||
LPCSTR pValueName, LPDWORD pType,
|
LPCSTR pValueName, LPDWORD pType,
|
||||||
LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
|
LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
|
||||||
{
|
{
|
||||||
HKEY hkeyPrinter, hkeySubkey;
|
opened_printer_t *printer;
|
||||||
|
HKEY hkeyPrinters, hkeyPrinter = 0, hkeySubkey = 0;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
|
|
||||||
TRACE("(%p, %s, %s %p, %p, %08x, %p)\n", hPrinter,
|
TRACE("(%p, %s, %s, %p, %p, %u, %p)\n", hPrinter, debugstr_a(pKeyName),
|
||||||
debugstr_a(pKeyName), debugstr_a(pValueName), pType, pData, nSize,
|
debugstr_a(pValueName), pType, pData, nSize, pcbNeeded);
|
||||||
pcbNeeded);
|
|
||||||
|
|
||||||
if((ret = WINSPOOL_GetOpenedPrinterRegKey(hPrinter, &hkeyPrinter))
|
printer = get_opened_printer(hPrinter);
|
||||||
!= ERROR_SUCCESS)
|
if(!printer) return ERROR_INVALID_HANDLE;
|
||||||
return ret;
|
|
||||||
|
|
||||||
if((ret = RegOpenKeyA(hkeyPrinter, pKeyName, &hkeySubkey))
|
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters);
|
||||||
!= ERROR_SUCCESS) {
|
if (ret) return ret;
|
||||||
WARN("Can't open subkey %s\n", debugstr_a(pKeyName));
|
|
||||||
RegCloseKey(hkeyPrinter);
|
if (printer->name) {
|
||||||
return ret;
|
|
||||||
|
ret = RegOpenKeyW(hkeyPrinters, printer->name, &hkeyPrinter);
|
||||||
|
if (ret) {
|
||||||
|
RegCloseKey(hkeyPrinters);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
if((ret = RegOpenKeyA(hkeyPrinter, pKeyName, &hkeySubkey)) != ERROR_SUCCESS) {
|
||||||
|
WARN("Can't open subkey %s: %d\n", debugstr_a(pKeyName), ret);
|
||||||
|
RegCloseKey(hkeyPrinter);
|
||||||
|
RegCloseKey(hkeyPrinters);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*pcbNeeded = nSize;
|
*pcbNeeded = nSize;
|
||||||
ret = RegQueryValueExA(hkeySubkey, pValueName, 0, pType, pData, pcbNeeded);
|
ret = RegQueryValueExA(printer->name ? hkeySubkey : hkeyPrinters, pValueName,
|
||||||
|
0, pType, pData, pcbNeeded);
|
||||||
|
|
||||||
RegCloseKey(hkeySubkey);
|
RegCloseKey(hkeySubkey);
|
||||||
RegCloseKey(hkeyPrinter);
|
RegCloseKey(hkeyPrinter);
|
||||||
|
RegCloseKey(hkeyPrinters);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5385,27 +5398,40 @@ DWORD WINAPI GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName,
|
||||||
LPCWSTR pValueName, LPDWORD pType,
|
LPCWSTR pValueName, LPDWORD pType,
|
||||||
LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
|
LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
|
||||||
{
|
{
|
||||||
HKEY hkeyPrinter, hkeySubkey;
|
opened_printer_t *printer;
|
||||||
|
HKEY hkeyPrinters, hkeyPrinter = 0, hkeySubkey = 0;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
|
|
||||||
TRACE("(%p, %s, %s %p, %p, %08x, %p)\n", hPrinter,
|
TRACE("(%p, %s, %s, %p, %p, %u, %p)\n", hPrinter, debugstr_w(pKeyName),
|
||||||
debugstr_w(pKeyName), debugstr_w(pValueName), pType, pData, nSize,
|
debugstr_w(pValueName), pType, pData, nSize, pcbNeeded);
|
||||||
pcbNeeded);
|
|
||||||
|
|
||||||
if((ret = WINSPOOL_GetOpenedPrinterRegKey(hPrinter, &hkeyPrinter))
|
printer = get_opened_printer(hPrinter);
|
||||||
!= ERROR_SUCCESS)
|
if(!printer) return ERROR_INVALID_HANDLE;
|
||||||
return ret;
|
|
||||||
|
|
||||||
if((ret = RegOpenKeyW(hkeyPrinter, pKeyName, &hkeySubkey))
|
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters);
|
||||||
!= ERROR_SUCCESS) {
|
if (ret) return ret;
|
||||||
WARN("Can't open subkey %s\n", debugstr_w(pKeyName));
|
|
||||||
RegCloseKey(hkeyPrinter);
|
if (printer->name) {
|
||||||
return ret;
|
|
||||||
|
ret = RegOpenKeyW(hkeyPrinters, printer->name, &hkeyPrinter);
|
||||||
|
if (ret) {
|
||||||
|
RegCloseKey(hkeyPrinters);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
if((ret = RegOpenKeyW(hkeyPrinter, pKeyName, &hkeySubkey)) != ERROR_SUCCESS) {
|
||||||
|
WARN("Can't open subkey %s: %d\n", debugstr_w(pKeyName), ret);
|
||||||
|
RegCloseKey(hkeyPrinter);
|
||||||
|
RegCloseKey(hkeyPrinters);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*pcbNeeded = nSize;
|
*pcbNeeded = nSize;
|
||||||
ret = RegQueryValueExW(hkeySubkey, pValueName, 0, pType, pData, pcbNeeded);
|
ret = RegQueryValueExW(printer->name ? hkeySubkey : hkeyPrinters, pValueName,
|
||||||
|
0, pType, pData, pcbNeeded);
|
||||||
|
|
||||||
RegCloseKey(hkeySubkey);
|
RegCloseKey(hkeySubkey);
|
||||||
RegCloseKey(hkeyPrinter);
|
RegCloseKey(hkeyPrinter);
|
||||||
|
RegCloseKey(hkeyPrinters);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1009,6 +1009,7 @@ HKLM,"Software\Microsoft\OLE","EnableRemoteConnect",,"N"
|
||||||
|
|
||||||
[Printing]
|
[Printing]
|
||||||
HKLM,%Control%\Print\Monitors\Local Port,"Driver",2,"localspl.dll"
|
HKLM,%Control%\Print\Monitors\Local Port,"Driver",2,"localspl.dll"
|
||||||
|
HKLM,%Control%\Print\Printers,"DefaultSpoolDirectory",2,"%11%\spool\printers"
|
||||||
HKLM,%CurrentVersionNT%\Ports,"FILE:",,""
|
HKLM,%CurrentVersionNT%\Ports,"FILE:",,""
|
||||||
HKLM,%CurrentVersionNT%\Ports,"LPT1:",,""
|
HKLM,%CurrentVersionNT%\Ports,"LPT1:",,""
|
||||||
HKLM,%CurrentVersionNT%\Ports,"LPT2:",,""
|
HKLM,%CurrentVersionNT%\Ports,"LPT2:",,""
|
||||||
|
|
Loading…
Reference in New Issue