From 9e65dbc3944a7154da53c185b0f93de400289eaf Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Mon, 4 Feb 2008 08:59:54 +0100 Subject: [PATCH] localspl: Initialize pointers in struct PRINTPROVIDOR. --- dlls/localspl/localspl_main.c | 107 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/dlls/localspl/localspl_main.c b/dlls/localspl/localspl_main.c index 3585c342cd0..29cb4b8a623 100644 --- a/dlls/localspl/localspl_main.c +++ b/dlls/localspl/localspl_main.c @@ -1,7 +1,7 @@ /* * Implementation of the Local Printmonitor * - * Copyright 2006 Detlef Riekenberg + * Copyright 2006-2008 Detlef Riekenberg * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -35,8 +35,110 @@ WINE_DEFAULT_DEBUG_CHANNEL(localspl); +/* ############################### */ + HINSTANCE LOCALSPL_hInstance = NULL; +static const PRINTPROVIDOR * pp = NULL; + +/***************************************************** + * get_backend [internal] + */ +static const PRINTPROVIDOR * get_backend(void) +{ + static const PRINTPROVIDOR backend = { + NULL, /* fpOpenPrinter */ + NULL, /* fpSetJob */ + NULL, /* fpGetJob */ + NULL, /* fpEnumJobs */ + NULL, /* fpAddPrinter */ + NULL, /* fpDeletePrinter */ + NULL, /* fpSetPrinter */ + NULL, /* fpGetPrinter */ + NULL, /* fpEnumPrinters */ + NULL, /* fpAddPrinterDriver */ + NULL, /* fpEnumPrinterDrivers */ + NULL, /* fpGetPrinterDriver */ + NULL, /* fpGetPrinterDriverDirectory */ + NULL, /* fpDeletePrinterDriver */ + NULL, /* fpAddPrintProcessor */ + NULL, /* fpEnumPrintProcessors */ + NULL, /* fpGetPrintProcessorDirectory */ + NULL, /* fpDeletePrintProcessor */ + NULL, /* fpEnumPrintProcessorDatatypes */ + NULL, /* fpStartDocPrinter */ + NULL, /* fpStartPagePrinter */ + NULL, /* fpWritePrinter */ + NULL, /* fpEndPagePrinter */ + NULL, /* fpAbortPrinter */ + NULL, /* fpReadPrinter */ + NULL, /* fpEndDocPrinter */ + NULL, /* fpAddJob */ + NULL, /* fpScheduleJob */ + NULL, /* fpGetPrinterData */ + NULL, /* fpSetPrinterData */ + NULL, /* fpWaitForPrinterChange */ + NULL, /* fpClosePrinter */ + NULL, /* fpAddForm */ + NULL, /* fpDeleteForm */ + NULL, /* fpGetForm */ + NULL, /* fpSetForm */ + NULL, /* fpEnumForms */ + NULL, /* fpEnumMonitors */ + NULL, /* fpEnumPorts */ + NULL, /* fpAddPort */ + NULL, /* fpConfigurePort */ + NULL, /* fpDeletePort */ + NULL, /* fpCreatePrinterIC */ + NULL, /* fpPlayGdiScriptOnPrinterIC */ + NULL, /* fpDeletePrinterIC */ + NULL, /* fpAddPrinterConnection */ + NULL, /* fpDeletePrinterConnection */ + NULL, /* fpPrinterMessageBox */ + NULL, /* fpAddMonitor */ + NULL, /* fpDeleteMonitor */ + NULL, /* fpResetPrinter */ + NULL, /* fpGetPrinterDriverEx */ + NULL, /* fpFindFirstPrinterChangeNotification */ + NULL, /* fpFindClosePrinterChangeNotification */ + NULL, /* fpAddPortEx */ + NULL, /* fpShutDown */ + NULL, /* fpRefreshPrinterChangeNotification */ + NULL, /* fpOpenPrinterEx */ + NULL, /* fpAddPrinterEx */ + NULL, /* fpSetPort */ + NULL, /* fpEnumPrinterData */ + NULL, /* fpDeletePrinterData */ + NULL, /* fpClusterSplOpen */ + NULL, /* fpClusterSplClose */ + NULL, /* fpClusterSplIsAlive */ + NULL, /* fpSetPrinterDataEx */ + NULL, /* fpGetPrinterDataEx */ + NULL, /* fpEnumPrinterDataEx */ + NULL, /* fpEnumPrinterKey */ + NULL, /* fpDeletePrinterDataEx */ + NULL, /* fpDeletePrinterKey */ + NULL, /* fpSeekPrinter */ + NULL, /* fpDeletePrinterDriverEx */ + NULL, /* fpAddPerMachineConnection */ + NULL, /* fpDeletePerMachineConnection */ + NULL, /* fpEnumPerMachineConnections */ + NULL, /* fpXcvData */ + NULL, /* fpAddPrinterDriverEx */ + NULL, /* fpSplReadPrinter */ + NULL, /* fpDriverUnloadComplete */ + NULL, /* fpGetSpoolFileInfo */ + NULL, /* fpCommitSpoolData */ + NULL, /* fpCloseSpoolFileHandle */ + NULL, /* fpFlushPrinter */ + NULL, /* fpSendRecvBidiData */ + NULL /* fpAddDriverCatalog */ + }; + TRACE("=> %p (%u byte for %u entries)\n", &backend, sizeof(backend), sizeof(backend) / sizeof(VOID *)); + return &backend; + +} + /***************************************************** * DllMain */ @@ -52,6 +154,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinstDLL ); LOCALSPL_hInstance = hinstDLL; + pp = get_backend(); break; } return TRUE; @@ -84,7 +187,7 @@ BOOL WINAPI InitializePrintProvidor(LPPRINTPROVIDOR pPrintProvidor, { TRACE("(%p, %u, %s)\n", pPrintProvidor, cbPrintProvidor, debugstr_w(pFullRegistryPath)); - ZeroMemory(pPrintProvidor, (cbPrintProvidor < sizeof(PRINTPROVIDOR)) ? cbPrintProvidor : sizeof(PRINTPROVIDOR)); + memcpy(pPrintProvidor, pp, (cbPrintProvidor < sizeof(PRINTPROVIDOR)) ? cbPrintProvidor : sizeof(PRINTPROVIDOR)); return TRUE; } -- 2.11.4.GIT