user32: Add DlgDirList wildcard checks.
Based on a patch from Christian Lupien. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=8226 Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7272bd8994
commit
7a6b00dc25
|
@ -1941,7 +1941,7 @@ static void test_listbox_dlgdir(void)
|
|||
strcpy(pathBuffer, "C:\\");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
|
||||
ok(res, "DlgDirList failed to list C:\\ folders\n");
|
||||
todo_wine ok(!strcmp(pathBuffer, "*"), "DlgDirList set the invalid path spec '%s', expected '*'\n", pathBuffer);
|
||||
ok(!strcmp(pathBuffer, "*"), "DlgDirList set the invalid path spec '%s', expected '*'\n", pathBuffer);
|
||||
|
||||
strcpy(pathBuffer, "C:\\*");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
|
||||
|
@ -1952,8 +1952,8 @@ static void test_listbox_dlgdir(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
strcpy(pathBuffer, "C:\\INVALID$$DIR");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
|
||||
todo_wine ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
|
||||
todo_wine ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
|
||||
ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
|
||||
ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
|
||||
"GetLastError should return 0x589, got 0x%X\n",GetLastError());
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
|
|
|
@ -1821,6 +1821,7 @@ static INT DIALOG_DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox,
|
|||
HWND hwnd;
|
||||
LPWSTR orig_spec = spec;
|
||||
WCHAR any[] = {'*','.','*',0};
|
||||
WCHAR star[] = {'*',0};
|
||||
|
||||
#define SENDMSG(msg,wparam,lparam) \
|
||||
((attrib & DDL_POSTMSGS) ? PostMessageW( hwnd, msg, wparam, lparam ) \
|
||||
|
@ -1829,10 +1830,16 @@ static INT DIALOG_DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox,
|
|||
TRACE("%p %s %d %d %04x\n", hDlg, debugstr_w(spec), idLBox, idStatic, attrib );
|
||||
|
||||
/* If the path exists and is a directory, chdir to it */
|
||||
if (!spec || !spec[0] || SetCurrentDirectoryW( spec )) spec = any;
|
||||
if (!spec || !spec[0] || SetCurrentDirectoryW( spec )) spec = star;
|
||||
else
|
||||
{
|
||||
WCHAR *p, *p2;
|
||||
|
||||
if (!strchrW(spec, '*') && !strchrW(spec, '?'))
|
||||
{
|
||||
SetLastError(ERROR_NO_WILDCARD_CHARACTERS);
|
||||
return FALSE;
|
||||
}
|
||||
p = spec;
|
||||
if ((p2 = strchrW( p, ':' ))) p = p2 + 1;
|
||||
if ((p2 = strrchrW( p, '\\' ))) p = p2;
|
||||
|
|
|
@ -1836,7 +1836,7 @@ static void test_listbox_dlgdir(void)
|
|||
strcpy(pathBuffer, "C:\\");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
|
||||
ok(res || broken(!res) /* NT4/W2K */, "DlgDirList failed to list C:\\ folders\n");
|
||||
todo_wine ok(!strcmp(pathBuffer, "*") || broken(!res) /* NT4/W2K */,
|
||||
ok(!strcmp(pathBuffer, "*") || broken(!res) /* NT4/W2K */,
|
||||
"DlgDirList set the invalid path spec '%s', expected '*'\n", pathBuffer);
|
||||
|
||||
strcpy(pathBuffer, "C:\\*");
|
||||
|
@ -1849,8 +1849,8 @@ static void test_listbox_dlgdir(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
strcpy(pathBuffer, "C:\\INVALID$$DIR");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
|
||||
todo_wine ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
|
||||
todo_wine ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
|
||||
ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
|
||||
ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
|
||||
"GetLastError should return 0x589, got 0x%X\n",GetLastError());
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
|
|
Loading…
Reference in New Issue