Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/systemclock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c index 258e19808f..9dae754b58 100644 --- a/dlls/quartz/tests/systemclock.c +++ b/dlls/quartz/tests/systemclock.c @@ -74,7 +74,7 @@ static void test_get_time(void)
hr = IReferenceClock_GetTime(clock, &time1); if (pGetTickCount64) - time2 = GetTickCount64() * 10000; + time2 = pGetTickCount64() * 10000; else time2 = GetTickCount() * 10000; ok(hr == S_OK, "Got hr %#x.\n", hr);
Spotted by Nikolay Sivov.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index dcaedd512d..09bd473d84 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -394,6 +394,7 @@ static void test_basic_audio(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind); ok(IsEqualGUID(&typeattr->guid, &IID_IBasicAudio), "Got IID %s.\n", wine_dbgstr_guid(&typeattr->guid)); + ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); ITypeInfo_Release(typeinfo);
IBasicAudio_Release(audio);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v3: actually remove failing tests
dlls/quartz/tests/systemclock.c | 83 +++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+)
diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c index 9dae754b58..77e6c63001 100644 --- a/dlls/quartz/tests/systemclock.c +++ b/dlls/quartz/tests/systemclock.c @@ -96,6 +96,88 @@ static void test_get_time(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_advise(void) +{ + IReferenceClock *clock = create_system_clock(); + HANDLE event, semaphore; + REFERENCE_TIME current; + DWORD_PTR cookie; + unsigned int i; + HRESULT hr; + ULONG ref; + + event = CreateEventA(NULL, TRUE, FALSE, NULL); + semaphore = CreateSemaphoreA(NULL, 0, 10, NULL); + + hr = IReferenceClock_GetTime(clock, ¤t); + ok(SUCCEEDED(hr), "Got hr %#x.\n", hr); + + hr = IReferenceClock_AdviseTime(clock, current, 500 * 10000, (HEVENT)event, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IReferenceClock_AdviseTime(clock, -1000 * 10000, 500 * 10000, (HEVENT)event, &cookie); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IReferenceClock_AdviseTime(clock, current, 500 * 10000, (HEVENT)event, &cookie); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(WaitForSingleObject(event, 480) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + ok(!WaitForSingleObject(event, 40), "Event should be signaled.\n"); + + hr = IReferenceClock_Unadvise(clock, cookie); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + ResetEvent(event); + hr = IReferenceClock_GetTime(clock, ¤t); + ok(SUCCEEDED(hr), "Got hr %#x.\n", hr); + hr = IReferenceClock_AdviseTime(clock, current, 500 * 10000, (HEVENT)event, &cookie); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IReferenceClock_Unadvise(clock, cookie); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(WaitForSingleObject(event, 520) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + ResetEvent(event); + hr = IReferenceClock_GetTime(clock, ¤t); + ok(SUCCEEDED(hr), "Got hr %#x.\n", hr); + hr = IReferenceClock_AdviseTime(clock, current + 500 * 10000, 0, (HEVENT)event, &cookie); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(WaitForSingleObject(event, 480) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + ok(!WaitForSingleObject(event, 40), "Event should be signaled.\n"); + + hr = IReferenceClock_GetTime(clock, ¤t); + ok(SUCCEEDED(hr), "Got hr %#x.\n", hr); + + hr = IReferenceClock_AdvisePeriodic(clock, current, 500 * 10000, (HSEMAPHORE)semaphore, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IReferenceClock_AdvisePeriodic(clock, current, 0, (HSEMAPHORE)semaphore, &cookie); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IReferenceClock_AdvisePeriodic(clock, current, -500 * 10000, (HSEMAPHORE)semaphore, &cookie); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IReferenceClock_AdvisePeriodic(clock, -500 * 10000, 1000 * 10000, (HSEMAPHORE)semaphore, &cookie); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IReferenceClock_AdvisePeriodic(clock, current, 500 * 10000, (HSEMAPHORE)semaphore, &cookie); + ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!WaitForSingleObject(semaphore, 10), "Semaphore should be signaled.\n"); + for (i = 0; i < 5; ++i) + { + ok(WaitForSingleObject(semaphore, 480) == WAIT_TIMEOUT, "Semaphore should not be signaled.\n"); + ok(!WaitForSingleObject(semaphore, 40), "Semaphore should be signaled.\n"); + } + + hr = IReferenceClock_Unadvise(clock, cookie); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(WaitForSingleObject(semaphore, 520) == WAIT_TIMEOUT, "Semaphore should not be signaled.\n"); + + CloseHandle(event); + CloseHandle(semaphore); + + ref = IReferenceClock_Release(clock); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(systemclock) { CoInitialize(NULL); @@ -104,6 +186,7 @@ START_TEST(systemclock)
test_interfaces(); test_get_time(); + test_advise();
CoUninitialize(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/quartz_private.h | 1 + dlls/quartz/systemclock.c | 47 ++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index be31c92946..2104f806f7 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -31,6 +31,7 @@ #include "winuser.h" #include "dshow.h" #include "wine/debug.h" +#include "wine/heap.h" #include "wine/strmbase.h" #include "wine/list.h"
diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c index c809ce4bfc..e9f13b5130 100644 --- a/dlls/quartz/systemclock.c +++ b/dlls/quartz/systemclock.c @@ -122,7 +122,7 @@ static DWORD WINAPI SystemClockAdviseThread(LPVOID lpParam) { SetEvent(it->hEvent); /** ... and Release it */ QUARTZ_RemoveAviseEntryFromQueue(This, it); - CoTaskMemFree(it); + heap_free(it); it = nextit; } if (NULL != it) timeOut = (DWORD) ((it->rtBaseTime + it->rtIntervalTime) - curTime) / (REFERENCE_TIME)10000; @@ -234,7 +234,7 @@ static ULONG WINAPI SystemClockImpl_Release(IReferenceClock* iface) { } This->safe.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->safe); - CoTaskMemFree(This); + heap_free(This); } return ref; } @@ -279,11 +279,9 @@ static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock* iface, REFEREN if (NULL == pdwAdviseCookie) { return E_POINTER; } - pEntry = CoTaskMemAlloc(sizeof(SystemClockAdviseEntry)); - if (NULL == pEntry) { + + if (!(pEntry = heap_alloc_zero(sizeof(*pEntry)))) return E_OUTOFMEMORY; - } - ZeroMemory(pEntry, sizeof(SystemClockAdviseEntry));
pEntry->hEvent = (HANDLE) hEvent; pEntry->rtBaseTime = rtBaseTime + rtStreamTime; @@ -315,11 +313,9 @@ static HRESULT WINAPI SystemClockImpl_AdvisePeriodic(IReferenceClock* iface, REF if (NULL == pdwAdviseCookie) { return E_POINTER; } - pEntry = CoTaskMemAlloc(sizeof(SystemClockAdviseEntry)); - if (NULL == pEntry) { + + if (!(pEntry = heap_alloc_zero(sizeof(*pEntry)))) return E_OUTOFMEMORY; - } - ZeroMemory(pEntry, sizeof(SystemClockAdviseEntry));
pEntry->hEvent = (HANDLE) hSemaphore; pEntry->rtBaseTime = rtStartTime; @@ -355,7 +351,7 @@ static HRESULT WINAPI SystemClockImpl_Unadvise(IReferenceClock* iface, DWORD_PTR }
QUARTZ_RemoveAviseEntryFromQueue(This, pEntry); - CoTaskMemFree(pEntry); + heap_free(pEntry);
SystemClockPostMessageToAdviseThread(This, ADVISE_REMOVE);
@@ -375,23 +371,22 @@ static const IReferenceClockVtbl SystemClock_Vtbl = SystemClockImpl_Unadvise };
-HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) { - SystemClockImpl* obj = NULL; - - TRACE("(%p,%p)\n", ppv, pUnkOuter); +HRESULT QUARTZ_CreateSystemClock(IUnknown *outer, void **out) +{ + SystemClockImpl *object;
- obj = CoTaskMemAlloc(sizeof(SystemClockImpl)); - if (NULL == obj) { - *ppv = NULL; - return E_OUTOFMEMORY; - } - ZeroMemory(obj, sizeof(SystemClockImpl)); + TRACE("outer %p, out %p.\n", outer, out); + + if (!(object = heap_alloc_zero(sizeof(*object)))) + { + *out = NULL; + return E_OUTOFMEMORY; + }
- obj->IReferenceClock_iface.lpVtbl = &SystemClock_Vtbl; - obj->ref = 0; /* will be inited by QueryInterface */ + object->IReferenceClock_iface.lpVtbl = &SystemClock_Vtbl;
- InitializeCriticalSection(&obj->safe); - obj->safe.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SystemClockImpl.safe"); + InitializeCriticalSection(&object->safe); + object->safe.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SystemClockImpl.safe");
- return SystemClockImpl_QueryInterface(&obj->IReferenceClock_iface, &IID_IReferenceClock, ppv); + return SystemClockImpl_QueryInterface(&object->IReferenceClock_iface, &IID_IReferenceClock, out); }