Module: wine Branch: master Commit: 03daa6088c11641e4457b1870fa2ba80c2806cdc URL: http://source.winehq.org/git/wine.git/?a=commit;h=03daa6088c11641e4457b1870f...
Author: Detlef Riekenberg wine.dev@web.de Date: Tue Nov 28 00:49:06 2006 +0100
winspool: Implement AddPortW.
---
dlls/winspool.drv/info.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index d945b0b..eb84e6f 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -5772,14 +5772,47 @@ BOOL WINAPI AddPortA(LPSTR pName, HWND h * Success: TRUE * Failure: FALSE * - * BUGS - * only a Stub - * */ BOOL WINAPI AddPortW(LPWSTR pName, HWND hWnd, LPWSTR pMonitorName) { - FIXME("(%s, %p, %s), stub!\n",debugstr_w(pName),hWnd,debugstr_w(pMonitorName)); - return FALSE; + monitor_t * pm; + DWORD res = ROUTER_UNKNOWN; + + TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pMonitorName)); + + if (pName && pName[0]) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (!pMonitorName) { + SetLastError(RPC_X_NULL_REF_POINTER); + return FALSE; + } + + /* an empty Monitorname is Invalid */ + if (!pMonitorName[0]) goto cleanup; + + pm = monitor_load(pMonitorName, NULL); + if (pm && pm->monitor) { + if (pm->monitor->pfnAddPort != NULL) { + res = pm->monitor->pfnAddPort(pName, hWnd, pMonitorName); + TRACE("got %d with %d\n", res, GetLastError()); + } + else if (pm->monitor->pfnXcvOpenPort != NULL) + { + FIXME("XcvOpenPort not implemented (dwMonitorSize: %d)\n", pm->dwMonitorSize); + } + /* invalidate cached PORT_INFO_2W */ + if (res == ROUTER_SUCCESS) monitor_flush(pm); + } + monitor_unload(pm); + +cleanup: + /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */ + if (res == ROUTER_UNKNOWN) SetLastError(ERROR_NOT_SUPPORTED); + TRACE("returning %d with %d\n", (res == ROUTER_SUCCESS), GetLastError()); + return (res == ROUTER_SUCCESS); }
/******************************************************************************