[PATCH] odbccp32: Correct error when driver cannot be found.

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Mon Aug 26 22:45:03 CDT 2019


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/odbccp32/odbccp32.c   |  2 +-
 dlls/odbccp32/tests/misc.c | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c
index 283ed41a59..1198b487f3 100644
--- a/dlls/odbccp32/odbccp32.c
+++ b/dlls/odbccp32/odbccp32.c
@@ -288,7 +288,7 @@ static HMODULE load_config_driver(const WCHAR *driver)
     if(ret != ERROR_SUCCESS)
     {
         HeapFree(GetProcessHeap(), 0, filename);
-        push_error(ODBC_ERROR_INVALID_DSN, odbc_error_invalid_dsn);
+        push_error(ODBC_ERROR_COMPONENT_NOT_FOUND, odbc_error_component_not_found);
         return NULL;
     }
 
diff --git a/dlls/odbccp32/tests/misc.c b/dlls/odbccp32/tests/misc.c
index dc65bdf3f9..dc2ca7ed3f 100644
--- a/dlls/odbccp32/tests/misc.c
+++ b/dlls/odbccp32/tests/misc.c
@@ -741,6 +741,31 @@ static void test_SQLValidDSNW(void)
     ok(ret, "got %d\n", ret);
 }
 
+static void test_SQLConfigDataSource(void)
+{
+    BOOL ret;
+
+    ret = SQLConfigDataSource(0, ODBC_ADD_DSN, "SQL Server", "DSN=WINEMQIS\0Database=MQIS\0\0");
+    ok(ret, "got %d\n", ret);
+
+    ret = SQLConfigDataSource(0, ODBC_REMOVE_DSN, "SQL Server", "DSN=WINEMQIS\0\0");
+    ok(ret, "got %d\n", ret);
+
+    ret = SQLConfigDataSource(0, ODBC_REMOVE_DSN, "SQL Server", "DSN=WINEMQIS\0\0");
+    if(!ret)
+    {
+        RETCODE ret;
+        DWORD err;
+        ret = SQLInstallerError(1, &err, NULL, 0, NULL);
+        ok(ret == SQL_SUCCESS_WITH_INFO, "got %d\n", ret);
+        todo_wine ok(err == ODBC_ERROR_INVALID_DSN, "got %u\n", err);
+    }
+
+    ret = SQLConfigDataSource(0, ODBC_ADD_DSN, "ODBC driver", "DSN=ODBC data source\0\0");
+    todo_wine ok(!ret, "got %d\n", ret);
+    todo_wine check_error(ODBC_ERROR_COMPONENT_NOT_FOUND);
+}
+
 START_TEST(misc)
 {
     test_SQLConfigMode();
@@ -754,4 +779,5 @@ START_TEST(misc)
     test_SQLGetInstalledDrivers();
     test_SQLValidDSN();
     test_SQLValidDSNW();
+    test_SQLConfigDataSource();
 }
-- 
2.17.1




More information about the wine-devel mailing list