"Fourth added which is very long because at some time we only had a 256 byte character buffer and that was overflowing in one of those applications that had a common dialog file open box and tried to add a 300 characters long custom filter string which of course the code did not like and crashed. Just make sure this string is longer than 256 characters."
};
+static const char BAD_EXTENSION[] = "*.txtbad";
+
static HWND
create_listbox (DWORD add_style, HWND parent)
{
itemCount - 1, res);
/* This tests behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
SendMessage(hList, LB_RESETCONTENT, 0, 0);
res = SendMessage(hList, LB_DIR, 0, (LPARAM)pathBuffer);
- ok (res == -1, "SendMessage(LB_DIR, 0, *.txt) returned %d, expected -1\n", res);
+ ok (res == -1, "SendMessage(LB_DIR, 0, %s) returned %d, expected -1\n", BAD_EXTENSION, res);
/* There should be NO content in the listbox */
itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
itemCount - 1, res);
/* This tests behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
SendMessage(hList, LB_RESETCONTENT, 0, 0);
res = SendMessage(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
- ok (res == -1, "SendMessage(LB_DIR, DDL_DIRECTORY, *.txt) returned %d, expected -1\n", res);
+ ok (res == -1, "SendMessage(LB_DIR, DDL_DIRECTORY, %s) returned %d, expected -1\n", BAD_EXTENSION, res);
/* There should be NO content in the listbox */
itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
}
/* This tests behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
SendMessage(hList, LB_RESETCONTENT, 0, 0);
res = SendMessage(hList, LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
- ok (res == itemCount_justDrives -1, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, *.txt) returned %d, expected %d\n",
- res, itemCount_justDrives -1);
+ ok (res == itemCount_justDrives -1, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, %s) returned %d, expected %d\n",
+ BAD_EXTENSION, res, itemCount_justDrives -1);
itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
ok (itemCount == itemCount_justDrives, "SendMessage(LB_DIR) returned %d expected %d\n",
ok(res + 1 == itemCount, "SendMessage(LB_DIR, DDL_DRIVES, w*.c) returned incorrect index!\n");
/* This tests behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
SendMessage(hList, LB_RESETCONTENT, 0, 0);
res = SendMessage(hList, LB_DIR, DDL_DRIVES, (LPARAM)pathBuffer);
- ok (res == itemCount_justDrives -1, "SendMessage(LB_DIR, DDL_DRIVES, *.txt) returned %d, expected %d\n",
- res, itemCount_justDrives -1);
+ ok (res == itemCount_justDrives -1, "SendMessage(LB_DIR, DDL_DRIVES, %s) returned %d, expected %d\n",
+ BAD_EXTENSION, res, itemCount_justDrives -1);
itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
ok (itemCount == res + 1, "SendMessage(LB_DIR) returned %d expected %d\n", itemCount, res + 1);
}
/* This tests behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
SendMessage(hList, LB_RESETCONTENT, 0, 0);
res = SendMessage(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES, (LPARAM)pathBuffer);
- ok (res == itemCount_justDrives -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, *.txt) returned %d, expected %d\n",
- res, itemCount_justDrives -1);
+ ok (res == itemCount_justDrives -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, %s) returned %d, expected %d\n",
+ BAD_EXTENSION, res, itemCount_justDrives -1);
itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
ok (itemCount == res + 1, "SendMessage(LB_DIR) returned %d expected %d\n", itemCount, res + 1);
ok( !strcmp(pathBuffer, "[..]"), "First (and only) element is not [..]\n");
/* This tests behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
SendMessage(hList, LB_RESETCONTENT, 0, 0);
res = SendMessage(hList, LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
- ok (res == -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *.txt) returned %d, expected %d\n",
- res, -1);
+ ok (res == -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, %s) returned %d, expected %d\n",
+ BAD_EXTENSION, res, -1);
itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
ok (itemCount == res + 1, "SendMessage(LB_DIR) returned %d expected %d\n", itemCount, res + 1);
}
/* This tests behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
SendMessage(hList, LB_RESETCONTENT, 0, 0);
res = SendMessage(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
- ok (res == itemCount_justDrives -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, *.txt) returned %d, expected %d\n",
- res, itemCount_justDrives -1);
+ ok (res == itemCount_justDrives -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, %s) returned %d, expected %d\n",
+ BAD_EXTENSION, res, itemCount_justDrives -1);
itemCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
ok (itemCount == res + 1, "SendMessage(LB_DIR) returned %d expected %d\n", itemCount, res + 1);
}
/* Test behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL, 0);
- ok (res == 1, "DlgDirList(*.txt, 0) returned %d expected 1\n", res);
+ ok (res == 1, "DlgDirList(%s, 0) returned %d expected 1\n", BAD_EXTENSION, res);
itemCount = SendMessage(g_listBox, LB_GETCOUNT, 0, 0);
ok (itemCount == 0, "DlgDirList() DID fill the listbox!\n");
}
/* Test behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY);
- ok (res == 1, "DlgDirList(*.txt, DDL_DIRECTORY) returned %d expected 1\n", res);
+ ok (res == 1, "DlgDirList(%s, DDL_DIRECTORY) returned %d expected 1\n", BAD_EXTENSION, res);
itemCount = SendMessage(g_listBox, LB_GETCOUNT, 0, 0);
ok (itemCount == 1, "DlgDirList() incorrectly filled the listbox! (expected 1 got %d)\n",
}
/* Test behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DRIVES);
- ok (res == 1, "DlgDirList(*.txt, DDL_DRIVES) returned %d expected 1\n", res);
+ ok (res == 1, "DlgDirList(%s, DDL_DRIVES) returned %d expected 1\n", BAD_EXTENSION, res);
itemCount = SendMessage(g_listBox, LB_GETCOUNT, 0, 0);
ok (itemCount == itemCount_justDrives, "DlgDirList() incorrectly filled the listbox!\n");
}
/* Test behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY|DDL_DRIVES);
- ok (res == 1, "DlgDirList(*.txt, DDL_DIRECTORY|DDL_DRIVES) returned %d expected 1\n", res);
+ ok (res == 1, "DlgDirList(%s, DDL_DIRECTORY|DDL_DRIVES) returned %d expected 1\n", BAD_EXTENSION, res);
itemCount = SendMessage(g_listBox, LB_GETCOUNT, 0, 0);
ok (itemCount == itemCount_justDrives + 1,
/* Test behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY|DDL_EXCLUSIVE);
- ok (res == 1, "DlgDirList(*.txt, DDL_DIRECTORY|DDL_EXCLUSIVE) returned %d expected 1\n", res);
+ ok (res == 1, "DlgDirList(%s, DDL_DIRECTORY|DDL_EXCLUSIVE) returned %d expected 1\n", BAD_EXTENSION, res);
itemCount = SendMessage(g_listBox, LB_GETCOUNT, 0, 0);
ok (itemCount == 1, "DlgDirList() incorrectly filled the listbox!\n");
}
/* Test behavior when no files match the wildcard */
- strcpy(pathBuffer, "*.txt");
+ strcpy(pathBuffer, BAD_EXTENSION);
res = DlgDirList(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE);
- ok (res == 1, "DlgDirList(*.txt, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE) returned %d expected 1\n", res);
+ ok (res == 1, "DlgDirList(%s, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE) returned %d expected 1\n", BAD_EXTENSION, res);
itemCount = SendMessage(g_listBox, LB_GETCOUNT, 0, 0);
ok (itemCount == itemCount_justDrives + 1, "DlgDirList() incorrectly filled the listbox!\n");