[PATCH 2/2] quartz/tests: Build without -DWINE_NO_LONG_TYPES.

Zebediah Figura zfigura at codeweavers.com
Mon Mar 7 12:54:07 CST 2022


From: Eric Pouech <eric.pouech at gmail.com>

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/quartz/tests/Makefile.in     |    1 -
 dlls/quartz/tests/acmwrapper.c    |  196 ++--
 dlls/quartz/tests/avidec.c        |  506 ++++-----
 dlls/quartz/tests/avisplit.c      |  576 +++++-----
 dlls/quartz/tests/dsoundrender.c  |  500 ++++----
 dlls/quartz/tests/filesource.c    |  496 ++++----
 dlls/quartz/tests/filtergraph.c   | 1762 +++++++++++++++--------------
 dlls/quartz/tests/filtermapper.c  |  120 +-
 dlls/quartz/tests/memallocator.c  |  358 +++---
 dlls/quartz/tests/mpegsplit.c     |  626 +++++-----
 dlls/quartz/tests/passthrough.c   |   32 +-
 dlls/quartz/tests/systemclock.c   |   88 +-
 dlls/quartz/tests/videorenderer.c | 1216 ++++++++++----------
 dlls/quartz/tests/vmr7.c          | 1314 ++++++++++-----------
 dlls/quartz/tests/vmr9.c          | 1688 +++++++++++++--------------
 dlls/quartz/tests/waveparser.c    |  388 +++----
 16 files changed, 4934 insertions(+), 4933 deletions(-)

diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in
index a47eec8bfd2..423abc78ef6 100644
--- a/dlls/quartz/tests/Makefile.in
+++ b/dlls/quartz/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = quartz.dll
 IMPORTS   = strmbase advapi32 d3d9 dsound msdmo msvfw32 ole32 oleaut32 user32 uuid winmm
 
diff --git a/dlls/quartz/tests/acmwrapper.c b/dlls/quartz/tests/acmwrapper.c
index 8b9a472c0f3..564daa3a6f9 100644
--- a/dlls/quartz/tests/acmwrapper.c
+++ b/dlls/quartz/tests/acmwrapper.c
@@ -27,7 +27,7 @@ static IBaseFilter *create_acm_wrapper(void)
     IBaseFilter *filter = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_ACMWrapper, NULL, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return filter;
 }
 
@@ -48,7 +48,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -148,53 +148,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_ACMWrapper, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_ACMWrapper, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -206,116 +206,116 @@ static void test_enum_pins(void)
     HRESULT hr;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 3, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 3);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
     IEnumPins_Release(enum1);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_find_pin(void)
@@ -327,36 +327,36 @@ static void test_find_pin(void)
     ULONG ref;
 
     hr = IBaseFilter_EnumPins(filter, &enum_pins);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Pins didn't match.\n");
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IBaseFilter_FindPin(filter, L"Out", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Pins didn't match.\n");
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IBaseFilter_FindPin(filter, L"Input", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     hr = IBaseFilter_FindPin(filter, L"Output", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     hr = IBaseFilter_FindPin(filter, L"output pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     IEnumPins_Release(enum_pins);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_pin_info(void)
@@ -370,66 +370,66 @@ static void test_pin_info(void)
     IPin *pin;
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     todo_wine ok(!wcscmp(info.achName, L"Input"), "Got name %s.\n", debugstr_w(info.achName));
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"In"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     hr = IPin_QueryInternalConnections(pin, NULL, NULL);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
 
     hr = IBaseFilter_FindPin(filter, L"Out", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_interface(pin, &IID_IPin, TRUE);
     check_interface(pin, &IID_IMediaSeeking, TRUE);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
     todo_wine ok(!wcscmp(info.achName, L"Output"), "Got name %s.\n", debugstr_w(info.achName));
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"Out"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     hr = IPin_QueryInternalConnections(pin, NULL, NULL);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_filter_state(void)
@@ -440,53 +440,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 START_TEST(acmwrapper)
diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c
index ac1078bf59b..12d8daf3872 100644
--- a/dlls/quartz/tests/avidec.c
+++ b/dlls/quartz/tests/avidec.c
@@ -35,7 +35,7 @@ static IBaseFilter *create_avi_dec(void)
     IBaseFilter *filter = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_AVIDec, NULL, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return filter;
 }
 
@@ -60,7 +60,7 @@ static LRESULT CALLBACK vfw_driver_proc(DWORD_PTR id, HDRVR driver, UINT msg,
     static int in_begin;
 
     if (winetest_debug > 1)
-        trace("id %#lx, driver %p, msg %#x, lparam1 %#lx, lparam2 %#lx.\n",
+        trace("id %#Ix, driver %p, msg %#x, lparam1 %#Ix, lparam2 %#Ix.\n",
                 id, driver, msg, lparam1, lparam2);
 
     switch (msg)
@@ -143,18 +143,18 @@ static LRESULT CALLBACK vfw_driver_proc(DWORD_PTR id, HDRVR driver, UINT msg,
         ok(lparam2 == sizeof(ICDECOMPRESS), "Got size %Iu.\n", lparam2);
 
         if (testmode == 5 || testmode == 6)
-            ok(params->dwFlags == ICDECOMPRESS_NOTKEYFRAME, "Got flags %#x.\n", params->dwFlags);
+            ok(params->dwFlags == ICDECOMPRESS_NOTKEYFRAME, "Got flags %#lx.\n", params->dwFlags);
         else if (testmode == 3)
-            ok(params->dwFlags == ICDECOMPRESS_PREROLL, "Got flags %#x.\n", params->dwFlags);
+            ok(params->dwFlags == ICDECOMPRESS_PREROLL, "Got flags %#lx.\n", params->dwFlags);
         else
-            ok(params->dwFlags == 0, "Got flags %#x.\n", params->dwFlags);
+            ok(params->dwFlags == 0, "Got flags %#lx.\n", params->dwFlags);
 
         expect_sink_format.biSizeImage = 200;
         ok(!memcmp(params->lpbiInput, &expect_sink_format, sizeof(BITMAPINFOHEADER)),
                 "Input types didn't match.\n");
         ok(!memcmp(params->lpbiOutput, &source_bitmap_info, sizeof(BITMAPINFOHEADER)),
                 "Output types didn't match.\n");
-        ok(!params->ckid, "Got chunk id %#x.\n", params->ckid);
+        ok(!params->ckid, "Got chunk id %#lx.\n", params->ckid);
 
         for (i = 0; i < 200; ++i)
             expect[i] = i;
@@ -189,7 +189,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -289,53 +289,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_AVIDec, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_AVIDec, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -347,116 +347,116 @@ static void test_enum_pins(void)
     HRESULT hr;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 3, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 3);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
     IEnumPins_Release(enum1);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_find_pin(void)
@@ -468,36 +468,36 @@ static void test_find_pin(void)
     ULONG ref;
 
     hr = IBaseFilter_EnumPins(filter, &enum_pins);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Pins didn't match.\n");
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IBaseFilter_FindPin(filter, L"Out", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Pins didn't match.\n");
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IBaseFilter_FindPin(filter, L"XForm In", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     hr = IBaseFilter_FindPin(filter, L"XForm Out", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     hr = IBaseFilter_FindPin(filter, L"output pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     IEnumPins_Release(enum_pins);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_pin_info(void)
@@ -511,66 +511,66 @@ static void test_pin_info(void)
     IPin *pin;
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     todo_wine ok(!wcscmp(info.achName, L"XForm In"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"In"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     hr = IPin_QueryInternalConnections(pin, NULL, NULL);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
 
     hr = IBaseFilter_FindPin(filter, L"Out", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_interface(pin, &IID_IPin, TRUE);
     check_interface(pin, &IID_IMediaSeeking, TRUE);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
     todo_wine ok(!wcscmp(info.achName, L"XForm Out"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"Out"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     hr = IPin_QueryInternalConnections(pin, NULL, NULL);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_media_types(void)
@@ -586,10 +586,10 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"In", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
 
@@ -604,35 +604,35 @@ static void test_media_types(void)
     vih.bmiHeader.biHeight = 24;
     vih.bmiHeader.biBitCount = 16;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     vih.bmiHeader.biBitCount = 32;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     vih.bmiHeader.biBitCount = 16;
 
     mt.bFixedSizeSamples = TRUE;
     mt.bTemporalCompression = TRUE;
     mt.lSampleSize = 123;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Some versions of quartz check the major type; some do not. */
 
     mt.subtype = MEDIASUBTYPE_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_RGB24;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.subtype = test_subtype;
 
     mt.formattype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.formattype = FORMAT_VideoInfo;
 
     IPin_Release(pin);
@@ -640,23 +640,23 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"Out", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     mt.subtype = MEDIASUBTYPE_RGB24;
     vih.bmiHeader.biCompression = BI_RGB;
     vih.bmiHeader.biBitCount = 24;
     vih.bmiHeader.biSizeImage= 32 * 24 * 3;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_enum_media_types(void)
@@ -671,29 +671,29 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"In", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enum1);
     IEnumMediaTypes_Release(enum2);
@@ -702,36 +702,36 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"Out", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enum1);
     IEnumMediaTypes_Release(enum2);
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_filter_state(void)
@@ -742,53 +742,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 struct testfilter
@@ -884,12 +884,12 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample
     ++filter->got_sample;
 
     size = IMediaSample_GetSize(sample);
-    ok(size == 32 * 24 * 12 / 8, "Got size %u.\n", size);
+    ok(size == 32 * 24 * 12 / 8, "Got size %lu.\n", size);
     size = IMediaSample_GetActualDataLength(sample);
-    ok(size == 32 * 24 * 12 / 8, "Got valid size %u.\n", size);
+    ok(size == 32 * 24 * 12 / 8, "Got valid size %lu.\n", size);
 
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     for (i = 0; i < size; ++i)
         expect[i] = 111 - i;
     ok(!memcmp(data, expect, size), "Data didn't match.\n");
@@ -897,28 +897,28 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample
     hr = IMediaSample_GetTime(sample, &start, &stop);
     if (testmode == 0)
     {
-        ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+        ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
     }
     else if (testmode == 1)
     {
-        ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#x.\n", hr);
+        ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#lx.\n", hr);
         ok(start == 20000, "Got start time %s.\n", wine_dbgstr_longlong(start));
     }
     else
     {
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(start == 20000, "Got start time %s.\n", wine_dbgstr_longlong(start));
         ok(stop == 30000, "Got stop time %s.\n", wine_dbgstr_longlong(stop));
     }
 
     hr = IMediaSample_GetMediaTime(sample, &start, &stop);
-    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsDiscontinuity(sample);
-    todo_wine_if (testmode == 5) ok(hr == (testmode == 4) ? S_OK : S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine_if (testmode == 5) ok(hr == (testmode == 4) ? S_OK : S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsPreroll(sample);
-    todo_wine_if (testmode == 3) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine_if (testmode == 3) ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsSyncPoint(sample);
-    todo_wine_if (testmode == 5 || testmode == 6) ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine_if (testmode == 5 || testmode == 6) ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     return S_OK;
 }
@@ -983,27 +983,27 @@ static void test_sink_allocator(IMemInputPin *input)
     HRESULT hr;
 
     hr = IMemInputPin_GetAllocatorRequirements(input, &props);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &ret_allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (hr == S_OK)
     {
         hr = IMemAllocator_GetProperties(ret_allocator, &props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(!props.cBuffers, "Got %d buffers.\n", props.cBuffers);
-        ok(!props.cbBuffer, "Got size %d.\n", props.cbBuffer);
-        ok(!props.cbAlign, "Got alignment %d.\n", props.cbAlign);
-        ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
+        ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
+        ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
+        ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
 
         hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(ret_allocator);
     }
 
     hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
             &IID_IMemAllocator, (void **)&req_allocator);
@@ -1013,13 +1013,13 @@ static void test_sink_allocator(IMemInputPin *input)
     props.cbAlign = 1;
     props.cbPrefix = 0;
     hr = IMemAllocator_SetProperties(req_allocator, &props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &ret_allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
 
     IMemAllocator_Release(req_allocator);
@@ -1036,104 +1036,104 @@ static void test_sample_processing(IMediaControl *control, IMemInputPin *input,
     BYTE *data;
 
     hr = IMemInputPin_ReceiveCanBlock(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     size = IMediaSample_GetSize(sample);
-    ok(size == 256, "Got size %d.\n", size);
+    ok(size == 256, "Got size %ld.\n", size);
     for (i = 0; i < 200; ++i)
         data[i] = i;
     hr = IMediaSample_SetActualDataLength(sample, 200);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = 10000;
     stop = 20000;
     hr = IMediaSample_SetMediaTime(sample, &start, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetSyncPoint(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testmode = 0;
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
     sink->got_sample = 0;
 
     start = 20000;
     hr = IMediaSample_SetTime(sample, &start, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testmode = 1;
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
     sink->got_sample = 0;
 
     stop = 30000;
     hr = IMediaSample_SetTime(sample, &start, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testmode = 2;
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
     sink->got_sample = 0;
 
     hr = IMediaSample_SetPreroll(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testmode = 3;
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!sink->got_sample, "Got %u calls to Receive().\n", sink->got_sample);
 
     hr = IMediaSample_SetPreroll(sample, FALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetDiscontinuity(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testmode = 4;
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(sink->got_sample == 1, "Got %u calls to Receive().\n", sink->got_sample);
     sink->got_sample = 0;
 
     hr = IMediaSample_SetSyncPoint(sample, FALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testmode = 5;
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!sink->got_sample, "Got %u calls to Receive().\n", sink->got_sample);
 
     hr = IMediaSample_SetDiscontinuity(sample, FALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testmode = 6;
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!sink->got_sample, "Got %u calls to Receive().\n", sink->got_sample);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     IMediaSample_Release(sample);
     IMemAllocator_Release(allocator);
@@ -1149,68 +1149,68 @@ static void test_streaming_events(IMediaControl *control, IPin *sink,
     LONG i;
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     for (i = 0; i < 200; ++i)
         data[i] = i;
     hr = IMediaSample_SetActualDataLength(sample, 200);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetSyncPoint(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!testsink->got_new_segment, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
     hr = IPin_NewSegment(sink, 10000, 20000, 1.0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(testsink->got_new_segment == 1, "Got %u calls to IPin::NewSegment().\n", testsink->got_new_segment);
 
     ok(!testsink->got_eos, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
     hr = IPin_EndOfStream(sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!testsink->got_sample, "Got %u calls to Receive().\n", testsink->got_sample);
     ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
     testsink->got_eos = 0;
 
     hr = IPin_EndOfStream(sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(testsink->got_eos == 1, "Got %u calls to IPin::EndOfStream().\n", testsink->got_eos);
 
     testmode = 0;
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(testsink->got_sample == 1, "Got %u calls to Receive().\n", testsink->got_sample);
     testsink->got_sample = 0;
 
     ok(!testsink->got_begin_flush, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
     hr = IPin_BeginFlush(sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(testsink->got_begin_flush == 1, "Got %u calls to IPin::BeginFlush().\n", testsink->got_begin_flush);
 
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndOfStream(sink);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     ok(!testsink->got_end_flush, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
     hr = IPin_EndFlush(sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(testsink->got_end_flush == 1, "Got %u calls to IPin::EndFlush().\n", testsink->got_end_flush);
 
     hr = IMemInputPin_Receive(input, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(testsink->got_sample == 1, "Got %u calls to Receive().\n", testsink->got_sample);
     testsink->got_sample = 0;
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IMediaSample_Release(sample);
     IMemAllocator_Release(allocator);
 }
@@ -1262,49 +1262,49 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(sink, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(sink, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = MEDIASUBTYPE_RGB24;
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = test_subtype;
 
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(sink, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &testsource.source.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(sink, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
     ok(compare_media_types(&testsource.source.pin.mt, &req_mt), "Media types didn't match.\n");
     FreeMediaType(&mt);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     sink_bitmap_info = req_format.bmiHeader;
 
     hr = IPin_EnumMediaTypes(source, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < 9; ++i)
     {
@@ -1349,7 +1349,7 @@ static void test_connect_pin(void)
         };
 
         hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(pmt, &expect_mt, offsetof(AM_MEDIA_TYPE, cbFormat)),
                 "%u: Media types didn't match.\n", i);
         ok(!memcmp(pmt->pbFormat, &expect_format, sizeof(VIDEOINFOHEADER)),
@@ -1358,14 +1358,14 @@ static void test_connect_pin(void)
         {
             const VIDEOINFO *format = (VIDEOINFO *)pmt->pbFormat;
 
-            ok(pmt->cbFormat == offsetof(VIDEOINFO, dwBitMasks[3]), "Got format size %u.\n", pmt->cbFormat);
-            ok(format->dwBitMasks[iRED] == 0xf800, "Got red bit mask %#x.\n", format->dwBitMasks[iRED]);
-            ok(format->dwBitMasks[iGREEN] == 0x07e0, "Got green bit mask %#x.\n", format->dwBitMasks[iGREEN]);
-            ok(format->dwBitMasks[iBLUE] == 0x001f, "Got blue bit mask %#x.\n", format->dwBitMasks[iBLUE]);
+            ok(pmt->cbFormat == offsetof(VIDEOINFO, dwBitMasks[3]), "Got format size %lu.\n", pmt->cbFormat);
+            ok(format->dwBitMasks[iRED] == 0xf800, "Got red bit mask %#lx.\n", format->dwBitMasks[iRED]);
+            ok(format->dwBitMasks[iGREEN] == 0x07e0, "Got green bit mask %#lx.\n", format->dwBitMasks[iGREEN]);
+            ok(format->dwBitMasks[iBLUE] == 0x001f, "Got blue bit mask %#lx.\n", format->dwBitMasks[iBLUE]);
         }
 
         hr = IPin_QueryAccept(source, pmt);
-        ok(hr == (i == 8 ? S_OK : S_FALSE), "Got hr %#x.\n", hr);
+        ok(hr == (i == 8 ? S_OK : S_FALSE), "Got hr %#lx.\n", hr);
 
         if (i == 8)
             CopyMediaType(&source_mt, pmt);
@@ -1374,7 +1374,7 @@ static void test_connect_pin(void)
     }
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
 
@@ -1384,33 +1384,33 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(source, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(source, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     /* Exact connection. */
 
     CopyMediaType(&req_mt, &source_mt);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(source, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &testsink.sink.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(source, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
     ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
     FreeMediaType(&mt);
@@ -1418,88 +1418,88 @@ static void test_connect_pin(void)
     source_bitmap_info = ((VIDEOINFOHEADER *)req_mt.pbFormat)->bmiHeader;
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     test_sample_processing(control, meminput, &testsink);
     test_streaming_events(control, sink, meminput, &testsink);
 
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(testsink.sink.pin.peer == source, "Got peer %p.\n", testsink.sink.pin.peer);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.lSampleSize = 999;
     req_mt.bTemporalCompression = req_mt.bFixedSizeSamples = TRUE;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.formattype = FORMAT_None;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.formattype = FORMAT_VideoInfo;
 
     /* Connection with wildcards. */
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.majortype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.subtype = MEDIASUBTYPE_RGB32;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.formattype = FORMAT_None;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Video;
     req_mt.subtype = MEDIASUBTYPE_I420;
     req_mt.formattype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.subtype = MEDIASUBTYPE_RGB32;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.majortype = MEDIATYPE_Audio;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     /* Test enumeration of sink media types. */
 
@@ -1508,20 +1508,20 @@ static void test_connect_pin(void)
     testsink.mt = &req_mt;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
     ok(hr == VFW_E_NO_ACCEPTABLE_TYPES
-            || broken(hr == VFW_E_INVALIDMEDIATYPE) /* Win8+ */, "Got hr %#x.\n", hr);
+            || broken(hr == VFW_E_INVALIDMEDIATYPE) /* Win8+ */, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Video;
     req_mt.subtype = MEDIASUBTYPE_I420;
     req_mt.formattype = FORMAT_VideoInfo;
     req_mt.lSampleSize = 444;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
 
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(testsource.source.pin.peer == sink, "Got peer %p.\n", testsource.source.pin.peer);
     IFilterGraph2_Disconnect(graph, &testsource.source.pin.IPin_iface);
 
@@ -1530,13 +1530,13 @@ static void test_connect_pin(void)
     IPin_Release(source);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsource.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 START_TEST(avidec)
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c
index 0665fad3ad8..8b7e8a222b0 100644
--- a/dlls/quartz/tests/avisplit.c
+++ b/dlls/quartz/tests/avisplit.c
@@ -32,7 +32,7 @@ static IBaseFilter *create_avi_splitter(void)
     IBaseFilter *filter = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_AviSplitter, NULL, CLSCTX_INPROC_SERVER,
         &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return filter;
 }
 
@@ -54,11 +54,11 @@ static WCHAR *load_resource(const WCHAR *name)
     wcscat(pathW, name);
 
     file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %u.\n",
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %lu.\n",
             wine_dbgstr_w(pathW), GetLastError());
 
     res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA);
-    ok(!!res, "Failed to load resource, error %u.\n", GetLastError());
+    ok(!!res, "Failed to load resource, error %lu.\n", GetLastError());
     ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res));
     WriteFile(file, ptr, SizeofResource( GetModuleHandleA(NULL), res), &written, NULL);
     ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n");
@@ -96,7 +96,7 @@ static IFilterGraph2 *connect_input(IBaseFilter *splitter, const WCHAR *filename
     IBaseFilter_FindPin(reader, L"Output", &source);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, sink, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IPin_Release(source);
     IPin_Release(sink);
@@ -115,7 +115,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -220,53 +220,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_AviSplitter, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_AviSplitter, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -281,79 +281,79 @@ static void test_enum_pins(void)
     BOOL ret;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
@@ -361,46 +361,46 @@ static void test_enum_pins(void)
     graph = connect_input(filter, filename);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 3, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     IEnumPins_Release(enum1);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_find_pin(void)
@@ -415,34 +415,34 @@ static void test_find_pin(void)
     BOOL ret;
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pin);
 
     hr = IBaseFilter_FindPin(filter, L"Stream 00", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"Input", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     graph = connect_input(filter, filename);
 
     hr = IBaseFilter_EnumPins(filter, &enum_pins);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"Stream 00", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
     IPin_Release(pin);
     IPin_Release(pin2);
@@ -450,9 +450,9 @@ static void test_find_pin(void)
     IEnumPins_Release(enum_pins);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_pin_info(void)
@@ -471,52 +471,52 @@ static void test_pin_info(void)
     graph = connect_input(filter, filename);
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     expect_ref = get_refcount(filter);
     ref = get_refcount(pin);
-    ok(ref == expect_ref, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref, "Got unexpected refcount %ld.\n", ref);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     ok(!wcscmp(info.achName, L"input pin"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    ok(ref == expect_ref + 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == expect_ref + 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"input pin"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     IPin_Release(pin);
 
     hr = IBaseFilter_FindPin(filter, L"Stream 00", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_interface(pin, &IID_IPin, TRUE);
     check_interface(pin, &IID_IMediaSeeking, TRUE);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
     ok(!wcscmp(info.achName, L"Stream 00"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"Stream 00"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
@@ -524,9 +524,9 @@ static void test_pin_info(void)
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_media_types(void)
@@ -557,42 +557,42 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"input pin", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
 
     mt.majortype = MEDIATYPE_Stream;
     mt.subtype = MEDIASUBTYPE_Avi;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.bFixedSizeSamples = TRUE;
     mt.bTemporalCompression = TRUE;
     mt.lSampleSize = 123;
     mt.formattype = FORMAT_WaveFormatEx;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.majortype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.majortype = MEDIATYPE_Stream;
 
     mt.subtype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_Avi;
 
     graph = connect_input(filter, filename);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
     IPin_Release(pin);
@@ -600,86 +600,86 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"Stream 00", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Video), "Got major type %s\n",
             wine_dbgstr_guid(&pmt->majortype));
     ok(IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_I420), "Got subtype %s\n",
             wine_dbgstr_guid(&pmt->subtype));
     ok(!pmt->bFixedSizeSamples, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
     todo_wine ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
-    ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
+    ok(pmt->lSampleSize == 1, "Got sample size %lu.\n", pmt->lSampleSize);
     ok(IsEqualGUID(&pmt->formattype, &FORMAT_VideoInfo), "Got format type %s.\n",
             wine_dbgstr_guid(&pmt->formattype));
     ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
-    ok(pmt->cbFormat == sizeof(VIDEOINFOHEADER), "Got format size %u.\n", pmt->cbFormat);
+    ok(pmt->cbFormat == sizeof(VIDEOINFOHEADER), "Got format size %lu.\n", pmt->cbFormat);
     ok(!memcmp(pmt->pbFormat, &expect_vih, sizeof(VIDEOINFOHEADER)), "Format blocks didn't match.\n");
 
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pmt->bFixedSizeSamples = TRUE;
     pmt->bTemporalCompression = TRUE;
     pmt->lSampleSize = 123;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pmt->majortype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->majortype = MEDIATYPE_Video;
 
     pmt->subtype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->subtype = MEDIASUBTYPE_I420;
 
     pmt->formattype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->formattype = FORMAT_VideoInfo;
 
     vih = (VIDEOINFOHEADER *)pmt->pbFormat;
 
     vih->AvgTimePerFrame = 10000;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     vih->AvgTimePerFrame = 1000 * 10000;
 
     vih->dwBitRate = 1000000;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     vih->dwBitRate = 0;
 
     SetRect(&vih->rcSource, 0, 0, 32, 24);
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     SetRect(&vih->rcSource, 0, 0, 0, 0);
 
     vih->bmiHeader.biCompression = BI_RGB;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     vih->bmiHeader.biCompression = mmioFOURCC('I','4','2','0');
 
     CoTaskMemFree(pmt->pbFormat);
     CoTaskMemFree(pmt);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
     IPin_Release(pin);
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_enum_media_types(void)
@@ -697,29 +697,29 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"input pin", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enum1);
     IEnumMediaTypes_Release(enum2);
@@ -728,64 +728,64 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"Stream 00", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
@@ -795,9 +795,9 @@ static void test_enum_media_types(void)
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 struct testfilter
@@ -877,7 +877,7 @@ static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface
 
     if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt)))
     {
-        ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+        ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
         IPin_Release(peer);
         iface->pin.peer = NULL;
         FreeMediaType(&iface->pin.mt);
@@ -924,12 +924,12 @@ static HRESULT testsink_connect(struct strmbase_sink *iface, IPin *peer, const A
     HRESULT hr;
 
     hr = IPin_ConnectedTo(peer, &peer2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer2 == &iface->pin.IPin_iface, "Peer didn't match.\n");
     IPin_Release(peer2);
 
     hr = IPin_ConnectionMediaType(peer, &mt2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(mt, &mt2), "Media types didn't match.\n");
     FreeMediaType(&mt2);
 
@@ -946,16 +946,16 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample
     HRESULT hr;
 
     hr = IMediaSample_GetTime(sample, &start, &end);
-    todo_wine_if (hr == VFW_S_NO_STOP_TIME) ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine_if (hr == VFW_S_NO_STOP_TIME) ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (winetest_debug > 1)
-        trace("%04x: Got sample with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
+        trace("%04lx: Got sample with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
 
     ok(filter->new_segment_count, "Expected NewSegment() before Receive().\n");
 
     IPin_QueryInterface(iface->pin.peer, &IID_IMediaSeeking, (void **)&seeking);
     hr = IMediaSeeking_GetPositions(seeking, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == filter->seek_start, "Expected start position %I64u, got %I64u.\n", filter->seek_start, start);
     ok(end == filter->seek_end, "Expected end position %I64u, got %I64u.\n", filter->seek_end, end);
     IMediaSeeking_Release(seeking);
@@ -970,7 +970,7 @@ static HRESULT testsink_eos(struct strmbase_sink *iface)
     struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
 
     if (winetest_debug > 1)
-        trace("%04x: Got EOS.\n", GetCurrentThreadId());
+        trace("%04lx: Got EOS.\n", GetCurrentThreadId());
 
     ok(!filter->eos_count, "Got %u EOS events.\n", filter->eos_count + 1);
     ++filter->eos_count;
@@ -986,13 +986,13 @@ static HRESULT testsink_new_segment(struct strmbase_sink *iface,
     HRESULT hr;
 
     if (winetest_debug > 1)
-        trace("%04x: Got segment with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
+        trace("%04lx: Got segment with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
 
     ++filter->new_segment_count;
 
     IPin_QueryInterface(iface->pin.peer, &IID_IMediaSeeking, (void **)&seeking);
     hr = IMediaSeeking_GetPositions(seeking, &filter->seek_start, &filter->seek_end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IMediaSeeking_Release(seeking);
 
     ok(start == filter->segment_start, "Expected start %I64d, got %I64d.\n", filter->segment_start, start);
@@ -1107,50 +1107,50 @@ static void test_filter_state(IMediaControl *control)
     HRESULT hr;
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 }
 
 static void test_connect_pin(void)
@@ -1198,48 +1198,48 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(sink, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(sink, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Video;
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.majortype = MEDIATYPE_Stream;
 
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_Avi;
 
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(sink, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &testsource.source.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(sink, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
     ok(compare_media_types(&testsource.source.pin.mt, &req_mt), "Media types didn't match.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Test source connection. */
 
@@ -1247,11 +1247,11 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(source, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(source, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     /* Exact connection. */
 
@@ -1261,135 +1261,135 @@ static void test_connect_pin(void)
     CopyMediaType(&req_mt, source_mt);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     test_filter_state(control);
 
     hr = IPin_ConnectedTo(source, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &testsink.sink.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(source, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
     ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(testsink.sink.pin.peer == source, "Got peer %p.\n", testsink.sink.pin.peer);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.lSampleSize = 999;
     req_mt.bTemporalCompression = req_mt.bFixedSizeSamples = TRUE;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.majortype = MEDIATYPE_Stream;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.majortype = MEDIATYPE_Video;
 
     req_mt.subtype = MEDIASUBTYPE_RGB32;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_I420;
 
     /* Connection with wildcards. */
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.majortype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.subtype = MEDIASUBTYPE_RGB32;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.formattype = FORMAT_None;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Video;
     req_mt.subtype = MEDIASUBTYPE_I420;
     req_mt.formattype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.subtype = MEDIASUBTYPE_RGB32;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.majortype = MEDIATYPE_Audio;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     /* Test enumeration of sink media types. */
 
     testsink.mt = &req_mt;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Video;
     req_mt.subtype = MEDIASUBTYPE_I420;
     req_mt.formattype = FORMAT_VideoInfo;
     req_mt.lSampleSize = 444;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
 
     IPin_Release(source);
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(testsource.source.pin.peer == sink, "Got peer %p.\n", testsource.source.pin.peer);
     IFilterGraph2_Disconnect(graph, &testsource.source.pin.IPin_iface);
 
@@ -1401,17 +1401,17 @@ static void test_connect_pin(void)
     IPin_Release(sink);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(reader);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsource.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_unconnected_filter_state(void)
@@ -1422,53 +1422,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_seeking(void)
@@ -1508,137 +1508,137 @@ static void test_seeking(void)
     IPin_QueryInterface(pin, &IID_IMediaSeeking, (void **)&seeking);
 
     hr = IMediaSeeking_GetCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards
             | AM_SEEKING_CanSeekBackwards | AM_SEEKING_CanGetStopPos
-            | AM_SEEKING_CanGetDuration), "Got caps %#x.\n", caps);
+            | AM_SEEKING_CanGetDuration), "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards), "Got caps %#x.\n", caps);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards), "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanGetCurrentPos;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(caps == AM_SEEKING_CanSeekAbsolute, "Got caps %#x.\n", caps);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(caps == AM_SEEKING_CanSeekAbsolute, "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanGetCurrentPos;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(!caps, "Got caps %#x.\n", caps);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(!caps, "Got caps %#lx.\n", caps);
 
     caps = 0;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(!caps, "Got caps %#x.\n", caps);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(!caps, "Got caps %#lx.\n", caps);
 
     for (i = 0; i < ARRAY_SIZE(format_tests); ++i)
     {
         hr = IMediaSeeking_IsFormatSupported(seeking, format_tests[i].guid);
-        todo_wine_if(i == 1) ok(hr == format_tests[i].hr, "Got hr %#x for format %s.\n",
+        todo_wine_if(i == 1) ok(hr == format_tests[i].hr, "Got hr %#lx for format %s.\n",
                 hr, wine_dbgstr_guid(format_tests[i].guid));
     }
 
     hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_FRAME);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_FRAME);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(IsEqualGUID(&format, &TIME_FORMAT_FRAME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_FRAME);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     duration = 0;
     hr = IMediaSeeking_GetDuration(seeking, &duration);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(duration == 50000000, "Got duration %I64d.\n", duration);
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetStopPosition(seeking, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(stop == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
     hr = IMediaSeeking_GetCurrentPosition(seeking, &current);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 123, &TIME_FORMAT_FRAME);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(time == 123 * 10000000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     earliest = latest = 0xdeadbeef;
     hr = IMediaSeeking_GetAvailable(seeking, &earliest, &latest);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!earliest, "Got time %s.\n", wine_dbgstr_longlong(earliest));
     ok(latest == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(latest));
 
     rate = 0;
     hr = IMediaSeeking_GetRate(seeking, &rate);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(rate == 1.0, "Got rate %.16e.\n", rate);
 
     hr = IMediaSeeking_SetRate(seeking, 200.0);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     rate = 0;
     hr = IMediaSeeking_GetRate(seeking, &rate);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(rate == 200.0, "Got rate %.16e.\n", rate);
 
     hr = IMediaSeeking_SetRate(seeking, -1.0);
-    todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetPreroll(seeking, &time);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     current = 1500 * 10000;
     stop = 3500 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 1500 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 3500 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     /* Native snaps to the nearest frame. */
     ok(current > 0 && current < duration, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop > 0 && stop < duration && stop > current, "Got time %s.\n", wine_dbgstr_longlong(stop));
@@ -1647,21 +1647,21 @@ static void test_seeking(void)
     stop = 3500 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
             &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current > 0 && current < duration, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop > 0 && stop < duration && stop > current, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     hr = IMediaSeeking_GetStopPosition(seeking, &prev_stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     current = 0;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             NULL, AM_SEEKING_NoPositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == prev_stop, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(prev_stop), wine_dbgstr_longlong(stop));
@@ -1670,9 +1670,9 @@ static void test_seeking(void)
     IPin_Release(pin);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_streaming(void)
@@ -1696,21 +1696,21 @@ static void test_streaming(void)
     IPin_QueryInterface(source, &IID_IMediaSeeking, (void **)&seeking);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Expected timeout.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
     ok(testsink.sample_count, "Expected at least one sample.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
@@ -1721,7 +1721,7 @@ static void test_streaming(void)
     testsink.segment_end = 3500 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &testsink.segment_start, AM_SEEKING_AbsolutePositioning,
             &testsink.segment_end, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
@@ -1729,14 +1729,14 @@ static void test_streaming(void)
 
     start = end = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == testsink.seek_start, "Expected start position %I64u, got %I64u.\n", testsink.seek_start, start);
     ok(end == testsink.seek_end, "Expected end position %I64u, got %I64u.\n", testsink.seek_end, end);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
@@ -1744,7 +1744,7 @@ static void test_streaming(void)
 
     start = end = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == testsink.seek_start, "Expected start position %I64u, got %I64u.\n", testsink.seek_start, start);
     ok(end == testsink.seek_end, "Expected end position %I64u, got %I64u.\n", testsink.seek_end, end);
 
@@ -1752,13 +1752,13 @@ static void test_streaming(void)
     IPin_Release(source);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 START_TEST(avisplit)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c
index 2e1289e715b..269c590f8ee 100644
--- a/dlls/quartz/tests/dsoundrender.c
+++ b/dlls/quartz/tests/dsoundrender.c
@@ -36,7 +36,7 @@ static IBaseFilter *create_dsound_render(void)
     IBaseFilter *filter = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return filter;
 }
 
@@ -45,7 +45,7 @@ static IFilterGraph2 *create_graph(void)
     IFilterGraph2 *ret;
     HRESULT hr;
     hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret);
-    ok(hr == S_OK, "Failed to create FilterGraph: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return ret;
 }
 
@@ -115,17 +115,17 @@ static void test_property_bag(void)
 
     hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER,
             &IID_IPersistPropertyBag, (void **)&ppb);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr != S_OK) return;
 
     hr = IPersistPropertyBag_InitNew(ppb);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPersistPropertyBag_Load(ppb, &property_bag, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ref = IPersistPropertyBag_Release(ppb);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
 }
 
 #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
@@ -138,7 +138,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -229,53 +229,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_DSoundRender, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_DSoundRender, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -287,85 +287,85 @@ static void test_enum_pins(void)
     HRESULT hr;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
     IEnumPins_Release(enum1);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_find_pin(void)
@@ -377,26 +377,26 @@ static void test_find_pin(void)
     ULONG ref;
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, sink_id, &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum_pins);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
     IPin_Release(pin);
     IPin_Release(pin2);
 
     IEnumPins_Release(enum_pins);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_pin_info(void)
@@ -410,38 +410,38 @@ static void test_pin_info(void)
     IPin *pin;
 
     hr = IBaseFilter_FindPin(filter, sink_id, &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     ok(!wcscmp(info.achName, sink_id), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, sink_id), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     hr = IPin_QueryInternalConnections(pin, NULL, NULL);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_basic_audio(void)
@@ -456,50 +456,50 @@ static void test_basic_audio(void)
     ULONG ref;
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBasicAudio, (void **)&audio);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicAudio_get_Balance(audio, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicAudio_get_Balance(audio, &balance);
     if (hr != VFW_E_MONO_AUDIO_HW)
     {
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(balance == 0, "Got balance %d.\n", balance);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(balance == 0, "Got balance %ld.\n", balance);
 
         hr = IBasicAudio_put_Balance(audio, DSBPAN_LEFT - 1);
-        ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+        ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
         hr = IBasicAudio_put_Balance(audio, DSBPAN_LEFT);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IBasicAudio_get_Balance(audio, &balance);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(balance == DSBPAN_LEFT, "Got balance %d.\n", balance);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(balance == DSBPAN_LEFT, "Got balance %ld.\n", balance);
     }
 
     hr = IBasicAudio_get_Volume(audio, &volume);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(volume == 0, "Got volume %d.\n", volume);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(volume == 0, "Got volume %ld.\n", volume);
 
     hr = IBasicAudio_put_Volume(audio, DSBVOLUME_MIN - 1);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicAudio_put_Volume(audio, DSBVOLUME_MIN);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicAudio_get_Volume(audio, &volume);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(volume == DSBVOLUME_MIN, "Got volume %d.\n", volume);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(volume == DSBVOLUME_MIN, "Got volume %ld.\n", volume);
 
     hr = IBasicAudio_GetTypeInfoCount(audio, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(count == 1, "Got count %u.\n", count);
 
     hr = IBasicAudio_GetTypeInfo(audio, 0, 0, &typeinfo);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\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);
@@ -507,7 +507,7 @@ static void test_basic_audio(void)
 
     IBasicAudio_Release(audio);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_enum_media_types(void)
@@ -522,64 +522,64 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, sink_id, &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat);
     if (hr == S_OK) CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(count == 1, "Got count %u.\n", count);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(count == 1, "Got count %lu.\n", count);
     if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat);
     if (hr == S_OK) CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    todo_wine ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    todo_wine ok(count == 1, "Got count %lu.\n", count);
     if (count > 0) CoTaskMemFree(mts[0]->pbFormat);
     if (count > 0) CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat);
     if (hr == S_OK) CoTaskMemFree(mts[0]);
 
@@ -588,7 +588,7 @@ static void test_enum_media_types(void)
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 struct testfilter
@@ -656,36 +656,36 @@ static void test_allocator(IMemInputPin *input)
     HRESULT hr;
 
     hr = IMemInputPin_GetAllocatorRequirements(input, &props);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &ret_allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (hr == S_OK)
     {
         hr = IMemAllocator_GetProperties(ret_allocator, &props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(!props.cBuffers, "Got %d buffers.\n", props.cBuffers);
-        ok(!props.cbBuffer, "Got size %d.\n", props.cbBuffer);
-        ok(!props.cbAlign, "Got alignment %d.\n", props.cbAlign);
-        ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
+        ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
+        ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
+        ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
 
         hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(ret_allocator);
     }
 
     hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
             &IID_IMemAllocator, (void **)&req_allocator);
 
     hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &ret_allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
 
     IMemAllocator_Release(req_allocator);
@@ -703,9 +703,9 @@ static DWORD WINAPI frame_thread(void *arg)
     struct frame_thread_params *params = arg;
     HRESULT hr;
 
-    if (winetest_debug > 1) trace("%04x: Sending frame.\n", GetCurrentThreadId());
+    if (winetest_debug > 1) trace("%04lx: Sending frame.\n", GetCurrentThreadId());
     hr = IMemInputPin_Receive(params->sink, params->sample);
-    if (winetest_debug > 1) trace("%04x: Returned %#x.\n", GetCurrentThreadId(), hr);
+    if (winetest_debug > 1) trace("%04lx: Returned %#lx.\n", GetCurrentThreadId(), hr);
     IMediaSample_Release(params->sample);
     free(params);
     return hr;
@@ -725,24 +725,24 @@ static HRESULT send_frame(IMemInputPin *sink)
     DWORD ret;
 
     hr = IMemInputPin_GetAllocator(sink, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     words = (unsigned short *)data;
     for (i = 0; i < 44100 * 2; i += 2)
         words[i] = words[i+1] = sinf(i / 20.0f) * 0x7fff;
 
     hr = IMediaSample_SetActualDataLength(sample, 44100 * 4);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start_time = 0;
     end_time = start_time + 10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     params->sink = sink;
     params->sample = sample;
@@ -762,7 +762,7 @@ static void test_filter_state(IMemInputPin *input, IMediaControl *control)
     HRESULT hr;
 
     hr = send_frame(input);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     /* The renderer is not fully paused until it receives a sample. The
      * DirectSound renderer never blocks in Receive(), despite returning S_OK
@@ -771,71 +771,71 @@ static void test_filter_state(IMemInputPin *input, IMediaControl *control)
      * than it's worth to emulate, so for now, we'll ignore this behaviour. */
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     /* It's possible to queue multiple samples while paused. The number of
      * samples that can be queued depends on the length of each sample, but
      * it's not particularly clear how. */
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* The DirectSound renderer will silently refuse to transition to running
      * if it hasn't finished pausing yet. Once it does it reports itself as
@@ -848,43 +848,43 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
     HRESULT hr;
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
@@ -898,14 +898,14 @@ static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
     {
         if (code == EC_COMPLETE)
         {
-            ok(param1 == S_OK, "Got param1 %#lx.\n", param1);
-            ok(!param2, "Got param2 %#lx.\n", param2);
+            ok(param1 == S_OK, "Got param1 %#Ix.\n", param1);
+            ok(!param2, "Got param2 %#Ix.\n", param2);
             ret++;
         }
         IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
         timeout = 0;
     }
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     return ret;
 }
@@ -920,28 +920,28 @@ static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
     IMediaControl_QueryInterface(control, &IID_IMediaEvent, (void **)&eventsrc);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = send_frame(input);
-    todo_wine ok(hr == VFW_E_SAMPLE_REJECTED_EOS, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_SAMPLE_REJECTED_EOS, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Expected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
@@ -949,79 +949,79 @@ static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
      * done rendering. */
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = send_frame(input);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
     ret = check_ec_complete(eventsrc, 2000);
     todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     /* Test sending EOS while flushing. */
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = send_frame(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndOfStream(pin);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     /* Test sending EOS and then flushing or stopping. */
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = send_frame(input);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = send_frame(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
@@ -1070,37 +1070,37 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &source.source.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
 
@@ -1108,48 +1108,48 @@ static void test_connect_pin(void)
 
     hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
             &IID_IMemAllocator, (void **)&allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
     hr = IMemInputPin_NotifyAllocator(input, allocator, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_ReceiveCanBlock(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     test_filter_state(input, control);
     test_flushing(pin, input, control);
     test_eos(pin, input, control);
 
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(source.source.pin.peer == pin, "Got peer %p.\n", source.source.pin.peer);
     IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     ref = IMemAllocator_Release(allocator);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IMemInputPin_Release(input);
     IPin_Release(pin);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_filter_state(void)
@@ -1160,53 +1160,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static HRESULT does_dsound_support_format(WAVEFORMATEX *format)
@@ -1222,7 +1222,7 @@ static HRESULT does_dsound_support_format(WAVEFORMATEX *format)
     HRESULT hr;
 
     hr = DirectSoundCreate(NULL, &dsound, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IDirectSound_CreateSoundBuffer(dsound, &desc, &buffer, NULL);
     if (hr == S_OK)
@@ -1263,30 +1263,30 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, sink_id, &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &mt, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         ok(IsEqualGUID(&mt->majortype, &MEDIATYPE_Audio), "Got major type %s.\n", wine_dbgstr_guid(&mt->majortype));
         ok(IsEqualGUID(&mt->subtype, &GUID_NULL), "Got subtype %s.\n", wine_dbgstr_guid(&mt->subtype));
         ok(mt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", mt->bFixedSizeSamples);
         ok(!mt->bTemporalCompression, "Got temporal compression %d.\n", mt->bTemporalCompression);
-        ok(mt->lSampleSize == 1, "Got sample size %u.\n", mt->lSampleSize);
+        ok(mt->lSampleSize == 1, "Got sample size %lu.\n", mt->lSampleSize);
         ok(IsEqualGUID(&mt->formattype, &GUID_NULL), "Got format type %s.\n", wine_dbgstr_guid(&mt->formattype));
         ok(!mt->pUnk, "Got pUnk %p.\n", mt->pUnk);
-        ok(!mt->cbFormat, "Got format size %u.\n", mt->cbFormat);
+        ok(!mt->cbFormat, "Got format size %lu.\n", mt->cbFormat);
         ok(!mt->pbFormat, "Got unexpected format block.\n");
 
         hr = IPin_QueryAccept(pin, mt);
-        ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+        ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
         CoTaskMemFree(mt);
     }
 
     hr = IEnumMediaTypes_Next(enummt, 1, &mt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Audio;
     req_mt.formattype = FORMAT_WaveFormatEx;
@@ -1312,7 +1312,7 @@ static void test_media_types(void)
                 expect_hr = does_dsound_support_format(&wfx);
 
                 hr = IPin_QueryAccept(pin, &req_mt);
-                ok(hr == expect_hr, "Expected hr %#x, got %#x, for %d channels, %d-bit %s, %d Hz.\n",
+                ok(hr == expect_hr, "Expected hr %#lx, got %#lx, for %d channels, %d-bit %s, %ld Hz.\n",
                         expect_hr, hr, channels, formats[i].depth,
                         formats[i].tag == WAVE_FORMAT_PCM ? "integer" : "float", sample_rates[j]);
             }
@@ -1321,7 +1321,7 @@ static void test_media_types(void)
 
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_eos(void)
@@ -1335,49 +1335,49 @@ static void test_unconnected_eos(void)
     ULONG ref;
 
     hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
@@ -1385,9 +1385,9 @@ static void test_unconnected_eos(void)
     IMediaControl_Release(control);
     IMediaEvent_Release(eventsrc);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 START_TEST(dsoundrender)
@@ -1405,7 +1405,7 @@ START_TEST(dsoundrender)
         CoUninitialize();
         return;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IBaseFilter_Release(filter);
 
     test_property_bag();
diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c
index 4162e248937..c383d9f6579 100644
--- a/dlls/quartz/tests/filesource.c
+++ b/dlls/quartz/tests/filesource.c
@@ -29,7 +29,7 @@ static IBaseFilter *create_file_source(void)
     IBaseFilter *filter = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
         &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return filter;
 }
 
@@ -51,11 +51,11 @@ static WCHAR *load_resource(const WCHAR *name)
     wcscat(pathW, name);
 
     file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %u.\n",
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %lu.\n",
             wine_dbgstr_w(pathW), GetLastError());
 
     res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA);
-    ok(!!res, "Failed to load resource, error %u.\n", GetLastError());
+    ok(!!res, "Failed to load resource, error %lu.\n", GetLastError());
     ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res));
     WriteFile(file, ptr, SizeofResource( GetModuleHandleA(NULL), res), &written, NULL);
     ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n");
@@ -70,9 +70,9 @@ static void load_file(IBaseFilter *filter, const WCHAR *filename)
     HRESULT hr;
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFileSourceFilter_Load(filesource, filename, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IFileSourceFilter_Release(filesource);
 }
 
@@ -93,7 +93,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -181,53 +181,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_AsyncReader, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_AsyncReader, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_file_source_filter(void)
@@ -306,9 +306,9 @@ static void test_file_source_filter(void)
         trace("Running test for %s.\n", tests[i].label);
 
         file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-        ok(file != INVALID_HANDLE_VALUE, "Failed to create file, error %u.\n", GetLastError());
+        ok(file != INVALID_HANDLE_VALUE, "Failed to create file, error %lu.\n", GetLastError());
         ret = WriteFile(file, tests[i].data, tests[i].size, &written, NULL);
-        ok(ret, "Failed to write file, error %u.\n", GetLastError());
+        ok(ret, "Failed to write file, error %lu.\n", GetLastError());
         CloseHandle(file);
 
         filter = create_file_source();
@@ -316,27 +316,27 @@ static void test_file_source_filter(void)
 
         olepath = (void *)0xdeadbeef;
         hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!olepath, "Got path %s.\n", wine_dbgstr_w(olepath));
 
         hr = IFileSourceFilter_Load(filesource, NULL, NULL);
-        ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+        ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
         hr = IFileSourceFilter_Load(filesource, path, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IFileSourceFilter_GetCurFile(filesource, NULL, &mt);
-        ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+        ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
         olepath = NULL;
         hr = IFileSourceFilter_GetCurFile(filesource, &olepath, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         CoTaskMemFree(olepath);
 
         olepath = NULL;
         memset(&file_mt, 0x11, sizeof(file_mt));
         hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &file_mt);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!wcscmp(olepath, path), "Expected path %s, got %s.\n",
                 wine_dbgstr_w(path), wine_dbgstr_w(olepath));
         ok(IsEqualGUID(&file_mt.majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
@@ -348,40 +348,40 @@ static void test_file_source_filter(void)
         ok(file_mt.bFixedSizeSamples == TRUE, "Got fixed size %d.\n", file_mt.bFixedSizeSamples);
         ok(file_mt.bTemporalCompression == FALSE, "Got temporal compression %d.\n",
                 file_mt.bTemporalCompression);
-        ok(file_mt.lSampleSize == 1, "Got sample size %u.\n", file_mt.lSampleSize);
+        ok(file_mt.lSampleSize == 1, "Got sample size %lu.\n", file_mt.lSampleSize);
         ok(IsEqualGUID(&file_mt.formattype, &GUID_NULL), "Got format type %s.\n",
                 wine_dbgstr_guid(&file_mt.formattype));
         ok(!file_mt.pUnk, "Got pUnk %p.\n", file_mt.pUnk);
-        ok(!file_mt.cbFormat, "Got format size %#x.\n", file_mt.cbFormat);
+        ok(!file_mt.cbFormat, "Got format size %#lx.\n", file_mt.cbFormat);
         ok(!file_mt.pbFormat, "Got format %p.\n", file_mt.pbFormat);
         CoTaskMemFree(olepath);
 
         hr = IBaseFilter_FindPin(filter, L"Output", &pin);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IPin_EnumMediaTypes(pin, &enum_mt);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(pmt, &file_mt, sizeof(*pmt)), "Media types did not match.\n");
         CoTaskMemFree(pmt);
 
         hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         mt = file_mt;
         mt.subtype = GUID_NULL;
         ok(!memcmp(pmt, &mt, sizeof(*pmt)), "Media types did not match.\n");
         CoTaskMemFree(pmt);
 
         hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
-        ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+        ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
         IEnumMediaTypes_Release(enum_mt);
 
         mt = file_mt;
         hr = IPin_QueryAccept(pin, &mt);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         mt.bFixedSizeSamples = FALSE;
         mt.bTemporalCompression = TRUE;
@@ -389,33 +389,33 @@ static void test_file_source_filter(void)
         mt.formattype = FORMAT_VideoInfo;
         mt.subtype = MEDIASUBTYPE_RGB32;
         hr = IPin_QueryAccept(pin, &mt);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         mt.majortype = MEDIATYPE_Video;
         hr = IPin_QueryAccept(pin, &mt);
-        ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+        ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
         mt.majortype = MEDIATYPE_Stream;
 
         if (!IsEqualGUID(tests[i].subtype, &GUID_NULL))
         {
             mt.subtype = GUID_NULL;
             hr = IPin_QueryAccept(pin, &mt);
-            ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+            ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
         }
 
         IPin_Release(pin);
         IFileSourceFilter_Release(filesource);
         ref = IBaseFilter_Release(filter);
-        ok(!ref, "Got outstanding refcount %d.\n", ref);
+        ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
         ret = DeleteFileW(path);
-        ok(ret, "Failed to delete file, error %u\n", GetLastError());
+        ok(ret, "Failed to delete file, error %lu\n", GetLastError());
     }
 
     /* test prescribed format */
     filter = create_file_source();
     hr = IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.majortype = MEDIATYPE_Video;
     mt.subtype = MEDIASUBTYPE_RGB8;
@@ -428,73 +428,73 @@ static void test_file_source_filter(void)
     mt.pbFormat = NULL;
     filename = load_resource(L"test.avi");
     hr = IFileSourceFilter_Load(filesource, filename, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &file_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!memcmp(&file_mt, &mt, sizeof(mt)), "Media types did not match.\n");
     CoTaskMemFree(olepath);
 
     hr = IBaseFilter_FindPin(filter, L"Output", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_EnumMediaTypes(pin, &enum_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!memcmp(pmt, &file_mt, sizeof(*pmt)), "Media types did not match.\n");
     CoTaskMemFree(pmt);
 
     hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
             wine_dbgstr_guid(&pmt->majortype));
     ok(IsEqualGUID(&pmt->subtype, &GUID_NULL), "Got subtype %s.\n",
             wine_dbgstr_guid(&pmt->subtype));
     ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
     ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
-    ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
+    ok(pmt->lSampleSize == 1, "Got sample size %lu.\n", pmt->lSampleSize);
     ok(IsEqualGUID(&pmt->formattype, &GUID_NULL), "Got format type %s.\n",
             wine_dbgstr_guid(&pmt->formattype));
     ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
-    ok(!pmt->cbFormat, "Got format size %#x.\n", pmt->cbFormat);
+    ok(!pmt->cbFormat, "Got format size %#lx.\n", pmt->cbFormat);
     ok(!pmt->pbFormat, "Got format %p.\n", pmt->pbFormat);
 
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     CoTaskMemFree(pmt);
 
     hr = IEnumMediaTypes_Next(enum_mt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enum_mt);
 
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.bFixedSizeSamples = TRUE;
     mt.bTemporalCompression = FALSE;
     mt.lSampleSize = 456;
     mt.formattype = FORMAT_VideoInfo;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.majortype = MEDIATYPE_Stream;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.majortype = MEDIATYPE_Video;
 
     mt.subtype = MEDIASUBTYPE_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
     IFileSourceFilter_Release(filesource);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_enum_pins(void)
@@ -509,102 +509,102 @@ static void test_enum_pins(void)
     BOOL ret;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     load_file(filter, filename);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
     IEnumPins_Release(enum1);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_find_pin(void)
@@ -618,31 +618,31 @@ static void test_find_pin(void)
     BOOL ret;
 
     hr = IBaseFilter_FindPin(filter, L"Output", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     load_file(filter, filename);
 
     hr = IBaseFilter_FindPin(filter, L"Output", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, &enumpins);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enumpins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin, pin2);
 
     IPin_Release(pin2);
     IPin_Release(pin);
     IEnumPins_Release(enumpins);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_pin_info(void)
@@ -660,37 +660,37 @@ static void test_pin_info(void)
     load_file(filter, filename);
 
     hr = IBaseFilter_FindPin(filter, L"Output", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
     ok(!wcscmp(info.achName, L"Output"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"Output"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_unconnected_filter_state(void)
@@ -701,53 +701,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_sync_read_aligned(IAsyncReader *reader, IMemAllocator *allocator)
@@ -765,13 +765,13 @@ static void test_sync_read_aligned(IAsyncReader *reader, IMemAllocator *allocato
     start_time = 0;
     end_time = 512 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_SyncReadAligned(reader, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     len = IMediaSample_GetActualDataLength(sample);
-    ok(len == 512, "Got length %d.\n", len);
+    ok(len == 512, "Got length %ld.\n", len);
 
     for (i = 0; i < 512; i++)
         ok(data[i] == i % 111, "Got wrong byte %02x at %u.\n", data[i], i);
@@ -779,13 +779,13 @@ static void test_sync_read_aligned(IAsyncReader *reader, IMemAllocator *allocato
     start_time = 512 * (LONGLONG)10000000;
     end_time  = 1024 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_SyncReadAligned(reader, sample);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     len = IMediaSample_GetActualDataLength(sample);
-    ok(len == 88, "Got length %d.\n", len);
+    ok(len == 88, "Got length %ld.\n", len);
 
     for (i = 0; i < 88; i++)
         ok(data[i] == (512 + i) % 111, "Got wrong byte %02x at %u.\n", data[i], i);
@@ -793,13 +793,13 @@ static void test_sync_read_aligned(IAsyncReader *reader, IMemAllocator *allocato
     start_time = 1024 * (LONGLONG)10000000;
     end_time   = 1536 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_SyncReadAligned(reader, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     len = IMediaSample_GetActualDataLength(sample);
-    ok(len == 0, "Got length %d.\n", len);
+    ok(len == 0, "Got length %ld.\n", len);
 
     IMediaSample_Release(sample);
 }
@@ -814,7 +814,7 @@ static DWORD CALLBACK request_thread(void *arg)
 {
     struct request_thread_params *params = arg;
     HRESULT hr = IAsyncReader_Request(params->reader, params->sample, 123);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return 0;
 }
 
@@ -836,23 +836,23 @@ static void test_request(IAsyncReader *reader, IMemAllocator *allocator)
     IMediaSample_GetPointer(sample2, &data2);
 
     hr = IAsyncReader_WaitForNext(reader, 0, &ret_sample, &cookie);
-    ok(hr == VFW_E_TIMEOUT, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TIMEOUT, "Got hr %#lx.\n", hr);
 
     start_time = 0;
     end_time = 512 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_Request(reader, sample, 123);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_WaitForNext(reader, 1000, &ret_sample, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(ret_sample == sample, "Expected sample %p, got %p.\n", sample, ret_sample);
-    ok(cookie == 123, "Got cookie %lu.\n", cookie);
+    ok(cookie == 123, "Got cookie %Iu.\n", cookie);
 
     len = IMediaSample_GetActualDataLength(sample);
-    ok(len == 512, "Got length %d.\n", hr);
+    ok(len == 512, "Got length %ld.\n", len);
 
     for (i = 0; i < 512; i++)
         ok(data[i] == i % 111, "Got wrong byte %02x at %u.\n", data[i], i);
@@ -860,47 +860,47 @@ static void test_request(IAsyncReader *reader, IMemAllocator *allocator)
     start_time = 1024 * (LONGLONG)10000000;
     end_time   = 1536 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_Request(reader, sample, 123);
-    ok(hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF), "Got hr %#x.\n", hr);
+    ok(hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF), "Got hr %#lx.\n", hr);
 
     start_time = 0;
     end_time = 512 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_Request(reader, sample, 123);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start_time = 512 * (LONGLONG)10000000;
     end_time  = 1024 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample2, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_Request(reader, sample2, 456);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_WaitForNext(reader, 1000, &ret_sample, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (cookie == 123)
     {
         ok(ret_sample == sample, "Expected sample %p, got %p.\n", sample, ret_sample);
 
         hr = IAsyncReader_WaitForNext(reader, 1000, &ret_sample, &cookie);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(ret_sample == sample2, "Expected sample %p, got %p.\n", sample2, ret_sample);
-        ok(cookie == 456, "Got cookie %lu.\n", cookie);
+        ok(cookie == 456, "Got cookie %Iu.\n", cookie);
     }
     else
     {
-        ok(cookie == 456, "Got cookie %lu.\n", cookie);
+        ok(cookie == 456, "Got cookie %Iu.\n", cookie);
         ok(ret_sample == sample2, "Expected sample %p, got %p.\n", sample2, ret_sample);
 
         hr = IAsyncReader_WaitForNext(reader, 1000, &ret_sample, &cookie);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(ret_sample == sample, "Expected sample %p, got %p.\n", sample, ret_sample);
-        ok(cookie == 123, "Got cookie %lu.\n", cookie);
+        ok(cookie == 123, "Got cookie %Iu.\n", cookie);
     }
 
     for (i = 0; i < 512; i++)
@@ -916,9 +916,9 @@ static void test_request(IAsyncReader *reader, IMemAllocator *allocator)
     CloseHandle(thread);
 
     hr = IAsyncReader_WaitForNext(reader, 1000, &ret_sample, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(ret_sample == sample, "Samples didn't match.\n");
-    ok(cookie == 123, "Got cookie %lu.\n", cookie);
+    ok(cookie == 123, "Got cookie %Iu.\n", cookie);
 
     IMediaSample_Release(sample);
     IMediaSample_Release(sample2);
@@ -930,7 +930,7 @@ static DWORD CALLBACK wait_thread(void *arg)
     IMediaSample *sample;
     DWORD_PTR cookie;
     HRESULT hr = IAsyncReader_WaitForNext(reader, 2000, &sample, &cookie);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
     return 0;
 }
 
@@ -950,44 +950,44 @@ static void test_flush(IAsyncReader *reader, IMemAllocator *allocator)
     start_time = 0;
     end_time = 512 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_BeginFlush(reader);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_SyncRead(reader, 0, 20, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     for (i = 0; i < 20; i++)
         ok(buffer[i] == i % 111, "Got wrong byte %02x at %u.\n", buffer[i], i);
 
     start_time = 0;
     end_time = 512 * (LONGLONG)10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_SyncReadAligned(reader, sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     for (i = 0; i < 512; i++)
         ok(data[i] == i % 111, "Got wrong byte %02x at %u.\n", data[i], i);
 
     hr = IAsyncReader_Request(reader, sample, 456);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_EndFlush(reader);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_WaitForNext(reader, 0, &ret_sample, &cookie);
-    ok(hr == VFW_E_TIMEOUT, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TIMEOUT, "Got hr %#lx.\n", hr);
 
     start_time = 0;
     end_time = 512 * (LONGLONG)10000000;
     hr = IAsyncReader_Request(reader, sample, 123);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_WaitForNext(reader, 1000, &ret_sample, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(ret_sample == sample, "Expected sample %p, got %p.\n", sample, ret_sample);
-    ok(cookie == 123, "Got cookie %lu.\n", cookie);
+    ok(cookie == 123, "Got cookie %Iu.\n", cookie);
 
     for (i = 0; i < 512; i++)
         ok(data[i] == i % 111, "Got wrong byte %02x at %u.\n", data[i], i);
@@ -996,12 +996,12 @@ static void test_flush(IAsyncReader *reader, IMemAllocator *allocator)
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Expected timeout.\n");
 
     hr = IAsyncReader_BeginFlush(reader);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!WaitForSingleObject(thread, 1000), "Wait timed out.\n");
     CloseHandle(thread);
 
     hr = IAsyncReader_EndFlush(reader);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaSample_Release(sample);
 }
@@ -1027,7 +1027,7 @@ static void test_async_reader(void)
     GetTempPathW(ARRAY_SIZE(filename), filename);
     wcscat(filename, L"test.avi");
     file = CreateFileW(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create file, error %u.\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create file, error %lu.\n", GetLastError());
     for (i = 0; i < 600; i++)
     {
         BYTE b = i % 111;
@@ -1040,31 +1040,31 @@ static void test_async_reader(void)
     IBaseFilter_FindPin(filter, L"Output", &pin);
 
     hr = IPin_QueryInterface(pin, &IID_IAsyncReader, (void **)&reader);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IAsyncReader_Length(reader, &length, &available);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(length == 600, "Got length %s.\n", wine_dbgstr_longlong(length));
     ok(available == 600, "Got available length %s.\n", wine_dbgstr_longlong(available));
 
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IAsyncReader_SyncRead(reader, 0, 10, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     for (i = 0; i < 10; i++)
         ok(buffer[i] == i % 111, "Got wrong byte %02x at %u.\n", buffer[i], i);
 
     hr = IAsyncReader_SyncRead(reader, 0, 10, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     for (i = 0; i < 10; i++)
         ok(buffer[i] == i % 111, "Got wrong byte %02x at %u.\n", buffer[i], i);
 
     hr = IAsyncReader_SyncRead(reader, 10, 10, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     for (i = 0; i < 10; i++)
         ok(buffer[i] == (10 + i) % 111, "Got wrong byte %02x at %u.\n", buffer[i], i);
 
     hr = IAsyncReader_SyncRead(reader, 590, 20, buffer);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     for (i = 0; i < 10; i++)
         ok(buffer[i] == (590 + i) % 111, "Got wrong byte %02x at %u.\n", buffer[i], i);
     for (; i < 20; i++)
@@ -1072,16 +1072,16 @@ static void test_async_reader(void)
 
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IAsyncReader_SyncRead(reader, 600, 10, buffer);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(buffer[0] == 0xcc, "Got wrong byte %02x.\n", buffer[0]);
 
     ret_props = req_props;
     hr = IAsyncReader_RequestAllocator(reader, NULL, &ret_props, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(ret_props.cBuffers == 100, "Got %d buffers.\n", ret_props.cBuffers);
-    ok(ret_props.cbBuffer == 1024, "Got size %d.\n", ret_props.cbBuffer);
-    ok(ret_props.cbAlign == 512, "Got alignment %d.\n", ret_props.cbAlign);
-    ok(ret_props.cbPrefix == 0, "Got prefix %d.\n", ret_props.cbPrefix);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(ret_props.cBuffers == 100, "Got %ld buffers.\n", ret_props.cBuffers);
+    ok(ret_props.cbBuffer == 1024, "Got size %ld.\n", ret_props.cbBuffer);
+    ok(ret_props.cbAlign == 512, "Got alignment %ld.\n", ret_props.cbAlign);
+    ok(ret_props.cbPrefix == 0, "Got prefix %ld.\n", ret_props.cbPrefix);
 
     IMemAllocator_Commit(allocator);
 
@@ -1094,9 +1094,9 @@ static void test_async_reader(void)
     IPin_Release(pin);
     IFileSourceFilter_Release(filesource);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_enum_media_types(void)
@@ -1115,84 +1115,84 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"Output", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]);
     CoTaskMemFree(mts[1]);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 3, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]);
     CoTaskMemFree(mts[1]);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 3);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     CoTaskMemFree(mts[0]);
 
     IEnumMediaTypes_Release(enum1);
@@ -1200,9 +1200,9 @@ static void test_enum_media_types(void)
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 struct testsink
@@ -1319,52 +1319,52 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(source, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(source, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     /* Test exact connection. */
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(source, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &testsink.pin.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(source, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
     ok(compare_media_types(&testsink.pin.pin.mt, &req_mt), "Media types didn't match.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(testsink.pin.pin.peer == source, "Got peer %p.\n", testsink.pin.pin.peer);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
 
     req_mt.pbFormat = &my_format;
     req_mt.cbFormat = sizeof(my_format);
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.pin.pin.mt, &req_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
@@ -1373,31 +1373,31 @@ static void test_connect_pin(void)
 
     req_mt.majortype = MEDIATYPE_Video;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.majortype = MEDIATYPE_Stream;
 
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.pin.pin.mt, &req_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_Avi;
 
     /* Test connection with wildcards. */
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
 
     req_mt.formattype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
@@ -1405,22 +1405,22 @@ static void test_connect_pin(void)
     req_mt.formattype = FORMAT_None;
     req_mt.majortype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.formattype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
 
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
@@ -1428,24 +1428,24 @@ static void test_connect_pin(void)
     req_mt.majortype = MEDIATYPE_Stream;
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
 
     req_mt.majortype = MEDIATYPE_Video;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     /* The second type (i.e. whose subtype is GUID_NULL) is not tried. This is
      * consistent with its being rejected by IPin::QueryAccept(). */
     testsink.reject_avi = TRUE;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, NULL);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     /* But any types we expose are tried. */
     testsink.mt = &mt;
@@ -1454,11 +1454,11 @@ static void test_connect_pin(void)
     mt.subtype = MEDIASUBTYPE_RGB8;
     mt.formattype = FORMAT_None;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, NULL);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     mt.majortype = MEDIATYPE_Stream;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.pin.pin.mt, &mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
@@ -1467,13 +1467,13 @@ static void test_connect_pin(void)
     IPin_Release(source);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 START_TEST(filesource)
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 2496b556132..0e9a398ad2c 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -42,10 +42,10 @@ static WCHAR *create_file(const WCHAR *name, const char *data, DWORD size)
     GetTempPathW(ARRAY_SIZE(pathW), pathW);
     wcscat(pathW, name);
     file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %u.\n",
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %lu.\n",
             wine_dbgstr_w(pathW), GetLastError());
     WriteFile(file, data, size, &written, NULL);
-    ok(written = size, "Failed to write file data, error %u.\n", GetLastError());
+    ok(written = size, "Failed to write file data, error %lu.\n", GetLastError());
     CloseHandle(file);
 
     return pathW;
@@ -57,7 +57,7 @@ static WCHAR *load_resource(const WCHAR *name)
     void *ptr;
 
     res = FindResourceW(NULL, name, (const WCHAR *)RT_RCDATA);
-    ok(!!res, "Failed to find resource %s, error %u.\n", wine_dbgstr_w(name), GetLastError());
+    ok(!!res, "Failed to find resource %s, error %lu.\n", wine_dbgstr_w(name), GetLastError());
     ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res));
     return create_file(name, ptr, SizeofResource(GetModuleHandleA(NULL), res));
 }
@@ -67,7 +67,7 @@ static IFilterGraph2 *create_graph(void)
     IFilterGraph2 *ret;
     HRESULT hr;
     hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret);
-    ok(hr == S_OK, "Failed to create FilterGraph: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return ret;
 }
 
@@ -88,7 +88,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -134,202 +134,202 @@ static void test_basic_video(IFilterGraph2 *graph)
     HRESULT hr;
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IBasicVideo, (void **)&pbv);
-    ok(hr==S_OK, "Cannot get IBasicVideo interface returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* test get video size */
     hr = IBasicVideo_GetVideoSize(pbv, NULL, NULL);
-    ok(hr==E_POINTER, "IBasicVideo_GetVideoSize returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoSize(pbv, &video_width, NULL);
-    ok(hr==E_POINTER, "IBasicVideo_GetVideoSize returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoSize(pbv, NULL, &video_height);
-    ok(hr==E_POINTER, "IBasicVideo_GetVideoSize returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoSize(pbv, &video_width, &video_height);
-    ok(hr==S_OK, "Cannot get video size returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* test source position */
     hr = IBasicVideo_GetSourcePosition(pbv, NULL, NULL, NULL, NULL);
-    ok(hr == E_POINTER, "IBasicVideo_GetSourcePosition returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(pbv, &left, &top, NULL, NULL);
-    ok(hr == E_POINTER, "IBasicVideo_GetSourcePosition returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(pbv, NULL, NULL, &width, &height);
-    ok(hr == E_POINTER, "IBasicVideo_GetSourcePosition returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(left == 0, "expected 0, got %d\n", left);
-    ok(top == 0, "expected 0, got %d\n", top);
-    ok(width == video_width, "expected %d, got %d\n", video_width, width);
-    ok(height == video_height, "expected %d, got %d\n", video_height, height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 0, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == video_width, "Expected width %ld, got %ld.\n", video_width, width);
+    ok(height == video_height, "Expected height %ld, got %ld.\n", video_height, height);
 
     hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, 0, 0);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width*2, video_height*2);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(pbv, -1);
-    ok(hr==E_INVALIDARG, "IBasicVideo_put_SourceTop returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(pbv, 0);
-    ok(hr==S_OK, "Cannot put source top returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(pbv, 1);
-    ok(hr==E_INVALIDARG, "IBasicVideo_put_SourceTop returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(pbv, video_width, 0, video_width, video_height);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetSourcePosition(pbv, 0, video_height, video_width, video_height);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetSourcePosition(pbv, -1, 0, video_width, video_height);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetSourcePosition(pbv, 0, -1, video_width, video_height);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetSourcePosition(pbv, video_width/2, video_height/2, video_width, video_height);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetSourcePosition(pbv, video_width/2, video_height/2, video_width, video_height);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width, video_height+1);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width+1, video_height);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(pbv, video_width/2, video_height/2, video_width/3+1, video_height/3+1);
-    ok(hr==S_OK, "Cannot set source position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_SourceLeft(pbv, &left);
-    ok(hr==S_OK, "Cannot get source left returned: %x\n", hr);
-    ok(left==video_width/2, "expected %d, got %d\n", video_width/2, left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == video_width / 2, "Expected left %ld, got %ld.\n", video_width / 2, left);
     hr = IBasicVideo_get_SourceTop(pbv, &top);
-    ok(hr==S_OK, "Cannot get source top returned: %x\n", hr);
-    ok(top==video_height/2, "expected %d, got %d\n", video_height/2, top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == video_height / 2, "Expected top %ld, got %ld.\n", video_height / 2, top);
     hr = IBasicVideo_get_SourceWidth(pbv, &width);
-    ok(hr==S_OK, "Cannot get source width returned: %x\n", hr);
-    ok(width==video_width/3+1, "expected %d, got %d\n", video_width/3+1, width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == video_width / 3 + 1, "Expected width %ld, got %ld.\n", video_width / 3 + 1, width);
     hr = IBasicVideo_get_SourceHeight(pbv, &height);
-    ok(hr==S_OK, "Cannot get source height returned: %x\n", hr);
-    ok(height==video_height/3+1, "expected %d, got %d\n", video_height/3+1, height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == video_height / 3 + 1, "Expected height %ld, got %ld.\n", video_height / 3 + 1, height);
 
     hr = IBasicVideo_put_SourceLeft(pbv, video_width/3);
-    ok(hr==S_OK, "Cannot put source left returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(left == video_width/3, "expected %d, got %d\n", video_width/3, left);
-    ok(width == video_width/3+1, "expected %d, got %d\n", video_width/3+1, width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == video_width / 3, "Expected left %ld, got %ld.\n", video_width / 3, left);
+    ok(width == video_width / 3 + 1, "Expected width %ld, got %ld.\n", video_width / 3 + 1, width);
 
     hr = IBasicVideo_put_SourceTop(pbv, video_height/3);
-    ok(hr==S_OK, "Cannot put source top returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(top == video_height/3, "expected %d, got %d\n", video_height/3, top);
-    ok(height == video_height/3+1, "expected %d, got %d\n", video_height/3+1, height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == video_height / 3, "Expected top %ld, got %ld.\n", video_height / 3, top);
+    ok(height == video_height / 3 + 1, "Expected height %ld, got %ld.\n", video_height / 3 + 1, height);
 
     hr = IBasicVideo_put_SourceWidth(pbv, video_width/4+1);
-    ok(hr==S_OK, "Cannot put source width returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(left == video_width/3, "expected %d, got %d\n", video_width/3, left);
-    ok(width == video_width/4+1, "expected %d, got %d\n", video_width/4+1, width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == video_width / 3, "Expected left %ld, got %ld.\n", video_width / 3, left);
+    ok(width == video_width / 4 + 1, "Expected width %ld, got %ld.\n", video_width / 4 + 1, width);
 
     hr = IBasicVideo_put_SourceHeight(pbv, video_height/4+1);
-    ok(hr==S_OK, "Cannot put source height returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(top == video_height/3, "expected %d, got %d\n", video_height/3, top);
-    ok(height == video_height/4+1, "expected %d, got %d\n", video_height/4+1, height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == video_height / 3, "Expected top %ld, got %ld.\n", video_height / 3, top);
+    ok(height == video_height / 4 + 1, "Expected height %ld, got %ld.\n", video_height / 4 + 1, height);
 
     /* test destination rectangle */
     window_width = max(video_width, GetSystemMetrics(SM_CXMIN) - 2 * GetSystemMetrics(SM_CXFRAME));
 
     hr = IBasicVideo_GetDestinationPosition(pbv, NULL, NULL, NULL, NULL);
-    ok(hr == E_POINTER, "IBasicVideo_GetDestinationPosition returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, NULL, NULL);
-    ok(hr == E_POINTER, "IBasicVideo_GetDestinationPosition returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(pbv, NULL, NULL, &width, &height);
-    ok(hr == E_POINTER, "IBasicVideo_GetDestinationPosition returned: %x\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get destination position returned: %x\n", hr);
-    ok(left == 0, "expected 0, got %d\n", left);
-    ok(top == 0, "expected 0, got %d\n", top);
-    ok(width == window_width, "expected %d, got %d\n", window_width, width);
-    ok(height == video_height, "expected %d, got %d\n", video_height, height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 0, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == window_width, "Expected width %ld, got %ld.\n", window_width, width);
+    ok(height == video_height, "Expected height %ld, got %ld.\n", video_height, height);
 
     hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, 0, 0);
-    ok(hr==E_INVALIDARG, "IBasicVideo_SetDestinationPosition returned: %x\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width*2, video_height*2);
-    ok(hr==S_OK, "Cannot put destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationLeft(pbv, -1);
-    ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationLeft(pbv, 0);
-    ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationLeft(pbv, 1);
-    ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(pbv, video_width, 0, video_width, video_height);
-    ok(hr==S_OK, "Cannot set destinaiton position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDestinationPosition(pbv, 0, video_height, video_width, video_height);
-    ok(hr==S_OK, "Cannot set destinaiton position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDestinationPosition(pbv, -1, 0, video_width, video_height);
-    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDestinationPosition(pbv, 0, -1, video_width, video_height);
-    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDestinationPosition(pbv, video_width/2, video_height/2, video_width, video_height);
-    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDestinationPosition(pbv, video_width/2, video_height/2, video_width, video_height);
-    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width, video_height+1);
-    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width+1, video_height);
-    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(pbv, video_width/2, video_height/2, video_width/3+1, video_height/3+1);
-    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_DestinationLeft(pbv, &left);
-    ok(hr==S_OK, "Cannot get destination left returned: %x\n", hr);
-    ok(left==video_width/2, "expected %d, got %d\n", video_width/2, left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == video_width / 2, "Expected left %ld, got %ld.\n", video_width / 2, left);
     hr = IBasicVideo_get_DestinationTop(pbv, &top);
-    ok(hr==S_OK, "Cannot get destination top returned: %x\n", hr);
-    ok(top==video_height/2, "expected %d, got %d\n", video_height/2, top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == video_height / 2, "Expected top %ld, got %ld.\n", video_height / 2, top);
     hr = IBasicVideo_get_DestinationWidth(pbv, &width);
-    ok(hr==S_OK, "Cannot get destination width returned: %x\n", hr);
-    ok(width==video_width/3+1, "expected %d, got %d\n", video_width/3+1, width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == video_width / 3 + 1, "Expected width %ld, got %ld.\n", video_width / 3 + 1, width);
     hr = IBasicVideo_get_DestinationHeight(pbv, &height);
-    ok(hr==S_OK, "Cannot get destination height returned: %x\n", hr);
-    ok(height==video_height/3+1, "expected %d, got %d\n", video_height/3+1, height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == video_height / 3 + 1, "Expected height %ld, got %ld.\n", video_height / 3 + 1, height);
 
     hr = IBasicVideo_put_DestinationLeft(pbv, video_width/3);
-    ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(left == video_width/3, "expected %d, got %d\n", video_width/3, left);
-    ok(width == video_width/3+1, "expected %d, got %d\n", video_width/3+1, width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == video_width / 3, "Expected left %ld, got %ld.\n", video_width / 3, left);
+    ok(width == video_width / 3 + 1, "Expected width %ld, got %ld.\n", video_width / 3 + 1, width);
 
     hr = IBasicVideo_put_DestinationTop(pbv, video_height/3);
-    ok(hr==S_OK, "Cannot put destination top returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(top == video_height/3, "expected %d, got %d\n", video_height/3, top);
-    ok(height == video_height/3+1, "expected %d, got %d\n", video_height/3+1, height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == video_height / 3, "Expected top %ld, got %ld.\n", video_height / 3, top);
+    ok(height == video_height / 3 + 1, "Expected height %ld, got %ld.\n", video_height / 3 + 1, height);
 
     hr = IBasicVideo_put_DestinationWidth(pbv, video_width/4+1);
-    ok(hr==S_OK, "Cannot put destination width returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(left == video_width/3, "expected %d, got %d\n", video_width/3, left);
-    ok(width == video_width/4+1, "expected %d, got %d\n", video_width/4+1, width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == video_width / 3, "Expected left %ld, got %ld.\n", video_width / 3, left);
+    ok(width == video_width / 4 + 1, "Expected width %ld, got %ld.\n", video_width / 4 + 1, width);
 
     hr = IBasicVideo_put_DestinationHeight(pbv, video_height/4+1);
-    ok(hr==S_OK, "Cannot put destination height returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
-    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
-    ok(top == video_height/3, "expected %d, got %d\n", video_height/3, top);
-    ok(height == video_height/4+1, "expected %d, got %d\n", video_height/4+1, height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == video_height / 3, "Expected top %ld, got %ld.\n", video_height / 3, top);
+    ok(height == video_height / 4 + 1, "Expected height %ld, got %ld.\n", video_height / 4 + 1, height);
 
     /* reset source rectangle */
     hr = IBasicVideo_SetDefaultSourcePosition(pbv);
-    ok(hr==S_OK, "IBasicVideo_SetDefaultSourcePosition returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* reset destination position */
     hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width, video_height);
-    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IBasicVideo_Release(pbv);
 }
@@ -344,57 +344,57 @@ static void test_media_seeking(IFilterGraph2 *graph)
 
     IFilterGraph2_SetDefaultSyncSource(graph);
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaSeeking, (void **)&seeking);
-    ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %08x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter);
-    ok(hr == S_OK, "QueryInterface(IMediaFilter) failed: %08x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     format = GUID_NULL;
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "GetTimeFormat failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "got %s\n", wine_dbgstr_guid(&format));
 
     pos = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, NULL, 0x123456789a, NULL);
-    ok(hr == S_OK, "ConvertTimeFormat failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pos == 0x123456789a, "got %s\n", wine_dbgstr_longlong(pos));
 
     pos = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL);
-    ok(hr == S_OK, "ConvertTimeFormat failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pos == 0x123456789a, "got %s\n", wine_dbgstr_longlong(pos));
 
     pos = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &pos, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "ConvertTimeFormat failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pos == 0x123456789a, "got %s\n", wine_dbgstr_longlong(pos));
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &pos);
-    ok(hr == S_OK, "GetCurrentPosition failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pos == 0, "got %s\n", wine_dbgstr_longlong(pos));
 
     hr = IMediaSeeking_GetDuration(seeking, &duration);
-    ok(hr == S_OK, "GetDuration failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(duration > 0, "got %s\n", wine_dbgstr_longlong(duration));
 
     hr = IMediaSeeking_GetStopPosition(seeking, &stop);
-    ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(stop == duration || stop == duration + 1, "expected %s, got %s\n",
         wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
 
     hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_ReturnTime, NULL, AM_SEEKING_NoPositioning);
-    ok(hr == S_OK, "SetPositions failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_SetPositions(seeking, NULL, AM_SEEKING_NoPositioning, NULL, AM_SEEKING_ReturnTime);
-    ok(hr == S_OK, "SetPositions failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pos = 0;
     hr = IMediaSeeking_SetPositions(seeking, &pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
-    ok(hr == S_OK, "SetPositions failed: %08x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaFilter_SetSyncSource(filter, NULL);
     pos = 0xdeadbeef;
     hr = IMediaSeeking_GetCurrentPosition(seeking, &pos);
-    ok(hr == S_OK, "GetCurrentPosition failed: %08x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pos == 0, "Position != 0 (%s)\n", wine_dbgstr_longlong(pos));
     IFilterGraph2_SetDefaultSyncSource(graph);
 
@@ -409,47 +409,47 @@ static void test_state_change(IFilterGraph2 *graph)
     HRESULT hr;
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-    ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "GetState() failed: %x\n", hr);
-    ok(state == State_Stopped, "wrong state %d\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %ld.\n", state);
 
     hr = IMediaControl_Run(control);
-    ok(SUCCEEDED(hr), "Run() failed: %x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, INFINITE, &state);
-    ok(SUCCEEDED(hr), "GetState() failed: %x\n", hr);
-    ok(state == State_Running, "wrong state %d\n", state);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %ld.\n", state);
 
     hr = IMediaControl_Stop(control);
-    ok(SUCCEEDED(hr), "Stop() failed: %x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "GetState() failed: %x\n", hr);
-    ok(state == State_Stopped, "wrong state %d\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %ld.\n", state);
 
     hr = IMediaControl_Pause(control);
-    ok(SUCCEEDED(hr), "Pause() failed: %x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "GetState() failed: %x\n", hr);
-    ok(state == State_Paused, "wrong state %d\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %ld.\n", state);
 
     hr = IMediaControl_Run(control);
-    ok(SUCCEEDED(hr), "Run() failed: %x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "GetState() failed: %x\n", hr);
-    ok(state == State_Running, "wrong state %d\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %ld.\n", state);
 
     hr = IMediaControl_Pause(control);
-    ok(SUCCEEDED(hr), "Pause() failed: %x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "GetState() failed: %x\n", hr);
-    ok(state == State_Paused, "wrong state %d\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %ld.\n", state);
 
     hr = IMediaControl_Stop(control);
-    ok(SUCCEEDED(hr), "Stop() failed: %x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "GetState() failed: %x\n", hr);
-    ok(state == State_Stopped, "wrong state %d\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %ld.\n", state);
 
     IMediaControl_Release(control);
 }
@@ -469,33 +469,33 @@ static void test_media_event(IFilterGraph2 *graph)
     LONG code;
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter);
-    ok(hr == S_OK, "QueryInterface(IMediaFilter) failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-    ok(hr == S_OK, "QueryInterface(IMediaControl) failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&media_event);
-    ok(hr == S_OK, "QueryInterface(IMediaEvent) failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaSeeking, (void **)&seeking);
-    ok(hr == S_OK, "QueryInterface(IMediaEvent) failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(SUCCEEDED(hr), "Stop() failed: %#x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
     ok(hr == S_OK, "GetState() timed out\n");
 
     hr = IMediaSeeking_GetDuration(seeking, &stop);
-    ok(hr == S_OK, "GetDuration() failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     current = 0;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning, &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "SetPositions() failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaFilter_SetSyncSource(filter, NULL);
-    ok(hr == S_OK, "SetSyncSource() failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEventHandle(media_event, (OAEVENT *)&event);
-    ok(hr == S_OK, "GetEventHandle() failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* flush existing events */
     while ((hr = IMediaEvent_GetEvent(media_event, &code, &lparam1, &lparam2, 0)) == S_OK);
@@ -503,7 +503,7 @@ static void test_media_event(IFilterGraph2 *graph)
     ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "event should not be signaled\n");
 
     hr = IMediaControl_Run(control);
-    ok(SUCCEEDED(hr), "Run() failed: %#x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
 
     while (!got_eos)
     {
@@ -522,16 +522,16 @@ static void test_media_event(IFilterGraph2 *graph)
     ok(got_eos, "didn't get EOS\n");
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &current);
-    ok(hr == S_OK, "GetCurrentPosition() failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == stop, "expected %s, got %s\n", wine_dbgstr_longlong(stop), wine_dbgstr_longlong(current));
 
     hr = IMediaControl_Stop(control);
-    ok(SUCCEEDED(hr), "Run() failed: %#x\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
     ok(hr == S_OK, "GetState() timed out\n");
 
     hr = IFilterGraph2_SetDefaultSyncSource(graph);
-    ok(hr == S_OK, "SetDefaultSinkSource() failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaSeeking_Release(seeking);
     IMediaEvent_Release(media_event);
@@ -564,7 +564,7 @@ static HRESULT test_graph_builder_connect_file(WCHAR *filename, BOOL audio, BOOL
                 &IID_IBaseFilter, (void **)&renderer);
     if (hr == VFW_E_NO_AUDIO_HARDWARE)
         return VFW_E_CANNOT_CONNECT;
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     graph = create_graph();
 
@@ -573,13 +573,13 @@ static HRESULT test_graph_builder_connect_file(WCHAR *filename, BOOL audio, BOOL
     IEnumPins_Release(enumpins);
 
     hr = IFilterGraph2_AddSourceFilter(graph, filename, NULL, &source_filter);
-    ok(hr == S_OK, "AddSourceFilter failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_AddFilter(graph, renderer, NULL);
-    ok(hr == S_OK, "AddFilter failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(source_filter, L"Output", &pin_out);
-    ok(hr == S_OK, "FindPin failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Connect(graph, pin_out, pin_in);
 
     if (SUCCEEDED(hr))
@@ -620,32 +620,32 @@ static void test_render_run(const WCHAR *file, BOOL audio, BOOL video)
         skip("%s: codec not supported; skipping test\n", wine_dbgstr_w(file));
 
         refs = IFilterGraph2_Release(graph);
-        ok(!refs, "Graph has %u references\n", refs);
+        ok(!refs, "Got outsanding refcount %ld.\n", refs);
 
         hr = test_graph_builder_connect_file(filename, audio, video);
-        ok(hr == VFW_E_CANNOT_CONNECT, "got %#x\n", hr);
+        ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#lx.\n", hr);
     }
     else
     {
         if (audio)
-            ok(hr == S_OK || hr == VFW_S_AUDIO_NOT_RENDERED, "Got hr %#x.\n", hr);
+            ok(hr == S_OK || hr == VFW_S_AUDIO_NOT_RENDERED, "Got hr %#lx.\n", hr);
         else
-            ok(hr == S_OK, "Got hr %#x.\n", hr);
+            ok(hr == S_OK, "Got hr %#lx.\n", hr);
         rungraph(graph, video);
 
         refs = IFilterGraph2_Release(graph);
-        ok(!refs, "Graph has %u references\n", refs);
+        ok(!refs, "Got outsanding refcount %ld.\n", refs);
 
         hr = test_graph_builder_connect_file(filename, audio, video);
         if (audio && video)
-            todo_wine ok(hr == VFW_S_PARTIAL_RENDER, "Got hr %#x.\n", hr);
+            todo_wine ok(hr == VFW_S_PARTIAL_RENDER, "Got hr %#lx.\n", hr);
         else
-            ok(hr == S_OK, "Got hr %#x.\n", hr);
+            ok(hr == S_OK, "Got hr %#lx.\n", hr);
     }
 
     /* check reference leaks */
     h = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(h != INVALID_HANDLE_VALUE, "CreateFile failed: err=%d\n", GetLastError());
+    ok(h != INVALID_HANDLE_VALUE, "CreateFile failed: err=%ld\n", GetLastError());
     CloseHandle(h);
 
     DeleteFileW(filename);
@@ -665,74 +665,74 @@ static void test_enum_filters(void)
             &IID_IBaseFilter, (void **)&filter2);
 
     hr = IFilterGraph2_EnumFilters(graph, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Next(enum1, 1, filters, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 1);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     IFilterGraph2_AddFilter(graph, filter1, NULL);
     IFilterGraph2_AddFilter(graph, filter2, NULL);
 
     hr = IEnumFilters_Next(enum1, 1, filters, NULL);
-    ok(hr == VFW_E_ENUM_OUT_OF_SYNC, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_ENUM_OUT_OF_SYNC, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 1);
-    ok(hr == VFW_E_ENUM_OUT_OF_SYNC, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_ENUM_OUT_OF_SYNC, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 1);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum1, 1);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Next(enum1, 1, filters, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filters[0] == filter2, "Got filter %p.\n", filters[0]);
     IBaseFilter_Release(filters[0]);
 
     hr = IEnumFilters_Next(enum1, 1, filters, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     ok(filters[0] == filter1, "Got filter %p.\n", filters[0]);
     IBaseFilter_Release(filters[0]);
 
     hr = IEnumFilters_Next(enum1, 1, filters, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 0, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 0, "Got count %lu.\n", count);
 
     hr = IEnumFilters_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Next(enum1, 2, filters, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     ok(filters[0] == filter2, "Got filter %p.\n", filters[0]);
     ok(filters[1] == filter1, "Got filter %p.\n", filters[1]);
     IBaseFilter_Release(filters[0]);
@@ -742,41 +742,41 @@ static void test_enum_filters(void)
     IFilterGraph2_AddFilter(graph, filter1, NULL);
 
     hr = IEnumFilters_Next(enum1, 2, filters, &count);
-    ok(hr == VFW_E_ENUM_OUT_OF_SYNC, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_ENUM_OUT_OF_SYNC, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Next(enum1, 2, filters, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     ok(filters[0] == filter1, "Got filter %p.\n", filters[0]);
     ok(filters[1] == filter2, "Got filter %p.\n", filters[1]);
     IBaseFilter_Release(filters[0]);
     IBaseFilter_Release(filters[1]);
 
     hr = IEnumFilters_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Skip(enum2, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Next(enum2, 2, filters, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     ok(filters[0] == filter2, "Got filter %p.\n", filters[0]);
     IBaseFilter_Release(filters[0]);
 
     hr = IEnumFilters_Skip(enum1, 3);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumFilters_Release(enum2);
     IEnumFilters_Release(enum1);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static DWORD WINAPI call_RenderFile_multithread(LPVOID lParam)
@@ -786,7 +786,7 @@ static DWORD WINAPI call_RenderFile_multithread(LPVOID lParam)
     HRESULT hr;
 
     hr = IFilterGraph2_RenderFile(graph, filename, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     rungraph(graph, TRUE);
 
@@ -1434,7 +1434,7 @@ static HRESULT WINAPI testfilter_Run(IBaseFilter *iface, REFERENCE_TIME start)
 static HRESULT WINAPI testfilter_GetState(IBaseFilter *iface, DWORD timeout, FILTER_STATE *state)
 {
     struct testfilter *filter = impl_from_IBaseFilter(iface);
-    if (winetest_debug > 1) trace("%p->GetState(%u)\n", filter, timeout);
+    if (winetest_debug > 1) trace("%p->GetState(%lu)\n", filter, timeout);
 
     *state = filter->state;
     return filter->GetState_hr;
@@ -1679,7 +1679,7 @@ static HRESULT WINAPI testseek_SetPositions(IMediaSeeking *iface, LONGLONG *curr
     DWORD current_flags, LONGLONG *stop, DWORD stop_flags )
 {
     struct testfilter *filter = impl_from_IMediaSeeking(iface);
-    if (winetest_debug > 1) trace("%p->SetPositions(%s, %#x, %s, %#x)\n",
+    if (winetest_debug > 1) trace("%p->SetPositions(%s, %#lx, %s, %#lx)\n",
             iface, wine_dbgstr_longlong(*current), current_flags, wine_dbgstr_longlong(*stop), stop_flags);
     ok(filter->state != State_Running, "Filter should be paused or stopped while seeking.\n");
     filter->seek_current = *current;
@@ -2093,7 +2093,7 @@ static void test_graph_builder_render(void)
     IFilterGraph2_AddFilter(graph, &sink2.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink2_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
     IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
@@ -2102,7 +2102,7 @@ static void test_graph_builder_render(void)
     IFilterGraph2_AddFilter(graph, &sink1.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink1_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
 
     IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
@@ -2113,7 +2113,7 @@ static void test_graph_builder_render(void)
     IFilterGraph2_AddFilter(graph, &parser.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(parser_pins[1].peer == &sink1_pin.IPin_iface, "Got peer %p.\n", parser_pins[1].peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
@@ -2125,7 +2125,7 @@ static void test_graph_builder_render(void)
     IFilterGraph2_AddFilter(graph, &sink1.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink1_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
     IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
@@ -2138,7 +2138,7 @@ static void test_graph_builder_render(void)
 
     parser_pins[1].name[0] = '~';
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!parser_pins[1].peer, "Got peer %p.\n", parser_pins[1].peer);
     ok(!sink1_pin.peer, "Got peer %p.\n", sink1_pin.peer);
@@ -2148,14 +2148,14 @@ static void test_graph_builder_render(void)
     parser_pins[1].name[0] = 0;
     parser_pins[1].id[0] = '~';
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(parser_pins[1].peer == &sink1_pin.IPin_iface, "Got peer %p.\n", parser_pins[1].peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
     IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* Test enumeration of filters from the registry. */
 
@@ -2183,7 +2183,7 @@ static void test_graph_builder_render(void)
         skip("Not enough permission to register filters.\n");
         goto out;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     graph = create_graph();
     IFilterGraph2_AddFilter(graph, &source.IBaseFilter_iface, NULL);
@@ -2192,12 +2192,12 @@ static void test_graph_builder_render(void)
     IFilterMapper2_RegisterFilter(mapper, &sink2_clsid, L"test", NULL, NULL, NULL, &regfilter);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink2_pin.IPin_iface || source_pin.peer == &sink1_pin.IPin_iface,
             "Got peer %p.\n", source_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* Preference is given to filters already in the graph. */
 
@@ -2206,11 +2206,11 @@ static void test_graph_builder_render(void)
     IFilterGraph2_AddFilter(graph, &sink2.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink2_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* No preference is given to renderer filters. */
 
@@ -2225,12 +2225,12 @@ static void test_graph_builder_render(void)
     IFilterMapper2_RegisterFilter(mapper, &sink2_clsid, L"test", NULL, NULL, NULL, &regfilter);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink2_pin.IPin_iface || source_pin.peer == &sink1_pin.IPin_iface,
             "Got peer %p.\n", source_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* Preference is given to filters with higher merit. */
 
@@ -2246,11 +2246,11 @@ static void test_graph_builder_render(void)
     IFilterMapper2_RegisterFilter(mapper, &sink2_clsid, L"test", NULL, NULL, NULL, &regfilter);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink2_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     graph = create_graph();
     IFilterGraph2_AddFilter(graph, &source.IBaseFilter_iface, NULL);
@@ -2264,11 +2264,11 @@ static void test_graph_builder_render(void)
     IFilterMapper2_RegisterFilter(mapper, &sink2_clsid, L"test", NULL, NULL, NULL, &regfilter);
 
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink1_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* Test AM_RENDEREX_RENDERTOEXISTINGRENDERERS. */
 
@@ -2276,16 +2276,16 @@ static void test_graph_builder_render(void)
     IFilterGraph2_AddFilter(graph, &source.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_RenderEx(graph, &source_pin.IPin_iface, AM_RENDEREX_RENDERTOEXISTINGRENDERERS, NULL);
-    ok(hr == VFW_E_CANNOT_RENDER, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_CANNOT_RENDER, "Got hr %#lx.\n", hr);
 
     IFilterGraph2_AddFilter(graph, &sink1.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_RenderEx(graph, &source_pin.IPin_iface, AM_RENDEREX_RENDERTOEXISTINGRENDERERS, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink1_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &sink1_clsid);
     IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &sink2_clsid);
@@ -2294,15 +2294,15 @@ out:
     CoRevokeClassObject(cookie1);
     CoRevokeClassObject(cookie2);
     IFilterMapper2_Release(mapper);
-    ok(source.ref == 1, "Got outstanding refcount %d.\n", source.ref);
-    ok(source_pin.ref == 1, "Got outstanding refcount %d.\n", source_pin.ref);
-    ok(sink1.ref == 1, "Got outstanding refcount %d.\n", sink1.ref);
-    ok(sink1_pin.ref == 1, "Got outstanding refcount %d.\n", sink1_pin.ref);
-    ok(sink2.ref == 1, "Got outstanding refcount %d.\n", sink2.ref);
-    ok(sink2_pin.ref == 1, "Got outstanding refcount %d.\n", sink2_pin.ref);
-    ok(parser.ref == 1, "Got outstanding refcount %d.\n", parser.ref);
-    ok(parser_pins[0].ref == 1, "Got outstanding refcount %d.\n", parser_pins[0].ref);
-    ok(parser_pins[1].ref == 1, "Got outstanding refcount %d.\n", parser_pins[1].ref);
+    ok(source.ref == 1, "Got outstanding refcount %ld.\n", source.ref);
+    ok(source_pin.ref == 1, "Got outstanding refcount %ld.\n", source_pin.ref);
+    ok(sink1.ref == 1, "Got outstanding refcount %ld.\n", sink1.ref);
+    ok(sink1_pin.ref == 1, "Got outstanding refcount %ld.\n", sink1_pin.ref);
+    ok(sink2.ref == 1, "Got outstanding refcount %ld.\n", sink2.ref);
+    ok(sink2_pin.ref == 1, "Got outstanding refcount %ld.\n", sink2_pin.ref);
+    ok(parser.ref == 1, "Got outstanding refcount %ld.\n", parser.ref);
+    ok(parser_pins[0].ref == 1, "Got outstanding refcount %ld.\n", parser_pins[0].ref);
+    ok(parser_pins[1].ref == 1, "Got outstanding refcount %ld.\n", parser_pins[1].ref);
 }
 
 static void test_graph_builder_connect(void)
@@ -2357,7 +2357,7 @@ static void test_graph_builder_connect(void)
     IFilterGraph2_AddFilter(graph, &sink.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
     IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
@@ -2366,7 +2366,7 @@ static void test_graph_builder_connect(void)
             ++source_pin.Connect_hr)
     {
         hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-        ok(hr == source_pin.Connect_hr, "Got hr %#x for Connect() hr %#x.\n",
+        ok(hr == source_pin.Connect_hr, "Got hr %#lx for Connect() hr %#lx.\n",
                 hr, source_pin.Connect_hr);
         ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
         IFilterGraph2_Disconnect(graph, source_pin.peer);
@@ -2376,7 +2376,7 @@ static void test_graph_builder_connect(void)
 
     sink_pin.accept_mt = &sink_type;
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#lx.\n", hr);
     ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
 
     for (source_pin.Connect_hr = 0x80040200; source_pin.Connect_hr <= 0x800402ff;
@@ -2385,10 +2385,10 @@ static void test_graph_builder_connect(void)
         hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
         if (source_pin.Connect_hr == VFW_E_NOT_CONNECTED
                 || source_pin.Connect_hr == VFW_E_NO_AUDIO_HARDWARE)
-            ok(hr == source_pin.Connect_hr, "Got hr %#x for Connect() hr %#x.\n",
+            ok(hr == source_pin.Connect_hr, "Got hr %#lx for Connect() hr %#lx.\n",
                     hr, source_pin.Connect_hr);
         else
-            ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x for Connect() hr %#x.\n",
+            ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#lx for Connect() hr %#lx.\n",
                     hr, source_pin.Connect_hr);
         ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
         ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
@@ -2399,7 +2399,7 @@ static void test_graph_builder_connect(void)
             ++source_pin.EnumMediaTypes_hr)
     {
         hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-        ok(hr == source_pin.EnumMediaTypes_hr, "Got hr %#x for EnumMediaTypes() hr %#x.\n",
+        ok(hr == source_pin.EnumMediaTypes_hr, "Got hr %#lx for EnumMediaTypes() hr %#lx.\n",
                 hr, source_pin.EnumMediaTypes_hr);
         ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
         ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
@@ -2414,14 +2414,14 @@ static void test_graph_builder_connect(void)
 
     sink_pin.accept_mt = NULL;
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
     IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
 
     sink_pin.accept_mt = &sink_type;
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", sink_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
@@ -2433,7 +2433,7 @@ static void test_graph_builder_connect(void)
             ++source_pin.Connect_hr)
     {
         hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-        ok(hr == S_OK, "Got hr %#x for Connect() hr %#x.\n", hr, source_pin.Connect_hr);
+        ok(hr == S_OK, "Got hr %#lx for Connect() hr %#lx.\n", hr, source_pin.Connect_hr);
         ok(source_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", source_pin.peer);
         ok(sink_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", sink_pin.peer);
         IFilterGraph2_Disconnect(graph, source_pin.peer);
@@ -2447,7 +2447,7 @@ static void test_graph_builder_connect(void)
     IFilterGraph2_AddFilter(graph, &parser1.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
@@ -2459,7 +2459,7 @@ static void test_graph_builder_connect(void)
 
     IFilterGraph2_AddFilter(graph, &parser3.IBaseFilter_iface, NULL);
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser3_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(parser3_pins[1].peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", parser3_pins[1].peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
@@ -2481,7 +2481,7 @@ static void test_graph_builder_connect(void)
     IFilterGraph2_AddFilter(graph, &sink2.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    todo_wine ok(hr == VFW_S_PARTIAL_RENDER, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_PARTIAL_RENDER, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
     ok(!parser1_pins[2].peer, "Got peer %p.\n", parser1_pins[2].peer);
@@ -2495,7 +2495,7 @@ static void test_graph_builder_connect(void)
 
     parser1_pins[1].QueryInternalConnections_hr = S_OK;
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
@@ -2508,12 +2508,12 @@ static void test_graph_builder_connect(void)
 
     parser1_pins[1].name[0] = '~';
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#lx.\n", hr);
     ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
 
     parser1.pin_count = 3;
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[2].IPin_iface, "Got peer %p.\n", sink_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
@@ -2525,7 +2525,7 @@ static void test_graph_builder_connect(void)
     parser1_pins[1].name[0] = 0;
     parser1_pins[1].id[0] = '~';
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
     IFilterGraph2_Disconnect(graph, source_pin.peer);
@@ -2534,15 +2534,15 @@ static void test_graph_builder_connect(void)
     IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
 
     hr = IFilterGraph2_Connect(graph, &parser1_pins[1].IPin_iface, &parser1_pins[0].IPin_iface);
-    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#lx.\n", hr);
 
     parser1_pins[0].QueryInternalConnections_hr = S_OK;
     hr = IFilterGraph2_Connect(graph, &parser1_pins[1].IPin_iface, &parser1_pins[0].IPin_iface);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     parser1_pins[0].QueryInternalConnections_hr = E_NOTIMPL;
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* The graph connects from source to sink, not from sink to source. */
 
@@ -2554,7 +2554,7 @@ static void test_graph_builder_connect(void)
     parser1_pins[0].require_connected_pin = &parser1_pins[1];
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#lx.\n", hr);
     ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
@@ -2562,14 +2562,14 @@ static void test_graph_builder_connect(void)
     parser1_pins[1].require_connected_pin = &parser1_pins[0];
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
 
     parser1_pins[1].require_connected_pin = NULL;
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* Test enumeration of filters from the registry. */
 
@@ -2605,19 +2605,19 @@ static void test_graph_builder_connect(void)
         skip("Not enough permission to register filters.\n");
         goto out;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IFilterMapper2_RegisterFilter(mapper, &parser2_clsid, L"test", NULL, NULL, NULL, &regfilter);
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface
             || source_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface
             || sink_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", sink_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* Preference is given to filters already in the graph. */
 
@@ -2627,12 +2627,12 @@ static void test_graph_builder_connect(void)
     IFilterGraph2_AddFilter(graph, &parser1.IBaseFilter_iface, NULL);
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     /* Preference is given to filters with higher merit. */
 
@@ -2649,12 +2649,12 @@ static void test_graph_builder_connect(void)
     IFilterMapper2_RegisterFilter(mapper, &parser2_clsid, L"test", NULL, NULL, NULL, &regfilter);
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser2_pins[1].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser2_pins[0].IPin_iface, "Got peer %p.\n", sink_pin.peer);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     graph = create_graph();
     IFilterGraph2_AddFilter(graph, &source.IBaseFilter_iface, NULL);
@@ -2669,7 +2669,7 @@ static void test_graph_builder_connect(void)
     IFilterMapper2_RegisterFilter(mapper, &parser2_clsid, L"test", NULL, NULL, NULL, &regfilter);
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &parser1_pins[1].IPin_iface, "Got peer %p.\n", sink_pin.peer);
 
@@ -2681,21 +2681,21 @@ out:
     CoRevokeClassObject(cookie2);
     IFilterMapper2_Release(mapper);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
-    ok(source.ref == 1, "Got outstanding refcount %d.\n", source.ref);
-    ok(source_pin.ref == 1, "Got outstanding refcount %d.\n", source_pin.ref);
-    ok(sink.ref == 1, "Got outstanding refcount %d.\n", sink.ref);
-    ok(sink_pin.ref == 1, "Got outstanding refcount %d.\n", sink_pin.ref);
-    ok(parser1.ref == 1, "Got outstanding refcount %d.\n", parser1.ref);
-    ok(parser1_pins[0].ref == 1, "Got outstanding refcount %d.\n", parser1_pins[0].ref);
-    ok(parser1_pins[1].ref == 1, "Got outstanding refcount %d.\n", parser1_pins[1].ref);
-    ok(parser1_pins[2].ref == 1, "Got outstanding refcount %d.\n", parser1_pins[2].ref);
-    ok(parser2.ref == 1, "Got outstanding refcount %d.\n", parser2.ref);
-    ok(parser2_pins[0].ref == 1, "Got outstanding refcount %d.\n", parser2_pins[0].ref);
-    ok(parser2_pins[1].ref == 1, "Got outstanding refcount %d.\n", parser2_pins[1].ref);
-    ok(parser3.ref == 1, "Got outstanding refcount %d.\n", parser3.ref);
-    ok(parser3_pins[0].ref == 1, "Got outstanding refcount %d.\n", parser3_pins[0].ref);
-    ok(parser3_pins[1].ref == 1, "Got outstanding refcount %d.\n", parser3_pins[1].ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(source.ref == 1, "Got outstanding refcount %ld.\n", source.ref);
+    ok(source_pin.ref == 1, "Got outstanding refcount %ld.\n", source_pin.ref);
+    ok(sink.ref == 1, "Got outstanding refcount %ld.\n", sink.ref);
+    ok(sink_pin.ref == 1, "Got outstanding refcount %ld.\n", sink_pin.ref);
+    ok(parser1.ref == 1, "Got outstanding refcount %ld.\n", parser1.ref);
+    ok(parser1_pins[0].ref == 1, "Got outstanding refcount %ld.\n", parser1_pins[0].ref);
+    ok(parser1_pins[1].ref == 1, "Got outstanding refcount %ld.\n", parser1_pins[1].ref);
+    ok(parser1_pins[2].ref == 1, "Got outstanding refcount %ld.\n", parser1_pins[2].ref);
+    ok(parser2.ref == 1, "Got outstanding refcount %ld.\n", parser2.ref);
+    ok(parser2_pins[0].ref == 1, "Got outstanding refcount %ld.\n", parser2_pins[0].ref);
+    ok(parser2_pins[1].ref == 1, "Got outstanding refcount %ld.\n", parser2_pins[1].ref);
+    ok(parser3.ref == 1, "Got outstanding refcount %ld.\n", parser3.ref);
+    ok(parser3_pins[0].ref == 1, "Got outstanding refcount %ld.\n", parser3_pins[0].ref);
+    ok(parser3_pins[1].ref == 1, "Got outstanding refcount %ld.\n", parser3_pins[1].ref);
 }
 
 static const GUID test_iid = {0x33333333};
@@ -2744,77 +2744,77 @@ static void test_aggregation(void)
     graph = (IFilterGraph2 *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_FilterGraph, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IFilterGraph2, (void **)&graph);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!graph, "Got interface %p.\n", graph);
 
     hr = CoCreateInstance(&CLSID_FilterGraph, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IFilterGraph2, (void **)&graph);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IFilterGraph2, (void **)&graph2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(graph2 == (IFilterGraph2 *)0xdeadbeef, "Got unexpected IFilterGraph2 %p.\n", graph2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IFilterGraph2_QueryInterface(graph, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IFilterGraph2_Release(graph);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     /* Test the aggregated filter mapper. */
 
     graph = create_graph();
 
     ref = get_refcount(graph);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IFilterMapper2, (void **)&mapper);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ref = get_refcount(graph);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(mapper);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IFilterMapper2_QueryInterface(mapper, &IID_IFilterGraph2, (void **)&graph2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(graph2 == graph, "Got unexpected IFilterGraph2 %p.\n", graph2);
     IFilterGraph2_Release(graph2);
 
     IFilterMapper2_Release(mapper);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
 }
 
 /* Test how methods from "control" interfaces (IBasicAudio, IBasicVideo,
@@ -2835,115 +2835,115 @@ static void test_control_delegation(void)
     /* IBasicAudio */
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IBasicAudio, (void **)&audio);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicAudio_GetTypeInfoCount(audio, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(count == 1, "Got count %u.\n", count);
 
     hr = IBasicAudio_put_Volume(audio, -10);
-    ok(hr == E_NOTIMPL, "got %#x\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IBasicAudio_get_Volume(audio, &val);
-    ok(hr == E_NOTIMPL, "got %#x\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IBasicAudio_put_Balance(audio, 10);
-    ok(hr == E_NOTIMPL, "got %#x\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IBasicAudio_get_Balance(audio, &val);
-    ok(hr == E_NOTIMPL, "got %#x\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&renderer);
     if (hr != VFW_E_NO_AUDIO_HARDWARE)
     {
-        ok(hr == S_OK, "got %#x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IFilterGraph2_AddFilter(graph, renderer, NULL);
-        ok(hr == S_OK, "got %#x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IBasicAudio_put_Volume(audio, -10);
-        ok(hr == S_OK, "got %#x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IBasicAudio_get_Volume(audio, &val);
-        ok(hr == S_OK, "got %#x\n", hr);
-        ok(val == -10, "got %d\n", val);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(val == -10, "got %ld\n", val);
         hr = IBasicAudio_put_Balance(audio, 10);
-        ok(hr == S_OK || hr == VFW_E_MONO_AUDIO_HW, "got %#x\n", hr);
+        ok(hr == S_OK || hr == VFW_E_MONO_AUDIO_HW, "Got hr %#lx.\n", hr);
         hr = IBasicAudio_get_Balance(audio, &val);
-        ok(hr == S_OK || hr == VFW_E_MONO_AUDIO_HW, "got %#x\n", hr);
+        ok(hr == S_OK || hr == VFW_E_MONO_AUDIO_HW, "Got hr %#lx.\n", hr);
         if (hr == S_OK)
-            ok(val == 10, "got balance %d\n", val);
+            ok(val == 10, "got balance %ld\n", val);
 
         hr = IBaseFilter_QueryInterface(renderer, &IID_IBasicAudio, (void **)&filter_audio);
-        ok(hr == S_OK, "got %#x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IBasicAudio_get_Volume(filter_audio, &val);
-        ok(hr == S_OK, "got %#x\n", hr);
-        ok(val == -10, "got volume %d\n", val);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(val == -10, "got volume %ld\n", val);
 
         hr = IFilterGraph2_RemoveFilter(graph, renderer);
-        ok(hr == S_OK, "got %#x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         IBaseFilter_Release(renderer);
         IBasicAudio_Release(filter_audio);
     }
 
     hr = IBasicAudio_put_Volume(audio, -10);
-    ok(hr == E_NOTIMPL, "got %#x\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IBasicAudio_get_Volume(audio, &val);
-    ok(hr == E_NOTIMPL, "got %#x\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IBasicAudio_put_Balance(audio, 10);
-    ok(hr == E_NOTIMPL, "got %#x\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IBasicAudio_get_Balance(audio, &val);
-    ok(hr == E_NOTIMPL, "got %#x\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IBasicAudio_Release(audio);
 
     /* IBasicVideo and IVideoWindow */
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IBasicVideo2, (void **)&video);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_QueryInterface(graph, &IID_IVideoWindow, (void **)&window);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Unlike IBasicAudio, these return E_NOINTERFACE. */
     hr = IBasicVideo2_get_BitRate(video, &val);
-    ok(hr == E_NOINTERFACE, "got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo2_GetTypeInfoCount(video, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(count == 1, "Got count %u.\n", count);
 
     hr = IBasicVideo2_GetTypeInfo(video, 0, 0, &typeinfo);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind);
     ok(IsEqualGUID(&typeattr->guid, &IID_IBasicVideo), "Got IID %s.\n", wine_dbgstr_guid(&typeattr->guid));
     ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
     ITypeInfo_Release(typeinfo);
 
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == E_NOINTERFACE, "got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_GetTypeInfoCount(window, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(count == 1, "Got count %u.\n", count);
 
     hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&renderer);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_AddFilter(graph, renderer, NULL);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo2_get_BitRate(video, &val);
-    ok(hr == VFW_E_NOT_CONNECTED, "got %#x\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == VFW_E_NOT_CONNECTED, "got %#x\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_RemoveFilter(graph, renderer);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo2_get_BitRate(video, &val);
-    ok(hr == E_NOINTERFACE, "got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == E_NOINTERFACE, "got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
 
     IBaseFilter_Release(renderer);
     IBasicVideo2_Release(video);
@@ -2958,51 +2958,52 @@ static void test_add_remove_filter(void)
     IFilterGraph2 *graph = create_graph();
     IBaseFilter *ret_filter;
     HRESULT hr;
+    LONG ref;
 
     testfilter_init(&filter, NULL, 0);
 
     hr = IFilterGraph2_FindFilterByName(graph, L"testid", &ret_filter);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     ok(!ret_filter, "Got filter %p.\n", ret_filter);
 
     hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, L"testid");
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter.graph == (IFilterGraph *)graph, "Got graph %p.\n", filter.graph);
     ok(!wcscmp(filter.name, L"testid"), "Got name %s.\n", wine_dbgstr_w(filter.name));
 
     hr = IFilterGraph2_FindFilterByName(graph, L"testid", &ret_filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(ret_filter == &filter.IBaseFilter_iface, "Got filter %p.\n", ret_filter);
     IBaseFilter_Release(ret_filter);
 
     hr = IFilterGraph2_RemoveFilter(graph, &filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!filter.graph, "Got graph %p.\n", filter.graph);
     ok(!filter.name, "Got name %s.\n", wine_dbgstr_w(filter.name));
     ok(!filter.clock, "Got clock %p,\n", filter.clock);
-    ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref);
+    ok(filter.ref == 1, "Got outstanding refcount %ld.\n", filter.ref);
 
     hr = IFilterGraph2_FindFilterByName(graph, L"testid", &ret_filter);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     ok(!ret_filter, "Got filter %p.\n", ret_filter);
 
     hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter.graph == (IFilterGraph *)graph, "Got graph %p.\n", filter.graph);
     ok(!wcscmp(filter.name, L"0001"), "Got name %s.\n", wine_dbgstr_w(filter.name));
 
     hr = IFilterGraph2_FindFilterByName(graph, L"0001", &ret_filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(ret_filter == &filter.IBaseFilter_iface, "Got filter %p.\n", ret_filter);
     IBaseFilter_Release(ret_filter);
 
     /* test releasing the filter graph while filters are still connected */
-    hr = IFilterGraph2_Release(graph);
-    ok(!hr, "Got outstanding refcount %d.\n", hr);
+    ref = IFilterGraph2_Release(graph);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ok(!filter.graph, "Got graph %p.\n", filter.graph);
     ok(!filter.name, "Got name %s.\n", wine_dbgstr_w(filter.name));
     ok(!filter.clock, "Got clock %p.\n", filter.clock);
-    ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref);
+    ok(filter.ref == 1, "Got outstanding refcount %ld.\n", filter.ref);
 }
 
 static HRESULT WINAPI test_connect_direct_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
@@ -3052,6 +3053,7 @@ static void test_connect_direct(void)
     IMediaControl *control;
     AM_MEDIA_TYPE mt;
     HRESULT hr;
+    ULONG ref;
 
     test_connect_direct_init(&source_pin, PINDIR_OUTPUT);
     testfilter_init(&source, &source_pin, 1);
@@ -3065,75 +3067,75 @@ static void test_connect_direct(void)
     testfilter_init(&parser2, parser2_pins, 2);
 
     hr = IFilterGraph2_AddFilter(graph, &source.IBaseFilter_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_AddFilter(graph, &sink.IBaseFilter_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* The filter graph does not prevent connection while it is running; only
      * individual filters do. */
     IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     hr = IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     hr = IFilterGraph2_Connect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     hr = IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     /* Swap the pins when connecting. */
     hr = IFilterGraph2_ConnectDirect(graph, &sink_pin.IPin_iface, &source_pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(sink_pin.peer == &source_pin.IPin_iface, "Got peer %p.\n", sink_pin.peer);
     ok(!sink_pin.mt, "Got mt %p.\n", sink_pin.mt);
     todo_wine ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
 
     hr = IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     hr = IFilterGraph2_Connect(graph, &sink_pin.IPin_iface, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(sink_pin.peer == &source_pin.IPin_iface, "Got peer %p.\n", sink_pin.peer);
     ok(!sink_pin.mt, "Got mt %p.\n", sink_pin.mt);
     todo_wine ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
 
     hr = IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     /* Disconnect() does not disconnect the peer. */
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
@@ -3142,146 +3144,146 @@ static void test_connect_direct(void)
     IPin_AddRef(sink_pin.peer);
 
     hr = IFilterGraph2_Disconnect(graph, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     /* Test specifying the media type. */
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(source_pin.mt == &mt, "Got mt %p.\n", source_pin.mt);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
     hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Test Reconnect[Ex](). */
 
     hr = IFilterGraph2_Reconnect(graph, &source_pin.IPin_iface);
-    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Reconnect(graph, &sink_pin.IPin_iface);
-    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_Reconnect(graph, &source_pin.IPin_iface);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Reconnect(graph, &sink_pin.IPin_iface);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Reconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
     hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     sink_pin.peer = &source_pin.IPin_iface;
     IPin_AddRef(sink_pin.peer);
     hr = IFilterGraph2_Reconnect(graph, &sink_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
     hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, NULL);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ReconnectEx(graph, &sink_pin.IPin_iface, NULL);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!source_pin.mt, "Got mt %p.\n", source_pin.mt);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
     hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ReconnectEx(graph, &source_pin.IPin_iface, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(source_pin.mt == &mt, "Got mt %p.\n", source_pin.mt);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
     hr = IFilterGraph2_Disconnect(graph, &source_pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* ConnectDirect() protects against cyclical connections. */
     hr = IFilterGraph2_AddFilter(graph, &parser1.IBaseFilter_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_AddFilter(graph, &parser2.IBaseFilter_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &parser1_pins[1].IPin_iface, &parser1_pins[0].IPin_iface, NULL);
-    ok(hr == VFW_E_CIRCULAR_GRAPH, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_CIRCULAR_GRAPH, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &parser1_pins[1].IPin_iface, &parser2_pins[0].IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &parser2_pins[1].IPin_iface, &parser1_pins[0].IPin_iface, NULL);
-    todo_wine ok(hr == VFW_E_CIRCULAR_GRAPH, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_CIRCULAR_GRAPH, "Got hr %#lx.\n", hr);
     IFilterGraph2_Disconnect(graph, &parser1_pins[1].IPin_iface);
     IFilterGraph2_Disconnect(graph, &parser2_pins[0].IPin_iface);
 
     parser1_pins[0].QueryInternalConnections_hr = S_OK;
     hr = IFilterGraph2_ConnectDirect(graph, &parser1_pins[1].IPin_iface, &parser1_pins[0].IPin_iface, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!parser1_pins[0].peer, "Got peer %p.\n", parser1_pins[0].peer);
     todo_wine ok(parser1_pins[1].peer == &parser1_pins[0].IPin_iface, "Got peer %p.\n", parser1_pins[1].peer);
     IFilterGraph2_Disconnect(graph, &parser1_pins[0].IPin_iface);
     IFilterGraph2_Disconnect(graph, &parser1_pins[1].IPin_iface);
 
     hr = IFilterGraph2_ConnectDirect(graph, &parser1_pins[1].IPin_iface, &parser2_pins[0].IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &parser2_pins[1].IPin_iface, &parser1_pins[0].IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IFilterGraph2_Disconnect(graph, &parser1_pins[1].IPin_iface);
     IFilterGraph2_Disconnect(graph, &parser2_pins[0].IPin_iface);
 
     hr = IFilterGraph2_RemoveFilter(graph, &parser1.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_RemoveFilter(graph, &parser2.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Both pins are disconnected when a filter is removed. */
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     sink_pin.peer = &source_pin.IPin_iface;
     IPin_AddRef(sink_pin.peer);
     hr = IFilterGraph2_RemoveFilter(graph, &source.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
     /* If the filter cannot be disconnected, then RemoveFilter() fails. */
 
     hr = IFilterGraph2_AddFilter(graph, &source.IBaseFilter_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &source_pin.IPin_iface, &sink_pin.IPin_iface, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     sink_pin.peer = &source_pin.IPin_iface;
     IPin_AddRef(sink_pin.peer);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     source_pin.require_stopped_disconnect = TRUE;
     hr = IFilterGraph2_RemoveFilter(graph, &source.IBaseFilter_iface);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 
@@ -3290,19 +3292,19 @@ static void test_connect_direct(void)
     source_pin.require_stopped_disconnect = FALSE;
     sink_pin.require_stopped_disconnect = TRUE;
     hr = IFilterGraph2_RemoveFilter(graph, &source.IBaseFilter_iface);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
     ok(sink_pin.peer == &source_pin.IPin_iface, "Got peer %p.\n", sink_pin.peer);
 
     /* Filters are stopped, and pins disconnected, when the graph is destroyed. */
 
     IMediaControl_Release(control);
-    hr = IFilterGraph2_Release(graph);
-    ok(!hr, "Got outstanding refcount %d.\n", hr);
-    ok(source.ref == 1, "Got outstanding refcount %d.\n", source.ref);
-    ok(sink.ref == 1, "Got outstanding refcount %d.\n", sink.ref);
-    ok(source_pin.ref == 1, "Got outstanding refcount %d.\n", source_pin.ref);
-    todo_wine ok(sink_pin.ref == 1, "Got outstanding refcount %d.\n", sink_pin.ref);
+    ref = IFilterGraph2_Release(graph);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(source.ref == 1, "Got outstanding refcount %ld.\n", source.ref);
+    ok(sink.ref == 1, "Got outstanding refcount %ld.\n", sink.ref);
+    ok(source_pin.ref == 1, "Got outstanding refcount %ld.\n", source_pin.ref);
+    todo_wine ok(sink_pin.ref == 1, "Got outstanding refcount %ld.\n", sink_pin.ref);
     ok(!source_pin.peer, "Got peer %p.\n", source_pin.peer);
     ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
 }
@@ -3332,30 +3334,30 @@ static void test_sync_source(void)
             &IID_IReferenceClock, (void **)&systemclock);
 
     hr = IMediaFilter_SetSyncSource(filter, systemclock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter1.clock == systemclock, "Got clock %p.\n", filter1.clock);
     ok(filter2.clock == systemclock, "Got clock %p.\n", filter2.clock);
 
     hr = IMediaFilter_GetSyncSource(filter, &clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(clock == systemclock, "Got clock %p.\n", clock);
     IReferenceClock_Release(clock);
 
     hr = IMediaFilter_SetSyncSource(filter, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!filter1.clock, "Got clock %p.\n", filter1.clock);
     ok(!filter2.clock, "Got clock %p.\n", filter2.clock);
 
     hr = IMediaFilter_GetSyncSource(filter, &clock);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(!clock, "Got clock %p.\n", clock);
 
     IReferenceClock_Release(systemclock);
     IMediaFilter_Release(filter);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d\n", ref);
-    ok(filter1.ref == 1, "Got outstanding refcount %d.\n", filter1.ref);
-    ok(filter2.ref == 1, "Got outstanding refcount %d.\n", filter2.ref);
+    ok(!ref, "Got outstanding refcount %ld\n", ref);
+    ok(filter1.ref == 1, "Got outstanding refcount %ld.\n", filter1.ref);
+    ok(filter2.ref == 1, "Got outstanding refcount %ld.\n", filter2.ref);
 }
 
 #define check_filter_state(a, b) check_filter_state_(__LINE__, a, b)
@@ -3371,13 +3373,13 @@ static void check_filter_state_(unsigned int line, IFilterGraph2 *graph, FILTER_
 
     IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&mediafilter);
     hr = IMediaFilter_GetState(mediafilter, 1000, &state);
-    ok_(__FILE__, line)(hr == S_OK, "IMediaFilter_GetState() returned %#x.\n", hr);
+    ok_(__FILE__, line)(hr == S_OK, "IMediaFilter_GetState() returned %#lx.\n", hr);
     ok_(__FILE__, line)(state == expect, "Expected state %u, got %u.\n", expect, state);
     IMediaFilter_Release(mediafilter);
 
     IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
     hr = IMediaControl_GetState(control, 1000, &oastate);
-    ok_(__FILE__, line)(hr == S_OK, "IMediaControl_GetState() returned %#x.\n", hr);
+    ok_(__FILE__, line)(hr == S_OK, "IMediaControl_GetState() returned %#lx.\n", hr);
     ok_(__FILE__, line)(state == expect, "Expected state %u, got %u.\n", expect, state);
     IMediaControl_Release(control);
 
@@ -3385,7 +3387,7 @@ static void check_filter_state_(unsigned int line, IFilterGraph2 *graph, FILTER_
     while (IEnumFilters_Next(filterenum, 1, &filter, NULL) == S_OK)
     {
         hr = IBaseFilter_GetState(filter, 1000, &state);
-        ok_(__FILE__, line)(hr == S_OK, "IBaseFilter_GetState() returned %#x.\n", hr);
+        ok_(__FILE__, line)(hr == S_OK, "IBaseFilter_GetState() returned %#lx.\n", hr);
         ok_(__FILE__, line)(state == expect, "Expected state %u, got %u.\n", expect, state);
         IBaseFilter_Release(filter);
     }
@@ -3429,21 +3431,21 @@ static void test_filter_state(void)
     check_filter_state(graph, State_Stopped);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
 
     /* Pausing sets the default sync source, if it's not already set. */
 
     hr = IMediaFilter_GetSyncSource(filter, &clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!!clock, "Reference clock not set.\n");
     ok(source.clock == clock, "Expected %p, got %p.\n", clock, source.clock);
     ok(sink.clock == clock, "Expected %p, got %p.\n", clock, sink.clock);
 
     hr = IReferenceClock_GetTime(clock, &start_time);
-    ok(SUCCEEDED(hr), "Got hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(source.start_time >= start_time && source.start_time < start_time + 500 * 10000,
@@ -3453,84 +3455,84 @@ static void test_filter_state(void)
         wine_dbgstr_longlong(source.start_time), wine_dbgstr_longlong(sink.start_time));
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
 
     sink.state = State_Stopped;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     sink.state = State_Running;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     sink.state = State_Paused;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
 
     sink.state = State_Stopped;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
 
     sink.state = State_Paused;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
 
     sink.state = State_Running;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     sink.state = State_Running;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     sink.state = State_Paused;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     sink.state = State_Stopped;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
 
     hr = IMediaControl_StopWhenReady(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
 
     hr = IMediaControl_StopWhenReady(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     hr = IMediaControl_StopWhenReady(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     IReferenceClock_Release(clock);
@@ -3553,44 +3555,44 @@ static void test_filter_state(void)
     IPin_Connect(&source_pin.IPin_iface, &sink_pin.IPin_iface, NULL);
 
     hr = IMediaFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
 
     hr = IMediaFilter_GetSyncSource(filter, &clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!!clock, "Reference clock not set.\n");
     ok(source.clock == clock, "Expected %p, got %p.\n", clock, source.clock);
     ok(sink.clock == clock, "Expected %p, got %p.\n", clock, sink.clock);
 
     hr = IMediaFilter_Run(filter, 0xdeadbeef);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
     ok(source.start_time == 0xdeadbeef, "Got time %s.\n", wine_dbgstr_longlong(source.start_time));
     ok(sink.start_time == 0xdeadbeef, "Got time %s.\n", wine_dbgstr_longlong(sink.start_time));
 
     hr = IMediaFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
 
     hr = IMediaFilter_Run(filter, 0xdeadf00d);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
     ok(source.start_time == 0xdeadf00d, "Got time %s.\n", wine_dbgstr_longlong(source.start_time));
     ok(sink.start_time == 0xdeadf00d, "Got time %s.\n", wine_dbgstr_longlong(sink.start_time));
 
     hr = IMediaFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
 
     hr = IMediaFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     source.expect_run_prev = sink.expect_run_prev = State_Stopped;
     hr = IReferenceClock_GetTime(clock, &start_time);
-    ok(SUCCEEDED(hr), "Got hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IMediaFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(source.start_time >= start_time && source.start_time < start_time + 500 * 10000,
@@ -3601,12 +3603,12 @@ static void test_filter_state(void)
 
     Sleep(600);
     hr = IMediaFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
 
     source.expect_run_prev = sink.expect_run_prev = State_Paused;
     hr = IMediaFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(source.start_time >= start_time && source.start_time < start_time + 500 * 10000,
@@ -3616,13 +3618,13 @@ static void test_filter_state(void)
         wine_dbgstr_longlong(source.start_time), wine_dbgstr_longlong(sink.start_time));
 
     hr = IMediaFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
     Sleep(600);
 
     start_time += 550 * 10000;
     hr = IMediaFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(source.start_time >= start_time && source.start_time < start_time + 500 * 10000,
@@ -3632,7 +3634,7 @@ static void test_filter_state(void)
         wine_dbgstr_longlong(source.start_time), wine_dbgstr_longlong(sink.start_time));
 
     hr = IMediaFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     /* Test removing the sync source. */
@@ -3641,7 +3643,7 @@ static void test_filter_state(void)
     IMediaFilter_SetSyncSource(filter, NULL);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
     todo_wine ok(source.start_time > 0 && source.start_time < 500 * 10000,
             "Got time %s.\n", wine_dbgstr_longlong(source.start_time));
@@ -3649,7 +3651,7 @@ static void test_filter_state(void)
         wine_dbgstr_longlong(source.start_time), wine_dbgstr_longlong(sink.start_time));
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     /* Test asynchronous state change. */
@@ -3657,30 +3659,30 @@ static void test_filter_state(void)
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     sink.state_hr = sink.GetState_hr = S_OK;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaControl_Stop(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     sink.state_hr = sink.GetState_hr = S_OK;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     /* Renderers are expected to block completing a state change into paused
      * until they receive a sample. Because the graph can transition from
@@ -3696,11 +3698,11 @@ static void test_filter_state(void)
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
     ok(sink.state == State_Paused, "Got state %u.\n", sink.state);
     ok(source.state == State_Paused, "Got state %u.\n", source.state);
 
@@ -3709,14 +3711,14 @@ static void test_filter_state(void)
     time = 0;
     hr = IMediaSeeking_SetPositions(seeking, &time, AM_SEEKING_AbsolutePositioning,
             NULL, AM_SEEKING_NoPositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
     ok(sink.state == State_Paused, "Got state %u.\n", sink.state);
     ok(source.state == State_Paused, "Got state %u.\n", source.state);
 
@@ -3724,13 +3726,13 @@ static void test_filter_state(void)
 
     while ((hr = IMediaControl_GetState(control, INFINITE, &state)) == VFW_S_STATE_INTERMEDIATE)
     {
-        ok(state == State_Running, "Got state %u.\n", state);
+        ok(state == State_Running, "Got state %lu.\n", state);
         ok(sink.state == State_Paused, "Got state %u.\n", sink.state);
         ok(source.state == State_Paused, "Got state %u.\n", source.state);
         Sleep(10);
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
     ok(sink.state == State_Running, "Got state %u.\n", sink.state);
     ok(source.state == State_Running, "Got state %u.\n", source.state);
 
@@ -3742,21 +3744,21 @@ static void test_filter_state(void)
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaControl_Stop(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(sink.state == State_Stopped, "Got state %u.\n", sink.state);
     ok(source.state == State_Stopped, "Got state %u.\n", source.state);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     sink.state_hr = sink.GetState_hr = S_OK;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
 
     /* Try an asynchronous stopped->paused->running transition, but pause or
      * stop the graph before our filter is completely paused. */
@@ -3764,35 +3766,35 @@ static void test_filter_state(void)
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     sink.state_hr = sink.GetState_hr = S_OK;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
     ok(sink.state == State_Paused, "Got state %u.\n", sink.state);
     ok(source.state == State_Paused, "Got state %u.\n", source.state);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(sink.state == State_Stopped, "Got state %u.\n", sink.state);
     ok(source.state == State_Stopped, "Got state %u.\n", source.state);
 
     sink.state_hr = sink.GetState_hr = S_OK;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Stopped, "Got state %u.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Stopped, "Got state %lu.\n", state);
     ok(sink.state == State_Stopped, "Got state %u.\n", sink.state);
     ok(source.state == State_Stopped, "Got state %u.\n", source.state);
 
@@ -3801,13 +3803,13 @@ static void test_filter_state(void)
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IMediaFilter_Release(filter);
     IMediaControl_Release(control);
     IMediaSeeking_Release(seeking);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     graph = create_graph();
     IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter);
@@ -3823,23 +3825,23 @@ static void test_filter_state(void)
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaFilter_Run(filter, 0);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaFilter_GetState(filter, 0, &mf_state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
     ok(mf_state == State_Running, "Got state %u.\n", mf_state);
     ok(sink.state == State_Running, "Got state %u.\n", sink.state);
     ok(source.state == State_Running, "Got state %u.\n", source.state);
 
     sink.state_hr = sink.GetState_hr = S_OK;
     hr = IMediaFilter_GetState(filter, 0, &mf_state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(mf_state == State_Running, "Got state %u.\n", mf_state);
     ok(sink.state == State_Running, "Got state %u.\n", sink.state);
     ok(source.state == State_Running, "Got state %u.\n", source.state);
 
     hr = IMediaFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(sink.state == State_Stopped, "Got state %u.\n", sink.state);
     ok(source.state == State_Stopped, "Got state %u.\n", source.state);
 
@@ -3849,79 +3851,79 @@ static void test_filter_state(void)
 
     sink.GetState_hr = VFW_S_CANT_CUE;
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == VFW_S_CANT_CUE, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     source.GetState_hr = VFW_S_CANT_CUE;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == VFW_S_CANT_CUE, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     sink.GetState_hr = VFW_S_CANT_CUE;
     source.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %u.\n", state);
+    ok(hr == VFW_S_CANT_CUE, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %lu.\n", state);
 
     sink.GetState_hr = source.GetState_hr = S_OK;
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     sink.state_hr = S_FALSE;
     sink.GetState_hr = VFW_S_STATE_INTERMEDIATE;
     source.GetState_hr = VFW_S_CANT_CUE;
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(sink.state == State_Running, "Got state %u.\n", sink.state);
     ok(source.state == State_Running, "Got state %u.\n", source.state);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
-    ok(state == State_Running, "Got state %u.\n", state);
+    ok(hr == VFW_S_CANT_CUE, "Got hr %#lx.\n", hr);
+    ok(state == State_Running, "Got state %lu.\n", state);
     ok(sink.state == State_Running, "Got state %u.\n", sink.state);
     ok(source.state == State_Running, "Got state %u.\n", source.state);
 
     sink.state_hr = sink.GetState_hr = source.GetState_hr = S_OK;
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Add and remove a filter while the graph is running. */
 
     hr = IFilterGraph2_AddFilter(graph, &dummy.IBaseFilter_iface, L"dummy");
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dummy.state == State_Stopped, "Got state %#x.\n", dummy.state);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Paused);
     ok(dummy.state == State_Paused, "Got state %#x.\n", dummy.state);
 
     hr = IFilterGraph2_RemoveFilter(graph, &dummy.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dummy.state == State_Paused, "Got state %#x.\n", dummy.state);
 
     hr = IFilterGraph2_AddFilter(graph, &dummy.IBaseFilter_iface, L"dummy");
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dummy.state == State_Paused, "Got state %#x.\n", dummy.state);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Stopped);
 
     hr = IFilterGraph2_RemoveFilter(graph, &dummy.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dummy.state == State_Stopped, "Got state %#x.\n", dummy.state);
 
     /* Destroying the graph while it's running stops all filters. */
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_filter_state(graph, State_Running);
 
     source.expect_stop_prev = sink.expect_stop_prev = State_Running;
@@ -3929,11 +3931,11 @@ static void test_filter_state(void)
     IMediaControl_Release(control);
     IMediaSeeking_Release(seeking);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
-    ok(source.ref == 1, "Got outstanding refcount %d.\n", source.ref);
-    ok(sink.ref == 1, "Got outstanding refcount %d.\n", sink.ref);
-    ok(source_pin.ref == 1, "Got outstanding refcount %d.\n", source_pin.ref);
-    ok(sink_pin.ref == 1, "Got outstanding refcount %d.\n", sink_pin.ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(source.ref == 1, "Got outstanding refcount %ld.\n", source.ref);
+    ok(sink.ref == 1, "Got outstanding refcount %ld.\n", sink.ref);
+    ok(source_pin.ref == 1, "Got outstanding refcount %ld.\n", source_pin.ref);
+    ok(sink_pin.ref == 1, "Got outstanding refcount %ld.\n", sink_pin.ref);
     ok(source.state == State_Stopped, "Got state %u.\n", source.state);
     ok(sink.state == State_Stopped, "Got state %u.\n", sink.state);
 }
@@ -3956,22 +3958,22 @@ static HRESULT check_ec_complete(IFilterGraph2 *graph, IBaseFilter *filter)
     IMediaControl_Run(control);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 0);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret_hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 0);
     if (ret_hr == S_OK)
     {
-        ok(code == EC_COMPLETE, "Got code %#x.\n", code);
-        ok(param1 == S_OK, "Got param1 %#lx.\n", param1);
-        ok(!param2, "Got param2 %#lx.\n", param2);
+        ok(code == EC_COMPLETE, "Got code %#lx.\n", code);
+        ok(param1 == S_OK, "Got param1 %#Ix.\n", param1);
+        ok(!param2, "Got param2 %#Ix.\n", param2);
         hr = IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 0);
-        ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+        ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
     }
 
     IMediaControl_Stop(control);
@@ -3992,8 +3994,8 @@ static void test_ec_complete(void)
     LONG_PTR param1, param2;
     IMediaControl *control;
     IMediaEvent *eventsrc;
+    LONG code, ref;
     HRESULT hr;
-    LONG code;
 
     testsink_init(&filter1_pin);
     testsink_init(&filter2_pin);
@@ -4026,33 +4028,33 @@ static void test_ec_complete(void)
         ok(code != EC_COMPLETE, "Got unexpected EC_COMPLETE.\n");
         IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
     }
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter1.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter2.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(code == EC_COMPLETE, "Got code %#x.\n", code);
-    ok(param1 == S_OK, "Got param1 %#lx.\n", param1);
-    ok(!param2, "Got param2 %#lx.\n", param2);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(code == EC_COMPLETE, "Got code %#lx.\n", code);
+    ok(param1 == S_OK, "Got param1 %#Ix.\n", param1);
+    ok(!param2, "Got param2 %#Ix.\n", param2);
     hr = IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter3.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     IMediaControl_Stop(control);
 
@@ -4061,42 +4063,42 @@ static void test_ec_complete(void)
     IMediaControl_Run(control);
 
     hr = IMediaEvent_CancelDefaultHandling(eventsrc, EC_COMPLETE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter1.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(code == EC_COMPLETE, "Got code %#x.\n", code);
-    ok(param1 == S_OK, "Got param1 %#lx.\n", param1);
-    ok(param2 == (LONG_PTR)&filter1.IBaseFilter_iface, "Got param2 %#lx.\n", param2);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(code == EC_COMPLETE, "Got code %#lx.\n", code);
+    ok(param1 == S_OK, "Got param1 %#Ix.\n", param1);
+    ok(param2 == (LONG_PTR)&filter1.IBaseFilter_iface, "Got param2 %#Ix.\n", param2);
     hr = IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter3.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(code == EC_COMPLETE, "Got code %#x.\n", code);
-    ok(param1 == S_OK, "Got param1 %#lx.\n", param1);
-    ok(param2 == (LONG_PTR)&filter3.IBaseFilter_iface, "Got param2 %#lx.\n", param2);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(code == EC_COMPLETE, "Got code %#lx.\n", code);
+    ok(param1 == S_OK, "Got param1 %#Ix.\n", param1);
+    ok(param2 == (LONG_PTR)&filter3.IBaseFilter_iface, "Got param2 %#Ix.\n", param2);
     hr = IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     IMediaControl_Stop(control);
     hr = IMediaEvent_RestoreDefaultHandling(eventsrc, EC_COMPLETE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* A filter counts as a renderer if it (1) exposes IAMFilterMiscFlags and
      * reports itself as a renderer, or (2) exposes IMediaSeeking or
@@ -4110,7 +4112,7 @@ static void test_ec_complete(void)
     IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL);
 
     hr = check_ec_complete(graph, &filter1.IBaseFilter_iface);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface);
     filter1_pin.dir = PINDIR_INPUT;
@@ -4119,37 +4121,37 @@ static void test_ec_complete(void)
     IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL);
 
     hr = check_ec_complete(graph, &filter1.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
-    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
+    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
     IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface);
-    ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
+    ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
 
     filter1_pin.dir = PINDIR_OUTPUT;
     IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL);
 
     hr = check_ec_complete(graph, &filter1.IBaseFilter_iface);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
-    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
+    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
     IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface);
-    ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
+    ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
 
     filter1_pin.dir = PINDIR_INPUT;
     filter1.support_media_time = FALSE;
     IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL);
 
     hr = check_ec_complete(graph, &filter1.IBaseFilter_iface);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
-    ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
+    ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
     IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface);
 
     filter1.IMediaPosition_iface.lpVtbl = &testpos_vtbl;
     IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL);
 
     hr = check_ec_complete(graph, &filter1.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface);
 
@@ -4161,7 +4163,7 @@ static void test_ec_complete(void)
     IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL);
 
     hr = check_ec_complete(graph, &filter1.IBaseFilter_iface);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface);
 
@@ -4169,16 +4171,16 @@ static void test_ec_complete(void)
     IFilterGraph2_AddFilter(graph, &filter1.IBaseFilter_iface, NULL);
 
     hr = check_ec_complete(graph, &filter1.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaControl_Release(control);
     IMediaEvent_Release(eventsrc);
     IMediaEventSink_Release(eventsink);
-    hr = IFilterGraph2_Release(graph);
-    ok(!hr, "Got outstanding refcount %d.\n", hr);
-    ok(filter1.ref == 1, "Got outstanding refcount %d.\n", filter1.ref);
-    ok(filter2.ref == 1, "Got outstanding refcount %d.\n", filter2.ref);
-    ok(filter3.ref == 1, "Got outstanding refcount %d.\n", filter3.ref);
+    ref = IFilterGraph2_Release(graph);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(filter1.ref == 1, "Got outstanding refcount %ld.\n", filter1.ref);
+    ok(filter2.ref == 1, "Got outstanding refcount %ld.\n", filter2.ref);
+    ok(filter3.ref == 1, "Got outstanding refcount %ld.\n", filter3.ref);
 }
 
 static void test_renderfile_failure(void)
@@ -4200,28 +4202,28 @@ static void test_renderfile_failure(void)
     graph = create_graph();
     testfilter_init(&testfilter, NULL, 0);
     hr = IFilterGraph2_AddFilter(graph, &testfilter.IBaseFilter_iface, L"dummy");
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     filename = create_file(L"test.nonsense", bogus_data, sizeof(bogus_data));
     hr = IFilterGraph2_RenderFile(graph, filename, NULL);
-    todo_wine ok(hr == VFW_E_UNSUPPORTED_STREAM, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_UNSUPPORTED_STREAM, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_EnumFilters(graph, &filterenum);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumFilters_Next(filterenum, 1, &filter, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter == &testfilter.IBaseFilter_iface, "Got unexpected filter %p.\n", filter);
 
     hr = IEnumFilters_Next(filterenum, 1, &filter, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumFilters_Release(filterenum);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete %s, error %u.\n", debugstr_w(filename), GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", debugstr_w(filename), GetLastError());
 }
 
 /* Remove and re-add the filter, to flush the graph's internal
@@ -4282,156 +4284,156 @@ static void test_graph_seeking(void)
     IFilterGraph2_QueryInterface(graph, &IID_IMediaEventSink, (void **)&eventsink);
 
     hr = IMediaSeeking_GetCapabilities(seeking, &caps);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(!caps, "Got caps %#x.\n", caps);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(!caps, "Got caps %#lx.\n", caps);
 
     caps = 0;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(!caps, "Got caps %#x.\n", caps);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(!caps, "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanSeekAbsolute;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    todo_wine ok(!caps, "Got caps %#x.\n", caps);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    todo_wine ok(!caps, "Got caps %#lx.\n", caps);
 
     hr = IMediaSeeking_IsFormatSupported(seeking, NULL);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < ARRAY_SIZE(all_formats); ++i)
     {
         hr = IMediaSeeking_IsFormatSupported(seeking, all_formats[i]);
-        todo_wine ok(hr == E_NOTIMPL, "Got hr %#x for format %s.\n", hr, wine_dbgstr_guid(all_formats[i]));
+        todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx for format %s.\n", hr, wine_dbgstr_guid(all_formats[i]));
     }
 
     hr = IMediaSeeking_QueryPreferredFormat(seeking, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_GetTimeFormat(seeking, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_NONE);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_NONE);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_NONE);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < ARRAY_SIZE(unsupported_formats); ++i)
     {
         hr = IMediaSeeking_SetTimeFormat(seeking, unsupported_formats[i]);
-        todo_wine ok(hr == E_NOTIMPL, "Got hr %#x for format %s.\n", hr, wine_dbgstr_guid(unsupported_formats[i]));
+        todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx for format %s.\n", hr, wine_dbgstr_guid(unsupported_formats[i]));
     }
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_NONE, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_NONE, 0x123456789a, NULL);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, &TIME_FORMAT_NONE);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_NONE);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_NONE, 0x123456789a, &TIME_FORMAT_NONE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &testguid, 0x123456789a, &testguid);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaSeeking_GetDuration(seeking, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_GetDuration(seeking, &time);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetStopPosition(seeking, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_GetStopPosition(seeking, &time);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetPositions(seeking, &current, 0, &stop, 0);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetPositions(seeking, NULL, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_GetPositions(seeking, NULL, &stop);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     current = 0xdeadbeef;
     hr = IMediaSeeking_GetCurrentPosition(seeking, &current);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaSeeking_GetAvailable(seeking, &earliest, &latest);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetRate(seeking, 1.0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_SetRate(seeking, 2.0);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetRate(seeking, &rate);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(rate == 1.0, "Got rate %.16e.\n", rate);
 
     hr = IMediaSeeking_GetPreroll(seeking, &time);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     /* Try with filters added. Note that a filter need only expose
      * IMediaSeeking—no other heuristics are used to determine if it is a
@@ -4443,10 +4445,10 @@ static void test_graph_seeking(void)
     filter1.support_testguid = TRUE;
 
     hr = IMediaSeeking_GetDuration(seeking, &time);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &testguid);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IFilterGraph2_RemoveFilter(graph, &filter1.IBaseFilter_iface);
     filter1.support_media_time = TRUE;
@@ -4460,91 +4462,91 @@ static void test_graph_seeking(void)
     filter1.seek_caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetCurrentPos;
     filter2.seek_caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetDuration;
     hr = IMediaSeeking_GetCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps);
-    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
-    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter2.seeking_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#lx.\n", caps);
+    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
+    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter2.seeking_ref);
 
     flush_cached_seeking(graph, &filter1);
     flush_cached_seeking(graph, &filter2);
 
     caps = AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetCurrentPos;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanDoSegments;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanGetCurrentPos;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(!caps, "Got caps %#x.\n", caps);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(!caps, "Got caps %#lx.\n", caps);
 
     flush_cached_seeking(graph, &filter1);
     flush_cached_seeking(graph, &filter2);
 
     hr = IMediaSeeking_IsFormatSupported(seeking, &testguid);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     filter1.support_testguid = TRUE;
     hr = IMediaSeeking_IsFormatSupported(seeking, &testguid);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     filter1.support_testguid = FALSE;
     filter2.support_testguid = TRUE;
     hr = IMediaSeeking_IsFormatSupported(seeking, &testguid);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Filters are not consulted about preferred formats. */
     hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     filter2.support_testguid = FALSE;
     hr = IMediaSeeking_SetTimeFormat(seeking, &testguid);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     filter1.support_testguid = TRUE;
     hr = IMediaSeeking_SetTimeFormat(seeking, &testguid);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(IsEqualGUID(&filter1.time_format, &testguid), "Got format %s.\n",
             debugstr_guid(&filter1.time_format));
     ok(IsEqualGUID(&filter2.time_format, &TIME_FORMAT_MEDIA_TIME),
             "Got format %s.\n", debugstr_guid(&filter2.time_format));
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(IsEqualGUID(&format, &testguid), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &testguid);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps);
-    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
-    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter2.seeking_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#lx.\n", caps);
+    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
+    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter2.seeking_ref);
 
     filter2.support_testguid = TRUE;
     hr = IMediaSeeking_SetTimeFormat(seeking, &testguid);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&filter1.time_format, &TIME_FORMAT_MEDIA_TIME),
             "Got format %s.\n", debugstr_guid(&filter1.time_format));
     todo_wine ok(IsEqualGUID(&filter2.time_format, &testguid),
@@ -4554,43 +4556,43 @@ static void test_graph_seeking(void)
     flush_cached_seeking(graph, &filter1);
 
     hr = IMediaSeeking_GetCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(caps == (AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetDuration), "Got caps %#x.\n", caps);
-    ok(!filter1.seeking_ref, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
-    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter2.seeking_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(caps == (AM_SEEKING_CanDoSegments | AM_SEEKING_CanGetDuration), "Got caps %#lx.\n", caps);
+    ok(!filter1.seeking_ref, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
+    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter2.seeking_ref);
 
     filter1.support_media_time = TRUE;
     filter1.support_testguid = FALSE;
     flush_cached_seeking(graph, &filter1);
 
     hr = IMediaSeeking_GetCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#x.\n", caps);
-    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
-    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter2.seeking_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(caps == AM_SEEKING_CanDoSegments, "Got caps %#lx.\n", caps);
+    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
+    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter2.seeking_ref);
 
     ok(IsEqualGUID(&filter1.time_format, &TIME_FORMAT_MEDIA_TIME),
             "Got format %s.\n", debugstr_guid(&filter1.time_format));
     todo_wine ok(IsEqualGUID(&filter2.time_format, &testguid),
             "Got format %s.\n", debugstr_guid(&filter2.time_format));
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(IsEqualGUID(&format, &testguid), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_NONE);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &testguid, 0x123456789a, &testguid);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &testguid, 0x123456789a, &TIME_FORMAT_NONE);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     flush_cached_seeking(graph, &filter1);
     flush_cached_seeking(graph, &filter2);
@@ -4598,33 +4600,33 @@ static void test_graph_seeking(void)
     filter1.seek_duration = 0x12345;
     filter2.seek_duration = 0x23456;
     hr = IMediaSeeking_GetDuration(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     filter2.seek_duration = 0x12345;
     filter1.seek_duration = 0x23456;
     hr = IMediaSeeking_GetDuration(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     filter1.seek_hr = filter2.seek_hr = 0xbeef;
     hr = IMediaSeeking_GetDuration(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x23456, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     filter1.seek_hr = E_NOTIMPL;
     filter2.seek_hr = S_OK;
     hr = IMediaSeeking_GetDuration(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x12345, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     filter1.seek_hr = 0xdeadbeef;
     hr = IMediaSeeking_GetDuration(seeking, &time);
-    ok(hr == 0xdeadbeef, "Got hr %#x.\n", hr);
+    ok(hr == 0xdeadbeef, "Got hr %#lx.\n", hr);
 
     filter1.seek_hr = filter2.seek_hr = E_NOTIMPL;
     hr = IMediaSeeking_GetDuration(seeking, &time);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     filter1.seek_hr = filter2.seek_hr = S_OK;
 
     flush_cached_seeking(graph, &filter1);
@@ -4633,40 +4635,40 @@ static void test_graph_seeking(void)
     filter1.seek_stop = 0x54321;
     filter2.seek_stop = 0x65432;
     hr = IMediaSeeking_GetStopPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     filter2.seek_stop = 0x54321;
     filter1.seek_stop = 0x65432;
     hr = IMediaSeeking_GetStopPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     filter1.seek_hr = filter2.seek_hr = 0xbeef;
     hr = IMediaSeeking_GetStopPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     filter1.seek_hr = E_NOTIMPL;
     filter2.seek_hr = S_OK;
     hr = IMediaSeeking_GetStopPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x54321, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     filter1.seek_hr = 0xdeadbeef;
     hr = IMediaSeeking_GetStopPosition(seeking, &time);
-    ok(hr == 0xdeadbeef, "Got hr %#x.\n", hr);
+    ok(hr == 0xdeadbeef, "Got hr %#lx.\n", hr);
 
     filter1.seek_hr = filter2.seek_hr = E_NOTIMPL;
     hr = IMediaSeeking_GetStopPosition(seeking, &time);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     filter1.seek_hr = filter2.seek_hr = S_OK;
 
     flush_cached_seeking(graph, &filter1);
     flush_cached_seeking(graph, &filter2);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!time, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     flush_cached_seeking(graph, &filter1);
@@ -4674,7 +4676,7 @@ static void test_graph_seeking(void)
 
     current = stop = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 0x65432, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
@@ -4685,7 +4687,7 @@ static void test_graph_seeking(void)
     stop = 0x321;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop));
     ok(filter1.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current));
@@ -4696,32 +4698,32 @@ static void test_graph_seeking(void)
     filter1.seek_hr = filter2.seek_hr = 0xbeef;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     filter1.seek_hr = E_NOTIMPL;
     filter2.seek_hr = S_OK;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     filter1.seek_hr = 0xdeadbeef;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == 0xdeadbeef, "Got hr %#x.\n", hr);
+    ok(hr == 0xdeadbeef, "Got hr %#lx.\n", hr);
 
     filter1.seek_hr = filter2.seek_hr = E_NOTIMPL;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     filter1.seek_hr = filter2.seek_hr = S_OK;
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 12340000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     current = stop = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 12340000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
@@ -4729,7 +4731,7 @@ static void test_graph_seeking(void)
     stop = 0x321;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 12340000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop));
     ok(filter1.seek_current == 12340000, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current));
@@ -4741,7 +4743,7 @@ static void test_graph_seeking(void)
     stop = 0x321;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 43210000, "Got time %s.\n", wine_dbgstr_longlong(stop));
     ok(filter1.seek_current == 0x123, "Got time %s.\n", wine_dbgstr_longlong(filter1.seek_current));
@@ -4753,17 +4755,17 @@ static void test_graph_seeking(void)
     flush_cached_seeking(graph, &filter2);
 
     hr = IMediaSeeking_SetRate(seeking, 2.0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(filter1.seek_rate == 2.0, "Got rate %.16e.\n", filter1.seek_rate);
     todo_wine ok(filter2.seek_rate == 2.0, "Got rate %.16e.\n", filter2.seek_rate);
 
     hr = IMediaSeeking_SetRate(seeking, 1.0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(filter1.seek_rate == 1.0, "Got rate %.16e.\n", filter1.seek_rate);
     todo_wine ok(filter2.seek_rate == 1.0, "Got rate %.16e.\n", filter2.seek_rate);
 
     hr = IMediaSeeking_SetRate(seeking, -1.0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(filter1.seek_rate == -1.0, "Got rate %.16e.\n", filter1.seek_rate);
     todo_wine ok(filter2.seek_rate == -1.0, "Got rate %.16e.\n", filter2.seek_rate);
 
@@ -4771,34 +4773,34 @@ static void test_graph_seeking(void)
     flush_cached_seeking(graph, &filter2);
 
     hr = IMediaSeeking_GetRate(seeking, &rate);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(rate == -1.0, "Got rate %.16e.\n", rate);
 
     hr = IMediaSeeking_SetRate(seeking, 1.0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Test how retrieving the current position behaves while the graph is
      * running. Apparently the graph caches the last position returned by
      * SetPositions() and then adds the clock offset to the stream start. */
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Note that if the graph is running, it is paused while seeking. */
     current = 0;
     stop = 9000 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(compare_time(time, 1234 * 10000, 40 * 10000),
                 "Expected about 1234ms, got %s.\n", wine_dbgstr_longlong(time));
     current = stop = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(compare_time(current, 1234 * 10000, 40 * 10000),
                 "Expected about 1234ms, got %s.\n", wine_dbgstr_longlong(current));
@@ -4810,144 +4812,144 @@ static void test_graph_seeking(void)
     hr = IMediaSeeking_SetPositions(seeking, &current,
             AM_SEEKING_AbsolutePositioning | AM_SEEKING_NoFlush,
             &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_NoFlush);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     Sleep(100);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(compare_time(time, 1334 * 10000, 80 * 10000),
                 "Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(time));
     current = stop = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(compare_time(current, 1334 * 10000, 80 * 10000),
                 "Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 8000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     Sleep(100);
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(compare_time(time, 1334 * 10000, 80 * 10000),
                 "Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(time));
     current = stop = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_interactive) /* Timing problems make this test too liable to fail. */
         ok(compare_time(current, 1334 * 10000, 80 * 10000),
                 "Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 8000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 12340000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaFilter_SetSyncSource(filter, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     Sleep(100);
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!time, "Got time %s.\n", wine_dbgstr_longlong(time));
     current = stop = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(!stop, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* GetCurrentPositions() will return the stop position once all renderers
      * report EC_COMPLETE. Atelier Sophie depends on this behaviour. */
 
     hr = IFilterGraph2_SetDefaultSyncSource(graph);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     filter1.seek_stop = 5000 * 10000;
     filter2.seek_stop = 6000 * 10000;
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time < 5000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter1.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time < 5000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter2.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 6000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     filter1.seek_hr = filter2.seek_hr = E_NOTIMPL;
     filter1.seek_stop = filter2.seek_stop = 0xdeadbeef;
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time < 5000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter1.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(eventsink, EC_COMPLETE, S_OK, (LONG_PTR)&filter2.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 6000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_NONE);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaFilter_Release(filter);
     IMediaControl_Release(control);
     IMediaSeeking_Release(seeking);
     IMediaEventSink_Release(eventsink);
 
-    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
-    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %d.\n", filter2.seeking_ref);
+    ok(filter1.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
+    ok(filter2.seeking_ref > 0, "Unexpected seeking refcount %ld.\n", filter2.seeking_ref);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", hr);
-    ok(filter1.ref == 1, "Got outstanding refcount %d.\n", filter1.ref);
-    ok(filter2.ref == 1, "Got outstanding refcount %d.\n", filter2.ref);
-    ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %d.\n", filter1.seeking_ref);
-    ok(filter2.seeking_ref == 0, "Unexpected seeking refcount %d.\n", filter2.seeking_ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(filter1.ref == 1, "Got outstanding refcount %ld.\n", filter1.ref);
+    ok(filter2.ref == 1, "Got outstanding refcount %ld.\n", filter2.ref);
+    ok(filter1.seeking_ref == 0, "Unexpected seeking refcount %ld.\n", filter1.seeking_ref);
+    ok(filter2.seeking_ref == 0, "Unexpected seeking refcount %ld.\n", filter2.seeking_ref);
 }
 
 static void test_default_sync_source(void)
@@ -4976,20 +4978,20 @@ static void test_default_sync_source(void)
     IFilterGraph2_QueryInterface(graph, &IID_IMediaFilter, (void **)&filter);
 
     hr = IFilterGraph2_SetDefaultSyncSource(graph);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaFilter_GetSyncSource(filter, &clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!!clock, "Reference clock not set.\n");
     IReferenceClock_Release(clock);
 
     source.IReferenceClock_iface.lpVtbl = &testclock_vtbl;
 
     hr = IFilterGraph2_SetDefaultSyncSource(graph);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaFilter_GetSyncSource(filter, &clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(clock == &source.IReferenceClock_iface, "Got unexpected clock.\n");
     IReferenceClock_Release(clock);
 
@@ -4999,29 +5001,29 @@ static void test_default_sync_source(void)
     sink2.IReferenceClock_iface.lpVtbl = &testclock_vtbl;
 
     hr = IFilterGraph2_SetDefaultSyncSource(graph);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaFilter_GetSyncSource(filter, &clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(clock == &sink2.IReferenceClock_iface, "Got unexpected clock.\n");
     IReferenceClock_Release(clock);
 
     sink1.IReferenceClock_iface.lpVtbl = &testclock_vtbl;
 
     hr = IFilterGraph2_SetDefaultSyncSource(graph);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaFilter_GetSyncSource(filter, &clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(clock == &sink1.IReferenceClock_iface, "Got unexpected clock.\n");
     IReferenceClock_Release(clock);
 
     IMediaFilter_Release(filter);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
-    ok(sink1.ref == 1, "Got outstanding refcount %d.\n", sink1.ref);
-    ok(sink2.ref == 1, "Got outstanding refcount %d.\n", sink2.ref);
-    ok(source.ref == 1, "Got outstanding refcount %d.\n", source.ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(sink1.ref == 1, "Got outstanding refcount %ld.\n", sink1.ref);
+    ok(sink2.ref == 1, "Got outstanding refcount %ld.\n", sink2.ref);
+    ok(source.ref == 1, "Got outstanding refcount %ld.\n", source.ref);
 }
 
 static void test_add_source_filter(void)
@@ -5046,20 +5048,20 @@ static void test_add_source_filter(void)
 
     filename = create_file(L"test.mp3", midi_data, sizeof(midi_data));
     hr = IFilterGraph2_AddSourceFilter(graph, filename, L"test", &filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetClassID(filter, &clsid);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&clsid, &CLSID_AsyncReader), "Got filter %s.\n", wine_dbgstr_guid(&clsid));
     hr = IBaseFilter_QueryFilterInfo(filter, &filter_info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(filter_info.achName, L"test"), "Got unexpected name %s.\n", wine_dbgstr_w(filter_info.achName));
     IFilterGraph_Release(filter_info.pGraph);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFileSourceFilter_GetCurFile(filesource, &ret_filename, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(ret_filename, filename), "Expected filename %s, got %s.\n",
             wine_dbgstr_w(filename), wine_dbgstr_w(ret_filename));
     ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Stream), "Got major type %s.\n", wine_dbgstr_guid(&mt.majortype));
@@ -5067,38 +5069,38 @@ static void test_add_source_filter(void)
     IFileSourceFilter_Release(filesource);
 
     hr = IFilterGraph2_AddSourceFilter(graph, filename, L"test", &filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 != filter, "Filters shouldn't match.\n");
     hr = IFilterGraph2_RemoveFilter(graph, filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = IBaseFilter_Release(filter2);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     hr = IFilterGraph2_RemoveFilter(graph, filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete %s, error %u.\n", wine_dbgstr_w(filename), GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", wine_dbgstr_w(filename), GetLastError());
 
     /* Test a file which should be registered by signature. */
 
     filename = create_file(L"test.avi", midi_data, sizeof(midi_data));
     hr = IFilterGraph2_AddSourceFilter(graph, filename, NULL, &filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetClassID(filter, &clsid);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&clsid, &CLSID_AsyncReader), "Got filter %s.\n", wine_dbgstr_guid(&clsid));
     hr = IBaseFilter_QueryFilterInfo(filter, &filter_info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(!wcscmp(filter_info.achName, filename), "Got unexpected name %s.\n", wine_dbgstr_w(filter_info.achName));
     IFilterGraph_Release(filter_info.pGraph);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFileSourceFilter_GetCurFile(filesource, &ret_filename, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(ret_filename, filename), "Expected filename %s, got %s.\n",
             wine_dbgstr_w(filename), wine_dbgstr_w(ret_filename));
     ok(IsEqualGUID(&mt.majortype, &MEDIATYPE_Stream), "Got major type %s.\n", wine_dbgstr_guid(&mt.majortype));
@@ -5106,11 +5108,11 @@ static void test_add_source_filter(void)
     IFileSourceFilter_Release(filesource);
 
     hr = IFilterGraph2_RemoveFilter(graph, filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete %s, error %u.\n", wine_dbgstr_w(filename), GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", wine_dbgstr_w(filename), GetLastError());
 
     if (!RegCreateKeyA(HKEY_CLASSES_ROOT, "Media Type\\{abbccdde-0000-0000-0000-000000000000}"
             "\\{bccddeef-0000-0000-0000-000000000000}", &key))
@@ -5132,16 +5134,16 @@ static void test_add_source_filter(void)
 
         filename = create_file(L"test.avi", bogus_data, sizeof(bogus_data));
         hr = IFilterGraph2_AddSourceFilter(graph, filename, NULL, &filter);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(filter == &testfilter.IBaseFilter_iface, "Got unexpected filter %p.\n", filter);
 
         hr = IFilterGraph2_RemoveFilter(graph, filter);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IBaseFilter_Release(filter);
         ref = IBaseFilter_Release(&testfilter.IBaseFilter_iface);
-        ok(!ref, "Got outstanding refcount %d.\n", ref);
+        ok(!ref, "Got outstanding refcount %ld.\n", ref);
         ret = DeleteFileW(filename);
-        ok(ret, "Failed to delete %s, error %u.\n", wine_dbgstr_w(filename), GetLastError());
+        ok(ret, "Failed to delete %s, error %lu.\n", wine_dbgstr_w(filename), GetLastError());
         RegDeleteKeyA(HKEY_CLASSES_ROOT, "Media Type\\{abbccdde-0000-0000-0000-000000000000}"
             "\\{bccddeef-0000-0000-0000-000000000000}");
         RegDeleteKeyA(HKEY_CLASSES_ROOT, "Media Type\\{abbccdde-0000-0000-0000-000000000000}");
@@ -5151,7 +5153,7 @@ static void test_add_source_filter(void)
         skip("Not enough permission to register media types.\n");
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static HWND get_renderer_hwnd(IFilterGraph2 *graph)
@@ -5165,20 +5167,20 @@ static HWND get_renderer_hwnd(IFilterGraph2 *graph)
     IPin *pin;
 
     hr = IFilterGraph2_EnumFilters(graph, &enum_filters);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     while (IEnumFilters_Next(enum_filters, 1, &filter, NULL) == S_OK)
     {
         hr = IBaseFilter_EnumPins(filter, &enum_pins);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IEnumPins_Next(enum_pins, 1, &pin, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IEnumPins_Release(enum_pins);
 
         if (SUCCEEDED(IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay)))
         {
             hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-            ok(hr == S_OK, "Got hr %#x.\n", hr);
+            ok(hr == S_OK, "Got hr %#lx.\n", hr);
             IOverlay_Release(overlay);
         }
 
@@ -5224,12 +5226,12 @@ static void test_window_threading(void)
     hr = IFilterGraph2_RenderFile(graph, filename, NULL);
     if (FAILED(hr))
     {
-        skip("Cannot render test file, hr %#x.\n", hr);
+        skip("Cannot render test file, hr %#lx.\n", hr);
         IFilterGraph2_Release(graph);
         DeleteFileW(filename);
         return;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if ((hwnd = get_renderer_hwnd(graph)))
     {
@@ -5243,9 +5245,9 @@ static void test_window_threading(void)
          * while the video window is released. In particular, we must not send
          * WM_PARENTNOTIFY. This is not achieved through window styles. */
         hr = IFilterGraph2_QueryInterface(graph, &IID_IVideoWindow, (void **)&window);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IVideoWindow_put_Owner(window, (OAHWND)parent);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IVideoWindow_Release(window);
         ok(!(GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_NOPARENTNOTIFY), "Window has WS_EX_NOPARENTNOTIFY.\n");
     }
@@ -5255,7 +5257,7 @@ static void test_window_threading(void)
     SetActiveWindow(parent);
     expect_parent_message = FALSE;
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     expect_parent_message = TRUE;
 
     hwnd = GetActiveWindow();
@@ -5263,10 +5265,10 @@ static void test_window_threading(void)
 
     hr = CoCreateInstance(&CLSID_FilterGraphNoThread, NULL, CLSCTX_INPROC_SERVER,
             &IID_IFilterGraph2, (void **)&graph);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_RenderFile(graph, filename, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if ((hwnd = get_renderer_hwnd(graph)))
     {
@@ -5277,12 +5279,12 @@ static void test_window_threading(void)
         skip("Could not find renderer window.\n");
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     DestroyWindow(parent);
     UnregisterClassA("quartz_test_parent", GetModuleHandleA(NULL));
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 /* Hyperdevotion Noire needs to be able to Render() from UYVY. */
@@ -5321,12 +5323,12 @@ static void test_autoplug_uyvy(void)
      * failure to decode up to missing audio hardware, even though we're not
      * trying to render audio. */
     hr = IFilterGraph2_Render(graph, &source_pin.IPin_iface);
-    todo_wine ok(hr == S_OK || hr == VFW_E_NO_AUDIO_HARDWARE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK || hr == VFW_E_NO_AUDIO_HARDWARE, "Got hr %#lx.\n", hr);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
-    ok(source.ref == 1, "Got outstanding refcount %d.\n", source.ref);
-    ok(source_pin.ref == 1, "Got outstanding refcount %d.\n", source_pin.ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(source.ref == 1, "Got outstanding refcount %ld.\n", source.ref);
+    ok(source_pin.ref == 1, "Got outstanding refcount %ld.\n", source_pin.ref);
 }
 
 static void test_set_notify_flags(void)
@@ -5351,129 +5353,129 @@ static void test_set_notify_flags(void)
     status = SysAllocString(L"status");
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEventEx, (void **)&media_event);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEventSink, (void **)&media_event_sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testfilter_init(&filter, NULL, 0);
     filter.IAMFilterMiscFlags_iface.lpVtbl = &testmiscflags_vtbl;
     filter.misc_flags = AM_FILTER_MISC_FLAGS_IS_RENDERER;
 
     hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventEx_GetEventHandle(media_event, (OAEVENT *)&event);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventEx_SetNotifyWindow(media_event, (OAHWND)window, WM_USER, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
 
     while (PeekMessageA(&msg, window, WM_USER, WM_USER, PM_REMOVE));
 
     hr = IMediaEventEx_SetNotifyFlags(media_event, 2);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventEx_GetNotifyFlags(media_event, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     flags = 0xdeadbeef;
     hr = IMediaEventEx_GetNotifyFlags(media_event, &flags);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!flags, "Got flags %#x\n", flags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!flags, "Got flags %#lx\n", flags);
 
     hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     flags = 0xdeadbeef;
     hr = IMediaEventEx_GetNotifyFlags(media_event, &flags);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(flags == AM_MEDIAEVENT_NONOTIFY, "Got flags %#x\n", flags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(flags == AM_MEDIAEVENT_NONOTIFY, "Got flags %#lx\n", flags);
 
     ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
 
     hr = IMediaEventEx_GetEvent(media_event, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
 
     ok(!PeekMessageA(&msg, window, WM_USER, WM_USER, PM_REMOVE), "Window should not be notified.\n");
 
     hr = IMediaEventEx_GetEvent(media_event, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
 
     hr = IMediaControl_Stop(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
 
     hr = IMediaControl_Pause(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
 
     hr = IMediaControl_Run(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
 
     hr = IMediaEventEx_GetEvent(media_event, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
 
     hr = IMediaEventEx_SetNotifyFlags(media_event, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     flags = 0xdeadbeef;
     hr = IMediaEventEx_GetNotifyFlags(media_event, &flags);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!flags, "Got flags %#x\n", flags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!flags, "Got flags %#lx\n", flags);
 
     hr = IMediaControl_Stop(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Run(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
 
     hr = IMediaControl_Stop(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaControl_Release(media_control);
     IMediaEventEx_Release(media_event);
     IMediaEventSink_Release(media_event_sink);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
-    ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(filter.ref == 1, "Got outstanding refcount %ld.\n", filter.ref);
 
     SysFreeString(status);
     DestroyWindow(window);
@@ -5498,9 +5500,9 @@ static void check_events_(unsigned int line, IMediaEventEx *media_event,
         if (code == EC_STATUS)
             ++ec_status_count;
         hr = IMediaEventEx_FreeEventParams(media_event, code, param1, param2);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
     }
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
     ok_(__FILE__, line)(ec_complete_count == expected_ec_complete_count,
         "Expected %d EC_COMPLETE events.\n", expected_ec_complete_count);
     ok_(__FILE__, line)(ec_status_count == expected_ec_status_count,
@@ -5524,58 +5526,58 @@ static void test_events(void)
     status = SysAllocString(L"status");
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEventEx, (void **)&media_event);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEventSink, (void **)&media_event_sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     testfilter_init(&filter, NULL, 0);
     filter.IAMFilterMiscFlags_iface.lpVtbl = &testmiscflags_vtbl;
     filter.misc_flags = AM_FILTER_MISC_FLAGS_IS_RENDERER;
 
     hr = IFilterGraph2_AddFilter(graph, &filter.IBaseFilter_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventEx_GetEventHandle(media_event, (OAEVENT *)&event);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     code = 0xdeadbeef;
     param1 = 0xdeadbeef;
     param2 = 0xdeadbeef;
     hr = IMediaEventEx_GetEvent(media_event, &code, &param1, &param2, 0);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
-    ok(!code, "Got code %#x.\n", code);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
+    ok(!code, "Got code %#lx.\n", code);
     todo_wine ok(!param1, "Got param1 %#Ix.\n", param1);
     todo_wine ok(!param2, "Got param2 %#Ix.\n", param2);
 
     /* EC_COMPLETE is ignored while in stopped or paused state. */
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_events(media_event, 0, 2);
 
     hr = IMediaControl_Pause(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_events(media_event, 0, 2);
 
     hr = IMediaControl_Run(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_events(media_event, 0, 0);
 
@@ -5583,68 +5585,68 @@ static void test_events(void)
      * This remains true even with default handling canceled. */
 
     hr = IMediaEventEx_CancelDefaultHandling(media_event, EC_COMPLETE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_events(media_event, 1, 2);
 
     hr = IMediaControl_Run(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Run(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_events(media_event, 0, 2);
 
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Pause(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_events(media_event, 1, 2);
 
     hr = IMediaControl_Run(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_COMPLETE, S_OK,
             (LONG_PTR)&filter.IBaseFilter_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Run(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_events(media_event, 0, 2);
 
@@ -5653,19 +5655,19 @@ static void test_events(void)
     SetEvent(event);
 
     hr = IMediaEventEx_GetEvent(media_event, &code, &param1, &param2, 50);
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
 
     hr = IMediaControl_Stop(media_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaControl_Release(media_control);
     IMediaEventEx_Release(media_event);
     IMediaEventSink_Release(media_event_sink);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
-    ok(filter.ref == 1, "Got outstanding refcount %d.\n", filter.ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(filter.ref == 1, "Got outstanding refcount %ld.\n", filter.ref);
 
     SysFreeString(status);
 }
@@ -5687,13 +5689,13 @@ static void test_event_dispatch(void)
     IMediaEventEx_Release(event_ex);
 
     hr = IMediaEvent_GetTypeInfoCount(event, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(count == 1, "Got count %u.\n", count);
 
     hr = IMediaEvent_GetTypeInfo(event, 0, 0, &typeinfo);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind);
     ok(IsEqualGUID(&typeattr->guid, &IID_IMediaEvent), "Got IID %s.\n", debugstr_guid(&typeattr->guid));
     ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
@@ -5701,7 +5703,7 @@ static void test_event_dispatch(void)
 
     IMediaEvent_Release(event);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 START_TEST(filtergraph)
diff --git a/dlls/quartz/tests/filtermapper.c b/dlls/quartz/tests/filtermapper.c
index f1a942b1d25..3c492845389 100644
--- a/dlls/quartz/tests/filtermapper.c
+++ b/dlls/quartz/tests/filtermapper.c
@@ -35,7 +35,7 @@ static IFilterMapper3 *create_mapper(void)
     IFilterMapper3 *ret;
     HRESULT hr;
     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper3, (void **)&ret);
-    ok(hr == S_OK, "Failed to create filter mapper, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create filter mapper, hr %#lx.\n", hr);
     return ret;
 }
 
@@ -56,7 +56,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -92,10 +92,10 @@ static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum)
         VariantInit(&var);
 
         hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
-        ok(SUCCEEDED(hr), "IMoniker_BindToStorage failed with %x\n", hr);
+        ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
 
         hr = IPropertyBag_Read(pPropBagCat, L"FriendlyName", &var, NULL);
-        ok(SUCCEEDED(hr), "IPropertyBag_Read failed with %x\n", hr);
+        ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
 
         if (!wcscmp(V_BSTR(&var), wszFilterName))
             found = TRUE;
@@ -128,13 +128,13 @@ static void test_fm2_enummatchingfilters(void)
 
     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
             &IID_IFilterMapper2, (LPVOID*)&pMapper);
-    ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (FAILED(hr)) goto out;
 
     hr = CoCreateGuid(&clsidFilter1);
-    ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = CoCreateGuid(&clsidFilter2);
-    ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Test that a test renderer filter is returned when enumerating filters with bRender=FALSE */
     rgf2.dwVersion = 2;
@@ -162,7 +162,7 @@ static void test_fm2_enummatchingfilters(void)
     }
     else
     {
-        ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         rgPins2[0].dwFlags = 0;
 
@@ -178,11 +178,11 @@ static void test_fm2_enummatchingfilters(void)
 
         hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter2, L"Testfilter2", NULL,
                     &CLSID_LegacyAmFilterCategory, NULL, &rgf2);
-        ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
                 0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
-        ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         if (SUCCEEDED(hr) && pEnum)
         {
             found = enum_find_filter(L"Testfilter1", pEnum);
@@ -194,7 +194,7 @@ static void test_fm2_enummatchingfilters(void)
 
         hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
                 0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
-        ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         if (SUCCEEDED(hr) && pEnum)
         {
             found = enum_find_filter(L"Testfilter2", pEnum);
@@ -208,7 +208,7 @@ static void test_fm2_enummatchingfilters(void)
 
         hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
                 0, NULL, NULL, &GUID_NULL, TRUE, FALSE, 0, NULL, NULL, &GUID_NULL);
-        ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         if (SUCCEEDED(hr) && pEnum)
         {
@@ -217,12 +217,12 @@ static void test_fm2_enummatchingfilters(void)
         }
 
         hr = IFilterMapper2_QueryInterface(pMapper, &IID_IFilterMapper, (void **)&mapper);
-        ok(hr == S_OK, "QueryInterface(IFilterMapper) failed: %#x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         found = FALSE;
         hr = IFilterMapper_EnumMatchingFilters(mapper, &enum_reg, MERIT_UNLIKELY,
             FALSE, GUID_NULL, GUID_NULL, FALSE, FALSE, GUID_NULL, GUID_NULL);
-        ok(hr == S_OK, "IFilterMapper_EnumMatchingFilters failed: %#x\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         while (!found && IEnumRegFilters_Next(enum_reg, 1, &regfilter, &count) == S_OK)
         {
             if (!wcscmp(regfilter->Name, L"Testfilter1") && IsEqualGUID(&clsidFilter1, &regfilter->Clsid))
@@ -239,7 +239,7 @@ static void test_fm2_enummatchingfilters(void)
 
     hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0, TRUE, MERIT_UNLIKELY, TRUE,
                 0, NULL, NULL, &GUID_NULL, TRUE, FALSE, 0, NULL, NULL, &GUID_NULL);
-    ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (SUCCEEDED(hr) && pEnum)
     {
@@ -251,18 +251,18 @@ static void test_fm2_enummatchingfilters(void)
     {
         hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL,
                 &clsidFilter1);
-        ok(SUCCEEDED(hr), "IFilterMapper2_UnregisterFilter failed with %x\n", hr);
+        ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
 
         hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL,
                 &clsidFilter2);
-        ok(SUCCEEDED(hr), "IFilterMapper2_UnregisterFilter failed with %x\n", hr);
+        ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     }
 
     out:
 
     if (pEnum) IEnumMoniker_Release(pEnum);
     ref = IFilterMapper2_Release(pMapper);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_legacy_filter_registration(void)
@@ -298,34 +298,34 @@ static void test_legacy_filter_registration(void)
      * registers in this way. Filters so registered must then be accessible through both IFilterMapper_EnumMatchingFilters
      * and IFilterMapper2_EnumMatchingFilters. */
     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (void **)&mapper2);
-    ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper2_QueryInterface(mapper2, &IID_IFilterMapper, (void **)&mapper);
-    ok(hr == S_OK, "IFilterMapper2_QueryInterface failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Set default value - this is interpreted as "friendly name" later. */
     RegSetValueExW(hkey, NULL, 0, REG_SZ, (const BYTE *)L"Testfilter", sizeof(L"Testfilter"));
     RegCloseKey(hkey);
 
     hr = IFilterMapper_RegisterFilter(mapper, clsid, L"Testfilter", MERIT_UNLIKELY);
-    ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper_RegisterPin(mapper, clsid, L"Pin1", TRUE, FALSE, FALSE, FALSE, GUID_NULL, NULL);
-    ok(hr == S_OK, "RegisterPin failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper_RegisterPinType(mapper, clsid, L"Pin1", GUID_NULL, GUID_NULL);
-    ok(hr == S_OK, "RegisterPinType failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper2_EnumMatchingFilters(mapper2, &enum_mon, 0, TRUE, MERIT_UNLIKELY, TRUE,
             0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
-    ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(enum_find_filter(L"Testfilter", enum_mon), "IFilterMapper2 didn't find filter\n");
     IEnumMoniker_Release(enum_mon);
 
     found = FALSE;
     hr = IFilterMapper_EnumMatchingFilters(mapper, &enum_reg, MERIT_UNLIKELY, TRUE, GUID_NULL, GUID_NULL,
         FALSE, FALSE, GUID_NULL, GUID_NULL);
-    ok(hr == S_OK, "IFilterMapper_EnumMatchingFilters failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     while(!found && IEnumRegFilters_Next(enum_reg, 1, &regfilter, &count) == S_OK)
     {
         if (!wcscmp(regfilter->Name, L"Testfilter") && IsEqualGUID(&clsid, &regfilter->Clsid))
@@ -335,18 +335,18 @@ static void test_legacy_filter_registration(void)
     ok(found, "IFilterMapper didn't find filter\n");
 
     hr = IFilterMapper_UnregisterFilter(mapper, clsid);
-    ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper2_EnumMatchingFilters(mapper2, &enum_mon, 0, TRUE, MERIT_UNLIKELY, TRUE,
             0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
-    ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed: %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!enum_find_filter(L"Testfilter", enum_mon), "IFilterMapper2 shouldn't find filter\n");
     IEnumMoniker_Release(enum_mon);
 
     found = FALSE;
     hr = IFilterMapper_EnumMatchingFilters(mapper, &enum_reg, MERIT_UNLIKELY, TRUE, GUID_NULL, GUID_NULL,
         FALSE, FALSE, GUID_NULL, GUID_NULL);
-    ok(hr == S_OK, "IFilterMapper_EnumMatchingFilters failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     while(!found && IEnumRegFilters_Next(enum_reg, 1, &regfilter, &count) == S_OK)
     {
         if (!wcscmp(regfilter->Name, L"Testfilter") && IsEqualGUID(&clsid, &regfilter->Clsid))
@@ -356,13 +356,13 @@ static void test_legacy_filter_registration(void)
     ok(!found, "IFilterMapper shouldn't find filter\n");
 
     ret = RegDeleteKeyW(HKEY_CLASSES_ROOT, key_name);
-    ok(!ret, "RegDeleteKeyA failed: %lu\n", ret);
+    ok(!ret, "RegDeleteKeyA failed: %Iu\n", ret);
 
     hr = IFilterMapper_RegisterFilter(mapper, clsid, L"Testfilter", MERIT_UNLIKELY);
-    ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper_UnregisterFilter(mapper, clsid);
-    ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IFilterMapper_Release(mapper);
     IFilterMapper2_Release(mapper2);
@@ -382,13 +382,13 @@ static void test_register_filter_with_null_clsMinorType(void)
 
     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
             &IID_IFilterMapper2, (LPVOID*)&pMapper);
-    ok(hr == S_OK, "CoCreateInstance failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (FAILED(hr)) goto out;
 
     hr = CoCreateGuid(&clsidFilter1);
-    ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = CoCreateGuid(&clsidFilter2);
-    ok(hr == S_OK, "CoCreateGuid failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     rgPinType.clsMajorType = &GUID_NULL;
     /* Make sure quartz accepts it without crashing */
@@ -418,10 +418,10 @@ static void test_register_filter_with_null_clsMinorType(void)
         skip("Not authorized to register filters\n");
         goto out;
     }
-    ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL, &clsidFilter1);
-    ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Test with pin descript version 2 */
     ZeroMemory(&rgf2, sizeof(rgf2));
@@ -440,10 +440,10 @@ static void test_register_filter_with_null_clsMinorType(void)
 
     hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter2, L"Testfilter2", NULL,
                     &CLSID_LegacyAmFilterCategory, NULL, &rgf2);
-    ok(hr == S_OK, "IFilterMapper2_RegisterFilter failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory, NULL, &clsidFilter2);
-    ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     out:
 
@@ -473,7 +473,7 @@ static void test_parse_filter_data(void)
 
     hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
             &IID_IFilterMapper2, (LPVOID*)&pMapper);
-    ok((hr == S_OK || broken(hr != S_OK)), "CoCreateInstance failed with %x\n", hr);
+    ok((hr == S_OK || broken(hr != S_OK)), "Got hr %#lx.\n", hr);
     if (FAILED(hr)) goto out;
 
     hr = IFilterMapper2_QueryInterface(pMapper, &IID_IAMFilterData, (LPVOID*)&pData);
@@ -559,53 +559,53 @@ static void test_aggregation(void)
     mapper = (IFilterMapper3 *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_FilterMapper2, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IFilterMapper3, (void **)&mapper);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!mapper, "Got interface %p.\n", mapper);
 
     hr = CoCreateInstance(&CLSID_FilterMapper2, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IFilterMapper3, (void **)&mapper);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterMapper3_QueryInterface(mapper, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IFilterMapper3_QueryInterface(mapper, &IID_IFilterMapper3, (void **)&mapper2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(mapper2 == (IFilterMapper3 *)0xdeadbeef, "Got unexpected IFilterMapper3 %p.\n", mapper2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IFilterMapper3_QueryInterface(mapper, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IFilterMapper3_Release(mapper);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_dmo(void)
@@ -625,19 +625,19 @@ static void test_dmo(void)
         skip("Not enough permissions to register DMOs.\n");
         return;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mapper = create_mapper();
 
     hr = IFilterMapper3_EnumMatchingFilters(mapper, &enumerator, 0, FALSE, 0,
             FALSE, 0, NULL, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     found = FALSE;
     while (IEnumMoniker_Next(enumerator, 1, &moniker, NULL) == S_OK)
     {
         hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &name);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         if (!wcscmp(name, L"@device:dmo:{77777777-0000-0000-0000-000000000000}{57F2DB8B-E6BB-4513-9D43-DCD2A6593125}"))
             found = TRUE;
@@ -651,10 +651,10 @@ static void test_dmo(void)
     /* DMOs are enumerated by IFilterMapper in Windows 7 and higher. */
 
     ref = IFilterMapper3_Release(mapper);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     hr = DMOUnregister(&testclsid, &DMOCATEGORY_AUDIO_DECODER);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 START_TEST(filtermapper)
diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c
index 164f3af47f4..37df9a24bd2 100644
--- a/dlls/quartz/tests/memallocator.c
+++ b/dlls/quartz/tests/memallocator.c
@@ -27,7 +27,7 @@ static IMemAllocator *create_allocator(void)
     IMemAllocator *allocator = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
         &IID_IMemAllocator, (void **)&allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return allocator;
 }
 
@@ -63,59 +63,59 @@ static void test_properties(void)
 
     memset(&ret_props, 0xcc, sizeof(ret_props));
     hr = IMemAllocator_GetProperties(allocator, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!ret_props.cBuffers, "Got %d buffers.\n", ret_props.cBuffers);
-    ok(!ret_props.cbBuffer, "Got size %d.\n", ret_props.cbBuffer);
-    ok(!ret_props.cbAlign, "Got align %d.\n", ret_props.cbAlign);
-    ok(!ret_props.cbPrefix, "Got prefix %d.\n", ret_props.cbPrefix);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!ret_props.cBuffers, "Got %ld buffers.\n", ret_props.cBuffers);
+    ok(!ret_props.cbBuffer, "Got size %ld.\n", ret_props.cbBuffer);
+    ok(!ret_props.cbAlign, "Got align %ld.\n", ret_props.cbAlign);
+    ok(!ret_props.cbPrefix, "Got prefix %ld.\n", ret_props.cbPrefix);
 
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == VFW_E_BADALIGN, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_BADALIGN, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < ARRAY_SIZE(tests); i++)
     {
         req_props = tests[i];
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
         ok(!memcmp(&req_props, &tests[i], sizeof(req_props)), "Test %u: Requested props should not be changed.\n", i);
-        ok(ret_props.cBuffers == req_props.cBuffers, "Test %u: Got %d buffers.\n", i, ret_props.cBuffers);
-        ok(ret_props.cbBuffer >= req_props.cbBuffer, "Test %u: Got size %d.\n", i, ret_props.cbBuffer);
-        ok(ret_props.cbAlign == req_props.cbAlign, "Test %u: Got alignment %d.\n", i, ret_props.cbAlign);
-        ok(ret_props.cbPrefix == req_props.cbPrefix, "Test %u: Got prefix %d.\n", i, ret_props.cbPrefix);
+        ok(ret_props.cBuffers == req_props.cBuffers, "Test %u: Got %ld buffers.\n", i, ret_props.cBuffers);
+        ok(ret_props.cbBuffer >= req_props.cbBuffer, "Test %u: Got size %ld.\n", i, ret_props.cbBuffer);
+        ok(ret_props.cbAlign == req_props.cbAlign, "Test %u: Got alignment %ld.\n", i, ret_props.cbAlign);
+        ok(ret_props.cbPrefix == req_props.cbPrefix, "Test %u: Got prefix %ld.\n", i, ret_props.cbPrefix);
         ret_size = ret_props.cbBuffer;
 
         hr = IMemAllocator_GetProperties(allocator, &ret_props);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
-        ok(ret_props.cBuffers == req_props.cBuffers, "Test %u: Got %d buffers.\n", i, ret_props.cBuffers);
-        ok(ret_props.cbBuffer == ret_size, "Test %u: Got size %d.\n", i, ret_props.cbBuffer);
-        ok(ret_props.cbAlign == req_props.cbAlign, "Test %u: Got alignment %d.\n", i, ret_props.cbAlign);
-        ok(ret_props.cbPrefix == req_props.cbPrefix, "Test %u: Got prefix %d.\n", i, ret_props.cbPrefix);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
+        ok(ret_props.cBuffers == req_props.cBuffers, "Test %u: Got %ld buffers.\n", i, ret_props.cBuffers);
+        ok(ret_props.cbBuffer == ret_size, "Test %u: Got size %ld.\n", i, ret_props.cbBuffer);
+        ok(ret_props.cbAlign == req_props.cbAlign, "Test %u: Got alignment %ld.\n", i, ret_props.cbAlign);
+        ok(ret_props.cbPrefix == req_props.cbPrefix, "Test %u: Got prefix %ld.\n", i, ret_props.cbPrefix);
 
         hr = IMemAllocator_Commit(allocator);
         if (!req_props.cbBuffer)
         {
-            ok(hr == VFW_E_SIZENOTSET, "Test %u: Got hr %#x.\n", i, hr);
+            ok(hr == VFW_E_SIZENOTSET, "Test %u: Got hr %#lx.\n", i, hr);
             continue;
         }
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
 
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == VFW_E_ALREADY_COMMITTED, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == VFW_E_ALREADY_COMMITTED, "Test %u: Got hr %#lx.\n", i, hr);
 
         hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
 
         size = IMediaSample_GetSize(sample);
-        ok(size == ret_size, "Test %u: Got size %d.\n", i, size);
+        ok(size == ret_size, "Test %u: Got size %ld.\n", i, size);
 
         hr = IMemAllocator_Decommit(allocator);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
 
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == VFW_E_BUFFERS_OUTSTANDING, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == VFW_E_BUFFERS_OUTSTANDING, "Test %u: Got hr %#lx.\n", i, hr);
 
         hr = IMediaSample_Release(sample);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
     }
 
     IMemAllocator_Release(allocator);
@@ -130,42 +130,42 @@ static void test_commit(void)
     BYTE *data;
 
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IMediaSample_Release(sample);
 
     hr = IMemAllocator_Decommit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Decommit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Extant samples remain valid even after Decommit() is called. */
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_Decommit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     memset(data, 0xcc, 65536);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample2, NULL, NULL, 0);
-    ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
 
     IMediaSample_Release(sample);
     IMemAllocator_Release(allocator);
@@ -182,132 +182,132 @@ static void test_sample_time(void)
     HRESULT hr;
 
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_QueryInterface(sample, &IID_IMediaSample2, (void **)&sample2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = 0xdeadbeef;
     end = 0xdeadf00d;
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
     ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     hr = IMediaSample_SetTime(sample, NULL, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     start = 0x123;
     hr = IMediaSample_SetTime(sample, &start, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = end = 0;
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#lx.\n", hr);
     ok(start == 0x123, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0x124, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(props.dwSampleFlags == AM_SAMPLE_TIMEVALID, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(props.dwSampleFlags == AM_SAMPLE_TIMEVALID, "Got flags %#lx.\n", props.dwSampleFlags);
     ok(props.tStart == 0x123, "Got start %s.\n", wine_dbgstr_longlong(props.tStart));
 
     hr = IMediaSample_SetTime(sample, NULL, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     end = 0x321;
     hr = IMediaSample_SetTime(sample, NULL, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     start = 0x123;
     end = 0x321;
     hr = IMediaSample_SetTime(sample, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = end = 0;
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == 0x123, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0x321, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(props.dwSampleFlags == (AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID),
-            "Got flags %#x.\n", props.dwSampleFlags);
+            "Got flags %#lx.\n", props.dwSampleFlags);
     ok(props.tStart == 0x123, "Got start %s.\n", wine_dbgstr_longlong(props.tStart));
     ok(props.tStop == 0x321, "Got end %s.\n", wine_dbgstr_longlong(props.tStop));
 
     props.dwSampleFlags = 0;
     hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     props.dwSampleFlags = AM_SAMPLE_TIMEVALID;
     props.tStart = 0x123;
     hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = end = 0;
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_NO_STOP_TIME, "Got hr %#lx.\n", hr);
     ok(start == 0x123, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0x124, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(props.dwSampleFlags == AM_SAMPLE_TIMEVALID, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(props.dwSampleFlags == AM_SAMPLE_TIMEVALID, "Got flags %#lx.\n", props.dwSampleFlags);
     ok(props.tStart == 0x123, "Got start %s.\n", wine_dbgstr_longlong(props.tStart));
 
     props.dwSampleFlags = AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID;
     props.tStart = 0x1234;
     props.tStop = 0x4321;
     hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = end = 0;
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == 0x1234, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0x4321, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(props.dwSampleFlags == (AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID),
-            "Got flags %#x.\n", props.dwSampleFlags);
+            "Got flags %#lx.\n", props.dwSampleFlags);
     ok(props.tStart == 0x1234, "Got start %s.\n", wine_dbgstr_longlong(props.tStart));
     ok(props.tStop == 0x4321, "Got end %s.\n", wine_dbgstr_longlong(props.tStop));
 
@@ -317,28 +317,28 @@ static void test_sample_time(void)
     start = 0x123;
     end = 0x321;
     hr = IMemAllocator_GetBuffer(allocator, &sample, &start, &end, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_QueryInterface(sample, &IID_IMediaSample2, (void **)&sample2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = 0xdeadbeef;
     end = 0xdeadf00d;
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
     ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     start = 0x123;
     end = 0x321;
     hr = IMediaSample_SetMediaTime(sample, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetTime(sample, &start, &end);
-    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_SAMPLE_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     IMediaSample2_Release(sample2);
     IMediaSample_Release(sample);
@@ -355,48 +355,48 @@ static void test_media_time(void)
     HRESULT hr;
 
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = 0xdeadbeef;
     end = 0xdeadf00d;
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#lx.\n", hr);
     ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     hr = IMediaSample_SetMediaTime(sample, NULL, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     /* This crashes on quartz.dll < 6.6. */
     if (0)
     {
         start = 0x123;
         hr = IMediaSample_SetMediaTime(sample, &start, NULL);
-        ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+        ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     }
 
     end = 0x321;
     hr = IMediaSample_SetMediaTime(sample, NULL, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     start = 0x123;
     end = 0x321;
     hr = IMediaSample_SetMediaTime(sample, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = end = 0;
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == 0x123, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0x321, "Got end %s.\n", wine_dbgstr_longlong(end));
 
@@ -405,35 +405,35 @@ static void test_media_time(void)
     start = 0x123;
     end = 0x321;
     hr = IMemAllocator_GetBuffer(allocator, &sample, &start, &end, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start = 0xdeadbeef;
     end = 0xdeadf00d;
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#lx.\n", hr);
     ok(start == 0xdeadbeef, "Got start %s.\n", wine_dbgstr_longlong(start));
     ok(end == 0xdeadf00d, "Got end %s.\n", wine_dbgstr_longlong(end));
 
     start = 0x123;
     end = 0x321;
     hr = IMediaSample_SetTime(sample, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     start = 0x123;
     end = 0x321;
     hr = IMediaSample_SetMediaTime(sample, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaSample_Release(sample);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetMediaTime(sample, &start, &end);
-    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_MEDIA_TIME_NOT_SET, "Got hr %#lx.\n", hr);
 
     IMediaSample_Release(sample);
     IMemAllocator_Release(allocator);
@@ -457,193 +457,193 @@ static void test_sample_properties(void)
     expect_mt.pbFormat = NULL;
 
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_QueryInterface(sample, &IID_IMediaSample2, (void **)&sample2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwTypeSpecificFlags, "Got type-specific flags %#x.\n", props.dwTypeSpecificFlags);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
-    ok(props.lActual == 65536, "Got actual length %d.\n", props.lActual);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwTypeSpecificFlags, "Got type-specific flags %#lx.\n", props.dwTypeSpecificFlags);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
+    ok(props.lActual == 65536, "Got actual length %ld.\n", props.lActual);
     ok(!props.tStart, "Got sample start %s.\n", wine_dbgstr_longlong(props.tStart));
-    ok(!props.dwStreamId, "Got stream ID %#x.\n", props.dwStreamId);
+    ok(!props.dwStreamId, "Got stream ID %#lx.\n", props.dwStreamId);
     ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType);
     ok(props.pbBuffer == data, "Expected pointer %p, got %p.\n", data, props.pbBuffer);
-    ok(props.cbBuffer == 65536, "Got buffer length %d.\n", props.cbBuffer);
+    ok(props.cbBuffer == 65536, "Got buffer length %ld.\n", props.cbBuffer);
 
     /* media type */
 
     mt = (AM_MEDIA_TYPE *)0xdeadbeef;
     hr = IMediaSample_GetMediaType(sample, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(!mt, "Got media type %p.\n", mt);
 
     hr = IMediaSample_SetMediaType(sample, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt = (AM_MEDIA_TYPE *)0xdeadbeef;
     hr = IMediaSample_GetMediaType(sample, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(!mt, "Got media type %p.\n", mt);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
     ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType);
 
     hr = IMediaSample_SetMediaType(sample, &expect_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetMediaType(sample, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!memcmp(mt, &expect_mt, sizeof(AM_MEDIA_TYPE)), "Media types didn't match.\n");
     CoTaskMemFree(mt);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(props.dwSampleFlags == AM_SAMPLE_TYPECHANGED, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(props.dwSampleFlags == AM_SAMPLE_TYPECHANGED, "Got flags %#lx.\n", props.dwSampleFlags);
     ok(!memcmp(props.pMediaType, &expect_mt, sizeof(AM_MEDIA_TYPE)), "Media types didn't match.\n");
 
     hr = IMediaSample_SetMediaType(sample, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt = (AM_MEDIA_TYPE *)0xdeadbeef;
     hr = IMediaSample_GetMediaType(sample, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(!mt, "Got media type %p.\n", mt);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
     ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType);
 
     /* actual length */
 
     len = IMediaSample_GetActualDataLength(sample);
-    ok(len == 65536, "Got length %d.\n", len);
+    ok(len == 65536, "Got length %ld.\n", len);
 
     hr = IMediaSample_SetActualDataLength(sample, 65537);
-    ok(hr == VFW_E_BUFFER_OVERFLOW, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_BUFFER_OVERFLOW, "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetActualDataLength(sample, -1);
-    ok(hr == VFW_E_BUFFER_OVERFLOW || broken(hr == S_OK), "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_BUFFER_OVERFLOW || broken(hr == S_OK), "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetActualDataLength(sample, 65536);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetActualDataLength(sample, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     len = IMediaSample_GetActualDataLength(sample);
-    ok(len == 0, "Got length %d.\n", len);
+    ok(len == 0, "Got length %ld.\n", len);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(props.lActual == 0, "Got actual length %d.\n", props.lActual);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(props.lActual == 0, "Got actual length %ld.\n", props.lActual);
 
     props.lActual = 123;
     hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(props.lActual == 123, "Got actual length %d.\n", props.lActual);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(props.lActual == 123, "Got actual length %ld.\n", props.lActual);
 
     len = IMediaSample_GetActualDataLength(sample);
-    ok(len == 123, "Got length %d.\n", len);
+    ok(len == 123, "Got length %ld.\n", len);
 
     /* boolean flags */
 
     hr = IMediaSample_IsPreroll(sample);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetPreroll(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsPreroll(sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(props.dwSampleFlags == AM_SAMPLE_PREROLL, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(props.dwSampleFlags == AM_SAMPLE_PREROLL, "Got flags %#lx.\n", props.dwSampleFlags);
     hr = IMediaSample_SetPreroll(sample, FALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsPreroll(sample);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     hr = IMediaSample_IsDiscontinuity(sample);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetDiscontinuity(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsDiscontinuity(sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(props.dwSampleFlags == AM_SAMPLE_DATADISCONTINUITY, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(props.dwSampleFlags == AM_SAMPLE_DATADISCONTINUITY, "Got flags %#lx.\n", props.dwSampleFlags);
     hr = IMediaSample_SetDiscontinuity(sample, FALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsDiscontinuity(sample);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     hr = IMediaSample_IsSyncPoint(sample);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSample_SetSyncPoint(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsSyncPoint(sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(props.dwSampleFlags == AM_SAMPLE_SPLICEPOINT, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(props.dwSampleFlags == AM_SAMPLE_SPLICEPOINT, "Got flags %#lx.\n", props.dwSampleFlags);
     hr = IMediaSample_SetSyncPoint(sample, FALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsSyncPoint(sample);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
 
     props.dwSampleFlags = (AM_SAMPLE_PREROLL | AM_SAMPLE_DATADISCONTINUITY | AM_SAMPLE_SPLICEPOINT);
     hr = IMediaSample2_SetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsPreroll(sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsDiscontinuity(sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_IsSyncPoint(sample);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(props.dwSampleFlags == (AM_SAMPLE_PREROLL | AM_SAMPLE_DATADISCONTINUITY | AM_SAMPLE_SPLICEPOINT),
-            "Got flags %#x.\n", props.dwSampleFlags);
+            "Got flags %#lx.\n", props.dwSampleFlags);
 
     hr = IMediaSample_SetMediaType(sample, &expect_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaSample2_Release(sample2);
     IMediaSample_Release(sample);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSample_QueryInterface(sample, &IID_IMediaSample2, (void **)&sample2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample2_GetProperties(sample2, sizeof(props), (BYTE *)&props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!props.dwTypeSpecificFlags, "Got type-specific flags %#x.\n", props.dwTypeSpecificFlags);
-    ok(!props.dwSampleFlags, "Got flags %#x.\n", props.dwSampleFlags);
-    ok(props.lActual == 123, "Got actual length %d.\n", props.lActual);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!props.dwTypeSpecificFlags, "Got type-specific flags %#lx.\n", props.dwTypeSpecificFlags);
+    ok(!props.dwSampleFlags, "Got flags %#lx.\n", props.dwSampleFlags);
+    ok(props.lActual == 123, "Got actual length %ld.\n", props.lActual);
     ok(!props.tStart, "Got sample start %s.\n", wine_dbgstr_longlong(props.tStart));
-    ok(!props.dwStreamId, "Got stream ID %#x.\n", props.dwStreamId);
+    ok(!props.dwStreamId, "Got stream ID %#lx.\n", props.dwStreamId);
     ok(!props.pMediaType, "Got media type %p.\n", props.pMediaType);
-    ok(props.cbBuffer == 65536, "Got buffer length %d.\n", props.cbBuffer);
+    ok(props.cbBuffer == 65536, "Got buffer length %ld.\n", props.cbBuffer);
 
     IMediaSample2_Release(sample2);
     IMediaSample_Release(sample);
diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c
index 5aae09b596d..b2cced84c68 100644
--- a/dlls/quartz/tests/mpegsplit.c
+++ b/dlls/quartz/tests/mpegsplit.c
@@ -32,7 +32,7 @@ static IBaseFilter *create_mpeg_splitter(void)
     IBaseFilter *filter = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_MPEG1Splitter, NULL, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return filter;
 }
 
@@ -54,11 +54,11 @@ static WCHAR *load_resource(const WCHAR *name)
     wcscat(pathW, name);
 
     file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %u.\n",
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %lu.\n",
             wine_dbgstr_w(pathW), GetLastError());
 
     res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA);
-    ok(!!res, "Failed to load resource, error %u.\n", GetLastError());
+    ok(!!res, "Failed to load resource, error %lu.\n", GetLastError());
     ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res));
     WriteFile(file, ptr, SizeofResource( GetModuleHandleA(NULL), res), &written, NULL);
     ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n");
@@ -96,7 +96,7 @@ static IFilterGraph2 *connect_input(IBaseFilter *splitter, const WCHAR *filename
     IBaseFilter_FindPin(reader, L"Output", &source);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, sink, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IPin_Release(source);
     IPin_Release(sink);
@@ -115,7 +115,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -222,53 +222,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_MPEG1Splitter, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_MPEG1Splitter, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -283,71 +283,71 @@ static void test_enum_pins(void)
     BOOL ret;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
@@ -355,46 +355,46 @@ static void test_enum_pins(void)
     graph = connect_input(filter, filename);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 3, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     IEnumPins_Release(enum1);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_find_pin(void)
@@ -409,34 +409,34 @@ static void test_find_pin(void)
     BOOL ret;
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"Input", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pin);
 
     hr = IBaseFilter_FindPin(filter, L"Audio", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     graph = connect_input(filter, filename);
 
     hr = IBaseFilter_EnumPins(filter, &enum_pins);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"Input", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"Audio", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
     IPin_Release(pin);
     IPin_Release(pin2);
@@ -444,9 +444,9 @@ static void test_find_pin(void)
     IEnumPins_Release(enum_pins);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_pin_info(void)
@@ -465,49 +465,49 @@ static void test_pin_info(void)
     graph = connect_input(filter, filename);
 
     hr = IBaseFilter_FindPin(filter, L"Input", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     expect_ref = get_refcount(filter);
     ref = get_refcount(pin);
-    ok(ref == expect_ref, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref, "Got unexpected refcount %ld.\n", ref);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     ok(!wcscmp(info.achName, L"Input"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    ok(ref == expect_ref + 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == expect_ref + 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"Input"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     IPin_Release(pin);
 
     hr = IBaseFilter_FindPin(filter, L"Audio", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
     ok(!wcscmp(info.achName, L"Audio"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"Audio"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
@@ -515,9 +515,9 @@ static void test_pin_info(void)
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_media_types(void)
@@ -548,7 +548,7 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"Input", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     expect_mt.majortype = MEDIATYPE_Stream;
     expect_mt.bFixedSizeSamples = TRUE;
@@ -556,7 +556,7 @@ static void test_media_types(void)
     expect_mt.lSampleSize = 1;
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     expect_mt.subtype = MEDIASUBTYPE_MPEG1System;
     if (hr == S_OK)
     {
@@ -565,7 +565,7 @@ static void test_media_types(void)
     }
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     expect_mt.subtype = MEDIASUBTYPE_MPEG1VideoCD;
     if (hr == S_OK)
     {
@@ -574,7 +574,7 @@ static void test_media_types(void)
     }
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     expect_mt.subtype = MEDIASUBTYPE_MPEG1Video;
     if (hr == S_OK)
     {
@@ -583,7 +583,7 @@ static void test_media_types(void)
     }
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     expect_mt.subtype = MEDIASUBTYPE_MPEG1Audio;
     if (hr == S_OK)
     {
@@ -592,70 +592,70 @@ static void test_media_types(void)
     }
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
 
     mt.majortype = MEDIATYPE_Stream;
     mt.subtype = MEDIASUBTYPE_MPEG1Audio;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.subtype = MEDIASUBTYPE_MPEG1Video;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_MPEG1VideoCD;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_MPEG1System;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_MPEG1Payload;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_MPEG1Packet;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.subtype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_MPEG1Audio;
 
     mt.majortype = MEDIATYPE_Audio;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.majortype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.majortype = MEDIATYPE_Stream;
 
     mt.formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.formattype = FORMAT_VideoInfo;
     hr = IPin_QueryAccept(pin, &mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.formattype = FORMAT_WaveFormatEx;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.bFixedSizeSamples = TRUE;
     mt.bTemporalCompression = TRUE;
     mt.lSampleSize = 123;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     graph = connect_input(filter, filename);
 
     /* Connecting input doesn't change the reported media types. */
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     expect_mt.subtype = MEDIASUBTYPE_MPEG1System;
     if (hr == S_OK)
     {
@@ -669,21 +669,21 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"Audio", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio), "Got major type %s.\n",
             wine_dbgstr_guid(&pmt->majortype));
     todo_wine ok(IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_MPEG1AudioPayload), "Got subtype %s.\n",
             wine_dbgstr_guid(&pmt->subtype));
     todo_wine ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
     ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
-    todo_wine ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
+    todo_wine ok(pmt->lSampleSize == 1, "Got sample size %lu.\n", pmt->lSampleSize);
     ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n",
             wine_dbgstr_guid(&pmt->formattype));
     ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
-    todo_wine ok(pmt->cbFormat == sizeof(MPEG1WAVEFORMAT), "Got format size %u.\n", pmt->cbFormat);
+    todo_wine ok(pmt->cbFormat == sizeof(MPEG1WAVEFORMAT), "Got format size %lu.\n", pmt->cbFormat);
     if (pmt->cbFormat == sizeof(MPEG1WAVEFORMAT))
     {
         /* Native will sometimes leave junk in the joint stereo flags. */
@@ -692,58 +692,58 @@ static void test_media_types(void)
     }
 
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pmt->bFixedSizeSamples = FALSE;
     pmt->bTemporalCompression = TRUE;
     pmt->lSampleSize = 123;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pmt->majortype = MEDIATYPE_Video;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->majortype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->majortype = MEDIATYPE_Audio;
 
     pmt->subtype = MEDIASUBTYPE_MPEG1Audio;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->subtype = MEDIASUBTYPE_MPEG1Packet;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->subtype = MEDIASUBTYPE_MPEG1Video;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->subtype = MEDIASUBTYPE_MPEG1AudioPayload;
 
     pmt->formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->formattype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->formattype = FORMAT_WaveFormatEx;
 
     wfx = (MPEG1WAVEFORMAT *)pmt->pbFormat;
 
     wfx->fwHeadLayer = ACM_MPEG_LAYER2;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     wfx->fwHeadLayer = ACM_MPEG_LAYER3;
 
     wfx->wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     wfx->wfx.wFormatTag = WAVE_FORMAT_MPEG;
 
     CoTaskMemFree(pmt->pbFormat);
     CoTaskMemFree(pmt);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr != S_OK)
         goto done;
     ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio), "Got major type %s.\n",
@@ -752,80 +752,80 @@ static void test_media_types(void)
             wine_dbgstr_guid(&pmt->subtype));
     ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
     ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
-    ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
+    ok(pmt->lSampleSize == 1, "Got sample size %lu.\n", pmt->lSampleSize);
     ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n",
             wine_dbgstr_guid(&pmt->formattype));
     ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
-    ok(pmt->cbFormat == sizeof(MPEG1WAVEFORMAT), "Got format size %u.\n", pmt->cbFormat);
+    ok(pmt->cbFormat == sizeof(MPEG1WAVEFORMAT), "Got format size %lu.\n", pmt->cbFormat);
     /* Native will sometimes leave junk in the joint stereo flags. */
     expect_wfx.fwHeadModeExt = ((MPEG1WAVEFORMAT *)pmt->pbFormat)->fwHeadModeExt;
     ok(!memcmp(pmt->pbFormat, &expect_wfx, sizeof(MPEG1WAVEFORMAT)), "Format blocks didn't match.\n");
 
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     CoTaskMemFree(pmt->pbFormat);
     CoTaskMemFree(pmt);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio), "Got major type %s.\n",
             wine_dbgstr_guid(&pmt->majortype));
     ok(IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_mp3), "Got subtype %s.\n",
             wine_dbgstr_guid(&pmt->subtype));
     ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
     ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
-    ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
+    ok(pmt->lSampleSize == 1, "Got sample size %lu.\n", pmt->lSampleSize);
     ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n",
             wine_dbgstr_guid(&pmt->formattype));
     ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
-    ok(pmt->cbFormat == sizeof(MPEGLAYER3WAVEFORMAT), "Got format size %u.\n", pmt->cbFormat);
+    ok(pmt->cbFormat == sizeof(MPEGLAYER3WAVEFORMAT), "Got format size %lu.\n", pmt->cbFormat);
     ok(!memcmp(pmt->pbFormat, &expect_mp3_wfx, sizeof(MPEGLAYER3WAVEFORMAT)),
             "Format blocks didn't match.\n");
 
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pmt->bFixedSizeSamples = FALSE;
     pmt->bTemporalCompression = TRUE;
     pmt->lSampleSize = 123;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pmt->majortype = MEDIATYPE_Video;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->majortype = MEDIATYPE_Audio;
 
     pmt->subtype = MEDIASUBTYPE_MPEG1Audio;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->subtype = MEDIASUBTYPE_MPEG1Packet;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->subtype = MEDIASUBTYPE_MPEG1Video;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->subtype = MEDIASUBTYPE_MPEG1AudioPayload;
 
     pmt->formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->formattype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->formattype = FORMAT_WaveFormatEx;
 
     mp3wfx = (MPEGLAYER3WAVEFORMAT *)pmt->pbFormat;
 
     mp3wfx->fdwFlags = MPEGLAYER3_FLAG_PADDING_OFF;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mp3wfx->fdwFlags = MPEGLAYER3_FLAG_PADDING_ISO;
 
     mp3wfx->wfx.wFormatTag = WAVE_FORMAT_MPEG;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mp3wfx->wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
 
     CoTaskMemFree(pmt->pbFormat);
@@ -833,16 +833,16 @@ static void test_media_types(void)
 
 done:
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
     IPin_Release(pin);
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_enum_media_types(void)
@@ -861,78 +861,78 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"Input", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < 4; ++i)
     {
         hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-        todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+        todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
         if (hr == S_OK) CoTaskMemFree(mts[0]);
     }
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < 4; ++i)
     {
         hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-        todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-        todo_wine ok(count == 1, "Got count %u.\n", count);
+        todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        todo_wine ok(count == 1, "Got count %lu.\n", count);
         if (hr == S_OK) CoTaskMemFree(mts[0]);
     }
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(count == 2, "Got count %u.\n", count);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(count == 2, "Got count %lu.\n", count);
     if (count > 0) CoTaskMemFree(mts[0]);
     if (count > 1) CoTaskMemFree(mts[1]);
 
     hr = IEnumMediaTypes_Next(enum1, 3, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    todo_wine ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    todo_wine ok(count == 2, "Got count %lu.\n", count);
     if (count > 0) CoTaskMemFree(mts[0]);
     if (count > 1) CoTaskMemFree(mts[1]);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 5);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 4);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK) CoTaskMemFree(mts[0]);
 
     IEnumMediaTypes_Release(enum1);
@@ -942,82 +942,82 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"Audio", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < 3; ++i)
     {
         hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-        todo_wine_if(i) ok(hr == S_OK, "Got hr %#x.\n", hr);
+        todo_wine_if(i) ok(hr == S_OK, "Got hr %#lx.\n", hr);
         if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat);
         if (hr == S_OK) CoTaskMemFree(mts[0]);
     }
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < 3; ++i)
     {
         hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-        todo_wine_if(i) ok(hr == S_OK, "Got hr %#x.\n", hr);
-        todo_wine_if(i) ok(count == 1, "Got count %u.\n", count);
+        todo_wine_if(i) ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        todo_wine_if(i) ok(count == 1, "Got count %lu.\n", count);
         if (hr == S_OK) CoTaskMemFree(mts[0]->pbFormat);
         if (hr == S_OK) CoTaskMemFree(mts[0]);
     }
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(count == 2, "Got count %u.\n", count);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(count == 2, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
     if (count > 1) CoTaskMemFree(mts[1]->pbFormat);
     if (count > 1) CoTaskMemFree(mts[1]);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    todo_wine ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    todo_wine ok(count == 1, "Got count %lu.\n", count);
     if (count) CoTaskMemFree(mts[0]->pbFormat);
     if (count) CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 4);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 3);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
@@ -1027,9 +1027,9 @@ static void test_enum_media_types(void)
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_unconnected_filter_state(void)
@@ -1040,53 +1040,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 struct testfilter
@@ -1166,7 +1166,7 @@ static HRESULT WINAPI testsource_AttemptConnection(struct strmbase_source *iface
 
     if (FAILED(hr = IPin_ReceiveConnection(peer, &iface->pin.IPin_iface, mt)))
     {
-        ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+        ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
         IPin_Release(peer);
         iface->pin.peer = NULL;
         FreeMediaType(&iface->pin.mt);
@@ -1221,16 +1221,16 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample
     HRESULT hr;
 
     hr = IMediaSample_GetTime(sample, &start, &end);
-    todo_wine_if (hr == VFW_S_NO_STOP_TIME) ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine_if (hr == VFW_S_NO_STOP_TIME) ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (winetest_debug > 1)
-        trace("%04x: Got sample with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
+        trace("%04lx: Got sample with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
 
     ok(filter->new_segment_count, "Expected NewSegment() before Receive().\n");
 
     IPin_QueryInterface(iface->pin.peer, &IID_IMediaSeeking, (void **)&seeking);
     hr = IMediaSeeking_GetPositions(seeking, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == filter->seek_start, "Expected start position %I64u, got %I64u.\n", filter->seek_start, start);
     ok(end == filter->seek_end, "Expected end position %I64u, got %I64u.\n", filter->seek_end, end);
     IMediaSeeking_Release(seeking);
@@ -1245,7 +1245,7 @@ static HRESULT testsink_eos(struct strmbase_sink *iface)
     struct testfilter *filter = impl_from_strmbase_filter(iface->pin.filter);
 
     if (winetest_debug > 1)
-        trace("%04x: Got EOS.\n", GetCurrentThreadId());
+        trace("%04lx: Got EOS.\n", GetCurrentThreadId());
 
     ok(!filter->eos_count, "Got %u EOS events.\n", filter->eos_count + 1);
     ++filter->eos_count;
@@ -1261,13 +1261,13 @@ static HRESULT testsink_new_segment(struct strmbase_sink *iface,
     HRESULT hr;
 
     if (winetest_debug > 1)
-        trace("%04x: Got segment with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
+        trace("%04lx: Got segment with timestamps %I64d-%I64d.\n", GetCurrentThreadId(), start, end);
 
     ++filter->new_segment_count;
 
     IPin_QueryInterface(iface->pin.peer, &IID_IMediaSeeking, (void **)&seeking);
     hr = IMediaSeeking_GetPositions(seeking, &filter->seek_start, &filter->seek_end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IMediaSeeking_Release(seeking);
 
     ok(start == filter->segment_start, "Expected start %I64d, got %I64d.\n", filter->segment_start, start);
@@ -1421,48 +1421,48 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(sink, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(sink, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Video;
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.majortype = MEDIATYPE_Stream;
 
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_MPEG1Audio;
 
     hr = IFilterGraph2_ConnectDirect(graph, &testsource.source.pin.IPin_iface, sink, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(sink, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &testsource.source.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(sink, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
     ok(compare_media_types(&testsource.source.pin.mt, &req_mt), "Media types didn't match.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Test source connection. */
 
@@ -1470,11 +1470,11 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(source, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(source, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     /* Exact connection. */
 
@@ -1484,71 +1484,71 @@ static void test_connect_pin(void)
     CopyMediaType(&req_mt, source_mt);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(source, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &testsink.sink.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(source, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
     ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, source);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(testsink.sink.pin.peer == source, "Got peer %p.\n", testsink.sink.pin.peer);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.lSampleSize = 999;
     req_mt.bTemporalCompression = req_mt.bFixedSizeSamples = TRUE;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.majortype = MEDIATYPE_Stream;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.majortype = MEDIATYPE_Audio;
 
     req_mt.subtype = MEDIASUBTYPE_PCM;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload;
 
     /* Connection with wildcards. */
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.majortype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
         ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
@@ -1556,24 +1556,24 @@ static void test_connect_pin(void)
 
     req_mt.subtype = MEDIASUBTYPE_PCM;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.formattype = FORMAT_None;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Audio;
     req_mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload;
     req_mt.formattype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
         ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
@@ -1581,38 +1581,38 @@ static void test_connect_pin(void)
 
     req_mt.subtype = MEDIASUBTYPE_PCM;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.subtype = GUID_NULL;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n");
     IFilterGraph2_Disconnect(graph, source);
     IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
 
     req_mt.majortype = MEDIATYPE_Stream;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     /* Test enumeration of sink media types. */
 
     testsink.mt = &req_mt;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#lx.\n", hr);
 
     req_mt.majortype = MEDIATYPE_Audio;
     req_mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload;
     req_mt.formattype = FORMAT_WaveFormatEx;
     req_mt.lSampleSize = 444;
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(compare_media_types(&testsink.sink.pin.mt, &req_mt), "Media types didn't match.\n");
 
     IPin_Release(source);
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, sink);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(testsource.source.pin.peer == sink, "Got peer %p.\n", testsource.source.pin.peer);
     IFilterGraph2_Disconnect(graph, &testsource.source.pin.IPin_iface);
 
@@ -1624,17 +1624,17 @@ static void test_connect_pin(void)
     IPin_Release(sink);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(reader);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsource.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_seeking(void)
@@ -1674,121 +1674,121 @@ static void test_seeking(void)
     IPin_QueryInterface(pin, &IID_IMediaSeeking, (void **)&seeking);
 
     hr = IMediaSeeking_GetCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards
             | AM_SEEKING_CanSeekBackwards | AM_SEEKING_CanGetStopPos
-            | AM_SEEKING_CanGetDuration), "Got caps %#x.\n", caps);
+            | AM_SEEKING_CanGetDuration), "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards), "Got caps %#x.\n", caps);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards), "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanGetCurrentPos;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(caps == AM_SEEKING_CanSeekAbsolute, "Got caps %#x.\n", caps);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(caps == AM_SEEKING_CanSeekAbsolute, "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanGetCurrentPos;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(!caps, "Got caps %#x.\n", caps);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(!caps, "Got caps %#lx.\n", caps);
 
     caps = 0;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(!caps, "Got caps %#x.\n", caps);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(!caps, "Got caps %#lx.\n", caps);
 
     for (i = 0; i < ARRAY_SIZE(format_tests); ++i)
     {
         hr = IMediaSeeking_IsFormatSupported(seeking, format_tests[i].guid);
-        ok(hr == format_tests[i].hr, "Got hr %#x for format %s.\n",
+        ok(hr == format_tests[i].hr, "Got hr %#lx for format %s.\n",
                 hr, wine_dbgstr_guid(format_tests[i].guid));
     }
 
     hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_FRAME);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     duration = 0;
     hr = IMediaSeeking_GetDuration(seeking, &duration);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(duration == 5392500, "Got duration %I64d.\n", duration);
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetStopPosition(seeking, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(stop == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
     hr = IMediaSeeking_GetCurrentPosition(seeking, &current);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     earliest = latest = 0xdeadbeef;
     hr = IMediaSeeking_GetAvailable(seeking, &earliest, &latest);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!earliest, "Got time %s.\n", wine_dbgstr_longlong(earliest));
     ok(latest == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(latest));
 
     rate = 0;
     hr = IMediaSeeking_GetRate(seeking, &rate);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(rate == 1.0, "Got rate %.16e.\n", rate);
 
     hr = IMediaSeeking_SetRate(seeking, 200.0);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     rate = 0;
     hr = IMediaSeeking_GetRate(seeking, &rate);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(rate == 200.0, "Got rate %.16e.\n", rate);
 
     hr = IMediaSeeking_SetRate(seeking, -1.0);
-    todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetPreroll(seeking, &time);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     current = 200 * 10000;
     stop = 400 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
@@ -1796,7 +1796,7 @@ static void test_seeking(void)
     stop = 400 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
             &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
@@ -1804,18 +1804,18 @@ static void test_seeking(void)
     stop = 200 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
             &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 100 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     current = 50 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             NULL, AM_SEEKING_NoPositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 50 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
@@ -1823,9 +1823,9 @@ static void test_seeking(void)
     IPin_Release(pin);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_streaming(void)
@@ -1849,21 +1849,21 @@ static void test_streaming(void)
     IPin_QueryInterface(source, &IID_IMediaSeeking, (void **)&seeking);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Expected timeout.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
     ok(testsink.sample_count, "Expected at least one sample.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
@@ -1874,7 +1874,7 @@ static void test_streaming(void)
     testsink.segment_end = 300 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &testsink.segment_start, AM_SEEKING_AbsolutePositioning,
             &testsink.segment_end, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
@@ -1882,14 +1882,14 @@ static void test_streaming(void)
 
     start = end = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == testsink.seek_start, "Expected start position %I64u, got %I64u.\n", testsink.seek_start, start);
     ok(end == testsink.seek_end, "Expected end position %I64u, got %I64u.\n", testsink.seek_end, end);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(!WaitForSingleObject(testsink.eos_event, 1000), "Did not receive EOS.\n");
     ok(WaitForSingleObject(testsink.eos_event, 100) == WAIT_TIMEOUT, "Got more than one EOS.\n");
@@ -1897,7 +1897,7 @@ static void test_streaming(void)
 
     start = end = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &start, &end);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(start == testsink.seek_start, "Expected start position %I64u, got %I64u.\n", testsink.seek_start, start);
     ok(end == testsink.seek_end, "Expected end position %I64u, got %I64u.\n", testsink.seek_end, end);
 
@@ -1905,13 +1905,13 @@ static void test_streaming(void)
     IPin_Release(source);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&testsink.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_large_file(void)
@@ -1949,17 +1949,17 @@ static void test_large_file(void)
 
     duration = 0xdeadbeef;
     hr = IMediaSeeking_GetDuration(seeking, &duration);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(duration == 2400 * 10000000ull, "Got duration %I64d.\n", duration);
 
     IMediaSeeking_Release(seeking);
     IPin_Release(source);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(path);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 START_TEST(mpegsplit)
diff --git a/dlls/quartz/tests/passthrough.c b/dlls/quartz/tests/passthrough.c
index ce7365928e5..0e542d1733a 100644
--- a/dlls/quartz/tests/passthrough.c
+++ b/dlls/quartz/tests/passthrough.c
@@ -74,53 +74,53 @@ static void test_aggregation(void)
     passthrough = (ISeekingPassThru *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_SeekingPassThru, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_ISeekingPassThru, (void **)&passthrough);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!passthrough, "Got interface %p.\n", passthrough);
 
     hr = CoCreateInstance(&CLSID_SeekingPassThru, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_ISeekingPassThru, (void **)&passthrough);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = ISeekingPassThru_QueryInterface(passthrough, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = ISeekingPassThru_QueryInterface(passthrough, &IID_ISeekingPassThru, (void **)&passthrough2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(passthrough2 == (ISeekingPassThru *)0xdeadbeef, "Got unexpected ISeekingPassThru %p.\n", passthrough2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = ISeekingPassThru_QueryInterface(passthrough, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     ISeekingPassThru_Release(passthrough);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 START_TEST(passthrough)
diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c
index 3b39d2aadb4..65bc406f35f 100644
--- a/dlls/quartz/tests/systemclock.c
+++ b/dlls/quartz/tests/systemclock.c
@@ -27,7 +27,7 @@ static IReferenceClock *create_system_clock(void)
     IReferenceClock *clock = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER,
             &IID_IReferenceClock, (void **)&clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return clock;
 }
 
@@ -48,7 +48,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -64,7 +64,7 @@ static void test_interfaces(void)
     check_interface(clock, &IID_IDirectDraw, FALSE);
 
     ref = IReferenceClock_Release(clock);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static const GUID test_iid = {0x33333333};
@@ -112,53 +112,53 @@ static void test_aggregation(void)
     clock = (IReferenceClock *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_SystemClock, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IReferenceClock, (void **)&clock);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!clock, "Got interface %p.\n", clock);
 
     hr = CoCreateInstance(&CLSID_SystemClock, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IReferenceClock, (void **)&clock);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_QueryInterface(clock, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IReferenceClock_QueryInterface(clock, &IID_IReferenceClock, (void **)&clock2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(clock2 == (IReferenceClock *)0xdeadbeef, "Got unexpected IReferenceClock %p.\n", clock2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IReferenceClock_QueryInterface(clock, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IReferenceClock_Release(clock);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_get_time(void)
@@ -169,17 +169,17 @@ static void test_get_time(void)
     ULONG ref;
 
     hr = IReferenceClock_GetTime(clock, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_GetTime(clock, &time1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time1 % 10000 == 0, "Expected no less than 1ms coarseness, but got time %s.\n",
             wine_dbgstr_longlong(time1));
 
     ticks = (REFERENCE_TIME)timeGetTime() * 10000;
 
     hr = IReferenceClock_GetTime(clock, &time2);
-    ok(hr == (time2 == time1 ? S_FALSE : S_OK), "Got hr %#x.\n", hr);
+    ok(hr == (time2 == time1 ? S_FALSE : S_OK), "Got hr %#lx.\n", hr);
     ok(time2 % 10000 == 0, "Expected no less than 1ms coarseness, but got time %s.\n",
             wine_dbgstr_longlong(time1));
 
@@ -187,12 +187,12 @@ static void test_get_time(void)
 
     Sleep(100);
     hr = IReferenceClock_GetTime(clock, &time2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time2 - time1 > 80 * 10000, "Expected about %s, but got %s.\n",
             wine_dbgstr_longlong(time1 + 80 * 10000), wine_dbgstr_longlong(time2));
 
     ref = IReferenceClock_Release(clock);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_advise(void)
@@ -209,72 +209,72 @@ static void test_advise(void)
     semaphore = CreateSemaphoreA(NULL, 0, 10, NULL);
 
     hr = IReferenceClock_GetTime(clock, &current);
-    ok(SUCCEEDED(hr), "Got hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_AdviseTime(clock, current, 500 * 10000, (HEVENT)event, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_AdviseTime(clock, -1000 * 10000, 500 * 10000, (HEVENT)event, &cookie);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_AdviseTime(clock, current, 500 * 10000, (HEVENT)event, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(WaitForSingleObject(event, 460) == WAIT_TIMEOUT, "Event should not be signaled.\n");
     ok(!WaitForSingleObject(event, 80), "Event should be signaled.\n");
 
     hr = IReferenceClock_Unadvise(clock, cookie);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     ResetEvent(event);
     hr = IReferenceClock_GetTime(clock, &current);
-    ok(SUCCEEDED(hr), "Got hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IReferenceClock_AdviseTime(clock, current, 500 * 10000, (HEVENT)event, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IReferenceClock_Unadvise(clock, cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(WaitForSingleObject(event, 540) == WAIT_TIMEOUT, "Event should not be signaled.\n");
 
     ResetEvent(event);
     hr = IReferenceClock_GetTime(clock, &current);
-    ok(SUCCEEDED(hr), "Got hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IReferenceClock_AdviseTime(clock, current + 500 * 10000, 0, (HEVENT)event, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(WaitForSingleObject(event, 460) == WAIT_TIMEOUT, "Event should not be signaled.\n");
     ok(!WaitForSingleObject(event, 80), "Event should be signaled.\n");
 
     hr = IReferenceClock_GetTime(clock, &current);
-    ok(SUCCEEDED(hr), "Got hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_AdvisePeriodic(clock, current, 500 * 10000, (HSEMAPHORE)semaphore, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_AdvisePeriodic(clock, current, 0, (HSEMAPHORE)semaphore, &cookie);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_AdvisePeriodic(clock, current, -500 * 10000, (HSEMAPHORE)semaphore, &cookie);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_AdvisePeriodic(clock, -500 * 10000, 1000 * 10000, (HSEMAPHORE)semaphore, &cookie);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IReferenceClock_AdvisePeriodic(clock, current, 100 * 10000, (HSEMAPHORE)semaphore, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!WaitForSingleObject(semaphore, 50), "Semaphore should be signaled.\n");
     for (i = 0; i < 5; ++i)
         ok(!WaitForSingleObject(semaphore, 500), "Semaphore should be signaled.\n");
 
     hr = IReferenceClock_Unadvise(clock, cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(WaitForSingleObject(semaphore, 200) == WAIT_TIMEOUT, "Semaphore should not be signaled.\n");
 
     ResetEvent(event);
     hr = IReferenceClock_GetTime(clock, &current);
-    ok(SUCCEEDED(hr), "Got hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr);
     hr = IReferenceClock_AdviseTime(clock, current, 500 * 10000, (HEVENT)event, &cookie);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ref = IReferenceClock_Release(clock);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
 
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
index ec212f1b5d6..c1a3266197b 100644
--- a/dlls/quartz/tests/videorenderer.c
+++ b/dlls/quartz/tests/videorenderer.c
@@ -28,7 +28,7 @@ static IBaseFilter *create_video_renderer(void)
     IBaseFilter *filter = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return filter;
 }
 
@@ -43,7 +43,7 @@ static IFilterGraph2 *create_graph(void)
     IFilterGraph2 *ret;
     HRESULT hr;
     hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret);
-    ok(hr == S_OK, "Failed to create FilterGraph: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return ret;
 }
 
@@ -64,7 +64,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -158,53 +158,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_VideoRenderer, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_VideoRenderer, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -217,85 +217,85 @@ static void test_enum_pins(void)
     ULONG ref;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
     IEnumPins_Release(enum1);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_find_pin(void)
@@ -307,23 +307,23 @@ static void test_find_pin(void)
     ULONG ref;
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum_pins);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
     IPin_Release(pin);
     IPin_Release(pin2);
 
     IEnumPins_Release(enum_pins);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_pin_info(void)
@@ -337,38 +337,38 @@ static void test_pin_info(void)
     IPin *pin;
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     todo_wine ok(!wcscmp(info.achName, L"Input"), "Got name %s.\n", debugstr_w(info.achName));
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"In"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     hr = IPin_QueryInternalConnections(pin, NULL, NULL);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_media_types(void)
@@ -397,10 +397,10 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"In", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &mt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
 
@@ -413,30 +413,30 @@ static void test_media_types(void)
     {
         req_mt.subtype = *subtype_tests[i];
         hr = IPin_QueryAccept(pin, &req_mt);
-        ok(hr == S_OK, "Got hr %#x for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
+        ok(hr == S_OK, "Got hr %#lx for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
     }
 
     req_mt.subtype = MEDIASUBTYPE_NULL;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_RGB24;
 
     req_mt.majortype = MEDIATYPE_NULL;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     req_mt.majortype = MEDIATYPE_Video;
 
     req_mt.formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     req_mt.formattype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_enum_media_types(void)
@@ -451,36 +451,36 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"In", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enum1);
     IEnumMediaTypes_Release(enum2);
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 struct testfilter
@@ -712,36 +712,36 @@ static void test_allocator(IMemInputPin *input)
     HRESULT hr;
 
     hr = IMemInputPin_GetAllocatorRequirements(input, &props);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &ret_allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (hr == S_OK)
     {
         hr = IMemAllocator_GetProperties(ret_allocator, &props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(!props.cBuffers, "Got %d buffers.\n", props.cBuffers);
-        ok(!props.cbBuffer, "Got size %d.\n", props.cbBuffer);
-        ok(!props.cbAlign, "Got alignment %d.\n", props.cbAlign);
-        ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
+        ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
+        ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
+        ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
 
         hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(ret_allocator);
     }
 
     hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
             &IID_IMemAllocator, (void **)&req_allocator);
 
     hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &ret_allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
 
     IMemAllocator_Release(req_allocator);
@@ -759,9 +759,9 @@ static DWORD WINAPI frame_thread(void *arg)
     struct frame_thread_params *params = arg;
     HRESULT hr;
 
-    if (winetest_debug > 1) trace("%04x: Sending frame.\n", GetCurrentThreadId());
+    if (winetest_debug > 1) trace("%04lx: Sending frame.\n", GetCurrentThreadId());
     hr = IMemInputPin_Receive(params->sink, params->sample);
-    if (winetest_debug > 1) trace("%04x: Returned %#x.\n", GetCurrentThreadId(), hr);
+    if (winetest_debug > 1) trace("%04lx: Returned %#lx.\n", GetCurrentThreadId(), hr);
     IMediaSample_Release(params->sample);
     free(params);
     return hr;
@@ -778,25 +778,25 @@ static HANDLE send_frame_time(IMemInputPin *sink, REFERENCE_TIME start_time, uns
     BYTE *data;
 
     hr = IMemInputPin_GetAllocator(sink, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     memset(data, color, 32 * 16 * 2);
 
     hr = IMediaSample_SetActualDataLength(sample, 32 * 16 * 2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start_time *= 10000000;
     end_time = start_time + 10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_SetPreroll(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     params->sink = sink;
     params->sample = sample;
@@ -831,129 +831,129 @@ static void test_filter_state(IMemInputPin *input, IMediaControl *control)
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     /* The renderer is not fully paused until it receives a sample. The thread
      * sending the sample blocks in IMemInputPin_Receive() until the filter is
      * stopped or run. */
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* The sink will decommit our allocator for us when stopping, and recommit
      * it when pausing. */
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    todo_wine ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
     if (hr == S_OK) IMediaSample_Release(sample);
 
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     thread = send_frame(input);
     hr = join_thread(thread);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMemAllocator_Release(allocator);
 }
@@ -965,54 +965,54 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
     HRESULT hr;
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* We dropped the sample we were holding, so now we need a new one... */
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(send_frame(input));
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input, IMediaControl *control)
@@ -1026,32 +1026,32 @@ static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input
     IBaseFilter_QueryInterface(filter, &IID_IMediaSeeking, (void **)&seeking);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == 0xdeadbeef, "Got hr %#x.\n", hr);
+    ok(hr == 0xdeadbeef, "Got hr %#lx.\n", hr);
 
     thread = send_frame_time(input, 1, 0x11); /* dark blue */
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 10000000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 500) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Sample time is relative to the time passed to Run(). Thus a sample
      * stamped at or earlier than 1s will now be displayed immediately, because
@@ -1063,38 +1063,38 @@ static void test_sample_time(IBaseFilter *filter, IPin *pin, IMemInputPin *input
      * are marked as discontinuous. */
 
     hr = join_thread(send_frame_time(input, 1, 0x22)); /* dark green */
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(send_frame_time(input, 0, 0x33)); /* light green */
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(send_frame_time(input, -2, 0x44)); /* dark red */
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame_time(input, 2, 0x66); /* orange */
     ok(WaitForSingleObject(thread, 500) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame_time(input, 1000000, 0xff); /* white */
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = join_thread(thread);
     /* If the frame makes it to Receive() in time to be rendered, we get S_OK. */
-    ok(hr == S_OK || hr == E_FAIL, "Got hr %#x.\n", hr);
+    ok(hr == S_OK || hr == E_FAIL, "Got hr %#lx.\n", hr);
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame_time(input, 1000000, 0xff);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = join_thread(thread);
     /* If the frame makes it to Receive() in time to be rendered, we get S_OK. */
-    ok(hr == S_OK || hr == E_FAIL, "Got hr %#x.\n", hr);
+    ok(hr == S_OK || hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     IMediaSeeking_Release(seeking);
 }
@@ -1110,14 +1110,14 @@ static unsigned int check_event_code(IMediaEvent *eventsrc, DWORD timeout, LONG
     {
         if (code == expected_code)
         {
-            ok(param1 == expected1, "Got param1 %#lx.\n", param1);
-            ok(param2 == expected2, "Got param2 %#lx.\n", param2);
+            ok(param1 == expected1, "Got param1 %#Ix.\n", param1);
+            ok(param2 == expected2, "Got param2 %#Ix.\n", param2);
             ret++;
         }
         IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
         timeout = 0;
     }
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     return ret;
 }
@@ -1137,28 +1137,28 @@ static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
     IMediaControl_QueryInterface(control, &IID_IMediaEvent, (void **)&eventsrc);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = join_thread(send_frame(input));
-    todo_wine ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_UNEXPECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Expected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
@@ -1166,73 +1166,73 @@ static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
      * done rendering. */
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
     ret = check_ec_complete(eventsrc, 1600);
     todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     /* Test sending EOS while flushing. */
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndOfStream(pin);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     /* Test sending EOS and then flushing or stopping. */
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
@@ -1254,43 +1254,43 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
     IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video);
 
     hr = IBasicVideo_GetCurrentImage(video, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetCurrentImage(video, NULL, buffer);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     size = 0xdeadbeef;
     hr = IBasicVideo_GetCurrentImage(video, &size, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 2, "Got size %d.\n", size);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 2, "Got size %ld.\n", size);
 
     size = 0xdeadbeef;
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == VFW_E_NOT_PAUSED, "Got hr %#x.\n", hr);
-    ok(size == 0xdeadbeef, "Got size %d.\n", size);
+    ok(hr == VFW_E_NOT_PAUSED, "Got hr %#lx.\n", hr);
+    ok(size == 0xdeadbeef, "Got size %ld.\n", size);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     size = 0xdeadbeef;
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
-    ok(size == 0xdeadbeef, "Got size %d.\n", size);
+    ok(hr == E_UNEXPECTED, "Got hr %#lx.\n", hr);
+    ok(size == 0xdeadbeef, "Got size %ld.\n", size);
 
     thread = send_frame(input);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     size = sizeof(BITMAPINFOHEADER) + 32 * 16 * 2 - 1;
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == E_OUTOFMEMORY, "Got hr %#x.\n", hr);
-    ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 2 - 1, "Got size %d.\n", size);
+    ok(hr == E_OUTOFMEMORY, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 2 - 1, "Got size %ld.\n", size);
 
     size = sizeof(BITMAPINFOHEADER) + 32 * 16 * 2;
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 2, "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 2, "Got size %ld.\n", size);
     ok(!memcmp(bih, expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     for (i = 0; i < 32 * 16 * 2; ++i)
     {
@@ -1299,14 +1299,14 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
     }
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     join_thread(thread);
 
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == VFW_E_NOT_PAUSED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_PAUSED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IBasicVideo_Release(video);
 }
@@ -1330,18 +1330,18 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
 
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IOverlay_Release(overlay);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
     SendMessageW(hwnd, WM_CLOSE, 0, 0);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(ret == 1, "Expected EC_USERABORT.\n");
 
@@ -1354,28 +1354,28 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     if (ret == WAIT_OBJECT_0)
     {
         GetExitCodeThread(thread, (DWORD *)&hr);
-        ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
+        ok(hr == E_UNEXPECTED, "Got hr %#lx.\n", hr);
     }
     CloseHandle(thread);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
     /* We receive an EC_USERABORT notification immediately. */
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
@@ -1388,7 +1388,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
@@ -1446,52 +1446,52 @@ static void test_connect_pin(void)
     {
         req_mt.subtype = *subtype_tests[i];
         hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-        ok(hr == S_OK, "Got hr %#x for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
+        ok(hr == S_OK, "Got hr %#lx for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
 
         hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IFilterGraph2_Disconnect(graph, pin);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
     }
 
     req_mt.formattype = FORMAT_None;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.formattype = FORMAT_VideoInfo;
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &source.source.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
 
@@ -1499,17 +1499,17 @@ static void test_connect_pin(void)
 
     hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
             &IID_IMemAllocator, (void **)&allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
     hr = IMemInputPin_NotifyAllocator(input, allocator, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_ReceiveCanBlock(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     test_filter_state(input, control);
     test_flushing(pin, input, control);
@@ -1519,31 +1519,31 @@ static void test_connect_pin(void)
     test_window_close(pin, input, control);
 
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(source.source.pin.peer == pin, "Got peer %p.\n", peer);
     IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     ref = IMemAllocator_Release(allocator);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IMemInputPin_Release(input);
     IPin_Release(pin);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_filter_state(void)
@@ -1554,53 +1554,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_overlay(void)
@@ -1615,17 +1615,17 @@ static void test_overlay(void)
     IBaseFilter_FindPin(filter, L"In", &pin);
 
     hr = IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hwnd = (HWND)0xdeadbeef;
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(hwnd && hwnd != (HWND)0xdeadbeef, "Got invalid window %p.\n", hwnd);
 
     IOverlay_Release(overlay);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 /* try to make sure pending X events have been processed before continuing */
@@ -1649,7 +1649,7 @@ static void flush_events(void)
 static LRESULT CALLBACK window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 {
     if (winetest_debug > 1)
-        trace("hwnd %p, msg %#x, wparam %#lx, lparam %#lx.\n", hwnd, msg, wparam, lparam);
+        trace("hwnd %p, msg %#x, wparam %#Ix, lparam %#Ix.\n", hwnd, msg, wparam, lparam);
 
     if (wparam == 0xdeadbeef)
         return 0;
@@ -1664,7 +1664,7 @@ static void test_video_window_caption(IVideoWindow *window, HWND hwnd)
     HRESULT hr;
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(caption, L"ActiveMovie Window"), "Got caption %s.\n", wine_dbgstr_w(caption));
     SysFreeString(caption);
 
@@ -1673,11 +1673,11 @@ static void test_video_window_caption(IVideoWindow *window, HWND hwnd)
 
     caption = SysAllocString(L"foo");
     hr = IVideoWindow_put_Caption(window, caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SysFreeString(caption);
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(caption, L"foo"), "Got caption %s.\n", wine_dbgstr_w(caption));
     SysFreeString(caption);
 
@@ -1691,53 +1691,53 @@ static void test_video_window_style(IVideoWindow *window, HWND hwnd, HWND our_hw
     LONG style;
 
     hr = IVideoWindow_get_WindowStyle(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(style == (WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW),
-            "Got style %#x.\n", style);
+            "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
     ok(style == (WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW),
-            "Got style %#x.\n", style);
+            "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_WindowStyle(window, style | WS_DISABLED);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_HSCROLL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_VSCROLL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_MAXIMIZE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_MINIMIZE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_WindowStyle(window, style & ~WS_CLIPCHILDREN);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyle(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#x.\n", style);
+    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_get_WindowStyleEx(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == WS_EX_WINDOWEDGE, "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == WS_EX_WINDOWEDGE, "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_EXSTYLE);
-    ok(style == WS_EX_WINDOWEDGE, "Got style %#x.\n", style);
+    ok(style == WS_EX_WINDOWEDGE, "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_WindowStyleEx(window, style | WS_EX_TRANSPARENT);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyleEx(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_EXSTYLE);
-    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#x.\n", style);
+    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#lx.\n", style);
 }
 
 static BOOL CALLBACK top_window_cb(HWND hwnd, LPARAM ctx)
@@ -1768,25 +1768,25 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
     ok(!IsZoomed(hwnd), "Window should not be maximized.\n");
 
     hr = IVideoWindow_put_WindowState(window, SW_SHOWNA);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1796,14 +1796,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(top == hwnd, "Got top window %p.\n", top);
 
     hr = IVideoWindow_put_WindowState(window, SW_MINIMIZE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_MINIMIZE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_MINIMIZE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(IsIconic(hwnd), "Window should be minimized.\n");
@@ -1811,14 +1811,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_RESTORE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1826,14 +1826,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_MAXIMIZE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_MAXIMIZE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_MAXIMIZE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should be minimized.\n");
@@ -1841,17 +1841,17 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_RESTORE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_WindowState(window, SW_HIDE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1859,14 +1859,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_Visible(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1874,14 +1874,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1889,14 +1889,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_SHOWNA);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_SetWindowForeground(window, TRUE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     hr = IVideoWindow_SetWindowForeground(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -1904,7 +1904,7 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(top == hwnd, "Got top window %p.\n", top);
 
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -1913,7 +1913,7 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
 
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == our_hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == our_hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -1935,114 +1935,114 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
     expect_height = rect.bottom - rect.top;
 
     hr = IVideoWindow_put_Left(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_Top(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 0, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 0, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == expect_height, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 0, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 0, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == expect_height, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 0, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 0, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == expect_height, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_put_Left(window, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == expect_height, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == expect_height, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 10, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 10, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 10 + expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == expect_height, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_put_Height(window, 200);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == 200, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == 200, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == 200, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == 200, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 10, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == 200, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 10, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 10 + expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == 200, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_SetWindowPosition(window, 100, 200, 300, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 100, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 100, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 200, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 200, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 300, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 300, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == 400, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 100, "Got left %d.\n", left);
-    ok(top == 200, "Got top %d.\n", top);
-    ok(width == 300, "Got width %d.\n", width);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 100, "Got left %ld.\n", left);
+    ok(top == 200, "Got top %ld.\n", top);
+    ok(width == 300, "Got width %ld.\n", width);
+    ok(height == 400, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 100, "Got window left %d.\n", rect.left);
-    ok(rect.top == 200, "Got window top %d.\n", rect.top);
-    ok(rect.right == 400, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == 600, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 100, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 200, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 400, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == 600, "Got window bottom %ld.\n", rect.bottom);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
@@ -2059,25 +2059,25 @@ static void test_video_window_owner(IVideoWindow *window, HWND hwnd, HWND our_hw
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == GetDesktopWindow(), "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(!(style & WS_CHILD), "Got style %#x.\n", style);
+    ok(!(style & WS_CHILD), "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_Owner(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(oahwnd == (OAHWND)our_hwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(oahwnd == (OAHWND)our_hwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == our_hwnd, "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok((style & WS_CHILD), "Got style %#x.\n", style);
+    ok((style & WS_CHILD), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
@@ -2086,31 +2086,31 @@ static void test_video_window_owner(IVideoWindow *window, HWND hwnd, HWND our_hw
     ShowWindow(our_hwnd, SW_HIDE);
 
     hr = IVideoWindow_put_Visible(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_put_Owner(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == GetDesktopWindow(), "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(!(style & WS_CHILD), "Got style %#x.\n", style);
+    ok(!(style & WS_CHILD), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
     ok(top_hwnd == hwnd, "Got top window %p.\n", top_hwnd);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 }
 
 struct notify_message_params
@@ -2124,7 +2124,7 @@ static DWORD CALLBACK notify_message_proc(void *arg)
 {
     const struct notify_message_params *params = arg;
     HRESULT hr = IVideoWindow_NotifyOwnerMessage(params->window, (OAHWND)params->hwnd, params->message, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return 0;
 }
 
@@ -2167,15 +2167,15 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     flush_events();
 
     hr = IVideoWindow_get_MessageDrain(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got window %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got window %#Ix.\n", oahwnd);
 
     hr = IVideoWindow_put_MessageDrain(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_MessageDrain(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(oahwnd == (OAHWND)our_hwnd, "Got window %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(oahwnd == (OAHWND)our_hwnd, "Got window %#Ix.\n", oahwnd);
 
     for (i = 0; i < ARRAY_SIZE(drain_tests); ++i)
     {
@@ -2184,8 +2184,8 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
         ok(ret, "Expected a message.\n");
         ok(msg.hwnd == our_hwnd, "Got hwnd %p.\n", msg.hwnd);
         ok(msg.message == drain_tests[i], "Got message %#x.\n", msg.message);
-        ok(msg.wParam == 0xdeadbeef, "Got wparam %#lx.\n", msg.wParam);
-        ok(!msg.lParam, "Got lparam %#lx.\n", msg.lParam);
+        ok(msg.wParam == 0xdeadbeef, "Got wparam %#Ix.\n", msg.wParam);
+        ok(!msg.lParam, "Got lparam %#Ix.\n", msg.lParam);
         DispatchMessageA(&msg);
 
         ret = PeekMessageA(&msg, 0, drain_tests[i], drain_tests[i], PM_REMOVE);
@@ -2193,10 +2193,10 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_put_MessageDrain(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_Owner(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     flush_events();
 
@@ -2205,7 +2205,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
      * posted all messages. */
 
     hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SYSCOLORCHANGE, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
@@ -2214,7 +2214,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_FONTCHANGE, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
@@ -2251,7 +2251,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_put_Owner(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static void test_video_window_autoshow(IVideoWindow *window, IFilterGraph2 *graph, HWND hwnd)
@@ -2263,41 +2263,41 @@ static void test_video_window_autoshow(IVideoWindow *window, IFilterGraph2 *grap
     IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
 
     hr = IVideoWindow_get_AutoShow(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IVideoWindow_put_AutoShow(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OAFALSE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OAFALSE, "Got %ld.\n", l);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaControl_Release(control);
 }
@@ -2351,36 +2351,36 @@ static void test_video_window(void)
     IBaseFilter_FindPin(filter, L"In", &pin);
 
     hr = IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_debug > 1) trace("ours %p, theirs %p\n", our_hwnd, hwnd);
     GetWindowRect(hwnd, &rect);
 
     tid = GetWindowThreadProcessId(hwnd, NULL);
-    ok(tid == GetCurrentThreadId(), "Expected tid %#x, got %#x.\n", GetCurrentThreadId(), tid);
+    ok(tid == GetCurrentThreadId(), "Expected tid %#lx, got %#lx.\n", GetCurrentThreadId(), tid);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IVideoWindow, (void **)&window);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyle(window, &l);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_AutoShow(window, &l);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     testfilter_init(&source);
     IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
     IFilterGraph2_AddFilter(graph, filter, NULL);
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
@@ -2393,29 +2393,29 @@ static void test_video_window(void)
     test_video_window_messages(window, hwnd, our_hwnd);
 
     hr = IVideoWindow_put_FullScreenMode(window, OATRUE);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_FullScreenMode(window, &l);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_GetMinIdealImageSize(window, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 640, "Got width %d.\n", width);
-    ok(height == 480, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 640, "Got width %ld.\n", width);
+    ok(height == 480, "Got height %ld.\n", height);
 
     hr = IVideoWindow_GetMaxIdealImageSize(window, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 640, "Got width %d.\n", width);
-    ok(height == 480, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 640, "Got width %ld.\n", width);
+    ok(height == 480, "Got height %ld.\n", height);
 
     IFilterGraph2_Release(graph);
     IVideoWindow_Release(window);
     IOverlay_Release(overlay);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(our_hwnd);
 }
 
@@ -2427,31 +2427,31 @@ static void check_source_position_(int line, IBasicVideo *video,
 
     left = top = width = height = 0xdeadbeef;
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, &width, &height);
-    ok_(__FILE__,line)(hr == S_OK, "Got hr %#x.\n", hr);
-    ok_(__FILE__,line)(left == expect_left, "Got left %d.\n", left);
-    ok_(__FILE__,line)(top == expect_top, "Got top %d.\n", top);
-    ok_(__FILE__,line)(width == expect_width, "Got width %d.\n", width);
-    ok_(__FILE__,line)(height == expect_height, "Got height %d.\n", height);
+    ok_(__FILE__,line)(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok_(__FILE__,line)(left == expect_left, "Got left %ld.\n", left);
+    ok_(__FILE__,line)(top == expect_top, "Got top %ld.\n", top);
+    ok_(__FILE__,line)(width == expect_width, "Got width %ld.\n", width);
+    ok_(__FILE__,line)(height == expect_height, "Got height %ld.\n", height);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceLeft(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == left, "Got left %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == left, "Got left %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceTop(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == top, "Got top %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == top, "Got top %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceWidth(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == width, "Got width %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == width, "Got width %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceHeight(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == height, "Got height %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == height, "Got height %ld.\n", l);
 }
 #define check_source_position(a,b,c,d,e) check_source_position_(__LINE__,a,b,c,d,e)
 
@@ -2461,77 +2461,77 @@ static void test_basic_video_source(IBasicVideo *video)
 
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceLeft(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceLeft(video, 10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceTop(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(video, 10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceWidth(video, -500);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 700);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 500, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceHeight(video, -300);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 600);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceLeft(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceLeft(video, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 10, 0, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceTop(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(video, 20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 10, 20, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 4, 5, 60, 40);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 0, 0, 600, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDefaultSourcePosition(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static void check_destination_position_(int line, IBasicVideo *video,
@@ -2542,31 +2542,31 @@ static void check_destination_position_(int line, IBasicVideo *video,
 
     left = top = width = height = 0xdeadbeef;
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, &width, &height);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get position, hr %#x.\n", hr);
-    ok_(__FILE__,line)(left == expect_left, "Got left %d.\n", left);
-    ok_(__FILE__,line)(top == expect_top, "Got top %d.\n", top);
-    ok_(__FILE__,line)(width == expect_width, "Got width %d.\n", width);
-    ok_(__FILE__,line)(height == expect_height, "Got height %d.\n", height);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get position, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(left == expect_left, "Got left %ld.\n", left);
+    ok_(__FILE__,line)(top == expect_top, "Got top %ld.\n", top);
+    ok_(__FILE__,line)(width == expect_width, "Got width %ld.\n", width);
+    ok_(__FILE__,line)(height == expect_height, "Got height %ld.\n", height);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationLeft(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == left, "Got left %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == left, "Got left %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationTop(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == top, "Got top %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == top, "Got top %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationWidth(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == width, "Got width %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == width, "Got width %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationHeight(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == height, "Got height %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == height, "Got height %ld.\n", l);
 }
 #define check_destination_position(a,b,c,d,e) check_destination_position_(__LINE__,a,b,c,d,e)
 
@@ -2580,107 +2580,107 @@ static void test_basic_video_destination(IBasicVideo *video)
 
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationLeft(video, -10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, -10, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationLeft(video, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationTop(video, -20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, -20, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationTop(video, 20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationWidth(video, -700);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationWidth(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationWidth(video, 700);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 700, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationWidth(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationHeight(video, -500);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationHeight(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationHeight(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 500);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationHeight(video, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 4, 5, 60, 40);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 0, 0, 600, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDefaultDestinationPosition(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     SetRect(&rect, 100, 200, 500, 500);
     AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
     hr = IVideoWindow_SetWindowPosition(window, rect.left, rect.top,
             rect.right - rect.left, rect.bottom - rect.top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 0, 0, 400, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     SetRect(&rect, 100, 200, 600, 600);
     AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
     hr = IVideoWindow_SetWindowPosition(window, rect.left, rect.top,
             rect.right - rect.left, rect.bottom - rect.top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IVideoWindow_Release(window);
 }
@@ -2725,127 +2725,127 @@ static void test_basic_video(void)
     IBaseFilter_FindPin(filter, L"In", &pin);
 
     hr = IBasicVideo_GetTypeInfoCount(video, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(count == 1, "Got count %u.\n", count);
 
     hr = IBasicVideo_GetTypeInfo(video, 0, 0, &typeinfo);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind);
     ok(IsEqualGUID(&typeattr->guid, &IID_IBasicVideo), "Got IID %s.\n", wine_dbgstr_guid(&typeattr->guid));
     ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
     ITypeInfo_Release(typeinfo);
 
     hr = IBasicVideo_get_AvgTimePerFrame(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_AvgTimePerFrame(video, &reftime);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_BitRate(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_BitRate(video, &l);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_BitErrorRate(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_BitErrorRate(video, &l);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_VideoWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_VideoHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_SourceLeft(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceTop(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_DestinationLeft(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationTop(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetSourcePosition(video, NULL, &top, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, NULL, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetDestinationPosition(video, NULL, &top, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, NULL, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetVideoSize(video, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoSize(video, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, NULL, &l);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, &l, NULL);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     testfilter_init(&source);
     IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, L"vmr9");
     IFilterGraph2_AddFilter(graph, filter, L"source");
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     reftime = 0.0;
     hr = IBasicVideo_get_AvgTimePerFrame(video, &reftime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(reftime == 0.02, "Got frame rate %.16e.\n", reftime);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_BitRate(video, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!l, "Got bit rate %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!l, "Got bit rate %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_BitErrorRate(video, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!l, "Got bit rate %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!l, "Got bit rate %ld.\n", l);
 
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, &l, NULL);
-    todo_wine ok(hr == VFW_E_NO_PALETTE_AVAILABLE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NO_PALETTE_AVAILABLE, "Got hr %#lx.\n", hr);
 
     width = height = 0xdeadbeef;
     hr = IBasicVideo_GetVideoSize(video, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 600, "Got width %d.\n", width);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 600, "Got width %ld.\n", width);
+    ok(height == 400, "Got height %ld.\n", height);
 
     test_basic_video_source(video);
     test_basic_video_destination(video);
 
     hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     vih.bmiHeader.biWidth = 16;
     vih.bmiHeader.biHeight = 16;
     vih.bmiHeader.biSizeImage = 0;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_source_position(video, 0, 0, 16, 16);
 
@@ -2855,13 +2855,13 @@ static void test_basic_video(void)
             max(16, GetSystemMetrics(SM_CYMIN) - (rect.bottom - rect.top)));
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IBasicVideo_Release(video);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_eos(void)
@@ -2875,49 +2875,49 @@ static void test_unconnected_eos(void)
     ULONG ref;
 
     hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
@@ -2925,9 +2925,9 @@ static void test_unconnected_eos(void)
     IMediaControl_Release(control);
     IMediaEvent_Release(eventsrc);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 START_TEST(videorenderer)
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c
index efc876a845c..2cff39a867c 100644
--- a/dlls/quartz/tests/vmr7.c
+++ b/dlls/quartz/tests/vmr7.c
@@ -32,13 +32,13 @@ static IBaseFilter *create_vmr7(DWORD mode)
     IVMRFilterConfig *config;
     HRESULT hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (mode)
     {
         hr = IBaseFilter_QueryInterface(filter, &IID_IVMRFilterConfig, (void **)&config);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IVMRFilterConfig_SetRenderingMode(config, mode);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IVMRFilterConfig_Release(config);
     }
     return filter;
@@ -50,10 +50,10 @@ static HRESULT set_mixing_mode(IBaseFilter *filter)
     HRESULT hr;
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IVMRFilterConfig, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_SetNumberOfStreams(config, 2);
-    todo_wine ok(hr == VFW_E_DDRAW_CAPS_NOT_SUITABLE || hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_DDRAW_CAPS_NOT_SUITABLE || hr == S_OK, "Got hr %#lx.\n", hr);
 
     IVMRFilterConfig_Release(config);
     return hr;
@@ -87,7 +87,7 @@ static IFilterGraph2 *create_graph(void)
     IFilterGraph2 *ret;
     HRESULT hr;
     hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret);
-    ok(hr == S_OK, "Failed to create FilterGraph: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return ret;
 }
 
@@ -107,101 +107,101 @@ static void test_filter_config(void)
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER,
             &IID_IVMRFilterConfig, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMRMode_Windowed, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMRMode_Windowed, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig_SetRenderingMode(config, VMRMode_Windowed);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMRMode_Windowed, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMRMode_Windowed, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig_SetRenderingMode(config, VMRMode_Windowed);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     ref = IVMRFilterConfig_Release(config);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER,
             &IID_IVMRFilterConfig, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_SetRenderingMode(config, VMRMode_Windowless);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMRMode_Windowless, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMRMode_Windowless, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig_SetRenderingMode(config, VMRMode_Windowed);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     ref = IVMRFilterConfig_Release(config);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER,
             &IID_IVMRFilterConfig, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_SetRenderingMode(config, VMRMode_Renderless);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMRMode_Renderless, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMRMode_Renderless, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig_SetRenderingMode(config, VMRMode_Windowless);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     ref = IVMRFilterConfig_Release(config);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER,
             &IID_IVMRFilterConfig, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_GetNumberOfStreams(config, &count);
-    todo_wine ok(hr == VFW_E_VMR_NOT_IN_MIXER_MODE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_VMR_NOT_IN_MIXER_MODE, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig_SetNumberOfStreams(config, 3);
     if (hr != VFW_E_DDRAW_CAPS_NOT_SUITABLE)
     {
-        todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+        todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IVMRFilterConfig_GetNumberOfStreams(config, &count);
         todo_wine {
-            ok(hr == S_OK, "Got hr %#x.\n", hr);
-            ok(count == 3, "Got count %u.\n", count);
+            ok(hr == S_OK, "Got hr %#lx.\n", hr);
+            ok(count == 3, "Got count %lu.\n", count);
         }
 
         hr = IVMRFilterConfig_GetRenderingMode(config, &mode);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(mode == VMRMode_Windowed, "Got mode %#x.\n", mode);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(mode == VMRMode_Windowed, "Got mode %#lx.\n", mode);
 
         /* Despite MSDN, you can still change the rendering mode after setting the
          * stream count. */
         hr = IVMRFilterConfig_SetRenderingMode(config, VMRMode_Windowless);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IVMRFilterConfig_GetRenderingMode(config, &mode);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(mode == VMRMode_Windowless, "Got mode %#x.\n", mode);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(mode == VMRMode_Windowless, "Got mode %#lx.\n", mode);
 
         hr = IVMRFilterConfig_GetNumberOfStreams(config, &count);
         todo_wine {
-            ok(hr == S_OK, "Got hr %#x.\n", hr);
-            ok(count == 3, "Got count %u.\n", count);
+            ok(hr == S_OK, "Got hr %#lx.\n", hr);
+            ok(count == 3, "Got count %lu.\n", count);
         }
     }
     else
         skip("Mixing mode is not supported.\n");
 
     ref = IVMRFilterConfig_Release(config);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
@@ -214,7 +214,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -336,7 +336,7 @@ static void test_interfaces(void)
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static const GUID test_iid = {0x33333333};
@@ -384,53 +384,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -442,79 +442,79 @@ static void test_enum_pins(void)
     HRESULT hr;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
@@ -522,37 +522,37 @@ static void test_enum_pins(void)
     if (SUCCEEDED(set_mixing_mode(filter)))
     {
         hr = IEnumPins_Next(enum1, 1, pins, NULL);
-        todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+        todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
         hr = IEnumPins_Reset(enum1);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IEnumPins_Next(enum1, 1, pins, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IPin_Release(pins[0]);
 
         hr = IEnumPins_Next(enum1, 1, pins, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IPin_Release(pins[0]);
 
         hr = IEnumPins_Next(enum1, 1, pins, NULL);
-        ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+        ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
         hr = IEnumPins_Reset(enum1);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IEnumPins_Next(enum1, 2, pins, &count);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(count == 2, "Got count %u.\n", count);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(count == 2, "Got count %lu.\n", count);
         IPin_Release(pins[0]);
         IPin_Release(pins[1]);
 
         hr = IEnumPins_Reset(enum1);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IEnumPins_Next(enum1, 3, pins, &count);
-        ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-        ok(count == 2, "Got count %u.\n", count);
+        ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+        ok(count == 2, "Got count %lu.\n", count);
         IPin_Release(pins[0]);
         IPin_Release(pins[1]);
     }
@@ -561,7 +561,7 @@ static void test_enum_pins(void)
 
     IEnumPins_Release(enum1);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_find_pin(void)
@@ -575,51 +575,51 @@ static void test_find_pin(void)
     IBaseFilter_EnumPins(filter, &enum_pins);
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Pins did not match.\n");
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IBaseFilter_FindPin(filter, L"VMR input1", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     if (SUCCEEDED(set_mixing_mode(filter)))
     {
         IEnumPins_Reset(enum_pins);
 
         hr = IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(pin == pin2, "Pins did not match.\n");
         IPin_Release(pin);
         IPin_Release(pin2);
 
         hr = IBaseFilter_FindPin(filter, L"VMR Input1", &pin);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(pin == pin2, "Pins did not match.\n");
         IPin_Release(pin);
         IPin_Release(pin2);
 
         hr = IBaseFilter_FindPin(filter, L"VMR Input2", &pin);
-        ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+        ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
     }
     else
         skip("Mixing mode is not supported.\n");
 
     IEnumPins_Release(enum_pins);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_pin_info(void)
@@ -640,16 +640,16 @@ static void test_pin_info(void)
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"VMR Input0"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     hr = IPin_QueryInternalConnections(pin, NULL, &count);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
 
@@ -663,16 +663,16 @@ static void test_pin_info(void)
         IBaseFilter_Release(info.pFilter);
 
         hr = IPin_QueryDirection(pin, &dir);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
         hr = IPin_QueryId(pin, &id);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!wcscmp(id, L"VMR Input1"), "Got id %s.\n", wine_dbgstr_w(id));
         CoTaskMemFree(id);
 
         hr = IPin_QueryInternalConnections(pin, NULL, &count);
-        ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+        ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
         IPin_Release(pin);
     }
@@ -680,7 +680,7 @@ static void test_pin_info(void)
         skip("Mixing mode is not supported.\n");
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_media_types(void)
@@ -709,10 +709,10 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &mt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
 
@@ -725,30 +725,30 @@ static void test_media_types(void)
     {
         req_mt.subtype = *subtype_tests[i];
         hr = IPin_QueryAccept(pin, &req_mt);
-        ok(hr == S_OK, "Got hr %#x for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
+        ok(hr == S_OK, "Got hr %#lx for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
     }
 
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IPin_QueryAccept(pin, &req_mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_RGB24;
 
     req_mt.majortype = MEDIATYPE_NULL;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     req_mt.majortype = MEDIATYPE_Video;
 
     req_mt.formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     req_mt.formattype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_enum_media_types(void)
@@ -763,36 +763,36 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enum1);
     IEnumMediaTypes_Release(enum2);
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_filter_state(void)
@@ -803,53 +803,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 struct testfilter
@@ -910,45 +910,45 @@ static void test_allocator(IMemInputPin *input)
     HRESULT hr;
 
     hr = IMemInputPin_GetAllocatorRequirements(input, &props);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &ret_allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (hr == S_OK)
     {
         hr = IMemAllocator_GetProperties(ret_allocator, &props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(!props.cBuffers, "Got %d buffers.\n", props.cBuffers);
-        ok(!props.cbBuffer, "Got size %d.\n", props.cbBuffer);
-        ok(!props.cbAlign, "Got alignment %d.\n", props.cbAlign);
-        ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
+        ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
+        ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
+        ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
 
         hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         req_props.cBuffers = 1;
         req_props.cbBuffer = 32 * 16 * 4;
         req_props.cbAlign = 1;
         req_props.cbPrefix = 0;
         hr = IMemAllocator_SetProperties(ret_allocator, &req_props, &props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(props.cBuffers == 1, "Got %d buffers.\n", props.cBuffers);
-        ok(props.cbBuffer == 32 * 16 * 4, "Got size %d.\n", props.cbBuffer);
-        ok(props.cbAlign == 1, "Got alignment %d.\n", props.cbAlign);
-        ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(props.cBuffers == 1, "Got %ld buffers.\n", props.cBuffers);
+        ok(props.cbBuffer == 32 * 16 * 4, "Got size %ld.\n", props.cbBuffer);
+        ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign);
+        ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
 
         IMemAllocator_Release(ret_allocator);
     }
 
     hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
             &IID_IMemAllocator, (void **)&req_allocator);
 
     hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     IMemAllocator_Release(req_allocator);
 }
@@ -964,9 +964,9 @@ static DWORD WINAPI frame_thread(void *arg)
     struct frame_thread_params *params = arg;
     HRESULT hr;
 
-    if (winetest_debug > 1) trace("%04x: Sending frame.\n", GetCurrentThreadId());
+    if (winetest_debug > 1) trace("%04lx: Sending frame.\n", GetCurrentThreadId());
     hr = IMemInputPin_Receive(params->sink, params->sample);
-    if (winetest_debug > 1) trace("%04x: Returned %#x.\n", GetCurrentThreadId(), hr);
+    if (winetest_debug > 1) trace("%04lx: Returned %#lx.\n", GetCurrentThreadId(), hr);
     IMediaSample_Release(params->sample);
     free(params);
     return hr;
@@ -983,25 +983,25 @@ static HANDLE send_frame(IMemInputPin *sink)
     BYTE *data;
 
     hr = IMemInputPin_GetAllocator(sink, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     memset(data, 0x55, IMediaSample_GetSize(sample));
 
     hr = IMediaSample_SetActualDataLength(sample, IMediaSample_GetSize(sample));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start_time = 0;
     end_time = start_time + 10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_SetPreroll(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     params->sink = sink;
     params->sample = sample;
@@ -1027,9 +1027,9 @@ static void commit_allocator(IMemInputPin *input)
     HRESULT hr;
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IMemAllocator_Release(allocator);
 }
 
@@ -1043,130 +1043,130 @@ static void test_filter_state(IMemInputPin *input, IMediaControl *control)
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     /* The renderer is not fully paused until it receives a sample. The thread
      * sending the sample blocks in IMemInputPin_Receive() until the filter is
      * stopped or run. */
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* The sink will decommit our allocator for us when stopping, however it
      * will not recommit it when pausing. */
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    todo_wine ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
     if (hr == S_OK) IMediaSample_Release(sample);
 
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMemAllocator_Release(allocator);
 }
@@ -1179,61 +1179,61 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* We dropped the sample we were holding, so now we need a new one... */
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %#x.\n", state);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %#lx.\n", state);
 
     thread = send_frame(input);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %#x.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %#lx.\n", state);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static unsigned int check_event_code(IMediaEvent *eventsrc, DWORD timeout, LONG expected_code, LONG_PTR expected1, LONG_PTR expected2)
@@ -1247,14 +1247,14 @@ static unsigned int check_event_code(IMediaEvent *eventsrc, DWORD timeout, LONG
     {
         if (code == expected_code)
         {
-            ok(param1 == expected1, "Got param1 %#lx.\n", param1);
-            ok(param2 == expected2, "Got param2 %#lx.\n", param2);
+            ok(param1 == expected1, "Got param1 %#Ix.\n", param1);
+            ok(param2 == expected2, "Got param2 %#Ix.\n", param2);
             ret++;
         }
         IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
         timeout = 0;
     }
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     return ret;
 }
@@ -1286,68 +1286,68 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
     IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video);
 
     hr = IBasicVideo_GetCurrentImage(video, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetCurrentImage(video, NULL, buffer);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     size = 0xdeadbeef;
     hr = IBasicVideo_GetCurrentImage(video, &size, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 4, "Got size %d.\n", size);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 4, "Got size %ld.\n", size);
 
     size = sizeof(buffer);
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(buffer), "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(buffer), "Got size %ld.\n", size);
     ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     /* The contents seem to reflect the last frame rendered. */
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     size = sizeof(buffer);
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(buffer), "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(buffer), "Got size %ld.\n", size);
     ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     /* The contents seem to reflect the last frame rendered. */
 
     thread = send_frame(input);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     size = 1;
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == 1, "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == 1, "Got size %ld.\n", size);
 
     size = sizeof(buffer);
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(buffer), "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(buffer), "Got size %ld.\n", size);
     ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     for (i = 0; i < 32 * 16; ++i)
-        ok((data[i] & 0xffffff) == 0x555555, "Got unexpected color %08x at %u.\n", data[i], i);
+        ok((data[i] & 0xffffff) == 0x555555, "Got unexpected color %08lx at %u.\n", data[i], i);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     join_thread(thread);
 
     size = sizeof(buffer);
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(buffer), "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(buffer), "Got size %ld.\n", size);
     ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     for (i = 0; i < 32 * 16; ++i)
-        ok((data[i] & 0xffffff) == 0x555555, "Got unexpected color %08x at %u.\n", data[i], i);
+        ok((data[i] & 0xffffff) == 0x555555, "Got unexpected color %08lx at %u.\n", data[i], i);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IBasicVideo_Release(video);
 }
@@ -1363,14 +1363,14 @@ static unsigned int check_ec_userabort(IMediaEvent *eventsrc, DWORD timeout)
     {
         if (code == EC_USERABORT)
         {
-            ok(!param1, "Got param1 %#lx.\n", param1);
-            ok(!param2, "Got param2 %#lx.\n", param2);
+            ok(!param1, "Got param1 %#Ix.\n", param1);
+            ok(!param2, "Got param2 %#Ix.\n", param2);
             ret++;
         }
         IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
         timeout = 0;
     }
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     return ret;
 }
@@ -1389,19 +1389,19 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
 
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IOverlay_Release(overlay);
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
     SendMessageW(hwnd, WM_CLOSE, 0, 0);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(ret == 1, "Expected EC_USERABORT.\n");
 
@@ -1414,17 +1414,17 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     if (ret == WAIT_OBJECT_0)
     {
         GetExitCodeThread(thread, (DWORD *)&hr);
-        ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
+        ok(hr == E_UNEXPECTED, "Got hr %#lx.\n", hr);
     }
     CloseHandle(thread);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
@@ -1432,11 +1432,11 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
 
     commit_allocator(input);
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
@@ -1449,7 +1449,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
@@ -1505,7 +1505,7 @@ static void test_connect_pin(void)
 
     vih.bmiHeader.biBitCount = 16;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
 
     vih.bmiHeader.biBitCount = 32;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
@@ -1518,32 +1518,32 @@ static void test_connect_pin(void)
          * the actual samples only have a size of 32 * 16 * 3. */
         req_props.cbBuffer = 32 * 16 * 3;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     for (i = 0; i < ARRAY_SIZE(subtype_tests); ++i)
     {
         req_mt.subtype = *subtype_tests[i];
         hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-        ok(hr == S_OK, "Got hr %#x for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
+        ok(hr == S_OK, "Got hr %#lx for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
 
         hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IFilterGraph2_Disconnect(graph, pin);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
     }
 
     req_mt.formattype = FORMAT_None;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.formattype = FORMAT_VideoInfo;
 
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
@@ -1553,29 +1553,29 @@ static void test_connect_pin(void)
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &source.source.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
 
     /* Disconnecting while not stopped is broken: it returns S_OK, but
@@ -1586,16 +1586,16 @@ static void test_connect_pin(void)
     test_allocator(input);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IMemAllocator_Release(allocator);
 
     hr = IMemInputPin_ReceiveCanBlock(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     test_filter_state(input, control);
     test_flushing(pin, input, control);
@@ -1603,29 +1603,29 @@ static void test_connect_pin(void)
     test_window_close(pin, input, control);
 
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(source.source.pin.peer == pin, "Got peer %p.\n", peer);
     IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     IMemInputPin_Release(input);
     IPin_Release(pin);
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_overlay(void)
@@ -1640,17 +1640,17 @@ static void test_overlay(void)
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
 
     hr = IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hwnd = (HWND)0xdeadbeef;
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(hwnd && hwnd != (HWND)0xdeadbeef, "Got invalid window %p.\n", hwnd);
 
     IOverlay_Release(overlay);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 /* try to make sure pending X events have been processed before continuing */
@@ -1674,7 +1674,7 @@ static void flush_events(void)
 static LRESULT CALLBACK window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 {
     if (winetest_debug > 1)
-        trace("hwnd %p, msg %#x, wparam %#lx, lparam %#lx.\n", hwnd, msg, wparam, lparam);
+        trace("hwnd %p, msg %#x, wparam %#Ix, lparam %#Ix.\n", hwnd, msg, wparam, lparam);
 
     if (wparam == 0xdeadbeef)
         return 0;
@@ -1689,7 +1689,7 @@ static void test_video_window_caption(IVideoWindow *window, HWND hwnd)
     HRESULT hr;
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(caption, L"ActiveMovie Window"), "Got caption %s.\n", wine_dbgstr_w(caption));
     SysFreeString(caption);
 
@@ -1698,11 +1698,11 @@ static void test_video_window_caption(IVideoWindow *window, HWND hwnd)
 
     caption = SysAllocString(L"foo");
     hr = IVideoWindow_put_Caption(window, caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SysFreeString(caption);
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(caption, L"foo"), "Got caption %s.\n", wine_dbgstr_w(caption));
     SysFreeString(caption);
 
@@ -1716,53 +1716,53 @@ static void test_video_window_style(IVideoWindow *window, HWND hwnd, HWND our_hw
     LONG style;
 
     hr = IVideoWindow_get_WindowStyle(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(style == (WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW),
-            "Got style %#x.\n", style);
+            "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
     ok(style == (WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW),
-            "Got style %#x.\n", style);
+            "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_WindowStyle(window, style | WS_DISABLED);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_HSCROLL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_VSCROLL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_MAXIMIZE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_MINIMIZE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_WindowStyle(window, style & ~WS_CLIPCHILDREN);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyle(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#x.\n", style);
+    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_get_WindowStyleEx(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == WS_EX_WINDOWEDGE, "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == WS_EX_WINDOWEDGE, "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_EXSTYLE);
-    ok(style == WS_EX_WINDOWEDGE, "Got style %#x.\n", style);
+    ok(style == WS_EX_WINDOWEDGE, "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_WindowStyleEx(window, style | WS_EX_TRANSPARENT);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyleEx(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_EXSTYLE);
-    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#x.\n", style);
+    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#lx.\n", style);
 }
 
 static BOOL CALLBACK top_window_cb(HWND hwnd, LPARAM ctx)
@@ -1793,25 +1793,25 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
     ok(!IsZoomed(hwnd), "Window should not be maximized.\n");
 
     hr = IVideoWindow_put_WindowState(window, SW_SHOWNA);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1821,14 +1821,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(top == hwnd, "Got top window %p.\n", top);
 
     hr = IVideoWindow_put_WindowState(window, SW_MINIMIZE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_MINIMIZE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_MINIMIZE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(IsIconic(hwnd), "Window should be minimized.\n");
@@ -1836,14 +1836,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_RESTORE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1851,14 +1851,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_MAXIMIZE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_MAXIMIZE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_MAXIMIZE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should be minimized.\n");
@@ -1866,17 +1866,17 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_RESTORE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_WindowState(window, SW_HIDE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1884,14 +1884,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_Visible(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1899,14 +1899,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -1914,14 +1914,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_SHOWNA);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_SetWindowForeground(window, TRUE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     hr = IVideoWindow_SetWindowForeground(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -1929,7 +1929,7 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(top == hwnd, "Got top window %p.\n", top);
 
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -1938,7 +1938,7 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
 
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == our_hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == our_hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -1960,114 +1960,114 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
     expect_height = rect.bottom - rect.top;
 
     hr = IVideoWindow_put_Left(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_Top(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 0, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 0, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == expect_height, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 0, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 0, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == expect_height, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 0, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 0, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == expect_height, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_put_Left(window, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == expect_height, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == expect_height, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 10, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 10, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 10 + expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == expect_height, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_put_Height(window, 200);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == 200, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == 200, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == 200, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == 200, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 10, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == 200, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 10, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 10 + expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == 200, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_SetWindowPosition(window, 100, 200, 300, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 100, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 100, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 200, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 200, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 300, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 300, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == 400, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 100, "Got left %d.\n", left);
-    ok(top == 200, "Got top %d.\n", top);
-    ok(width == 300, "Got width %d.\n", width);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 100, "Got left %ld.\n", left);
+    ok(top == 200, "Got top %ld.\n", top);
+    ok(width == 300, "Got width %ld.\n", width);
+    ok(height == 400, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 100, "Got window left %d.\n", rect.left);
-    ok(rect.top == 200, "Got window top %d.\n", rect.top);
-    ok(rect.right == 400, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == 600, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 100, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 200, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 400, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == 600, "Got window bottom %ld.\n", rect.bottom);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
@@ -2084,25 +2084,25 @@ static void test_video_window_owner(IVideoWindow *window, HWND hwnd, HWND our_hw
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == GetDesktopWindow(), "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(!(style & WS_CHILD), "Got style %#x.\n", style);
+    ok(!(style & WS_CHILD), "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_Owner(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(oahwnd == (OAHWND)our_hwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(oahwnd == (OAHWND)our_hwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == our_hwnd, "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok((style & WS_CHILD), "Got style %#x.\n", style);
+    ok((style & WS_CHILD), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
@@ -2111,31 +2111,31 @@ static void test_video_window_owner(IVideoWindow *window, HWND hwnd, HWND our_hw
     ShowWindow(our_hwnd, SW_HIDE);
 
     hr = IVideoWindow_put_Visible(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_put_Owner(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == GetDesktopWindow(), "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(!(style & WS_CHILD), "Got style %#x.\n", style);
+    ok(!(style & WS_CHILD), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
     ok(top_hwnd == hwnd, "Got top window %p.\n", top_hwnd);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 }
 
 struct notify_message_params
@@ -2149,7 +2149,7 @@ static DWORD CALLBACK notify_message_proc(void *arg)
 {
     const struct notify_message_params *params = arg;
     HRESULT hr = IVideoWindow_NotifyOwnerMessage(params->window, (OAHWND)params->hwnd, params->message, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return 0;
 }
 
@@ -2192,15 +2192,15 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     flush_events();
 
     hr = IVideoWindow_get_MessageDrain(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got window %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got window %#Ix.\n", oahwnd);
 
     hr = IVideoWindow_put_MessageDrain(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_MessageDrain(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(oahwnd == (OAHWND)our_hwnd, "Got window %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(oahwnd == (OAHWND)our_hwnd, "Got window %#Ix.\n", oahwnd);
 
     for (i = 0; i < ARRAY_SIZE(drain_tests); ++i)
     {
@@ -2209,8 +2209,8 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
         ok(ret, "Expected a message.\n");
         ok(msg.hwnd == our_hwnd, "Got hwnd %p.\n", msg.hwnd);
         ok(msg.message == drain_tests[i], "Got message %#x.\n", msg.message);
-        ok(msg.wParam == 0xdeadbeef, "Got wparam %#lx.\n", msg.wParam);
-        ok(!msg.lParam, "Got lparam %#lx.\n", msg.lParam);
+        ok(msg.wParam == 0xdeadbeef, "Got wparam %#Ix.\n", msg.wParam);
+        ok(!msg.lParam, "Got lparam %#Ix.\n", msg.lParam);
         DispatchMessageA(&msg);
 
         ret = PeekMessageA(&msg, 0, drain_tests[i], drain_tests[i], PM_REMOVE);
@@ -2218,10 +2218,10 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_put_MessageDrain(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_Owner(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     flush_events();
 
@@ -2230,7 +2230,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
      * posted all messages. */
 
     hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SYSCOLORCHANGE, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
@@ -2239,7 +2239,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_FONTCHANGE, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
@@ -2276,7 +2276,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_put_Owner(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static void test_video_window_autoshow(IVideoWindow *window, IFilterGraph2 *graph, HWND hwnd)
@@ -2288,41 +2288,41 @@ static void test_video_window_autoshow(IVideoWindow *window, IFilterGraph2 *grap
     IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
 
     hr = IVideoWindow_get_AutoShow(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IVideoWindow_put_AutoShow(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OAFALSE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OAFALSE, "Got %ld.\n", l);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaControl_Release(control);
 }
@@ -2380,27 +2380,27 @@ static void test_video_window(void)
     IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
 
     hr = IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_debug > 1) trace("ours %p, theirs %p\n", our_hwnd, hwnd);
     GetWindowRect(hwnd, &rect);
 
     tid = GetWindowThreadProcessId(hwnd, NULL);
-    ok(tid == GetCurrentThreadId(), "Expected tid %#x, got %#x.\n", GetCurrentThreadId(), tid);
+    ok(tid == GetCurrentThreadId(), "Expected tid %#lx, got %#lx.\n", GetCurrentThreadId(), tid);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IVideoWindow, (void **)&window);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyle(window, &l);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_AutoShow(window, &l);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     testfilter_init(&source);
     IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
@@ -2413,17 +2413,17 @@ static void test_video_window(void)
         req_props.cbBuffer = 32 * 16 * 3;
         hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
         hr = IMemAllocator_Commit(allocator);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(allocator);
     }
 
@@ -2438,14 +2438,14 @@ static void test_video_window(void)
     test_video_window_messages(window, hwnd, our_hwnd);
 
     hr = IVideoWindow_put_FullScreenMode(window, OATRUE);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_get_FullScreenMode(window, &l);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_GetMinIdealImageSize(window, &width, &height);
-    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_GetMaxIdealImageSize(window, &width, &height);
-    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     IFilterGraph2_Release(graph);
     IVideoWindow_Release(window);
@@ -2453,9 +2453,9 @@ static void test_video_window(void)
     IMemInputPin_Release(input);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(our_hwnd);
 }
 
@@ -2467,31 +2467,31 @@ static void check_source_position_(int line, IBasicVideo *video,
 
     left = top = width = height = 0xdeadbeef;
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, &width, &height);
-    ok_(__FILE__,line)(hr == S_OK, "Got hr %#x.\n", hr);
-    ok_(__FILE__,line)(left == expect_left, "Got left %d.\n", left);
-    ok_(__FILE__,line)(top == expect_top, "Got top %d.\n", top);
-    ok_(__FILE__,line)(width == expect_width, "Got width %d.\n", width);
-    ok_(__FILE__,line)(height == expect_height, "Got height %d.\n", height);
+    ok_(__FILE__,line)(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok_(__FILE__,line)(left == expect_left, "Got left %ld.\n", left);
+    ok_(__FILE__,line)(top == expect_top, "Got top %ld.\n", top);
+    ok_(__FILE__,line)(width == expect_width, "Got width %ld.\n", width);
+    ok_(__FILE__,line)(height == expect_height, "Got height %ld.\n", height);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceLeft(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == left, "Got left %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == left, "Got left %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceTop(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == top, "Got top %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == top, "Got top %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceWidth(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == width, "Got width %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == width, "Got width %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceHeight(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == height, "Got height %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == height, "Got height %ld.\n", l);
 }
 #define check_source_position(a,b,c,d,e) check_source_position_(__LINE__,a,b,c,d,e)
 
@@ -2501,77 +2501,77 @@ static void test_basic_video_source(IBasicVideo *video)
 
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceLeft(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceLeft(video, 10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceTop(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(video, 10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceWidth(video, -500);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 700);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 500, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceHeight(video, -300);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 600);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceLeft(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceLeft(video, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 10, 0, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceTop(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(video, 20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 10, 20, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 4, 5, 60, 40);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 0, 0, 600, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDefaultSourcePosition(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static void check_destination_position_(int line, IBasicVideo *video,
@@ -2582,31 +2582,31 @@ static void check_destination_position_(int line, IBasicVideo *video,
 
     left = top = width = height = 0xdeadbeef;
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, &width, &height);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get position, hr %#x.\n", hr);
-    ok_(__FILE__,line)(left == expect_left, "Got left %d.\n", left);
-    ok_(__FILE__,line)(top == expect_top, "Got top %d.\n", top);
-    ok_(__FILE__,line)(width == expect_width, "Got width %d.\n", width);
-    ok_(__FILE__,line)(height == expect_height, "Got height %d.\n", height);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get position, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(left == expect_left, "Got left %ld.\n", left);
+    ok_(__FILE__,line)(top == expect_top, "Got top %ld.\n", top);
+    ok_(__FILE__,line)(width == expect_width, "Got width %ld.\n", width);
+    ok_(__FILE__,line)(height == expect_height, "Got height %ld.\n", height);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationLeft(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == left, "Got left %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == left, "Got left %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationTop(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == top, "Got top %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == top, "Got top %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationWidth(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == width, "Got width %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == width, "Got width %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationHeight(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == height, "Got height %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == height, "Got height %ld.\n", l);
 }
 #define check_destination_position(a,b,c,d,e) check_destination_position_(__LINE__,a,b,c,d,e)
 
@@ -2620,107 +2620,107 @@ static void test_basic_video_destination(IBasicVideo *video)
 
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationLeft(video, -10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, -10, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationLeft(video, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationTop(video, -20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, -20, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationTop(video, 20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationWidth(video, -700);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationWidth(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationWidth(video, 700);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 700, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationWidth(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationHeight(video, -500);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationHeight(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationHeight(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 500);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationHeight(video, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 4, 5, 60, 40);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 0, 0, 600, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDefaultDestinationPosition(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     SetRect(&rect, 100, 200, 500, 500);
     AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
     hr = IVideoWindow_SetWindowPosition(window, rect.left, rect.top,
             rect.right - rect.left, rect.bottom - rect.top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 0, 0, 400, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     SetRect(&rect, 100, 200, 600, 600);
     AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
     hr = IVideoWindow_SetWindowPosition(window, rect.left, rect.top,
             rect.right - rect.left, rect.bottom - rect.top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IVideoWindow_Release(window);
 }
@@ -2769,83 +2769,83 @@ static void test_basic_video(void)
     IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
 
     hr = IBasicVideo_GetTypeInfoCount(video, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(count == 1, "Got count %u.\n", count);
 
     hr = IBasicVideo_GetTypeInfo(video, 0, 0, &typeinfo);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind);
     ok(IsEqualGUID(&typeattr->guid, &IID_IBasicVideo), "Got IID %s.\n", wine_dbgstr_guid(&typeattr->guid));
     ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
     ITypeInfo_Release(typeinfo);
 
     hr = IBasicVideo_get_AvgTimePerFrame(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_AvgTimePerFrame(video, &reftime);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_BitRate(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_BitRate(video, &l);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_BitErrorRate(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_BitErrorRate(video, &l);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_VideoWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_VideoHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_SourceLeft(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceTop(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_DestinationLeft(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationTop(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetSourcePosition(video, NULL, &top, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, NULL, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetDestinationPosition(video, NULL, &top, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, NULL, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetVideoSize(video, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoSize(video, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, NULL, &l);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, &l, NULL);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     testfilter_init(&source);
     IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, L"vmr9");
@@ -2856,66 +2856,66 @@ static void test_basic_video(void)
         skip("Got E_FAIL when connecting.\n");
         goto out;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
         hr = IMemAllocator_Commit(allocator);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(allocator);
     }
 
     reftime = 0.0;
     hr = IBasicVideo_get_AvgTimePerFrame(video, &reftime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_double(reftime, 0.02, 1 << 28), "Got frame rate %.16e.\n", reftime);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_BitRate(video, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!l, "Got bit rate %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!l, "Got bit rate %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_BitErrorRate(video, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!l, "Got bit rate %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!l, "Got bit rate %ld.\n", l);
 
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, &l, NULL);
-    todo_wine ok(hr == VFW_E_NO_PALETTE_AVAILABLE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NO_PALETTE_AVAILABLE, "Got hr %#lx.\n", hr);
 
     width = height = 0xdeadbeef;
     hr = IBasicVideo_GetVideoSize(video, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 600, "Got width %d.\n", width);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 600, "Got width %ld.\n", width);
+    ok(height == 400, "Got height %ld.\n", height);
 
     test_basic_video_source(video);
     test_basic_video_destination(video);
 
     hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     vih.bmiHeader.biWidth = 16;
     vih.bmiHeader.biHeight = 16;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
         hr = IMemAllocator_Commit(allocator);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(allocator);
     }
 
@@ -2928,14 +2928,14 @@ static void test_basic_video(void)
 
 out:
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IBasicVideo_Release(video);
     IMemInputPin_Release(input);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_windowless_size(void)
@@ -2980,12 +2980,12 @@ static void test_windowless_size(void)
     ok(!!window, "Failed to create a window.\n");
 
     hr = IVMRWindowlessControl_SetVideoClippingWindow(windowless_control, window);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
@@ -2995,47 +2995,47 @@ static void test_windowless_size(void)
             skip("Got E_FAIL when setting allocator properties.\n");
             goto out;
         }
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
     }
 
     hr = IVMRWindowlessControl_GetNativeVideoSize(windowless_control, NULL, &height, &aspect_width, &aspect_height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IVMRWindowlessControl_GetNativeVideoSize(windowless_control, &width, NULL, &aspect_width, &aspect_height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     width = height = 0xdeadbeef;
     hr = IVMRWindowlessControl_GetNativeVideoSize(windowless_control, &width, &height, NULL, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 32, "Got width %d.\n", width);
-    ok(height == 16, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 32, "Got width %ld.\n", width);
+    ok(height == 16, "Got height %ld.\n", height);
 
     aspect_width = aspect_height = 0xdeadbeef;
     hr = IVMRWindowlessControl_GetNativeVideoSize(windowless_control, &width, &height, &aspect_width, &aspect_height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(aspect_width == 32, "Got width %d.\n", aspect_width);
-    ok(aspect_height == 16, "Got height %d.\n", aspect_height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(aspect_width == 32, "Got width %ld.\n", aspect_width);
+    ok(aspect_height == 16, "Got height %ld.\n", aspect_height);
 
     memset(&src, 0xcc, sizeof(src));
     hr = IVMRWindowlessControl_GetVideoPosition(windowless_control, &src, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 0, 0, 32, 16);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
 
     memset(&dst, 0xcc, sizeof(dst));
     hr = IVMRWindowlessControl_GetVideoPosition(windowless_control, NULL, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 0, 0, 0, 0);
     ok(EqualRect(&dst, &expect), "Got dest rect %s.\n", wine_dbgstr_rect(&dst));
 
     SetRect(&src, 4, 6, 16, 12);
     hr = IVMRWindowlessControl_SetVideoPosition(windowless_control, &src, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     memset(&src, 0xcc, sizeof(src));
     memset(&dst, 0xcc, sizeof(dst));
     hr = IVMRWindowlessControl_GetVideoPosition(windowless_control, &src, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 4, 6, 16, 12);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
     SetRect(&expect, 0, 0, 0, 0);
@@ -3043,12 +3043,12 @@ static void test_windowless_size(void)
 
     SetRect(&dst, 40, 60, 120, 160);
     hr = IVMRWindowlessControl_SetVideoPosition(windowless_control, NULL, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     memset(&src, 0xcc, sizeof(src));
     memset(&dst, 0xcc, sizeof(dst));
     hr = IVMRWindowlessControl_GetVideoPosition(windowless_control, &src, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 4, 6, 16, 12);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
     SetRect(&expect, 40, 60, 120, 160);
@@ -3060,12 +3060,12 @@ static void test_windowless_size(void)
 
 out:
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IMemInputPin_Release(input);
     IPin_Release(pin);
     IVMRWindowlessControl_Release(windowless_control);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(window);
 }
 
@@ -3080,49 +3080,49 @@ static void test_unconnected_eos(void)
     ULONG ref;
 
     hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
@@ -3130,9 +3130,9 @@ static void test_unconnected_eos(void)
     IMediaControl_Release(control);
     IMediaEvent_Release(eventsrc);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 START_TEST(vmr7)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 45ec3313813..151c68cf6af 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -37,13 +37,13 @@ static IBaseFilter *create_vmr9(DWORD mode)
     IVMRFilterConfig9 *config;
     HRESULT hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (mode)
     {
         hr = IBaseFilter_QueryInterface(filter, &IID_IVMRFilterConfig9, (void **)&config);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         hr = IVMRFilterConfig9_SetRenderingMode(config, mode);
-        ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#x.\n", hr);
+        ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#lx.\n", hr);
         IVMRFilterConfig9_Release(config);
     }
     return filter;
@@ -55,10 +55,10 @@ static HRESULT set_mixing_mode(IBaseFilter *filter, DWORD count)
     HRESULT hr;
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IVMRFilterConfig9, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_SetNumberOfStreams(config, count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IVMRFilterConfig9_Release(config);
     return hr;
@@ -92,7 +92,7 @@ static IFilterGraph2 *create_graph(void)
     IFilterGraph2 *ret;
     HRESULT hr;
     hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret);
-    ok(hr == S_OK, "Failed to create FilterGraph: %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return ret;
 }
 
@@ -112,92 +112,92 @@ static void test_filter_config(void)
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
             &IID_IVMRFilterConfig9, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMRMode_Windowed, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMRMode_Windowed, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowed);
-    ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#x.\n", hr);
+    ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMR9Mode_Windowed, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMR9Mode_Windowed, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowed);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     ref = IVMRFilterConfig9_Release(config);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
             &IID_IVMRFilterConfig9, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowless);
-    ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#x.\n", hr);
+    ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMR9Mode_Windowless, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMR9Mode_Windowless, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowed);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     ref = IVMRFilterConfig9_Release(config);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
             &IID_IVMRFilterConfig9, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Renderless);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMR9Mode_Renderless, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMR9Mode_Renderless, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowless);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     ref = IVMRFilterConfig9_Release(config);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
             &IID_IVMRFilterConfig9, (void **)&config);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetNumberOfStreams(config, &count);
-    ok(hr == VFW_E_VMR_NOT_IN_MIXER_MODE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_VMR_NOT_IN_MIXER_MODE, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_SetNumberOfStreams(config, 3);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetNumberOfStreams(config, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 3, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 3, "Got count %lu.\n", count);
 
     hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMR9Mode_Windowed, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMR9Mode_Windowed, "Got mode %#lx.\n", mode);
 
     /* Despite MSDN, you can still change the rendering mode after setting the
      * stream count. */
     hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowless);
-    ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#x.\n", hr);
+    ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetRenderingMode(config, &mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(mode == VMR9Mode_Windowless, "Got mode %#x.\n", mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(mode == VMR9Mode_Windowless, "Got mode %#lx.\n", mode);
 
     hr = IVMRFilterConfig9_GetNumberOfStreams(config, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 3, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 3, "Got count %lu.\n", count);
 
     ref = IVMRFilterConfig9_Release(config);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 #define check_interface_broken(a, b, c) check_interface_(__LINE__, a, b, c, TRUE)
@@ -220,7 +220,7 @@ static HRESULT check_interface_(unsigned int line, void *iface, REFIID riid, BOO
 
     hr = IUnknown_QueryInterface(unknown, riid, (void **)&out);
     ok_(__FILE__, line)(hr == expected_hr || broken(is_broken && hr == broken_hr),
-            "Got hr %#x, expected %#x.\n", hr, expected_hr);
+            "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(out);
     return hr;
@@ -294,7 +294,7 @@ static void test_interfaces(void)
     check_interface(filter, &IID_IVMRWindowlessControl9, FALSE);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     filter = create_vmr9(VMR9Mode_Windowless);
     test_common_interfaces(filter);
@@ -311,7 +311,7 @@ static void test_interfaces(void)
     check_interface(filter, &IID_IVMRSurfaceAllocatorNotify9, FALSE);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     filter = create_vmr9(VMR9Mode_Renderless);
     test_common_interfaces(filter);
@@ -325,7 +325,7 @@ static void test_interfaces(void)
     check_interface(filter, &IID_IVMRWindowlessControl9, FALSE);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     filter = create_vmr9(VMR9Mode_Windowed);
     set_mixing_mode(filter, 1);
@@ -343,7 +343,7 @@ static void test_interfaces(void)
     check_interface(filter, &IID_IVMRWindowlessControl9, FALSE);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static const GUID test_iid = {0x33333333};
@@ -391,53 +391,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -449,79 +449,79 @@ static void test_enum_pins(void)
     HRESULT hr;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
@@ -529,43 +529,43 @@ static void test_enum_pins(void)
     set_mixing_mode(filter, 2);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK) IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(count == 2, "Got count %u.\n", count);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     if (count > 1) IPin_Release(pins[1]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 3, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    todo_wine ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    todo_wine ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     if (count > 1) IPin_Release(pins[1]);
 
     IEnumPins_Release(enum1);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_find_pin(void)
@@ -579,51 +579,51 @@ static void test_find_pin(void)
     IBaseFilter_EnumPins(filter, &enum_pins);
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"In", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Pins did not match.\n");
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IBaseFilter_FindPin(filter, L"VMR Input1", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     set_mixing_mode(filter, 2);
 
     IEnumPins_Reset(enum_pins);
 
     hr = IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Pins did not match.\n");
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IBaseFilter_FindPin(filter, L"VMR Input1", &pin);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(pin == pin2, "Pins did not match.\n");
         IPin_Release(pin);
         IPin_Release(pin2);
     }
 
     hr = IBaseFilter_FindPin(filter, L"VMR Input2", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     IEnumPins_Release(enum_pins);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_pin_info(void)
@@ -644,23 +644,23 @@ static void test_pin_info(void)
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"VMR Input0"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     hr = IPin_QueryInternalConnections(pin, NULL, &count);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
 
     set_mixing_mode(filter, 2);
 
     hr = IBaseFilter_FindPin(filter, L"VMR Input1", &pin);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IPin_QueryPinInfo(pin, &info);
@@ -670,22 +670,22 @@ static void test_pin_info(void)
         IBaseFilter_Release(info.pFilter);
 
         hr = IPin_QueryDirection(pin, &dir);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
         hr = IPin_QueryId(pin, &id);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!wcscmp(id, L"VMR Input1"), "Got id %s.\n", wine_dbgstr_w(id));
         CoTaskMemFree(id);
 
         hr = IPin_QueryInternalConnections(pin, NULL, &count);
-        ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+        ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
         IPin_Release(pin);
     }
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_media_types(void)
@@ -713,10 +713,10 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &mt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
 
@@ -729,33 +729,33 @@ static void test_media_types(void)
     {
         req_mt.subtype = *subtype_tests[i];
         hr = IPin_QueryAccept(pin, &req_mt);
-        ok(hr == S_OK, "Got hr %#x for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
+        ok(hr == S_OK, "Got hr %#lx for subtype %s.\n", hr, wine_dbgstr_guid(subtype_tests[i]));
     }
 
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IPin_QueryAccept(pin, &req_mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_NULL;
     hr = IPin_QueryAccept(pin, &req_mt);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_RGB24;
 
     req_mt.majortype = MEDIATYPE_NULL;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     req_mt.majortype = MEDIATYPE_Video;
 
     req_mt.formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     req_mt.formattype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &req_mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_enum_media_types(void)
@@ -770,36 +770,36 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enum1);
     IEnumMediaTypes_Release(enum2);
     IPin_Release(pin);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_filter_state(void)
@@ -810,53 +810,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 struct testfilter
@@ -917,45 +917,45 @@ static void test_allocator(IMemInputPin *input)
     HRESULT hr;
 
     hr = IMemInputPin_GetAllocatorRequirements(input, &props);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &ret_allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (hr == S_OK)
     {
         hr = IMemAllocator_GetProperties(ret_allocator, &props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(!props.cBuffers, "Got %d buffers.\n", props.cBuffers);
-        ok(!props.cbBuffer, "Got size %d.\n", props.cbBuffer);
-        ok(!props.cbAlign, "Got alignment %d.\n", props.cbAlign);
-        ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(!props.cBuffers, "Got %ld buffers.\n", props.cBuffers);
+        ok(!props.cbBuffer, "Got size %ld.\n", props.cbBuffer);
+        ok(!props.cbAlign, "Got alignment %ld.\n", props.cbAlign);
+        ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
 
         hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         req_props.cBuffers = 1;
         req_props.cbBuffer = 32 * 16 * 4;
         req_props.cbAlign = 1;
         req_props.cbPrefix = 0;
         hr = IMemAllocator_SetProperties(ret_allocator, &req_props, &props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(props.cBuffers == 1, "Got %d buffers.\n", props.cBuffers);
-        ok(props.cbBuffer == 32 * 16 * 4, "Got size %d.\n", props.cbBuffer);
-        ok(props.cbAlign == 1, "Got alignment %d.\n", props.cbAlign);
-        ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(props.cBuffers == 1, "Got %ld buffers.\n", props.cBuffers);
+        ok(props.cbBuffer == 32 * 16 * 4, "Got size %ld.\n", props.cbBuffer);
+        ok(props.cbAlign == 1, "Got alignment %ld.\n", props.cbAlign);
+        ok(!props.cbPrefix, "Got prefix %ld.\n", props.cbPrefix);
 
         IMemAllocator_Release(ret_allocator);
     }
 
     hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
             &IID_IMemAllocator, (void **)&req_allocator);
 
     hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     IMemAllocator_Release(req_allocator);
 }
@@ -971,9 +971,9 @@ static DWORD WINAPI frame_thread(void *arg)
     struct frame_thread_params *params = arg;
     HRESULT hr;
 
-    if (winetest_debug > 1) trace("%04x: Sending frame.\n", GetCurrentThreadId());
+    if (winetest_debug > 1) trace("%04lx: Sending frame.\n", GetCurrentThreadId());
     hr = IMemInputPin_Receive(params->sink, params->sample);
-    if (winetest_debug > 1) trace("%04x: Returned %#x.\n", GetCurrentThreadId(), hr);
+    if (winetest_debug > 1) trace("%04lx: Returned %#lx.\n", GetCurrentThreadId(), hr);
     IMediaSample_Release(params->sample);
     free(params);
     return hr;
@@ -991,27 +991,27 @@ static HANDLE send_frame_time(IMemInputPin *sink, REFERENCE_TIME start_time, DWO
     BYTE *data;
 
     hr = IMemInputPin_GetAllocator(sink, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     size = IMediaSample_GetSize(sample);
     hr = IMediaSample_GetPointer(sample, &data);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     for (i = 0; i < size / sizeof(DWORD); ++i)
         ((DWORD *)data)[i] = color;
 
     hr = IMediaSample_SetActualDataLength(sample, size);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     start_time *= 10000000;
     end_time = start_time + 10000000;
     hr = IMediaSample_SetTime(sample, &start_time, &end_time);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSample_SetPreroll(sample, TRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     params->sink = sink;
     params->sample = sample;
@@ -1042,9 +1042,9 @@ static void commit_allocator(IMemInputPin *input)
     HRESULT hr;
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IMemAllocator_Release(allocator);
 }
 
@@ -1058,130 +1058,130 @@ static void test_filter_state(IMemInputPin *input, IMediaControl *control)
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     /* The renderer is not fully paused until it receives a sample. The thread
      * sending the sample blocks in IMemInputPin_Receive() until the filter is
      * stopped or run. */
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* The sink will decommit our allocator for us when stopping, however it
      * will not recommit it when pausing. */
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
-    todo_wine ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#lx.\n", hr);
     if (hr == S_OK) IMediaSample_Release(sample);
 
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMemAllocator_Release(allocator);
 }
@@ -1194,61 +1194,61 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* We dropped the sample we were holding, so now we need a new one... */
 
     hr = IMediaControl_GetState(control, 0, &state);
-    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %#x.\n", state);
+    todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %#lx.\n", state);
 
     thread = send_frame(input);
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == State_Paused, "Got state %#x.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == State_Paused, "Got state %#lx.\n", state);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame(input);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static unsigned int check_event_code(IMediaEvent *eventsrc, DWORD timeout, LONG expected_code, LONG_PTR expected1, LONG_PTR expected2)
@@ -1262,14 +1262,14 @@ static unsigned int check_event_code(IMediaEvent *eventsrc, DWORD timeout, LONG
     {
         if (code == expected_code)
         {
-            ok(param1 == expected1, "Got param1 %#lx.\n", param1);
-            ok(param2 == expected2, "Got param2 %#lx.\n", param2);
+            ok(param1 == expected1, "Got param1 %#Ix.\n", param1);
+            ok(param2 == expected2, "Got param2 %#Ix.\n", param2);
             ret++;
         }
         IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
         timeout = 0;
     }
-    ok(hr == E_ABORT, "Got hr %#x.\n", hr);
+    ok(hr == E_ABORT, "Got hr %#lx.\n", hr);
 
     return ret;
 }
@@ -1290,28 +1290,28 @@ static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = join_thread(send_frame(input));
-    todo_wine ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_UNEXPECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Expected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
@@ -1320,23 +1320,23 @@ static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
 
     commit_allocator(input);
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
     ret = check_ec_complete(eventsrc, 1600);
     todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
@@ -1344,19 +1344,19 @@ static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
 
     commit_allocator(input);
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndOfStream(pin);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
@@ -1364,31 +1364,31 @@ static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
 
     commit_allocator(input);
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IPin_EndOfStream(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got unexpected EC_COMPLETE.\n");
 
@@ -1403,25 +1403,25 @@ static void test_sample_time(IPin *pin, IMemInputPin *input, IMediaControl *cont
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_GetState(control, 0, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
 
     thread = send_frame_time(input, 1, 0x000000ff); /* blue */
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok(WaitForSingleObject(thread, 500) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     /* Sample time is relative to the time passed to Run(). Thus a sample
      * stamped at or earlier than 1s will now be displayed immediately, because
@@ -1433,33 +1433,33 @@ static void test_sample_time(IPin *pin, IMemInputPin *input, IMediaControl *cont
      * discontinuous. */
 
     hr = join_thread(send_frame_time(input, 1, 0x0000ffff)); /* cyan */
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(send_frame_time(input, 0, 0x0000ff00)); /* green */
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = join_thread(send_frame_time(input, -2, 0x00ff0000)); /* red */
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame_time(input, 1000000, 0x00ffffff); /* white */
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IPin_BeginFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = join_thread(thread);
     /* If the frame makes it to Receive() in time to be rendered, we get S_OK. */
-    ok(hr == S_OK || hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_OK || hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IPin_EndFlush(pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     thread = send_frame_time(input, 1000000, 0x00ffff00); /* yellow */
     ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = join_thread(thread);
     /* If the frame makes it to Receive() in time to be rendered, we get S_OK. */
-    ok(hr == S_OK || hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == S_OK || hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 }
 
 static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
@@ -1481,68 +1481,68 @@ static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
     IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video);
 
     hr = IBasicVideo_GetCurrentImage(video, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetCurrentImage(video, NULL, buffer);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     size = 0xdeadbeef;
     hr = IBasicVideo_GetCurrentImage(video, &size, NULL);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 4, "Got size %d.\n", size);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(size == sizeof(BITMAPINFOHEADER) + 32 * 16 * 4, "Got size %ld.\n", size);
 
     size = sizeof(buffer);
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(buffer), "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(buffer), "Got size %ld.\n", size);
     ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     /* The contents seem to reflect the last frame rendered. */
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     size = sizeof(buffer);
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(buffer), "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(buffer), "Got size %ld.\n", size);
     ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     /* The contents seem to reflect the last frame rendered. */
 
     thread = send_frame(input);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     size = 1;
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == 1, "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == 1, "Got size %ld.\n", size);
 
     size = sizeof(buffer);
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(buffer), "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(buffer), "Got size %ld.\n", size);
     ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     for (i = 0; i < 32 * 16; ++i)
-        ok((data[i] & 0xffffff) == 0x7f007f, "Got unexpected color %08x at %u.\n", data[i], i);
+        ok((data[i] & 0xffffff) == 0x7f007f, "Got unexpected color %08lx at %u.\n", data[i], i);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     join_thread(thread);
 
     size = sizeof(buffer);
     memset(buffer, 0xcc, sizeof(buffer));
     hr = IBasicVideo_GetCurrentImage(video, &size, buffer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(size == sizeof(buffer), "Got size %d.\n", size);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(size == sizeof(buffer), "Got size %ld.\n", size);
     ok(!memcmp(bih, &expect_bih, sizeof(BITMAPINFOHEADER)), "Bitmap headers didn't match.\n");
     for (i = 0; i < 32 * 16; ++i)
-        ok((data[i] & 0xffffff) == 0x7f007f, "Got unexpected color %08x at %u.\n", data[i], i);
+        ok((data[i] & 0xffffff) == 0x7f007f, "Got unexpected color %08lx at %u.\n", data[i], i);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IBasicVideo_Release(video);
 }
@@ -1566,19 +1566,19 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
 
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IOverlay_Release(overlay);
 
     commit_allocator(input);
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
     SendMessageW(hwnd, WM_CLOSE, 0, 0);
 
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(ret == 1, "Expected EC_USERABORT.\n");
 
@@ -1591,17 +1591,17 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     if (ret == WAIT_OBJECT_0)
     {
         GetExitCodeThread(thread, (DWORD *)&hr);
-        ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
+        ok(hr == E_UNEXPECTED, "Got hr %#lx.\n", hr);
     }
     CloseHandle(thread);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
@@ -1609,11 +1609,11 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
 
     commit_allocator(input);
     hr = IMediaControl_Run(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = join_thread(send_frame(input));
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
@@ -1626,7 +1626,7 @@ static void test_window_close(IPin *pin, IMemInputPin *input, IMediaControl *con
     ok(!IsWindowVisible(hwnd), "Window should be visible.\n");
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ret = check_ec_userabort(eventsrc, 0);
     ok(!ret, "Got unexpected EC_USERABORT.\n");
 
@@ -1696,54 +1696,54 @@ static void test_connect_pin(void)
                 skip("Got E_FAIL when connecting.\n");
                 goto out;
             }
-            ok(hr == S_OK, "Got hr %#x for subtype %s and bpp %u.\n", hr,
+            ok(hr == S_OK, "Got hr %#lx for subtype %s and bpp %u.\n", hr,
                     wine_dbgstr_guid(subtype_tests[i]), bpp_tests[j]);
 
             hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-            ok(hr == S_OK, "Got hr %#x.\n", hr);
+            ok(hr == S_OK, "Got hr %#lx.\n", hr);
             hr = IFilterGraph2_Disconnect(graph, pin);
-            ok(hr == S_OK, "Got hr %#x.\n", hr);
+            ok(hr == S_OK, "Got hr %#lx.\n", hr);
         }
     }
 
     req_mt.formattype = FORMAT_None;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.formattype = FORMAT_VideoInfo;
 
     req_mt.subtype = MEDIASUBTYPE_RGB8;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_WAVE;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr);
     req_mt.subtype = MEDIASUBTYPE_RGB32;
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_STOPPED, "Got hr %#lx.\n", hr);
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(peer == &source.source.pin.IPin_iface, "Got peer %p.\n", peer);
     IPin_Release(peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
 
     /* Disconnecting while not stopped is broken: it returns S_OK, but
@@ -1752,16 +1752,16 @@ static void test_connect_pin(void)
     test_allocator(input);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
     hr = IMemAllocator_Commit(allocator);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IMemAllocator_Release(allocator);
 
     hr = IMemInputPin_ReceiveCanBlock(input);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     test_filter_state(input, control);
     test_flushing(pin, input, control);
@@ -1771,30 +1771,30 @@ static void test_connect_pin(void)
     test_window_close(pin, input, control);
 
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     ok(source.source.pin.peer == pin, "Got peer %p.\n", source.source.pin.peer);
     IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
 
     peer = (IPin *)0xdeadbeef;
     hr = IPin_ConnectedTo(pin, &peer);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
     ok(!peer, "Got peer %p.\n", peer);
 
     hr = IPin_ConnectionMediaType(pin, &mt);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
 out:
     IMediaControl_Release(control);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IMemInputPin_Release(input);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_overlay(void)
@@ -1809,49 +1809,49 @@ static void test_overlay(void)
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
 
     hr = IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hwnd = (HWND)0xdeadbeef;
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(hwnd && hwnd != (HWND)0xdeadbeef, "Got invalid window %p.\n", hwnd);
 
     IOverlay_Release(overlay);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     filter = create_vmr9(VMR9Mode_Windowless);
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
 
     hr = IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hwnd = (HWND)0xdeadbeef;
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
     ok(hwnd == (HWND)0xdeadbeef, "Got window %p.\n", hwnd);
 
     IOverlay_Release(overlay);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 
     filter = create_vmr9(VMR9Mode_Renderless);
     IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
 
     hr = IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hwnd = (HWND)0xdeadbeef;
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
     ok(hwnd == (HWND)0xdeadbeef, "Got window %p.\n", hwnd);
 
     IOverlay_Release(overlay);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 /* try to make sure pending X events have been processed before continuing */
@@ -1875,7 +1875,7 @@ static void flush_events(void)
 static LRESULT CALLBACK window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 {
     if (winetest_debug > 1)
-        trace("hwnd %p, msg %#x, wparam %#lx, lparam %#lx.\n", hwnd, msg, wparam, lparam);
+        trace("hwnd %p, msg %#x, wparam %#Ix, lparam %#Ix.\n", hwnd, msg, wparam, lparam);
 
     if (wparam == 0xdeadbeef)
         return 0;
@@ -1890,7 +1890,7 @@ static void test_video_window_caption(IVideoWindow *window, HWND hwnd)
     HRESULT hr;
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(caption, L"ActiveMovie Window"), "Got caption %s.\n", wine_dbgstr_w(caption));
     SysFreeString(caption);
 
@@ -1899,11 +1899,11 @@ static void test_video_window_caption(IVideoWindow *window, HWND hwnd)
 
     caption = SysAllocString(L"foo");
     hr = IVideoWindow_put_Caption(window, caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SysFreeString(caption);
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(caption, L"foo"), "Got caption %s.\n", wine_dbgstr_w(caption));
     SysFreeString(caption);
 
@@ -1917,53 +1917,53 @@ static void test_video_window_style(IVideoWindow *window, HWND hwnd, HWND our_hw
     LONG style;
 
     hr = IVideoWindow_get_WindowStyle(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(style == (WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW),
-            "Got style %#x.\n", style);
+            "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
     ok(style == (WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW),
-            "Got style %#x.\n", style);
+            "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_WindowStyle(window, style | WS_DISABLED);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_HSCROLL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_VSCROLL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_MAXIMIZE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_WindowStyle(window, style | WS_MINIMIZE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_WindowStyle(window, style & ~WS_CLIPCHILDREN);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyle(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#x.\n", style);
+    ok(style == (WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_get_WindowStyleEx(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == WS_EX_WINDOWEDGE, "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == WS_EX_WINDOWEDGE, "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_EXSTYLE);
-    ok(style == WS_EX_WINDOWEDGE, "Got style %#x.\n", style);
+    ok(style == WS_EX_WINDOWEDGE, "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_WindowStyleEx(window, style | WS_EX_TRANSPARENT);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyleEx(window, &style);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#x.\n", style);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#lx.\n", style);
 
     style = GetWindowLongA(hwnd, GWL_EXSTYLE);
-    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#x.\n", style);
+    ok(style == (WS_EX_WINDOWEDGE | WS_EX_TRANSPARENT), "Got style %#lx.\n", style);
 }
 
 static BOOL CALLBACK top_window_cb(HWND hwnd, LPARAM ctx)
@@ -1994,25 +1994,25 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
     ok(!IsZoomed(hwnd), "Window should not be maximized.\n");
 
     hr = IVideoWindow_put_WindowState(window, SW_SHOWNA);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -2022,14 +2022,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(top == hwnd, "Got top window %p.\n", top);
 
     hr = IVideoWindow_put_WindowState(window, SW_MINIMIZE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_MINIMIZE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_MINIMIZE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(IsIconic(hwnd), "Window should be minimized.\n");
@@ -2037,14 +2037,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_RESTORE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -2052,14 +2052,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_MAXIMIZE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_MAXIMIZE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_MAXIMIZE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should be minimized.\n");
@@ -2067,17 +2067,17 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_RESTORE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_WindowState(window, SW_HIDE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -2085,14 +2085,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_Visible(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_SHOW, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_SHOW, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 
     ok(IsWindowVisible(hwnd), "Window should be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -2100,14 +2100,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowState(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == SW_HIDE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == SW_HIDE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     ok(!IsWindowVisible(hwnd), "Window should not be visible.\n");
     ok(!IsIconic(hwnd), "Window should not be minimized.\n");
@@ -2115,14 +2115,14 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
 
     hr = IVideoWindow_put_WindowState(window, SW_SHOWNA);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_SetWindowForeground(window, TRUE);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     hr = IVideoWindow_SetWindowForeground(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -2130,7 +2130,7 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
     ok(top == hwnd, "Got top window %p.\n", top);
 
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -2139,7 +2139,7 @@ static void test_video_window_state(IVideoWindow *window, HWND hwnd, HWND our_hw
 
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     hr = IVideoWindow_SetWindowForeground(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     ok(GetFocus() == our_hwnd, "Got focus window %p.\n", GetFocus());
     ok(GetForegroundWindow() == our_hwnd, "Got foreground window %p.\n", GetForegroundWindow());
@@ -2161,114 +2161,114 @@ static void test_video_window_position(IVideoWindow *window, HWND hwnd, HWND our
     expect_height = rect.bottom - rect.top;
 
     hr = IVideoWindow_put_Left(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_put_Top(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 0, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 0, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == expect_height, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 0, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 0, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == expect_height, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 0, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 0, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == expect_height, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_put_Left(window, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == expect_height, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == expect_height, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == expect_height, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 10, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == expect_height, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 10, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 10 + expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == expect_height, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_put_Height(window, 200);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 0, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 0, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == expect_width, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == expect_width, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == 200, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == 200, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 10, "Got left %d.\n", left);
-    ok(top == 0, "Got top %d.\n", top);
-    ok(width == expect_width, "Got width %d.\n", width);
-    ok(height == 200, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 10, "Got left %ld.\n", left);
+    ok(top == 0, "Got top %ld.\n", top);
+    ok(width == expect_width, "Got width %ld.\n", width);
+    ok(height == 200, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 10, "Got window left %d.\n", rect.left);
-    ok(rect.top == 0, "Got window top %d.\n", rect.top);
-    ok(rect.right == 10 + expect_width, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == 200, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 10, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 0, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 10 + expect_width, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == 200, "Got window bottom %ld.\n", rect.bottom);
 
     hr = IVideoWindow_SetWindowPosition(window, 100, 200, 300, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Left(window, &left);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 100, "Got left %d.\n", left);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 100, "Got left %ld.\n", left);
     hr = IVideoWindow_get_Top(window, &top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(top == 200, "Got top %d.\n", top);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(top == 200, "Got top %ld.\n", top);
     hr = IVideoWindow_get_Width(window, &width);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 300, "Got width %d.\n", width);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 300, "Got width %ld.\n", width);
     hr = IVideoWindow_get_Height(window, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(height == 400, "Got height %ld.\n", height);
     hr = IVideoWindow_GetWindowPosition(window, &left, &top, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(left == 100, "Got left %d.\n", left);
-    ok(top == 200, "Got top %d.\n", top);
-    ok(width == 300, "Got width %d.\n", width);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(left == 100, "Got left %ld.\n", left);
+    ok(top == 200, "Got top %ld.\n", top);
+    ok(width == 300, "Got width %ld.\n", width);
+    ok(height == 400, "Got height %ld.\n", height);
     GetWindowRect(hwnd, &rect);
-    ok(rect.left == 100, "Got window left %d.\n", rect.left);
-    ok(rect.top == 200, "Got window top %d.\n", rect.top);
-    ok(rect.right == 400, "Got window right %d.\n", rect.right);
-    ok(rect.bottom == 600, "Got window bottom %d.\n", rect.bottom);
+    ok(rect.left == 100, "Got window left %ld.\n", rect.left);
+    ok(rect.top == 200, "Got window top %ld.\n", rect.top);
+    ok(rect.right == 400, "Got window right %ld.\n", rect.right);
+    ok(rect.bottom == 600, "Got window bottom %ld.\n", rect.bottom);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
@@ -2285,25 +2285,25 @@ static void test_video_window_owner(IVideoWindow *window, HWND hwnd, HWND our_hw
     SetWindowPos(our_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == GetDesktopWindow(), "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(!(style & WS_CHILD), "Got style %#x.\n", style);
+    ok(!(style & WS_CHILD), "Got style %#lx.\n", style);
 
     hr = IVideoWindow_put_Owner(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(oahwnd == (OAHWND)our_hwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(oahwnd == (OAHWND)our_hwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == our_hwnd, "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok((style & WS_CHILD), "Got style %#x.\n", style);
+    ok((style & WS_CHILD), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == our_hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
@@ -2312,31 +2312,31 @@ static void test_video_window_owner(IVideoWindow *window, HWND hwnd, HWND our_hw
     ShowWindow(our_hwnd, SW_HIDE);
 
     hr = IVideoWindow_put_Visible(window, OATRUE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == OAFALSE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == OAFALSE, "Got state %ld.\n", state);
 
     hr = IVideoWindow_put_Owner(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Owner(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got owner %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got owner %#Ix.\n", oahwnd);
 
     parent = GetAncestor(hwnd, GA_PARENT);
     ok(parent == GetDesktopWindow(), "Got parent %p.\n", parent);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok(!(style & WS_CHILD), "Got style %#x.\n", style);
+    ok(!(style & WS_CHILD), "Got style %#lx.\n", style);
 
     ok(GetActiveWindow() == hwnd, "Got active window %p.\n", GetActiveWindow());
     top_hwnd = get_top_window();
     ok(top_hwnd == hwnd, "Got top window %p.\n", top_hwnd);
 
     hr = IVideoWindow_get_Visible(window, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(state == OATRUE, "Got state %d.\n", state);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(state == OATRUE, "Got state %ld.\n", state);
 }
 
 struct notify_message_params
@@ -2350,7 +2350,7 @@ static DWORD CALLBACK notify_message_proc(void *arg)
 {
     const struct notify_message_params *params = arg;
     HRESULT hr = IVideoWindow_NotifyOwnerMessage(params->window, (OAHWND)params->hwnd, params->message, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return 0;
 }
 
@@ -2393,15 +2393,15 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     flush_events();
 
     hr = IVideoWindow_get_MessageDrain(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!oahwnd, "Got window %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!oahwnd, "Got window %#Ix.\n", oahwnd);
 
     hr = IVideoWindow_put_MessageDrain(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_MessageDrain(window, &oahwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(oahwnd == (OAHWND)our_hwnd, "Got window %#lx.\n", oahwnd);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(oahwnd == (OAHWND)our_hwnd, "Got window %#Ix.\n", oahwnd);
 
     for (i = 0; i < ARRAY_SIZE(drain_tests); ++i)
     {
@@ -2410,8 +2410,8 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
         ok(ret, "Expected a message.\n");
         ok(msg.hwnd == our_hwnd, "Got hwnd %p.\n", msg.hwnd);
         ok(msg.message == drain_tests[i], "Got message %#x.\n", msg.message);
-        ok(msg.wParam == 0xdeadbeef, "Got wparam %#lx.\n", msg.wParam);
-        ok(!msg.lParam, "Got lparam %#lx.\n", msg.lParam);
+        ok(msg.wParam == 0xdeadbeef, "Got wparam %#Ix.\n", msg.wParam);
+        ok(!msg.lParam, "Got lparam %#Ix.\n", msg.lParam);
         DispatchMessageA(&msg);
 
         ret = PeekMessageA(&msg, 0, drain_tests[i], drain_tests[i], PM_REMOVE);
@@ -2419,10 +2419,10 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_put_MessageDrain(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_Owner(window, (OAHWND)our_hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     flush_events();
 
@@ -2431,7 +2431,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
      * posted all messages. */
 
     hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_SYSCOLORCHANGE, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
@@ -2440,7 +2440,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_NotifyOwnerMessage(window, (OAHWND)our_hwnd, WM_FONTCHANGE, 0, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
@@ -2477,7 +2477,7 @@ static void test_video_window_messages(IVideoWindow *window, HWND hwnd, HWND our
     }
 
     hr = IVideoWindow_put_Owner(window, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static void test_video_window_autoshow(IVideoWindow *window, IFilterGraph2 *graph, HWND hwnd)
@@ -2489,41 +2489,41 @@ static void test_video_window_autoshow(IVideoWindow *window, IFilterGraph2 *grap
     IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
 
     hr = IVideoWindow_get_AutoShow(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OATRUE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OATRUE, "Got %ld.\n", l);
 
     hr = IVideoWindow_put_AutoShow(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_put_Visible(window, OAFALSE);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Visible(window, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(l == OAFALSE, "Got %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(l == OAFALSE, "Got %ld.\n", l);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaControl_Release(control);
 }
@@ -2583,27 +2583,27 @@ static void test_video_window(void)
     IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
 
     hr = IPin_QueryInterface(pin, &IID_IOverlay, (void **)&overlay);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (winetest_debug > 1) trace("ours %p, theirs %p\n", our_hwnd, hwnd);
     GetWindowRect(hwnd, &rect);
 
     tid = GetWindowThreadProcessId(hwnd, NULL);
-    ok(tid == GetCurrentThreadId(), "Expected tid %#x, got %#x.\n", GetCurrentThreadId(), tid);
+    ok(tid == GetCurrentThreadId(), "Expected tid %#lx, got %#lx.\n", GetCurrentThreadId(), tid);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IVideoWindow, (void **)&window);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_Caption(window, &caption);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_WindowStyle(window, &l);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_get_AutoShow(window, &l);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     testfilter_init(&source);
     IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
@@ -2615,17 +2615,17 @@ static void test_video_window(void)
         skip("Got E_FAIL when connecting.\n");
         goto out;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
         hr = IMemAllocator_Commit(allocator);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(allocator);
     }
 
@@ -2640,34 +2640,34 @@ static void test_video_window(void)
     test_video_window_messages(window, hwnd, our_hwnd);
 
     hr = IVideoWindow_put_FullScreenMode(window, OATRUE);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_get_FullScreenMode(window, &l);
-    ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     hr = IVideoWindow_GetMinIdealImageSize(window, &width, &height);
-    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
     hr = IVideoWindow_GetMaxIdealImageSize(window, &width, &height);
-    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     monitorinfo.cbSize = sizeof(monitorinfo);
     GetMonitorInfoW(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), &monitorinfo);
 
     hr = IVideoWindow_GetMinIdealImageSize(window, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(width == 1, "Got width %d.\n", width);
-    todo_wine ok(height == 1, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(width == 1, "Got width %ld.\n", width);
+    todo_wine ok(height == 1, "Got height %ld.\n", height);
     hr = IVideoWindow_GetMaxIdealImageSize(window, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(width == monitorinfo.rcMonitor.right + 1, "Expected width %d, got %d.\n",
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(width == monitorinfo.rcMonitor.right + 1, "Expected width %ld, got %ld.\n",
             monitorinfo.rcMonitor.right + 1, width);
-    todo_wine ok(height == monitorinfo.rcMonitor.bottom + 1, "Expected height %d, got %d.\n",
+    todo_wine ok(height == monitorinfo.rcMonitor.bottom + 1, "Expected height %ld, got %ld.\n",
             monitorinfo.rcMonitor.bottom + 1, height);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
 out:
     IMediaControl_Release(control);
@@ -2677,9 +2677,9 @@ out:
     IMemInputPin_Release(input);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(our_hwnd);
 }
 
@@ -2706,7 +2706,7 @@ static IDirect3DDevice9 *create_device(HWND window)
     IDirect3D9_Release(d3d);
     if (FAILED(hr))
     {
-        skip("Failed to create a 3D device, hr %#x.\n", hr);
+        skip("Failed to create a 3D device, hr %#lx.\n", hr);
         return NULL;
     }
     return device;
@@ -2751,7 +2751,7 @@ static void test_allocate_surface_helper(void)
 
     count = 2;
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
-    todo_wine ok(hr == E_FAIL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
 
     hr = IVMRSurfaceAllocatorNotify9_SetD3DDevice(notify, device, MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY));
     if (hr == E_NOINTERFACE)
@@ -2759,42 +2759,42 @@ static void test_allocate_surface_helper(void)
         win_skip("Direct3D does not support video rendering.\n");
         goto out;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     if (0) /* crashes on Windows */
     {
         hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, NULL, &count, surfaces);
-        ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+        ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
         hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, NULL, surfaces);
-        ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+        ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     }
 
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     ok(!!surfaces[0], "Surface 0 was not allocated.\n");
     ok(!!surfaces[1], "Surface 1 was not allocated.\n");
 
     hr = IDirect3DSurface9_GetDevice(surfaces[0], &device2);
-    ok(hr == D3D_OK, "Got hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
     ok(device2 == device, "Devices did not match.\n");
     IDirect3DDevice9_Release(device2);
 
     hr = IDirect3DSurface9_GetContainer(surfaces[0], &IID_IDirect3DTexture9, (void **)&container);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
 
     hr = IDirect3DSurface9_GetDesc(surfaces[0], &desc);
-    ok(hr == D3D_OK, "Got hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
     ok(desc.Format == info.Format, "Got format %#x.\n", desc.Format);
     ok(desc.Type == D3DRTYPE_SURFACE, "Got type %u.\n", desc.Type);
-    ok(!desc.Usage, "Got usage %#x.\n", desc.Usage);
+    ok(!desc.Usage, "Got usage %#lx.\n", desc.Usage);
     ok(desc.Pool == D3DPOOL_DEFAULT, "Got pool %u.\n", desc.Pool);
     ok(desc.MultiSampleType == D3DMULTISAMPLE_NONE, "Got multisample type %u.\n", desc.MultiSampleType);
-    ok(!desc.MultiSampleQuality, "Got multisample quality %u.\n", desc.MultiSampleQuality);
+    ok(!desc.MultiSampleQuality, "Got multisample quality %lu.\n", desc.MultiSampleQuality);
     ok(desc.Width == 32, "Got width %u.\n", desc.Width);
     ok(desc.Height == 16, "Got height %u.\n", desc.Height);
 
@@ -2804,16 +2804,16 @@ static void test_allocate_surface_helper(void)
     surfaces[0] = surfaces[1] = NULL;
     count = 1;
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(!count, "Got count %u.\n", count);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    todo_wine ok(!count, "Got count %lu.\n", count);
     ok(!surfaces[0], "Surface 0 was allocated.\n");
     ok(!surfaces[1], "Surface 1 was allocated.\n");
 
     count = 2;
     info.MinBuffers = 1;
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     ok(!!surfaces[0], "Surface 0 was not allocated.\n");
     ok(!!surfaces[1], "Surface 1 was not allocated.\n");
     IDirect3DSurface9_Release(surfaces[0]);
@@ -2823,28 +2823,28 @@ static void test_allocate_surface_helper(void)
     info.dwFlags = VMR9AllocFlag_TextureSurface;
     surfaces[0] = surfaces[1] = NULL;
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     ok(!!surfaces[0], "Surface 0 was not allocated.\n");
     ok(!!surfaces[1], "Surface 1 was not allocated.\n");
 
     hr = IDirect3DSurface9_GetDevice(surfaces[0], &device2);
-    ok(hr == D3D_OK, "Got hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
     ok(device2 == device, "Devices did not match.\n");
     IDirect3DDevice9_Release(device2);
 
     hr = IDirect3DSurface9_GetContainer(surfaces[0], &IID_IDirect3DTexture9, (void **)&container);
-    ok(hr == D3D_OK, "Got hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
     IDirect3DTexture9_Release(container);
 
     hr = IDirect3DSurface9_GetDesc(surfaces[1], &desc);
-    ok(hr == D3D_OK, "Got hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
     ok(desc.Format == info.Format, "Got format %#x.\n", desc.Format);
     ok(desc.Type == D3DRTYPE_SURFACE, "Got type %u.\n", desc.Type);
-    ok(desc.Usage == D3DUSAGE_DYNAMIC, "Got usage %#x.\n", desc.Usage);
+    ok(desc.Usage == D3DUSAGE_DYNAMIC, "Got usage %#lx.\n", desc.Usage);
     ok(desc.Pool == D3DPOOL_DEFAULT, "Got pool %u.\n", desc.Pool);
     ok(desc.MultiSampleType == D3DMULTISAMPLE_NONE, "Got multisample type %u.\n", desc.MultiSampleType);
-    ok(!desc.MultiSampleQuality, "Got multisample quality %u.\n", desc.MultiSampleQuality);
+    ok(!desc.MultiSampleQuality, "Got multisample quality %lu.\n", desc.MultiSampleQuality);
     ok(desc.Width == 32, "Got width %u.\n", desc.Width);
     ok(desc.Height == 16, "Got height %u.\n", desc.Height);
 
@@ -2854,8 +2854,8 @@ static void test_allocate_surface_helper(void)
     info.Format = D3DFMT_R8G8B8;
     surfaces[0] = surfaces[1] = NULL;
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
-    ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == D3DERR_INVALIDCALL, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
     ok(!surfaces[0], "Surface 0 was allocated.\n");
     ok(!surfaces[1], "Surface 1 was allocated.\n");
 
@@ -2863,19 +2863,19 @@ static void test_allocate_surface_helper(void)
     info.dwFlags = VMR9AllocFlag_3DRenderTarget;
     count = 1;
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     ok(!!surfaces[0], "Surface 0 was not allocated.\n");
     ok(info.Format != 0, "Expected a format.\n");
 
     hr = IDirect3DSurface9_GetDesc(surfaces[0], &desc);
-    ok(hr == D3D_OK, "Got hr %#x.\n", hr);
+    ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
     ok(desc.Format == info.Format, "Expected format %#x, got %#x.\n", info.Format, desc.Format);
     ok(desc.Type == D3DRTYPE_SURFACE, "Got type %u.\n", desc.Type);
-    ok(desc.Usage == D3DUSAGE_RENDERTARGET, "Got usage %#x.\n", desc.Usage);
+    ok(desc.Usage == D3DUSAGE_RENDERTARGET, "Got usage %#lx.\n", desc.Usage);
     ok(desc.Pool == D3DPOOL_DEFAULT, "Got pool %u.\n", desc.Pool);
     ok(desc.MultiSampleType == D3DMULTISAMPLE_NONE, "Got multisample type %u.\n", desc.MultiSampleType);
-    ok(!desc.MultiSampleQuality, "Got multisample quality %u.\n", desc.MultiSampleQuality);
+    ok(!desc.MultiSampleQuality, "Got multisample quality %lu.\n", desc.MultiSampleQuality);
     ok(desc.Width == 32, "Got width %u.\n", desc.Width);
     ok(desc.Height == 16, "Got height %u.\n", desc.Height);
 
@@ -2885,15 +2885,15 @@ static void test_allocate_surface_helper(void)
     info.dwFlags = VMR9AllocFlag_OffscreenSurface | VMR9AllocFlag_TextureSurface;
     count = 1;
     hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
 
 out:
     IVMRSurfaceAllocatorNotify9_Release(notify);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IDirect3DDevice9_Release(device);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(window);
 }
 
@@ -2936,14 +2936,14 @@ static ULONG WINAPI presenter_Release(IVMRImagePresenter9 *iface)
 static HRESULT WINAPI presenter_StartPresenting(IVMRImagePresenter9 *iface, DWORD_PTR cookie)
 {
     if (winetest_debug > 1) trace("StartPresenting()\n");
-    ok(cookie == 0xabacab, "Got cookie %#lx.\n", cookie);
+    ok(cookie == 0xabacab, "Got cookie %#Ix.\n", cookie);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI presenter_StopPresenting(IVMRImagePresenter9 *iface, DWORD_PTR cookie)
 {
     if (winetest_debug > 1) trace("StopPresenting()\n");
-    ok(cookie == 0xabacab, "Got cookie %#lx.\n", cookie);
+    ok(cookie == 0xabacab, "Got cookie %#Ix.\n", cookie);
     return E_NOTIMPL;
 }
 
@@ -2953,16 +2953,16 @@ static HRESULT WINAPI presenter_PresentImage(IVMRImagePresenter9 *iface, DWORD_P
     static const RECT rect;
 
     if (winetest_debug > 1) trace("PresentImage()\n");
-    ok(cookie == 0xabacab, "Got cookie %#lx.\n", cookie);
-    todo_wine ok(info->dwFlags == VMR9Sample_TimeValid, "Got flags %#x.\n", info->dwFlags);
+    ok(cookie == 0xabacab, "Got cookie %#Ix.\n", cookie);
+    todo_wine ok(info->dwFlags == VMR9Sample_TimeValid, "Got flags %#lx.\n", info->dwFlags);
     ok(!info->rtStart, "Got start time %s.\n", wine_dbgstr_longlong(info->rtStart));
     ok(info->rtEnd == 10000000, "Got end time %s.\n", wine_dbgstr_longlong(info->rtEnd));
-    todo_wine ok(info->szAspectRatio.cx == 120, "Got aspect ratio width %d.\n", info->szAspectRatio.cx);
-    todo_wine ok(info->szAspectRatio.cy == 60, "Got aspect ratio height %d.\n", info->szAspectRatio.cy);
+    todo_wine ok(info->szAspectRatio.cx == 120, "Got aspect ratio width %ld.\n", info->szAspectRatio.cx);
+    todo_wine ok(info->szAspectRatio.cy == 60, "Got aspect ratio height %ld.\n", info->szAspectRatio.cy);
     ok(EqualRect(&info->rcSrc, &rect), "Got source rect %s.\n", wine_dbgstr_rect(&info->rcSrc));
     ok(EqualRect(&info->rcDst, &rect), "Got dest rect %s.\n", wine_dbgstr_rect(&info->rcDst));
-    ok(!info->dwReserved1, "Got dwReserved1 %#x.\n", info->dwReserved1);
-    ok(!info->dwReserved2, "Got dwReserved2 %#x.\n", info->dwReserved2);
+    ok(!info->dwReserved1, "Got dwReserved1 %#lx.\n", info->dwReserved1);
+    ok(!info->dwReserved2, "Got dwReserved2 %#lx.\n", info->dwReserved2);
 
     ++presenter->got_PresentImage;
     return S_OK;
@@ -3017,18 +3017,18 @@ static HRESULT WINAPI allocator_InitializeDevice(IVMRSurfaceAllocator9 *iface,
 {
     struct presenter *presenter = impl_from_IVMRSurfaceAllocator9(iface);
 
-    if (winetest_debug > 1) trace("InitializeDevice(flags %#x, format %u)\n",
+    if (winetest_debug > 1) trace("InitializeDevice(flags %#lx, format %u)\n",
             info->dwFlags, info->Format);
-    ok(cookie == 0xabacab, "Got cookie %#lx.\n", cookie);
-    ok(info->dwWidth == 32, "Got width %u.\n", info->dwWidth);
-    ok(info->dwHeight == 16, "Got height %u.\n", info->dwHeight);
-    todo_wine ok(info->MinBuffers == 5, "Got buffer count %u.\n", info->MinBuffers);
+    ok(cookie == 0xabacab, "Got cookie %#Ix.\n", cookie);
+    ok(info->dwWidth == 32, "Got width %lu.\n", info->dwWidth);
+    ok(info->dwHeight == 16, "Got height %lu.\n", info->dwHeight);
+    todo_wine ok(info->MinBuffers == 5, "Got buffer count %lu.\n", info->MinBuffers);
     ok(info->Pool == D3DPOOL_DEFAULT, "Got pool %u\n", info->Pool);
-    todo_wine ok(info->szAspectRatio.cx == 120, "Got aspect ratio width %d.\n", info->szAspectRatio.cx);
-    todo_wine ok(info->szAspectRatio.cy == 60, "Got aspect ratio height %d.\n", info->szAspectRatio.cy);
-    ok(info->szNativeSize.cx == 32, "Got native width %d.\n", info->szNativeSize.cx);
-    ok(info->szNativeSize.cy == 16, "Got native height %d.\n", info->szNativeSize.cy);
-    todo_wine ok(*buffer_count == 5, "Got buffer count %u.\n", *buffer_count);
+    todo_wine ok(info->szAspectRatio.cx == 120, "Got aspect ratio width %ld.\n", info->szAspectRatio.cx);
+    todo_wine ok(info->szAspectRatio.cy == 60, "Got aspect ratio height %ld.\n", info->szAspectRatio.cy);
+    ok(info->szNativeSize.cx == 32, "Got native width %ld.\n", info->szNativeSize.cx);
+    ok(info->szNativeSize.cy == 16, "Got native height %ld.\n", info->szNativeSize.cy);
+    todo_wine ok(*buffer_count == 5, "Got buffer count %lu.\n", *buffer_count);
 
     presenter->format = info->Format;
 
@@ -3043,7 +3043,7 @@ static HRESULT WINAPI allocator_TerminateDevice(IVMRSurfaceAllocator9 *iface, DW
     struct presenter *presenter = impl_from_IVMRSurfaceAllocator9(iface);
 
     if (winetest_debug > 1) trace("TerminateDevice()\n");
-    ok(cookie == 0xabacab, "Got cookie %#lx.\n", cookie);
+    ok(cookie == 0xabacab, "Got cookie %#Ix.\n", cookie);
     /* Don't dereference the surfaces here, to mimic How to Survive. */
     ++presenter->got_TerminateDevice;
     return E_NOTIMPL;
@@ -3054,10 +3054,10 @@ static HRESULT WINAPI allocator_GetSurface(IVMRSurfaceAllocator9 *iface,
 {
     struct presenter *presenter = impl_from_IVMRSurfaceAllocator9(iface);
 
-    if (winetest_debug > 1) trace("GetSurface(index %u)\n", index);
-    ok(cookie == 0xabacab, "Got cookie %#lx.\n", cookie);
-    ok(!flags, "Got flags %#x.\n", flags);
-    ok(index < 5, "Got index %u.\n", index);
+    if (winetest_debug > 1) trace("GetSurface(index %lu)\n", index);
+    ok(cookie == 0xabacab, "Got cookie %#Ix.\n", cookie);
+    ok(!flags, "Got flags %#lx.\n", flags);
+    ok(index < 5, "Got index %lu.\n", index);
 
     /* Don't reference the surface here, to mimic How to Survive. */
     *surface = presenter->surfaces[index];
@@ -3094,10 +3094,10 @@ static void test_renderless_present(struct presenter *presenter,
     presenter->got_PresentImage = 0;
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     thread = send_frame(input);
     hr = IMediaControl_GetState(control, 1000, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     /* Atelier Sophie uses the VMR in renderless mode, calls
      * IMediaControl::Run() from a stopped state and expects that
      * IMediaControl::GetState() returns S_OK only after PresentImage() has
@@ -3105,13 +3105,13 @@ static void test_renderless_present(struct presenter *presenter,
     ok(presenter->got_PresentImage == 1, "Got %u calls to PresentImage().\n", presenter->got_PresentImage);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = join_thread(thread);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(presenter->got_PresentImage == 1, "Got %u calls to PresentImage().\n", presenter->got_PresentImage);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IMediaControl_Release(control);
 }
@@ -3200,11 +3200,11 @@ static void test_renderless_formats(void)
         win_skip("Direct3D does not support video rendering.\n");
         goto out;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRSurfaceAllocatorNotify9_AdviseSurfaceAllocator(notify, 0xabacab,
             &presenter.IVMRSurfaceAllocator9_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     presenter.notify = notify;
 
@@ -3226,14 +3226,14 @@ static void test_renderless_formats(void)
          * IMemAllocator::SetProperties(), so let that fail here for now. */
         if (hr != S_OK)
         {
-            skip("Format %u (%#x), flags %#x are not supported, hr %#x.\n",
+            skip("Format %u (%#x), flags %#lx are not supported, hr %#lx.\n",
                     tests[i].format, tests[i].format, tests[i].flags, hr);
             continue;
         }
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
 
         hr = IMemInputPin_GetAllocator(input, &allocator);
-        todo_wine ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        todo_wine ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
         if (hr != S_OK)
         {
             test_allocator(input);
@@ -3243,22 +3243,22 @@ static void test_renderless_formats(void)
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
         if (hr != S_OK)
         {
-            skip("Format %u (%#x), flags %#x are not supported, hr %#x.\n",
+            skip("Format %u (%#x), flags %#lx are not supported, hr %#lx.\n",
                     tests[i].format, tests[i].format, tests[i].flags, hr);
             IMemAllocator_Release(allocator);
             hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-            ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+            ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
             hr = IFilterGraph2_Disconnect(graph, pin);
-            ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+            ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
             continue;
         }
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
         hr = IMemAllocator_Commit(allocator);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
 
         hr = IVMRSurfaceAllocatorNotify9_AdviseSurfaceAllocator(notify, 0xabacab,
                 &presenter2.IVMRSurfaceAllocator9_iface);
-        ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+        ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
         ok(presenter.format == tests[i].format, "Test %u: Got format %u (%#x).\n",
                 i, presenter.format, presenter.format);
@@ -3266,31 +3266,31 @@ static void test_renderless_formats(void)
         test_renderless_present(&presenter, graph, input);
 
         hr = IMemAllocator_Decommit(allocator);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
         IMemAllocator_Release(allocator);
 
         hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
         hr = IFilterGraph2_Disconnect(graph, pin);
-        ok(hr == S_OK, "Test %u: Got hr %#x.\n", i, hr);
+        ok(hr == S_OK, "Test %u: Got hr %#lx.\n", i, hr);
     }
 
     hr = IVMRSurfaceAllocatorNotify9_AdviseSurfaceAllocator(notify, 0xabacab, &presenter2.IVMRSurfaceAllocator9_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IMemInputPin_Release(input);
     IPin_Release(pin);
 
 out:
     IVMRSurfaceAllocatorNotify9_Release(notify);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
-    ok(presenter.refcount == 1, "Got outstanding refcount %d.\n", presenter.refcount);
-    ok(presenter2.refcount == 1, "Got outstanding refcount %d.\n", presenter2.refcount);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
+    ok(presenter.refcount == 1, "Got outstanding refcount %ld.\n", presenter.refcount);
+    ok(presenter2.refcount == 1, "Got outstanding refcount %ld.\n", presenter2.refcount);
     ref = IDirect3DDevice9_Release(device);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(window);
 }
 
@@ -3320,32 +3320,32 @@ static void test_mixing_mode(void)
         IBaseFilter_QueryInterface(filter, &IID_IVMRFilterConfig9, (void **)&config);
 
         hr = IBaseFilter_QueryInterface(filter, &IID_IVMRMixerControl9, (void **)&mixer_control);
-        ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+        ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
 
         hr = IVMRFilterConfig9_GetNumberOfStreams(config, &stream_count);
-        ok(hr == VFW_E_VMR_NOT_IN_MIXER_MODE, "Got hr %#x.\n", hr);
+        ok(hr == VFW_E_VMR_NOT_IN_MIXER_MODE, "Got hr %#lx.\n", hr);
 
         hr = IVMRFilterConfig9_SetNumberOfStreams(config, 1);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
         hr = IVMRFilterConfig9_GetNumberOfStreams(config, &stream_count);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(stream_count == 1, "Got %u streams.\n", stream_count);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(stream_count == 1, "Got %lu streams.\n", stream_count);
 
         hr = IBaseFilter_QueryInterface(filter, &IID_IVMRMixerControl9, (void **)&mixer_control);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IVMRMixerControl9_Release(mixer_control);
 
         hr = IVMRFilterConfig9_SetNumberOfStreams(config, 2);
-        ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+        ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
         hr = IVMRFilterConfig9_GetNumberOfStreams(config, &stream_count);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
-        ok(stream_count == 1, "Got %u streams.\n", stream_count);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
+        ok(stream_count == 1, "Got %lu streams.\n", stream_count);
 
         IVMRFilterConfig9_Release(config);
         ref = IBaseFilter_Release(filter);
-        ok(!ref, "Got outstanding refcount %d.\n", ref);
+        ok(!ref, "Got outstanding refcount %ld.\n", ref);
     }
 
     filter = create_vmr9(VMR9Mode_Windowless);
@@ -3355,27 +3355,27 @@ static void test_mixing_mode(void)
     window = CreateWindowA("static", "quartz_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
     ok(!!window, "Failed to create a window.\n");
     hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, window);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetNumberOfStreams(config, &stream_count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(stream_count == 4, "Got %u streams.\n", stream_count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(stream_count == 4, "Got %lu streams.\n", stream_count);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IVMRMixerControl9, (void **)&mixer_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IVMRMixerControl9_Release(mixer_control);
 
     hr = IVMRFilterConfig9_SetNumberOfStreams(config, 2);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     hr = IVMRFilterConfig9_GetNumberOfStreams(config, &stream_count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(stream_count == 4, "Got %u streams.\n", stream_count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(stream_count == 4, "Got %lu streams.\n", stream_count);
 
     IVMRWindowlessControl9_Release(windowless_control);
     IVMRFilterConfig9_Release(config);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(window);
 }
 
@@ -3414,30 +3414,30 @@ static void test_clipping_window(void)
     ok(!!window, "Failed to create a window.\n");
 
     hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, (HWND)0xdeadbeef);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, window);
-    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, window);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IPin_Release(pin);
     IVMRWindowlessControl9_Release(windowless_control);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(window);
 }
 
@@ -3460,16 +3460,16 @@ static void test_surface_allocator_notify_refcount(void)
 
     hr = IVMRSurfaceAllocatorNotify9_AdviseSurfaceAllocator(notify, 0xabacab,
             &presenter.IVMRSurfaceAllocator9_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ok(presenter.got_TerminateDevice == 1, "Got %u calls to TerminateDevice().\n",
             presenter.got_TerminateDevice);
-    ok(presenter.refcount == 1, "Got outstanding refcount %d.\n", presenter.refcount);
+    ok(presenter.refcount == 1, "Got outstanding refcount %ld.\n", presenter.refcount);
 
     ref = IVMRSurfaceAllocatorNotify9_Release(notify);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void check_source_position_(int line, IBasicVideo *video,
@@ -3480,31 +3480,31 @@ static void check_source_position_(int line, IBasicVideo *video,
 
     left = top = width = height = 0xdeadbeef;
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, &width, &height);
-    ok_(__FILE__,line)(hr == S_OK, "Got hr %#x.\n", hr);
-    ok_(__FILE__,line)(left == expect_left, "Got left %d.\n", left);
-    ok_(__FILE__,line)(top == expect_top, "Got top %d.\n", top);
-    ok_(__FILE__,line)(width == expect_width, "Got width %d.\n", width);
-    ok_(__FILE__,line)(height == expect_height, "Got height %d.\n", height);
+    ok_(__FILE__,line)(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok_(__FILE__,line)(left == expect_left, "Got left %ld.\n", left);
+    ok_(__FILE__,line)(top == expect_top, "Got top %ld.\n", top);
+    ok_(__FILE__,line)(width == expect_width, "Got width %ld.\n", width);
+    ok_(__FILE__,line)(height == expect_height, "Got height %ld.\n", height);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceLeft(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == left, "Got left %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == left, "Got left %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceTop(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == top, "Got top %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == top, "Got top %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceWidth(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == width, "Got width %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == width, "Got width %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_SourceHeight(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == height, "Got height %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == height, "Got height %ld.\n", l);
 }
 #define check_source_position(a,b,c,d,e) check_source_position_(__LINE__,a,b,c,d,e)
 
@@ -3514,77 +3514,77 @@ static void test_basic_video_source(IBasicVideo *video)
 
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceLeft(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceLeft(video, 10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceTop(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(video, 10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceWidth(video, -500);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 700);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceWidth(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 500, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceHeight(video, -300);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 600);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceHeight(video, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceLeft(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceLeft(video, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 10, 0, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_SourceTop(video, -10);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_SourceTop(video, 20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 10, 20, 500, 300);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 4, 5, 60, 40);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 0, 0, 600, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetSourcePosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDefaultSourcePosition(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_source_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultSource(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 }
 
 static void check_destination_position_(int line, IBasicVideo *video,
@@ -3595,31 +3595,31 @@ static void check_destination_position_(int line, IBasicVideo *video,
 
     left = top = width = height = 0xdeadbeef;
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, &width, &height);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get position, hr %#x.\n", hr);
-    ok_(__FILE__,line)(left == expect_left, "Got left %d.\n", left);
-    ok_(__FILE__,line)(top == expect_top, "Got top %d.\n", top);
-    ok_(__FILE__,line)(width == expect_width, "Got width %d.\n", width);
-    ok_(__FILE__,line)(height == expect_height, "Got height %d.\n", height);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get position, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(left == expect_left, "Got left %ld.\n", left);
+    ok_(__FILE__,line)(top == expect_top, "Got top %ld.\n", top);
+    ok_(__FILE__,line)(width == expect_width, "Got width %ld.\n", width);
+    ok_(__FILE__,line)(height == expect_height, "Got height %ld.\n", height);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationLeft(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == left, "Got left %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get left, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == left, "Got left %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationTop(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == top, "Got top %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get top, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == top, "Got top %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationWidth(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == width, "Got width %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get width, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == width, "Got width %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_DestinationHeight(video, &l);
-    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#x.\n", hr);
-    ok_(__FILE__,line)(l == height, "Got height %d.\n", l);
+    ok_(__FILE__,line)(hr == S_OK, "Failed to get height, hr %#lx.\n", hr);
+    ok_(__FILE__,line)(l == height, "Got height %ld.\n", l);
 }
 #define check_destination_position(a,b,c,d,e) check_destination_position_(__LINE__,a,b,c,d,e)
 
@@ -3633,107 +3633,107 @@ static void test_basic_video_destination(IBasicVideo *video)
 
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationLeft(video, -10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, -10, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationLeft(video, 10);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationTop(video, -20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, -20, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationTop(video, 20);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationWidth(video, -700);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationWidth(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationWidth(video, 700);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 700, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationWidth(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationHeight(video, -500);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationHeight(video, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_put_DestinationHeight(video, 500);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 500);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_put_DestinationHeight(video, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 10, 20, 500, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 4, 5, 60, 40);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 0, 0, 600, 400);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 4, 5, 60, 40);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_SetDefaultDestinationPosition(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 600, 400);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     SetRect(&rect, 100, 200, 500, 500);
     AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
     hr = IVideoWindow_SetWindowPosition(window, rect.left, rect.top,
             rect.right - rect.left, rect.bottom - rect.top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_SetDestinationPosition(video, 0, 0, 400, 300);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     SetRect(&rect, 100, 200, 600, 600);
     AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
     hr = IVideoWindow_SetWindowPosition(window, rect.left, rect.top,
             rect.right - rect.left, rect.bottom - rect.top);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     check_destination_position(video, 0, 0, 400, 300);
     hr = IBasicVideo_IsUsingDefaultDestination(video);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IVideoWindow_Release(window);
 }
@@ -3782,83 +3782,83 @@ static void test_basic_video(void)
     IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
 
     hr = IBasicVideo_GetTypeInfoCount(video, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(count == 1, "Got count %u.\n", count);
 
     hr = IBasicVideo_GetTypeInfo(video, 0, 0, &typeinfo);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind);
     ok(IsEqualGUID(&typeattr->guid, &IID_IBasicVideo), "Got IID %s.\n", wine_dbgstr_guid(&typeattr->guid));
     ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
     ITypeInfo_Release(typeinfo);
 
     hr = IBasicVideo_get_AvgTimePerFrame(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_AvgTimePerFrame(video, &reftime);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_BitRate(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_BitRate(video, &l);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_BitErrorRate(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_BitErrorRate(video, &l);
-    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_VideoWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_VideoHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_SourceLeft(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceTop(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_SourceHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_get_DestinationLeft(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationWidth(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationTop(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_get_DestinationHeight(video, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetSourcePosition(video, NULL, &top, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, NULL, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetSourcePosition(video, &left, &top, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetDestinationPosition(video, NULL, &top, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, NULL, &width, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetDestinationPosition(video, &left, &top, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetVideoSize(video, &width, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoSize(video, NULL, &height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, NULL, &l);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, &l, NULL);
-    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#lx.\n", hr);
 
     testfilter_init(&source);
     IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, L"vmr9");
@@ -3869,66 +3869,66 @@ static void test_basic_video(void)
         skip("Got E_FAIL when connecting.\n");
         goto out;
     }
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
         hr = IMemAllocator_Commit(allocator);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(allocator);
     }
 
     reftime = 0.0;
     hr = IBasicVideo_get_AvgTimePerFrame(video, &reftime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(compare_double(reftime, 0.02, 1 << 28), "Got frame rate %.16e.\n", reftime);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_BitRate(video, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!l, "Got bit rate %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!l, "Got bit rate %ld.\n", l);
 
     l = 0xdeadbeef;
     hr = IBasicVideo_get_BitErrorRate(video, &l);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(!l, "Got bit rate %d.\n", l);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(!l, "Got bit rate %ld.\n", l);
 
     hr = IBasicVideo_GetVideoPaletteEntries(video, 0, 1, &l, NULL);
-    todo_wine ok(hr == VFW_E_NO_PALETTE_AVAILABLE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == VFW_E_NO_PALETTE_AVAILABLE, "Got hr %#lx.\n", hr);
 
     width = height = 0xdeadbeef;
     hr = IBasicVideo_GetVideoSize(video, &width, &height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 600, "Got width %d.\n", width);
-    ok(height == 400, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 600, "Got width %ld.\n", width);
+    ok(height == 400, "Got height %ld.\n", height);
 
     test_basic_video_source(video);
     test_basic_video_destination(video);
 
     hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IFilterGraph2_Disconnect(graph, pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     vih.bmiHeader.biWidth = 16;
     vih.bmiHeader.biHeight = 16;
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
         hr = IMemAllocator_Commit(allocator);
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         IMemAllocator_Release(allocator);
     }
 
@@ -3941,14 +3941,14 @@ static void test_basic_video(void)
 
 out:
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IBasicVideo_Release(video);
     IMemInputPin_Release(input);
     IPin_Release(pin);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(&source.filter.IBaseFilter_iface);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_windowless_size(void)
@@ -3996,12 +3996,12 @@ static void test_windowless_size(void)
     ok(!!window, "Failed to create a window.\n");
 
     hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, window);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMemInputPin_GetAllocator(input, &allocator);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     if (hr == S_OK)
     {
         hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props);
@@ -4011,57 +4011,57 @@ static void test_windowless_size(void)
             skip("Got E_FAIL when setting allocator properties.\n");
             goto out;
         }
-        ok(hr == S_OK, "Got hr %#x.\n", hr);
+        ok(hr == S_OK, "Got hr %#lx.\n", hr);
         ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n");
     }
 
     hr = IVMRWindowlessControl9_GetNativeVideoSize(windowless_control, NULL, &height, &aspect_width, &aspect_height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
     hr = IVMRWindowlessControl9_GetNativeVideoSize(windowless_control, &width, NULL, &aspect_width, &aspect_height);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     aspect_mode = 0xdeadbeef;
     hr = IVMRWindowlessControl9_GetAspectRatioMode(windowless_control, &aspect_mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(aspect_mode == VMR9ARMode_None, "Got mode %u.\n", aspect_mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(aspect_mode == VMR9ARMode_None, "Got mode %lu.\n", aspect_mode);
 
     aspect_mode = 0xdeadbeef;
     hr = IVMRAspectRatioControl9_GetAspectRatioMode(aspect_ratio_control, &aspect_mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(aspect_mode == VMR9ARMode_None, "Got mode %u.\n", aspect_mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(aspect_mode == VMR9ARMode_None, "Got mode %lu.\n", aspect_mode);
 
     width = height = 0xdeadbeef;
     hr = IVMRWindowlessControl9_GetNativeVideoSize(windowless_control, &width, &height, NULL, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(width == 32, "Got width %d.\n", width);
-    ok(height == 16, "Got height %d.\n", height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(width == 32, "Got width %ld.\n", width);
+    ok(height == 16, "Got height %ld.\n", height);
 
     aspect_width = aspect_height = 0xdeadbeef;
     hr = IVMRWindowlessControl9_GetNativeVideoSize(windowless_control, &width, &height, &aspect_width, &aspect_height);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(aspect_width == 32, "Got width %d.\n", aspect_width);
-    ok(aspect_height == 16, "Got height %d.\n", aspect_height);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(aspect_width == 32, "Got width %ld.\n", aspect_width);
+    ok(aspect_height == 16, "Got height %ld.\n", aspect_height);
 
     memset(&src, 0xcc, sizeof(src));
     hr = IVMRWindowlessControl9_GetVideoPosition(windowless_control, &src, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 0, 0, 32, 16);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
 
     memset(&dst, 0xcc, sizeof(dst));
     hr = IVMRWindowlessControl9_GetVideoPosition(windowless_control, NULL, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 0, 0, 0, 0);
     ok(EqualRect(&dst, &expect), "Got dest rect %s.\n", wine_dbgstr_rect(&dst));
 
     SetRect(&src, 4, 6, 16, 12);
     hr = IVMRWindowlessControl9_SetVideoPosition(windowless_control, &src, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     memset(&src, 0xcc, sizeof(src));
     memset(&dst, 0xcc, sizeof(dst));
     hr = IVMRWindowlessControl9_GetVideoPosition(windowless_control, &src, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 4, 6, 16, 12);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
     SetRect(&expect, 0, 0, 0, 0);
@@ -4069,12 +4069,12 @@ static void test_windowless_size(void)
 
     SetRect(&dst, 40, 60, 120, 160);
     hr = IVMRWindowlessControl9_SetVideoPosition(windowless_control, NULL, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     memset(&src, 0xcc, sizeof(src));
     memset(&dst, 0xcc, sizeof(dst));
     hr = IVMRWindowlessControl9_GetVideoPosition(windowless_control, &src, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 4, 6, 16, 12);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
     SetRect(&expect, 40, 60, 120, 160);
@@ -4085,28 +4085,28 @@ static void test_windowless_size(void)
     ok(EqualRect(&src, &expect), "Got window rect %s.\n", wine_dbgstr_rect(&src));
 
     hr = IVMRAspectRatioControl9_SetAspectRatioMode(aspect_ratio_control, VMR9ARMode_LetterBox);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     aspect_mode = 0xdeadbeef;
     hr = IVMRWindowlessControl9_GetAspectRatioMode(windowless_control, &aspect_mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(aspect_mode == VMR9ARMode_LetterBox, "Got mode %u.\n", aspect_mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(aspect_mode == VMR9ARMode_LetterBox, "Got mode %lu.\n", aspect_mode);
 
     hr = IVMRWindowlessControl9_SetAspectRatioMode(windowless_control, VMR9ARMode_None);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     aspect_mode = 0xdeadbeef;
     hr = IVMRAspectRatioControl9_GetAspectRatioMode(aspect_ratio_control, &aspect_mode);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(aspect_mode == VMR9ARMode_None, "Got mode %u.\n", aspect_mode);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(aspect_mode == VMR9ARMode_None, "Got mode %lu.\n", aspect_mode);
 
     hr = IVMRWindowlessControl9_SetAspectRatioMode(windowless_control, VMR9ARMode_LetterBox);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     memset(&src, 0xcc, sizeof(src));
     memset(&dst, 0xcc, sizeof(dst));
     hr = IVMRWindowlessControl9_GetVideoPosition(windowless_control, &src, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 4, 6, 16, 12);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
     SetRect(&expect, 40, 60, 120, 160);
@@ -4115,12 +4115,12 @@ static void test_windowless_size(void)
     SetRect(&src, 0, 0, 32, 16);
     SetRect(&dst, 0, 0, 640, 480);
     hr = IVMRWindowlessControl9_SetVideoPosition(windowless_control, &src, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     memset(&src, 0xcc, sizeof(src));
     memset(&dst, 0xcc, sizeof(dst));
     hr = IVMRWindowlessControl9_GetVideoPosition(windowless_control, &src, &dst);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     SetRect(&expect, 0, 0, 32, 16);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
     SetRect(&expect, 0, 0, 640, 480);
@@ -4128,13 +4128,13 @@ static void test_windowless_size(void)
 
 out:
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     IMemInputPin_Release(input);
     IPin_Release(pin);
     IVMRWindowlessControl9_Release(windowless_control);
     IVMRAspectRatioControl9_Release(aspect_ratio_control);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     DestroyWindow(window);
 }
 
@@ -4149,25 +4149,25 @@ static void test_mixing_prefs(void)
     set_mixing_mode(filter, 1);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IVMRMixerControl9, (void **)&mixer_control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRMixerControl9_GetMixingPrefs(mixer_control, &flags);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(flags == (MixerPref9_NoDecimation | MixerPref9_ARAdjustXorY | MixerPref9_BiLinearFiltering
-            | MixerPref9_RenderTargetRGB), "Got flags %#x.\n", flags);
+            | MixerPref9_RenderTargetRGB), "Got flags %#lx.\n", flags);
 
     hr = IVMRMixerControl9_SetMixingPrefs(mixer_control, MixerPref9_NoDecimation
             | MixerPref9_ARAdjustXorY | MixerPref9_PointFiltering | MixerPref9_RenderTargetRGB);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IVMRMixerControl9_GetMixingPrefs(mixer_control, &flags);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(flags == (MixerPref9_NoDecimation | MixerPref9_ARAdjustXorY | MixerPref9_PointFiltering
-            | MixerPref9_RenderTargetRGB), "Got flags %#x.\n", flags);
+            | MixerPref9_RenderTargetRGB), "Got flags %#lx.\n", flags);
 
     IVMRMixerControl9_Release(mixer_control);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_unconnected_eos(void)
@@ -4181,49 +4181,49 @@ static void test_unconnected_eos(void)
     ULONG ref;
 
     hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Pause(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Stop(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
 
     hr = IMediaControl_Run(control);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = check_ec_complete(eventsrc, 0);
     ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
@@ -4231,9 +4231,9 @@ static void test_unconnected_eos(void)
     IMediaControl_Release(control);
     IMediaEvent_Release(eventsrc);
     ref = IFilterGraph2_Release(graph);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 START_TEST(vmr9)
@@ -4246,7 +4246,7 @@ START_TEST(vmr9)
     if (FAILED(hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL,
             CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&filter)))
     {
-        skip("Failed to create VMR9, hr %#x.\n", hr);
+        skip("Failed to create VMR9, hr %#lx.\n", hr);
         return;
     }
     IBaseFilter_Release(filter);
diff --git a/dlls/quartz/tests/waveparser.c b/dlls/quartz/tests/waveparser.c
index fee93b33f5f..1c86a39c730 100644
--- a/dlls/quartz/tests/waveparser.c
+++ b/dlls/quartz/tests/waveparser.c
@@ -30,7 +30,7 @@ static IBaseFilter *create_wave_parser(void)
     IBaseFilter *filter = NULL;
     HRESULT hr = CoCreateInstance(&CLSID_WAVEParser, NULL, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     return filter;
 }
 
@@ -46,11 +46,11 @@ static WCHAR *load_resource(const WCHAR *name)
     wcscat(pathW, name);
 
     file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %u.\n",
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %lu.\n",
             wine_dbgstr_w(pathW), GetLastError());
 
     res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA);
-    ok(!!res, "Failed to load resource, error %u.\n", GetLastError());
+    ok(!!res, "Failed to load resource, error %lu.\n", GetLastError());
     ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res));
     WriteFile(file, ptr, SizeofResource( GetModuleHandleA(NULL), res), &written, NULL);
     ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n");
@@ -88,7 +88,7 @@ static IFilterGraph2 *connect_input(IBaseFilter *splitter, const WCHAR *filename
     IBaseFilter_FindPin(reader, L"Output", &source);
 
     hr = IFilterGraph2_ConnectDirect(graph, source, sink, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     IPin_Release(source);
     IPin_Release(sink);
@@ -107,7 +107,7 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
@@ -212,53 +212,53 @@ static void test_aggregation(void)
     filter = (IBaseFilter *)0xdeadbeef;
     hr = CoCreateInstance(&CLSID_WAVEParser, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IBaseFilter, (void **)&filter);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!filter, "Got interface %p.\n", filter);
 
     hr = CoCreateInstance(&CLSID_WAVEParser, &test_outer, CLSCTX_INPROC_SERVER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
     ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
     ref = get_refcount(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     ref = IUnknown_AddRef(unk);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     ref = IUnknown_Release(unk);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2);
     IUnknown_Release(unk2);
 
     hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2);
 
     hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2);
-    ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Got hr %#lx.\n", hr);
     ok(!unk2, "Got unexpected IUnknown %p.\n", unk2);
 
     hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
 
     IBaseFilter_Release(filter);
     ref = IUnknown_Release(unk);
-    ok(!ref, "Got unexpected refcount %d.\n", ref);
-    ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
+    ok(!ref, "Got unexpected refcount %ld.\n", ref);
+    ok(outer_ref == 1, "Got unexpected refcount %ld.\n", outer_ref);
 }
 
 static void test_enum_pins(void)
@@ -273,79 +273,79 @@ static void test_enum_pins(void)
     BOOL ret;
 
     ref = get_refcount(filter);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IBaseFilter_EnumPins(filter, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_EnumPins(filter, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, NULL, NULL);
-    ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+    ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ref = get_refcount(filter);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pins[0]);
-    ok(ref == 3, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 3, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(enum1);
-    ok(ref == 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 1, "Got unexpected refcount %ld.\n", ref);
     IPin_Release(pins[0]);
     ref = get_refcount(filter);
-    ok(ref == 2, "Got unexpected refcount %d.\n", ref);
+    ok(ref == 2, "Got unexpected refcount %ld.\n", ref);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, NULL);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum2, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     IEnumPins_Release(enum2);
@@ -353,46 +353,46 @@ static void test_enum_pins(void)
     graph = connect_input(filter, filename);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pins[0]);
 
     hr = IEnumPins_Next(enum1, 1, pins, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 2, pins, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     hr = IEnumPins_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum1, 3, pins, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 2, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 2, "Got count %lu.\n", count);
     IPin_Release(pins[0]);
     IPin_Release(pins[1]);
 
     IEnumPins_Release(enum1);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_find_pin(void)
@@ -407,31 +407,31 @@ static void test_find_pin(void)
     BOOL ret;
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     IPin_Release(pin);
 
     hr = IBaseFilter_FindPin(filter, L"output", &pin);
-    ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr);
+    ok(hr == VFW_E_NOT_FOUND, "Got hr %#lx.\n", hr);
 
     graph = connect_input(filter, filename);
 
     hr = IBaseFilter_EnumPins(filter, &enum_pins);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"output", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
     IPin_Release(pin);
     IPin_Release(pin2);
 
     hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin);
     IPin_Release(pin);
     IPin_Release(pin2);
@@ -439,9 +439,9 @@ static void test_find_pin(void)
     IEnumPins_Release(enum_pins);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_pin_info(void)
@@ -460,52 +460,52 @@ static void test_pin_info(void)
     graph = connect_input(filter, filename);
 
     hr = IBaseFilter_FindPin(filter, L"input pin", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     expect_ref = get_refcount(filter);
     ref = get_refcount(pin);
-    ok(ref == expect_ref, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref, "Got unexpected refcount %ld.\n", ref);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir);
     ok(!wcscmp(info.achName, L"input pin"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     ref = get_refcount(filter);
-    ok(ref == expect_ref + 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
     ref = get_refcount(pin);
-    ok(ref == expect_ref + 1, "Got unexpected refcount %d.\n", ref);
+    ok(ref == expect_ref + 1, "Got unexpected refcount %ld.\n", ref);
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"input pin"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
     IPin_Release(pin);
 
     hr = IBaseFilter_FindPin(filter, L"output", &pin);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     check_interface(pin, &IID_IPin, TRUE);
     check_interface(pin, &IID_IMediaSeeking, TRUE);
 
     hr = IPin_QueryPinInfo(pin, &info);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter);
     ok(info.dir == PINDIR_OUTPUT, "Got direction %d.\n", info.dir);
     ok(!wcscmp(info.achName, L"output"), "Got name %s.\n", wine_dbgstr_w(info.achName));
     IBaseFilter_Release(info.pFilter);
 
     hr = IPin_QueryDirection(pin, &dir);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(dir == PINDIR_OUTPUT, "Got direction %d.\n", dir);
 
     hr = IPin_QueryId(pin, &id);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!wcscmp(id, L"output"), "Got id %s.\n", wine_dbgstr_w(id));
     CoTaskMemFree(id);
 
@@ -513,9 +513,9 @@ static void test_pin_info(void)
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_media_types(void)
@@ -536,42 +536,42 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"input pin", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
 
     mt.majortype = MEDIATYPE_Stream;
     mt.subtype = MEDIASUBTYPE_WAVE;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.bFixedSizeSamples = TRUE;
     mt.bTemporalCompression = TRUE;
     mt.lSampleSize = 123;
     mt.formattype = FORMAT_VideoInfo;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     mt.majortype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.majortype = MEDIATYPE_Stream;
 
     mt.subtype = GUID_NULL;
     hr = IPin_QueryAccept(pin, &mt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     mt.subtype = MEDIASUBTYPE_WAVE;
 
     graph = connect_input(filter, filename);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
     IPin_Release(pin);
@@ -579,48 +579,48 @@ static void test_media_types(void)
     IBaseFilter_FindPin(filter, L"output", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enummt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio), "Got major type %s.\n",
             wine_dbgstr_guid(&pmt->majortype));
     ok(IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_PCM), "Got subtype %s\n",
             wine_dbgstr_guid(&pmt->subtype));
     ok(pmt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", pmt->bFixedSizeSamples);
     ok(!pmt->bTemporalCompression, "Got temporal compression %d.\n", pmt->bTemporalCompression);
-    ok(pmt->lSampleSize == 1, "Got sample size %u.\n", pmt->lSampleSize);
+    ok(pmt->lSampleSize == 1, "Got sample size %lu.\n", pmt->lSampleSize);
     ok(IsEqualGUID(&pmt->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n",
             wine_dbgstr_guid(&pmt->formattype));
     ok(!pmt->pUnk, "Got pUnk %p.\n", pmt->pUnk);
-    ok(pmt->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", pmt->cbFormat);
+    ok(pmt->cbFormat == sizeof(WAVEFORMATEX), "Got format size %lu.\n", pmt->cbFormat);
     ok(!memcmp(pmt->pbFormat, &expect_wfx, sizeof(WAVEFORMATEX)), "Format blocks didn't match.\n");
 
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pmt->bFixedSizeSamples = FALSE;
     pmt->bTemporalCompression = TRUE;
     pmt->lSampleSize = 123;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     pmt->majortype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->majortype = MEDIATYPE_Audio;
 
     pmt->subtype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->subtype = MEDIASUBTYPE_WAVE;
 
     pmt->formattype = GUID_NULL;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     pmt->formattype = FORMAT_None;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     wfx = (WAVEFORMATEX *)pmt->pbFormat;
 
@@ -628,28 +628,28 @@ static void test_media_types(void)
     wfx->nAvgBytesPerSec = 44100 * 2;
     wfx->nBlockAlign = 2;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     *wfx = expect_wfx;
 
     wfx->wFormatTag = WAVE_FORMAT_IMA_ADPCM;
     hr = IPin_QueryAccept(pin, pmt);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     *wfx = expect_wfx;
 
     CoTaskMemFree(pmt->pbFormat);
     CoTaskMemFree(pmt);
 
     hr = IEnumMediaTypes_Next(enummt, 1, &pmt, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enummt);
     IPin_Release(pin);
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_enum_media_types(void)
@@ -667,29 +667,29 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"input pin", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     IEnumMediaTypes_Release(enum1);
     IEnumMediaTypes_Release(enum2);
@@ -698,64 +698,64 @@ static void test_enum_media_types(void)
     IBaseFilter_FindPin(filter, L"output", &pin);
 
     hr = IPin_EnumMediaTypes(pin, &enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(!count, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(!count, "Got count %lu.\n", count);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 2, mts, &count);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(count == 1, "Got count %u.\n", count);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(count == 1, "Got count %lu.\n", count);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Clone(enum1, &enum2);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 2);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Reset(enum1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Skip(enum1, 1);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     CoTaskMemFree(mts[0]->pbFormat);
     CoTaskMemFree(mts[0]);
 
@@ -765,9 +765,9 @@ static void test_enum_media_types(void)
 
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void test_unconnected_filter_state(void)
@@ -778,53 +778,53 @@ static void test_unconnected_filter_state(void)
     ULONG ref;
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Pause(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Paused, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     hr = IBaseFilter_Run(filter, 0);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Running, "Got state %u.\n", state);
 
     hr = IBaseFilter_Stop(filter);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IBaseFilter_GetState(filter, 0, &state);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(state == State_Stopped, "Got state %u.\n", state);
 
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
 }
 
 static void test_seeking(void)
@@ -864,137 +864,137 @@ static void test_seeking(void)
     IPin_QueryInterface(pin, &IID_IMediaSeeking, (void **)&seeking);
 
     hr = IMediaSeeking_GetCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards
             | AM_SEEKING_CanSeekBackwards | AM_SEEKING_CanGetStopPos
-            | AM_SEEKING_CanGetDuration | AM_SEEKING_CanDoSegments), "Got caps %#x.\n", caps);
+            | AM_SEEKING_CanGetDuration | AM_SEEKING_CanDoSegments), "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards), "Got caps %#x.\n", caps);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(caps == (AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanSeekForwards), "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanSeekAbsolute | AM_SEEKING_CanGetCurrentPos;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
-    ok(caps == AM_SEEKING_CanSeekAbsolute, "Got caps %#x.\n", caps);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
+    ok(caps == AM_SEEKING_CanSeekAbsolute, "Got caps %#lx.\n", caps);
 
     caps = AM_SEEKING_CanGetCurrentPos;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(!caps, "Got caps %#x.\n", caps);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(!caps, "Got caps %#lx.\n", caps);
 
     caps = 0;
     hr = IMediaSeeking_CheckCapabilities(seeking, &caps);
-    ok(hr == E_FAIL, "Got hr %#x.\n", hr);
-    ok(!caps, "Got caps %#x.\n", caps);
+    ok(hr == E_FAIL, "Got hr %#lx.\n", hr);
+    ok(!caps, "Got caps %#lx.\n", caps);
 
     for (i = 0; i < ARRAY_SIZE(format_tests); ++i)
     {
         hr = IMediaSeeking_IsFormatSupported(seeking, format_tests[i].guid);
-        todo_wine_if(i == 1) ok(hr == format_tests[i].hr, "Got hr %#x for format %s.\n",
+        todo_wine_if(i == 1) ok(hr == format_tests[i].hr, "Got hr %#lx for format %s.\n",
                 hr, wine_dbgstr_guid(format_tests[i].guid));
     }
 
     hr = IMediaSeeking_QueryPreferredFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
-    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_FRAME);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetTimeFormat(seeking, &format);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(IsEqualGUID(&format, &TIME_FORMAT_SAMPLE), "Got format %s.\n", wine_dbgstr_guid(&format));
 
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_FALSE, "Got hr %#lx.\n", hr);
     hr = IMediaSeeking_IsUsingTimeFormat(seeking, &TIME_FORMAT_SAMPLE);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_SetTimeFormat(seeking, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     duration = 0xdeadbeef;
     hr = IMediaSeeking_GetDuration(seeking, &duration);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(duration == 1000000, "Got duration %I64d.\n", duration);
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetStopPosition(seeking, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(stop == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
     hr = IMediaSeeking_GetCurrentPosition(seeking, &current);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!current, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(stop));
 
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, &TIME_FORMAT_MEDIA_TIME, 0x123456789a, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 0x123456789a, &TIME_FORMAT_MEDIA_TIME);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(time == 0x123456789a, "Got time %s.\n", wine_dbgstr_longlong(time));
     time = 0xdeadbeef;
     hr = IMediaSeeking_ConvertTimeFormat(seeking, &time, NULL, 441, &TIME_FORMAT_SAMPLE);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(time == 100000, "Got time %s.\n", wine_dbgstr_longlong(time));
 
     earliest = latest = 0xdeadbeef;
     hr = IMediaSeeking_GetAvailable(seeking, &earliest, &latest);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(!earliest, "Got time %s.\n", wine_dbgstr_longlong(earliest));
     ok(latest == duration, "Expected time %s, got %s.\n",
             wine_dbgstr_longlong(duration), wine_dbgstr_longlong(latest));
 
     rate = 0;
     hr = IMediaSeeking_GetRate(seeking, &rate);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(rate == 1.0, "Got rate %.16e.\n", rate);
 
     hr = IMediaSeeking_SetRate(seeking, 200.0);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
     rate = 0;
     hr = IMediaSeeking_GetRate(seeking, &rate);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     todo_wine ok(rate == 200.0, "Got rate %.16e.\n", rate);
 
     hr = IMediaSeeking_SetRate(seeking, -1.0);
-    todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = IMediaSeeking_GetPreroll(seeking, &time);
-    todo_wine ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == E_NOTIMPL, "Got hr %#lx.\n", hr);
 
     current = 200 * 10000;
     stop = 400 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             &stop, AM_SEEKING_AbsolutePositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
@@ -1002,7 +1002,7 @@ static void test_seeking(void)
     stop = 400 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
             &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 400 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
@@ -1010,18 +1010,18 @@ static void test_seeking(void)
     stop = 200 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime,
             &stop, AM_SEEKING_AbsolutePositioning | AM_SEEKING_ReturnTime);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 100 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
     current = 50 * 10000;
     hr = IMediaSeeking_SetPositions(seeking, &current, AM_SEEKING_AbsolutePositioning,
             NULL, AM_SEEKING_NoPositioning);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     stop = current = 0xdeadbeef;
     hr = IMediaSeeking_GetPositions(seeking, &current, &stop);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     ok(current == 50 * 10000, "Got time %s.\n", wine_dbgstr_longlong(current));
     ok(stop == 200 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
 
@@ -1029,9 +1029,9 @@ static void test_seeking(void)
     IPin_Release(pin);
     IFilterGraph2_Release(graph);
     ref = IBaseFilter_Release(filter);
-    ok(!ref, "Got outstanding refcount %d.\n", ref);
+    ok(!ref, "Got outstanding refcount %ld.\n", ref);
     ret = DeleteFileW(filename);
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 START_TEST(waveparser)
-- 
2.35.1




More information about the wine-devel mailing list