[PATCH 3/3] mscms: Set last error on insufficient buffer in EnumColorProfilesA/W.
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> --- dlls/mscms/profile.c | 12 ++++++++++-- dlls/mscms/tests/profile.c | 6 ++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c index 6bc55e7ae6..d45ac4af12 100644 --- a/dlls/mscms/profile.c +++ b/dlls/mscms/profile.c @@ -918,7 +918,11 @@ BOOL WINAPI EnumColorProfilesA( PCSTR machine, PENUMTYPEA record, PBYTE buffer, *p = 0; ret = TRUE; } - else ret = FALSE; + else + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + ret = FALSE; + } *size = totalsize; if (number) *number = count; @@ -1044,7 +1048,11 @@ BOOL WINAPI EnumColorProfilesW( PCWSTR machine, PENUMTYPEW record, PBYTE buffer, *p = 0; ret = TRUE; } - else ret = FALSE; + else + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + ret = FALSE; + } *size = totalsize; if (number) *number = count; diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c index c4ea7f2c9f..7054082186 100644 --- a/dlls/mscms/tests/profile.c +++ b/dlls/mscms/tests/profile.c @@ -660,8 +660,9 @@ static void test_EnumColorProfilesA( char *standardprofile ) record.dwDataColorSpace = SPACE_RGB; total = 0; + SetLastError( 0xdeadbeef ); ret = pEnumColorProfilesA( NULL, &record, NULL, &total, &number ); - ok( !ret, "EnumColorProfilesA() failed (%d)\n", GetLastError() ); + ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError() ); buffer = HeapAlloc( GetProcessHeap(), 0, total ); size = total; @@ -710,8 +711,9 @@ static void test_EnumColorProfilesW( WCHAR *standardprofileW ) record.dwDataColorSpace = SPACE_RGB; total = 0; + SetLastError( 0xdeadbeef ); ret = pEnumColorProfilesW( NULL, &record, NULL, &total, &number ); - ok( !ret, "EnumColorProfilesW() failed (%d)\n", GetLastError() ); + ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError() ); buffer = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) ); size = total; -- 2.11.0
Hi, While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48175 Your paranoid android. === debian9 (32 bit report) === mscms: profile.c:665: Test failed: got 2 profile.c:716: Test failed: got 2 === debian9 (32 bit French report) === mscms: profile.c:665: Test failed: got 2 profile.c:716: Test failed: got 2 === debian9 (32 bit Japanese:Japan report) === mscms: profile.c:665: Test failed: got 2 profile.c:716: Test failed: got 2 === debian9 (32 bit Chinese:China report) === mscms: profile.c:665: Test failed: got 2 profile.c:716: Test failed: got 2 === debian9 (32 bit WoW report) === mscms: profile.c:665: Test failed: got 2 profile.c:716: Test failed: got 2 === debian9 (64 bit WoW report) === mscms: profile.c:665: Test failed: got 2 profile.c:716: Test failed: got 2
participants (2)
-
Hans Leidekker -
Marvin