kernel32/tests: Drop path test workarounds for Windows <= 2000.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
529e4154a3
commit
c43ce509d2
|
@ -350,8 +350,7 @@ static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive)
|
||||||
"GetTempPathA returned a path that did not end in '\\'\n");
|
"GetTempPathA returned a path that did not end in '\\'\n");
|
||||||
lstrcpyA(tmpstr,"aaaaaaaa");
|
lstrcpyA(tmpstr,"aaaaaaaa");
|
||||||
len1=GetTempPathA(len,tmpstr);
|
len1=GetTempPathA(len,tmpstr);
|
||||||
ok(len1==len+1 || broken(len1 == len), /* WinME */
|
ok(len1==len+1,"GetTempPathA should return string length %d instead of %d\n",len+1,len1);
|
||||||
"GetTempPathA should return string length %d instead of %d\n",len+1,len1);
|
|
||||||
|
|
||||||
/* Test GetTmpFileNameA */
|
/* Test GetTmpFileNameA */
|
||||||
ok((id=GetTempFileNameA(tmppath,"path",0,newdir)),"GetTempFileNameA failed\n");
|
ok((id=GetTempFileNameA(tmppath,"path",0,newdir)),"GetTempFileNameA failed\n");
|
||||||
|
@ -364,25 +363,20 @@ static void test_InitPathA(CHAR *newdir, CHAR *curDrive, CHAR *otherDrive)
|
||||||
ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created\n");
|
ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created\n");
|
||||||
|
|
||||||
id=GetTempFileNameA(tmppath,NULL,0,newdir);
|
id=GetTempFileNameA(tmppath,NULL,0,newdir);
|
||||||
/* Windows 95, 98 return 0==id, while Windows 2000, XP return 0!=id */
|
sprintf(tmpstr,"%.4x.tmp",id & 0xffff);
|
||||||
if (id)
|
sprintf(tmpstr1,"%x.tmp",id & 0xffff);
|
||||||
{
|
ok(lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr)==0 ||
|
||||||
sprintf(tmpstr,"%.4x.tmp",id & 0xffff);
|
lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0,
|
||||||
sprintf(tmpstr1,"%x.tmp",id & 0xffff);
|
"GetTempFileNameA returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
|
||||||
ok(lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr)==0 ||
|
newdir,tmpstr,tmpstr1,id);
|
||||||
lstrcmpiA(newdir+lstrlenA(tmppath),tmpstr1)==0,
|
ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created\n");
|
||||||
"GetTempFileNameA returned '%s' which doesn't match '%s' or '%s'. id=%x\n",
|
|
||||||
newdir,tmpstr,tmpstr1,id);
|
|
||||||
ok(DeleteFileA(newdir),"Couldn't delete the temporary file we just created\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
for(unique=0;unique<3;unique++) {
|
for(unique=0;unique<3;unique++) {
|
||||||
/* Nonexistent path */
|
/* Nonexistent path */
|
||||||
sprintf(invalid_dir, "%s\\%s",tmppath,"non_existent_dir_1jwj3y32nb3");
|
sprintf(invalid_dir, "%s\\%s",tmppath,"non_existent_dir_1jwj3y32nb3");
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ok(!GetTempFileNameA(invalid_dir,"tfn",unique,newdir),"GetTempFileNameA should have failed\n");
|
ok(!GetTempFileNameA(invalid_dir,"tfn",unique,newdir),"GetTempFileNameA should have failed\n");
|
||||||
ok(GetLastError()==ERROR_DIRECTORY || broken(GetLastError()==ERROR_PATH_NOT_FOUND)/*win98*/,
|
ok(GetLastError()==ERROR_DIRECTORY,"got %u, expected ERROR_DIRECTORY\n", GetLastError());
|
||||||
"got %d, expected ERROR_DIRECTORY\n", GetLastError());
|
|
||||||
|
|
||||||
/* Check return value for unique !=0 */
|
/* Check return value for unique !=0 */
|
||||||
if(unique) {
|
if(unique) {
|
||||||
|
@ -489,12 +483,12 @@ static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir)
|
||||||
SetLastError( 0xdeadbeef );
|
SetLastError( 0xdeadbeef );
|
||||||
strcpy( buffer, "foo" );
|
strcpy( buffer, "foo" );
|
||||||
len = GetCurrentDirectoryA( 65536, buffer );
|
len = GetCurrentDirectoryA( 65536, buffer );
|
||||||
ok( (len != 0 && len < MAX_PATH) || broken(!len), /* nt4 */ "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
|
ok( (len != 0 && len < MAX_PATH), "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
|
||||||
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
|
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
|
||||||
SetLastError( 0xdeadbeef );
|
SetLastError( 0xdeadbeef );
|
||||||
strcpy( buffer, "foo" );
|
strcpy( buffer, "foo" );
|
||||||
len = GetCurrentDirectoryA( 2 * 65536, buffer );
|
len = GetCurrentDirectoryA( 2 * 65536, buffer );
|
||||||
ok( (len != 0 && len < MAX_PATH) || broken(!len), /* nt4 */ "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
|
ok( (len != 0 && len < MAX_PATH), "GetCurrentDirectoryA failed %u err %u\n", len, GetLastError() );
|
||||||
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
|
if (len) ok( !strcmp( buffer, origdir ), "wrong result %s\n", buffer );
|
||||||
HeapFree( GetProcessHeap(), 0, buffer );
|
HeapFree( GetProcessHeap(), 0, buffer );
|
||||||
|
|
||||||
|
@ -1004,11 +998,6 @@ static void test_GetTempPathW(char* tmp_dir)
|
||||||
|
|
||||||
lstrcpyW(buf, fooW);
|
lstrcpyW(buf, fooW);
|
||||||
len = GetTempPathW(MAX_PATH, buf);
|
len = GetTempPathW(MAX_PATH, buf);
|
||||||
if (len == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
|
||||||
{
|
|
||||||
win_skip("GetTempPathW is not available\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path\n");
|
ok(lstrcmpiW(buf, tmp_dirW) == 0, "GetTempPathW returned an incorrect temporary path\n");
|
||||||
ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
|
ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
|
||||||
|
|
||||||
|
@ -1185,12 +1174,6 @@ static void test_GetLongPathNameA(void)
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
length = GetLongPathNameA(temppath2, NULL, 0);
|
length = GetLongPathNameA(temppath2, NULL, 0);
|
||||||
if (length == 0 && GetLastError() == ERROR_BAD_NET_NAME)
|
|
||||||
{
|
|
||||||
win_skip("UNC syntax tests don't work on Win98/WinMe\n");
|
|
||||||
DeleteFileA(tempfile);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ok(length == explength, "Wrong length %d, expected %d\n", length, explength);
|
ok(length == explength, "Wrong length %d, expected %d\n", length, explength);
|
||||||
|
|
||||||
length = GetLongPathNameA(temppath2, NULL, MAX_PATH);
|
length = GetLongPathNameA(temppath2, NULL, MAX_PATH);
|
||||||
|
@ -1275,11 +1258,6 @@ static void test_GetLongPathNameW(void)
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
length = GetLongPathNameW(NULL,NULL,0);
|
length = GetLongPathNameW(NULL,NULL,0);
|
||||||
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
|
||||||
{
|
|
||||||
win_skip("GetLongPathNameW is not implemented\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ok(0==length,"GetLongPathNameW returned %d but expected 0\n",length);
|
ok(0==length,"GetLongPathNameW returned %d but expected 0\n",length);
|
||||||
ok(GetLastError()==ERROR_INVALID_PARAMETER,"GetLastError returned %d but expected ERROR_INVALID_PARAMETER\n",GetLastError());
|
ok(GetLastError()==ERROR_INVALID_PARAMETER,"GetLastError returned %d but expected ERROR_INVALID_PARAMETER\n",GetLastError());
|
||||||
|
|
||||||
|
@ -1371,13 +1349,7 @@ static void test_GetShortPathNameW(void)
|
||||||
HANDLE file;
|
HANDLE file;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
GetTempPathW( MAX_PATH, tmppath );
|
GetTempPathW( MAX_PATH, tmppath );
|
||||||
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
|
||||||
{
|
|
||||||
win_skip("GetTempPathW is not implemented\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lstrcpyW( path, tmppath );
|
lstrcpyW( path, tmppath );
|
||||||
lstrcatW( path, test_path );
|
lstrcatW( path, test_path );
|
||||||
|
@ -1462,11 +1434,8 @@ static void test_GetSystemDirectory(void)
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = GetSystemDirectoryA(NULL, total-1);
|
res = GetSystemDirectoryA(NULL, total-1);
|
||||||
/* 95+NT: total (includes the terminating Zero)
|
ok( res == total, "returned %u with %u (expected '%u')\n",
|
||||||
98+ME: 0 with ERROR_INVALID_PARAMETER */
|
res, GetLastError(), total );
|
||||||
ok( (res == total) || (!res && (GetLastError() == ERROR_INVALID_PARAMETER)),
|
|
||||||
"returned %d with %d (expected '%d' or: '0' with "
|
|
||||||
"ERROR_INVALID_PARAMETER)\n", res, GetLastError(), total);
|
|
||||||
|
|
||||||
if (total > MAX_PATH) return;
|
if (total > MAX_PATH) return;
|
||||||
|
|
||||||
|
@ -1521,11 +1490,8 @@ static void test_GetWindowsDirectory(void)
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = GetWindowsDirectoryA(NULL, total-1);
|
res = GetWindowsDirectoryA(NULL, total-1);
|
||||||
/* 95+NT: total (includes the terminating Zero)
|
ok( res == total, "returned %u with %u (expected '%u')\n",
|
||||||
98+ME: 0 with ERROR_INVALID_PARAMETER */
|
res, GetLastError(), total );
|
||||||
ok( (res == total) || (!res && (GetLastError() == ERROR_INVALID_PARAMETER)),
|
|
||||||
"returned %d with %d (expected '%d' or: '0' with "
|
|
||||||
"ERROR_INVALID_PARAMETER)\n", res, GetLastError(), total);
|
|
||||||
|
|
||||||
if (total > MAX_PATH) return;
|
if (total > MAX_PATH) return;
|
||||||
|
|
||||||
|
@ -1912,11 +1878,11 @@ static void test_SearchPathW(void)
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
|
|
||||||
if (0)
|
/* NULL filename */
|
||||||
{
|
ret = SearchPathW(pathW, NULL, NULL, ARRAY_SIZE(buffW), buffW, &ptrW);
|
||||||
/* NULL filename, crashes on nt4 */
|
ok(ret == 0, "Expected failure, got %d\n", ret);
|
||||||
SearchPathW(pathW, NULL, NULL, ARRAY_SIZE(buffW), buffW, &ptrW);
|
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||||
}
|
"Expected ERROR_INVALID_PARAMETER, got %#x\n", GetLastError());
|
||||||
|
|
||||||
GetWindowsDirectoryW(pathW, ARRAY_SIZE(pathW));
|
GetWindowsDirectoryW(pathW, ARRAY_SIZE(pathW));
|
||||||
|
|
||||||
|
@ -2105,14 +2071,6 @@ static void test_GetFullPathNameW(void)
|
||||||
{emptyW, MAX_PATH, output, &filepart, 1},
|
{emptyW, MAX_PATH, output, &filepart, 1},
|
||||||
};
|
};
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
ret = GetFullPathNameW(NULL, 0, NULL, NULL);
|
|
||||||
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
|
||||||
{
|
|
||||||
win_skip("GetFullPathNameW is not available\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
|
for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
|
||||||
{
|
{
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
|
|
Loading…
Reference in New Issue