Module: wine
Branch: master
Commit: fa010ad211b43be723866a36b8e2bddeb7ec9912
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fa010ad211b43be723866a36b…
Author: Nicolas Le Cam <niko.lecam(a)gmail.com>
Date: Thu Apr 9 01:30:31 2009 +0200
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.
---
dlls/shell32/tests/shlfolder.c | 46 ++++++++++++++++++++++-----------------
1 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index 5c30a7b..1d63778 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -1376,11 +1376,11 @@ static void test_ITEMIDLIST_format(void) {
HANDLE hFile;
HRESULT hr;
BOOL bResult;
- WCHAR wszFile[3][17] = { { 'e','v','e','n','_',0 }, { 'o','d','d','_',0 },
+ WCHAR wszFile[3][17] = { { 'e','v','e','n','_',0 }, { 'o','d','d','_',0 },
{ 'l','o','n','g','e','r','_','t','h','a','n','.','8','_','3',0 } };
int i;
-
- if(!pSHGetSpecialFolderPathW) return;
+
+ if (!pSHGetSpecialFolderPathW) return;
bResult = pSHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE);
ok(bResult, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError());
@@ -1417,9 +1417,9 @@ static void test_ITEMIDLIST_format(void) {
CHAR szFile[MAX_PATH];
struct FileStructA *pFileStructA;
WORD cbOffset;
-
+
WideCharToMultiByte(CP_ACP, 0, wszFile[i], -1, szFile, MAX_PATH, NULL, NULL);
-
+
hFile = CreateFileW(wszFile[i], GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_FLAG_WRITE_THROUGH, NULL);
ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed! (%u)\n", GetLastError());
if (hFile == INVALID_HANDLE_VALUE) {
@@ -1439,51 +1439,57 @@ static void test_ITEMIDLIST_format(void) {
pFileStructA = (struct FileStructA *)pidlFile->mkid.abID;
ok(pFileStructA->type == 0x32, "PIDLTYPE should be 0x32!\n");
ok(pFileStructA->dummy == 0x00, "Dummy Byte should be 0x00!\n");
- ok(pFileStructA->dwFileSize == 0, "Filesize should be zero!\n");
+ ok(pFileStructA->dwFileSize == 0, "Filesize should be zero!\n");
- if (i < 2) /* First two file names are already in valid 8.3 format */
+ if (i < 2) /* First two file names are already in valid 8.3 format */
ok(!strcmp(szFile, (CHAR*)&pidlFile->mkid.abID[12]), "Wrong file name!\n");
- else
+ else
/* WinXP stores a derived 8.3 dos name (LONGER~1.8_3) here. We probably
* can't implement this correctly, since unix filesystems don't support
* 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
* 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. */
- ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0',
- "Alignment byte, where there shouldn't be!\n");
-
+ 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");
+
if (i == 1) /* Second file name has an uneven number of chars => alignment byte */
- ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] == '\0',
+ ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] == '\0',
"There should be an alignment byte, but isn't!\n");
/* 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));
- ok (cbOffset >= sizeof(struct FileStructA) &&
- cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW),
+ ok ((cbOffset >= sizeof(struct FileStructA) &&
+ 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);
if (cbOffset >= sizeof(struct FileStructA) &&
- cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW))
+ cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW))
{
struct FileStructW *pFileStructW = (struct FileStructW *)(((LPBYTE)pidlFile)+cbOffset);
- ok(pidlFile->mkid.cb == cbOffset + pFileStructW->cbLen,
+ ok(pidlFile->mkid.cb == cbOffset + pFileStructW->cbLen,
"FileStructW's offset and length should add up to the PIDL's length!\n");
if (pidlFile->mkid.cb == cbOffset + pFileStructW->cbLen) {
/* Since we just created the file, time of creation,
- * time of last access and time of last write access just be the same.
- * These tests seem to fail sometimes (on WinXP), if the test is run again shortly
+ * time of last access and time of last write access just be the same.
+ * These tests seem to fail sometimes (on WinXP), if the test is run again shortly
* after the first run. I do remember something with NTFS keeping the creation time
* if a file is deleted and then created again within a couple of seconds or so.
* Might be the reason. */
ok (pFileStructA->uFileDate == pFileStructW->uDate &&
pFileStructA->uFileTime == pFileStructW->uTime,
"Last write time should match creation time!\n");
-
+
ok (pFileStructA->uFileDate == pFileStructW->uDate2 &&
pFileStructA->uFileTime == pFileStructW->uTime2,
"Last write time should match last access time!\n");
Module: wine
Branch: master
Commit: fbcec1ca56e7acff180b23e81b6f1d38060ad4b0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fbcec1ca56e7acff180b23e81…
Author: Nicolas Le Cam <niko.lecam(a)gmail.com>
Date: Thu Apr 9 00:01:12 2009 +0200
shell32/tests: Skip FolderShortcut test on Win2k.
Skip this test as it doesn't work on Win2k.
CoCreateInstance is successful but IPersistPropertyBag_Load call fails.
---
dlls/shell32/tests/shlfolder.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index a45a386..5c30a7b 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -1196,7 +1196,13 @@ static void test_FolderShortcut(void) {
win_skip("SHGetSpecialFolderPathW and/or StrRetToBufW are not available\n");
return;
}
-
+
+ if (!pSHGetFolderPathAndSubDirA)
+ {
+ win_skip("FolderShortcut test doesn't work on Win2k\n");
+ return;
+ }
+
/* These tests basically show, that CLSID_FolderShortcuts are initialized
* via their IPersistPropertyBag interface. And that the target folder
* is taken from the IPropertyBag's 'Target' property.
@@ -1216,7 +1222,7 @@ static void test_FolderShortcut(void) {
IPersistPropertyBag_Release(pPersistPropertyBag);
return;
}
-
+
hr = IPersistPropertyBag_QueryInterface(pPersistPropertyBag, &IID_IShellFolder,
(LPVOID*)&pShellFolder);
IPersistPropertyBag_Release(pPersistPropertyBag);
Module: wine
Branch: master
Commit: eb57396fc62b1c4fc56c187273c534ca82abc1f3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=eb57396fc62b1c4fc56c18727…
Author: Nicolas Le Cam <niko.lecam(a)gmail.com>
Date: Tue Apr 7 19:15:35 2009 +0200
shell32/tests: Skip interactive part of SetNameOf test on Win2k.
Passing an absolute path to SetNameOf on Win2k display an error
message box about invalid characters in filename, forcing interaction
during test.
---
dlls/shell32/tests/shlfolder.c | 63 +++++++++++++++++++++------------------
1 files changed, 34 insertions(+), 29 deletions(-)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index 08ea9cc..cbbad01 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -473,7 +473,7 @@ static void test_GetDisplayName(void)
IShellFolder_Release(psfFile);
}
- if(!pSHBindToParent)
+ if (!pSHBindToParent)
{
win_skip("SHBindToParent is missing\n");
DeleteFileA(szTestFile);
@@ -482,37 +482,42 @@ static void test_GetDisplayName(void)
}
/* Some tests for IShellFolder::SetNameOf */
- hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
- ok(SUCCEEDED(hr), "SHBindToParent failed! hr = %08x\n", hr);
- if (SUCCEEDED(hr)) {
- /* It's ok to use this fixed path. Call will fail anyway. */
- WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
- LPITEMIDLIST pidlNew;
-
- /* The pidl returned through the last parameter of SetNameOf is a simple one. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
- ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
- if(hr == S_OK)
- {
- ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
- "pidl returned from SetNameOf should be simple!\n");
-
- /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
- * is implemented on top of SHFileOperation in WinXP. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename,
- SHGDN_FORPARSING, NULL);
- ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
-
- /* Rename the file back to its original name. SetNameOf ignores the fact, that the
- * SHGDN flags specify an absolute path. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
+ if (pSHGetFolderPathAndSubDirA)
+ {
+ hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
+ ok(SUCCEEDED(hr), "SHBindToParent failed! hr = %08x\n", hr);
+ if (SUCCEEDED(hr)) {
+ /* It's ok to use this fixed path. Call will fail anyway. */
+ WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
+ LPITEMIDLIST pidlNew;
+
+ /* The pidl returned through the last parameter of SetNameOf is a simple one. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
+ if (hr == S_OK)
+ {
+ ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
+ "pidl returned from SetNameOf should be simple!\n");
+
+ /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
+ * is implemented on top of SHFileOperation in WinXP. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename,
+ SHGDN_FORPARSING, NULL);
+ ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
+
+ /* Rename the file back to its original name. SetNameOf ignores the fact, that the
+ * SHGDN flags specify an absolute path. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
+ ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
+
+ pILFree(pidlNew);
+ }
- pILFree(pidlNew);
+ IShellFolder_Release(psfPersonal);
}
-
- IShellFolder_Release(psfPersonal);
}
+ else
+ win_skip("Avoid needs of interaction on Win2k\n");
/* Deleting the file and the directory */
DeleteFileA(szTestFile);