winspool: [4/6] Implement AddPortW
Detlef Riekenberg
wine.dev at web.de
Mon Nov 27 17:49:06 CST 2006
Changelog:
winspool: Implement AddPortW
--
By by ... Detlef
-------------- next part --------------
>From 8d6531c8c99842ff90d591cd0704a0945bce345b Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Tue, 28 Nov 2006 00:31:25 +0100
Subject: [PATCH] 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 e83b170..8945de1 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);
}
/******************************************************************************
--
1.4.1
More information about the wine-patches
mailing list