From 83f67ff998097c92cb5d3eef128969d25c6588e5 Mon Sep 17 00:00:00 2001 From: Owen Rudge Date: Mon, 14 May 2012 15:23:29 +0100 Subject: [PATCH] user32: Correct return value when buffer too short in GetUserObjectInformation. --- dlls/user32/tests/winstation.c | 8 ++++---- dlls/user32/winstation.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/user32/tests/winstation.c b/dlls/user32/tests/winstation.c index e3836d34cbc..bd042f246cb 100644 --- a/dlls/user32/tests/winstation.c +++ b/dlls/user32/tests/winstation.c @@ -396,7 +396,7 @@ static void test_getuserobjectinformation(void) ret = GetUserObjectInformationA(desk, UOI_NAME, NULL, 0, &size); ok(!ret, "GetUserObjectInformationA returned %x", ret); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError()); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError()); todo_wine ok(size == 22, "size is set to %d\n", size); /* Windows returns Unicode length (11*2) */ /* Get string */ @@ -416,7 +416,7 @@ static void test_getuserobjectinformation(void) ret = GetUserObjectInformationW(desk, UOI_NAME, NULL, 0, &size); ok(!ret, "GetUserObjectInformationW returned %x", ret); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError()); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError()); ok(size == 22, "size is set to %d\n", size); /* 22 bytes in 'foobarTest\0' in Unicode */ /* Get string (Unicode) */ @@ -438,7 +438,7 @@ static void test_getuserobjectinformation(void) ret = GetUserObjectInformationA(desk, UOI_TYPE, NULL, 0, &size); ok(!ret, "GetUserObjectInformationA returned %x", ret); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError()); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError()); todo_wine ok(size == 16, "size is set to %d\n", size); /* Windows returns Unicode length (8*2) */ /* Get string */ @@ -458,7 +458,7 @@ static void test_getuserobjectinformation(void) ret = GetUserObjectInformationW(desk, UOI_TYPE, NULL, 0, &size); ok(!ret, "GetUserObjectInformationW returned %x", ret); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError()); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError()); ok(size == 16, "size is set to %d\n", size); /* 16 bytes in 'Desktop\0' in Unicode */ /* Get string (Unicode) */ diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c index 8126b31dd9f..770245dc998 100644 --- a/dlls/user32/winstation.c +++ b/dlls/user32/winstation.c @@ -484,7 +484,7 @@ BOOL WINAPI GetUserObjectInformationA( HANDLE handle, INT index, LPVOID info, DW if (needed) *needed = lenA; if (lenA > len) { - SetLastError( ERROR_MORE_DATA ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } if (info) WideCharToMultiByte( CP_ACP, 0, buffer, -1, info, len, NULL, NULL ); @@ -541,7 +541,7 @@ BOOL WINAPI GetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DW if (needed) *needed = size; if (len < size) { - SetLastError( ERROR_MORE_DATA ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); ret = FALSE; } else memcpy( info, reply->is_desktop ? desktopW : winstationW, size ); @@ -567,7 +567,7 @@ BOOL WINAPI GetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DW if (needed) *needed = size; if (len < size) { - SetLastError( ERROR_MORE_DATA ); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); ret = FALSE; } else memcpy( info, buffer, size );