diff --git a/reactos/dll/win32/spoolss/router.c b/reactos/dll/win32/spoolss/router.c index f4e8e96819e..479d23a6a7f 100644 --- a/reactos/dll/win32/spoolss/router.c +++ b/reactos/dll/win32/spoolss/router.c @@ -312,6 +312,122 @@ static backend_t * backend_first(LPWSTR name) return NULL; } +/****************************************************************** + * AddMonitorW (spoolss.@) + * + * Install a Printmonitor + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * Level [I] Structure-Level (Must be 2) + * pMonitors [I] PTR to MONITOR_INFO_2 + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + * NOTES + * All Files for the Monitor must already be copied to %winsysdir% ("%SystemRoot%\system32") + * + */ +BOOL WINAPI AddMonitorW(LPWSTR pName, DWORD Level, LPBYTE pMonitors) +{ + backend_t * pb; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %d, %p)\n", debugstr_w(pName), Level, pMonitors); + + if (Level != 2) { + SetLastError(ERROR_INVALID_LEVEL); + return FALSE; + } + + pb = backend_first(pName); + if (pb && pb->fpAddMonitor) + res = pb->fpAddMonitor(pName, Level, pMonitors); + else + { + SetLastError(ERROR_PROC_NOT_FOUND); + } + + TRACE("got %u with %u\n", res, GetLastError()); + return (res == ROUTER_SUCCESS); +} + +/****************************************************************** + * AddPrinterDriverExW (spoolss.@) + * + * Install a Printer Driver with the Option to upgrade / downgrade the Files + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * level [I] Level for the supplied DRIVER_INFO_*W struct + * pDriverInfo [I] PTR to DRIVER_INFO_*W struct with the Driver Parameter + * dwFileCopyFlags [I] How to Copy / Upgrade / Downgrade the needed Files + * + * RESULTS + * Success: TRUE + * Failure: FALSE + * + */ +BOOL WINAPI AddPrinterDriverExW(LPWSTR pName, DWORD level, LPBYTE pDriverInfo, DWORD dwFileCopyFlags) +{ + backend_t * pb; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %d, %p, 0x%x)\n", debugstr_w(pName), level, pDriverInfo, dwFileCopyFlags); + + if (!pDriverInfo) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + pb = backend_first(pName); + if (pb && pb->fpAddPrinterDriverEx) + res = pb->fpAddPrinterDriverEx(pName, level, pDriverInfo, dwFileCopyFlags); + else + { + SetLastError(ERROR_PROC_NOT_FOUND); + } + + TRACE("got %u with %u\n", res, GetLastError()); + return (res == ROUTER_SUCCESS); +} + +/****************************************************************** + * DeleteMonitorW (spoolss.@) + * + * Delete a specific Printmonitor from a Printing-Environment + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * pEnvironment [I] Printing-Environment of the Monitor or NULL (Default) + * pMonitorName [I] Name of the Monitor, that should be deleted + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + */ +BOOL WINAPI DeleteMonitorW(LPWSTR pName, LPWSTR pEnvironment, LPWSTR pMonitorName) +{ + backend_t * pb; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %s, %s)\n", debugstr_w(pName), debugstr_w(pEnvironment), debugstr_w(pMonitorName)); + + pb = backend_first(pName); + if (pb && pb->fpDeleteMonitor) + res = pb->fpDeleteMonitor(pName, pEnvironment, pMonitorName); + else + { + SetLastError(ERROR_PROC_NOT_FOUND); + } + + TRACE("got %u with %u\n", res, GetLastError()); + return (res == ROUTER_SUCCESS); +} + /****************************************************************** * EnumMonitorsW (spoolss.@) * @@ -399,3 +515,58 @@ BOOL WINAPI EnumPortsW(LPWSTR pName, DWORD Level, LPBYTE pPorts, DWORD cbBuf, return (res == ROUTER_SUCCESS); } + +/****************************************************************** + * GetPrinterDriverDirectoryW (spoolss.@) + * + * Return the PATH for the Printer-Drivers + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * pEnvironment [I] Printing-Environment or NULL (Default) + * Level [I] Structure-Level (must be 1) + * pDriverDirectory [O] PTR to Buffer that receives the Result + * cbBuf [I] Size of Buffer at pDriverDirectory + * pcbNeeded [O] PTR to DWORD that receives the size in Bytes used / + * required for pDriverDirectory + * + * RETURNS + * Success: TRUE and in pcbNeeded the Bytes used in pDriverDirectory + * Failure: FALSE and in pcbNeeded the Bytes required for pDriverDirectory, + * if cbBuf is too small + * + * Native Values returned in pDriverDirectory on Success: + *| NT(Windows NT x86): "%winsysdir%\\spool\\DRIVERS\\w32x86" + *| NT(Windows x64): "%winsysdir%\\spool\\DRIVERS\\x64" + *| NT(Windows 4.0): "%winsysdir%\\spool\\DRIVERS\\win40" + *| win9x(Windows 4.0): "%winsysdir%" + * + * "%winsysdir%" is the Value from GetSystemDirectoryW() + * + */ +BOOL WINAPI GetPrinterDriverDirectoryW(LPWSTR pName, LPWSTR pEnvironment, + DWORD Level, LPBYTE pDriverDirectory, DWORD cbBuf, LPDWORD pcbNeeded) +{ + backend_t * pb; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %s, %d, %p, %d, %p)\n", debugstr_w(pName), + debugstr_w(pEnvironment), Level, pDriverDirectory, cbBuf, pcbNeeded); + + if (pcbNeeded) *pcbNeeded = 0; + + pb = backend_first(pName); + if (pb && pb->fpGetPrinterDriverDirectory) + res = pb->fpGetPrinterDriverDirectory(pName, pEnvironment, Level, + pDriverDirectory, cbBuf, pcbNeeded); + else + { + SetLastError(ERROR_PROC_NOT_FOUND); + } + + TRACE("got %u with %u (%u byte)\n", + res, GetLastError(), pcbNeeded ? *pcbNeeded : 0); + + return (res == ROUTER_SUCCESS); + +} diff --git a/reactos/dll/win32/spoolss/spoolss.spec b/reactos/dll/win32/spoolss/spoolss.spec index 2b5fc197235..68188ba390d 100644 --- a/reactos/dll/win32/spoolss/spoolss.spec +++ b/reactos/dll/win32/spoolss/spoolss.spec @@ -1,14 +1,14 @@ @ stub AbortPrinter @ stub AddFormW @ stub AddJobW -@ stub AddMonitorW +@ stdcall AddMonitorW(wstr long ptr) @ stub AddPerMachineConnectionW @ stub AddPortExW @ stub AddPortW @ stub AddPrintProcessorW @ stub AddPrintProvidorW @ stub AddPrinterConnectionW -@ stub AddPrinterDriverExW +@ stdcall AddPrinterDriverExW(wstr long ptr long) @ stub AddPrinterDriverW @ stub AddPrinterExW @ stub AddPrinterW @@ -25,7 +25,7 @@ @ stub CreatePrinterIC @ stub DbgGetPointers @ stub DeleteFormW -@ stub DeleteMonitorW +@ stdcall DeleteMonitorW(wstr wstr wstr) @ stub DeletePerMachineConnectionW @ stub DeletePortW @ stub DeletePrintProcessorW @@ -68,7 +68,7 @@ @ stub GetPrintProcessorDirectoryW @ stub GetPrinterDataExW @ stub GetPrinterDataW -@ stub GetPrinterDriverDirectoryW +@ stdcall GetPrinterDriverDirectoryW(wstr wstr long ptr long ptr) @ stub GetPrinterDriverExW @ stub GetPrinterDriverW @ stub GetPrinterW diff --git a/reactos/dll/win32/winspool/stubs.c b/reactos/dll/win32/winspool/stubs.c index b245cdb0d51..9f5365f624c 100644 --- a/reactos/dll/win32/winspool/stubs.c +++ b/reactos/dll/win32/winspool/stubs.c @@ -1068,9 +1068,9 @@ GetPrinterDataW(HANDLE Printer, LPWSTR Name, PDWORD Type, PBYTE Buffer, DWORD Bu /* * @unimplemented */ -DWORD +BOOL WINAPI -GetPrinterDriverA(HANDLE Printer, LPSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +GetPrinterDriverA(HANDLE Printer, LPSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrinterDriverA stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1082,9 +1082,9 @@ GetPrinterDriverA(HANDLE Printer, LPSTR Environment, DWORD Level, PBYTE Buffer, /* * @unimplemented */ -DWORD +BOOL WINAPI -GetPrinterDriverW(HANDLE Printer, LPWSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +GetPrinterDriverW(HANDLE Printer, LPWSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrinterDriverW stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1096,9 +1096,9 @@ GetPrinterDriverW(HANDLE Printer, LPWSTR Environment, DWORD Level, PBYTE Buffer, /* * @unimplemented */ -DWORD +BOOL WINAPI -GetPrinterDriverDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +GetPrinterDriverDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrinterDriverDirectoryA stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1110,9 +1110,9 @@ GetPrinterDriverDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, PBYTE Buf /* * @unimplemented */ -DWORD +BOOL WINAPI -GetPrinterDriverDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +GetPrinterDriverDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrinterDriverDirectoryW stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1124,9 +1124,9 @@ GetPrinterDriverDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, PBYTE B /* * @unimplemented */ -DWORD +BOOL WINAPI -GetPrintProcessorDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +GetPrintProcessorDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrintProcessorDirectoryA stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -1138,9 +1138,9 @@ GetPrintProcessorDirectoryA(LPSTR Name, LPSTR Environment, DWORD Level, PBYTE Bu /* * @unimplemented */ -DWORD +BOOL WINAPI -GetPrintProcessorDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, PBYTE Buffer, DWORD BufSize, PDWORD Needed) +GetPrintProcessorDirectoryW(LPWSTR Name, LPWSTR Environment, DWORD Level, LPBYTE Buffer, DWORD BufSize, LPDWORD Needed) { OutputDebugStringW(L"winspool GetPrintProcessorDirectoryW stub called\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED);