[PATCH 3/3] mscms: Set last error on insufficient buffer in EnumColorProfilesA/W.

Hans Leidekker hans at codeweavers.com
Sun Feb 24 11:03:26 CST 2019


Signed-off-by: Hans Leidekker <hans at 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




More information about the wine-devel mailing list