On 12/11/2009 10:57 AM, Alexandre Hardy wrote:
@@ -1067,6 +1067,12 @@ static void test_GetLongPathNameW(void)
{
DWORD length;
WCHAR empty[MAX_PATH];
+ WCHAR tempfile[MAX_PATH];
+ WCHAR longpath[MAX_PATH];
+ WCHAR shortpath[MAX_PATH];
+ WCHAR longfilename[] = {'l', 'o', 'n', 'g', 'f', 'i', 'l', 'e', 'n', 'a',
'm', 'e', '.', 'l', 'o', 'n', 'g', 'e', 'x', 't', 0};
+ WCHAR uncprefix[] = {'\\', '\\' , '?', '\\', 0};
+ HANDLE file;
/* Not present in all windows versions */
if(pGetLongPathNameW)
@@ -1086,6 +1092,29 @@ static void test_GetLongPathNameW(void)
length = pGetLongPathNameW(empty,NULL,0);
ok(0==length,"GetLongPathNameW returned %d but expected 0\n",length);
ok(GetLastError()==ERROR_PATH_NOT_FOUND,"GetLastError returned %d but expected
ERROR_PATH_NOT_FOUND\n",GetLastError());
+
+ GetTempPathW(MAX_PATH, tempfile);
+ lstrcatW(tempfile, longfilename);
+
+ file = CreateFileW(tempfile, GENERIC_READ|GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ CloseHandle(file);
+
+ memset(longpath, 0, MAX_PATH * sizeof(WCHAR));
Don't think this memset makes sense as you do lstrcpyW after that (and
yes it does not make sense in the A-test I did either ;) ).
+ lstrcpyW(longpath, uncprefix);
+ lstrcatW(longpath, tempfile);
+ length = pGetLongPathNameW(longpath,NULL,0);
+ todo_wine
+ ok(lstrlenW(longpath) + 1==length,"GetLongPathNameW returned %d but expected
0\n",length);
You're saying that length should be 0 but the test tests something else.
+
+ memset(shortpath, 0, MAX_PATH * sizeof(WCHAR));
+ memset(longpath, 0, MAX_PATH * sizeof(WCHAR));
You're setting longpath but it's not used anymore after that.
+ lstrcpyW(shortpath, uncprefix);
+ GetShortPathNameW(shortpath + 4, tempfile, MAX_PATH - 4);
+ length = pGetLongPathNameW(shortpath,NULL,0);
This doesn't make sense to me. You are fill tempfile but not using it
afterwards and then you call pGetLongPathNameW with NULL?
+ todo_wine
+ ok(lstrlenW(longpath) + 5==length,"GetLongPathNameW returned %d but expected
0\n",length);
+
+ DeleteFileW(tempfile);
}
}
These are added tests but Wine crashes right now with these?
--
Cheers,
Paul.