Daniel Lehman : opengl32: Set last error on invalid share in wglCreateContextAttribsARB.

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


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

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

opengl32: Set last error on invalid share in wglCreateContextAttribsARB.

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

---

 dlls/opengl32/tests/opengl.c | 5 +++--
 dlls/opengl32/wgl.c          | 6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index 5a0e786..7552d44 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -898,12 +898,13 @@ static void test_opengl3(HDC hdc)
     {
         HGLRC gl3Ctx;
         DWORD error;
+        SetLastError(0xdeadbeef);
         gl3Ctx = pwglCreateContextAttribsARB(hdc, (HGLRC)0xdeadbeef, 0);
         ok(gl3Ctx == 0, "pwglCreateContextAttribsARB using an invalid shareList passed\n");
         error = GetLastError();
         /* The Nvidia implementation seems to return hresults instead of win32 error codes */
-        todo_wine ok(error == ERROR_INVALID_OPERATION ||
-                     error == NVIDIA_HRESULT_FROM_WIN32(ERROR_INVALID_OPERATION), "Expected ERROR_INVALID_OPERATION, got error=%x\n", error);
+        ok(error == ERROR_INVALID_OPERATION ||
+           error == NVIDIA_HRESULT_FROM_WIN32(ERROR_INVALID_OPERATION), "Expected ERROR_INVALID_OPERATION, got error=%x\n", error);
         wglDeleteContext(gl3Ctx);
     }
 
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 8e61348..863dea2 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -280,7 +280,11 @@ HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *attrib
         return 0;
     }
     if (!funcs->ext.p_wglCreateContextAttribsARB) return 0;
-    if (share && !(share_ptr = get_handle_ptr( share, HANDLE_CONTEXT ))) return 0;
+    if (share && !(share_ptr = get_handle_ptr( share, HANDLE_CONTEXT )))
+    {
+        SetLastError( ERROR_INVALID_OPERATION );
+        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