Reactos

[ODBCCP32_WINETEST] Sync with Wine Staging 4.0. CORE-15682

+116 -4
+1 -1
modules/rostests/winetests/odbccp32/CMakeLists.txt
··· 1 1 2 - add_executable(odbccp32_winetest misc.c testlist.c) 2 + add_executable(odbccp32_winetest misc.c testlist.c odbccp32.rc) 3 3 set_module_type(odbccp32_winetest win32cui) 4 4 add_importlibs(odbccp32_winetest odbccp32 advapi32 msvcrt kernel32) 5 5 add_rostests_file(TARGET odbccp32_winetest)
+75 -3
modules/rostests/winetests/odbccp32/misc.c
··· 171 171 { 172 172 HKEY hkey; 173 173 174 + ret = SQLWritePrivateProfileString("wineodbc", "testing" , NULL, "odbc.ini"); 175 + ok(ret, "SQLWritePrivateProfileString failed\n"); 176 + 174 177 reg_ret = RegOpenKeyExW(HKEY_CURRENT_USER, odbc_key, 0, KEY_READ, &hkey); 175 178 ok(reg_ret == ERROR_SUCCESS, "RegOpenKeyExW failed\n"); 176 179 if(reg_ret == ERROR_SUCCESS) ··· 618 621 { 619 622 char buffer[1000], *p; 620 623 WORD written, len; 624 + BOOL ret, sql_ret; 625 + DWORD error_code; 621 626 int found = 0; 622 - BOOL ret; 623 627 624 - SQLInstallDriverEx("Wine test\0Driver=test.dll\0\0", NULL, buffer, 625 - sizeof(buffer), &written, ODBC_INSTALL_COMPLETE, NULL); 628 + ret = SQLInstallDriverEx("Wine test\0Driver=test.dll\0\0", NULL, buffer, 629 + sizeof(buffer), &written, ODBC_INSTALL_COMPLETE, NULL); 630 + ok(ret, "SQLInstallDriverEx failed: %d\n", ret); 631 + sql_ret = SQLInstallerErrorW(1, &error_code, NULL, 0, NULL); 632 + if (sql_ret && error_code == ODBC_ERROR_WRITING_SYSINFO_FAILED) 633 + { 634 + skip("not enough privileges\n"); 635 + return; 636 + } 626 637 627 638 ret = SQLGetInstalledDrivers(NULL, sizeof(buffer), &written); 628 639 ok(!ret, "got %d\n", ret); ··· 671 682 SQLRemoveDriver("Wine test", TRUE, NULL); 672 683 } 673 684 685 + static void test_SQLValidDSN(void) 686 + { 687 + static const char *invalid = "[]{}(),;?*=!@\\"; 688 + char str[10]; 689 + int i; 690 + BOOL ret; 691 + 692 + strcpy(str, "wine10"); 693 + for(i = 0; i < strlen(invalid); i++) 694 + { 695 + str[4] = invalid[i]; 696 + ret = SQLValidDSN(str); 697 + ok(!ret, "got %d\n", ret); 698 + } 699 + 700 + /* Too large */ 701 + ret = SQLValidDSN("Wine123456789012345678901234567890"); 702 + ok(!ret, "got %d\n", ret); 703 + 704 + /* Valid with a space */ 705 + ret = SQLValidDSN("Wine Vinegar"); 706 + ok(ret, "got %d\n", ret); 707 + 708 + /* Max DSN name value */ 709 + ret = SQLValidDSN("12345678901234567890123456789012"); 710 + ok(ret, "got %d\n", ret); 711 + } 712 + 713 + static void test_SQLValidDSNW(void) 714 + { 715 + static const WCHAR invalid[] = {'[',']','{','}','(',')',',',';','?','*','=','!','@','\\',0}; 716 + static const WCHAR value[] = { 'w','i','n','e','1','0',0}; 717 + static const WCHAR too_large[] = { 'W','i','n','e','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5', 718 + '6','7','8','9','0','1','2','3','4','5','6','7','8','9','0', 0}; 719 + static const WCHAR with_space[] = { 'W','i','n','e',' ','V','i','n','e','g','a','r', 0}; 720 + static const WCHAR max_dsn[] = { '1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0', 721 + '1','2','3','4','5','6','7','8','9','0','1','2', 0}; 722 + WCHAR str[10]; 723 + int i; 724 + BOOL ret; 725 + 726 + lstrcpyW(str, value); 727 + for(i = 0; i < lstrlenW(invalid); i++) 728 + { 729 + str[4] = invalid[i]; 730 + ret = SQLValidDSNW(str); 731 + ok(!ret, "got %d\n", ret); 732 + } 733 + 734 + ret = SQLValidDSNW(too_large); 735 + ok(!ret, "got %d\n", ret); 736 + 737 + ret = SQLValidDSNW(with_space); 738 + ok(ret, "got %d\n", ret); 739 + 740 + ret = SQLValidDSNW(max_dsn); 741 + ok(ret, "got %d\n", ret); 742 + } 743 + 674 744 START_TEST(misc) 675 745 { 676 746 test_SQLConfigMode(); ··· 682 752 test_SQLInstallDriverEx(); 683 753 test_SQLInstallTranslatorEx(); 684 754 test_SQLGetInstalledDrivers(); 755 + test_SQLValidDSN(); 756 + test_SQLValidDSNW(); 685 757 }
+18
modules/rostests/winetests/odbccp32/odbccp32.manifest
··· 1 + <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 2 + <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 3 + <assemblyIdentity 4 + type="win32" 5 + name="Wine.odbccp32.Test" 6 + version="1.0.0.0" 7 + processorArchitecture="*" 8 + /> 9 + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> 10 + <security> 11 + <requestedPrivileges> 12 + <requestedExecutionLevel 13 + level="asInvoker" 14 + /> 15 + </requestedPrivileges> 16 + </security> 17 + </trustInfo> 18 + </assembly>
+22
modules/rostests/winetests/odbccp32/odbccp32.rc
··· 1 + /* 2 + * Copyright 2018 Zebediah Figura 3 + * 4 + * This library is free software; you can redistribute it and/or 5 + * modify it under the terms of the GNU Lesser General Public 6 + * License as published by the Free Software Foundation; either 7 + * version 2.1 of the License, or (at your option) any later version. 8 + * 9 + * This library is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 + * Lesser General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU Lesser General Public 15 + * License along with this library; if not, write to the Free Software 16 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 + */ 18 + 19 + #include "winuser.h" 20 + 21 + /* @makedep: odbccp32.manifest */ 22 + 1 RT_MANIFEST odbccp32.manifest