[kernel32][tests] Add test for GetShortPathNameW
Anatoly Lyutin
vostok at etersoft.ru
Wed Jun 20 13:54:44 CDT 2007
Dmitry Timoshkov wrote:
> "Anatoly Lyutin" <vostok at etersoft.ru> wrote:
>
>> + WCHAR PROG_FILES_DIR[MAX_PATH];
>
> Looks like that this variable is not used anywhere.
Yeah, It is a garbage.
>
>> static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR,LPSTR,DWORD);
>> static DWORD (WINAPI *pGetLongPathNameW)(LPWSTR,LPWSTR,DWORD);
>> +static DWORD (WINAPI *pGetShortPathNameW)(LPWSTR,LPWSTR,DWORD);
>
> I don't see where pGetShortPathNameW is initialized.
I have decided that no need to check implemention of this function.
>
>> + file = CreateFileW(short_path, GENERIC_READ|GENERIC_WRITE, 0,
>> + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
>> NULL);
>> + ok(file != INVALID_HANDLE_VALUE, "File was not created.\n");
>> + ret = WriteFile(file, "test", strlen("test"), NULL, NULL);
>> + ok(ret, "Can not open file!!\n");
>
> The error message in ok() is not correct.
Sorry. Muff.=)
>
>> + CloseHandle(file);
>> + ret = DeleteFileW(short_path);
>> + ok(ret, "Can not delete file.\n");
>> + GetTempPathW(MAX_PATH, path);
>> + lstrcatW(path, src);
>> + lstrcatW(path, backSlash);
>> + ret = RemoveDirectoryW(path);
>
> 'path' at this point already contains what you need, calling
> GetTempPathW and
> friends is not needed, and that would simplify the code a bit.
Yes. You are right.
>
>> +static void test_GetShortPathNameW(void)
>> +{
>> + WCHAR empty[MAX_PATH];
>> + WCHAR pathE[] = {'p','a','t','h','t','e','s','t',0};
>> + WCHAR pathRL[] =
>> {0x0414,0x043B,0x0438,0x043D,0x043D,0x043E,0x0435,0x0418,0x043C,0x044F,0};
>> /* Long Russian name */
>> + WCHAR pathRS[] = {0x0418,0x043C,0x044F,0}; /* Short Russian name */
>
> Do you really need the test to use cyrillic characters? That won't work
> if underlying unix locale is not russian regardless what you set the
> thread
> locale to.
Hmm. How to do this better?May be to check locale and if it is non UTF8
skip this test?
Thank you for your comments.
--
Best regards
Anatoly Lyutin.
More information about the wine-devel
mailing list