"Anatoly Lyutin" vostok@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 Timoshkov wrote:
"Anatoly Lyutin" vostok@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.
"Anatoly Lyutin" vostok@etersoft.ru wrote:
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.
But you still have to call GetProcAddress to initialize a function pointer.
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?
Plain ASCII characters should work just fine since you don't check the resulting names anyway.