Commit fa010ad2 authored by Nicolas Le Cam's avatar Nicolas Le Cam Committed by Alexandre Julliard

shell32/tests: Fix ITEMIDLIST format test on Win2k and below.

On Win2k SHITEMID only contains FileStructA. This structure isn't padded like it is on WinXP and contains a supplementary CHAR* member at its end which contains the 8.3 filename if needed.
parent fbcec1ca
...@@ -1380,7 +1380,7 @@ static void test_ITEMIDLIST_format(void) { ...@@ -1380,7 +1380,7 @@ static void test_ITEMIDLIST_format(void) {
{ 'l','o','n','g','e','r','_','t','h','a','n','.','8','_','3',0 } }; { 'l','o','n','g','e','r','_','t','h','a','n','.','8','_','3',0 } };
int i; int i;
if(!pSHGetSpecialFolderPathW) return; if (!pSHGetSpecialFolderPathW) return;
bResult = pSHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE); bResult = pSHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE);
ok(bResult, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError()); ok(bResult, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError());
...@@ -1449,10 +1449,14 @@ static void test_ITEMIDLIST_format(void) { ...@@ -1449,10 +1449,14 @@ static void test_ITEMIDLIST_format(void) {
* this nasty short/long filename stuff. So we'll probably stay with our * this nasty short/long filename stuff. So we'll probably stay with our
* current habbit of storing the long filename here, which seems to work * current habbit of storing the long filename here, which seems to work
* just fine. */ * just fine. */
todo_wine { ok(pidlFile->mkid.abID[18] == '~', "Should be derived 8.3 name!\n"); } todo_wine
ok(pidlFile->mkid.abID[18] == '~' ||
broken(pidlFile->mkid.abID[34] == '~'), /* Win2k */
"Should be derived 8.3 name!\n");
if (i == 0) /* First file name has an even number of chars. No need for alignment. */ if (i == 0) /* First file name has an even number of chars. No need for alignment. */
ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0', ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0' ||
broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1), /* Win2k */
"Alignment byte, where there shouldn't be!\n"); "Alignment byte, where there shouldn't be!\n");
if (i == 1) /* Second file name has an uneven number of chars => alignment byte */ if (i == 1) /* Second file name has an uneven number of chars => alignment byte */
...@@ -1461,8 +1465,10 @@ static void test_ITEMIDLIST_format(void) { ...@@ -1461,8 +1465,10 @@ static void test_ITEMIDLIST_format(void) {
/* The offset of the FileStructW member is stored as a WORD at the end of the pidl. */ /* The offset of the FileStructW member is stored as a WORD at the end of the pidl. */
cbOffset = *(WORD*)(((LPBYTE)pidlFile)+pidlFile->mkid.cb-sizeof(WORD)); cbOffset = *(WORD*)(((LPBYTE)pidlFile)+pidlFile->mkid.cb-sizeof(WORD));
ok (cbOffset >= sizeof(struct FileStructA) && ok ((cbOffset >= sizeof(struct FileStructA) &&
cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW), cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)) ||
broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1) || /* Win2k on short names */
broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 12 + 1), /* Win2k on long names */
"Wrong offset value (%d) stored at the end of the PIDL\n", cbOffset); "Wrong offset value (%d) stored at the end of the PIDL\n", cbOffset);
if (cbOffset >= sizeof(struct FileStructA) && if (cbOffset >= sizeof(struct FileStructA) &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment