Module: wine Branch: master Commit: 0293e19928f9ec66697cbd6e421c64bb43380aa9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0293e19928f9ec66697cbd6e42...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon May 2 22:16:37 2011 +0200
ddraw/tests: Make sure the window is properly released by ddraw in test_wndproc().
---
dlls/ddraw/tests/d3d.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 8d43cca..8bb517c 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -3251,6 +3251,27 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM return DefWindowProcA(hwnd, message, wparam, lparam); }
+/* Set the wndproc back to what ddraw expects it to be, and release the ddraw + * interface. This prevents subsequent SetCooperativeLevel() calls on a + * different window from failing with DDERR_HWNDALREADYSET. */ +static void fix_wndproc(HWND window, LONG_PTR proc) +{ + IDirectDraw7 *ddraw7; + HRESULT hr; + + hr = pDirectDrawCreateEx(NULL, (void **)&ddraw7, &IID_IDirectDraw7, NULL); + ok(SUCCEEDED(hr), "Failed to create IDirectDraw7 object, hr %#x.", hr); + if (FAILED(hr)) return; + + SetWindowLongPtrA(window, GWLP_WNDPROC, proc); + hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + IDirectDraw7_Release(ddraw7); +} + static void test_wndproc(void) { LONG_PTR proc, ddraw_proc; @@ -3458,6 +3479,7 @@ static void test_wndproc(void) (LONG_PTR)DefWindowProcA, proc);
done: + fix_wndproc(window, (LONG_PTR)test_proc); expect_messages = NULL; DestroyWindow(window); UnregisterClassA("d3d7_test_wndproc_wc", GetModuleHandleA(NULL));