Otherwise, it returns an incorrect buffer size especially for a DBCS file name.
From: Akihiro Sagawa sagawa.aki@gmail.com
--- dlls/shell32/tests/shellole.c | 92 ++++++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 22 deletions(-)
diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c index 5f0c2ea1bca..1129b603201 100644 --- a/dlls/shell32/tests/shellole.c +++ b/dlls/shell32/tests/shellole.c @@ -746,7 +746,6 @@ static void test_SHCreateQueryCancelAutoPlayMoniker(void) }
#define WM_EXPECTED_VALUE WM_APP -#define DROPTEST_FILENAME "c:\wintest.bin" struct DragParam { HWND hwnd; HANDLE ready; @@ -755,10 +754,12 @@ struct DragParam { static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { static BOOL expected; + static char expected_filename[MAX_PATH];
switch (msg) { case WM_EXPECTED_VALUE: { + lstrcpynA(expected_filename, (const char*)wparam, sizeof(expected_filename)); expected = lparam; break; } @@ -768,19 +769,44 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA char filename[MAX_PATH] = "dummy"; POINT pt; BOOL r; - UINT num; + UINT num, len; + winetest_push_context("%s", wine_dbgstr_a(expected_filename)); + num = DragQueryFileA(hDrop, 0xffffffff, NULL, 0); ok(num == 1, "expected 1, got %u\n", num); + num = DragQueryFileA(hDrop, 0xffffffff, (char*)0xdeadbeef, 0xffffffff); ok(num == 1, "expected 1, got %u\n", num); + + len = strlen(expected_filename); + num = DragQueryFileA(hDrop, 0, NULL, 0); + todo_wine_if(expected_filename[0] == 'd') + ok(num == len, "expected %u, got %u\n", len, num); + + num = DragQueryFileA(hDrop, 0, filename, 0); + todo_wine_if(expected_filename[0] == 'd') + ok(num == len, "expected %u, got %u\n", len, num); + ok(!strcmp(filename, "dummy"), "got %s\n", filename); + num = DragQueryFileA(hDrop, 0, filename, sizeof(filename)); - ok(num == strlen(DROPTEST_FILENAME), "got %u\n", num); - ok(!strcmp(filename, DROPTEST_FILENAME), "got %s\n", filename); + todo_wine_if(expected_filename[0] == 'd') + ok(num == len, "expected %u, got %u\n", len, num); + ok(!strcmp(filename, expected_filename), "expected %s, got %s\n", + expected_filename, filename); + + memset(filename, 0xaa, sizeof(filename)); + num = DragQueryFileA(hDrop, 0, filename, 2); + todo_wine ok(num == 1, "expected 1, got %u\n", num); + ok(filename[0] == expected_filename[0], "expected '%c', got '%c'\n", + expected_filename[0], filename[0]); + ok(filename[1] == '\0', "expected nul, got %#x\n", (BYTE)filename[1]); + r = DragQueryPoint(hDrop, &pt); ok(r == expected, "expected %d, got %d\n", expected, r); ok(pt.x == 10, "expected 10, got %ld\n", pt.x); ok(pt.y == 20, "expected 20, got %ld\n", pt.y); DragFinish(hDrop); + winetest_pop_context(); return 0; } } @@ -841,8 +867,15 @@ static void test_DragQueryFile(BOOL non_client_flag) DWORD rc; HGLOBAL hDrop; DROPFILES *pDrop; - int ret; + int ret, i; BOOL r; + static const struct { + UINT codepage; + const char* filename; + } testcase[] = { + { 0, "c:\wintest.bin" }, + { 932, "d:\\x89\xb9\x8a\x79_02.CHY" }, + };
param.ready = CreateEventA(NULL, FALSE, FALSE, NULL); ok(param.ready != NULL, "can't create event\n"); @@ -851,23 +884,39 @@ static void test_DragQueryFile(BOOL non_client_flag) rc = WaitForSingleObject(param.ready, 5000); ok(rc == WAIT_OBJECT_0, "got %lu\n", rc);
- hDrop = GlobalAlloc(GHND, sizeof(DROPFILES) + (strlen(DROPTEST_FILENAME) + 2) * sizeof(WCHAR)); - pDrop = GlobalLock(hDrop); - pDrop->pt.x = 10; - pDrop->pt.y = 20; - pDrop->fNC = non_client_flag; - pDrop->pFiles = sizeof(DROPFILES); - ret = MultiByteToWideChar(CP_ACP, 0, DROPTEST_FILENAME, -1, - (LPWSTR)(pDrop + 1), strlen(DROPTEST_FILENAME) + 1); - ok(ret > 0, "got %d\n", ret); - pDrop->fWide = TRUE; - GlobalUnlock(hDrop); - - r = PostMessageA(param.hwnd, WM_EXPECTED_VALUE, 0, !non_client_flag); - ok(r, "got %d\n", r); + for (i = 0; i < ARRAY_SIZE(testcase); i++) + { + winetest_push_context("%d", i); + if (testcase[i].codepage && testcase[i].codepage != GetACP()) + { + skip("need codepage %u for this test\n", testcase[i].codepage); + winetest_pop_context(); + continue; + }
- r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0); - ok(r, "got %d\n", r); + ret = MultiByteToWideChar(CP_ACP, 0, testcase[i].filename, -1, NULL, 0); + ok(ret > 0, "got %d\n", ret); + hDrop = GlobalAlloc(GHND, sizeof(DROPFILES) + (ret + 1) * sizeof(WCHAR)); + pDrop = GlobalLock(hDrop); + pDrop->pt.x = 10; + pDrop->pt.y = 20; + pDrop->fNC = non_client_flag; + pDrop->pFiles = sizeof(DROPFILES); + ret = MultiByteToWideChar(CP_ACP, 0, testcase[i].filename, -1, + (LPWSTR)(pDrop + 1), ret); + ok(ret > 0, "got %d\n", ret); + pDrop->fWide = TRUE; + GlobalUnlock(hDrop); + + r = PostMessageA(param.hwnd, WM_EXPECTED_VALUE, + (WPARAM)testcase[i].filename, !non_client_flag); + ok(r, "got %d\n", r); + + r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0); + ok(r, "got %d\n", r); + + winetest_pop_context(); + }
r = PostMessageA(param.hwnd, WM_QUIT, 0, 0); ok(r, "got %d\n", r); @@ -879,7 +928,6 @@ static void test_DragQueryFile(BOOL non_client_flag) CloseHandle(hThread); } #undef WM_EXPECTED_VALUE -#undef DROPTEST_FILENAME
static void test_SHCreateSessionKey(void) {
From: Akihiro Sagawa sagawa.aki@gmail.com
--- dlls/shell32/tests/shellole.c | 64 ++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 8 deletions(-)
diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c index 1129b603201..0b1146ba8bb 100644 --- a/dlls/shell32/tests/shellole.c +++ b/dlls/shell32/tests/shellole.c @@ -746,6 +746,8 @@ static void test_SHCreateQueryCancelAutoPlayMoniker(void) }
#define WM_EXPECTED_VALUE WM_APP +#define DROP_NC_AREA 1 +#define DROP_WIDE_FILENAME 2 struct DragParam { HWND hwnd; HANDLE ready; @@ -753,24 +755,25 @@ struct DragParam {
static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - static BOOL expected; + static DWORD flags; static char expected_filename[MAX_PATH];
switch (msg) { case WM_EXPECTED_VALUE: { lstrcpynA(expected_filename, (const char*)wparam, sizeof(expected_filename)); - expected = lparam; + flags = lparam; break; } case WM_DROPFILES: { HDROP hDrop = (HDROP)wparam; char filename[MAX_PATH] = "dummy"; + WCHAR filenameW[MAX_PATH] = L"dummy", expected_filenameW[MAX_PATH]; POINT pt; BOOL r; UINT num, len; - winetest_push_context("%s", wine_dbgstr_a(expected_filename)); + winetest_push_context("%s(%lu)", wine_dbgstr_a(expected_filename), flags);
num = DragQueryFileA(hDrop, 0xffffffff, NULL, 0); ok(num == 1, "expected 1, got %u\n", num); @@ -780,16 +783,16 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
len = strlen(expected_filename); num = DragQueryFileA(hDrop, 0, NULL, 0); - todo_wine_if(expected_filename[0] == 'd') + todo_wine_if(expected_filename[0] == 'd' && (flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num);
num = DragQueryFileA(hDrop, 0, filename, 0); - todo_wine_if(expected_filename[0] == 'd') + todo_wine_if(expected_filename[0] == 'd' && (flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num); ok(!strcmp(filename, "dummy"), "got %s\n", filename);
num = DragQueryFileA(hDrop, 0, filename, sizeof(filename)); - todo_wine_if(expected_filename[0] == 'd') + todo_wine_if(expected_filename[0] == 'd' && (flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num); ok(!strcmp(filename, expected_filename), "expected %s, got %s\n", expected_filename, filename); @@ -801,8 +804,34 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA expected_filename[0], filename[0]); ok(filename[1] == '\0', "expected nul, got %#x\n", (BYTE)filename[1]);
+ MultiByteToWideChar(CP_ACP, 0, expected_filename, -1, + expected_filenameW, ARRAY_SIZE(expected_filenameW)); + + len = wcslen(expected_filenameW); + num = DragQueryFileW(hDrop, 0, NULL, 0); + todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME)) + ok(num == len, "expected %u, got %u\n", len, num); + + num = DragQueryFileW(hDrop, 0, filenameW, 0); + todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME)) + ok(num == len, "expected %u, got %u\n", len, num); + ok(!wcscmp(filenameW, L"dummy"), "got %s\n", wine_dbgstr_w(filenameW)); + + num = DragQueryFileW(hDrop, 0, filenameW, ARRAY_SIZE(filename)); + todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME)) + ok(num == len, "expected %u, got %u\n", len, num); + ok(!wcscmp(filenameW, expected_filenameW), "expected %s, got %s\n", + wine_dbgstr_w(expected_filenameW), wine_dbgstr_w(filenameW)); + + memset(filenameW, 0xaa, sizeof(filenameW)); + num = DragQueryFileW(hDrop, 0, filenameW, 2); + todo_wine ok(num == 1, "expected 1, got %u\n", num); + ok(filenameW[0] == expected_filenameW[0], "expected '%lc', got '%lc'\n", + expected_filenameW[0], filenameW[0]); + ok(filenameW[1] == L'\0', "expected nul, got %#x\n", (WCHAR)filenameW[1]); + r = DragQueryPoint(hDrop, &pt); - ok(r == expected, "expected %d, got %d\n", expected, r); + ok(r == !(flags & DROP_NC_AREA), "expected %d, got %d\n", !(flags & DROP_NC_AREA), r); ok(pt.x == 10, "expected 10, got %ld\n", pt.x); ok(pt.y == 20, "expected 20, got %ld\n", pt.y); DragFinish(hDrop); @@ -909,7 +938,24 @@ static void test_DragQueryFile(BOOL non_client_flag) GlobalUnlock(hDrop);
r = PostMessageA(param.hwnd, WM_EXPECTED_VALUE, - (WPARAM)testcase[i].filename, !non_client_flag); + (WPARAM)testcase[i].filename, DROP_WIDE_FILENAME | (non_client_flag ? DROP_NC_AREA : 0)); + ok(r, "got %d\n", r); + + r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0); + ok(r, "got %d\n", r); + + hDrop = GlobalAlloc(GHND, sizeof(DROPFILES) + strlen(testcase[i].filename) + 2); + pDrop = GlobalLock(hDrop); + pDrop->pt.x = 10; + pDrop->pt.y = 20; + pDrop->fNC = non_client_flag; + pDrop->pFiles = sizeof(DROPFILES); + strcpy((char *)(pDrop + 1), testcase[i].filename); + pDrop->fWide = FALSE; + GlobalUnlock(hDrop); + + r = PostMessageA(param.hwnd, WM_EXPECTED_VALUE, + (WPARAM)testcase[i].filename, non_client_flag ? DROP_NC_AREA : 0); ok(r, "got %d\n", r);
r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0); @@ -928,6 +974,8 @@ static void test_DragQueryFile(BOOL non_client_flag) CloseHandle(hThread); } #undef WM_EXPECTED_VALUE +#undef DROP_NC_AREA +#undef DROP_WIDE_FILENAME
static void test_SHCreateSessionKey(void) {
From: Akihiro Sagawa sagawa.aki@gmail.com
--- dlls/shell32/shellole.c | 66 ++++++++++++++++++++--------------- dlls/shell32/tests/shellole.c | 3 -- 2 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 055244b1e67..0ee5c95402b 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -621,50 +621,58 @@ UINT WINAPI DragQueryFileW( LPWSTR lpszwFile, UINT lLength) { - LPWSTR lpwDrop; + LPWSTR buffer = NULL; + LPCWSTR filename; UINT i = 0; - DROPFILES *lpDropFileStruct = GlobalLock(hDrop); + const DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);
if(!lpDropFileStruct) goto end;
- lpwDrop = (LPWSTR) ((LPSTR)lpDropFileStruct + lpDropFileStruct->pFiles); - - if(lpDropFileStruct->fWide == FALSE) { - LPSTR lpszFileA = NULL; - - if(lpszwFile && lFile != 0xFFFFFFFF) { - lpszFileA = malloc(lLength); - if(lpszFileA == NULL) { + if(lpDropFileStruct->fWide) + { + LPCWSTR p = (LPCWSTR) ((LPCSTR)lpDropFileStruct + lpDropFileStruct->pFiles); + while (i++ < lFile) + { + while (*p++); /* skip filename */ + if (!*p) + { + i = (lFile == 0xFFFFFFFF) ? i : 0; goto end; } } - i = DragQueryFileA(hDrop, lFile, lpszFileA, lLength); - - if(lpszFileA) { - MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength); - free(lpszFileA); + filename = p; + } + else + { + LPCSTR p = (LPCSTR)lpDropFileStruct + lpDropFileStruct->pFiles; + while (i++ < lFile) + { + while (*p++); /* skip filename */ + if (!*p) + { + i = (lFile == 0xFFFFFFFF) ? i : 0; + goto end; + } } - goto end; + i = MultiByteToWideChar(CP_ACP, 0, p, -1, NULL, 0); + buffer = malloc(i * sizeof(WCHAR)); + if (!buffer) + { + i = 0; + goto end; + } + MultiByteToWideChar(CP_ACP, 0, p, -1, buffer, i); + filename = buffer; }
- i = 0; - while (i++ < lFile) - { - while (*lpwDrop++); /* skip filename */ - if (!*lpwDrop) - { - i = (lFile == 0xFFFFFFFF) ? i : 0; - goto end; - } - } - - i = lstrlenW(lpwDrop); + i = lstrlenW(filename); if ( !lpszwFile) goto end; /* needed buffer size */ - lstrcpynW (lpszwFile, lpwDrop, lLength); + lstrcpynW(lpszwFile, filename, lLength); end: GlobalUnlock(hDrop); + free(buffer); return i; }
diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c index 0b1146ba8bb..7d1204d1c1f 100644 --- a/dlls/shell32/tests/shellole.c +++ b/dlls/shell32/tests/shellole.c @@ -809,16 +809,13 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
len = wcslen(expected_filenameW); num = DragQueryFileW(hDrop, 0, NULL, 0); - todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num);
num = DragQueryFileW(hDrop, 0, filenameW, 0); - todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num); ok(!wcscmp(filenameW, L"dummy"), "got %s\n", wine_dbgstr_w(filenameW));
num = DragQueryFileW(hDrop, 0, filenameW, ARRAY_SIZE(filename)); - todo_wine_if(expected_filename[0] == 'd' && !(flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num); ok(!wcscmp(filenameW, expected_filenameW), "expected %s, got %s\n", wine_dbgstr_w(expected_filenameW), wine_dbgstr_w(filenameW));
From: Akihiro Sagawa sagawa.aki@gmail.com
Now, it returns a correct buffer size especially for a DBCS file name.
Wine-Bugs: https://bugs.winehq.org/show_bug.cgi?id=53738 --- dlls/shell32/shellole.c | 72 ++++++++++++++--------------------- dlls/shell32/tests/shellole.c | 3 -- 2 files changed, 28 insertions(+), 47 deletions(-)
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 0ee5c95402b..4f9d0db7ff6 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -560,56 +560,40 @@ BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p) * DragQueryFileA [SHELL32.@] * DragQueryFile [SHELL32.@] */ -UINT WINAPI DragQueryFileA( - HDROP hDrop, - UINT lFile, - LPSTR lpszFile, - UINT lLength) +UINT WINAPI DragQueryFileA(HDROP hDrop, UINT lFile, LPSTR lpszFile, UINT lLength) { - LPSTR lpDrop; - UINT i = 0; - DROPFILES *lpDropFileStruct = GlobalLock(hDrop); - - TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength); + LPWSTR filenameW = NULL; + LPSTR filename = NULL; + UINT i;
- if(!lpDropFileStruct) goto end; + TRACE("(%p, %x, %p, %u)\n", hDrop, lFile, lpszFile, lLength);
- lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles; - - if(lpDropFileStruct->fWide) { - LPWSTR lpszFileW = NULL; - - if(lpszFile && lFile != 0xFFFFFFFF) { - lpszFileW = malloc(lLength * sizeof(WCHAR)); - if(lpszFileW == NULL) { - goto end; - } - } - i = DragQueryFileW(hDrop, lFile, lpszFileW, lLength); + i = DragQueryFileW(hDrop, lFile, NULL, 0); + if (!i || lFile == 0xFFFFFFFF) goto end; + filenameW = malloc((i + 1) * sizeof(WCHAR)); + if (!filenameW) goto error; + if (!DragQueryFileW(hDrop, lFile, filenameW, i + 1)) goto error;
- if(lpszFileW) { - WideCharToMultiByte(CP_ACP, 0, lpszFileW, -1, lpszFile, lLength, 0, NULL); - free(lpszFileW); - } - goto end; - } - - while (i++ < lFile) - { - while (*lpDrop++); /* skip filename */ - if (!*lpDrop) - { - i = (lFile == 0xFFFFFFFF) ? i : 0; - goto end; - } - } + i = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL); + if (!lpszFile || !lLength) + { + /* minus a trailing null */ + i--; + goto end; + } + filename = malloc(i); + if (!filename) goto error; + WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, i, NULL, NULL);
- i = strlen(lpDrop); - if (!lpszFile ) goto end; /* needed buffer size */ - lstrcpynA (lpszFile, lpDrop, lLength); + i = strlen(filename); + lstrcpynA(lpszFile, filename, lLength); end: - GlobalUnlock(hDrop); - return i; + free(filenameW); + free(filename); + return i; +error: + i = 0; + goto end; }
/************************************************************************* diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c index 7d1204d1c1f..ca156ebda62 100644 --- a/dlls/shell32/tests/shellole.c +++ b/dlls/shell32/tests/shellole.c @@ -783,16 +783,13 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
len = strlen(expected_filename); num = DragQueryFileA(hDrop, 0, NULL, 0); - todo_wine_if(expected_filename[0] == 'd' && (flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num);
num = DragQueryFileA(hDrop, 0, filename, 0); - todo_wine_if(expected_filename[0] == 'd' && (flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num); ok(!strcmp(filename, "dummy"), "got %s\n", filename);
num = DragQueryFileA(hDrop, 0, filename, sizeof(filename)); - todo_wine_if(expected_filename[0] == 'd' && (flags & DROP_WIDE_FILENAME)) ok(num == len, "expected %u, got %u\n", len, num); ok(!strcmp(filename, expected_filename), "expected %s, got %s\n", expected_filename, filename);
From: Akihiro Sagawa sagawa.aki@gmail.com
--- dlls/shell32/shellole.c | 3 ++- dlls/shell32/tests/shellole.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 4f9d0db7ff6..45ff2a5410c 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -652,8 +652,9 @@ UINT WINAPI DragQueryFileW( }
i = lstrlenW(filename); - if ( !lpszwFile) goto end; /* needed buffer size */ + if (!lpszwFile || !lLength) goto end; /* needed buffer size */ lstrcpynW(lpszwFile, filename, lLength); + i = min(i, lLength - 1); end: GlobalUnlock(hDrop); free(buffer); diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c index ca156ebda62..6d9d348dc6e 100644 --- a/dlls/shell32/tests/shellole.c +++ b/dlls/shell32/tests/shellole.c @@ -819,7 +819,7 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
memset(filenameW, 0xaa, sizeof(filenameW)); num = DragQueryFileW(hDrop, 0, filenameW, 2); - todo_wine ok(num == 1, "expected 1, got %u\n", num); + ok(num == 1, "expected 1, got %u\n", num); ok(filenameW[0] == expected_filenameW[0], "expected '%lc', got '%lc'\n", expected_filenameW[0], filenameW[0]); ok(filenameW[1] == L'\0', "expected nul, got %#x\n", (WCHAR)filenameW[1]);
From: Akihiro Sagawa sagawa.aki@gmail.com
--- dlls/shell32/shellole.c | 4 ++-- dlls/shell32/tests/shellole.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 45ff2a5410c..29d973bf165 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -583,10 +583,10 @@ UINT WINAPI DragQueryFileA(HDROP hDrop, UINT lFile, LPSTR lpszFile, UINT lLength } filename = malloc(i); if (!filename) goto error; - WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, i, NULL, NULL); + i = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, i, NULL, NULL);
- i = strlen(filename); lstrcpynA(lpszFile, filename, lLength); + i = min(i, lLength) - 1; end: free(filenameW); free(filename); diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c index 6d9d348dc6e..4864d35ea9a 100644 --- a/dlls/shell32/tests/shellole.c +++ b/dlls/shell32/tests/shellole.c @@ -796,7 +796,7 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
memset(filename, 0xaa, sizeof(filename)); num = DragQueryFileA(hDrop, 0, filename, 2); - todo_wine ok(num == 1, "expected 1, got %u\n", num); + ok(num == 1, "expected 1, got %u\n", num); ok(filename[0] == expected_filename[0], "expected '%c', got '%c'\n", expected_filename[0], filename[0]); ok(filename[1] == '\0', "expected nul, got %#x\n", (BYTE)filename[1]);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125552
Your paranoid android.
=== debian11 (32 bit zh:CN report) ===
shell32: autocomplete.c:614: Test failed: Expected (null), got L"ab" autocomplete.c:637: Test failed: Expected (null), got L"www.ax"