localspl/tests: [2/2] Add tests for XcvClosePort

Detlef Riekenberg wine.dev at web.de
Fri Dec 8 07:02:50 CST 2006


Changelog:
localspl/tests: Add tests for XcvClosePort

-Wcast-qual tested



-- 
 
By by ... Detlef

-------------- next part --------------
>From 0e5c6ddae4b2049d9fad606e4b86b78ae2e2acbf Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Fri, 8 Dec 2006 13:55:16 +0100
Subject: [PATCH] localspl/tests: Add test for XcvClosePort
---
 dlls/localspl/tests/localmon.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/dlls/localspl/tests/localmon.c b/dlls/localspl/tests/localmon.c
index 89dd757..00978e7 100644
--- a/dlls/localspl/tests/localmon.c
+++ b/dlls/localspl/tests/localmon.c
@@ -291,6 +291,38 @@ static void test_InitializePrintMonitor(
         "returned %p with %d (expected %p)\n", res, GetLastError(), pm);
 }
 
+/* ########################### */
+
+static void test_XcvClosePort(void)
+{
+    DWORD   res;
+    HANDLE hXcv;
+
+    if ((pXcvOpenPort == NULL) || (pXcvClosePort == NULL)) return;
+
+#if 0
+    /* crash with native localspl.dll (w2k+xp) */
+    res = pXcvClosePort(NULL);
+    res = pXcvClosePort(INVALID_HANDLE_VALUE);
+#endif
+
+
+    SetLastError(0xdeadbeef);
+    hXcv = (HANDLE) 0xdeadbeef;
+    res = pXcvOpenPort(emptyW, SERVER_ACCESS_ADMINISTER, &hXcv);
+    ok(res, "returned %d with 0x%x and %p (expected '!= 0')\n", res, GetLastError(), hXcv);
+
+    if (res) {
+        SetLastError(0xdeadbeef);
+        res = pXcvClosePort(hXcv);
+        ok( res, "returned %d with 0x%x(expected '!= 0')\n", res, GetLastError());
+
+#if 0
+        /* test for "Double Free": crash with native localspl.dll (w2k+xp) */
+        res = pXcvClosePort(hXcv);
+#endif
+    }
+}
 
 /* ########################### */
 
@@ -400,5 +432,6 @@ START_TEST(localmon)
     test_ConfigurePort();
     test_DeletePort();
     test_EnumPorts();
+    test_XcvClosePort();
     test_XcvOpenPort();
 }
-- 
1.4.1



More information about the wine-patches mailing list