[PATCH 2/2] opengl32: Set last error on invalid share in wglCreateContextAttribsARB

Daniel Lehman dlehman25 at gmail.com
Sun Nov 20 11:21:15 CST 2016


removes a TODO

Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
---
 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 21f5a8c..e66d345 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 )))
     {
-- 
2.7.4




More information about the wine-patches mailing list