"Anatoly Lyutin" <vostok(a)etersoft.ru> wrote:
+ WCHAR PROG_FILES_DIR[MAX_PATH];
Looks like that this variable is not used anywhere.
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.
+ 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.
+ 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.
+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.
+ /* Not present in all windows versions */ + if(pGetShortPathNameW) + { + SetLastError(0xdeadbeef); + length = pGetShortPathNameW(NULL,NULL,0); + if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + skip("GetShortPathNameW is not implemented\n"); + return; + }
Indentation inside of 'if(pGetShortPathNameW)' is completely messed up. -- Dmitry.