winspool: Set the printer status of old printers to indicate that they should check for driver updates.
This commit is contained in:
parent
da0e1ecdd6
commit
0ef0ce2938
|
@ -420,6 +420,36 @@ static int multi_sz_lenA(const char *str)
|
||||||
return ptr - str + 1;
|
return ptr - str + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* get_dword_from_reg
|
||||||
|
*
|
||||||
|
* Return DWORD associated with name from hkey.
|
||||||
|
*/
|
||||||
|
static DWORD get_dword_from_reg( HKEY hkey, const WCHAR *name )
|
||||||
|
{
|
||||||
|
DWORD sz = sizeof(DWORD), type, value = 0;
|
||||||
|
LONG ret;
|
||||||
|
|
||||||
|
ret = RegQueryValueExW( hkey, name, 0, &type, (LPBYTE)&value, &sz );
|
||||||
|
|
||||||
|
if (ret != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
WARN( "Got ret = %d on name %s\n", ret, debugstr_w(name) );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (type != REG_DWORD)
|
||||||
|
{
|
||||||
|
ERR( "Got type %d\n", type );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline DWORD set_reg_DWORD( HKEY hkey, const WCHAR *keyname, const DWORD value )
|
||||||
|
{
|
||||||
|
return RegSetValueExW( hkey, keyname, 0, REG_DWORD, (const BYTE*)&value, sizeof(value) );
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
WINSPOOL_SetDefaultPrinter(const char *devname, const char *name, BOOL force) {
|
WINSPOOL_SetDefaultPrinter(const char *devname, const char *name, BOOL force) {
|
||||||
char qbuf[200];
|
char qbuf[200];
|
||||||
|
@ -738,12 +768,15 @@ static BOOL CUPS_LoadPrinters(void)
|
||||||
|
|
||||||
TRACE("Printer %d: %s\n", i, debugstr_w(nameW));
|
TRACE("Printer %d: %s\n", i, debugstr_w(nameW));
|
||||||
if(RegOpenKeyW(hkeyPrinters, nameW, &hkeyPrinter) == ERROR_SUCCESS) {
|
if(RegOpenKeyW(hkeyPrinters, nameW, &hkeyPrinter) == ERROR_SUCCESS) {
|
||||||
|
DWORD status = get_dword_from_reg( hkeyPrinter, StatusW );
|
||||||
/* Printer already in registry, delete the tag added in WINSPOOL_LoadSystemPrinters
|
/* Printer already in registry, delete the tag added in WINSPOOL_LoadSystemPrinters
|
||||||
and continue */
|
and continue */
|
||||||
TRACE("Printer already exists\n");
|
TRACE("Printer already exists\n");
|
||||||
/* overwrite old LPR:* port */
|
/* overwrite old LPR:* port */
|
||||||
RegSetValueExW(hkeyPrinter, PortW, 0, REG_SZ, (LPBYTE)port, (lstrlenW(port) + 1) * sizeof(WCHAR));
|
RegSetValueExW(hkeyPrinter, PortW, 0, REG_SZ, (LPBYTE)port, (lstrlenW(port) + 1) * sizeof(WCHAR));
|
||||||
RegDeleteValueW(hkeyPrinter, May_Delete_Value);
|
RegDeleteValueW(hkeyPrinter, May_Delete_Value);
|
||||||
|
/* flag that the PPD file should be checked for an update */
|
||||||
|
set_reg_DWORD( hkeyPrinter, StatusW, status | PRINTER_STATUS_DRIVER_UPDATE_NEEDED );
|
||||||
RegCloseKey(hkeyPrinter);
|
RegCloseKey(hkeyPrinter);
|
||||||
} else {
|
} else {
|
||||||
BOOL added_driver = FALSE;
|
BOOL added_driver = FALSE;
|
||||||
|
@ -990,11 +1023,6 @@ PRINTCAP_LoadPrinters(void) {
|
||||||
return hadprinter;
|
return hadprinter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DWORD set_reg_DWORD(HKEY hkey, const WCHAR *keyname, const DWORD value)
|
|
||||||
{
|
|
||||||
return RegSetValueExW(hkey, keyname, 0, REG_DWORD, (const BYTE*)&value, sizeof(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline DWORD set_reg_szW(HKEY hkey, const WCHAR *keyname, const WCHAR *value)
|
static inline DWORD set_reg_szW(HKEY hkey, const WCHAR *keyname, const WCHAR *value)
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
|
@ -3592,29 +3620,6 @@ BOOL WINAPI ResetPrinterW(HANDLE hPrinter, LPPRINTER_DEFAULTSW pDefault)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* get_dword_from_reg
|
|
||||||
*
|
|
||||||
* Return DWORD associated with name from hkey.
|
|
||||||
*/
|
|
||||||
static DWORD get_dword_from_reg( HKEY hkey, const WCHAR *name )
|
|
||||||
{
|
|
||||||
DWORD sz = sizeof(DWORD), type, value = 0;
|
|
||||||
LONG ret;
|
|
||||||
|
|
||||||
ret = RegQueryValueExW( hkey, name, 0, &type, (LPBYTE)&value, &sz );
|
|
||||||
|
|
||||||
if(ret != ERROR_SUCCESS) {
|
|
||||||
WARN("Got ret = %d on name %s\n", ret, debugstr_w(name));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if(type != REG_DWORD) {
|
|
||||||
ERR("Got type %d\n", type);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* get_filename_from_reg [internal]
|
* get_filename_from_reg [internal]
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue