Alex Villacís Lasso : oledb32: Added tests for DBTYPE_BYTES to DBTYPE_WSTR/DBTYPE_STR marked as todo_wine .

Alexandre Julliard julliard at winehq.org
Tue Apr 6 11:20:06 CDT 2010


Module: wine
Branch: master
Commit: ec7e297987d0341a81884d856f3a59999c0617b1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ec7e297987d0341a81884d856f3a59999c0617b1

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Mon Apr  5 11:45:20 2010 -0500

oledb32: Added tests for DBTYPE_BYTES to DBTYPE_WSTR/DBTYPE_STR marked as todo_wine.

---

 dlls/oledb32/tests/convert.c |  161 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 161 insertions(+), 0 deletions(-)

diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index e6da6de..77872b7 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -926,6 +926,8 @@ static void test_converttowstr(void)
     static const WCHAR guid_str[] = {
         '{','0','C','7','3','3','A','8','D','-','2','A','1','C','-','1','1','C','E','-',
         'A','D','E','5','-','0','0','A','A','0','0','4','4','7','7','3','D','}',0};
+    static const WCHAR hexunpacked_w[] = {'5','7','0','0','6','9','0','0','6','E','0','0','6','5','0','0','0','0','0','0', 0 };
+    static const WCHAR hexpacked_w[] = {'W','i','n','e', 0 };
     BSTR b;
 
     hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
@@ -1278,6 +1280,91 @@ static void test_converttowstr(void)
     ok(dst_len == 4, "got %d\n", dst_len);
     ok(!lstrcmpW(ten, dst), "got %s\n", wine_dbgstr_w(dst));
 
+
+
+    /* DBTYPE_BYTES to DBTYPE_*STR unpacks binary data into a hex string */
+    memcpy(src, hexpacked_w, sizeof(hexpacked_w));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, sizeof(hexpacked_w), &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(hexpacked_w) * 4, "got %d\n", dst_len);
+    ok(!lstrcmpW(hexunpacked_w, dst), "got %s\n", wine_dbgstr_w(dst));
+    }
+    ok(dst[sizeof(hexpacked_w)/sizeof(WCHAR) * 4 + 1] == 0xcccc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_w, sizeof(hexpacked_w));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    }
+    ok(dst_len == 0, "got %d\n", dst_len);
+    todo_wine ok(dst[0] == 0, "not null terminated\n");
+    ok(dst[1] == 0xcccc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_w, sizeof(hexpacked_w));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, 4, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    ok(dst_len == 2 * sizeof(WCHAR) * 4, "got %d\n", dst_len);
+    ok(!memcmp(hexunpacked_w, dst, 2 * sizeof(WCHAR) * 4 ), "got %s\n", wine_dbgstr_w(dst));
+    ok(dst[2 * 4] == 0, "not null terminated\n");
+    }
+    ok(dst[2 * 4 + 1] == 0xcccc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_w, sizeof(hexpacked_w));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, sizeof(hexpacked_w), &dst_len, src, dst, 2 * sizeof(WCHAR) * 4 + sizeof(WCHAR), 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(hexpacked_w) * 4, "got %d\n", dst_len);
+    ok(!memcmp(hexunpacked_w, dst, 2 * sizeof(WCHAR) * 4 ), "got %s\n", wine_dbgstr_w(dst));
+    ok(dst[2 * 4] == 0, "not null terminated\n");
+    }
+    ok(dst[2 * 4 + 1] == 0xcccc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_w, sizeof(hexpacked_w));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, sizeof(hexpacked_w), &dst_len, src, dst, 2 * sizeof(WCHAR) * 4 +1, 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(hexpacked_w) * 4, "got %d\n", dst_len);
+    ok(!memcmp(hexunpacked_w, dst, 2 * sizeof(WCHAR) * 4 - 2 ), "got %s\n", wine_dbgstr_w(dst));
+    ok(dst[2 * 4 - 1] == 0, "not null terminated\n");
+    }
+    ok(dst[2 * 4] == 0xcccc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_w, sizeof(hexpacked_w));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, sizeof(hexpacked_w), &dst_len, src, dst, 2 * sizeof(WCHAR) * 4, 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(hexpacked_w) * 4, "got %d\n", dst_len);
+    ok(!memcmp(hexunpacked_w, dst, 2 * sizeof(WCHAR) * 4 - 2 ), "got %s\n", wine_dbgstr_w(dst));
+    ok(dst[2 * 4 - 1] == 0, "not null terminated\n");
+    }
+    ok(dst[2 * 4] == 0xcccc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_w, sizeof(hexpacked_w));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_WSTR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, DBDATACONVERT_LENGTHFROMNTS);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    }
+    ok(dst_len == 0, "got %d\n", dst_len);
+    todo_wine ok(dst[0] == 0, "not null terminated\n");
+    ok(dst[1] == 0xcccc, "clobbered buffer\n");
+
+
     IDataConvert_Release(convert);
 }
 
@@ -1293,6 +1380,8 @@ static void test_converttostr(void)
     static const char ten_a[] = "10";
     static const char fourthreetwoone[] = "4321";
     static const char guid_str[] = "{0C733A8D-2A1C-11CE-ADE5-00AA0044773D}";
+    static const char hexunpacked_a[] = "57696E6500";
+    static const char hexpacked_a[] = "Wine";
     BSTR b;
 
     hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
@@ -1673,6 +1762,78 @@ static void test_converttostr(void)
     ok(dst_len == 2, "got %d\n", dst_len);
     ok(!lstrcmpA(ten_a, dst), "got %s\n", dst);
 
+
+
+    /* DBTYPE_BYTES to DBTYPE_*STR unpacks binary data into a hex string */
+    memcpy(src, hexpacked_a, sizeof(hexpacked_a));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, sizeof(hexpacked_a), &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(hexpacked_a) * 2, "got %d\n", dst_len);
+    ok(!lstrcmpA(hexunpacked_a, dst), "got %s\n", dst);
+    }
+    ok(dst[sizeof(hexpacked_a)/sizeof(char) * 4 + 1] == (char)0xcc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_a, sizeof(hexpacked_a));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    }
+    ok(dst_len == 0, "got %d\n", dst_len);
+    todo_wine ok(dst[0] == 0, "not null terminated\n");
+    ok(dst[1] == (char)0xcc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_a, sizeof(hexpacked_a));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, 4, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    ok(dst_len == 2 * sizeof(char) * 4, "got %d\n", dst_len);
+    ok(!memcmp(hexunpacked_a, dst, 2 * sizeof(char) * 4 ), "got %s\n", dst);
+    ok(dst[2 * 4] == 0, "not null terminated\n");
+    }
+    ok(dst[2 * 4 + 1] == (char)0xcc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_a, sizeof(hexpacked_a));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, sizeof(hexpacked_a), &dst_len, src, dst, 2 * sizeof(char) * 4 + sizeof(char), 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(hexpacked_a) * 2, "got %d\n", dst_len);
+    ok(!memcmp(hexunpacked_a, dst, 2 * sizeof(char) * 4 ), "got %s\n", dst);
+    ok(dst[2 * 4] == 0, "not null terminated\n");
+    }
+    ok(dst[2 * 4 + 1] == (char)0xcc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_a, sizeof(hexpacked_a));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, sizeof(hexpacked_a), &dst_len, src, dst, 2 * sizeof(char) * 4, 0, &dst_status, 0, 0, 0);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(hexpacked_a) * 2, "got %d\n", dst_len);
+    ok(!memcmp(hexunpacked_a, dst, 2 * sizeof(char) * 4 - 2 ), "got %s\n", dst);
+    ok(dst[2 * 4 - 1] == 0, "not null terminated\n");
+    }
+    ok(dst[2 * 4] == (char)0xcc, "clobbered buffer\n");
+
+    memcpy(src, hexpacked_a, sizeof(hexpacked_a));
+    memset(dst, 0xcc, sizeof(dst));
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_STR, 0, &dst_len, src, dst, sizeof(dst), 0, &dst_status, 0, 0, DBDATACONVERT_LENGTHFROMNTS);
+    todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    }
+    ok(dst_len == 0, "got %d\n", dst_len);
+    todo_wine ok(dst[0] == 0, "not null terminated\n");
+    ok(dst[1] == (char)0xcc, "clobbered buffer\n");
+
     IDataConvert_Release(convert);
 }
 




More information about the wine-cvs mailing list