[winspool 2/6] Move the dlopen of libcups to a separate function, allowing CUPS to be used prior to the full on loading of CUPS printers.
Jeremy White
jwhite at codeweavers.com
Wed Dec 23 14:20:44 CST 2009
---
dlls/winspool.drv/info.c | 37 ++++++++++++++++++++++---------------
1 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 312150c..2a8c348 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -111,6 +111,14 @@ typedef struct {
/* ############################### */
+#ifdef SONAME_LIBCUPS
+static typeof(cupsFreeDests) *pcupsFreeDests;
+static typeof(cupsGetDests) *pcupsGetDests;
+static typeof(cupsGetPPD) *pcupsGetPPD;
+static typeof(cupsPrintFile) *pcupsPrintFile;
+static void *cupshandle;
+#endif
+
static opened_printer_t **printer_handles;
static UINT nb_printer_handles;
static LONG next_job_id = 1;
@@ -453,22 +461,9 @@ static BOOL add_printer_driver(const char *name)
}
#ifdef SONAME_LIBCUPS
-static typeof(cupsFreeDests) *pcupsFreeDests;
-static typeof(cupsGetDests) *pcupsGetDests;
-static typeof(cupsGetPPD) *pcupsGetPPD;
-static typeof(cupsPrintFile) *pcupsPrintFile;
-static void *cupshandle;
-
-static BOOL CUPS_LoadPrinters(void)
+static BOOL CUPS_LoadLibrary(void)
{
- int i, nrofdests;
- BOOL hadprinter = FALSE, haddefault = FALSE;
- cups_dest_t *dests;
- PRINTER_INFO_2A pinfo2a;
- char *port,*devline;
- HKEY hkeyPrinter, hkeyPrinters, hkey;
char loaderror[256];
-
cupshandle = wine_dlopen(SONAME_LIBCUPS, RTLD_NOW, loaderror, sizeof(loaderror));
if (!cupshandle) {
TRACE("%s\n", loaderror);
@@ -485,6 +480,17 @@ static BOOL CUPS_LoadPrinters(void)
DYNCUPS(cupsGetDests);
DYNCUPS(cupsPrintFile);
#undef DYNCUPS
+ return TRUE;
+}
+
+static BOOL CUPS_LoadPrinters(void)
+{
+ int i, nrofdests;
+ BOOL hadprinter = FALSE, haddefault = FALSE;
+ cups_dest_t *dests;
+ PRINTER_INFO_2A pinfo2a;
+ char *port,*devline;
+ HKEY hkeyPrinter, hkeyPrinters, hkey;
if(RegCreateKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters) !=
ERROR_SUCCESS) {
@@ -1054,7 +1060,8 @@ void WINSPOOL_LoadSystemPrinters(void)
#ifdef SONAME_LIBCUPS
- done = CUPS_LoadPrinters();
+ if (CUPS_LoadLibrary())
+ done = CUPS_LoadPrinters();
#endif
if(!done) /* If we have any CUPS based printers, skip looking for printcap printers */
More information about the wine-patches
mailing list