UNC Pathname handling

Paul Vriens paul.vriens.wine at gmail.com
Fri Dec 11 07:38:37 CST 2009


On 12/11/2009 01:58 PM, Alexandre Hardy wrote:
> +
> +    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);

How can you be sure about longpath being actually a long path? Maybe 
should do a proper call to pGetLongPathNameW just to be sure you're 
starting point is correct.

I say this as on my W2K3 box I get:

tempfile : (C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\longfilename.longext)

And that results in:

path.c:1109: Test failed: GetLongPathNameW returned 85 but expected 60
path.c:1115: Test failed: GetLongPathNameW returned 85 but expected 60

(linenumbers don't match because I add some trace()'s)

> +
> +    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));

If longpath is indeed a long path you could compare it with temppath?

> +
> +    DeleteFileW(tempfile);


-- 
Cheers,

Paul.



More information about the wine-devel mailing list