Hi Paul,

On Fri, Dec 11, 2009 at 11:09 AM, Paul Vriens
<[email protected]> wrote:
> Well, the tests show that the A-version also handles this case.
>
Okay, no problem there, but since the edge cases for GetLongPathNameW
are not tested by GetLongPathNameA, how about adding a few of
these tests?

A proposed patch with such tests is attached.

Thanks for the friendly advice!

Kinf regards
Alexandre

-- 
--------------------------------------------------
Alexandre Hardy
http://www.ahardy.za.net
From 742e937bf945d7769b99782e21e1b5e4f567b6d0 Mon Sep 17 00:00:00 2001
From: Alexandre Hardy <[email protected]>
Date: Fri, 11 Dec 2009 11:50:18 +0200
Subject: Some UNC GetLongPathNameW tests

---
 dlls/kernel32/tests/path.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index 104a48c..20b13c5 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -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));
+    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);
+
+    memset(shortpath, 0, MAX_PATH * sizeof(WCHAR));
+    memset(longpath, 0, MAX_PATH * sizeof(WCHAR));
+    lstrcpyW(shortpath, uncprefix);
+    GetShortPathNameW(shortpath + 4, tempfile, MAX_PATH - 4);
+    length = pGetLongPathNameW(shortpath,NULL,0);
+    todo_wine
+    ok(lstrlenW(longpath) + 5==length,"GetLongPathNameW returned %d but expected 0\n",length);
+
+    DeleteFileW(tempfile);
     }
 }
 
-- 
1.6.2.1



Reply via email to