From: Piotr Caban piotr@codeweavers.com
--- dlls/localspl/provider.c | 53 +++++++++++++++++++++++++++++++++++++++- dlls/winspool.drv/info.c | 17 +++++++++---- 2 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c index 63113157cc8..dd6b6b9cf45 100644 --- a/dlls/localspl/provider.c +++ b/dlls/localspl/provider.c @@ -2627,6 +2627,57 @@ emP_cleanup: return (res); }
+static BOOL WINAPI fpAddPrintProcessor(WCHAR *name, WCHAR *environment, WCHAR *path, + WCHAR *print_proc) +{ + const printenv_t * env; + HKEY hroot = NULL; + WCHAR *regpath; + LSTATUS s; + + TRACE("(%s, %s, %s, %s)\n", debugstr_w(name), debugstr_w(environment), + debugstr_w(path), debugstr_w(print_proc)); + + if (!path || !print_proc) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (name && name[0]) + { + FIXME("server %s not supported\n", debugstr_w(name)); + SetLastError(ERROR_INVALID_NAME); + return FALSE; + } + + env = validate_envW(environment); + if (!env) + return FALSE; + + regpath = malloc(sizeof(fmt_printprocessorsW) + + wcslen(env->envname) * sizeof(WCHAR)); + if (!regpath) + return FALSE; + wsprintfW(regpath, fmt_printprocessorsW, env->envname); + + s = RegCreateKeyW(HKEY_LOCAL_MACHINE, regpath, &hroot); + free(regpath); + if (!s) + { + s = RegSetKeyValueW(hroot, print_proc, L"Driver", REG_SZ, path, + (wcslen(path) + 1) * sizeof(WCHAR)); + } + RegCloseKey(hroot); + if (s) + { + SetLastError(s); + return FALSE; + } + + return TRUE; +} + /***************************************************************************** * fpEnumPrintProcessors [exported through PRINTPROVIDOR] * @@ -3715,7 +3766,7 @@ static const PRINTPROVIDOR backend = { NULL, /* fpGetPrinterDriver */ fpGetPrinterDriverDirectory, NULL, /* fpDeletePrinterDriver */ - NULL, /* fpAddPrintProcessor */ + fpAddPrintProcessor, fpEnumPrintProcessors, fpGetPrintProcessorDirectory, NULL, /* fpDeletePrintProcessor */ diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index 258d67c5788..8abfc9b0887 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -4799,12 +4799,19 @@ BOOL WINAPI AddPrintProcessorA(LPSTR pName, LPSTR pEnvironment, LPSTR pPathName, /***************************************************************************** * AddPrintProcessorW [WINSPOOL.@] */ -BOOL WINAPI AddPrintProcessorW(LPWSTR pName, LPWSTR pEnvironment, LPWSTR pPathName, - LPWSTR pPrintProcessorName) +BOOL WINAPI AddPrintProcessorW(WCHAR *name, WCHAR *env, WCHAR *path, WCHAR *print_proc) { - FIXME("(%s,%s,%s,%s): stub\n", debugstr_w(pName), debugstr_w(pEnvironment), - debugstr_w(pPathName), debugstr_w(pPrintProcessorName)); - return TRUE; + TRACE("(%s,%s,%s,%s)\n", debugstr_w(name), debugstr_w(env), + debugstr_w(path), debugstr_w(print_proc)); + + if (!path || !print_proc) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if ((backend == NULL) && !load_backend()) return FALSE; + return backend->fpAddPrintProcessor(name, env, path, print_proc); }
/*****************************************************************************