Daniel Lehman : opengl32: Set last error on invalid hdc to wglCreateContextAttribsARB.

Alexandre Julliard julliard at winehq.org
Mon Nov 21 15:28:12 CST 2016


Module: wine
Branch: master
Commit: ed4271fae953732d262357aa99a7dd8d673aede0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ed4271fae953732d262357aa99a7dd8d673aede0

Author: Daniel Lehman <dlehman25 at gmail.com>
Date:   Sat Nov 19 08:07:13 2016 -0800

opengl32: Set last error on invalid hdc to wglCreateContextAttribsARB.

Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/opengl32/tests/opengl.c | 7 ++++---
 dlls/opengl32/wgl.c          | 7 ++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index 3f203ab..5a0e786 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -884,12 +884,13 @@ static void test_opengl3(HDC hdc)
     {
         HGLRC gl3Ctx;
         DWORD error;
+        SetLastError(0xdeadbeef);
         gl3Ctx = pwglCreateContextAttribsARB((HDC)0xdeadbeef, 0, 0);
         ok(gl3Ctx == 0, "pwglCreateContextAttribsARB using an invalid HDC passed\n");
         error = GetLastError();
-        todo_wine ok(error == ERROR_DC_NOT_FOUND ||
-                     broken(error == NVIDIA_HRESULT_FROM_WIN32(ERROR_INVALID_DATA)), /* Nvidia Vista + Win7 */
-                     "Expected ERROR_DC_NOT_FOUND, got error=%x\n", error);
+        ok(error == ERROR_DC_NOT_FOUND ||
+           broken(error == NVIDIA_HRESULT_FROM_WIN32(ERROR_INVALID_DATA)), /* Nvidia Vista + Win7 */
+           "Expected ERROR_DC_NOT_FOUND, got error=%x\n", error);
         wglDeleteContext(gl3Ctx);
     }
 
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 932b217..8e61348 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -274,7 +274,12 @@ HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *attrib
     struct opengl_context *context;
     struct opengl_funcs *funcs = get_dc_funcs( hdc );
 
-    if (!funcs || !funcs->ext.p_wglCreateContextAttribsARB) return 0;
+    if (!funcs)
+    {
+        SetLastError( ERROR_DC_NOT_FOUND );
+        return 0;
+    }
+    if (!funcs->ext.p_wglCreateContextAttribsARB) return 0;
     if (share && !(share_ptr = get_handle_ptr( share, HANDLE_CONTEXT ))) return 0;
     if ((drv_ctx = funcs->ext.p_wglCreateContextAttribsARB( hdc,
                                               share_ptr ? share_ptr->u.context->drv_ctx : NULL, attribs )))




More information about the wine-cvs mailing list