localspl: Implement DeletePort

Detlef Riekenberg wine.dev at web.de
Thu Nov 23 14:49:46 CST 2006


Changelog:
localspl: Implement DeletePort


The API-Documentation are my own words

-Wcast-qual tested


-- 
 
By by ... Detlef

-------------- next part --------------
>From fb74ea29e27617c7f5ade20c71fe33df07811766 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Thu, 23 Nov 2006 21:45:03 +0100
Subject: [PATCH] localspl: Implement DeletePort
---
 dlls/localspl/localmon.c |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/dlls/localspl/localmon.c b/dlls/localspl/localmon.c
index 72b6b35..4f65417 100644
--- a/dlls/localspl/localmon.c
+++ b/dlls/localspl/localmon.c
@@ -197,6 +197,39 @@ BOOL WINAPI localmon_ConfigurePortW(LPWS
 }
 
 /*****************************************************
+ *   localmon_DeletePortW [exported through MONITOREX]
+ *
+ * Delete a specific Port
+ *
+ * PARAMS
+ *  pName     [I] Servername or NULL (local Computer)
+ *  hWnd      [I] Handle to parent Window
+ *  pPortName [I] Name of the Port, that should be deleted
+ *
+ * RETURNS
+ *  Success: TRUE
+ *  Failure: FALSE
+ *
+ */
+BOOL WINAPI localmon_DeletePortW(LPWSTR pName, HWND hWnd, LPWSTR pPortName)
+{
+    DWORD   res;
+    HKEY    hroot;
+
+    TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pPortName));
+
+    if ((!pPortName) || (!pPortName[0])) return FALSE;
+
+    res = RegOpenKeyW(HKEY_LOCAL_MACHINE, WinNT_CV_PortsW, &hroot);
+    if (res == ERROR_SUCCESS) {
+        res = RegDeleteValueW(hroot, pPortName);
+        RegCloseKey(hroot);
+    }
+    TRACE("=> %d\n", (res == ERROR_SUCCESS));
+    return (res == ERROR_SUCCESS);
+}
+
+/*****************************************************
  *   localmon_EnumPortsW [exported through MONITOREX]
  *
  * Enumerate all local Ports
@@ -290,7 +323,8 @@ LPMONITOREX WINAPI InitializePrintMonito
             NULL,       /* localmon_ClosePortW */
             NULL,       /* localmon_AddPortW */
             NULL,       /* localmon_AddPortExW */
-            localmon_ConfigurePortW
+            localmon_ConfigurePortW,
+            localmon_DeletePortW
         }
     };
 
-- 
1.4.1



More information about the wine-patches mailing list