Alistair Leslie-Hughes : odbccp32: Implement SQLRemoveDSNFromIni/w.

Alexandre Julliard julliard at winehq.org
Fri Dec 4 14:36:04 CST 2020


Module: wine
Branch: master
Commit: 44e2a14af1b9af22388098a66ea15cf92fe88065
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=44e2a14af1b9af22388098a66ea15cf92fe88065

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Wed Dec  2 20:36:20 2020 +1100

odbccp32: Implement SQLRemoveDSNFromIni/w.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/odbccp32/odbccp32.c | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c
index 0e4a12534c8..420f206b700 100644
--- a/dlls/odbccp32/odbccp32.c
+++ b/dlls/odbccp32/odbccp32.c
@@ -1523,18 +1523,45 @@ BOOL WINAPI SQLRemoveDriverManager(LPDWORD pdwUsageCount)
 
 BOOL WINAPI SQLRemoveDSNFromIniW(LPCWSTR lpszDSN)
 {
+    HKEY hkey;
+
+    TRACE("%s\n", debugstr_w(lpszDSN));
+
     clear_errors();
-    FIXME("%s\n", debugstr_w(lpszDSN));
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
+
+    if (RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\\ODBC\\ODBC.INI\\ODBC Data Sources", &hkey) == ERROR_SUCCESS)
+    {
+        RegDeleteValueW(hkey, lpszDSN);
+        RegCloseKey(hkey);
+    }
+
+    if (RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\\ODBC\\ODBC.INI", &hkey) == ERROR_SUCCESS)
+    {
+        RegDeleteTreeW(hkey, lpszDSN);
+        RegCloseKey(hkey);
+    }
+
+    return TRUE;
 }
 
 BOOL WINAPI SQLRemoveDSNFromIni(LPCSTR lpszDSN)
 {
+    BOOL ret = FALSE;
+    WCHAR *dsn;
+
+    TRACE("%s\n", debugstr_a(lpszDSN));
+
     clear_errors();
-    FIXME("%s\n", debugstr_a(lpszDSN));
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
+
+    dsn = SQLInstall_strdup(lpszDSN);
+    if (dsn)
+        ret = SQLRemoveDSNFromIniW(dsn);
+    else
+        push_error(ODBC_ERROR_OUT_OF_MEM, odbc_error_out_of_mem);
+
+    heap_free(dsn);
+
+    return ret;
 }
 
 BOOL WINAPI SQLRemoveTranslatorW(const WCHAR *translator, DWORD *usage_count)




More information about the wine-cvs mailing list