Commit 7508a5d4 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

winspool: Implement SetPrinterW for level 2.

parent de9d18c6
......@@ -748,6 +748,11 @@ PRINTCAP_LoadPrinters(void) {
return hadprinter;
}
static inline DWORD set_reg_DWORD(HKEY hkey, LPCSTR keyname, const DWORD value)
{
return RegSetValueExA(hkey, keyname, 0, REG_DWORD, (const BYTE*)&value, sizeof(value));
}
static inline DWORD set_reg_szW(HKEY hkey, const WCHAR *keyname, const WCHAR *value)
{
if (value)
......@@ -2874,6 +2879,30 @@ BOOL WINAPI SetPrinterA( HANDLE printer, DWORD level, LPBYTE data, DWORD command
return ret;
}
static void set_printer_2( HKEY key, const PRINTER_INFO_2W *pi )
{
set_reg_szW( key, NameW, pi->pPrinterName );
set_reg_szW( key, Share_NameW, pi->pShareName );
set_reg_szW( key, PortW, pi->pPortName );
set_reg_szW( key, Printer_DriverW, pi->pDriverName );
set_reg_szW( key, DescriptionW, pi->pComment );
set_reg_szW( key, LocationW, pi->pLocation );
if (pi->pDevMode)
set_reg_devmode( key, Default_DevModeW, pi->pDevMode );
set_reg_szW( key, Separator_FileW, pi->pSepFile );
set_reg_szW( key, Print_ProcessorW, pi->pPrintProcessor );
set_reg_szW( key, DatatypeW, pi->pDatatype );
set_reg_szW( key, ParametersW, pi->pParameters );
set_reg_DWORD( key, "Attributes", pi->Attributes );
set_reg_DWORD( key, "Priority", pi->Priority );
set_reg_DWORD( key, "Default Priority", pi->DefaultPriority );
set_reg_DWORD( key, "StartTime", pi->StartTime );
set_reg_DWORD( key, "UntilTime", pi->UntilTime );
}
static BOOL set_printer_9( HKEY key, const PRINTER_INFO_9W *pi )
{
if (!pi->pDevMode) return FALSE;
......@@ -2899,6 +2928,14 @@ BOOL WINAPI SetPrinterW( HANDLE printer, DWORD level, LPBYTE data, DWORD command
switch (level)
{
case 2:
{
PRINTER_INFO_2W *pi2 = (PRINTER_INFO_2W *)data;
set_printer_2( key, pi2 );
ret = TRUE;
break;
}
case 9:
{
PRINTER_INFO_9W *pi = (PRINTER_INFO_9W *)data;
......
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