forked from Mirrors/wine-wine
gdi32: Properly set ERROR_NOACCESS when GetObject receives invalid arguments.
parent
7d7586d358
commit
da40f95efa
|
@ -973,7 +973,12 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
|
||||||
GDI_ReleaseObj( handle );
|
GDI_ReleaseObj( handle );
|
||||||
|
|
||||||
if (funcs && funcs->pGetObjectA)
|
if (funcs && funcs->pGetObjectA)
|
||||||
result = funcs->pGetObjectA( handle, count, buffer );
|
{
|
||||||
|
if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */
|
||||||
|
SetLastError( ERROR_NOACCESS );
|
||||||
|
else
|
||||||
|
result = funcs->pGetObjectA( handle, count, buffer );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
SetLastError( ERROR_INVALID_HANDLE );
|
SetLastError( ERROR_INVALID_HANDLE );
|
||||||
|
|
||||||
|
@ -995,7 +1000,12 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
|
||||||
GDI_ReleaseObj( handle );
|
GDI_ReleaseObj( handle );
|
||||||
|
|
||||||
if (funcs && funcs->pGetObjectW)
|
if (funcs && funcs->pGetObjectW)
|
||||||
result = funcs->pGetObjectW( handle, count, buffer );
|
{
|
||||||
|
if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */
|
||||||
|
SetLastError( ERROR_NOACCESS );
|
||||||
|
else
|
||||||
|
result = funcs->pGetObjectW( handle, count, buffer );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
SetLastError( ERROR_INVALID_HANDLE );
|
SetLastError( ERROR_INVALID_HANDLE );
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,14 @@ static void test_gdi_objects(void)
|
||||||
"GetObject(NULL obj), expected 0, NO_ERROR, got %d, %u\n",
|
"GetObject(NULL obj), expected 0, NO_ERROR, got %d, %u\n",
|
||||||
i, GetLastError());
|
i, GetLastError());
|
||||||
|
|
||||||
|
/* GetObject expects ERROR_NOACCESS when passed an invalid buffer */
|
||||||
|
hp = SelectObject(hdc, GetStockObject(BLACK_PEN));
|
||||||
|
SetLastError(0);
|
||||||
|
i = GetObjectA(hp, (INT_PTR)buff, (LPVOID)sizeof(buff));
|
||||||
|
ok (!i && GetLastError() == ERROR_NOACCESS,
|
||||||
|
"GetObject(invalid buff), expected 0, ERROR_NOACCESS, got %d, %u\n",
|
||||||
|
i, GetLastError());
|
||||||
|
|
||||||
/* GetObjectType does SetLastError() on a null object */
|
/* GetObjectType does SetLastError() on a null object */
|
||||||
SetLastError(0);
|
SetLastError(0);
|
||||||
i = GetObjectType(NULL);
|
i = GetObjectType(NULL);
|
||||||
|
|
Loading…
Reference in New Issue