From 5808f78d07c40dac75eca9f4b0dccbb00e16f154 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 23 Nov 2013 04:46:08 +0100 Subject: [PATCH 1/2] Improved VMRMonitorConfig tests according to suggestions by A. Hentschel --- ...ests-for-IVMRMonitorConfig-and-IVMRM.patch | 243 +++++++++++++----- 1 file changed, 175 insertions(+), 68 deletions(-) diff --git a/patches/0007-quartz-tests-Add-tests-for-IVMRMonitorConfig-and-IVMRM.patch b/patches/0007-quartz-tests-Add-tests-for-IVMRMonitorConfig-and-IVMRM.patch index f7c7a30e..f1dba60a 100644 --- a/patches/0007-quartz-tests-Add-tests-for-IVMRMonitorConfig-and-IVMRM.patch +++ b/patches/0007-quartz-tests-Add-tests-for-IVMRMonitorConfig-and-IVMRM.patch @@ -1,15 +1,15 @@ -From 8c8c8c24a8c90c292c6af2c83fd2587a04492a4f Mon Sep 17 00:00:00 2001 +From 4347b37128afcd1878a0f993a058fe147f219982 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 22 Nov 2013 18:40:59 +0100 Subject: quartz/tests: Add tests for IVMRMonitorConfig and IVMRMonitorConfig9 interface --- - dlls/quartz/tests/videorenderer.c | 210 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 205 insertions(+), 5 deletions(-) + dlls/quartz/tests/videorenderer.c | 275 ++++++++++++++++++++++++++++++++++--- + 1 file changed, 254 insertions(+), 21 deletions(-) diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c -index ce1ac29..df45e1e 100644 +index ce1ac29..e3a4fa2 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -22,6 +22,9 @@ @@ -22,43 +22,124 @@ index ce1ac29..df45e1e 100644 #define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \ ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \ -@@ -33,6 +36,8 @@ +@@ -32,28 +35,17 @@ + ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \ } - static IUnknown *pVideoRenderer = NULL; -+static IUnknown *pVMR7 = NULL; -+static IUnknown *pVMR9 = NULL; - - static int create_video_renderer(void) +-static IUnknown *pVideoRenderer = NULL; +- +-static int create_video_renderer(void) ++static const WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n ) { -@@ -150,16 +155,211 @@ static void test_basefilter(void) - IBaseFilter_Release(base); +- HRESULT hr; +- +- hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, +- &IID_IUnknown, (LPVOID*)&pVideoRenderer); +- return (hr == S_OK && pVideoRenderer != NULL); +-} +- +-static void release_video_renderer(void) +-{ +- HRESULT hr; +- +- hr = IUnknown_Release(pVideoRenderer); +- ok(hr == 0, "IUnknown_Release failed with %x\n", hr); ++ const WCHAR *end; ++ for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return ptr; ++ return NULL; } -+static int create_vmr7(void) -+{ -+ HRESULT hr; + static void test_query_interface(void) + { + HRESULT hr; ++ IUnknown *pVideoRenderer = NULL; + IBaseFilter *pBaseFilter = NULL; + IBasicVideo *pBasicVideo = NULL; + IDirectDrawVideo *pDirectDrawVideo = NULL; +@@ -64,6 +56,15 @@ static void test_query_interface(void) + IQualProp *pQualProp = NULL; + IVideoWindow *pVideoWindow = NULL; + ++ hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, ++ &IID_IUnknown, (LPVOID*)&pVideoRenderer); ++ ok(hr != S_OK || pVideoRenderer != NULL, "CoCreateInstance returned S_OK, but pVideoRenderer is NULL.\n"); ++ if (hr != S_OK || !pVideoRenderer) ++ { ++ skip("VideoRenderer is not available, skipping QI test.\n"); ++ return; ++ } + -+ hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER, -+ &IID_IUnknown, (LPVOID*)&pVMR7); -+ return (hr == S_OK && pVMR7 != NULL); -+} + QI_SUCCEED(pVideoRenderer, IID_IBaseFilter, pBaseFilter); + RELEASE_EXPECT(pBaseFilter, 1); + QI_SUCCEED(pVideoRenderer, IID_IBasicVideo, pBasicVideo); +@@ -84,6 +85,8 @@ static void test_query_interface(void) + RELEASE_EXPECT(pMediaPosition, 1); + QI_SUCCEED(pVideoRenderer, IID_IVideoWindow, pVideoWindow); + RELEASE_EXPECT(pVideoWindow, 1); + -+static void release_vmr7(void) -+{ -+ HRESULT hr; ++ RELEASE_EXPECT(pVideoRenderer, 0); + } + + static void test_pin(IPin *pin) +@@ -104,18 +107,28 @@ static void test_pin(IPin *pin) + + static void test_basefilter(void) + { ++ IUnknown *pVideoRenderer = NULL; + IEnumPins *pin_enum = NULL; + IBaseFilter *base = NULL; + IPin *pins[2]; + ULONG ref; + HRESULT hr; + ++ hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, ++ &IID_IUnknown, (LPVOID*)&pVideoRenderer); ++ ok(hr != S_OK || pVideoRenderer != NULL, "CoCreateInstance returned S_OK, but pVideoRenderer is NULL.\n"); ++ if (hr != S_OK || !pVideoRenderer) ++ { ++ skip("VideoRenderer is not available, skipping BaseFilter test.\n"); ++ return; ++ } + -+ hr = IUnknown_Release(pVMR7); -+ ok(hr == 0, "IUnknown_Release failed with %x\n", hr); + IUnknown_QueryInterface(pVideoRenderer, &IID_IBaseFilter, (void *)&base); + if (base == NULL) + { + /* test_query_interface handles this case */ + skip("No IBaseFilter\n"); +- return; ++ goto out; + } + + hr = IBaseFilter_EnumPins(base, NULL); +@@ -147,19 +160,239 @@ static void test_basefilter(void) + ref = IEnumPins_Release(pin_enum); + ok(ref == 0, "ref is %u and not 0!\n", ref); + +- IBaseFilter_Release(base); ++out: ++ if (base) IBaseFilter_Release(base); ++ RELEASE_EXPECT(pVideoRenderer, 0); +} + +static void test_monitorconfig7(void) +{ + HRESULT hr; ++ IUnknown *pVMR7 = NULL; + IVMRMonitorConfig *pMonitorConfig = NULL; + VMRGUID guid; + VMRMONITORINFO info[8]; + DWORD numdev_total, numdev; ++ GUID max_guid; ++ RECT max_rect; ++ ++ hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER, ++ &IID_IUnknown, (LPVOID*)&pVMR7); ++ ok(hr != S_OK || pVMR7 != NULL, "CoCreateInstance returned S_OK, but pVMR7 is NULL.\n"); ++ if (hr != S_OK || !pVMR7) ++ { ++ skip("VideoMixingRenderer7 is not available, skipping MonitorConfig7 test.\n"); ++ return; ++ } + + hr = IUnknown_QueryInterface(pVMR7, &IID_IVMRMonitorConfig, (LPVOID*)&pMonitorConfig); + ok(hr == S_OK, "IUnknown_QueryInterface returned %x.\n", hr); @@ -119,40 +200,56 @@ index ce1ac29..df45e1e 100644 + /* don't request information for more monitors than memory available */ + if (numdev_total > sizeof(info)/sizeof(info[0])) + numdev_total = sizeof(info)/sizeof(info[0]); ++ memset(info, 255, sizeof(info)); + hr = IVMRMonitorConfig_GetAvailableMonitors(pMonitorConfig, info, numdev_total, &numdev); + ok(hr == S_OK, "GetAvailableMonitors failed with %x.\n", hr); + ok(numdev == numdev_total, "GetAvailableMonitors returned numdev = %d, expected %d.\n", numdev, numdev_total); + -+ /* TODO: Add more tests for content of info */ ++ memset(&max_guid, 255, sizeof(max_guid)); ++ memset(&max_rect, 255, sizeof(max_rect)); ++ ++ /* check that result is filled out, we do not check if the values actually make any sense */ ++ while (numdev--) ++ { ++ ok(info[numdev].guid.pGUID == NULL || info[numdev].guid.pGUID == &info[numdev].guid.GUID, ++ "GetAvailableMonitors returned info[%d].guid.pGUID = %p, expected NULL or %p.\n", numdev, info[numdev].guid.pGUID, &info[numdev].guid.GUID); ++ ok(info[numdev].guid.pGUID != &info[numdev].guid.GUID || memcmp(&info[numdev].guid.GUID, &max_guid, sizeof(max_guid)) != 0, ++ "GetAvailableMonitors returned info[%d].GUID = {FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}, expected any other value.\n", numdev); ++ ok(memcmp(&info[numdev].rcMonitor, &max_rect, sizeof(max_rect)) != 0, ++ "GetAvailableMonitors returned info[%d].rcMonitor = {-1, -1, -1, -1}, expected any other value.\n", numdev); ++ ok(info[numdev].hMon != (HMONITOR)0 && info[numdev].hMon != (HMONITOR)-1, ++ "GetAvailableMonitors returned info[%d].hMon = %p, expected != 0 and != -1.\n", numdev, info[numdev].hMon); ++ ok(info[numdev].dwFlags != (DWORD)-1, ++ "GetAvailableMonitors returned info[%d].dwFlags = -1, expected != -1.\n", numdev); ++ ok(memchrW(info[numdev].szDevice, 0, sizeof(info[numdev].szDevice)/sizeof(WCHAR)) != NULL, ++ "GetAvailableMonitors returned info[%d].szDevice without null-termination.\n", numdev); ++ ok(memchrW(info[numdev].szDescription, 0, sizeof(info[numdev].szDescription)/sizeof(WCHAR)) != NULL, ++ "GetAvailableMonitors returned info[%d].szDescription without null-termination.\n", numdev); ++ } + +out: + if (pMonitorConfig) IVMRMonitorConfig_Release(pMonitorConfig); -+} -+ -+static int create_vmr9(void) -+{ -+ HRESULT hr; -+ -+ hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER, -+ &IID_IUnknown, (LPVOID*)&pVMR9); -+ return (hr == S_OK && pVMR7 != NULL); -+} -+ -+static void release_vmr9(void) -+{ -+ HRESULT hr; -+ -+ hr = IUnknown_Release(pVMR9); -+ ok(hr == 0, "IUnknown_Release failed with %x\n", hr); ++ RELEASE_EXPECT(pVMR7, 0); +} + +static void test_monitorconfig9(void) +{ + HRESULT hr; ++ IUnknown *pVMR9 = NULL; + IVMRMonitorConfig9 *pMonitorConfig = NULL; + UINT uDev; + VMR9MonitorInfo info[8]; + DWORD numdev_total, numdev; ++ RECT max_rect; ++ ++ hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER, ++ &IID_IUnknown, (LPVOID*)&pVMR9); ++ ok(hr != S_OK || pVMR9 != NULL, "CoCreateInstance returned S_OK, but pVMR9 is NULL.\n"); ++ if (hr != S_OK || !pVMR9) ++ { ++ skip("VideoMixingRenderer9 is not available, skipping MonitorConfig9 test.\n"); ++ return; ++ } + + hr = IUnknown_QueryInterface(pVMR9, &IID_IVMRMonitorConfig9, (LPVOID*)&pMonitorConfig); + ok(hr == S_OK, "IUnknown_QueryInterface returned %x.\n", hr); @@ -202,49 +299,59 @@ index ce1ac29..df45e1e 100644 + + if (numdev_total > sizeof(info)/sizeof(info[0])) + numdev_total = sizeof(info)/sizeof(info[0]); ++ memset(info, 255, sizeof(info)); + hr = IVMRMonitorConfig9_GetAvailableMonitors(pMonitorConfig, info, numdev_total, &numdev); + ok(hr == S_OK, "GetAvailableMonitors failed with %x.\n", hr); + ok(numdev == numdev_total, "GetAvailableMonitors returned numdev = %d, expected %d.\n", numdev, numdev_total); + -+ /* TODO: Add more tests for content of info */ ++ memset(&max_rect, 255, sizeof(max_rect)); ++ ++ /* check that result is filled out, we do not check if the values actually make any sense */ ++ while (numdev--) ++ { ++ ok(info[numdev].uDevID != (UINT)-1, ++ "GetAvailableMonitors returned info[%d].uDevID = -1, expected != -1.\n", numdev); ++ ok(memcmp(&info[numdev].rcMonitor, &max_rect, sizeof(max_rect)) != 0, ++ "GetAvailableMonitors returned info[%d].rcMonitor = {-1, -1, -1, -1}, expected any other value.\n", numdev); ++ ok(info[numdev].hMon != (HMONITOR)0 && info[numdev].hMon != (HMONITOR)-1, ++ "GetAvailableMonitors returned info[%d].hMon = %p, expected != 0 and != -1.\n", numdev, info[numdev].hMon); ++ ok(info[numdev].dwFlags != (DWORD)-1, ++ "GetAvailableMonitors returned info[%d].dwFlags = -1, expected != -1.\n", numdev); ++ ok(memchrW(info[numdev].szDevice, 0, sizeof(info[numdev].szDevice)/sizeof(WCHAR)) != NULL, ++ "GetAvailableMonitors returned info[%d].szDevice without null-termination.\n", numdev); ++ ok(memchrW(info[numdev].szDescription, 0, sizeof(info[numdev].szDescription)/sizeof(WCHAR)) != NULL, ++ "GetAvailableMonitors returned info[%d].szDescription without null-termination.\n", numdev); ++ ok(info[numdev].dwVendorId != (DWORD)-1, ++ "GetAvailableMonitors returned info[%d].dwVendorId = -1, expected != -1.\n", numdev); ++ ok(info[numdev].dwDeviceId != (DWORD)-1, ++ "GetAvailableMonitors returned info[%d].dwDeviceId = -1, expected != -1.\n", numdev); ++ ok(info[numdev].dwSubSysId != (DWORD)-1, ++ "GetAvailableMonitors returned info[%d].dwSubSysId = -1, expected != -1.\n", numdev); ++ ok(info[numdev].dwRevision != (DWORD)-1, ++ "GetAvailableMonitors returned info[%d].dwRevision = -1, expected != -1.\n", numdev); ++ } + +out: + if (pMonitorConfig) IVMRMonitorConfig9_Release(pMonitorConfig); -+} -+ ++ RELEASE_EXPECT(pVMR9, 0); + } + START_TEST(videorenderer) { CoInitialize(NULL); - if (!create_video_renderer()) - return; -- test_query_interface(); -- test_basefilter(); + /* Video Renderer tests */ -+ if (create_video_renderer()) -+ { -+ test_query_interface(); -+ test_basefilter(); -+ release_video_renderer(); -+ }else -+ skip("VideoRenderer is not available.\n"); -+ -+ /* Video Mixing Renderer 7 tests */ -+ if (create_vmr7()) -+ { -+ test_monitorconfig7(); -+ release_vmr7(); -+ }else -+ skip("VideoMixingRenderer7 is not available.\n"); + test_query_interface(); + test_basefilter(); - release_video_renderer(); ++ /* Video Mixing Renderer 7 tests */ ++ test_monitorconfig7(); ++ + /* Video Mixing Renderer 9 tests */ -+ if (create_vmr9()) -+ { -+ test_monitorconfig9(); -+ release_vmr9(); -+ }else -+ skip("VideoMixingRenderer9 is not available.\n"); ++ test_monitorconfig9(); CoUninitialize(); } From 33b3e62fc117b34c12d9200576b83f42e88a8518 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 23 Nov 2013 05:21:44 +0100 Subject: [PATCH 2/2] Fix patch-list-template.diff compilation error, regenerated patch-list.patch --- patch-list-template.diff | 19 +++++++++++++++---- patches/patch-list.patch | 21 ++++++++++++++++----- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/patch-list-template.diff b/patch-list-template.diff index 640089c1..b5220458 100644 --- a/patch-list-template.diff +++ b/patch-list-template.diff @@ -47,7 +47,7 @@ index a273502..5fa0cd5 100644 +}; + +/* return the applied non-standard patches */ -+const struct wine_patch * wine_get_patches(void) ++const void * wine_get_patches(void) +{ + return &wine_patch_data[0]; +} @@ -83,7 +83,7 @@ diff --git a/loader/main.c b/loader/main.c index ac67290..516fd82 100644 --- a/loader/main.c +++ b/loader/main.c -@@ -79,6 +79,13 @@ static inline void reserve_area( void *addr, size_t size ) +@@ -79,6 +79,12 @@ static inline void reserve_area( void *addr, size_t size ) #endif /* __APPLE__ */ @@ -92,7 +92,6 @@ index ac67290..516fd82 100644 + const char *author; + const char *title; +}; -+extern void * CDECL wine_get_patches(void); + /*********************************************************************** * check_command_line @@ -113,7 +112,7 @@ index ac67290..516fd82 100644 } + if (!strcmp( argv[1], "--patches" )) + { -+ struct wine_patch *wine_patch_data = wine_get_patches(); ++ const struct wine_patch *wine_patch_data = wine_get_patches(); + for(; wine_patch_data->hash != NULL; wine_patch_data++) + { + printf( "%s :: %s :: %s\n", wine_patch_data->hash, wine_patch_data->author, @@ -124,3 +123,15 @@ index ac67290..516fd82 100644 } +diff --git a/include/wine/library.h b/include/wine/library.h +index 242bb69..aa9e585 100644 +--- a/include/wine/library.h ++++ b/include/wine/library.h +@@ -43,6 +43,7 @@ extern const char *wine_get_data_dir(void); + extern const char *wine_get_server_dir(void); + extern const char *wine_get_user_name(void); + extern const char *wine_get_version(void); ++extern const void *wine_get_patches(void); + extern const char *wine_get_build_id(void); + extern void wine_init_argv0_path( const char *argv0 ); + extern void wine_exec_wine_binary( const char *name, char **argv, const char *env_var ); diff --git a/patches/patch-list.patch b/patches/patch-list.patch index b50bf6fc..d7a296d1 100644 --- a/patches/patch-list.patch +++ b/patches/patch-list.patch @@ -48,7 +48,7 @@ index a273502..5fa0cd5 100644 + { "d7af4990da84cfe5678c36e137ffa78a", "Erich E. Hoover", "server: Store and return security attributes with extended file attributes." }, + { "9d2fc8ba3a12f0b54dfd788a6d904484", "Erich E. Hoover", "ntdll: Inherit security attributes from parent directories." }, + { "31df02dc75b2e280aee57c1b46de2389", "Erich E. Hoover", "kernel32: Allow string comparison with linguistic casing." }, -+ { "1ab664be0bc24759d667ffd8ce907b97", "Sebastian Lackner", "quartz/tests: Add tests for IVMRMonitorConfig and IVMRMonitorConfig9 interface" }, ++ { "9d87b96b61d2d7ce620bc19dc6c8b3af", "Sebastian Lackner", "quartz/tests: Add tests for IVMRMonitorConfig and IVMRMonitorConfig9 interface" }, + { "102b21f7108d936a8e9a581d34354795", "Sebastian Lackner", "winex11: Update gl_drawable for embedded windows" }, + { "c8958b63e6afe0335d46da9b46520279", "Sebastian Lackner", "kernel32: Change return value of stub SetNamedPipeHandleState to TRUE" }, + { "a4ead552f0e423b4701116f6a7dbe521", "Sebastian Lackner", "winex11: Enable/disable windows when they are (un)mapped by foreign applications" }, @@ -57,7 +57,7 @@ index a273502..5fa0cd5 100644 +}; + +/* return the applied non-standard patches */ -+const struct wine_patch * wine_get_patches(void) ++const void * wine_get_patches(void) +{ + return &wine_patch_data[0]; +} @@ -93,7 +93,7 @@ diff --git a/loader/main.c b/loader/main.c index ac67290..516fd82 100644 --- a/loader/main.c +++ b/loader/main.c -@@ -79,6 +79,13 @@ static inline void reserve_area( void *addr, size_t size ) +@@ -79,6 +79,12 @@ static inline void reserve_area( void *addr, size_t size ) #endif /* __APPLE__ */ @@ -102,7 +102,6 @@ index ac67290..516fd82 100644 + const char *author; + const char *title; +}; -+extern void * CDECL wine_get_patches(void); + /*********************************************************************** * check_command_line @@ -123,7 +122,7 @@ index ac67290..516fd82 100644 } + if (!strcmp( argv[1], "--patches" )) + { -+ struct wine_patch *wine_patch_data = wine_get_patches(); ++ const struct wine_patch *wine_patch_data = wine_get_patches(); + for(; wine_patch_data->hash != NULL; wine_patch_data++) + { + printf( "%s :: %s :: %s\n", wine_patch_data->hash, wine_patch_data->author, @@ -134,3 +133,15 @@ index ac67290..516fd82 100644 } +diff --git a/include/wine/library.h b/include/wine/library.h +index 242bb69..aa9e585 100644 +--- a/include/wine/library.h ++++ b/include/wine/library.h +@@ -43,6 +43,7 @@ extern const char *wine_get_data_dir(void); + extern const char *wine_get_server_dir(void); + extern const char *wine_get_user_name(void); + extern const char *wine_get_version(void); ++extern const void *wine_get_patches(void); + extern const char *wine_get_build_id(void); + extern void wine_init_argv0_path( const char *argv0 ); + extern void wine_exec_wine_binary( const char *name, char **argv, const char *env_var );