From: Amine Khaldi Date: Sun, 19 Jul 2015 23:09:55 +0000 (+0000) Subject: [ODBCCP32_WINETEST] Sync with Wine Staging 1.7.47. CORE-9924 X-Git-Tag: ReactOS-0.4.0~1548 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=6108ea6bc92c46b6960e8c4748c03081e4618916;ds=sidebyside [ODBCCP32_WINETEST] Sync with Wine Staging 1.7.47. CORE-9924 svn path=/trunk/; revision=68468 --- diff --git a/rostests/winetests/odbccp32/CMakeLists.txt b/rostests/winetests/odbccp32/CMakeLists.txt index ce8fc761794..d051898e180 100644 --- a/rostests/winetests/odbccp32/CMakeLists.txt +++ b/rostests/winetests/odbccp32/CMakeLists.txt @@ -1,5 +1,5 @@ add_executable(odbccp32_winetest misc.c testlist.c) set_module_type(odbccp32_winetest win32cui) -add_importlibs(odbccp32_winetest odbccp32 msvcrt kernel32) +add_importlibs(odbccp32_winetest odbccp32 advapi32 msvcrt kernel32) add_cd_file(TARGET odbccp32_winetest DESTINATION reactos/bin FOR all) diff --git a/rostests/winetests/odbccp32/misc.c b/rostests/winetests/odbccp32/misc.c index cfe953220e1..f1f3f00316d 100644 --- a/rostests/winetests/odbccp32/misc.c +++ b/rostests/winetests/odbccp32/misc.c @@ -21,6 +21,7 @@ #include "windef.h" #include "winbase.h" +#include "winreg.h" #include "odbcinst.h" static void test_SQLConfigMode(void) @@ -129,9 +130,68 @@ static void test_SQLInstallDriverManager(void) ok(path_out != 0xcafe, "Expected path_out to show the correct amount of bytes\n"); } +static void test_SQLWritePrivateProfileString(void) +{ + static const WCHAR odbc_key[] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C','\\','O','D','B','C','.','I','N','I','\\','w','i','n','e','o','d','b','c',0}; + static const WCHAR abcd_key[] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C','\\','a','b','c','d','.','I','N','I','\\','w','i','n','e','o','d','b','c',0}; + static const WCHAR abcdini_key[] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C','\\','a','b','c','d','.','I','N','I',0 }; + BOOL ret; + LONG reg_ret; + DWORD error_code; + + ret = SQLWritePrivateProfileString("wineodbc", "testing" , "value", ""); + ok(!ret, "SQLWritePrivateProfileString passed\n"); + SQLInstallerErrorW(1, &error_code, NULL, 0, NULL); + ok(error_code == ODBC_ERROR_INVALID_STR, "SQLInstallerErrorW ret: %d\n", error_code); + + ret = SQLWritePrivateProfileString("wineodbc", "testing" , "value", NULL); + ok(!ret, "SQLWritePrivateProfileString passed\n"); + SQLInstallerErrorW(1, &error_code, NULL, 0, NULL); + ok(error_code == ODBC_ERROR_INVALID_STR, "SQLInstallerErrorW ret: %d\n", error_code); + + ret = SQLWritePrivateProfileString("wineodbc", "testing" , "value", "odbc.ini"); + ok(ret, "SQLWritePrivateProfileString failed\n"); + if(ret) + { + HKEY hkey; + + reg_ret = RegOpenKeyExW(HKEY_CURRENT_USER, odbc_key, 0, KEY_READ, &hkey); + ok(reg_ret == ERROR_SUCCESS, "RegOpenKeyExW failed\n"); + if(reg_ret == ERROR_SUCCESS) + { + reg_ret = RegDeleteKeyW(HKEY_CURRENT_USER, odbc_key); + ok(reg_ret == ERROR_SUCCESS, "RegDeleteKeyW failed\n"); + + RegCloseKey(hkey); + } + } + + ret = SQLWritePrivateProfileString("wineodbc", "testing" , "value", "abcd.ini"); + ok(ret, "SQLWritePrivateProfileString failed\n"); + if(ret) + { + HKEY hkey; + + reg_ret = RegOpenKeyExW(HKEY_CURRENT_USER, abcd_key, 0, KEY_READ, &hkey); + ok(reg_ret == ERROR_SUCCESS, "RegOpenKeyExW failed\n"); + if(reg_ret == ERROR_SUCCESS) + { + reg_ret = RegDeleteKeyW(HKEY_CURRENT_USER, abcd_key); + ok(reg_ret == ERROR_SUCCESS, "RegDeleteKeyW failed\n"); + + RegCloseKey(hkey); + } + + /* Cleanup key */ + reg_ret = RegDeleteKeyW(HKEY_CURRENT_USER, abcdini_key); + ok(reg_ret == ERROR_SUCCESS, "RegDeleteKeyW failed\n"); + } +} + START_TEST(misc) { test_SQLConfigMode(); test_SQLInstallerError(); test_SQLInstallDriverManager(); + test_SQLWritePrivateProfileString(); }