kernel32/tests: Remove win9x hacks.

This commit is contained in:
Austin English 2011-02-25 14:34:56 -08:00 committed by Alexandre Julliard
parent ead0efbacd
commit d385435876
1 changed files with 12 additions and 24 deletions

View File

@ -40,14 +40,12 @@ static void test_query_dos_deviceA(void)
char drivestr[] = "a:"; char drivestr[] = "a:";
char *p, *buffer, buffer2[2000]; char *p, *buffer, buffer2[2000];
DWORD ret, ret2, buflen=32768; DWORD ret, ret2, buflen=32768;
BOOL iswin9x, found = FALSE; BOOL found = FALSE;
buffer = HeapAlloc( GetProcessHeap(), 0, buflen ); buffer = HeapAlloc( GetProcessHeap(), 0, buflen );
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = QueryDosDeviceA( NULL, buffer, buflen ); ret = QueryDosDeviceA( NULL, buffer, buflen );
iswin9x = !ret && (GetLastError() == ERROR_INVALID_PARAMETER /* win98 */ ok((ret && GetLastError() != ERROR_INSUFFICIENT_BUFFER),
|| GetLastError() == ERROR_CALL_NOT_IMPLEMENTED /* win95*/);
ok((ret && GetLastError() != ERROR_INSUFFICIENT_BUFFER) || broken(iswin9x),
"QueryDosDeviceA failed to return list, last error %u\n", GetLastError()); "QueryDosDeviceA failed to return list, last error %u\n", GetLastError());
if (ret && GetLastError() != ERROR_INSUFFICIENT_BUFFER) { if (ret && GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
@ -64,15 +62,14 @@ static void test_query_dos_deviceA(void)
for (;drivestr[0] <= 'z'; drivestr[0]++) { for (;drivestr[0] <= 'z'; drivestr[0]++) {
/* Older W2K fails with ERROR_INSUFFICIENT_BUFFER when buflen is > 32767 */ /* Older W2K fails with ERROR_INSUFFICIENT_BUFFER when buflen is > 32767 */
ret = QueryDosDeviceA( drivestr, buffer, buflen - 1); ret = QueryDosDeviceA( drivestr, buffer, buflen - 1);
/* fails for all drives in win9x */ ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND,
ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND || broken(!ret && iswin9x),
"QueryDosDeviceA failed to return current mapping for %s, last error %u\n", drivestr, GetLastError()); "QueryDosDeviceA failed to return current mapping for %s, last error %u\n", drivestr, GetLastError());
if(ret) { if(ret) {
for (p = buffer; *p; p++) *p = toupper(*p); for (p = buffer; *p; p++) *p = toupper(*p);
if (strstr(buffer, "HARDDISK") || strstr(buffer, "RAMDISK")) found = TRUE; if (strstr(buffer, "HARDDISK") || strstr(buffer, "RAMDISK")) found = TRUE;
} }
} }
ok(found ^ iswin9x, "expected at least one devicename to contain HARDDISK or RAMDISK except on win9x\n"); ok(found, "expected at least one devicename to contain HARDDISK or RAMDISK\n");
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
} }
@ -239,9 +236,7 @@ static void test_GetLogicalDriveStringsA(void)
ok(size2 == size-1, "size2 = %d\n", size2); ok(size2 == size-1, "size2 = %d\n", size2);
for(ptr = buf; ptr < buf+size2; ptr += 4) { for(ptr = buf; ptr < buf+size2; ptr += 4) {
ok(('A' <= *ptr && *ptr <= 'Z') || ok(('A' <= *ptr && *ptr <= 'Z'), "device name '%c' is not uppercase\n", *ptr);
(broken('a' <= *ptr && *ptr <= 'z')), /* Win9x and WinMe */
"device name '%c' is not uppercase\n", *ptr);
ok(ptr[1] == ':', "ptr[1] = %c, expected ':'\n", ptr[1]); ok(ptr[1] == ':', "ptr[1] = %c, expected ':'\n", ptr[1]);
ok(ptr[2] == '\\', "ptr[2] = %c expected '\\'\n", ptr[2]); ok(ptr[2] == '\\', "ptr[2] = %c expected '\\'\n", ptr[2]);
ok(!ptr[3], "ptr[3] = %c expected nullbyte\n", ptr[3]); ok(!ptr[3], "ptr[3] = %c expected nullbyte\n", ptr[3]);
@ -333,8 +328,7 @@ static void test_GetVolumeInformationA(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL, ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len); NULL, NULL, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError() == ERROR_INVALID_NAME || ok(!ret && (GetLastError() == ERROR_INVALID_NAME),
broken(GetLastError() == ERROR_BAD_PATHNAME/* win9x */)),
"GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError()); "GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError());
/* reset current directory */ /* reset current directory */
@ -362,8 +356,7 @@ static void test_GetVolumeInformationA(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL, ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len); NULL, NULL, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError() == ERROR_INVALID_NAME || ok(!ret && (GetLastError() == ERROR_INVALID_NAME),
broken(GetLastError() == ERROR_BAD_PATHNAME/* Win9x */)),
"GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError()); "GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError());
/* Try normal drive letter with trailing \ */ /* Try normal drive letter with trailing \ */
@ -381,8 +374,7 @@ static void test_GetVolumeInformationA(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL, ret = pGetVolumeInformationA(Root_Colon, vol_name_buf, vol_name_size, NULL,
NULL, NULL, fs_name_buf, fs_name_len); NULL, NULL, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError() == ERROR_INVALID_NAME || ok(!ret && (GetLastError() == ERROR_INVALID_NAME),
broken(GetLastError() == ERROR_BAD_PATHNAME/* Win9x */)),
"GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError()); "GetVolumeInformationA did%s fail, last error %u\n", ret ? " not":"", GetLastError());
/* Now C:\ becomes the current directory on drive C: */ /* Now C:\ becomes the current directory on drive C: */
@ -420,32 +412,28 @@ static void test_GetVolumeInformationA(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size, ret = pGetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len); &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(ret || broken(!ret /* win9x */ && GetLastError()==ERROR_BAD_NETPATH), ok(ret, "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", Root_UNC, GetLastError());
"GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", Root_UNC, GetLastError());
/* try again with device name space */ /* try again with device name space */
Root_UNC[2] = '.'; Root_UNC[2] = '.';
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size, ret = pGetVolumeInformationA(Root_UNC, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len); &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(ret || broken(!ret /* win9x */ && GetLastError()==ERROR_BAD_NETPATH), ok(ret, "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", Root_UNC, GetLastError());
"GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", Root_UNC, GetLastError());
/* try again with a directory off the root - should generate error */ /* try again with a directory off the root - should generate error */
if (windowsdir[strlen(windowsdir)-1] != '\\') strcat(windowsdir, "\\"); if (windowsdir[strlen(windowsdir)-1] != '\\') strcat(windowsdir, "\\");
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size, ret = pGetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len); &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError()==ERROR_DIR_NOT_ROOT || ok(!ret && (GetLastError()==ERROR_DIR_NOT_ROOT),
broken(GetLastError()==ERROR_BAD_PATHNAME/* win9x */)),
"GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", windowsdir, GetLastError()); "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", windowsdir, GetLastError());
/* A subdir with trailing \ yields DIR_NOT_ROOT instead of INVALID_NAME */ /* A subdir with trailing \ yields DIR_NOT_ROOT instead of INVALID_NAME */
if (windowsdir[strlen(windowsdir)-1] == '\\') windowsdir[strlen(windowsdir)-1] = 0; if (windowsdir[strlen(windowsdir)-1] == '\\') windowsdir[strlen(windowsdir)-1] = 0;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size, ret = pGetVolumeInformationA(windowsdir, vol_name_buf, vol_name_size,
&vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len); &vol_serial_num, &max_comp_len, &fs_flags, fs_name_buf, fs_name_len);
ok(!ret && (GetLastError()==ERROR_INVALID_NAME || ok(!ret && (GetLastError()==ERROR_INVALID_NAME),
broken(GetLastError()==ERROR_BAD_PATHNAME/* win9x */)),
"GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", windowsdir, GetLastError()); "GetVolumeInformationA did%s fail, root=%s, last error=%u\n", ret ? " not":"", windowsdir, GetLastError());
if (!pGetVolumeNameForVolumeMountPointA) { if (!pGetVolumeNameForVolumeMountPointA) {