Hi Paul, Thanks for the help with the tests. Here is a new set of tests. I'll send the patch that makes these tests succeed shortly. I would appreciate it if you could have a look at it.
Kind regards Alexandre On Fri, Dec 11, 2009 at 12:25 PM, Alexandre Hardy <alexandre.ha...@gmail.com> wrote: > Hi Paul, > >> 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 ;) ). > > Okay, that can be removed... > >> You're saying that length should be 0 but the test tests something else. > > WIll correct that (copy and paste -> I was in too much of a hurry) > >> >>> + >>> + memset(shortpath, 0, MAX_PATH * sizeof(WCHAR)); >>> + memset(longpath, 0, MAX_PATH * sizeof(WCHAR)); > > I should remove that as well :) > >> >> 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? > > Yes, sorry, that should be > GetShortPathNameW(tempfile, shortpath + 4, MAX_PATH - 4); > >> These are added tests but Wine crashes right now with these? > > Yes, wine crashes right now with these. > > Kind regards > Alexandre > > > -- > -------------------------------------------------- > Alexandre Hardy > http://www.ahardy.za.net > -- -------------------------------------------------- Alexandre Hardy http://www.ahardy.za.net
From 05e69ddb946cc0de5c71157ea83bcd24f013bbe1 Mon Sep 17 00:00:00 2001 From: Alexandre Hardy <alexandre.ha...@gmail.com> Date: Fri, 11 Dec 2009 13:21:36 +0200 Subject: Some UNC GetLongPathNameW tests --- dlls/kernel32/tests/path.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c index 104a48c..c7e3dc7 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c @@ -1067,6 +1067,13 @@ static void test_GetLongPathNameW(void) { DWORD length; WCHAR empty[MAX_PATH]; + WCHAR tempfile[MAX_PATH]; + WCHAR longpath[MAX_PATH]; + WCHAR shortpath[MAX_PATH]; + WCHAR temppath[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 +1093,30 @@ 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); + + lstrcpyW(longpath, uncprefix); + lstrcatW(longpath, tempfile); + length = pGetLongPathNameW(longpath,NULL,0); + todo_wine + ok(lstrlenW(longpath) + 1==length,"GetLongPathNameW returned %d but expected %d\n",length, lstrlenW(longpath) + 1); + + lstrcpyW(shortpath, uncprefix); + GetShortPathNameW(tempfile, shortpath + 4, MAX_PATH - 4); + length = pGetLongPathNameW(shortpath,NULL,0); + todo_wine + ok(lstrlenW(longpath) + 1==length,"GetLongPathNameW returned %d but expected %d\n",length, lstrlenW(longpath) + 1); + + todo_wine + length = pGetLongPathNameW(shortpath,temppath,MAX_PATH); + ok(lstrlenW(longpath)==length,"GetLongPathNameW returned %d but expected %d\n",length, lstrlenW(longpath)); + + DeleteFileW(tempfile); } } -- 1.6.2.1