Commit a2e6c734 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineps: Change the printer info list into a standard list.

parent a37ee1e2
...@@ -530,15 +530,15 @@ static INT PSDRV_GetDeviceCaps( PHYSDEV dev, INT cap ) ...@@ -530,15 +530,15 @@ static INT PSDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
} }
} }
static struct list printer_list = LIST_INIT( printer_list );
/********************************************************************** /**********************************************************************
* PSDRV_FindPrinterInfo * PSDRV_FindPrinterInfo
*/ */
PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name) PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
{ {
static PRINTERINFO *PSDRV_PrinterList;
DWORD type = REG_BINARY, needed, res, dwPaperSize; DWORD type = REG_BINARY, needed, res, dwPaperSize;
PRINTERINFO *pi = PSDRV_PrinterList, **last = &PSDRV_PrinterList; PRINTERINFO *pi;
FONTNAME *font; FONTNAME *font;
const AFM *afm; const AFM *afm;
HANDLE hPrinter = 0; HANDLE hPrinter = 0;
...@@ -551,17 +551,14 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name) ...@@ -551,17 +551,14 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
TRACE("'%s'\n", debugstr_w(name)); TRACE("'%s'\n", debugstr_w(name));
/* LIST_FOR_EACH_ENTRY( pi, &printer_list, PRINTERINFO, entry )
* If this loop completes, last will point to the 'next' element of the {
* final PRINTERINFO in the list if (!strcmpW( pi->friendly_name, name ))
*/
for( ; pi; last = &pi->next, pi = pi->next)
if(!strcmpW(pi->friendly_name, name))
return pi; return pi;
}
pi = *last = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*pi) ); pi = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*pi) );
if (pi == NULL) if (pi == NULL) return NULL;
return NULL;
if (!(pi->friendly_name = HeapAlloc( PSDRV_Heap, 0, (strlenW(name)+1)*sizeof(WCHAR) ))) goto fail; if (!(pi->friendly_name = HeapAlloc( PSDRV_Heap, 0, (strlenW(name)+1)*sizeof(WCHAR) ))) goto fail;
strcpyW( pi->friendly_name, name ); strcpyW( pi->friendly_name, name );
...@@ -775,7 +772,6 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name) ...@@ -775,7 +772,6 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
goto cleanup; goto cleanup;
} }
pi->next = NULL;
pi->Fonts = NULL; pi->Fonts = NULL;
for(font = pi->ppd->InstalledFonts; font; font = font->next) { for(font = pi->ppd->InstalledFonts; font; font = font->next) {
...@@ -795,6 +791,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name) ...@@ -795,6 +791,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
} }
HeapFree( GetProcessHeap(), 0, nameA ); HeapFree( GetProcessHeap(), 0, nameA );
if (ppd) unlink(ppd); if (ppd) unlink(ppd);
list_add_head( &printer_list, &pi->entry );
return pi; return pi;
closeprinter: closeprinter:
...@@ -808,7 +805,6 @@ fail: ...@@ -808,7 +805,6 @@ fail:
HeapFree(PSDRV_Heap, 0, pi); HeapFree(PSDRV_Heap, 0, pi);
HeapFree( GetProcessHeap(), 0, nameA ); HeapFree( GetProcessHeap(), 0, nameA );
if (ppd) unlink(ppd); if (ppd) unlink(ppd);
*last = NULL;
return NULL; return NULL;
} }
......
...@@ -241,14 +241,15 @@ numInstalledOptions of OPTIONs ...@@ -241,14 +241,15 @@ numInstalledOptions of OPTIONs
} PSDRV_DEVMODEA; } PSDRV_DEVMODEA;
typedef struct _tagPI { typedef struct
{
struct list entry;
WCHAR *friendly_name; WCHAR *friendly_name;
PPD *ppd; PPD *ppd;
PSDRV_DEVMODEA *Devmode; PSDRV_DEVMODEA *Devmode;
FONTFAMILY *Fonts; FONTFAMILY *Fonts;
PPRINTER_ENUM_VALUESA FontSubTable; PPRINTER_ENUM_VALUESA FontSubTable;
DWORD FontSubTableSize; DWORD FontSubTableSize;
struct _tagPI *next;
} PRINTERINFO; } PRINTERINFO;
typedef struct { typedef struct {
......
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