- Add usermode checks to GetDIBits

- passes 21 out of 27 tests
- Add GdiSetLastError to the lib instead of forwarding it straight to kernel32

svn path=/trunk/; revision=29200
This commit is contained in:
Ged Murphy 2007-09-25 13:27:09 +00:00
parent b3c3c9ba5b
commit c338775265
4 changed files with 47 additions and 14 deletions

View file

@ -328,7 +328,7 @@ GdiReleaseLocalDC@4
GdiResetDCEMF@8 GdiResetDCEMF@8
GdiSetAttrs@4 GdiSetAttrs@4
GdiSetBatchLimit@4 GdiSetBatchLimit@4
GdiSetLastError@4=SetLastError@4 GdiSetLastError@4
GdiSetPixelFormat@8=NtGdiSetPixelFormat@8 GdiSetPixelFormat@8=NtGdiSetPixelFormat@8
GdiSetServerAttr@8 GdiSetServerAttr@8
GdiStartDocEMF@8 GdiStartDocEMF@8

View file

@ -192,5 +192,9 @@ int
STDCALL STDCALL
GdiAddFontResourceW(LPCWSTR lpszFilename,FLONG fl,DESIGNVECTOR *pdv); GdiAddFontResourceW(LPCWSTR lpszFilename,FLONG fl,DESIGNVECTOR *pdv);
VOID
STDCALL
GdiSetLastError( DWORD dwErrCode );
/* EOF */ /* EOF */

View file

@ -178,3 +178,13 @@ ExtEscape(
{ {
return NtGdiExtEscape(hDC, NULL, 0, nEscape, cbInput, (LPSTR)lpszInData, cbOutput, lpszOutData); return NtGdiExtEscape(hDC, NULL, 0, nEscape, cbInput, (LPSTR)lpszInData, cbOutput, lpszOutData);
} }
/*
* @implemented
*/
VOID
STDCALL
GdiSetLastError(DWORD dwErrCode)
{
SetLastError(dwErrCode);
}

View file

@ -1,5 +1,8 @@
#include "precomp.h" #include "precomp.h"
//#define NDEBUG
//#include <debug.h>
/* /*
* Return the full scan size for a bitmap. * Return the full scan size for a bitmap.
* *
@ -151,8 +154,6 @@ CreateCompatibleBitmap(
INT INT
STDCALL STDCALL
GetDIBits( GetDIBits(
@ -162,16 +163,34 @@ GetDIBits(
UINT cScanLines, UINT cScanLines,
LPVOID lpvBits, LPVOID lpvBits,
LPBITMAPINFO lpbmi, LPBITMAPINFO lpbmi,
UINT uUsage UINT uUsage)
)
{ {
return NtGdiGetDIBitsInternal(hDC, INT ret = 0;
if (hDC == NULL || !GdiIsHandleValid((HGDIOBJ)hDC))
{
GdiSetLastError(ERROR_INVALID_PARAMETER);
}
else if (lpbmi == NULL)
{
// XP doesn't run this check and results in a
// crash in DIB_BitmapMaxBitsSize, we'll be more forgiving
GdiSetLastError(ERROR_INVALID_PARAMETER);
}
else
{
UINT cjBmpScanSize = DIB_BitmapMaxBitsSize(lpbmi, cScanLines);
ret = NtGdiGetDIBitsInternal(hDC,
hbmp, hbmp,
uStartScan, uStartScan,
cScanLines, cScanLines,
lpvBits, lpvBits,
lpbmi, lpbmi,
uUsage, uUsage,
DIB_BitmapMaxBitsSize( lpbmi, cScanLines ), cjBmpScanSize,
0); 0);
} }
return ret;
}