Commit 313fc40a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernel32/tests: Get rid of no longer needed win9x checks.

parent 14435a6d
...@@ -39,37 +39,36 @@ struct _profileInt { ...@@ -39,37 +39,36 @@ struct _profileInt {
LPCSTR iniFile; LPCSTR iniFile;
INT defaultVal; INT defaultVal;
UINT result; UINT result;
UINT result9x;
}; };
static void test_profile_int(void) static void test_profile_int(void)
{ {
struct _profileInt profileInt[]={ struct _profileInt profileInt[]={
{ NULL, NULL, NULL, NULL, 70, 0 , 0}, /* 0 */ { NULL, NULL, NULL, NULL, 70, 0}, /* 0 */
{ NULL, NULL, NULL, TESTFILE, -1, 4294967295U, 0}, { NULL, NULL, NULL, TESTFILE, -1, 4294967295U},
{ NULL, NULL, NULL, TESTFILE, 1, 1 , 0}, { NULL, NULL, NULL, TESTFILE, 1, 1},
{ SECTION, NULL, NULL, TESTFILE, -1, 4294967295U, 0}, { SECTION, NULL, NULL, TESTFILE, -1, 4294967295U},
{ SECTION, NULL, NULL, TESTFILE, 1, 1 , 0}, { SECTION, NULL, NULL, TESTFILE, 1, 1},
{ NULL, KEY, NULL, TESTFILE, -1, 4294967295U, 0}, /* 5 */ { NULL, KEY, NULL, TESTFILE, -1, 4294967295U}, /* 5 */
{ NULL, KEY, NULL, TESTFILE, 1, 1 , 0}, { NULL, KEY, NULL, TESTFILE, 1, 1},
{ SECTION, KEY, NULL, TESTFILE, -1, 4294967295U, 4294967295U}, { SECTION, KEY, NULL, TESTFILE, -1, 4294967295U},
{ SECTION, KEY, NULL, TESTFILE, 1, 1 , 1}, { SECTION, KEY, NULL, TESTFILE, 1, 1},
{ SECTION, KEY, "-1", TESTFILE, -1, 4294967295U, 4294967295U}, { SECTION, KEY, "-1", TESTFILE, -1, 4294967295U},
{ SECTION, KEY, "-1", TESTFILE, 1, 4294967295U, 4294967295U}, /* 10 */ { SECTION, KEY, "-1", TESTFILE, 1, 4294967295U}, /* 10 */
{ SECTION, KEY, "1", TESTFILE, -1, 1 , 1}, { SECTION, KEY, "1", TESTFILE, -1, 1},
{ SECTION, KEY, "1", TESTFILE, 1, 1 , 1}, { SECTION, KEY, "1", TESTFILE, 1, 1},
{ SECTION, KEY, "+1", TESTFILE, -1, 1 , 0}, { SECTION, KEY, "+1", TESTFILE, -1, 1},
{ SECTION, KEY, "+1", TESTFILE, 1, 1 , 0}, { SECTION, KEY, "+1", TESTFILE, 1, 1},
{ SECTION, KEY, "4294967296", TESTFILE, -1, 0 , 0}, /* 15 */ { SECTION, KEY, "4294967296", TESTFILE, -1, 0}, /* 15 */
{ SECTION, KEY, "4294967296", TESTFILE, 1, 0 , 0}, { SECTION, KEY, "4294967296", TESTFILE, 1, 0},
{ SECTION, KEY, "4294967297", TESTFILE, -1, 1 , 1}, { SECTION, KEY, "4294967297", TESTFILE, -1, 1},
{ SECTION, KEY, "4294967297", TESTFILE, 1, 1 , 1}, { SECTION, KEY, "4294967297", TESTFILE, 1, 1},
{ SECTION, KEY, "-4294967297", TESTFILE, -1, 4294967295U, 4294967295U}, { SECTION, KEY, "-4294967297", TESTFILE, -1, 4294967295U},
{ SECTION, KEY, "-4294967297", TESTFILE, 1, 4294967295U, 4294967295U}, /* 20 */ { SECTION, KEY, "-4294967297", TESTFILE, 1, 4294967295U}, /* 20 */
{ SECTION, KEY, "42A94967297", TESTFILE, -1, 42 , 42}, { SECTION, KEY, "42A94967297", TESTFILE, -1, 42},
{ SECTION, KEY, "42A94967297", TESTFILE, 1, 42 , 42}, { SECTION, KEY, "42A94967297", TESTFILE, 1, 42},
{ SECTION, KEY, "B4294967297", TESTFILE, -1, 0 , 0}, { SECTION, KEY, "B4294967297", TESTFILE, -1, 0},
{ SECTION, KEY, "B4294967297", TESTFILE, 1, 0 , 0}, { SECTION, KEY, "B4294967297", TESTFILE, 1, 0},
}; };
int i, num_test = ARRAY_SIZE(profileInt); int i, num_test = ARRAY_SIZE(profileInt);
UINT res; UINT res;
...@@ -83,9 +82,8 @@ static void test_profile_int(void) ...@@ -83,9 +82,8 @@ static void test_profile_int(void)
res = GetPrivateProfileIntA(profileInt[i].section, profileInt[i].key, res = GetPrivateProfileIntA(profileInt[i].section, profileInt[i].key,
profileInt[i].defaultVal, profileInt[i].iniFile); profileInt[i].defaultVal, profileInt[i].iniFile);
ok((res == profileInt[i].result) || (res == profileInt[i].result9x), ok((res == profileInt[i].result), "test<%02d>: ret<%010u> exp<%010u>\n",
"test<%02d>: ret<%010u> exp<%010u><%010u>\n", i, res, profileInt[i].result);
i, res, profileInt[i].result, profileInt[i].result9x);
} }
DeleteFileA( TESTFILE); DeleteFileA( TESTFILE);
...@@ -205,24 +203,21 @@ static void test_profile_sections(void) ...@@ -205,24 +203,21 @@ static void test_profile_sections(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = GetPrivateProfileSectionA( NULL, buf, sizeof(buf), testfile4 ); ret = GetPrivateProfileSectionA( NULL, buf, sizeof(buf), testfile4 );
ok( ret == 0, "expected return size 0, got %d\n", ret ); ok( ret == 0, "expected return size 0, got %d\n", ret );
ok( GetLastError() == ERROR_INVALID_PARAMETER || ok( GetLastError() == ERROR_INVALID_PARAMETER,
broken(GetLastError() == 0xdeadbeef), /* Win9x, WinME */
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = GetPrivateProfileSectionA( "section1", buf, sizeof(buf), NULL ); ret = GetPrivateProfileSectionA( "section1", buf, sizeof(buf), NULL );
ok( ret == 0, "expected return size 0, got %d\n", ret ); ok( ret == 0, "expected return size 0, got %d\n", ret );
todo_wine todo_wine
ok( GetLastError() == ERROR_FILE_NOT_FOUND || ok( GetLastError() == ERROR_FILE_NOT_FOUND,
broken(GetLastError() == 0xdeadbeef), /* Win9x, WinME */
"expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
/* Existing empty section with no keys */ /* Existing empty section with no keys */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret=GetPrivateProfileSectionA("section2", buf, sizeof(buf), testfile4); ret=GetPrivateProfileSectionA("section2", buf, sizeof(buf), testfile4);
ok( ret == 0, "expected return size 0, got %d\n", ret ); ok( ret == 0, "expected return size 0, got %d\n", ret );
ok( GetLastError() == ERROR_SUCCESS || ok( GetLastError() == ERROR_SUCCESS,
broken(GetLastError() == 0xdeadbeef), /* Win9x, WinME */
"expected ERROR_SUCCESS, got %d\n", GetLastError()); "expected ERROR_SUCCESS, got %d\n", GetLastError());
/* Existing section with keys and values*/ /* Existing section with keys and values*/
...@@ -233,8 +228,7 @@ static void test_profile_sections(void) ...@@ -233,8 +228,7 @@ static void test_profile_sections(void)
ok( ret == 35 && !strcmp( buf, "name1=val1,name2=,name3,name4=val4"), "wrong section returned(%d): %s\n", ok( ret == 35 && !strcmp( buf, "name1=val1,name2=,name3,name4=val4"), "wrong section returned(%d): %s\n",
ret, buf); ret, buf);
ok( buf[ret-1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" ); ok( buf[ret-1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" );
ok( GetLastError() == ERROR_SUCCESS || ok( GetLastError() == ERROR_SUCCESS,
broken(GetLastError() == 0xdeadbeef), /* Win9x, WinME */
"expected ERROR_SUCCESS, got %d\n", GetLastError()); "expected ERROR_SUCCESS, got %d\n", GetLastError());
/* Existing section with no keys but has values */ /* Existing section with no keys but has values */
...@@ -246,8 +240,7 @@ static void test_profile_sections(void) ...@@ -246,8 +240,7 @@ static void test_profile_sections(void)
ok( ret == 6 && !strcmp( buf, "=val5"), "wrong section returned(%d): %s\n", ok( ret == 6 && !strcmp( buf, "=val5"), "wrong section returned(%d): %s\n",
ret, buf); ret, buf);
ok( buf[ret-1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" ); ok( buf[ret-1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" );
ok( GetLastError() == ERROR_SUCCESS || ok( GetLastError() == ERROR_SUCCESS,
broken(GetLastError() == 0xdeadbeef), /* Win9x, WinME */
"expected ERROR_SUCCESS, got %d\n", GetLastError()); "expected ERROR_SUCCESS, got %d\n", GetLastError());
/* Overflow*/ /* Overflow*/
...@@ -283,42 +276,32 @@ static void test_profile_sections_names(void) ...@@ -283,42 +276,32 @@ static void test_profile_sections_names(void)
/* Test with sufficiently large buffer */ /* Test with sufficiently large buffer */
memset(buf, 0xc, sizeof(buf)); memset(buf, 0xc, sizeof(buf));
ret = GetPrivateProfileSectionNamesA( buf, 29, testfile3 ); ret = GetPrivateProfileSectionNamesA( buf, 29, testfile3 );
ok( ret == 27 || ok( ret == 27, "expected return size 27, got %d\n", ret );
broken(ret == 28), /* Win9x, WinME */ ok( (buf[ret-1] == 0 && buf[ret] == 0),
"expected return size 27, got %d\n", ret );
ok( (buf[ret-1] == 0 && buf[ret] == 0) ||
broken(buf[ret-1] == 0 && buf[ret-2] == 0), /* Win9x, WinME */
"returned buffer not terminated with double-null\n" ); "returned buffer not terminated with double-null\n" );
/* Test with exactly fitting buffer */ /* Test with exactly fitting buffer */
memset(buf, 0xc, sizeof(buf)); memset(buf, 0xc, sizeof(buf));
ret = GetPrivateProfileSectionNamesA( buf, 28, testfile3 ); ret = GetPrivateProfileSectionNamesA( buf, 28, testfile3 );
ok( ret == 26 || ok( ret == 26, "expected return size 26, got %d\n", ret );
broken(ret == 28), /* Win9x, WinME */
"expected return size 26, got %d\n", ret );
todo_wine todo_wine
ok( (buf[ret+1] == 0 && buf[ret] == 0) || /* W2K3 and higher */ ok( (buf[ret+1] == 0 && buf[ret] == 0) || /* W2K3 and higher */
broken(buf[ret+1] == 0xc && buf[ret] == 0) || /* NT4, W2K, WinXP */ broken(buf[ret+1] == 0xc && buf[ret] == 0), /* NT4, W2K, WinXP */
broken(buf[ret-1] == 0 && buf[ret-2] == 0), /* Win9x, WinME */
"returned buffer not terminated with double-null\n" ); "returned buffer not terminated with double-null\n" );
/* Test with a buffer too small */ /* Test with a buffer too small */
memset(buf, 0xc, sizeof(buf)); memset(buf, 0xc, sizeof(buf));
ret = GetPrivateProfileSectionNamesA( buf, 27, testfile3 ); ret = GetPrivateProfileSectionNamesA( buf, 27, testfile3 );
ok( ret == 25, "expected return size 25, got %d\n", ret ); ok( ret == 25, "expected return size 25, got %d\n", ret );
/* Win9x and WinME only fills the buffer with complete section names (double-null terminated) */
count = strlen("section1") + sizeof(CHAR) + strlen("section2"); count = strlen("section1") + sizeof(CHAR) + strlen("section2");
todo_wine todo_wine
ok( (buf[ret+1] == 0 && buf[ret] == 0) || ok( buf[ret+1] == 0 && buf[ret] == 0,
broken(buf[count] == 0 && buf[count+1] == 0), /* Win9x, WinME */
"returned buffer not terminated with double-null\n" ); "returned buffer not terminated with double-null\n" );
/* Tests on nonexistent file */ /* Tests on nonexistent file */
memset(buf, 0xc, sizeof(buf)); memset(buf, 0xc, sizeof(buf));
ret = GetPrivateProfileSectionNamesA( buf, 10, ".\\not_here.ini" ); ret = GetPrivateProfileSectionNamesA( buf, 10, ".\\not_here.ini" );
ok( ret == 0 || ok( ret == 0, "expected return size 0, got %d\n", ret );
broken(ret == 1), /* Win9x, WinME */
"expected return size 0, got %d\n", ret );
ok( buf[0] == 0, "returned buffer not terminated with null\n" ); ok( buf[0] == 0, "returned buffer not terminated with null\n" );
ok( buf[1] != 0, "returned buffer terminated with double-null\n" ); ok( buf[1] != 0, "returned buffer terminated with double-null\n" );
...@@ -437,11 +420,8 @@ static void test_profile_existing(void) ...@@ -437,11 +420,8 @@ static void test_profile_existing(void)
ok(INVALID_HANDLE_VALUE != h, "%d: CreateFile failed\n",i); ok(INVALID_HANDLE_VALUE != h, "%d: CreateFile failed\n",i);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = GetPrivateProfileStringA(SECTION, KEY, NULL, buffer, MAX_PATH, testfile2); ret = GetPrivateProfileStringA(SECTION, KEY, NULL, buffer, MAX_PATH, testfile2);
/* Win9x and WinME returns 0 for all cases except the first one */
if (!pe[i].read_error) if (!pe[i].read_error)
ok( ret || ok( ret, "%d: GetPrivateProfileString failed with error %u\n", i, GetLastError() );
broken(!ret && GetLastError() == 0xdeadbeef), /* Win9x, WinME */
"%d: GetPrivateProfileString failed with error %u\n", i, GetLastError() );
else else
ok( !ret, "%d: GetPrivateProfileString succeeded\n", i ); ok( !ret, "%d: GetPrivateProfileString succeeded\n", i );
CloseHandle(h); CloseHandle(h);
...@@ -464,9 +444,7 @@ static void test_profile_delete_on_close(void) ...@@ -464,9 +444,7 @@ static void test_profile_delete_on_close(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = GetPrivateProfileIntA(SECTION, KEY, 0, testfile); res = GetPrivateProfileIntA(SECTION, KEY, 0, testfile);
ok( res == 123 || ok( res == 123, "Got %d instead of 123\n", res);
broken(res == 0 && GetLastError() == ERROR_SHARING_VIOLATION), /* Win9x, WinME */
"Got %d instead of 123\n", res);
/* This also deletes the file */ /* This also deletes the file */
CloseHandle(h); CloseHandle(h);
...@@ -488,9 +466,7 @@ static void test_profile_refresh(void) ...@@ -488,9 +466,7 @@ static void test_profile_refresh(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = GetPrivateProfileIntA(SECTION, KEY, 0, testfile); res = GetPrivateProfileIntA(SECTION, KEY, 0, testfile);
ok( res == 123 || ok( res == 123, "Got %d instead of 123\n", res);
broken(res == 0 && GetLastError() == ERROR_SHARING_VIOLATION), /* Win9x, WinME */
"Got %d instead of 123\n", res);
CloseHandle(h); CloseHandle(h);
...@@ -504,9 +480,7 @@ static void test_profile_refresh(void) ...@@ -504,9 +480,7 @@ static void test_profile_refresh(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = GetPrivateProfileIntA(SECTION, KEY, 0, testfile); res = GetPrivateProfileIntA(SECTION, KEY, 0, testfile);
ok( res == 124 || ok( res == 124, "Got %d instead of 124\n", res);
broken(res == 0 && GetLastError() == 0xdeadbeef), /* Win9x, WinME */
"Got %d instead of 124\n", res);
/* This also deletes the file */ /* This also deletes the file */
CloseHandle(h); CloseHandle(h);
...@@ -514,9 +488,7 @@ static void test_profile_refresh(void) ...@@ -514,9 +488,7 @@ static void test_profile_refresh(void)
/* Cache must be invalidated if file no longer exists and default must be returned */ /* Cache must be invalidated if file no longer exists and default must be returned */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = GetPrivateProfileIntA(SECTION, KEY, 421, testfile); res = GetPrivateProfileIntA(SECTION, KEY, 421, testfile);
ok( res == 421 || ok( res == 421, "Got %d instead of 421\n", res);
broken(res == 0 && GetLastError() == 0xdeadbeef), /* Win9x, WinME */
"Got %d instead of 421\n", res);
} }
static void create_test_file(LPCSTR name, LPCSTR data, DWORD size) static void create_test_file(LPCSTR name, LPCSTR data, DWORD size)
...@@ -597,18 +569,6 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ...@@ -597,18 +569,6 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
trace("test_GetPrivateProfileStringA: %s\n", descript); trace("test_GetPrivateProfileStringA: %s\n", descript);
if(!lstrcmpA(descript, "CR only"))
{
SetLastError(0xdeadbeef);
ret = GetPrivateProfileStringW(NULL, NULL, NULL,
NULL, 0, NULL);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("Win9x and WinME don't handle 'CR only' correctly\n");
return;
}
}
create_test_file(filename, content, lstrlenA(content)); create_test_file(filename, content, lstrlenA(content));
/* Run this test series with caching. Wine won't cache profile /* Run this test series with caching. Wine won't cache profile
...@@ -620,9 +580,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ...@@ -620,9 +580,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA(buf, "kumquat"); lstrcpyA(buf, "kumquat");
ret = GetPrivateProfileStringA(NULL, "name1", "default", ret = GetPrivateProfileStringA(NULL, "name1", "default",
buf, MAX_PATH, filename); buf, MAX_PATH, filename);
ok(ret == 18 || ok(ret == 18, "Expected 18, got %d\n", ret);
broken(ret == 19), /* Win9x and WinME */
"Expected 18, got %d\n", ret);
len = lstrlenA("section1") + sizeof(CHAR) + lstrlenA("section2") + 2 * sizeof(CHAR); len = lstrlenA("section1") + sizeof(CHAR) + lstrlenA("section2") + 2 * sizeof(CHAR);
ok(!memcmp(buf, "section1\0section2\0\0", len), ok(!memcmp(buf, "section1\0section2\0\0", len),
"Expected \"section1\\0section2\\0\\0\", got \"%s\"\n", buf); "Expected \"section1\\0section2\\0\\0\", got \"%s\"\n", buf);
...@@ -650,9 +608,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ...@@ -650,9 +608,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
ret = GetPrivateProfileStringA(emptystr, "name1", NULL, ret = GetPrivateProfileStringA(emptystr, "name1", NULL,
buf, MAX_PATH, filename); buf, MAX_PATH, filename);
ok(ret == 0, "Expected 0, got %d\n", ret); ok(ret == 0, "Expected 0, got %d\n", ret);
ok(!lstrcmpA(buf, "") || ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
broken(!lstrcmpA(buf, "kumquat")), /* Win9x, WinME */
"Expected \"\", got \"%s\"\n", buf);
ok(emptystr_ok(emptystr), "AppName modified\n"); ok(emptystr_ok(emptystr), "AppName modified\n");
/* lpAppName is empty, lpDefault is empty */ /* lpAppName is empty, lpDefault is empty */
...@@ -727,9 +683,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ...@@ -727,9 +683,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
ret = GetPrivateProfileStringA("section1", emptystr, NULL, ret = GetPrivateProfileStringA("section1", emptystr, NULL,
buf, MAX_PATH, filename); buf, MAX_PATH, filename);
ok(ret == 0, "Expected 0, got %d\n", ret); ok(ret == 0, "Expected 0, got %d\n", ret);
ok(!lstrcmpA(buf, "") || ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
broken(!lstrcmpA(buf, "kumquat")), /* Win9x, WinME */
"Expected \"\", got \"%s\"\n", buf);
ok(emptystr_ok(emptystr), "KeyName modified\n"); ok(emptystr_ok(emptystr), "KeyName modified\n");
/* lpKeyName is empty, lpDefault is empty */ /* lpKeyName is empty, lpDefault is empty */
...@@ -764,12 +718,8 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ...@@ -764,12 +718,8 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
lstrcpyA(buf, "kumquat"); lstrcpyA(buf, "kumquat");
ret = GetPrivateProfileStringA("section1", "name1", "default", ret = GetPrivateProfileStringA("section1", "name1", "default",
buf, MAX_PATH, NULL); buf, MAX_PATH, NULL);
ok(ret == 7 || ok(ret == 7, "Expected 7, got %d\n", ret);
broken(ret == 0), /* Win9x, WinME */ ok(!lstrcmpA(buf, "default"), "Expected \"default\", got \"%s\"\n", buf);
"Expected 7, got %d\n", ret);
ok(!lstrcmpA(buf, "default") ||
broken(!lstrcmpA(buf, "kumquat")), /* Win9x, WinME */
"Expected \"default\", got \"%s\"\n", buf);
/* lpFileName is empty */ /* lpFileName is empty */
memset(buf, 0xc,sizeof(buf)); memset(buf, 0xc,sizeof(buf));
...@@ -835,8 +785,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ...@@ -835,8 +785,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
ok(ret == 14, "Expected 14, got %d\n", ret); ok(ret == 14, "Expected 14, got %d\n", ret);
len = lstrlenA("section1") + 2 * sizeof(CHAR); len = lstrlenA("section1") + 2 * sizeof(CHAR);
todo_wine todo_wine
ok(!memcmp(buf, "section1\0secti\0\0", ret + 2) || ok(!memcmp(buf, "section1\0secti\0\0", ret + 2),
broken(!memcmp(buf, "section1\0\0", len)), /* Win9x, WinME */
"Expected \"section1\\0secti\\0\\0\", got \"%s\"\n", buf); "Expected \"section1\\0secti\\0\\0\", got \"%s\"\n", buf);
/* lpKeyName is NULL, not enough room for final key name */ /* lpKeyName is NULL, not enough room for final key name */
...@@ -846,8 +795,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ...@@ -846,8 +795,7 @@ static void test_GetPrivateProfileString(const char *content, const char *descri
buf, 16, filename); buf, 16, filename);
ok(ret == 14, "Expected 14, got %d\n", ret); ok(ret == 14, "Expected 14, got %d\n", ret);
todo_wine todo_wine
ok(!memcmp(buf, "name1\0name2\0na\0\0", ret + 2) || ok(!memcmp(buf, "name1\0name2\0na\0\0", ret + 2),
broken(!memcmp(buf, "name1\0name2\0n\0\0", ret + 1)), /* Win9x, WinME */
"Expected \"name1\\0name2\\0na\\0\\0\", got \"%s\"\n", buf); "Expected \"name1\\0name2\\0na\\0\\0\", got \"%s\"\n", buf);
/* key value has quotation marks which are stripped */ /* key value has quotation marks which are stripped */
...@@ -956,19 +904,6 @@ static void test_WritePrivateProfileString(void) ...@@ -956,19 +904,6 @@ static void test_WritePrivateProfileString(void)
CHAR temp[MAX_PATH]; CHAR temp[MAX_PATH];
HANDLE file; HANDLE file;
SetLastError(0xdeadbeef);
ret = WritePrivateProfileStringW(NULL, NULL, NULL, NULL);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* Win9x/WinME needs (variable) timeouts between tests and even long timeouts don't
* guarantee a correct result.
* Win9x/WinMe also produces different ini files where there is always a newline before
* a section start (except for the first one).
*/
win_skip("WritePrivateProfileString on Win9x/WinME is hard to test reliably\n");
return;
}
GetTempPathA(MAX_PATH, temp); GetTempPathA(MAX_PATH, temp);
GetTempFileNameA(temp, "wine", 0, path); GetTempFileNameA(temp, "wine", 0, path);
DeleteFileA(path); DeleteFileA(path);
...@@ -979,9 +914,7 @@ static void test_WritePrivateProfileString(void) ...@@ -979,9 +914,7 @@ static void test_WritePrivateProfileString(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = WritePrivateProfileStringA(NULL, "key", "string", path); ret = WritePrivateProfileStringA(NULL, "key", "string", path);
ok(ret == FALSE, "Expected FALSE, got %d\n", ret); ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
ok(GetLastError() == ERROR_FILE_NOT_FOUND || ok(GetLastError() == ERROR_FILE_NOT_FOUND,
broken(GetLastError() == ERROR_INVALID_PARAMETER) || /* NT4 */
broken(GetLastError() == 0xdeadbeef), /* Win9x and WinME */
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
ok(GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES, ok(GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES,
"Expected path to not exist\n"); "Expected path to not exist\n");
...@@ -993,9 +926,7 @@ static void test_WritePrivateProfileString(void) ...@@ -993,9 +926,7 @@ static void test_WritePrivateProfileString(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = WritePrivateProfileStringA(NULL, "key", "string", path); ret = WritePrivateProfileStringA(NULL, "key", "string", path);
ok(ret == FALSE, "Expected FALSE, got %d\n", ret); ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
ok(GetLastError() == ERROR_FILE_NOT_FOUND || ok(GetLastError() == ERROR_FILE_NOT_FOUND,
broken(GetLastError() == ERROR_INVALID_PARAMETER) || /* NT4 */
broken(GetLastError() == 0xdeadbeef), /* Win9x and WinME */
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
ok(check_file_data(path, data), "File doesn't match\n"); ok(check_file_data(path, data), "File doesn't match\n");
DeleteFileA(path); DeleteFileA(path);
...@@ -1041,9 +972,7 @@ static void test_WritePrivateProfileString(void) ...@@ -1041,9 +972,7 @@ static void test_WritePrivateProfileString(void)
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
todo_wine todo_wine
{ {
ok(check_file_data(path, data) || ok(check_file_data(path, data), "File doesn't match\n");
(broken(GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES)), /* Win9x and WinME */
"File doesn't match\n");
} }
DeleteFileA(path); DeleteFileA(path);
...@@ -1051,20 +980,15 @@ static void test_WritePrivateProfileString(void) ...@@ -1051,20 +980,15 @@ static void test_WritePrivateProfileString(void)
data = "[App]\r\n" data = "[App]\r\n"
"key=\r\n"; "key=\r\n";
ret = WritePrivateProfileStringA("App", "key", "", path); ret = WritePrivateProfileStringA("App", "key", "", path);
ok(ret == TRUE || ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
broken(!ret), /* Win9x and WinME */ ok(check_file_data(path, data), "File doesn't match\n");
"Expected TRUE, got %d\n", ret);
ok(check_file_data(path, data) ||
(broken(GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES)), /* Win9x and WinME */
"File doesn't match\n");
DeleteFileA(path); DeleteFileA(path);
/* empty lpFileName */ /* empty lpFileName */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = WritePrivateProfileStringA("App", "key", "string", ""); ret = WritePrivateProfileStringA("App", "key", "string", "");
ok(ret == FALSE, "Expected FALSE, got %d\n", ret); ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
ok(GetLastError() == ERROR_ACCESS_DENIED || ok(GetLastError() == ERROR_ACCESS_DENIED,
broken(GetLastError() == ERROR_PATH_NOT_FOUND), /* Win9x and WinME */
"Expected ERROR_ACCESS_DENIED, got %d\n", GetLastError()); "Expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
/* Relative paths are relative to X:\\%WINDIR% */ /* Relative paths are relative to X:\\%WINDIR% */
...@@ -1164,12 +1088,7 @@ static void test_WritePrivateProfileString(void) ...@@ -1164,12 +1088,7 @@ static void test_WritePrivateProfileString(void)
ret = WritePrivateProfileStringA("section1", "key1", "string1", path); ret = WritePrivateProfileStringA("section1", "key1", "string1", path);
ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
todo_wine todo_wine
ok( check_binary_file_data(path, data, 59) || ok( check_binary_file_data(path, data, 59), "File doesn't match\n");
broken( check_binary_file_data(path, /* Windows 9x */
"Data \0 before \0 first \0 section" /* 31 bytes */
"\r\n\r\n[section1]\r\n" /* 14 bytes */
"key1=string1" /* 14 bytes */
, 59)), "File doesn't match\n");
DeleteFileA(path); DeleteFileA(path);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment