[PATCH v2 2/2] qwave: Add stub for QOSCreateHandle and tests

Vijay Kiran Kamuju infyquest at gmail.com
Thu Apr 11 22:21:09 CDT 2019


Fix tests

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46174
From: Vijay Kiran Kamuju <infyquest at gmail.com>
Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
---
 configure                    |  1 +
 configure.ac                 |  1 +
 dlls/qwave/Makefile.in       |  1 +
 dlls/qwave/main.c            | 12 ++++++
 dlls/qwave/qwave.spec        |  2 +-
 dlls/qwave/tests/Makefile.in |  5 +++
 dlls/qwave/tests/qos.c       | 72 ++++++++++++++++++++++++++++++++++++
 7 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100644 dlls/qwave/tests/Makefile.in
 create mode 100644 dlls/qwave/tests/qos.c

diff --git a/configure b/configure
index 5733ea7350..fc148ed5d0 100755
--- a/configure
+++ b/configure
@@ -20447,6 +20447,7 @@ wine_fn_config_makefile dlls/quartz enable_quartz
 wine_fn_config_makefile dlls/quartz/tests enable_tests
 wine_fn_config_makefile dlls/query enable_query
 wine_fn_config_makefile dlls/qwave enable_qwave
+wine_fn_config_makefile dlls/qwave/tests enable_tests
 wine_fn_config_makefile dlls/rasapi16.dll16 enable_win16
 wine_fn_config_makefile dlls/rasapi32 enable_rasapi32
 wine_fn_config_makefile dlls/rasapi32/tests enable_tests
diff --git a/configure.ac b/configure.ac
index 4dbb7f4f22..45929bf106 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3607,6 +3607,7 @@ WINE_CONFIG_MAKEFILE(dlls/quartz)
 WINE_CONFIG_MAKEFILE(dlls/quartz/tests)
 WINE_CONFIG_MAKEFILE(dlls/query)
 WINE_CONFIG_MAKEFILE(dlls/qwave)
+WINE_CONFIG_MAKEFILE(dlls/qwave/tests)
 WINE_CONFIG_MAKEFILE(dlls/rasapi16.dll16,enable_win16)
 WINE_CONFIG_MAKEFILE(dlls/rasapi32)
 WINE_CONFIG_MAKEFILE(dlls/rasapi32/tests)
diff --git a/dlls/qwave/Makefile.in b/dlls/qwave/Makefile.in
index 9de8224697..5b4015cb2b 100644
--- a/dlls/qwave/Makefile.in
+++ b/dlls/qwave/Makefile.in
@@ -1,4 +1,5 @@
 MODULE    = qwave.dll
+IMPORTLIB = qwave
 
 C_SRCS = \
 	main.c
diff --git a/dlls/qwave/main.c b/dlls/qwave/main.c
index ce1cfbd670..6d77b29be6 100644
--- a/dlls/qwave/main.c
+++ b/dlls/qwave/main.c
@@ -1,5 +1,6 @@
 /*
  * Copyright 2018 Louis Lenders
+ * Copyright 2019 Vijay Kiran Kamuju
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,6 +22,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "qos2.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(qwave);
@@ -39,3 +41,13 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID lpv)
     }
     return TRUE;
 }
+
+BOOL WINAPI QOSCreateHandle(PQOS_VERSION version, PHANDLE handle)
+{
+    FIXME("%p %p stub!\n", version, handle);
+    if (!version || !((version->MajorVersion == 1) && (version->MinorVersion == 0)) || !handle)
+        SetLastError(ERROR_INVALID_PARAMETER);
+    else
+        SetLastError(ERROR_SERVICE_ALREADY_RUNNING);
+    return FALSE;
+}
diff --git a/dlls/qwave/qwave.spec b/dlls/qwave/qwave.spec
index 27b07f55d6..94b62eb1d8 100644
--- a/dlls/qwave/qwave.spec
+++ b/dlls/qwave/qwave.spec
@@ -3,7 +3,7 @@
 @ stub QOSAddSocketToFlow
 @ stub QOSCancel
 @ stub QOSCloseHandle
-@ stub QOSCreateHandle
+@ stdcall QOSCreateHandle(ptr ptr)
 @ stub QOSEnumerateFlows
 @ stub QOSNotifyFlow
 @ stub QOSQueryFlow
diff --git a/dlls/qwave/tests/Makefile.in b/dlls/qwave/tests/Makefile.in
new file mode 100644
index 0000000000..713909ba19
--- /dev/null
+++ b/dlls/qwave/tests/Makefile.in
@@ -0,0 +1,5 @@
+TESTDLL   = qwave.dll
+IMPORTS   = qwave
+
+C_SRCS = \
+	qos.c
diff --git a/dlls/qwave/tests/qos.c b/dlls/qwave/tests/qos.c
new file mode 100644
index 0000000000..5cb3e53996
--- /dev/null
+++ b/dlls/qwave/tests/qos.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2019 Vijay Kiran Kamuju
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windows.h>
+#include "qos2.h"
+
+#include "wine/test.h"
+
+static void test_QOSCreateHandle(void)
+{
+    QOS_VERSION ver;
+    HANDLE h;
+    BOOL ret;
+
+    SetLastError(0xdeadbeef);
+    ret = QOSCreateHandle(NULL, NULL);
+    ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = QOSCreateHandle(&ver, NULL);
+    ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ver.MajorVersion = 0;
+    ver.MinorVersion = 0;
+    ret = QOSCreateHandle(&ver, &h);
+    ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ver.MajorVersion = 1;
+    ver.MinorVersion = 0;
+    ret = QOSCreateHandle(&ver, &h);
+    todo_wine ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
+    todo_wine ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ver.MajorVersion = 1;
+    ver.MinorVersion = 5;
+    ret = QOSCreateHandle(&ver, &h);
+    ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ver.MajorVersion = 2;
+    ver.MinorVersion = 0;
+    ret = QOSCreateHandle(&ver, &h);
+    ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+}
+
+START_TEST(qos)
+{
+    test_QOSCreateHandle();
+}
-- 
2.21.0




More information about the wine-devel mailing list