Author: greatlrd
Date: Mon Nov 12 21:39:47 2007
New Revision: 30399
URL:
http://svn.reactos.org/svn/reactos?rev=30399&view=rev
Log:
fix Mesa ICD DrvSetFormatPixel, do not create stack cruption by ignore the 3 param.
copy code from fxgl interface and make DrvSetFormatPixel work
Modified:
trunk/reactos/dll/3rdparty/mesa32/src/drivers/windows/icd/icd.c
Modified: trunk/reactos/dll/3rdparty/mesa32/src/drivers/windows/icd/icd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/mesa32/src/dr…
==============================================================================
--- trunk/reactos/dll/3rdparty/mesa32/src/drivers/windows/icd/icd.c (original)
+++ trunk/reactos/dll/3rdparty/mesa32/src/drivers/windows/icd/icd.c Mon Nov 12 21:39:47
2007
@@ -283,19 +283,23 @@
WGLAPI int GLAPIENTRY DrvDescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes,
LPPIXELFORMATDESCRIPTOR ppfd)
{
- int qt_valid_pix;
- (void) hdc;
-
- qt_valid_pix = qt_pix;
+ int qt_valid_pix;
+
+ qt_valid_pix = qt_pix;
+
if(ppfd == NULL)
- return(qt_valid_pix);
- if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix || nBytes !=
sizeof(PIXELFORMATDESCRIPTOR))
- {
- SetLastError(0);
- return(0);
- }
- *ppfd = pix[iPixelFormat - 1].pfd;
- return(qt_valid_pix);
+ return(qt_valid_pix);
+
+ if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix ||
+ ((nBytes != sizeof(PIXELFORMATDESCRIPTOR)) && (nBytes != 0))) {
+ SetLastError(0);
+ return qt_valid_pix;
+ }
+
+ if (nBytes != 0)
+ *ppfd = pix[iPixelFormat - 1].pfd;
+
+ return qt_valid_pix;
}
/*
@@ -311,19 +315,27 @@
return(NULL);
}
-WGLAPI BOOL GLAPIENTRY DrvSetPixelFormat(HDC hdc,int iPixelFormat)
-{
- int qt_valid_pix;
- (void) hdc;
-
- qt_valid_pix = qt_pix;
- if(iPixelFormat < 1 || iPixelFormat > qt_valid_pix)
- {
- SetLastError(0);
- return(FALSE);
- }
- curPFD = iPixelFormat;
- return(TRUE);
+WGLAPI BOOL GLAPIENTRY DrvSetPixelFormat(HDC hdc,int iPixelFormat, const
PIXELFORMATDESCRIPTOR *ppfd)
+{
+ int qt_valid_pix;
+
+ qt_valid_pix = qt_pix;
+
+ if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix) {
+ if (ppfd == NULL) {
+ PIXELFORMATDESCRIPTOR my_pfd;
+ if (!DrvDescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR),
&my_pfd)) {
+ SetLastError(0);
+ return FALSE;
+ }
+ } else if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) {
+ SetLastError(0);
+ return FALSE;
+ }
+ }
+ curPFD = iPixelFormat;
+
+ return TRUE;
}
WGLAPI BOOL GLAPIENTRY DrvSwapBuffers(HDC hdc)