Don't leak GetLastError for fully implemented functions. Closes #1942

* When we plan to return a function pointer even with no onward implementation,
  wglGetProcAddress will have set PROC_NOT_FOUND or some similar error. We'll
  still return our hook though so we need to unset that error code just in case
  the application is looking for it.
This commit is contained in:
baldurk
2020-06-12 12:24:06 +01:00
parent 99bfc41caa
commit 70f838d358
+4
View File
@@ -563,6 +563,10 @@ static PROC WINAPI wglGetProcAddress_hooked(const char *func)
if(realFunc == NULL && !FullyImplementedFunction(func))
return realFunc;
// otherwise if we plan to return a hook anyway, ensure we don't leak the implementation's
// LastError code
SetLastError(0);
if(!strcmp(func, "wglCreateContext"))
return (PROC)&wglCreateContext_hooked;
if(!strcmp(func, "wglDeleteContext"))