[PATCH 12/24] dlls/mshtml: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Tue Feb 15 00:29:41 CST 2022


Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/mshtml/Makefile.in      |    1 
 dlls/mshtml/conpoint.c       |   10 +-
 dlls/mshtml/dispex.c         |   58 +++++++-------
 dlls/mshtml/editor.c         |   28 +++----
 dlls/mshtml/htmlanchor.c     |    8 +-
 dlls/mshtml/htmlarea.c       |    6 +
 dlls/mshtml/htmlattr.c       |    4 -
 dlls/mshtml/htmlbody.c       |   22 +++--
 dlls/mshtml/htmlcomment.c    |    2 
 dlls/mshtml/htmlcurstyle.c   |    6 +
 dlls/mshtml/htmldoc.c        |  112 ++++++++++++++--------------
 dlls/mshtml/htmlelem.c       |  170 +++++++++++++++++++++---------------------
 dlls/mshtml/htmlelemcol.c    |   30 ++++---
 dlls/mshtml/htmlevent.c      |   38 +++++----
 dlls/mshtml/htmlform.c       |   38 +++++----
 dlls/mshtml/htmlframe.c      |   26 +++---
 dlls/mshtml/htmlimg.c        |   38 +++++----
 dlls/mshtml/htmlinput.c      |   74 +++++++++---------
 dlls/mshtml/htmllink.c       |    4 -
 dlls/mshtml/htmllocation.c   |   10 +-
 dlls/mshtml/htmlnode.c       |   46 ++++++-----
 dlls/mshtml/htmlobject.c     |   18 ++--
 dlls/mshtml/htmlscript.c     |   10 +-
 dlls/mshtml/htmlselect.c     |   68 ++++++++---------
 dlls/mshtml/htmlstorage.c    |    6 +
 dlls/mshtml/htmlstyle.c      |   52 ++++++-------
 dlls/mshtml/htmlstyleelem.c  |    4 -
 dlls/mshtml/htmlstylesheet.c |   58 +++++++-------
 dlls/mshtml/htmltable.c      |   72 +++++++++---------
 dlls/mshtml/htmltextarea.c   |   10 +-
 dlls/mshtml/htmltextnode.c   |   16 ++--
 dlls/mshtml/htmlwindow.c     |  108 +++++++++++++--------------
 dlls/mshtml/ifacewrap.c      |    4 -
 dlls/mshtml/loadopts.c       |    8 +-
 dlls/mshtml/main.c           |   12 +--
 dlls/mshtml/mutation.c       |   20 ++---
 dlls/mshtml/navigate.c       |   64 ++++++++--------
 dlls/mshtml/npplugin.c       |    4 -
 dlls/mshtml/nsembed.c        |  100 ++++++++++++-------------
 dlls/mshtml/nsevents.c       |   12 +--
 dlls/mshtml/nsio.c           |   74 +++++++++---------
 dlls/mshtml/nsservice.c      |    4 -
 dlls/mshtml/olecmd.c         |  114 ++++++++++++++--------------
 dlls/mshtml/oleobj.c         |   52 ++++++-------
 dlls/mshtml/omnavigator.c    |   56 +++++++-------
 dlls/mshtml/persist.c        |   32 ++++----
 dlls/mshtml/pluginhost.c     |  114 ++++++++++++++--------------
 dlls/mshtml/protocol.c       |   38 +++++----
 dlls/mshtml/range.c          |   72 +++++++++---------
 dlls/mshtml/script.c         |   70 +++++++++--------
 dlls/mshtml/secmgr.c         |   10 +-
 dlls/mshtml/selection.c      |   12 +--
 dlls/mshtml/service.c        |    8 +-
 dlls/mshtml/svg.c            |   16 ++--
 dlls/mshtml/task.c           |    4 -
 dlls/mshtml/view.c           |   40 +++++-----
 dlls/mshtml/xmlhttprequest.c |   36 ++++-----
 57 files changed, 1064 insertions(+), 1065 deletions(-)

diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in
index aef53bffa27..14e992a6593 100644
--- a/dlls/mshtml/Makefile.in
+++ b/dlls/mshtml/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 MODULE    = mshtml.dll
 IMPORTLIB = mshtml
 IMPORTS   = strmiids uuid urlmon shlwapi shell32 ole32 oleaut32 user32 gdi32 advapi32
diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c
index e959a020073..baedc8472c1 100644
--- a/dlls/mshtml/conpoint.c
+++ b/dlls/mshtml/conpoint.c
@@ -70,7 +70,7 @@ static ULONG WINAPI EnumConnections_AddRef(IEnumConnections *iface)
     EnumConnections *This = impl_from_IEnumConnections(iface);
     ULONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -80,7 +80,7 @@ static ULONG WINAPI EnumConnections_Release(IEnumConnections *iface)
     EnumConnections *This = impl_from_IEnumConnections(iface);
     ULONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         IConnectionPoint_Release(&This->cp->IConnectionPoint_iface);
@@ -95,7 +95,7 @@ static HRESULT WINAPI EnumConnections_Next(IEnumConnections *iface, ULONG cConne
     EnumConnections *This = impl_from_IEnumConnections(iface);
     ULONG fetched = 0;
 
-    TRACE("(%p)->(%d %p %p)\n", This, cConnections, rgcd, pcFetched);
+    TRACE("(%p)->(%ld %p %p)\n", This, cConnections, rgcd, pcFetched);
 
     while(fetched < cConnections && This->iter < This->cp->sinks_size) {
         if(!This->cp->sinks[This->iter].unk) {
@@ -117,7 +117,7 @@ static HRESULT WINAPI EnumConnections_Next(IEnumConnections *iface, ULONG cConne
 static HRESULT WINAPI EnumConnections_Skip(IEnumConnections *iface, ULONG cConnections)
 {
     EnumConnections *This = impl_from_IEnumConnections(iface);
-    FIXME("(%p)->(%d)\n", This, cConnections);
+    FIXME("(%p)->(%ld)\n", This, cConnections);
     return E_NOTIMPL;
 }
 
@@ -254,7 +254,7 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
 static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
 {
     ConnectionPoint *This = impl_from_IConnectionPoint(iface);
-    TRACE("(%p)->(%d)\n", This, dwCookie);
+    TRACE("(%p)->(%ld)\n", This, dwCookie);
 
     if(!dwCookie || dwCookie > This->sinks_size || !This->sinks[dwCookie-1].unk)
         return CONNECT_E_NOCONNECTION;
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
index 450bc8efe51..7ab1df49cc5 100644
--- a/dlls/mshtml/dispex.c
+++ b/dlls/mshtml/dispex.c
@@ -134,7 +134,7 @@ static HRESULT load_typelib(void)
 
     hres = LoadRegTypeLib(&LIBID_MSHTML, 4, 0, LOCALE_SYSTEM_DEFAULT, &tl);
     if(FAILED(hres)) {
-        ERR("LoadRegTypeLib failed: %08x\n", hres);
+        ERR("LoadRegTypeLib failed: %08lx\n", hres);
         return hres;
     }
 
@@ -144,14 +144,14 @@ static HRESULT load_typelib(void)
     len = GetModuleFileNameW(hInst, module_path, MAX_PATH + 1);
     if (!len || len == MAX_PATH + 1)
     {
-        ERR("Could not get module file name, len %u.\n", len);
+        ERR("Could not get module file name, len %lu.\n", len);
         return E_FAIL;
     }
     lstrcatW(module_path, L"\\1");
 
     hres = LoadTypeLibEx(module_path, REGKIND_NONE, &tl);
     if(FAILED(hres)) {
-        ERR("LoadTypeLibEx failed for private typelib: %08x\n", hres);
+        ERR("LoadTypeLibEx failed for private typelib: %08lx\n", hres);
         return hres;
     }
 
@@ -175,7 +175,7 @@ static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
 
         hres = ITypeLib_GetTypeInfoOfGuid(tid > LAST_public_tid ? typelib_private : typelib, tid_ids[tid], &ti);
         if(FAILED(hres)) {
-            ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_mshtml_guid(tid_ids[tid]), hres);
+            ERR("GetTypeInfoOfGuid(%s) failed: %08lx\n", debugstr_mshtml_guid(tid_ids[tid]), hres);
             return hres;
         }
 
@@ -236,7 +236,7 @@ HRESULT get_class_typeinfo(const CLSID *clsid, ITypeInfo **typeinfo)
     if (FAILED(hres))
         hres = ITypeLib_GetTypeInfoOfGuid(typelib_private, clsid, typeinfo);
     if(FAILED(hres))
-        ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
+        ERR("GetTypeInfoOfGuid failed: %08lx\n", hres);
     return hres;
 }
 
@@ -278,7 +278,7 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc,
 
     hres = ITypeInfo_GetDocumentation(dti, desc->memid, &name, NULL, NULL, NULL);
     if(FAILED(hres)) {
-        WARN("GetDocumentation failed: %08x\n", hres);
+        WARN("GetDocumentation failed: %08lx\n", hres);
         return;
     }
 
@@ -355,7 +355,7 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc,
 
                 hres = ITypeInfo_GetRefTypeInfo(dti, tdesc->u.lptdesc->u.hreftype, &ref_type_info);
                 if(FAILED(hres)) {
-                    ERR("Could not get referenced type info: %08x\n", hres);
+                    ERR("Could not get referenced type info: %08lx\n", hres);
                     return;
                 }
 
@@ -365,7 +365,7 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc,
                     info->arg_info[i].iid = attr->guid;
                     ITypeInfo_ReleaseTypeAttr(ref_type_info, attr);
                 }else {
-                    ERR("GetTypeAttr failed: %08x\n", hres);
+                    ERR("GetTypeAttr failed: %08lx\n", hres);
                 }
                 ITypeInfo_Release(ref_type_info);
                 if(FAILED(hres))
@@ -380,7 +380,7 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc,
                 hres = VariantCopy(&info->arg_info[i].default_value,
                                    &desc->lprgelemdescParam[i].u.paramdesc.pparamdescex->varDefaultValue);
                 if(FAILED(hres)) {
-                    ERR("Could not copy default value: %08x\n", hres);
+                    ERR("Could not copy default value: %08lx\n", hres);
                     return;
                 }
                 TRACE("%s param %d: default value %s\n", debugstr_w(info->name),
@@ -455,7 +455,7 @@ void dispex_info_add_interface(dispex_data_t *info, tid_t tid, const dispex_hook
 
     hres = process_interface(info, tid, NULL, hooks);
     if(FAILED(hres))
-        ERR("process_interface failed: %08x\n", hres);
+        ERR("process_interface failed: %08lx\n", hres);
 }
 
 static int __cdecl dispid_cmp(const void *p1, const void *p2)
@@ -479,7 +479,7 @@ static dispex_data_t *preprocess_dispex_data(dispex_static_data_t *desc, compat_
     if(desc->disp_tid) {
         hres = get_typeinfo(desc->disp_tid, &dti);
         if(FAILED(hres)) {
-            ERR("Could not get disp type info: %08x\n", hres);
+            ERR("Could not get disp type info: %08lx\n", hres);
             return NULL;
         }
     }
@@ -751,13 +751,13 @@ static HRESULT typeinfo_invoke(DispatchEx *This, func_info_t *func, WORD flags,
 
     hres = get_typeinfo(func->tid, &ti);
     if(FAILED(hres)) {
-        ERR("Could not get type info: %08x\n", hres);
+        ERR("Could not get type info: %08lx\n", hres);
         return hres;
     }
 
     hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&unk);
     if(FAILED(hres)) {
-        ERR("Could not get iface %s: %08x\n", debugstr_mshtml_guid(tid_ids[func->tid]), hres);
+        ERR("Could not get iface %s: %08lx\n", debugstr_mshtml_guid(tid_ids[func->tid]), hres);
         return E_FAIL;
     }
 
@@ -796,7 +796,7 @@ static ULONG WINAPI Function_AddRef(IUnknown *iface)
     func_disp_t *This = impl_from_IUnknown(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -806,7 +806,7 @@ static ULONG WINAPI Function_Release(IUnknown *iface)
     func_disp_t *This = impl_from_IUnknown(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         assert(!This->obj);
@@ -951,7 +951,7 @@ static HRESULT invoke_disp_value(DispatchEx *This, IDispatch *func_disp, LCID lc
     if(SUCCEEDED(hres))
         TRACE("<<< %s\n", debugstr_variant(res));
     else
-        WARN("<<< %08x\n", hres);
+        WARN("<<< %08lx\n", hres);
 
     heap_free(new_dp.rgvarg);
     return hres;
@@ -1008,7 +1008,7 @@ static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **re
             max = n-1;
     }
 
-    WARN("invalid id %x\n", id);
+    WARN("invalid id %lx\n", id);
     return DISP_E_UNKNOWNNAME;
 }
 
@@ -1221,7 +1221,7 @@ static HRESULT invoke_builtin_function(DispatchEx *This, func_info_t *func, DISP
             }
             hres = IDispatch_QueryInterface(V_DISPATCH(arg_ptrs[i]), &func->arg_info[i].iid, (void**)&iface);
             if(FAILED(hres)) {
-                WARN("Could not get %s iface: %08x\n", debugstr_guid(&func->arg_info[i].iid), hres);
+                WARN("Could not get %s iface: %08lx\n", debugstr_guid(&func->arg_info[i].iid), hres);
                 break;
             }
             if(own_value)
@@ -1600,7 +1600,7 @@ static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
     DispatchEx *This = impl_from_IDispatchEx(iface);
     HRESULT hres;
 
-    TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
+    TRACE("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
 
     hres = get_typeinfo(This->info->desc->disp_tid, ppTInfo);
     if(FAILED(hres))
@@ -1618,7 +1618,7 @@ static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
     UINT i;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
+    TRACE("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
           lcid, rgDispId);
 
     for(i=0; i < cNames; i++) {
@@ -1636,7 +1636,7 @@ static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
 {
     DispatchEx *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
+    TRACE("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
           lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 
     return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, pDispParams,
@@ -1649,10 +1649,10 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
     dynamic_prop_t *dprop;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
+    TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(bstrName), grfdex, pid);
 
     if(grfdex & ~(fdexNameCaseSensitive|fdexNameCaseInsensitive|fdexNameEnsure|fdexNameImplicit|FDEX_VERSION_MASK))
-        FIXME("Unsupported grfdex %x\n", grfdex);
+        FIXME("Unsupported grfdex %lx\n", grfdex);
 
     if(!ensure_real_info(This))
         return E_OUTOFMEMORY;
@@ -1675,7 +1675,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
     DispatchEx *This = impl_from_IDispatchEx(iface);
     HRESULT hres;
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
 
     if(!ensure_real_info(This))
         return E_OUTOFMEMORY;
@@ -1761,7 +1761,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR nam
     DISPID id;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %x)\n", This, debugstr_w(name), grfdex);
+    TRACE("(%p)->(%s %lx)\n", This, debugstr_w(name), grfdex);
 
     if(dispex_compat_mode(This) < COMPAT_MODE_IE8) {
         /* Not implemented by IE */
@@ -1781,7 +1781,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID
 {
     DispatchEx *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%x)\n", This, id);
+    TRACE("(%p)->(%lx)\n", This, id);
 
     if(dispex_compat_mode(This) < COMPAT_MODE_IE8) {
         /* Not implemented by IE */
@@ -1807,7 +1807,7 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID
 static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
 {
     DispatchEx *This = impl_from_IDispatchEx(iface);
-    FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
+    FIXME("(%p)->(%lx %lx %p)\n", This, id, grfdexFetch, pgrfdex);
     return E_NOTIMPL;
 }
 
@@ -1817,7 +1817,7 @@ static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BS
     func_info_t *func;
     HRESULT hres;
 
-    TRACE("(%p)->(%x %p)\n", This, id, pbstrName);
+    TRACE("(%p)->(%lx %p)\n", This, id, pbstrName);
 
     if(!ensure_real_info(This))
         return E_OUTOFMEMORY;
@@ -1865,7 +1865,7 @@ static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex,
     func_info_t *func;
     HRESULT hres;
 
-    TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
+    TRACE("(%p)->(%lx %lx %p)\n", This, grfdex, id, pid);
 
     if(!ensure_real_info(This))
         return E_OUTOFMEMORY;
diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 0f63ce20131..d21616288e6 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -102,11 +102,11 @@ void set_dirty(GeckoBrowser *browser, VARIANT_BOOL dirty)
     if(dirty) {
         nsres = nsIEditor_IncrementModificationCount(browser->editor, 1);
         if(NS_FAILED(nsres))
-            ERR("IncrementModificationCount failed: %08x\n", nsres);
+            ERR("IncrementModificationCount failed: %08lx\n", nsres);
     }else {
         nsres = nsIEditor_ResetModificationCount(browser->editor);
         if(NS_FAILED(nsres))
-            ERR("ResetModificationCount failed: %08x\n", nsres);
+            ERR("ResetModificationCount failed: %08lx\n", nsres);
     }
 }
 
@@ -119,7 +119,7 @@ static void do_ns_editor_command(GeckoBrowser *This, const char *cmd)
 
     nsres = nsIController_DoCommand(This->editor_controller, cmd);
     if(NS_FAILED(nsres))
-        ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres);
+        ERR("DoCommand(%s) failed: %08lx\n", debugstr_a(cmd), nsres);
 }
 
 static nsresult get_ns_command_state(GeckoBrowser *This, const char *cmd, nsICommandParams *nsparam)
@@ -129,13 +129,13 @@ static nsresult get_ns_command_state(GeckoBrowser *This, const char *cmd, nsICom
 
     nsres = get_nsinterface((nsISupports*)This->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsICommandManager: %08x\n", nsres);
+        ERR("Could not get nsICommandManager: %08lx\n", nsres);
         return nsres;
     }
 
     nsres = nsICommandManager_GetCommandState(cmdmgr, cmd, This->doc->basedoc.window->window_proxy, nsparam);
     if(NS_FAILED(nsres))
-        ERR("GetCommandState(%s) failed: %08x\n", debugstr_a(cmd), nsres);
+        ERR("GetCommandState(%s) failed: %08lx\n", debugstr_a(cmd), nsres);
 
     nsICommandManager_Release(cmdmgr);
     return nsres;
@@ -200,7 +200,7 @@ static nsISelection *get_ns_selection(HTMLDocumentNode *doc)
 
     nsres = nsIDOMWindow_GetSelection(doc->basedoc.window->nswindow, &nsselection);
     if(NS_FAILED(nsres))
-        ERR("GetSelection failed %08x\n", nsres);
+        ERR("GetSelection failed %08lx\n", nsres);
 
     return nsselection;
 
@@ -330,7 +330,7 @@ static void set_font_size(HTMLDocumentNode *doc, LPCWSTR size)
 
     nsISelection_GetRangeCount(nsselection, &range_cnt);
     if(range_cnt != 1) {
-        FIXME("range_cnt %d not supprted\n", range_cnt);
+        FIXME("range_cnt %ld not supprted\n", range_cnt);
         if(!range_cnt) {
             nsISelection_Release(nsselection);
             return;
@@ -565,7 +565,7 @@ static HRESULT exec_forecolor(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *
             nsICommandParams *nsparam = create_nscommand_params();
             char color_str[10];
 
-            sprintf(color_str, "#%02x%02x%02x",
+            sprintf(color_str, "#%02lx%02lx%02lx",
                     V_I4(in)&0xff, (V_I4(in)>>8)&0xff, (V_I4(in)>>16)&0xff);
 
             nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, color_str);
@@ -792,7 +792,7 @@ static HRESULT exec_composesettings(HTMLDocumentNode *doc, DWORD cmdexecopt, VAR
         return E_INVALIDARG;
     }
 
-    TRACE("(%p)->(%x %s)\n", doc, cmdexecopt, debugstr_w(V_BSTR(in)));
+    TRACE("(%p)->(%lx %s)\n", doc, cmdexecopt, debugstr_w(V_BSTR(in)));
 
     update_doc(doc->browser->doc, UPDATE_UI);
 
@@ -877,7 +877,7 @@ HRESULT editor_exec_paste(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *in,
 
 static HRESULT exec_setdirty(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 {
-    TRACE("(%p)->(%08x %p %p)\n", doc, cmdexecopt, in, out);
+    TRACE("(%p)->(%08lx %p %p)\n", doc, cmdexecopt, in, out);
 
     if(!in)
         return S_OK;
@@ -1063,7 +1063,7 @@ static HRESULT exec_hyperlink(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *
     INT ret;
     HRESULT hres = E_FAIL;
 
-    TRACE("%p, 0x%x, %p, %p\n", doc, cmdexecopt, in, out);
+    TRACE("%p, 0x%lx, %p, %p\n", doc, cmdexecopt, in, out);
 
     if (cmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER)
     {
@@ -1136,7 +1136,7 @@ static HRESULT exec_hyperlink(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *
     if (cmdexecopt != OLECMDEXECOPT_DONTPROMPTUSER)
         SysFreeString(url);
 
-    TRACE("-- 0x%08x\n", hres);
+    TRACE("-- 0x%08lx\n", hres);
     return hres;
 }
 
@@ -1228,7 +1228,7 @@ HRESULT setup_edit_mode(HTMLDocumentObj *doc)
         hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
         if(SUCCEEDED(hres))
             /* FIXME: use hostinfo */
-            TRACE("hostinfo = {%u %08x %08x %s %s}\n",
+            TRACE("hostinfo = {%lu %08lx %08lx %s %s}\n",
                     hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
                     debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
     }
@@ -1244,7 +1244,7 @@ HRESULT setup_edit_mode(HTMLDocumentObj *doc)
     }else {
         hres = CreateURLMoniker(NULL, L"about:blank", &mon);
         if(FAILED(hres)) {
-            FIXME("CreateURLMoniker failed: %08x\n", hres);
+            FIXME("CreateURLMoniker failed: %08lx\n", hres);
             return hres;
         }
     }
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c
index b11d39ae07f..cfe49ac05bd 100644
--- a/dlls/mshtml/htmlanchor.c
+++ b/dlls/mshtml/htmlanchor.c
@@ -183,7 +183,7 @@ static IUri *get_anchor_uri(HTMLAnchorElement *anchor)
         nsAString_GetData(&href_str, &href);
         create_uri(href, 0, &uri);
     }else {
-        ERR("GetHref failed: %08x\n", nsres);
+        ERR("GetHref failed: %08lx\n", nsres);
     }
 
     nsAString_Finish(&href_str);
@@ -283,7 +283,7 @@ static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR
         nsAString_GetData(&href_str, &href);
         hres = nsuri_to_url(href, TRUE, p);
     }else {
-        ERR("GetHref failed: %08x\n", nsres);
+        ERR("GetHref failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -823,14 +823,14 @@ static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsI
         nsAString_Init(&href_str, NULL);
         nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
         if (NS_FAILED(nsres)) {
-            ERR("Could not get anchor href: %08x\n", nsres);
+            ERR("Could not get anchor href: %08lx\n", nsres);
             goto fallback;
         }
 
         nsAString_Init(&target_str, NULL);
         nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str);
         if (NS_FAILED(nsres)) {
-            ERR("Could not get anchor target: %08x\n", nsres);
+            ERR("Could not get anchor target: %08lx\n", nsres);
             goto fallback;
         }
 
diff --git a/dlls/mshtml/htmlarea.c b/dlls/mshtml/htmlarea.c
index 6c0da3633d5..9e43a7b0e80 100644
--- a/dlls/mshtml/htmlarea.c
+++ b/dlls/mshtml/htmlarea.c
@@ -160,7 +160,7 @@ static HRESULT WINAPI HTMLAreaElement_get_href(IHTMLAreaElement *iface, BSTR *p)
         nsAString_GetData(&href_str, &href);
         hres = nsuri_to_url(href, TRUE, p);
     }else {
-        ERR("GetHref failed: %08x\n", nsres);
+        ERR("GetHref failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -440,14 +440,14 @@ static HRESULT HTMLAreaElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDO
         nsAString_Init(&href_str, NULL);
         nsres = nsIDOMHTMLAreaElement_GetHref(This->nsarea, &href_str);
         if (NS_FAILED(nsres)) {
-            ERR("Could not get area href: %08x\n", nsres);
+            ERR("Could not get area href: %08lx\n", nsres);
             goto fallback;
         }
 
         nsAString_Init(&target_str, NULL);
         nsres = nsIDOMHTMLAreaElement_GetTarget(This->nsarea, &target_str);
         if (NS_FAILED(nsres)) {
-            ERR("Could not get area target: %08x\n", nsres);
+            ERR("Could not get area target: %08lx\n", nsres);
             goto fallback;
         }
 
diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c
index e4c98d9af06..7365b9ea63f 100644
--- a/dlls/mshtml/htmlattr.c
+++ b/dlls/mshtml/htmlattr.c
@@ -67,7 +67,7 @@ static ULONG WINAPI HTMLDOMAttribute_AddRef(IHTMLDOMAttribute *iface)
     HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -77,7 +77,7 @@ static ULONG WINAPI HTMLDOMAttribute_Release(IHTMLDOMAttribute *iface)
     HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         assert(!This->elem);
diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c
index 551c3a15188..663a75d2e2a 100644
--- a/dlls/mshtml/htmlbody.c
+++ b/dlls/mshtml/htmlbody.c
@@ -166,7 +166,7 @@ static HRESULT return_nscolor(nsresult nsres, nsAString *nsstr, VARIANT *p)
     const PRUnichar *color;
 
     if(NS_FAILED(nsres)) {
-        ERR("failed: %08x\n", nsres);
+        ERR("failed: %08lx\n", nsres);
         nsAString_Finish(nsstr);
         return E_FAIL;
     }
@@ -378,7 +378,7 @@ static HRESULT WINAPI HTMLBodyElement_put_bgColor(IHTMLBodyElement *iface, VARIA
     nsres = nsIDOMHTMLBodyElement_SetBgColor(This->nsbody, &strColor);
     nsAString_Finish(&strColor);
     if(NS_FAILED(nsres))
-        ERR("SetBgColor failed: %08x\n", nsres);
+        ERR("SetBgColor failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -410,7 +410,7 @@ static HRESULT WINAPI HTMLBodyElement_put_text(IHTMLBodyElement *iface, VARIANT
     nsres = nsIDOMHTMLBodyElement_SetText(This->nsbody, &text);
     nsAString_Finish(&text);
     if(NS_FAILED(nsres)) {
-        ERR("SetText failed: %08x\n", nsres);
+        ERR("SetText failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -435,7 +435,7 @@ static HRESULT WINAPI HTMLBodyElement_get_text(IHTMLBodyElement *iface, VARIANT
         V_VT(p) = VT_BSTR;
         hres = nscolor_to_str(color, &V_BSTR(p));
     }else {
-        ERR("GetText failed: %08x\n", nsres);
+        ERR("GetText failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -458,7 +458,7 @@ static HRESULT WINAPI HTMLBodyElement_put_link(IHTMLBodyElement *iface, VARIANT
     nsres = nsIDOMHTMLBodyElement_SetLink(This->nsbody, &link_str);
     nsAString_Finish(&link_str);
     if(NS_FAILED(nsres))
-        ERR("SetLink failed: %08x\n", nsres);
+        ERR("SetLink failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -490,7 +490,7 @@ static HRESULT WINAPI HTMLBodyElement_put_vLink(IHTMLBodyElement *iface, VARIANT
     nsres = nsIDOMHTMLBodyElement_SetVLink(This->nsbody, &vlink_str);
     nsAString_Finish(&vlink_str);
     if(NS_FAILED(nsres))
-        ERR("SetLink failed: %08x\n", nsres);
+        ERR("SetLink failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -522,7 +522,7 @@ static HRESULT WINAPI HTMLBodyElement_put_aLink(IHTMLBodyElement *iface, VARIANT
     nsres = nsIDOMHTMLBodyElement_SetALink(This->nsbody, &alink_str);
     nsAString_Finish(&alink_str);
     if(NS_FAILED(nsres))
-        ERR("SetALink failed: %08x\n", nsres);
+        ERR("SetALink failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -678,9 +678,9 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
     if(NS_SUCCEEDED(nsres)) {
         nsres = nsIDOMRange_SelectNodeContents(nsrange, This->element.node.nsnode);
         if(NS_FAILED(nsres))
-            ERR("SelectNodeContents failed: %08x\n", nsres);
+            ERR("SelectNodeContents failed: %08lx\n", nsres);
     }else {
-        ERR("CreateRange failed: %08x\n", nsres);
+        ERR("CreateRange failed: %08lx\n", nsres);
     }
 
     hres = HTMLTxtRange_Create(This->element.node.doc->basedoc.doc_node, nsrange, range);
@@ -820,7 +820,7 @@ static HRESULT WINAPI HTMLTextContainer_put_scrollTop(IHTMLTextContainer *iface,
 {
     HTMLBodyElement *This = impl_from_IHTMLTextContainer(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     return IHTMLElement2_put_scrollTop(&This->element.IHTMLElement2_iface, v);
 }
@@ -838,7 +838,7 @@ static HRESULT WINAPI HTMLTextContainer_put_scrollLeft(IHTMLTextContainer *iface
 {
     HTMLBodyElement *This = impl_from_IHTMLTextContainer(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     return IHTMLElement2_put_scrollLeft(&This->element.IHTMLElement2_iface, v);
 }
diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c
index 78158650c25..a9843858a9b 100644
--- a/dlls/mshtml/htmlcomment.c
+++ b/dlls/mshtml/htmlcomment.c
@@ -115,7 +115,7 @@ static HRESULT WINAPI HTMLCommentElement_get_text(IHTMLCommentElement *iface, BS
 static HRESULT WINAPI HTMLCommentElement_put_atomic(IHTMLCommentElement *iface, LONG v)
 {
     HTMLCommentElement *This = impl_from_IHTMLCommentElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c
index e66a42c1d4e..852b9059917 100644
--- a/dlls/mshtml/htmlcurstyle.c
+++ b/dlls/mshtml/htmlcurstyle.c
@@ -592,7 +592,7 @@ static HRESULT WINAPI HTMLCurrentStyle_getAttribute(IHTMLCurrentStyle *iface, BS
         LONG lFlags, VARIANT *AttributeValue)
 {
     HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
-    FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
+    FIXME("(%p)->(%s %lx %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
     return E_NOTIMPL;
 }
 
@@ -1323,7 +1323,7 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
 
     nsres = nsIDOMHTMLDocument_GetDefaultView(elem->node.doc->nsdoc, &nsview);
     if(NS_FAILED(nsres)) {
-        ERR("GetDefaultView failed: %08x\n", nsres);
+        ERR("GetDefaultView failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1336,7 +1336,7 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
     nsAString_Finish(&nsempty_str);
     nsIDOMWindow_Release(nswindow);
     if(NS_FAILED(nsres)) {
-        ERR("GetComputedStyle failed: %08x\n", nsres);
+        ERR("GetComputedStyle failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index d2caaef2741..3a742a86a1b 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -59,7 +59,7 @@ HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement *
     /* get element by id attribute */
     nsres = nsIDOMHTMLDocument_GetElementById(doc->nsdoc, &id_str, &nselem);
     if(FAILED(nsres)) {
-        ERR("GetElementById failed: %08x\n", nsres);
+        ERR("GetElementById failed: %08lx\n", nsres);
         nsAString_Finish(&id_str);
         return E_FAIL;
     }
@@ -68,7 +68,7 @@ HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement *
     nsres = nsIDOMHTMLDocument_GetElementsByName(doc->nsdoc, &id_str, &nsnode_list);
     nsAString_Finish(&id_str);
     if(FAILED(nsres)) {
-        ERR("getElementsByName failed: %08x\n", nsres);
+        ERR("getElementsByName failed: %08lx\n", nsres);
         if(nselem)
             nsIDOMElement_Release(nselem);
         return E_FAIL;
@@ -83,7 +83,7 @@ HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement *
 
         nsres = nsIDOMNode_CompareDocumentPosition(nsnode, (nsIDOMNode*)nselem, &pos);
         if(NS_FAILED(nsres)) {
-            FIXME("CompareDocumentPosition failed: 0x%08x\n", nsres);
+            FIXME("CompareDocumentPosition failed: 0x%08lx\n", nsres);
             nsIDOMNode_Release(nsnode);
             nsIDOMElement_Release(nselem);
             return E_FAIL;
@@ -136,7 +136,7 @@ UINT get_document_charset(HTMLDocumentNode *doc)
             SysFreeString(str);
         }
     }else {
-        ERR("GetCharset failed: %08x\n", nsres);
+        ERR("GetCharset failed: %08lx\n", nsres);
     }
     nsAString_Finish(&charset_str);
 
@@ -235,7 +235,7 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo
 
     nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
     if(NS_FAILED(nsres)) {
-        ERR("GetDocumentElement failed: %08x\n", nsres);
+        ERR("GetDocumentElement failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -268,7 +268,7 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
 
         nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
         if(NS_FAILED(nsres)) {
-            TRACE("Could not get body: %08x\n", nsres);
+            TRACE("Could not get body: %08lx\n", nsres);
             return E_UNEXPECTED;
         }
     }
@@ -308,7 +308,7 @@ static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTM
      */
     nsres = nsIDOMHTMLDocument_GetActiveElement(This->doc_node->nsdoc, &nselem);
     if(NS_FAILED(nsres)) {
-        ERR("GetActiveElement failed: %08x\n", nsres);
+        ERR("GetActiveElement failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -346,7 +346,7 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen
 
     nsres = nsIDOMHTMLDocument_GetImages(This->doc_node->nsdoc, &nscoll);
     if(NS_FAILED(nsres)) {
-        ERR("GetImages failed: %08x\n", nsres);
+        ERR("GetImages failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -378,7 +378,7 @@ static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLEleme
 
     nsres = nsIDOMHTMLDocument_GetApplets(This->doc_node->nsdoc, &nscoll);
     if(NS_FAILED(nsres)) {
-        ERR("GetApplets failed: %08x\n", nsres);
+        ERR("GetApplets failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -410,7 +410,7 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement
 
     nsres = nsIDOMHTMLDocument_GetLinks(This->doc_node->nsdoc, &nscoll);
     if(NS_FAILED(nsres)) {
-        ERR("GetLinks failed: %08x\n", nsres);
+        ERR("GetLinks failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -442,7 +442,7 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement
 
     nsres = nsIDOMHTMLDocument_GetForms(This->doc_node->nsdoc, &nscoll);
     if(NS_FAILED(nsres)) {
-        ERR("GetForms failed: %08x\n", nsres);
+        ERR("GetForms failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -474,7 +474,7 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme
 
     nsres = nsIDOMHTMLDocument_GetAnchors(This->doc_node->nsdoc, &nscoll);
     if(NS_FAILED(nsres)) {
-        ERR("GetAnchors failed: %08x\n", nsres);
+        ERR("GetAnchors failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -503,7 +503,7 @@ static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
     nsres = nsIDOMHTMLDocument_SetTitle(This->doc_node->nsdoc, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres))
-        ERR("SetTitle failed: %08x\n", nsres);
+        ERR("SetTitle failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -532,7 +532,7 @@ static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
     nsAString_Finish(&nsstr);
 
     if(NS_FAILED(nsres)) {
-        ERR("GetTitle failed: %08x\n", nsres);
+        ERR("GetTitle failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -559,7 +559,7 @@ static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLEleme
 
     nsres = nsIDOMHTMLDocument_GetScripts(This->doc_node->nsdoc, &nscoll);
     if(NS_FAILED(nsres)) {
-        ERR("GetImages failed: %08x\n", nsres);
+        ERR("GetImages failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -614,7 +614,7 @@ static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSel
 
     nsres = nsIDOMWindow_GetSelection(This->window->nswindow, &nsselection);
     if(NS_FAILED(nsres)) {
-        ERR("GetSelection failed: %08x\n", nsres);
+        ERR("GetSelection failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -683,7 +683,7 @@ static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
     hr = IHTMLDocument2_get_body(iface, &element);
     if (FAILED(hr))
     {
-        ERR("Failed to get body (0x%08x)\n", hr);
+        ERR("Failed to get body (0x%08lx)\n", hr);
         return hr;
     }
 
@@ -838,7 +838,7 @@ static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
     nsres = nsIDOMHTMLDocument_SetDomain(This->doc_node->nsdoc, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetDomain failed: %08x\n", nsres);
+        ERR("SetDomain failed: %08lx\n", nsres);
         return E_INVALIDARG;
     }
 
@@ -880,7 +880,7 @@ static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
 
     bret = InternetSetCookieExW(This->window->url, NULL, v, 0, 0);
     if(!bret) {
-        FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
+        FIXME("InternetSetCookieExW failed: %lu\n", GetLastError());
         return HRESULT_FROM_WIN32(GetLastError());
     }
 
@@ -898,7 +898,7 @@ static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
     size = 0;
     bret = InternetGetCookieExW(This->window->url, NULL, NULL, &size, 0, NULL);
     if(!bret && GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-        WARN("InternetGetCookieExW failed: %u\n", GetLastError());
+        WARN("InternetGetCookieExW failed: %lu\n", GetLastError());
         *p = NULL;
         return S_OK;
     }
@@ -914,7 +914,7 @@ static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
 
     bret = InternetGetCookieExW(This->window->url, NULL, *p, &size, 0, NULL);
     if(!bret) {
-        ERR("InternetGetCookieExW failed: %u\n", GetLastError());
+        ERR("InternetGetCookieExW failed: %lu\n", GetLastError());
         return E_FAIL;
     }
 
@@ -1048,7 +1048,7 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
 
     hres = SafeArrayAccessData(psarray, (void**)&var);
     if(FAILED(hres)) {
-        WARN("SafeArrayAccessData failed: %08x\n", hres);
+        WARN("SafeArrayAccessData failed: %08lx\n", hres);
         return hres;
     }
 
@@ -1076,7 +1076,7 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
         if(V_VT(var+i) != VT_BSTR)
             VariantClear(&tmp);
         if(NS_FAILED(nsres)) {
-            ERR("Write failed: %08x\n", nsres);
+            ERR("Write failed: %08lx\n", nsres);
             hres = E_FAIL;
             break;
         }
@@ -1127,7 +1127,7 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
     nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc, NULL, NULL, NULL,
             get_context_from_document(This->doc_node->nsdoc), 0, &tmp);
     if(NS_FAILED(nsres)) {
-        ERR("Open failed: %08x\n", nsres);
+        ERR("Open failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1153,7 +1153,7 @@ static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
 
     nsres = nsIDOMHTMLDocument_Close(This->doc_node->nsdoc);
     if(NS_FAILED(nsres)) {
-        ERR("Close failed: %08x\n", nsres);
+        ERR("Close failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1169,7 +1169,7 @@ static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
 
     nsres = nsIDOMHTMLDocument_Clear(This->doc_node->nsdoc);
     if(NS_FAILED(nsres)) {
-        ERR("Clear failed: %08x\n", nsres);
+        ERR("Clear failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1607,11 +1607,11 @@ static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %d %p)\n", This, x, y, elementHit);
+    TRACE("(%p)->(%ld %ld %p)\n", This, x, y, elementHit);
 
     nsres = nsIDOMHTMLDocument_ElementFromPoint(This->doc_node->nsdoc, x, y, &nselem);
     if(NS_FAILED(nsres)) {
-        ERR("ElementFromPoint failed: %08x\n", nsres);
+        ERR("ElementFromPoint failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1659,7 +1659,7 @@ static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
 
     nsres = nsIDOMHTMLDocument_GetStyleSheets(This->doc_node->nsdoc, &nsstylelist);
     if(NS_FAILED(nsres)) {
-        ERR("GetStyleSheets failed: %08x\n", nsres);
+        ERR("GetStyleSheets failed: %08lx\n", nsres);
         return map_nsresult(nsres);
     }
 
@@ -1716,7 +1716,7 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
+    TRACE("(%p)->(%s %ld %p)\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
 
     if(!This->doc_node->nsdoc) {
         FIXME("not a real doc object\n");
@@ -1724,7 +1724,7 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR
     }
 
     if(lIndex != -1)
-        FIXME("Unsupported lIndex %d\n", lIndex);
+        FIXME("Unsupported lIndex %ld\n", lIndex);
 
     if(bstrHref && *bstrHref) {
         FIXME("semi-stub for href %s\n", debugstr_w(bstrHref));
@@ -1975,7 +1975,7 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
     nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
     nsAString_Finish(&text_str);
     if(NS_FAILED(nsres)) {
-        ERR("CreateTextNode failed: %08x\n", nsres);
+        ERR("CreateTextNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2010,7 +2010,7 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
 
     nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
     if(NS_FAILED(nsres)) {
-        ERR("GetDocumentElement failed: %08x\n", nsres);
+        ERR("GetDocumentElement failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2172,7 +2172,7 @@ static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
     nsres = nsIDOMHTMLDocument_SetDir(This->doc_node->nsdoc, &dir_str);
     nsAString_Finish(&dir_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetDir failed: %08x\n", nsres);
+        ERR("SetDir failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2247,7 +2247,7 @@ static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface
 
     nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->doc_node->nsdoc, &doc_frag);
     if(NS_FAILED(nsres)) {
-        ERR("CreateDocumentFragment failed: %08x\n", nsres);
+        ERR("CreateDocumentFragment failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2370,7 +2370,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST
     nsAString_Finish(&selector_str);
     heap_free(selector);
     if(NS_FAILED(nsres)) {
-        ERR("QuerySelectorAll failed: %08x\n", nsres);
+        ERR("QuerySelectorAll failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2415,7 +2415,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
         nsres = nsIDOMHTMLDocument_GetElementsByTagName(This->doc_node->nsdoc, &id_str, &nslist);
         nsAString_Finish(&id_str);
         if(FAILED(nsres)) {
-            ERR("GetElementByName failed: %08x\n", nsres);
+            ERR("GetElementByName failed: %08lx\n", nsres);
             return E_FAIL;
         }
     }else {
@@ -2434,7 +2434,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
 
         nsres = nsIDOMNode_QueryInterface(This->doc_node->node.nsnode, &IID_nsIDOMDocumentFragment, (void**)&docfrag);
         if(NS_FAILED(nsres)) {
-            ERR("Could not get nsIDOMDocumentFragment iface: %08x\n", nsres);
+            ERR("Could not get nsIDOMDocumentFragment iface: %08lx\n", nsres);
             return E_UNEXPECTED;
         }
 
@@ -2443,7 +2443,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
         nsAString_Finish(&nsstr);
         nsIDOMDocumentFragment_Release(docfrag);
         if(NS_FAILED(nsres)) {
-            ERR("QuerySelectorAll failed: %08x\n", nsres);
+            ERR("QuerySelectorAll failed: %08lx\n", nsres);
             return E_FAIL;
         }
     }
@@ -2571,14 +2571,14 @@ static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
 
     nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
     if(NS_FAILED(nsres) || !nsbody) {
-        ERR("GetBody failed: %08x\n", nsres);
+        ERR("GetBody failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMHTMLElement_Focus(nsbody);
     nsIDOMHTMLElement_Release(nsbody);
     if(NS_FAILED(nsres)) {
-        ERR("Focus failed: %08x\n", nsres);
+        ERR("Focus failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2880,7 +2880,7 @@ static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs
     nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->nsdoc, &str, &nscomment);
     nsAString_Finish(&str);
     if(NS_FAILED(nsres)) {
-        ERR("CreateTextNode failed: %08x\n", nsres);
+        ERR("CreateTextNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -3158,7 +3158,7 @@ static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface,
     nsres = nsIDOMHTMLDocument_GetElementById(This->doc_node->nsdoc, &nsstr, &nselem);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("GetElementById failed: %08x\n", nsres);
+        ERR("GetElementById failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -3316,7 +3316,7 @@ static HRESULT WINAPI HTMLDocument7_createElementNS(IHTMLDocument7 *iface, VARIA
     nsAString_Finish(&ns);
     nsAString_Finish(&tag);
     if(NS_FAILED(nsres)) {
-        WARN("CreateElementNS failed: %08x\n", nsres);
+        WARN("CreateElementNS failed: %08lx\n", nsres);
         return map_nsresult(nsres);
     }
 
@@ -3407,7 +3407,7 @@ static HRESULT WINAPI HTMLDocument7_getElementsByClassName(IHTMLDocument7 *iface
     nsres = nsIDOMHTMLDocument_GetElementsByClassName(This->doc_node->nsdoc, &nsstr, &nslist);
     nsAString_Finish(&nsstr);
     if(FAILED(nsres)) {
-        ERR("GetElementByClassName failed: %08x\n", nsres);
+        ERR("GetElementByClassName failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -4320,7 +4320,7 @@ static HRESULT WINAPI DocumentSelector_querySelector(IDocumentSelector *iface, B
     nsres = nsIDOMHTMLDocument_QuerySelector(This->doc_node->nsdoc, &nsstr, &nselem);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("QuerySelector failed: %08x\n", nsres);
+        ERR("QuerySelector failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -4351,7 +4351,7 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface
     hres = map_nsresult(nsIDOMHTMLDocument_QuerySelectorAll(This->doc_node->nsdoc, &nsstr, &node_list));
     nsAString_Finish(&nsstr);
     if(FAILED(hres)) {
-        ERR("QuerySelectorAll failed: %08x\n", hres);
+        ERR("QuerySelectorAll failed: %08lx\n", hres);
         return hres;
     }
 
@@ -4602,7 +4602,7 @@ static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMemb
 {
     HTMLDocument *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
+    TRACE("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
           lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 
     switch(dispIdMember) {
@@ -4740,7 +4740,7 @@ static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo *i
 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo *iface, DWORD dwGuidKind, GUID *pGUID)
 {
     HTMLDocument *This = impl_from_IProvideMultipleClassInfo(iface);
-    FIXME("(%p)->(%u %p)\n", This, dwGuidKind, pGUID);
+    FIXME("(%p)->(%lu %p)\n", This, dwGuidKind, pGUID);
     return E_NOTIMPL;
 }
 
@@ -4756,7 +4756,7 @@ static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleCl
         DWORD dwFlags, ITypeInfo **pptiCoClass, DWORD *pdwTIFlags, ULONG *pcdispidReserved, IID *piidPrimary, IID *piidSource)
 {
     HTMLDocument *This = impl_from_IProvideMultipleClassInfo(iface);
-    FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
+    FIXME("(%p)->(%lu %lx %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
     return E_NOTIMPL;
 }
 
@@ -4874,7 +4874,7 @@ static HRESULT WINAPI MarkupServices_InsertText(IMarkupServices *iface,
     OLECHAR *pchText, LONG cch, IMarkupPointer *pPointerTarget)
 {
     HTMLDocument *This = impl_from_IMarkupServices(iface);
-    FIXME("(%p)->(%s,%x,%p)\n", This, debugstr_w(pchText), cch, pPointerTarget);
+    FIXME("(%p)->(%s,%lx,%p)\n", This, debugstr_w(pchText), cch, pPointerTarget);
     return E_NOTIMPL;
 }
 
@@ -4883,7 +4883,7 @@ static HRESULT WINAPI MarkupServices_ParseString(IMarkupServices *iface,
     IMarkupPointer *pPointerStart, IMarkupPointer *pPointerFinish)
 {
     HTMLDocument *This = impl_from_IMarkupServices(iface);
-    FIXME("(%p)->(%s,%x,%p,%p,%p)\n", This, debugstr_w(pchHTML), dwFlags, ppContainerResult, pPointerStart, pPointerFinish);
+    FIXME("(%p)->(%s,%lx,%p,%p,%p)\n", This, debugstr_w(pchHTML), dwFlags, ppContainerResult, pPointerStart, pPointerFinish);
     return E_NOTIMPL;
 }
 
@@ -4892,7 +4892,7 @@ static HRESULT WINAPI MarkupServices_ParseGlobal(IMarkupServices *iface,
     IMarkupPointer *pPointerStart, IMarkupPointer *pPointerFinish)
 {
     HTMLDocument *This = impl_from_IMarkupServices(iface);
-    FIXME("(%p)->(%s,%x,%p,%p,%p)\n", This, debugstr_w(hglobalHTML), dwFlags, ppContainerResult, pPointerStart, pPointerFinish);
+    FIXME("(%p)->(%s,%lx,%p,%p,%p)\n", This, debugstr_w(hglobalHTML), dwFlags, ppContainerResult, pPointerStart, pPointerFinish);
     return E_NOTIMPL;
 }
 
@@ -5721,7 +5721,7 @@ HRESULT create_document_node(nsIDOMHTMLDocument *nsdoc, GeckoBrowser *browser, H
         nsres = nsIDOMHTMLDocument_SetDesignMode(doc->nsdoc, &mode_str);
         nsAString_Finish(&mode_str);
         if(NS_FAILED(nsres))
-            ERR("SetDesignMode failed: %08x\n", nsres);
+            ERR("SetDesignMode failed: %08lx\n", nsres);
     }
 
     *ret = doc;
@@ -5809,7 +5809,7 @@ static ULONG WINAPI HTMLDocumentObj_AddRef(IUnknown *iface)
     HTMLDocumentObj *This = impl_from_IUnknown(iface);
     ULONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref = %u\n", This, ref);
+    TRACE("(%p) ref = %lu\n", This, ref);
 
     return ref;
 }
@@ -5819,7 +5819,7 @@ static ULONG WINAPI HTMLDocumentObj_Release(IUnknown *iface)
     HTMLDocumentObj *This = impl_from_IUnknown(iface);
     ULONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref = %u\n", This, ref);
+    TRACE("(%p) ref = %lu\n", This, ref);
 
     if(!ref) {
         if(This->basedoc.doc_node) {
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 2a73c6a2d33..47c18279689 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -192,7 +192,7 @@ HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, cons
 
     nsres = nsIDOMHTMLDocument_CreateRange(nsdoc, &range);
     if(NS_FAILED(nsres)) {
-        ERR("CreateRange failed: %08x\n", nsres);
+        ERR("CreateRange failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -201,7 +201,7 @@ HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, cons
     nsIDOMRange_Release(range);
     nsAString_Finish(&html_str);
     if(NS_FAILED(nsres)) {
-        ERR("CreateContextualFragment failed: %08x\n", nsres);
+        ERR("CreateContextualFragment failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -212,13 +212,13 @@ HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, cons
         nsres = nsIDOMNode_ReplaceChild(nsparent, (nsIDOMNode*)nsfragment, nsnode, &nstmp);
         nsIDOMNode_Release(nsparent);
         if(NS_FAILED(nsres)) {
-            ERR("ReplaceChild failed: %08x\n", nsres);
+            ERR("ReplaceChild failed: %08lx\n", nsres);
             hres = E_FAIL;
         }else if(nstmp) {
             nsIDOMNode_Release(nstmp);
         }
     }else {
-        ERR("GetParentNode failed: %08x\n", nsres);
+        ERR("GetParentNode failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -236,7 +236,7 @@ nsresult get_elem_attr_value(nsIDOMElement *nselem, const WCHAR *name, nsAString
     nsres = nsIDOMElement_GetAttribute(nselem, &name_str, val_str);
     nsAString_Finish(&name_str);
     if(NS_FAILED(nsres)) {
-        ERR("GetAttribute(%s) failed: %08x\n", debugstr_w(name), nsres);
+        ERR("GetAttribute(%s) failed: %08lx\n", debugstr_w(name), nsres);
         nsAString_Finish(val_str);
         return nsres;
     }
@@ -281,7 +281,7 @@ HRESULT elem_string_attr_setter(HTMLElement *elem, const WCHAR *name, const WCHA
     nsAString_Finish(&val_str);
 
     if(NS_FAILED(nsres)) {
-        WARN("SetAttribute failed: %08x\n", nsres);
+        WARN("SetAttribute failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -497,7 +497,7 @@ HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMElement **r
     nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &tag_str, ret);
     nsAString_Finish(&tag_str);
     if(NS_FAILED(nsres)) {
-        ERR("CreateElement failed: %08x\n", nsres);
+        ERR("CreateElement failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -567,7 +567,7 @@ static ULONG WINAPI HTMLRect_AddRef(IHTMLRect *iface)
     HTMLRect *This = impl_from_IHTMLRect(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -577,7 +577,7 @@ static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface)
     HTMLRect *This = impl_from_IHTMLRect(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->nsrect)
@@ -626,7 +626,7 @@ static HRESULT WINAPI HTMLRect_Invoke(IHTMLRect *iface, DISPID dispIdMember,
 static HRESULT WINAPI HTMLRect_put_left(IHTMLRect *iface, LONG v)
 {
     HTMLRect *This = impl_from_IHTMLRect(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -640,7 +640,7 @@ static HRESULT WINAPI HTMLRect_get_left(IHTMLRect *iface, LONG *p)
 
     nsres = nsIDOMClientRect_GetLeft(This->nsrect, &left);
     if(NS_FAILED(nsres)) {
-        ERR("GetLeft failed: %08x\n", nsres);
+        ERR("GetLeft failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -651,7 +651,7 @@ static HRESULT WINAPI HTMLRect_get_left(IHTMLRect *iface, LONG *p)
 static HRESULT WINAPI HTMLRect_put_top(IHTMLRect *iface, LONG v)
 {
     HTMLRect *This = impl_from_IHTMLRect(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -665,7 +665,7 @@ static HRESULT WINAPI HTMLRect_get_top(IHTMLRect *iface, LONG *p)
 
     nsres = nsIDOMClientRect_GetTop(This->nsrect, &top);
     if(NS_FAILED(nsres)) {
-        ERR("GetTop failed: %08x\n", nsres);
+        ERR("GetTop failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -676,7 +676,7 @@ static HRESULT WINAPI HTMLRect_get_top(IHTMLRect *iface, LONG *p)
 static HRESULT WINAPI HTMLRect_put_right(IHTMLRect *iface, LONG v)
 {
     HTMLRect *This = impl_from_IHTMLRect(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -690,7 +690,7 @@ static HRESULT WINAPI HTMLRect_get_right(IHTMLRect *iface, LONG *p)
 
     nsres = nsIDOMClientRect_GetRight(This->nsrect, &right);
     if(NS_FAILED(nsres)) {
-        ERR("GetRight failed: %08x\n", nsres);
+        ERR("GetRight failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -701,7 +701,7 @@ static HRESULT WINAPI HTMLRect_get_right(IHTMLRect *iface, LONG *p)
 static HRESULT WINAPI HTMLRect_put_bottom(IHTMLRect *iface, LONG v)
 {
     HTMLRect *This = impl_from_IHTMLRect(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -715,7 +715,7 @@ static HRESULT WINAPI HTMLRect_get_bottom(IHTMLRect *iface, LONG *p)
 
     nsres = nsIDOMClientRect_GetBottom(This->nsrect, &bottom);
     if(NS_FAILED(nsres)) {
-        ERR("GetBottom failed: %08x\n", nsres);
+        ERR("GetBottom failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -813,7 +813,7 @@ static ULONG WINAPI HTMLRectCollection_AddRef(IHTMLRectCollection *iface)
     HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -823,7 +823,7 @@ static ULONG WINAPI HTMLRectCollection_Release(IHTMLRectCollection *iface)
     HTMLRectCollection *This = impl_from_IHTMLRectCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->rect_list)
@@ -955,7 +955,7 @@ static HRESULT HTMLRectCollection_get_dispid(DispatchEx *dispex, BSTR name, DWOR
         return DISP_E_UNKNOWNNAME;
 
     *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
-    TRACE("ret %x\n", *dispid);
+    TRACE("ret %lx\n", *dispid);
     return S_OK;
 }
 
@@ -964,7 +964,7 @@ static HRESULT HTMLRectCollection_invoke(DispatchEx *dispex, DISPID id, LCID lci
 {
     HTMLRectCollection *This = HTMLRectCollection_from_DispatchEx(dispex);
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
 
     switch(flags) {
     case DISPATCH_PROPERTYGET: {
@@ -1104,7 +1104,7 @@ static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttr
     DISPID dispid;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %s %08x)\n", This, debugstr_w(strAttributeName), debugstr_variant(&AttributeValue), lFlags);
+    TRACE("(%p)->(%s %s %08lx)\n", This, debugstr_w(strAttributeName), debugstr_variant(&AttributeValue), lFlags);
 
     if(compat_mode < COMPAT_MODE_IE9 || !This->dom_element) {
         hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, translate_attr_name(strAttributeName, compat_mode),
@@ -1145,7 +1145,7 @@ static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttr
     nsAString_Finish(&name_str);
     nsAString_Finish(&value_str);
     if(NS_FAILED(nsres))
-        WARN("SetAttribute failed: %08x\n", nsres);
+        WARN("SetAttribute failed: %08lx\n", nsres);
     hres = map_nsresult(nsres);
 
 done:
@@ -1200,10 +1200,10 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
     DISPID dispid;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
+    TRACE("(%p)->(%s %08lx %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
 
     if(lFlags & ~(ATTRFLAG_CASESENSITIVE|ATTRFLAG_ASSTRING))
-        FIXME("Unsupported flags %x\n", lFlags);
+        FIXME("Unsupported flags %lx\n", lFlags);
 
     if(compat_mode < COMPAT_MODE_IE9 || !This->dom_element) {
         hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, translate_attr_name(strAttributeName, compat_mode),
@@ -1251,7 +1251,7 @@ static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strA
     DISPID id;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
+    TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
 
     if(compat_mode < COMPAT_MODE_IE9 || !This->dom_element) {
         hres = IDispatchEx_GetDispID(&This->node.event_target.dispex.IDispatchEx_iface, translate_attr_name(strAttributeName, compat_mode),
@@ -1311,7 +1311,7 @@ static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
     nsres = nsIDOMElement_SetClassName(This->dom_element, &classname_str);
     nsAString_Finish(&classname_str);
     if(NS_FAILED(nsres))
-        ERR("SetClassName failed: %08x\n", nsres);
+        ERR("SetClassName failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1351,7 +1351,7 @@ static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
     nsres = nsIDOMElement_SetId(This->dom_element, &id_str);
     nsAString_Finish(&id_str);
     if(NS_FAILED(nsres))
-        ERR("SetId failed: %08x\n", nsres);
+        ERR("SetId failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1681,7 +1681,7 @@ static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
     nsres = nsIDOMHTMLElement_SetTitle(This->html_element, &title_str);
     nsAString_Finish(&title_str);
     if(NS_FAILED(nsres))
-        ERR("SetTitle failed: %08x\n", nsres);
+        ERR("SetTitle failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1844,7 +1844,7 @@ static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
     nsres = nsIDOMHTMLElement_SetLang(This->html_element, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetLang failed: %08x\n", nsres);
+        ERR("SetLang failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1883,7 +1883,7 @@ static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, LONG *p)
 
     nsres = nsIDOMHTMLElement_GetOffsetLeft(This->html_element, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetOffsetLeft failed: %08x\n", nsres);
+        ERR("GetOffsetLeft failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1904,7 +1904,7 @@ static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, LONG *p)
 
     nsres = nsIDOMHTMLElement_GetOffsetTop(This->html_element, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetOffsetTop failed: %08x\n", nsres);
+        ERR("GetOffsetTop failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1925,7 +1925,7 @@ static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, LONG *p)
 
     nsres = nsIDOMHTMLElement_GetOffsetWidth(This->html_element, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetOffsetWidth failed: %08x\n", nsres);
+        ERR("GetOffsetWidth failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1946,7 +1946,7 @@ static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, LONG *p)
 
     nsres = nsIDOMHTMLElement_GetOffsetHeight(This->html_element, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetOffsetHeight failed: %08x\n", nsres);
+        ERR("GetOffsetHeight failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1970,7 +1970,7 @@ static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLEle
 
     nsres = nsIDOMHTMLElement_GetOffsetParent(This->html_element, &nsparent);
     if(NS_FAILED(nsres)) {
-        ERR("GetOffsetParent failed: %08x\n", nsres);
+        ERR("GetOffsetParent failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2005,7 +2005,7 @@ static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
     nsres = nsIDOMHTMLElement_SetInnerHTML(This->html_element, &html_str);
     nsAString_Finish(&html_str);
     if(NS_FAILED(nsres)) {
-        FIXME("SetInnerHtml failed %08x\n", nsres);
+        FIXME("SetInnerHtml failed %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2043,7 +2043,7 @@ static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
     while(1) {
         nsres = nsIDOMElement_GetLastChild(This->dom_element, &nschild);
         if(NS_FAILED(nsres)) {
-            ERR("GetLastChild failed: %08x\n", nsres);
+            ERR("GetLastChild failed: %08lx\n", nsres);
             return E_FAIL;
         }
         if(!nschild)
@@ -2052,7 +2052,7 @@ static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
         nsres = nsIDOMElement_RemoveChild(This->dom_element, nschild, &tmp);
         nsIDOMNode_Release(nschild);
         if(NS_FAILED(nsres)) {
-            ERR("RemoveChild failed: %08x\n", nsres);
+            ERR("RemoveChild failed: %08lx\n", nsres);
             return E_FAIL;
         }
         nsIDOMNode_Release(tmp);
@@ -2062,13 +2062,13 @@ static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
     nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
     nsAString_Finish(&text_str);
     if(NS_FAILED(nsres)) {
-        ERR("CreateTextNode failed: %08x\n", nsres);
+        ERR("CreateTextNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMElement_AppendChild(This->dom_element, (nsIDOMNode*)text_node, &tmp);
     if(NS_FAILED(nsres)) {
-        ERR("AppendChild failed: %08x\n", nsres);
+        ERR("AppendChild failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2162,7 +2162,7 @@ static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
     }
     nsIDOMText_Release(text_node);
     if(NS_FAILED(nsres)) {
-        ERR("failed to set text: %08x\n", nsres);
+        ERR("failed to set text: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2266,7 +2266,7 @@ static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR w
     nsres = nsIDOMHTMLDocument_CreateRange(This->node.doc->nsdoc, &range);
     if(NS_FAILED(nsres))
     {
-        ERR("CreateRange failed: %08x\n", nsres);
+        ERR("CreateRange failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2279,7 +2279,7 @@ static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR w
 
     if(NS_FAILED(nsres) || !nsnode)
     {
-        ERR("CreateTextNode failed: %08x\n", nsres);
+        ERR("CreateTextNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2311,7 +2311,7 @@ static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR w
 
     if(NS_FAILED(nsres) || !nsnode)
     {
-        ERR("CreateTextNode failed: %08x\n", nsres);
+        ERR("CreateTextNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2352,7 +2352,7 @@ static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
 
     nsres = nsIDOMHTMLElement_Click(This->html_element);
     if(NS_FAILED(nsres)) {
-        ERR("Click failed: %08x\n", nsres);
+        ERR("Click failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2549,7 +2549,7 @@ static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **
 
     nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
     if(NS_FAILED(nsres)) {
-        ERR("GetChildNodes failed: %08x\n", nsres);
+        ERR("GetChildNodes failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2765,7 +2765,7 @@ static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
                                                       LONG x, LONG y, BSTR *component)
 {
     HTMLElement *This = impl_from_IHTMLElement2(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, x, y, component);
+    FIXME("(%p)->(%ld %ld %p)\n", This, x, y, component);
     return E_NOTIMPL;
 }
 
@@ -3016,7 +3016,7 @@ static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRec
 
     nsres = nsIDOMElement_GetClientRects(This->dom_element, &rect_list);
     if(NS_FAILED(nsres)) {
-        WARN("GetClientRects failed: %08x\n", nsres);
+        WARN("GetClientRects failed: %08lx\n", nsres);
         return map_nsresult(nsres);
     }
 
@@ -3052,7 +3052,7 @@ static HRESULT WINAPI HTMLElement2_getBoundingClientRect(IHTMLElement2 *iface, I
 
     nsres = nsIDOMElement_GetBoundingClientRect(This->dom_element, &nsrect);
     if(NS_FAILED(nsres) || !nsrect) {
-        ERR("GetBoindingClientRect failed: %08x\n", nsres);
+        ERR("GetBoindingClientRect failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -3101,7 +3101,7 @@ static HRESULT WINAPI HTMLElement2_put_tabIndex(IHTMLElement2 *iface, short v)
 
     nsres = nsIDOMHTMLElement_SetTabIndex(This->html_element, v);
     if(NS_FAILED(nsres))
-        ERR("GetTabIndex failed: %08x\n", nsres);
+        ERR("GetTabIndex failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -3121,7 +3121,7 @@ static HRESULT WINAPI HTMLElement2_get_tabIndex(IHTMLElement2 *iface, short *p)
 
     nsres = nsIDOMHTMLElement_GetTabIndex(This->html_element, &index);
     if(NS_FAILED(nsres)) {
-        ERR("GetTabIndex failed: %08x\n", nsres);
+        ERR("GetTabIndex failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -3143,7 +3143,7 @@ static HRESULT WINAPI HTMLElement2_focus(IHTMLElement2 *iface)
 
     nsres = nsIDOMHTMLElement_Focus(This->html_element);
     if(NS_FAILED(nsres))
-        ERR("Focus failed: %08x\n", nsres);
+        ERR("Focus failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -3253,7 +3253,7 @@ static HRESULT WINAPI HTMLElement2_blur(IHTMLElement2 *iface)
 
     nsres = nsIDOMHTMLElement_Blur(This->html_element);
     if(NS_FAILED(nsres)) {
-        ERR("Blur failed: %08x\n", nsres);
+        ERR("Blur failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -3323,7 +3323,7 @@ static HRESULT WINAPI HTMLElement2_get_clientTop(IHTMLElement2 *iface, LONG *p)
     nsres = nsIDOMElement_GetClientTop(This->dom_element, p);
     assert(nsres == NS_OK);
 
-    TRACE("*p = %d\n", *p);
+    TRACE("*p = %ld\n", *p);
     return S_OK;
 }
 
@@ -3342,7 +3342,7 @@ static HRESULT WINAPI HTMLElement2_get_clientLeft(IHTMLElement2 *iface, LONG *p)
     nsres = nsIDOMElement_GetClientLeft(This->dom_element, p);
     assert(nsres == NS_OK);
 
-    TRACE("*p = %d\n", *p);
+    TRACE("*p = %ld\n", *p);
     return S_OK;
 }
 
@@ -3466,7 +3466,7 @@ static HRESULT WINAPI HTMLElement2_put_dir(IHTMLElement2 *iface, BSTR v)
     nsres = nsIDOMHTMLElement_SetDir(This->html_element, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetDir failed: %08x\n", nsres);
+        ERR("SetDir failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -3514,7 +3514,7 @@ static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, LONG *
 
     nsres = nsIDOMElement_GetScrollHeight(This->dom_element, p);
     assert(nsres == NS_OK);
-    TRACE("*p = %d\n", *p);
+    TRACE("*p = %ld\n", *p);
     return S_OK;
 }
 
@@ -3533,7 +3533,7 @@ static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, LONG *p
     nsres = nsIDOMElement_GetScrollWidth(This->dom_element, p);
     assert(nsres == NS_OK);
 
-    TRACE("*p = %d\n", *p);
+    TRACE("*p = %ld\n", *p);
     return S_OK;
 }
 
@@ -3541,7 +3541,7 @@ static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, LONG v)
 {
     HTMLElement *This = impl_from_IHTMLElement2(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     if(!This->dom_element) {
         FIXME("comment element\n");
@@ -3567,7 +3567,7 @@ static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, LONG *p)
     nsres = nsIDOMElement_GetScrollTop(This->dom_element, p);
     assert(nsres == NS_OK);
 
-    TRACE("*p = %d\n", *p);
+    TRACE("*p = %ld\n", *p);
     return S_OK;
 }
 
@@ -3575,7 +3575,7 @@ static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, LONG v)
 {
     HTMLElement *This = impl_from_IHTMLElement2(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     if(!This->dom_element) {
         FIXME("comment element\n");
@@ -3603,7 +3603,7 @@ static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, LONG *p)
 
     nsres = nsIDOMElement_GetScrollLeft(This->dom_element, p);
     assert(nsres == NS_OK);
-    TRACE("*p = %d\n", *p);
+    TRACE("*p = %ld\n", *p);
     return S_OK;
 }
 
@@ -3704,7 +3704,7 @@ static HRESULT WINAPI HTMLElement2_removeBehavior(IHTMLElement2 *iface, LONG coo
                                                   VARIANT_BOOL *pfResult)
 {
     HTMLElement *This = impl_from_IHTMLElement2(iface);
-    FIXME("(%p)->(%d %p)\n", This, cookie, pfResult);
+    FIXME("(%p)->(%ld %p)\n", This, cookie, pfResult);
     return E_NOTIMPL;
 }
 
@@ -3791,7 +3791,7 @@ static HRESULT WINAPI HTMLElement2_getElementsByTagName(IHTMLElement2 *iface, BS
     nsres = nsIDOMElement_GetElementsByTagName(This->dom_element, &tag_str, &nscol);
     nsAString_Finish(&tag_str);
     if(NS_FAILED(nsres)) {
-        ERR("GetElementByTagName failed: %08x\n", nsres);
+        ERR("GetElementByTagName failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -4496,7 +4496,7 @@ static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLD
     if(replace) {
         hres = get_elem_attr_value_by_dispid(This, dispid, &replace->value);
         if(FAILED(hres)) {
-            WARN("could not get attr value: %08x\n", hres);
+            WARN("could not get attr value: %08lx\n", hres);
             V_VT(&replace->value) = VT_EMPTY;
         }
         if(!replace->name) {
@@ -4518,7 +4518,7 @@ static HRESULT WINAPI HTMLElement4_setAttributeNode(IHTMLElement4 *iface, IHTMLD
 
     hres = set_elem_attr_value_by_dispid(This, dispid, &attr->value);
     if(FAILED(hres))
-        WARN("Could not set attribute value: %08x\n", hres);
+        WARN("Could not set attribute value: %08lx\n", hres);
     VariantClear(&attr->value);
 
     *ppretAttribute = replace ? &replace->IHTMLDOMAttribute_iface : NULL;
@@ -4834,7 +4834,7 @@ static HRESULT WINAPI HTMLElement6_getElementsByClassName(IHTMLElement6 *iface,
         nsres = nsIDOMElement_GetElementsByClassName(This->dom_element, &nsstr, &nscol);
         nsAString_Finish(&nsstr);
         if(NS_FAILED(nsres)) {
-            ERR("GetElementsByClassName failed: %08x\n", nsres);
+            ERR("GetElementsByClassName failed: %08lx\n", nsres);
             return E_FAIL;
         }
     }
@@ -4862,7 +4862,7 @@ static HRESULT WINAPI HTMLElement6_msMatchesSelector(IHTMLElement6 *iface, BSTR
     nsres = nsIDOMElement_MozMatchesSelector(This->dom_element, &nsstr, &b);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        WARN("MozMatchesSelector failed: %08x\n", nsres);
+        WARN("MozMatchesSelector failed: %08lx\n", nsres);
         return map_nsresult(nsres);
     }
 
@@ -5658,14 +5658,14 @@ static HRESULT WINAPI HTMLElement7_get_onmsinertiastart(IHTMLElement7 *iface, VA
 static HRESULT WINAPI HTMLElement7_msSetPointerCapture(IHTMLElement7 *iface, LONG pointer_id)
 {
     HTMLElement *This = impl_from_IHTMLElement7(iface);
-    FIXME("(%p)->(%d)\n", This, pointer_id);
+    FIXME("(%p)->(%ld)\n", This, pointer_id);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement7_msReleasePointerCapture(IHTMLElement7 *iface, LONG pointer_id)
 {
     HTMLElement *This = impl_from_IHTMLElement7(iface);
-    FIXME("(%p)->(%d)\n", This, pointer_id);
+    FIXME("(%p)->(%ld)\n", This, pointer_id);
     return E_NOTIMPL;
 }
 
@@ -6072,7 +6072,7 @@ static HRESULT WINAPI ElementSelector_querySelector(IElementSelector *iface, BST
     nsres = nsIDOMElement_QuerySelector(This->dom_element, &nsstr, &nselem);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("QuerySelector failed: %08x\n", nsres);
+        ERR("QuerySelector failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -6108,7 +6108,7 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface,
     hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list));
     nsAString_Finish(&nsstr);
     if(FAILED(hres)) {
-        ERR("QuerySelectorAll failed: %08x\n", hres);
+        ERR("QuerySelectorAll failed: %08lx\n", hres);
         return hres;
     }
 
@@ -6163,7 +6163,7 @@ static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo *i
 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo *iface, DWORD dwGuidKind, GUID *pGUID)
 {
     HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
-    FIXME("(%p)->(%u %p)\n", This, dwGuidKind, pGUID);
+    FIXME("(%p)->(%lu %p)\n", This, dwGuidKind, pGUID);
     return E_NOTIMPL;
 }
 
@@ -6179,7 +6179,7 @@ static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleCl
         DWORD dwFlags, ITypeInfo **pptiCoClass, DWORD *pdwTIFlags, ULONG *pcdispidReserved, IID *piidPrimary, IID *piidSource)
 {
     HTMLElement *This = impl_from_IProvideMultipleClassInfo(iface);
-    FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
+    FIXME("(%p)->(%lu %lx %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
     return E_NOTIMPL;
 }
 
@@ -6764,7 +6764,7 @@ static ULONG WINAPI token_list_AddRef(IWineDOMTokenList *iface)
     struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
     LONG ref = InterlockedIncrement(&token_list->ref);
 
-    TRACE("(%p) ref=%d\n", token_list, ref);
+    TRACE("(%p) ref=%ld\n", token_list, ref);
 
     return ref;
 }
@@ -6774,7 +6774,7 @@ static ULONG WINAPI token_list_Release(IWineDOMTokenList *iface)
     struct token_list *token_list = impl_from_IWineDOMTokenList(iface);
     LONG ref = InterlockedDecrement(&token_list->ref);
 
-    TRACE("(%p) ref=%d\n", token_list, ref);
+    TRACE("(%p) ref=%ld\n", token_list, ref);
 
     if(!ref) {
         IHTMLElement_Release(token_list->element);
@@ -7276,7 +7276,7 @@ static ULONG WINAPI HTMLFiltersCollection_AddRef(IHTMLFiltersCollection *iface)
     HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -7286,7 +7286,7 @@ static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface)
     HTMLFiltersCollection *This = impl_from_IHTMLFiltersCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
     {
@@ -7378,14 +7378,14 @@ static HRESULT HTMLFiltersCollection_get_dispid(DispatchEx *dispex, BSTR name, D
         return DISP_E_UNKNOWNNAME;
 
     *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
-    TRACE("ret %x\n", *dispid);
+    TRACE("ret %lx\n", *dispid);
     return S_OK;
 }
 
 static HRESULT HTMLFiltersCollection_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
         VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
 {
-    TRACE("(%p)->(%x %x %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei);
+    TRACE("(%p)->(%lx %lx %x %p %p %p)\n", dispex, id, lcid, flags, params, res, ei);
 
     V_VT(res) = VT_DISPATCH;
     V_DISPATCH(res) = NULL;
@@ -7467,7 +7467,7 @@ static ULONG WINAPI HTMLAttributeCollection_AddRef(IHTMLAttributeCollection *ifa
     HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -7477,7 +7477,7 @@ static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *if
     HTMLAttributeCollection *This = impl_from_IHTMLAttributeCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         while(!list_empty(&This->attrs)) {
@@ -7868,7 +7868,7 @@ static HRESULT WINAPI HTMLAttributeCollection3_item(IHTMLAttributeCollection3 *i
     DISPID id;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %p)\n", This, index, ppNodeOut);
+    TRACE("(%p)->(%ld %p)\n", This, index, ppNodeOut);
 
     hres = get_attr_dispid_by_idx(This, &index, &id);
     if(hres == DISP_E_UNKNOWNNAME)
@@ -7917,7 +7917,7 @@ static HRESULT HTMLAttributeCollection_get_dispid(DispatchEx *dispex, BSTR name,
     LONG pos;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), flags, dispid);
+    TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(name), flags, dispid);
 
     hres = get_attr_dispid_by_name(This, name, dispid);
     if(FAILED(hres))
@@ -7937,7 +7937,7 @@ static HRESULT HTMLAttributeCollection_invoke(DispatchEx *dispex, DISPID id, LCI
 {
     HTMLAttributeCollection *This = HTMLAttributeCollection_from_DispatchEx(dispex);
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
 
     switch(flags) {
     case DISPATCH_PROPERTYGET: {
diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c
index 895b3db5b2a..385bd9038b2 100644
--- a/dlls/mshtml/htmlelemcol.c
+++ b/dlls/mshtml/htmlelemcol.c
@@ -125,7 +125,7 @@ static ULONG WINAPI HTMLElementCollectionEnum_AddRef(IEnumVARIANT *iface)
     HTMLElementCollectionEnum *This = impl_from_IEnumVARIANT(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -135,7 +135,7 @@ static ULONG WINAPI HTMLElementCollectionEnum_Release(IEnumVARIANT *iface)
     HTMLElementCollectionEnum *This = impl_from_IEnumVARIANT(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         IHTMLElementCollection_Release(&This->col->IHTMLElementCollection_iface);
@@ -150,7 +150,7 @@ static HRESULT WINAPI HTMLElementCollectionEnum_Next(IEnumVARIANT *iface, ULONG
     HTMLElementCollectionEnum *This = impl_from_IEnumVARIANT(iface);
     ULONG fetched = 0;
 
-    TRACE("(%p)->(%d %p %p)\n", This, celt, rgVar, pCeltFetched);
+    TRACE("(%p)->(%ld %p %p)\n", This, celt, rgVar, pCeltFetched);
 
     while(This->iter+fetched < This->col->len && fetched < celt) {
         V_VT(rgVar+fetched) = VT_DISPATCH;
@@ -169,7 +169,7 @@ static HRESULT WINAPI HTMLElementCollectionEnum_Skip(IEnumVARIANT *iface, ULONG
 {
     HTMLElementCollectionEnum *This = impl_from_IEnumVARIANT(iface);
 
-    TRACE("(%p)->(%d)\n", This, celt);
+    TRACE("(%p)->(%ld)\n", This, celt);
 
     if(This->iter + celt > This->col->len) {
         This->iter = This->col->len;
@@ -240,7 +240,7 @@ static ULONG WINAPI HTMLElementCollection_AddRef(IHTMLElementCollection *iface)
     HTMLElementCollection *This = impl_from_IHTMLElementCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -250,7 +250,7 @@ static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface)
     HTMLElementCollection *This = impl_from_IHTMLElementCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         unsigned i;
@@ -311,7 +311,7 @@ static HRESULT WINAPI HTMLElementCollection_put_length(IHTMLElementCollection *i
                                                        LONG v)
 {
     HTMLElementCollection *This = impl_from_IHTMLElementCollection(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -356,7 +356,7 @@ static BOOL is_elem_id(HTMLElement *elem, LPCWSTR name)
 
     hres = IHTMLElement_get_id(&elem->IHTMLElement_iface, &elem_id);
     if(FAILED(hres)){
-        WARN("IHTMLElement_get_id failed: 0x%08x\n", hres);
+        WARN("IHTMLElement_get_id failed: 0x%08lx\n", hres);
         return FALSE;
     }
 
@@ -522,7 +522,7 @@ static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface,
     nsAString_Finish(&tag_str);
     elem_vector_normalize(&buf);
 
-    TRACE("found %d tags\n", buf.len);
+    TRACE("found %ld tags\n", buf.len);
 
     *pdisp = (IDispatch*)HTMLElementCollection_Create(buf.buf, buf.len,
                                                       dispex_compat_mode(&This->dispex));
@@ -577,7 +577,7 @@ static HRESULT HTMLElementCollection_get_dispid(DispatchEx *dispex, BSTR name, D
         return DISP_E_UNKNOWNNAME;
 
     *dispid = DISPID_ELEMCOL_0 + idx;
-    TRACE("ret %x\n", *dispid);
+    TRACE("ret %lx\n", *dispid);
     return S_OK;
 }
 
@@ -587,7 +587,7 @@ static HRESULT HTMLElementCollection_invoke(DispatchEx *dispex, DISPID id, LCID
     HTMLElementCollection *This = impl_from_DispatchEx(dispex);
     DWORD idx;
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
 
     idx = id - DISPID_ELEMCOL_0;
     if(idx >= This->len)
@@ -636,7 +636,7 @@ static void create_all_list(HTMLDOMNode *elem, elem_vector_t *buf)
 
     nsres = nsIDOMNode_GetChildNodes(elem->nsnode, &nsnode_list);
     if(NS_FAILED(nsres)) {
-        ERR("GetChildNodes failed: %08x\n", nsres);
+        ERR("GetChildNodes failed: %08lx\n", nsres);
         return;
     }
 
@@ -647,7 +647,7 @@ static void create_all_list(HTMLDOMNode *elem, elem_vector_t *buf)
     for(i=0; i<list_len; i++) {
         nsres = nsIDOMNodeList_Item(nsnode_list, i, &iter);
         if(NS_FAILED(nsres)) {
-            ERR("Item failed: %08x\n", nsres);
+            ERR("Item failed: %08lx\n", nsres);
             continue;
         }
 
@@ -656,7 +656,7 @@ static void create_all_list(HTMLDOMNode *elem, elem_vector_t *buf)
 
             hres = get_node(iter, TRUE, &node);
             if(FAILED(hres)) {
-                FIXME("get_node failed: %08x\n", hres);
+                FIXME("get_node failed: %08lx\n", hres);
                 continue;
             }
 
@@ -838,7 +838,7 @@ static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems,
     init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLElementCollection_iface,
                   &HTMLElementCollection_dispex, compat_mode);
 
-    TRACE("ret=%p len=%d\n", ret, len);
+    TRACE("ret=%p len=%ld\n", ret, len);
 
     return &ret->IHTMLElementCollection_iface;
 }
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index 327bb1f915c..1663fba3ba3 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -314,7 +314,7 @@ static ULONG WINAPI HTMLEventObj_AddRef(IHTMLEventObj *iface)
     HTMLEventObj *This = impl_from_IHTMLEventObj(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -324,7 +324,7 @@ static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface)
     HTMLEventObj *This = impl_from_IHTMLEventObj(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->event)
@@ -509,7 +509,7 @@ static HRESULT WINAPI HTMLEventObj_get_toElement(IHTMLEventObj *iface, IHTMLElem
 static HRESULT WINAPI HTMLEventObj_put_keyCode(IHTMLEventObj *iface, LONG v)
 {
     HTMLEventObj *This = impl_from_IHTMLEventObj(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -831,7 +831,7 @@ static ULONG WINAPI DOMEvent_AddRef(IDOMEvent *iface)
     DOMEvent *This = impl_from_IDOMEvent(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%u\n", This, ref);
+    TRACE("(%p) ref=%lu\n", This, ref);
 
     return ref;
 }
@@ -841,7 +841,7 @@ static ULONG WINAPI DOMEvent_Release(IDOMEvent *iface)
     DOMEvent *This = impl_from_IDOMEvent(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%u\n", This, ref);
+    TRACE("(%p) ref=%lu\n", This, ref);
 
     if(!ref) {
         if(This->destroy)
@@ -1219,7 +1219,7 @@ static HRESULT WINAPI DOMUIEvent_initUIEvent(IDOMUIEvent *iface, BSTR type, VARI
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %x %x %p %x)\n", This, debugstr_w(type), can_bubble, cancelable, view, detail);
+    TRACE("(%p)->(%s %x %x %p %lx)\n", This, debugstr_w(type), can_bubble, cancelable, view, detail);
 
     if(This->target) {
         TRACE("called on already dispatched event\n");
@@ -1238,7 +1238,7 @@ static HRESULT WINAPI DOMUIEvent_initUIEvent(IDOMUIEvent *iface, BSTR type, VARI
                                       NULL /* FIXME */, detail);
     nsAString_Finish(&type_str);
     if(NS_FAILED(nsres)) {
-        FIXME("InitUIEvent failed: %08x\n", nsres);
+        FIXME("InitUIEvent failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1503,7 +1503,7 @@ static HRESULT WINAPI DOMMouseEvent_initMouseEvent(IDOMMouseEvent *iface, BSTR t
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %x %x %p %d %d %d %d %d %x %x %x %x %u %p)\n", This, debugstr_w(type),
+    TRACE("(%p)->(%s %x %x %p %ld %ld %ld %ld %ld %x %x %x %x %u %p)\n", This, debugstr_w(type),
           can_bubble, cancelable, view, detail, screen_x, screen_y, client_x, client_y,
           ctrl_key, alt_key, shift_key, meta_key, button, related_target);
 
@@ -1530,7 +1530,7 @@ static HRESULT WINAPI DOMMouseEvent_initMouseEvent(IDOMMouseEvent *iface, BSTR t
                                                 !!meta_key, button, nstarget);
         nsAString_Finish(&type_str);
         if(NS_FAILED(nsres)) {
-            FIXME("InitMouseEvent failed: %08x\n", nsres);
+            FIXME("InitMouseEvent failed: %08lx\n", nsres);
             return E_FAIL;
         }
     }
@@ -1940,7 +1940,7 @@ static HRESULT WINAPI DOMKeyboardEvent_initKeyboardEvent(IDOMKeyboardEvent *ifac
         ULONG location, BSTR modifiers_list, VARIANT_BOOL repeat, BSTR locale)
 {
     DOMEvent *This = impl_from_IDOMKeyboardEvent(iface);
-    FIXME("(%p)->(%s %x %x %p %s %u %s %x %s)\n", This, debugstr_w(type), can_bubble,
+    FIXME("(%p)->(%s %x %x %p %s %lu %s %x %s)\n", This, debugstr_w(type), can_bubble,
           cancelable, view, debugstr_w(key), location, debugstr_w(modifiers_list),
           repeat, debugstr_w(locale));
     return E_NOTIMPL;
@@ -2306,7 +2306,7 @@ HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, compat_mode_t compat_mod
         if(event_id == EVENTID_LAST)
             FIXME("unknown event type %s\n", debugstr_w(type));
     }else {
-        ERR("GetType failed: %08x\n", nsres);
+        ERR("GetType failed: %08lx\n", nsres);
     }
     nsAString_Finish(&nsstr);
 
@@ -2330,7 +2330,7 @@ HRESULT create_document_event_str(HTMLDocumentNode *doc, const WCHAR *type, IDOM
     nsres = nsIDOMHTMLDocument_CreateEvent(doc->nsdoc, &nsstr, &nsevent);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        FIXME("CreateEvent(%s) failed: %08x\n", debugstr_w(type), nsres);
+        FIXME("CreateEvent(%s) failed: %08lx\n", debugstr_w(type), nsres);
         return E_FAIL;
     }
 
@@ -2354,7 +2354,7 @@ HRESULT create_document_event(HTMLDocumentNode *doc, eventid_t event_id, DOMEven
     nsres = nsIDOMHTMLDocument_CreateEvent(doc->nsdoc, &nsstr, &nsevent);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        FIXME("CreateEvent(%s) failed: %08x\n", debugstr_w(event_types[event_info[event_id].type]), nsres);
+        FIXME("CreateEvent(%s) failed: %08lx\n", debugstr_w(event_types[event_info[event_id].type]), nsres);
         return E_FAIL;
     }
 
@@ -2381,7 +2381,7 @@ static HRESULT call_disp_func(IDispatch *disp, DISPPARAMS *dp, VARIANT *retv)
         hres = IDispatchEx_InvokeEx(dispex, 0, GetUserDefaultLCID(), DISPATCH_METHOD, dp, retv, &ei, NULL);
         IDispatchEx_Release(dispex);
     }else {
-        TRACE("Could not get IDispatchEx interface: %08x\n", hres);
+        TRACE("Could not get IDispatchEx interface: %08lx\n", hres);
         hres = IDispatch_Invoke(disp, 0, &IID_NULL, GetUserDefaultLCID(), DISPATCH_METHOD,
                 dp, retv, &ei, NULL);
     }
@@ -2396,7 +2396,7 @@ static HRESULT call_cp_func(IDispatch *disp, DISPID dispid, IHTMLEventObj *event
     UINT argerr;
     EXCEPINFO ei;
 
-    TRACE("%p,%d,%p,%p\n", disp, dispid, event_obj, retv);
+    TRACE("%p,%ld,%p,%p\n", disp, dispid, event_obj, retv);
 
     if(event_obj) {
         V_VT(&event_arg) = VT_DISPATCH;
@@ -2487,7 +2487,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp
                 }
                 VariantClear(&v);
             }else {
-                WARN("%p %s <<< %08x\n", event_target, debugstr_w(event->type), hres);
+                WARN("%p %s <<< %08lx\n", event_target, debugstr_w(event->type), hres);
             }
         }
     }
@@ -2568,7 +2568,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp
                 }
                 VariantClear(&v);
             }else {
-                WARN("%p %s <<< %08x\n", event_target, debugstr_w(event->type), hres);
+                WARN("%p %s <<< %08lx\n", event_target, debugstr_w(event->type), hres);
             }
         }else {
             VARIANTARG arg;
@@ -2593,7 +2593,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp
                 }
                 VariantClear(&v);
             }else {
-                WARN("%p %s attached <<< %08x\n", event_target, debugstr_w(event->type), hres);
+                WARN("%p %s attached <<< %08lx\n", event_target, debugstr_w(event->type), hres);
             }
         }
     }
@@ -2639,7 +2639,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp
                         }
                         VariantClear(&v);
                     }else {
-                        WARN("%p cp %s [%u] <<< %08x\n", event_target, debugstr_w(event->type), i, hres);
+                        WARN("%p cp %s [%u] <<< %08lx\n", event_target, debugstr_w(event->type), i, hres);
                     }
                 }
             }
diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c
index 566612f675a..45ff19aaa77 100644
--- a/dlls/mshtml/htmlform.c
+++ b/dlls/mshtml/htmlform.c
@@ -48,7 +48,7 @@ HRESULT return_nsform(nsresult nsres, nsIDOMHTMLFormElement *form, IHTMLFormElem
     HRESULT hres;
 
     if (NS_FAILED(nsres)) {
-        ERR("GetForm failed: %08x\n", nsres);
+        ERR("GetForm failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -83,14 +83,14 @@ static HRESULT htmlform_item(HTMLFormElement *This, int i, IDispatch **ret)
 
     nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
     if(NS_FAILED(nsres)) {
-        FIXME("GetElements failed: 0x%08x\n", nsres);
+        FIXME("GetElements failed: 0x%08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMHTMLCollection_Item(elements, i, &item);
     nsIDOMHTMLCollection_Release(elements);
     if(NS_FAILED(nsres)) {
-        FIXME("Item failed: 0x%08x\n", nsres);
+        FIXME("Item failed: 0x%08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -179,7 +179,7 @@ static HRESULT WINAPI HTMLFormElement_put_action(IHTMLFormElement *iface, BSTR v
     nsres = nsIDOMHTMLFormElement_SetAction(This->nsform, &action_str);
     nsAString_Finish(&action_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetAction failed: %08x\n", nsres);
+        ERR("SetAction failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -202,7 +202,7 @@ static HRESULT WINAPI HTMLFormElement_get_action(IHTMLFormElement *iface, BSTR *
         nsAString_GetData(&action_str, &action);
         hres = nsuri_to_url(action, FALSE, p);
     }else {
-        ERR("GetAction failed: %08x\n", nsres);
+        ERR("GetAction failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -310,7 +310,7 @@ static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDis
 
     nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
     if(NS_FAILED(nsres)) {
-        ERR("GetElements failed: %08x\n", nsres);
+        ERR("GetElements failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -333,7 +333,7 @@ static HRESULT WINAPI HTMLFormElement_put_target(IHTMLFormElement *iface, BSTR v
 
     nsAString_Finish(&str);
     if (NS_FAILED(nsres)) {
-        ERR("Set Target(%s) failed: %08x\n", wine_dbgstr_w(v), nsres);
+        ERR("Set Target(%s) failed: %08lx\n", wine_dbgstr_w(v), nsres);
         return E_FAIL;
     }
 
@@ -469,7 +469,7 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
         nsAString_Finish(&target_str);
         IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
         if(NS_FAILED(nsres)) {
-            ERR("Submit failed: %08x\n", nsres);
+            ERR("Submit failed: %08lx\n", nsres);
             return E_FAIL;
         }
 
@@ -484,7 +484,7 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
         nsAString_GetData(&action_uri_str, &action_uri);
         hres = create_uri(action_uri, 0, &uri);
     }else {
-        ERR("GetFormData failed: %08x\n", nsres);
+        ERR("GetFormData failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
     nsAString_Finish(&action_uri_str);
@@ -512,7 +512,7 @@ static HRESULT WINAPI HTMLFormElement_reset(IHTMLFormElement *iface)
     TRACE("(%p)->()\n", This);
     nsres = nsIDOMHTMLFormElement_Reset(This->nsform);
     if (NS_FAILED(nsres)) {
-        ERR("Reset failed: %08x\n", nsres);
+        ERR("Reset failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -522,7 +522,7 @@ static HRESULT WINAPI HTMLFormElement_reset(IHTMLFormElement *iface)
 static HRESULT WINAPI HTMLFormElement_put_length(IHTMLFormElement *iface, LONG v)
 {
     HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -535,7 +535,7 @@ static HRESULT WINAPI HTMLFormElement_get_length(IHTMLFormElement *iface, LONG *
 
     nsres = nsIDOMHTMLFormElement_GetLength(This->nsform, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetLength failed: %08x\n", nsres);
+        ERR("GetLength failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -658,17 +658,17 @@ static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface,
     nsresult nsres;
     HRESULT hres = DISP_E_UNKNOWNNAME;
 
-    TRACE("(%p)->(%s %x %p)\n", This, wine_dbgstr_w(name), grfdex, pid);
+    TRACE("(%p)->(%s %lx %p)\n", This, wine_dbgstr_w(name), grfdex, pid);
 
     nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
     if(NS_FAILED(nsres)) {
-        FIXME("GetElements failed: 0x%08x\n", nsres);
+        FIXME("GetElements failed: 0x%08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMHTMLCollection_GetLength(elements, &len);
     if(NS_FAILED(nsres)) {
-        FIXME("GetLength failed: 0x%08x\n", nsres);
+        FIXME("GetLength failed: 0x%08lx\n", nsres);
         nsIDOMHTMLCollection_Release(elements);
         return E_FAIL;
     }
@@ -695,7 +695,7 @@ static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface,
 
         nsres = nsIDOMHTMLCollection_Item(elements, i, &nsitem);
         if(NS_FAILED(nsres)) {
-            FIXME("Item failed: 0x%08x\n", nsres);
+            FIXME("Item failed: 0x%08lx\n", nsres);
             hres = E_FAIL;
             break;
         }
@@ -703,7 +703,7 @@ static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface,
         nsres = nsIDOMNode_QueryInterface(nsitem, &IID_nsIDOMElement, (void**)&elem);
         nsIDOMNode_Release(nsitem);
         if(NS_FAILED(nsres)) {
-            FIXME("Failed to get nsIDOMHTMLNode interface: 0x%08x\n", nsres);
+            FIXME("Failed to get nsIDOMHTMLNode interface: 0x%08lx\n", nsres);
             hres = E_FAIL;
             break;
         }
@@ -711,7 +711,7 @@ static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface,
         /* compare by id attr */
         nsres = nsIDOMElement_GetId(elem, &nsstr);
         if(NS_FAILED(nsres)) {
-            FIXME("GetId failed: 0x%08x\n", nsres);
+            FIXME("GetId failed: 0x%08lx\n", nsres);
             nsIDOMElement_Release(elem);
             hres = E_FAIL;
             break;
@@ -753,7 +753,7 @@ static HRESULT HTMLFormElement_invoke(HTMLDOMNode *iface,
     IDispatch *ret;
     HRESULT hres;
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
 
     hres = htmlform_item(This, id - MSHTML_DISPID_CUSTOM_MIN, &ret);
     if(FAILED(hres))
diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c
index e794284bef6..7a49e60bf8f 100644
--- a/dlls/mshtml/htmlframe.c
+++ b/dlls/mshtml/htmlframe.c
@@ -138,7 +138,7 @@ static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
             nsres = nsIDOMHTMLIFrameElement_SetSrc(This->nsiframe, &nsstr);
         nsAString_Finish(&nsstr);
         if(NS_FAILED(nsres)) {
-            ERR("SetSrc failed: %08x\n", nsres);
+            ERR("SetSrc failed: %08lx\n", nsres);
             return E_FAIL;
         }
 
@@ -189,7 +189,7 @@ static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
         nsres = nsIDOMHTMLIFrameElement_SetName(This->nsiframe, &name_str);
     nsAString_Finish(&name_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetName failed: %08x\n", nsres);
+        ERR("SetName failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -251,7 +251,7 @@ static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR
         nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetFrameBorder failed: %08x\n", nsres);
+        ERR("SetFrameBorder failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -352,7 +352,7 @@ static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIA
             V_BSTR(p) = NULL;
         }
     }else {
-        ERR("GetMarginWidth failed: %08x\n", nsres);
+        ERR("GetMarginWidth failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -419,7 +419,7 @@ static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARI
             V_BSTR(p) = NULL;
         }
     }else {
-        ERR("SetMarginHeight failed: %08x\n", nsres);
+        ERR("SetMarginHeight failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -465,7 +465,7 @@ static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
     nsAString_Finish(&nsstr);
 
     if(NS_FAILED(nsres)) {
-        ERR("SetScrolling failed: 0x%08x\n", nsres);
+        ERR("SetScrolling failed: 0x%08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -493,7 +493,7 @@ static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p
     }
 
     if(NS_FAILED(nsres)) {
-        ERR("GetScrolling failed: 0x%08x\n", nsres);
+        ERR("GetScrolling failed: 0x%08lx\n", nsres);
         nsAString_Finish(&nsstr);
         return E_FAIL;
     }
@@ -965,7 +965,7 @@ static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
 
     nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
     if(NS_FAILED(nsres) || !nsdoc) {
-        ERR("GetContentDocument failed: %08x\n", nsres);
+        ERR("GetContentDocument failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1116,7 +1116,7 @@ static HRESULT WINAPI HTMLIFrameElement_Invoke(IHTMLIFrameElement *iface, DISPID
 static HRESULT WINAPI HTMLIFrameElement_put_vspace(IHTMLIFrameElement *iface, LONG v)
 {
     HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -1130,7 +1130,7 @@ static HRESULT WINAPI HTMLIFrameElement_get_vspace(IHTMLIFrameElement *iface, LO
 static HRESULT WINAPI HTMLIFrameElement_put_hspace(IHTMLIFrameElement *iface, LONG v)
 {
     HTMLIFrame *This = impl_from_IHTMLIFrameElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -1246,7 +1246,7 @@ static HRESULT WINAPI HTMLIFrameElement2_put_height(IHTMLIFrameElement2 *iface,
     nsres = nsIDOMHTMLIFrameElement_SetHeight(This->framebase.nsiframe, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetHeight failed: %08x\n", nsres);
+        ERR("SetHeight failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1284,7 +1284,7 @@ static HRESULT WINAPI HTMLIFrameElement2_put_width(IHTMLIFrameElement2 *iface, V
     nsres = nsIDOMHTMLIFrameElement_SetWidth(This->framebase.nsiframe, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetWidth failed: %08x\n", nsres);
+        ERR("SetWidth failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1544,7 +1544,7 @@ static HRESULT HTMLIFrame_bind_to_tree(HTMLDOMNode *iface)
 
     nsres = nsIDOMHTMLIFrameElement_GetContentDocument(This->framebase.nsiframe, &nsdoc);
     if(NS_FAILED(nsres) || !nsdoc) {
-        ERR("GetContentDocument failed: %08x\n", nsres);
+        ERR("GetContentDocument failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index 96b8d31029f..4483a5ed5ac 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -107,7 +107,7 @@ static HRESULT WINAPI HTMLImgElement_put_isMap(IHTMLImgElement *iface, VARIANT_B
 
     nsres = nsIDOMHTMLImageElement_SetIsMap(This->nsimg, v != VARIANT_FALSE);
     if (NS_FAILED(nsres)) {
-        ERR("Set IsMap failed: %08x\n", nsres);
+        ERR("Set IsMap failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -127,7 +127,7 @@ static HRESULT WINAPI HTMLImgElement_get_isMap(IHTMLImgElement *iface, VARIANT_B
 
     nsres = nsIDOMHTMLImageElement_GetIsMap(This->nsimg, &b);
     if (NS_FAILED(nsres)) {
-        ERR("Get IsMap failed: %08x\n", nsres);
+        ERR("Get IsMap failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -222,7 +222,7 @@ static HRESULT WINAPI HTMLImgElement_get_border(IHTMLImgElement *iface, VARIANT
 static HRESULT WINAPI HTMLImgElement_put_vspace(IHTMLImgElement *iface, LONG v)
 {
     HTMLImg *This = impl_from_IHTMLImgElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -236,7 +236,7 @@ static HRESULT WINAPI HTMLImgElement_get_vspace(IHTMLImgElement *iface, LONG *p)
 static HRESULT WINAPI HTMLImgElement_put_hspace(IHTMLImgElement *iface, LONG v)
 {
     HTMLImg *This = impl_from_IHTMLImgElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -259,7 +259,7 @@ static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
     nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
     nsAString_Finish(&alt_str);
     if(NS_FAILED(nsres))
-        ERR("SetAlt failed: %08x\n", nsres);
+        ERR("SetAlt failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -289,7 +289,7 @@ static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
     nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
     nsAString_Finish(&src_str);
     if(NS_FAILED(nsres))
-        ERR("SetSrc failed: %08x\n", nsres);
+        ERR("SetSrc failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -318,7 +318,7 @@ static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
             hres = nsuri_to_url(src, TRUE, p);
         }
     }else {
-        ERR("GetSrc failed: %08x\n", nsres);
+        ERR("GetSrc failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -385,7 +385,7 @@ static HRESULT WINAPI HTMLImgElement_get_complete(IHTMLImgElement *iface, VARIAN
 
     nsres = nsIDOMHTMLImageElement_GetComplete(This->nsimg, &complete);
     if(NS_FAILED(nsres)) {
-        ERR("GetComplete failed: %08x\n", nsres);
+        ERR("GetComplete failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -420,7 +420,7 @@ static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v)
     nsres = nsIDOMHTMLImageElement_SetAlign(This->nsimg, &str);
     nsAString_Finish(&str);
     if (NS_FAILED(nsres)){
-        ERR("Set Align(%s) failed: %08x\n", debugstr_w(v), nsres);
+        ERR("Set Align(%s) failed: %08lx\n", debugstr_w(v), nsres);
         return E_FAIL;
     }
 
@@ -520,11 +520,11 @@ static HRESULT WINAPI HTMLImgElement_put_width(IHTMLImgElement *iface, LONG v)
     HTMLImg *This = impl_from_IHTMLImgElement(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     nsres = nsIDOMHTMLImageElement_SetWidth(This->nsimg, v);
     if(NS_FAILED(nsres)) {
-        ERR("SetWidth failed: %08x\n", nsres);
+        ERR("SetWidth failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -541,7 +541,7 @@ static HRESULT WINAPI HTMLImgElement_get_width(IHTMLImgElement *iface, LONG *p)
 
     nsres = nsIDOMHTMLImageElement_GetWidth(This->nsimg, &width);
     if(NS_FAILED(nsres)) {
-        ERR("GetWidth failed: %08x\n", nsres);
+        ERR("GetWidth failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -554,11 +554,11 @@ static HRESULT WINAPI HTMLImgElement_put_height(IHTMLImgElement *iface, LONG v)
     HTMLImg *This = impl_from_IHTMLImgElement(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     nsres = nsIDOMHTMLImageElement_SetHeight(This->nsimg, v);
     if(NS_FAILED(nsres)) {
-        ERR("SetHeight failed: %08x\n", nsres);
+        ERR("SetHeight failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -575,7 +575,7 @@ static HRESULT WINAPI HTMLImgElement_get_height(IHTMLImgElement *iface, LONG *p)
 
     nsres = nsIDOMHTMLImageElement_GetHeight(This->nsimg, &height);
     if(NS_FAILED(nsres)) {
-        ERR("GetHeight failed: %08x\n", nsres);
+        ERR("GetHeight failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -791,7 +791,7 @@ static ULONG WINAPI HTMLImageElementFactory_AddRef(IHTMLImageElementFactory *ifa
     HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -801,7 +801,7 @@ static ULONG WINAPI HTMLImageElementFactory_Release(IHTMLImageElementFactory *if
     HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -854,7 +854,7 @@ static LONG var_to_size(const VARIANT *v)
 
         hres = VarI4FromStr(V_BSTR(v), 0, 0, &ret);
         if(FAILED(hres)) {
-            FIXME("VarI4FromStr failed: %08x\n", hres);
+            FIXME("VarI4FromStr failed: %08lx\n", hres);
             return 0;
         }
         return ret;
@@ -903,7 +903,7 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
             (void**)&img);
     IHTMLElement_Release(&elem->IHTMLElement_iface);
     if(FAILED(hres)) {
-        ERR("IHTMLElement_QueryInterface failed: 0x%08x\n", hres);
+        ERR("IHTMLElement_QueryInterface failed: 0x%08lx\n", hres);
         return hres;
     }
 
diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c
index c0f6db8dd3b..757a85e4290 100644
--- a/dlls/mshtml/htmlinput.c
+++ b/dlls/mshtml/htmlinput.c
@@ -127,7 +127,7 @@ static HRESULT WINAPI HTMLInputElement_put_type(IHTMLInputElement *iface, BSTR v
     nsres = nsIDOMHTMLInputElement_SetType(This->nsinput, &type_str);
     nsAString_Finish(&type_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetType failed: %08x\n", nsres);
+        ERR("SetType failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -159,7 +159,7 @@ static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR
     nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
     nsAString_Finish(&val_str);
     if(NS_FAILED(nsres))
-        ERR("SetValue failed: %08x\n", nsres);
+        ERR("SetValue failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -189,7 +189,7 @@ static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v
     nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
     nsAString_Finish(&name_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetName failed: %08x\n", nsres);
+        ERR("SetName failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -232,7 +232,7 @@ static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VA
 
     nsres = nsIDOMHTMLInputElement_SetDisabled(This->nsinput, v != VARIANT_FALSE);
     if(NS_FAILED(nsres))
-        ERR("SetDisabled failed: %08x\n", nsres);
+        ERR("SetDisabled failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -268,13 +268,13 @@ static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v
     UINT32 val = v;
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
     if (v <= 0)
         return CTL_E_INVALIDPROPERTYVALUE;
 
     nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
     if (NS_FAILED(nsres)) {
-        ERR("Set Size(%u) failed: %08x\n", val, nsres);
+        ERR("Set Size(%u) failed: %08lx\n", val, nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -292,7 +292,7 @@ static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *
 
     nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
     if (NS_FAILED(nsres)) {
-        ERR("Get Size failed: %08x\n", nsres);
+        ERR("Get Size failed: %08lx\n", nsres);
         return E_FAIL;
     }
     *p = val;
@@ -304,7 +304,7 @@ static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, L
     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     nsres = nsIDOMHTMLInputElement_SetMaxLength(This->nsinput, v);
     if(NS_FAILED(nsres)) {
@@ -341,7 +341,7 @@ static HRESULT WINAPI HTMLInputElement_select(IHTMLInputElement *iface)
 
     nsres = nsIDOMHTMLInputElement_Select(This->nsinput);
     if(NS_FAILED(nsres)) {
-        ERR("Select failed: %08x\n", nsres);
+        ERR("Select failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -392,7 +392,7 @@ static HRESULT WINAPI HTMLInputElement_put_defaultValue(IHTMLInputElement *iface
     nsres = nsIDOMHTMLInputElement_SetDefaultValue(This->nsinput, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetValue failed: %08x\n", nsres);
+        ERR("SetValue failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -421,7 +421,7 @@ static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VA
 
     nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE);
     if (NS_FAILED(nsres)) {
-        ERR("Set ReadOnly Failed: %08x\n", nsres);
+        ERR("Set ReadOnly Failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -437,7 +437,7 @@ static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VA
 
     nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b);
     if (NS_FAILED(nsres)) {
-        ERR("Get ReadOnly Failed: %08x\n", nsres);
+        ERR("Get ReadOnly Failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -475,7 +475,7 @@ static HRESULT WINAPI HTMLInputElement_put_defaultChecked(IHTMLInputElement *ifa
 
     nsres = nsIDOMHTMLInputElement_SetDefaultChecked(This->nsinput, v != VARIANT_FALSE);
     if(NS_FAILED(nsres)) {
-        ERR("SetDefaultChecked failed: %08x\n", nsres);
+        ERR("SetDefaultChecked failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -492,7 +492,7 @@ static HRESULT WINAPI HTMLInputElement_get_defaultChecked(IHTMLInputElement *ifa
 
     nsres = nsIDOMHTMLInputElement_GetDefaultChecked(This->nsinput, &default_checked);
     if(NS_FAILED(nsres)) {
-        ERR("GetDefaultChecked failed: %08x\n", nsres);
+        ERR("GetDefaultChecked failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -509,7 +509,7 @@ static HRESULT WINAPI HTMLInputElement_put_checked(IHTMLInputElement *iface, VAR
 
     nsres = nsIDOMHTMLInputElement_SetChecked(This->nsinput, v != VARIANT_FALSE);
     if(NS_FAILED(nsres)) {
-        ERR("SetChecked failed: %08x\n", nsres);
+        ERR("SetChecked failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -526,7 +526,7 @@ static HRESULT WINAPI HTMLInputElement_get_checked(IHTMLInputElement *iface, VAR
 
     nsres = nsIDOMHTMLInputElement_GetChecked(This->nsinput, &checked);
     if(NS_FAILED(nsres)) {
-        ERR("GetChecked failed: %08x\n", nsres);
+        ERR("GetChecked failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -552,7 +552,7 @@ static HRESULT WINAPI HTMLInputElement_get_border(IHTMLInputElement *iface, VARI
 static HRESULT WINAPI HTMLInputElement_put_vspace(IHTMLInputElement *iface, LONG v)
 {
     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -566,7 +566,7 @@ static HRESULT WINAPI HTMLInputElement_get_vspace(IHTMLInputElement *iface, LONG
 static HRESULT WINAPI HTMLInputElement_put_hspace(IHTMLInputElement *iface, LONG v)
 {
     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -603,7 +603,7 @@ static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
     nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres))
-        ERR("SetSrc failed: %08x\n", nsres);
+        ERR("SetSrc failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -621,7 +621,7 @@ static HRESULT WINAPI HTMLInputElement_get_src(IHTMLInputElement *iface, BSTR *p
     nsAString_Init(&src_str, NULL);
     nsres = nsIDOMHTMLInputElement_GetSrc(This->nsinput, &src_str);
     if(NS_FAILED(nsres)) {
-        ERR("GetSrc failed: %08x\n", nsres);
+        ERR("GetSrc failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -761,7 +761,7 @@ static HRESULT WINAPI HTMLInputElement_get_onabort(IHTMLInputElement *iface, VAR
 static HRESULT WINAPI HTMLInputElement_put_width(IHTMLInputElement *iface, LONG v)
 {
     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -775,7 +775,7 @@ static HRESULT WINAPI HTMLInputElement_get_width(IHTMLInputElement *iface, LONG
 static HRESULT WINAPI HTMLInputElement_put_height(IHTMLInputElement *iface, LONG v)
 {
     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -1036,7 +1036,7 @@ static HRESULT WINAPI HTMLInputTextElement_put_size(IHTMLInputTextElement *iface
 {
     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     return IHTMLInputElement_put_size(&This->IHTMLInputElement_iface, v);
 }
@@ -1054,7 +1054,7 @@ static HRESULT WINAPI HTMLInputTextElement_put_maxLength(IHTMLInputTextElement *
 {
     HTMLInputElement *This = impl_from_IHTMLInputTextElement(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     return IHTMLInputElement_put_maxLength(&This->IHTMLInputElement_iface, v);
 }
@@ -1232,11 +1232,11 @@ static HRESULT WINAPI HTMLInputTextElement2_put_selectionStart(IHTMLInputTextEle
     HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     nsres = nsIDOMHTMLInputElement_SetSelectionStart(This->nsinput, v);
     if(NS_FAILED(nsres)) {
-        ERR("SetSelectionStart failed: %08x\n", nsres);
+        ERR("SetSelectionStart failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -1252,7 +1252,7 @@ static HRESULT WINAPI HTMLInputTextElement2_get_selectionStart(IHTMLInputTextEle
 
     nsres = nsIDOMHTMLInputElement_GetSelectionStart(This->nsinput, &selection_start);
     if(NS_FAILED(nsres)) {
-        ERR("GetSelectionStart failed: %08x\n", nsres);
+        ERR("GetSelectionStart failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1265,11 +1265,11 @@ static HRESULT WINAPI HTMLInputTextElement2_put_selectionEnd(IHTMLInputTextEleme
     HTMLInputElement *This = impl_from_IHTMLInputTextElement2(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     nsres = nsIDOMHTMLInputElement_SetSelectionEnd(This->nsinput, v);
     if(NS_FAILED(nsres)) {
-        ERR("SetSelectionEnd failed: %08x\n", nsres);
+        ERR("SetSelectionEnd failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -1285,7 +1285,7 @@ static HRESULT WINAPI HTMLInputTextElement2_get_selectionEnd(IHTMLInputTextEleme
 
     nsres = nsIDOMHTMLInputElement_GetSelectionEnd(This->nsinput, &selection_end);
     if(NS_FAILED(nsres)) {
-        ERR("GetSelectionEnd failed: %08x\n", nsres);
+        ERR("GetSelectionEnd failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1299,13 +1299,13 @@ static HRESULT WINAPI HTMLInputTextElement2_setSelectionRange(IHTMLInputTextElem
     nsAString none_str;
     nsresult nsres;
 
-    TRACE("(%p)->(%d %d)\n", This, start, end);
+    TRACE("(%p)->(%ld %ld)\n", This, start, end);
 
     nsAString_InitDepend(&none_str, L"none");
     nsres = nsIDOMHTMLInputElement_SetSelectionRange(This->nsinput, start, end, &none_str);
     nsAString_Finish(&none_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetSelectionRange failed: %08x\n", nsres);
+        ERR("SetSelectionRange failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -1552,7 +1552,7 @@ static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BST
     nsAString_Finish(&for_str);
     nsAString_Finish(&val_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetAttribute failed: %08x\n", nsres);
+        ERR("SetAttribute failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1755,7 +1755,7 @@ static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BST
     nsres = nsIDOMHTMLButtonElement_SetValue(This->nsbutton, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetValue failed: %08x\n", nsres);
+        ERR("SetValue failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1787,7 +1787,7 @@ static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR
     nsres = nsIDOMHTMLButtonElement_SetName(This->nsbutton, &name_str);
     nsAString_Finish(&name_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetName failed: %08x\n", nsres);
+        ERR("SetName failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1830,7 +1830,7 @@ static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface,
 
     nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
     if(NS_FAILED(nsres)) {
-        ERR("SetDisabled failed: %08x\n", nsres);
+        ERR("SetDisabled failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1847,7 +1847,7 @@ static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface,
 
     nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
     if(NS_FAILED(nsres)) {
-        ERR("GetDisabled failed: %08x\n", nsres);
+        ERR("GetDisabled failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
diff --git a/dlls/mshtml/htmllink.c b/dlls/mshtml/htmllink.c
index 1dd48737eb4..f4f5e2eb943 100644
--- a/dlls/mshtml/htmllink.c
+++ b/dlls/mshtml/htmllink.c
@@ -170,7 +170,7 @@ static HRESULT WINAPI HTMLLinkElement_put_rev(IHTMLLinkElement *iface, BSTR v)
     nsres = nsIDOMHTMLLinkElement_SetRev(This->nslink, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetRev failed: %08x\n", nsres);
+        ERR("SetRev failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -319,7 +319,7 @@ static HRESULT WINAPI HTMLLinkElement_put_media(IHTMLLinkElement *iface, BSTR v)
     nsAString_Finish(&str);
 
     if(NS_FAILED(nsres)) {
-        ERR("Set Media(%s) failed: %08x\n", debugstr_w(v), nsres);
+        ERR("Set Media(%s) failed: %08lx\n", debugstr_w(v), nsres);
         return E_FAIL;
     }
     return S_OK;
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index 85dfc40b5d7..8f7800ff2a3 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -64,7 +64,7 @@ static HRESULT get_url_components(HTMLLocation *This, URL_COMPONENTSW *url)
         return hres;
 
     if(!InternetCrackUrlW(doc_url, 0, 0, url)) {
-        FIXME("InternetCrackUrlW failed: 0x%08x\n", GetLastError());
+        FIXME("InternetCrackUrlW failed: 0x%08lx\n", GetLastError());
         SetLastError(0);
         return E_FAIL;
     }
@@ -108,7 +108,7 @@ static ULONG WINAPI HTMLLocation_AddRef(IHTMLLocation *iface)
     HTMLLocation *This = impl_from_IHTMLLocation(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -118,7 +118,7 @@ static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface)
     HTMLLocation *This = impl_from_IHTMLLocation(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->window)
@@ -240,7 +240,7 @@ static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
     }
 
     if(GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-        FIXME("InternetCreateUrl failed with error: %08x\n", GetLastError());
+        FIXME("InternetCreateUrl failed with error: %08lx\n", GetLastError());
         SetLastError(0);
         ret = E_FAIL;
         goto cleanup;
@@ -254,7 +254,7 @@ static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
     }
 
     if(!InternetCreateUrlW(&url, ICU_ESCAPE, buf, &len)) {
-        FIXME("InternetCreateUrl failed with error: %08x\n", GetLastError());
+        FIXME("InternetCreateUrl failed with error: %08lx\n", GetLastError());
         SetLastError(0);
         ret = E_FAIL;
         goto cleanup;
diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c
index 9918174fa41..13f178fc33b 100644
--- a/dlls/mshtml/htmlnode.c
+++ b/dlls/mshtml/htmlnode.c
@@ -85,7 +85,7 @@ static ULONG WINAPI HTMLDOMChildrenCollectionEnum_AddRef(IEnumVARIANT *iface)
     HTMLDOMChildrenCollectionEnum *This = impl_from_IEnumVARIANT(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -95,7 +95,7 @@ static ULONG WINAPI HTMLDOMChildrenCollectionEnum_Release(IEnumVARIANT *iface)
     HTMLDOMChildrenCollectionEnum *This = impl_from_IEnumVARIANT(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         IHTMLDOMChildrenCollection_Release(&This->col->IHTMLDOMChildrenCollection_iface);
@@ -124,7 +124,7 @@ static HRESULT WINAPI HTMLDOMChildrenCollectionEnum_Next(IEnumVARIANT *iface, UL
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %p %p)\n", This, celt, rgVar, pCeltFetched);
+    TRACE("(%p)->(%ld %p %p)\n", This, celt, rgVar, pCeltFetched);
 
     len = get_enum_len(This);
 
@@ -135,7 +135,7 @@ static HRESULT WINAPI HTMLDOMChildrenCollectionEnum_Next(IEnumVARIANT *iface, UL
         hres = get_node(nsnode, TRUE, &node);
         nsIDOMNode_Release(nsnode);
         if(FAILED(hres)) {
-            ERR("get_node failed: %08x\n", hres);
+            ERR("get_node failed: %08lx\n", hres);
             break;
         }
 
@@ -156,7 +156,7 @@ static HRESULT WINAPI HTMLDOMChildrenCollectionEnum_Skip(IEnumVARIANT *iface, UL
     HTMLDOMChildrenCollectionEnum *This = impl_from_IEnumVARIANT(iface);
     ULONG len;
 
-    TRACE("(%p)->(%d)\n", This, celt);
+    TRACE("(%p)->(%ld)\n", This, celt);
 
     len = get_enum_len(This);
     if(This->iter + celt > len) {
@@ -227,7 +227,7 @@ static ULONG WINAPI HTMLDOMChildrenCollection_AddRef(IHTMLDOMChildrenCollection
     HTMLDOMChildrenCollection *This = impl_from_IHTMLDOMChildrenCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -237,7 +237,7 @@ static ULONG WINAPI HTMLDOMChildrenCollection_Release(IHTMLDOMChildrenCollection
     HTMLDOMChildrenCollection *This = impl_from_IHTMLDOMChildrenCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         nsIDOMNodeList_Release(This->nslist);
@@ -320,7 +320,7 @@ static HRESULT WINAPI HTMLDOMChildrenCollection_item(IHTMLDOMChildrenCollection
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %p)\n", This, index, ppItem);
+    TRACE("(%p)->(%ld %p)\n", This, index, ppItem);
 
     if (ppItem)
         *ppItem = NULL;
@@ -333,7 +333,7 @@ static HRESULT WINAPI HTMLDOMChildrenCollection_item(IHTMLDOMChildrenCollection
 
     nsres = nsIDOMNodeList_Item(This->nslist, index, &nsnode);
     if(NS_FAILED(nsres) || !nsnode) {
-        ERR("Item failed: %08x\n", nsres);
+        ERR("Item failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -382,7 +382,7 @@ static HRESULT HTMLDOMChildrenCollection_get_dispid(DispatchEx *dispex, BSTR nam
         return DISP_E_UNKNOWNNAME;
 
     *dispid = DISPID_CHILDCOL_0 + idx;
-    TRACE("ret %x\n", *dispid);
+    TRACE("ret %lx\n", *dispid);
     return S_OK;
 }
 
@@ -391,7 +391,7 @@ static HRESULT HTMLDOMChildrenCollection_invoke(DispatchEx *dispex, DISPID id, L
 {
     HTMLDOMChildrenCollection *This = impl_from_DispatchEx(dispex);
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
 
     switch(flags) {
     case DISPATCH_PROPERTYGET: {
@@ -476,7 +476,7 @@ static ULONG WINAPI HTMLDOMNode_AddRef(IHTMLDOMNode *iface)
 
     ref = ccref_incr(&This->ccref, (nsISupports*)&This->IHTMLDOMNode_iface);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -486,7 +486,7 @@ static ULONG WINAPI HTMLDOMNode_Release(IHTMLDOMNode *iface)
     HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface);
     LONG ref = ccref_decr(&This->ccref, (nsISupports*)&This->IHTMLDOMNode_iface, /*&node_ccp*/ NULL);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -573,7 +573,7 @@ static HRESULT WINAPI HTMLDOMNode_get_parentNode(IHTMLDOMNode *iface, IHTMLDOMNo
 
     nsres = nsIDOMNode_GetParentNode(This->nsnode, &nsnode);
     if(NS_FAILED(nsres)) {
-        ERR("GetParentNode failed: %08x\n", nsres);
+        ERR("GetParentNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -601,7 +601,7 @@ static HRESULT WINAPI HTMLDOMNode_hasChildNodes(IHTMLDOMNode *iface, VARIANT_BOO
 
     nsres = nsIDOMNode_HasChildNodes(This->nsnode, &has_child);
     if(NS_FAILED(nsres))
-        ERR("HasChildNodes failed: %08x\n", nsres);
+        ERR("HasChildNodes failed: %08lx\n", nsres);
 
     *fChildren = variant_bool(has_child);
     return S_OK;
@@ -617,7 +617,7 @@ static HRESULT WINAPI HTMLDOMNode_get_childNodes(IHTMLDOMNode *iface, IDispatch
 
     hres = map_nsresult(nsIDOMNode_GetChildNodes(This->nsnode, &nslist));
     if(FAILED(hres)) {
-        ERR("GetChildNodes failed: %08x\n", hres);
+        ERR("GetChildNodes failed: %08lx\n", hres);
         return hres;
     }
 
@@ -695,7 +695,7 @@ static HRESULT WINAPI HTMLDOMNode_insertBefore(IHTMLDOMNode *iface, IHTMLDOMNode
     if(SUCCEEDED(hres)) {
         nsres = nsIDOMNode_InsertBefore(This->nsnode, new_child->nsnode, ref_node ? ref_node->nsnode : NULL, &nsnode);
         if(NS_FAILED(nsres)) {
-            ERR("InsertBefore failed: %08x\n", nsres);
+            ERR("InsertBefore failed: %08lx\n", nsres);
             hres = E_FAIL;
         }
     }
@@ -732,7 +732,7 @@ static HRESULT WINAPI HTMLDOMNode_removeChild(IHTMLDOMNode *iface, IHTMLDOMNode
     nsres = nsIDOMNode_RemoveChild(This->nsnode, node_obj->nsnode, &nsnode);
     node_release(node_obj);
     if(NS_FAILED(nsres)) {
-        ERR("RemoveChild failed: %08x\n", nsres);
+        ERR("RemoveChild failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -795,7 +795,7 @@ static HRESULT WINAPI HTMLDOMNode_cloneNode(IHTMLDOMNode *iface, VARIANT_BOOL fD
 
     nsres = nsIDOMNode_CloneNode(This->nsnode, fDeep != VARIANT_FALSE, 1, &nsnode);
     if(NS_FAILED(nsres) || !nsnode) {
-        ERR("CloneNode failed: %08x\n", nsres);
+        ERR("CloneNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -850,7 +850,7 @@ static HRESULT WINAPI HTMLDOMNode_appendChild(IHTMLDOMNode *iface, IHTMLDOMNode
     nsres = nsIDOMNode_AppendChild(This->nsnode, node_obj->nsnode, &nsnode);
     node_release(node_obj);
     if(NS_FAILED(nsres)) {
-        ERR("AppendChild failed: %08x\n", nsres);
+        ERR("AppendChild failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1250,7 +1250,7 @@ static HRESULT WINAPI HTMLDOMNode3_put_textContent(IHTMLDOMNode3 *iface, VARIANT
     nsres = nsIDOMNode_SetTextContent(This->nsnode, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetTextContent failed: %08x\n", nsres);
+        ERR("SetTextContent failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1349,7 +1349,7 @@ static HRESULT WINAPI HTMLDOMNode3_compareDocumentPosition(IHTMLDOMNode3 *iface,
     nsres = nsIDOMNode_CompareDocumentPosition(This->nsnode, other->nsnode, &position);
     IHTMLDOMNode_Release(&other->IHTMLDOMNode_iface);
     if(NS_FAILED(nsres)) {
-        ERR("failed: %08x\n", nsres);
+        ERR("failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1634,7 +1634,7 @@ HRESULT get_node(nsIDOMNode *nsnode, BOOL create, HTMLDOMNode **ret)
 
     nsres = nsIDOMNode_GetOwnerDocument(nsnode, &dom_document);
     if(NS_FAILED(nsres) || !dom_document) {
-        ERR("GetOwnerDocument failed: %08x\n", nsres);
+        ERR("GetOwnerDocument failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c
index 9c8af177ecc..787dd3762ee 100644
--- a/dlls/mshtml/htmlobject.c
+++ b/dlls/mshtml/htmlobject.c
@@ -278,7 +278,7 @@ static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VAR
     nsres = nsIDOMHTMLObjectElement_SetWidth(This->nsobject, &width_str);
     nsAString_Finish(&width_str);
     if(NS_FAILED(nsres)) {
-        FIXME("SetWidth failed: %08x\n", nsres);
+        FIXME("SetWidth failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -305,7 +305,7 @@ static HRESULT WINAPI HTMLObjectElement_get_width(IHTMLObjectElement *iface, VAR
         V_BSTR(p) = SysAllocString(width);
         hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
     }else {
-        ERR("GetWidth failed: %08x\n", nsres);
+        ERR("GetWidth failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -336,7 +336,7 @@ static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VA
     nsres = nsIDOMHTMLObjectElement_SetHeight(This->nsobject, &height_str);
     nsAString_Finish(&height_str);
     if(NS_FAILED(nsres)) {
-        FIXME("SetHeight failed: %08x\n", nsres);
+        FIXME("SetHeight failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -363,7 +363,7 @@ static HRESULT WINAPI HTMLObjectElement_get_height(IHTMLObjectElement *iface, VA
         V_BSTR(p) = SysAllocString(height);
         hres = V_BSTR(p) ? S_OK : E_OUTOFMEMORY;
     }else {
-        ERR("GetHeight failed: %08x\n", nsres);
+        ERR("GetHeight failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
 
@@ -423,7 +423,7 @@ static HRESULT WINAPI HTMLObjectElement_get_altHtml(IHTMLObjectElement *iface, B
 static HRESULT WINAPI HTMLObjectElement_put_vspace(IHTMLObjectElement *iface, LONG v)
 {
     HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -436,7 +436,7 @@ static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LO
 
     nsres = nsIDOMHTMLObjectElement_GetVspace(This->nsobject, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetVspace failed: %08x\n", nsres);
+        ERR("GetVspace failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -446,7 +446,7 @@ static HRESULT WINAPI HTMLObjectElement_get_vspace(IHTMLObjectElement *iface, LO
 static HRESULT WINAPI HTMLObjectElement_put_hspace(IHTMLObjectElement *iface, LONG v)
 {
     HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -704,7 +704,7 @@ static HRESULT HTMLObjectElement_get_dispid(HTMLDOMNode *iface, BSTR name,
 {
     HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
 
-    TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(name), grfdex, pid);
+    TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(name), grfdex, pid);
 
     return get_plugin_dispid(&This->plugin_container, name, pid);
 }
@@ -714,7 +714,7 @@ static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid
 {
     HTMLObjectElement *This = impl_from_HTMLDOMNode(iface);
 
-    TRACE("(%p)->(%d)\n", This, id);
+    TRACE("(%p)->(%ld)\n", This, id);
 
     return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei);
 }
diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c
index 9f3a0b21bb9..f28a9d3a29d 100644
--- a/dlls/mshtml/htmlscript.c
+++ b/dlls/mshtml/htmlscript.c
@@ -105,7 +105,7 @@ static HRESULT WINAPI HTMLScriptElement_put_src(IHTMLScriptElement *iface, BSTR
     nsres = nsIDOMHTMLScriptElement_SetSrc(This->nsscript, &src_str);
     nsAString_Finish(&src_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetSrc failed: %08x\n", nsres);
+        ERR("SetSrc failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -126,7 +126,7 @@ static HRESULT WINAPI HTMLScriptElement_put_src(IHTMLScriptElement *iface, BSTR
         nsAString_GetData(&src_str, &src);
         hres = load_script(This, src, TRUE);
     }else {
-        ERR("SetSrc failed: %08x\n", nsres);
+        ERR("SetSrc failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
     nsAString_Finish(&src_str);
@@ -201,7 +201,7 @@ static HRESULT WINAPI HTMLScriptElement_put_text(IHTMLScriptElement *iface, BSTR
     nsres = nsIDOMHTMLScriptElement_SetText(This->nsscript, &text_str);
     nsAString_Finish(&text_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetSrc failed: %08x\n", nsres);
+        ERR("SetSrc failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -260,7 +260,7 @@ static HRESULT WINAPI HTMLScriptElement_get_defer(IHTMLScriptElement *iface, VAR
 
     nsres = nsIDOMHTMLScriptElement_GetDefer(This->nsscript, &defer);
     if(NS_FAILED(nsres)) {
-        ERR("GetSrc failed: %08x\n", nsres);
+        ERR("GetSrc failed: %08lx\n", nsres);
     }
 
     *p = variant_bool(defer);
@@ -305,7 +305,7 @@ static HRESULT WINAPI HTMLScriptElement_put_type(IHTMLScriptElement *iface, BSTR
     nsAString_Init(&nstype_str, v);
     nsres = nsIDOMHTMLScriptElement_SetType(This->nsscript, &nstype_str);
     if (NS_FAILED(nsres))
-        ERR("SetType failed: %08x\n", nsres);
+        ERR("SetType failed: %08lx\n", nsres);
     nsAString_Finish (&nstype_str);
 
     return S_OK;
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index 9400ee043b6..44981a51d3c 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -108,7 +108,7 @@ static HRESULT WINAPI HTMLOptionElement_put_selected(IHTMLOptionElement *iface,
 
     nsres = nsIDOMHTMLOptionElement_SetSelected(This->nsoption, v != VARIANT_FALSE);
     if(NS_FAILED(nsres)) {
-        ERR("SetSelected failed: %08x\n", nsres);
+        ERR("SetSelected failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -125,7 +125,7 @@ static HRESULT WINAPI HTMLOptionElement_get_selected(IHTMLOptionElement *iface,
 
     nsres = nsIDOMHTMLOptionElement_GetSelected(This->nsoption, &selected);
     if(NS_FAILED(nsres)) {
-        ERR("GetSelected failed: %08x\n", nsres);
+        ERR("GetSelected failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -145,7 +145,7 @@ static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BST
     nsres = nsIDOMHTMLOptionElement_SetValue(This->nsoption, &value_str);
     nsAString_Finish(&value_str);
     if(NS_FAILED(nsres))
-        ERR("SetValue failed: %08x\n", nsres);
+        ERR("SetValue failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -175,20 +175,20 @@ static HRESULT WINAPI HTMLOptionElement_put_defaultSelected(IHTMLOptionElement *
 
     nsres = nsIDOMHTMLOptionElement_GetSelected(This->nsoption, &selected);
     if(NS_FAILED(nsres)) {
-        ERR("GetSelected failed: %08x\n", nsres);
+        ERR("GetSelected failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMHTMLOptionElement_SetDefaultSelected(This->nsoption, val);
     if(NS_FAILED(nsres)) {
-        ERR("SetDefaultSelected failed: %08x\n", nsres);
+        ERR("SetDefaultSelected failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     if(val != selected) {
         nsres = nsIDOMHTMLOptionElement_SetSelected(This->nsoption, selected); /* WinAPI will reserve selected property */
         if(NS_FAILED(nsres)) {
-            ERR("SetSelected failed: %08x\n", nsres);
+            ERR("SetSelected failed: %08lx\n", nsres);
             return E_FAIL;
         }
     }
@@ -207,7 +207,7 @@ static HRESULT WINAPI HTMLOptionElement_get_defaultSelected(IHTMLOptionElement *
         return E_POINTER;
     nsres = nsIDOMHTMLOptionElement_GetDefaultSelected(This->nsoption, &val);
     if(NS_FAILED(nsres)) {
-        ERR("GetDefaultSelected failed: %08x\n", nsres);
+        ERR("GetDefaultSelected failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -218,7 +218,7 @@ static HRESULT WINAPI HTMLOptionElement_get_defaultSelected(IHTMLOptionElement *
 static HRESULT WINAPI HTMLOptionElement_put_index(IHTMLOptionElement *iface, LONG v)
 {
     HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -235,7 +235,7 @@ static HRESULT WINAPI HTMLOptionElement_get_index(IHTMLOptionElement *iface, LON
 
     nsres = nsIDOMHTMLOptionElement_GetIndex(This->nsoption, &val);
     if(NS_FAILED(nsres)) {
-        ERR("GetIndex failed: %08x\n", nsres);
+        ERR("GetIndex failed: %08lx\n", nsres);
         return E_FAIL;
     }
     *p = val;
@@ -269,7 +269,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
         if(NS_SUCCEEDED(nsres)) {
             nsIDOMNode_Release(tmp);
         }else {
-            ERR("RemoveChild failed: %08x\n", nsres);
+            ERR("RemoveChild failed: %08lx\n", nsres);
             break;
         }
     }
@@ -278,7 +278,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
     nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
     nsAString_Finish(&text_str);
     if(NS_FAILED(nsres)) {
-        ERR("CreateTextNode failed: %08x\n", nsres);
+        ERR("CreateTextNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -286,7 +286,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
     if(NS_SUCCEEDED(nsres))
         nsIDOMNode_Release(tmp);
     else
-        ERR("AppendChild failed: %08x\n", nsres);
+        ERR("AppendChild failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -479,7 +479,7 @@ static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *i
     HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -489,7 +489,7 @@ static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *
     HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -688,14 +688,14 @@ static HRESULT htmlselect_item(HTMLSelectElement *This, int i, IDispatch **ret)
 
     nsres = nsIDOMHTMLSelectElement_GetOptions(This->nsselect, &nscol);
     if(NS_FAILED(nsres)) {
-        ERR("GetOptions failed: %08x\n", nsres);
+        ERR("GetOptions failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMHTMLOptionsCollection_Item(nscol, i, &nsnode);
     nsIDOMHTMLOptionsCollection_Release(nscol);
     if(NS_FAILED(nsres)) {
-        ERR("Item failed: %08x\n", nsres);
+        ERR("Item failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -777,13 +777,13 @@ static HRESULT WINAPI HTMLSelectElement_put_size(IHTMLSelectElement *iface, LONG
     HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
     if(v < 0)
         return CTL_E_INVALIDPROPERTYVALUE;
 
     nsres = nsIDOMHTMLSelectElement_SetSize(This->nsselect, v);
     if(NS_FAILED(nsres)) {
-        ERR("SetSize failed: %08x\n", nsres);
+        ERR("SetSize failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -801,7 +801,7 @@ static HRESULT WINAPI HTMLSelectElement_get_size(IHTMLSelectElement *iface, LONG
 
     nsres = nsIDOMHTMLSelectElement_GetSize(This->nsselect, &val);
     if(NS_FAILED(nsres)) {
-        ERR("GetSize failed: %08x\n", nsres);
+        ERR("GetSize failed: %08lx\n", nsres);
         return E_FAIL;
     }
     *p = val;
@@ -847,7 +847,7 @@ static HRESULT WINAPI HTMLSelectElement_put_name(IHTMLSelectElement *iface, BSTR
     nsAString_Finish(&str);
 
     if(NS_FAILED(nsres)) {
-        ERR("SetName failed: %08x\n", nsres);
+        ERR("SetName failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -899,11 +899,11 @@ static HRESULT WINAPI HTMLSelectElement_put_selectedIndex(IHTMLSelectElement *if
     HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     nsres = nsIDOMHTMLSelectElement_SetSelectedIndex(This->nsselect, v);
     if(NS_FAILED(nsres))
-        ERR("SetSelectedIndex failed: %08x\n", nsres);
+        ERR("SetSelectedIndex failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -917,7 +917,7 @@ static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *if
 
     nsres = nsIDOMHTMLSelectElement_GetSelectedIndex(This->nsselect, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetSelectedIndex failed: %08x\n", nsres);
+        ERR("GetSelectedIndex failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -949,7 +949,7 @@ static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BST
     nsres = nsIDOMHTMLSelectElement_SetValue(This->nsselect, &value_str);
     nsAString_Finish(&value_str);
     if(NS_FAILED(nsres))
-        ERR("SetValue failed: %08x\n", nsres);
+        ERR("SetValue failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -976,7 +976,7 @@ static HRESULT WINAPI HTMLSelectElement_put_disabled(IHTMLSelectElement *iface,
 
     nsres = nsIDOMHTMLSelectElement_SetDisabled(This->nsselect, v != VARIANT_FALSE);
     if(NS_FAILED(nsres)) {
-        ERR("SetDisabled failed: %08x\n", nsres);
+        ERR("SetDisabled failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -993,7 +993,7 @@ static HRESULT WINAPI HTMLSelectElement_get_disabled(IHTMLSelectElement *iface,
 
     nsres = nsIDOMHTMLSelectElement_GetDisabled(This->nsselect, &disabled);
     if(NS_FAILED(nsres)) {
-        ERR("GetDisabled failed: %08x\n", nsres);
+        ERR("GetDisabled failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1059,7 +1059,7 @@ static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElem
         nsres = nsIDOMHTMLSelectElement_Add(This->nsselect, element_obj->html_element, (nsIVariant*)nsvariant);
     nsIWritableVariant_Release(nsvariant);
     if(NS_FAILED(nsres)) {
-        ERR("Add failed: %08x\n", nsres);
+        ERR("Add failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1070,13 +1070,13 @@ static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, LONG i
 {
     HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
     nsresult nsres;
-    TRACE("(%p)->(%d)\n", This, index);
+    TRACE("(%p)->(%ld)\n", This, index);
     if(index < 0)
         return E_INVALIDARG;
 
     nsres = nsIDOMHTMLSelectElement_select_Remove(This->nsselect, index);
     if(NS_FAILED(nsres)) {
-        ERR("Remove failed: %08x\n", nsres);
+        ERR("Remove failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -1087,11 +1087,11 @@ static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, LO
     HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     nsres = nsIDOMHTMLSelectElement_SetLength(This->nsselect, v);
     if(NS_FAILED(nsres))
-        ERR("SetLength failed: %08x\n", nsres);
+        ERR("SetLength failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1106,11 +1106,11 @@ static HRESULT WINAPI HTMLSelectElement_get_length(IHTMLSelectElement *iface, LO
 
     nsres = nsIDOMHTMLSelectElement_GetLength(This->nsselect, &length);
     if(NS_FAILED(nsres))
-        ERR("GetLength failed: %08x\n", nsres);
+        ERR("GetLength failed: %08lx\n", nsres);
 
     *p = length;
 
-    TRACE("ret %d\n", *p);
+    TRACE("ret %ld\n", *p);
     return S_OK;
 }
 
@@ -1252,7 +1252,7 @@ static HRESULT HTMLSelectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid
 {
     HTMLSelectElement *This = impl_from_HTMLDOMNode(iface);
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
 
     switch(flags) {
     case DISPATCH_PROPERTYGET: {
diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c
index 9c1f9044cb7..95f7ae5cd16 100644
--- a/dlls/mshtml/htmlstorage.c
+++ b/dlls/mshtml/htmlstorage.c
@@ -69,7 +69,7 @@ static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
     HTMLStorage *This = impl_from_IHTMLStorage(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -79,7 +79,7 @@ static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface)
     HTMLStorage *This = impl_from_IHTMLStorage(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -138,7 +138,7 @@ static HRESULT WINAPI HTMLStorage_get_remainingSpace(IHTMLStorage *iface, LONG *
 static HRESULT WINAPI HTMLStorage_key(IHTMLStorage *iface, LONG lIndex, BSTR *p)
 {
     HTMLStorage *This = impl_from_IHTMLStorage(iface);
-    FIXME("(%p)->(%d %p)\n", This, lIndex, p);
+    FIXME("(%p)->(%ld %p)\n", This, lIndex, p);
     return E_NOTIMPL;
 }
 
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 2cbd8a55789..11a66369c39 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -789,7 +789,7 @@ static HRESULT set_nsstyle_property(nsIDOMCSSStyleDeclaration *nsstyle, styleid_
     nsAString_Finish(&str_name);
     nsAString_Finish(&str_empty);
     if(NS_FAILED(nsres))
-        WARN("SetProperty failed: %08x\n", nsres);
+        WARN("SetProperty failed: %08lx\n", nsres);
     return map_nsresult(nsres);
 }
 
@@ -866,7 +866,7 @@ static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, stylei
     nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
     nsAString_Finish(&str_name);
     if(NS_FAILED(nsres))
-        WARN("GetPropertyValue failed: %08x\n", nsres);
+        WARN("GetPropertyValue failed: %08lx\n", nsres);
     return map_nsresult(nsres);
 }
 
@@ -2540,7 +2540,7 @@ static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     return set_style_pxattr(This, STYLEID_TOP, v);
 }
@@ -2558,7 +2558,7 @@ static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     return set_style_pxattr(This, STYLEID_LEFT, v);
 }
@@ -2594,7 +2594,7 @@ static HRESULT WINAPI HTMLStyle_put_pixelHeight(IHTMLStyle *iface, LONG v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     return set_style_pxattr(This, STYLEID_HEIGHT, v);
 }
@@ -2747,7 +2747,7 @@ static void set_opacity(HTMLStyle *This, const WCHAR *val)
 
     nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->css_style.nsstyle, &name_str, &val_str, &empty_str);
     if(NS_FAILED(nsres))
-        ERR("SetProperty failed: %08x\n", nsres);
+        ERR("SetProperty failed: %08lx\n", nsres);
 
     nsAString_Finish(&name_str);
     nsAString_Finish(&val_str);
@@ -2893,7 +2893,7 @@ static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttribut
     HRESULT hres;
     DISPID dispid;
 
-    TRACE("(%p)->(%s %s %08x)\n", This, debugstr_w(strAttributeName),
+    TRACE("(%p)->(%s %s %08lx)\n", This, debugstr_w(strAttributeName),
           debugstr_variant(&AttributeValue), lFlags);
 
     if(!strAttributeName)
@@ -2923,7 +2923,7 @@ static HRESULT WINAPI HTMLStyle_setAttribute(IHTMLStyle *iface, BSTR strAttribut
         FIXME("Custom attributes not supported.\n");
     }
 
-    TRACE("ret: %08x\n", hres);
+    TRACE("ret: %08lx\n", hres);
 
     return hres;
 }
@@ -2935,7 +2935,7 @@ static HRESULT WINAPI HTMLStyle_getAttribute(IHTMLStyle *iface, BSTR strAttribut
     HRESULT hres;
     DISPID dispid;
 
-    TRACE("(%p)->(%s v%p %08x)\n", This, debugstr_w(strAttributeName),
+    TRACE("(%p)->(%s v%p %08lx)\n", This, debugstr_w(strAttributeName),
           AttributeValue, lFlags);
 
     if(!AttributeValue || !strAttributeName)
@@ -2970,7 +2970,7 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
+    TRACE("(%p)->(%s %08lx %p)\n", This, debugstr_w(strAttributeName), lFlags, pfSuccess);
 
     style_entry = lookup_style_tbl(&This->css_style, strAttributeName);
     if(!style_entry) {
@@ -3015,7 +3015,7 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri
         nsAString_GetData(&ret_str, &ret);
         *pfSuccess = variant_bool(*ret);
     }else {
-        WARN("RemoveProperty failed: %08x\n", nsres);
+        WARN("RemoveProperty failed: %08lx\n", nsres);
     }
     nsAString_Finish(&name_str);
     nsAString_Finish(&ret_str);
@@ -3437,7 +3437,7 @@ static HRESULT WINAPI HTMLStyle2_get_right(IHTMLStyle2 *iface, VARIANT *p)
 static HRESULT WINAPI HTMLStyle2_put_pixelBottom(IHTMLStyle2 *iface, LONG v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle2(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -3451,7 +3451,7 @@ static HRESULT WINAPI HTMLStyle2_get_pixelBottom(IHTMLStyle2 *iface, LONG *p)
 static HRESULT WINAPI HTMLStyle2_put_pixelRight(IHTMLStyle2 *iface, LONG v)
 {
     HTMLStyle *This = impl_from_IHTMLStyle2(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -4755,7 +4755,7 @@ static ULONG WINAPI HTMLCSSStyleDeclaration_AddRef(IHTMLCSSStyleDeclaration *ifa
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -4765,7 +4765,7 @@ static ULONG WINAPI HTMLCSSStyleDeclaration_Release(IHTMLCSSStyleDeclaration *if
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->nsstyle)
@@ -4789,7 +4789,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_GetTypeInfo(IHTMLCSSStyleDeclarati
         UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 {
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
-    TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
+    TRACE("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
     return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
 }
 
@@ -4797,7 +4797,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_GetIDsOfNames(IHTMLCSSStyleDeclara
         REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 {
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
-    TRACE("(%p)->(%p %p %u %u %p)\n", This, riid, rgszNames, cNames, lcid, rgDispId);
+    TRACE("(%p)->(%p %p %u %lu %p)\n", This, riid, rgszNames, cNames, lcid, rgDispId);
     return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames,
                                      cNames, lcid, rgDispId);
 }
@@ -4807,7 +4807,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_Invoke(IHTMLCSSStyleDeclaration *i
         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
-    TRACE("(%p)->(%d %p %u %u %p %p %p %p)\n", This, dispIdMember, riid, lcid, wFlags,
+    TRACE("(%p)->(%ld %p %lu %u %p %p %p %p)\n", This, dispIdMember, riid, lcid, wFlags,
           pDispParams, pVarResult, pExcepInfo, puArgErr);
     return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
                               wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
@@ -4900,14 +4900,14 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_setProperty(IHTMLCSSStyleDeclarati
     nsAString_Finish(&value_str);
     nsAString_Finish(&priority_str);
     if(NS_FAILED(nsres))
-        WARN("SetProperty failed: %08x\n", nsres);
+        WARN("SetProperty failed: %08lx\n", nsres);
     return map_nsresult(nsres);
 }
 
 static HRESULT WINAPI HTMLCSSStyleDeclaration_item(IHTMLCSSStyleDeclaration *iface, LONG index, BSTR *pbstrPropertyName)
 {
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
-    FIXME("(%p)->(%d %p)\n", This, index, pbstrPropertyName);
+    FIXME("(%p)->(%ld %p)\n", This, index, pbstrPropertyName);
     return E_NOTIMPL;
 }
 
@@ -6059,7 +6059,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_cssText(IHTMLCSSStyleDeclarati
     nsres = nsIDOMCSSStyleDeclaration_SetCssText(This->nsstyle, &text_str);
     nsAString_Finish(&text_str);
     if(NS_FAILED(nsres)) {
-        FIXME("SetCssStyle failed: %08x\n", nsres);
+        FIXME("SetCssStyle failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -8101,7 +8101,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration2_GetTypeInfo(IHTMLCSSStyleDeclarat
         UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 {
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration2(iface);
-    TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
+    TRACE("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
     return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
 }
 
@@ -8109,7 +8109,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration2_GetIDsOfNames(IHTMLCSSStyleDeclar
         REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 {
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration2(iface);
-    TRACE("(%p)->(%p %p %u %u %p)\n", This, riid, rgszNames, cNames, lcid, rgDispId);
+    TRACE("(%p)->(%p %p %u %lu %p)\n", This, riid, rgszNames, cNames, lcid, rgDispId);
     return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames,
                                      cNames, lcid, rgDispId);
 }
@@ -8119,7 +8119,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration2_Invoke(IHTMLCSSStyleDeclaration2
         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
     CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration2(iface);
-    TRACE("(%p)->(%d %p %u %u %p %p %p %p)\n", This, dispIdMember, riid, lcid, wFlags,
+    TRACE("(%p)->(%ld %p %lu %u %p %p %p %p)\n", This, dispIdMember, riid, lcid, wFlags,
           pDispParams, pVarResult, pExcepInfo, puArgErr);
     return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
                               wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
@@ -10032,7 +10032,7 @@ static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration
         nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, ret);
         nsIDOMElementCSSInlineStyle_Release(nselemstyle);
         if(NS_FAILED(nsres)) {
-            ERR("GetStyle failed: %08x\n", nsres);
+            ERR("GetStyle failed: %08lx\n", nsres);
             return E_FAIL;
         }
         return S_OK;
@@ -10043,7 +10043,7 @@ static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration
         nsres = nsIDOMSVGElement_GetStyle(svg_element, ret);
         nsIDOMSVGElement_Release(svg_element);
         if(NS_FAILED(nsres)) {
-            ERR("GetStyle failed: %08x\n", nsres);
+            ERR("GetStyle failed: %08lx\n", nsres);
             return E_FAIL;
         }
         return S_OK;
diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c
index cf575476841..1b1297ea5eb 100644
--- a/dlls/mshtml/htmlstyleelem.c
+++ b/dlls/mshtml/htmlstyleelem.c
@@ -113,7 +113,7 @@ static HRESULT WINAPI HTMLStyleElement_put_type(IHTMLStyleElement *iface, BSTR v
     nsres = nsIDOMHTMLStyleElement_SetType(This->nsstyle, &type_str);
     nsAString_Finish(&type_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetType failed: %08x\n", nsres);
+        ERR("SetType failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -239,7 +239,7 @@ static HRESULT WINAPI HTMLStyleElement_put_media(IHTMLStyleElement *iface, BSTR
     nsres = nsIDOMHTMLStyleElement_SetMedia(This->nsstyle, &media_str);
     nsAString_Finish(&media_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetMedia failed: %08x\n", nsres);
+        ERR("SetMedia failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c
index 3d9b7bb8683..2d16f4aceca 100644
--- a/dlls/mshtml/htmlstylesheet.c
+++ b/dlls/mshtml/htmlstylesheet.c
@@ -102,7 +102,7 @@ static ULONG WINAPI HTMLStyleSheetRule_AddRef(IHTMLStyleSheetRule *iface)
     HTMLStyleSheetRule *This = impl_from_IHTMLStyleSheetRule(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -112,7 +112,7 @@ static ULONG WINAPI HTMLStyleSheetRule_Release(IHTMLStyleSheetRule *iface)
     HTMLStyleSheetRule *This = impl_from_IHTMLStyleSheetRule(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -229,7 +229,7 @@ static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, compat_m
         nsres = nsIDOMCSSRule_QueryInterface(nsstylesheetrule, &IID_nsIDOMCSSRule,
                 (void **)&rule->nsstylesheetrule);
         if (NS_FAILED(nsres))
-            ERR("Could not get nsIDOMCSSRule interface: %08x\n", nsres);
+            ERR("Could not get nsIDOMCSSRule interface: %08lx\n", nsres);
     }
 
     *ret = &rule->IHTMLStyleSheetRule_iface;
@@ -269,7 +269,7 @@ static ULONG WINAPI HTMLStyleSheetRulesCollection_AddRef(IHTMLStyleSheetRulesCol
     HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -279,7 +279,7 @@ static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCo
     HTMLStyleSheetRulesCollection *This = impl_from_IHTMLStyleSheetRulesCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -335,7 +335,7 @@ static HRESULT WINAPI HTMLStyleSheetRulesCollection_get_length(IHTMLStyleSheetRu
 
         nsres = nsIDOMCSSRuleList_GetLength(This->nslist, &len);
         if(NS_FAILED(nsres))
-            ERR("GetLength failed: %08x\n", nsres);
+            ERR("GetLength failed: %08lx\n", nsres);
     }
 
     *p = len;
@@ -350,7 +350,7 @@ static HRESULT WINAPI HTMLStyleSheetRulesCollection_item(IHTMLStyleSheetRulesCol
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %p)\n", This, index, p);
+    TRACE("(%p)->(%ld %p)\n", This, index, p);
 
     nsres = nsIDOMCSSRuleList_Item(This->nslist, index, &nsstylesheetrule);
     if(NS_FAILED(nsres))
@@ -397,7 +397,7 @@ static HRESULT HTMLStyleSheetRulesCollection_get_dispid(DispatchEx *dispex, BSTR
         return DISP_E_UNKNOWNNAME;
 
     *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
-    TRACE("ret %x\n", *dispid);
+    TRACE("ret %lx\n", *dispid);
     return S_OK;
 }
 
@@ -406,7 +406,7 @@ static HRESULT HTMLStyleSheetRulesCollection_invoke(DispatchEx *dispex, DISPID i
 {
     HTMLStyleSheetRulesCollection *This = HTMLStyleSheetRulesCollection_from_DispatchEx(dispex);
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
 
     switch(flags) {
     case DISPATCH_PROPERTYGET: {
@@ -514,7 +514,7 @@ static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection
     HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -524,7 +524,7 @@ static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection
     HTMLStyleSheetsCollection *This = impl_from_IHTMLStyleSheetsCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -604,11 +604,11 @@ static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection
         nsresult nsres;
         HRESULT hres;
 
-        TRACE("index=%d\n", V_I4(pvarIndex));
+        TRACE("index=%ld\n", V_I4(pvarIndex));
 
         nsres = nsIDOMStyleSheetList_Item(This->nslist, V_I4(pvarIndex), &nsstylesheet);
         if(NS_FAILED(nsres) || !nsstylesheet) {
-            WARN("Item failed: %08x\n", nsres);
+            WARN("Item failed: %08lx\n", nsres);
             V_VT(pvarResult) = VT_EMPTY;
             return E_INVALIDARG;
         }
@@ -669,7 +669,7 @@ static HRESULT HTMLStyleSheetsCollection_get_dispid(DispatchEx *dispex, BSTR nam
         return DISP_E_UNKNOWNNAME;
 
     *dispid = MSHTML_DISPID_CUSTOM_MIN + idx;
-    TRACE("ret %x\n", *dispid);
+    TRACE("ret %lx\n", *dispid);
     return S_OK;
 }
 
@@ -678,7 +678,7 @@ static HRESULT HTMLStyleSheetsCollection_invoke(DispatchEx *dispex, DISPID id, L
 {
     HTMLStyleSheetsCollection *This = HTMLStyleSheetsCollection_from_DispatchEx(dispex);
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, flags, params, res, ei, caller);
 
     switch(flags) {
     case DISPATCH_PROPERTYGET: {
@@ -787,7 +787,7 @@ static ULONG WINAPI HTMLStyleSheet_AddRef(IHTMLStyleSheet *iface)
     HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -797,7 +797,7 @@ static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface)
     HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -936,7 +936,7 @@ static HRESULT WINAPI HTMLStyleSheet_addImport(IHTMLStyleSheet *iface, BSTR bstr
                                                LONG lIndex, LONG *plIndex)
 {
     HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
-    FIXME("(%p)->(%s %d %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
+    FIXME("(%p)->(%s %ld %p)\n", This, debugstr_w(bstrURL), lIndex, plIndex);
     return E_NOTIMPL;
 }
 
@@ -952,7 +952,7 @@ static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSe
     WCHAR *rule;
     size_t len;
 
-    TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
+    TRACE("(%p)->(%s %s %ld %p)\n", This, debugstr_w(bstrSelector), debugstr_w(bstrStyle),
           lIndex, plIndex);
 
     if(!bstrSelector || !bstrStyle || !bstrSelector[0] || !bstrStyle[0])
@@ -973,7 +973,7 @@ static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSe
 
     nsAString_InitDepend(&nsstr, rule);
     nsres = nsIDOMCSSStyleSheet_InsertRule(This->nsstylesheet, &nsstr, lIndex, &new_index);
-    if(NS_FAILED(nsres)) WARN("failed: %08x\n", nsres);
+    if(NS_FAILED(nsres)) WARN("failed: %08lx\n", nsres);
     nsAString_Finish(&nsstr);
     heap_free(rule);
 
@@ -984,14 +984,14 @@ static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSe
 static HRESULT WINAPI HTMLStyleSheet_removeImport(IHTMLStyleSheet *iface, LONG lIndex)
 {
     HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
-    FIXME("(%p)->(%d)\n", This, lIndex);
+    FIXME("(%p)->(%ld)\n", This, lIndex);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyleSheet_removeRule(IHTMLStyleSheet *iface, LONG lIndex)
 {
     HTMLStyleSheet *This = impl_from_IHTMLStyleSheet(iface);
-    FIXME("(%p)->(%d)\n", This, lIndex);
+    FIXME("(%p)->(%ld)\n", This, lIndex);
     return E_NOTIMPL;
 }
 
@@ -1050,7 +1050,7 @@ static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p
 
     nsres = nsIDOMCSSStyleSheet_GetCssRules(This->nsstylesheet, &nslist);
     if(NS_FAILED(nsres)) {
-        ERR("GetCssRules failed: %08x\n", nsres);
+        ERR("GetCssRules failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1060,7 +1060,7 @@ static HRESULT WINAPI HTMLStyleSheet_get_cssText(IHTMLStyleSheet *iface, BSTR *p
     if(len) {
         nsres = nsIDOMCSSRuleList_Item(nslist, 0, &nsrule);
         if(NS_FAILED(nsres))
-            ERR("Item failed: %08x\n", nsres);
+            ERR("Item failed: %08lx\n", nsres);
     }
 
     nsIDOMCSSRuleList_Release(nslist);
@@ -1090,7 +1090,7 @@ static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
 
     nsres = nsIDOMCSSStyleSheet_GetCssRules(This->nsstylesheet, &nslist);
     if(NS_FAILED(nsres)) {
-        ERR("GetCssRules failed: %08x\n", nsres);
+        ERR("GetCssRules failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1246,11 +1246,11 @@ static HRESULT WINAPI HTMLStyleSheet4_insertRule(IHTMLStyleSheet4 *iface, BSTR r
     nsAString nsstr;
     nsresult nsres;
 
-    TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(rule), index, p);
+    TRACE("(%p)->(%s %ld %p)\n", This, debugstr_w(rule), index, p);
 
     nsAString_InitDepend(&nsstr, rule);
     nsres = nsIDOMCSSStyleSheet_InsertRule(This->nsstylesheet, &nsstr, index, &new_index);
-    if(NS_FAILED(nsres)) WARN("failed: %08x\n", nsres);
+    if(NS_FAILED(nsres)) WARN("failed: %08lx\n", nsres);
     nsAString_Finish(&nsstr);
     *p = new_index;
     return map_nsresult(nsres);
@@ -1259,7 +1259,7 @@ static HRESULT WINAPI HTMLStyleSheet4_insertRule(IHTMLStyleSheet4 *iface, BSTR r
 static HRESULT WINAPI HTMLStyleSheet4_deleteRule(IHTMLStyleSheet4 *iface, LONG index)
 {
     HTMLStyleSheet *This = impl_from_IHTMLStyleSheet4(iface);
-    FIXME("(%p)->(%d)\n", This, index);
+    FIXME("(%p)->(%ld)\n", This, index);
     return E_NOTIMPL;
 }
 
@@ -1320,7 +1320,7 @@ HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_
         nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
                 (void**)&style_sheet->nsstylesheet);
         if(NS_FAILED(nsres))
-            ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres);
+            ERR("Could not get nsICSSStyleSheet interface: %08lx\n", nsres);
     }
 
     *ret = &style_sheet->IHTMLStyleSheet_iface;
diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c
index 53c98205574..6a64672a83a 100644
--- a/dlls/mshtml/htmltable.c
+++ b/dlls/mshtml/htmltable.c
@@ -101,14 +101,14 @@ static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
     HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     if(v <= 0)
         return E_INVALIDARG;
 
     nsres = nsIDOMHTMLTableCellElement_SetRowSpan(This->nscell, v);
     if(NS_FAILED(nsres)) {
-        ERR("SetRowSpan failed: %08x\n", nsres);
+        ERR("SetRowSpan failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -124,7 +124,7 @@ static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
 
     nsres = nsIDOMHTMLTableCellElement_GetRowSpan(This->nscell, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetRowSpan failed: %08x\n", nsres);
+        ERR("GetRowSpan failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -136,14 +136,14 @@ static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
     HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, v);
+    TRACE("(%p)->(%ld)\n", This, v);
 
     if(v <= 0)
         return E_INVALIDARG;
 
     nsres = nsIDOMHTMLTableCellElement_SetColSpan(This->nscell, v);
     if(NS_FAILED(nsres)) {
-        ERR("SetColSpan failed: %08x\n", nsres);
+        ERR("SetColSpan failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -159,7 +159,7 @@ static HRESULT WINAPI HTMLTableCell_get_colSpan(IHTMLTableCell *iface, LONG *p)
 
     nsres = nsIDOMHTMLTableCellElement_GetColSpan(This->nscell, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetColSpan failed: %08x\n", nsres);
+        ERR("GetColSpan failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -178,7 +178,7 @@ static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v)
     nsres = nsIDOMHTMLTableCellElement_SetAlign(This->nscell, &str);
     nsAString_Finish(&str);
     if (NS_FAILED(nsres)) {
-        ERR("Set Align failed: %08x\n", nsres);
+        ERR("Set Align failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -226,7 +226,7 @@ static HRESULT WINAPI HTMLTableCell_put_bgColor(IHTMLTableCell *iface, VARIANT v
     nsres = nsIDOMHTMLTableCellElement_SetBgColor(This->nscell, &strColor);
     nsAString_Finish(&strColor);
     if(NS_FAILED(nsres)) {
-        ERR("SetBgColor(%s) failed: %08x\n", debugstr_variant(&v), nsres);
+        ERR("SetBgColor(%s) failed: %08lx\n", debugstr_variant(&v), nsres);
         return E_FAIL;
     }
 
@@ -251,7 +251,7 @@ static HRESULT WINAPI HTMLTableCell_get_bgColor(IHTMLTableCell *iface, VARIANT *
         V_VT(p) = VT_BSTR;
         hres = nscolor_to_str(color, &V_BSTR(p));
     }else {
-        ERR("GetBgColor failed: %08x\n", nsres);
+        ERR("GetBgColor failed: %08lx\n", nsres);
         hres = E_FAIL;
     }
     nsAString_Finish(&strColor);
@@ -398,7 +398,7 @@ static HRESULT WINAPI HTMLTableCell_get_cellIndex(IHTMLTableCell *iface, LONG *p
     TRACE("(%p)->(%p)\n", This, p);
     nsres = nsIDOMHTMLTableCellElement_GetCellIndex(This->nscell, p);
     if (NS_FAILED(nsres)) {
-        ERR("Get CellIndex failed: %08x\n", nsres);
+        ERR("Get CellIndex failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -723,7 +723,7 @@ static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
        V_VT(p) = VT_BSTR;
        hres = nscolor_to_str(color, &V_BSTR(p));
     }else {
-       ERR("SetBgColor failed: %08x\n", nsres);
+       ERR("SetBgColor failed: %08lx\n", nsres);
        hres = E_FAIL;
     }
 
@@ -781,7 +781,7 @@ static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
     TRACE("(%p)->(%p)\n", This, p);
     nsres = nsIDOMHTMLTableRowElement_GetRowIndex(This->nsrow, p);
     if(NS_FAILED(nsres)) {
-        ERR("Get rowIndex failed: %08x\n", nsres);
+        ERR("Get rowIndex failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -795,7 +795,7 @@ static HRESULT WINAPI HTMLTableRow_get_sectionRowIndex(IHTMLTableRow *iface, LON
     TRACE("(%p)->(%p)\n", This, p);
     nsres = nsIDOMHTMLTableRowElement_GetSectionRowIndex(This->nsrow, p);
     if(NS_FAILED(nsres)) {
-        ERR("Get selectionRowIndex failed: %08x\n", nsres);
+        ERR("Get selectionRowIndex failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -811,7 +811,7 @@ static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementC
 
     nsres = nsIDOMHTMLTableRowElement_GetCells(This->nsrow, &nscol);
     if(NS_FAILED(nsres)) {
-        ERR("GetCells failed: %08x\n", nsres);
+        ERR("GetCells failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -829,17 +829,17 @@ static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index,
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %p)\n", This, index, row);
+    TRACE("(%p)->(%ld %p)\n", This, index, row);
     nsres = nsIDOMHTMLTableRowElement_InsertCell(This->nsrow, index, &nselem);
     if(NS_FAILED(nsres)) {
-        ERR("Insert Cell at %d failed: %08x\n", index, nsres);
+        ERR("Insert Cell at %ld failed: %08lx\n", index, nsres);
         return E_FAIL;
     }
 
     hres = HTMLTableCell_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
     nsIDOMHTMLElement_Release(nselem);
     if (FAILED(hres)) {
-        ERR("Create TableCell failed: %08x\n", hres);
+        ERR("Create TableCell failed: %08lx\n", hres);
         return hres;
     }
 
@@ -852,10 +852,10 @@ static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
     HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, index);
+    TRACE("(%p)->(%ld)\n", This, index);
     nsres = nsIDOMHTMLTableRowElement_DeleteCell(This->nsrow, index);
     if(NS_FAILED(nsres)) {
-        ERR("Delete Cell failed: %08x\n", nsres);
+        ERR("Delete Cell failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -1106,7 +1106,7 @@ static HRESULT WINAPI HTMLTable_Invoke(IHTMLTable *iface, DISPID dispIdMember,
 static HRESULT WINAPI HTMLTable_put_cols(IHTMLTable *iface, LONG v)
 {
     HTMLTable *This = impl_from_IHTMLTable(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -1144,7 +1144,7 @@ static HRESULT WINAPI HTMLTable_put_frame(IHTMLTable *iface, BSTR v)
     nsAString_Finish(&str);
 
     if (NS_FAILED(nsres)) {
-        ERR("SetFrame(%s) failed: %08x\n", debugstr_w(v), nsres);
+        ERR("SetFrame(%s) failed: %08lx\n", debugstr_w(v), nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -1204,7 +1204,7 @@ static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
     nsres = nsIDOMHTMLTableElement_SetCellSpacing(This->nstable, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("SetCellSpacing failed: %08x\n", nsres);
+        ERR("SetCellSpacing failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1241,7 +1241,7 @@ static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)
     nsres = nsIDOMHTMLTableElement_SetCellPadding(This->nstable, &val);
     nsAString_Finish(&val);
     if(NS_FAILED(nsres)) {
-        ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v), nsres);
+        ERR("Set Width(%s) failed, err = %08lx\n", debugstr_variant(&v), nsres);
         return E_FAIL;
     }
 
@@ -1314,7 +1314,7 @@ static HRESULT WINAPI HTMLTable_get_bgColor(IHTMLTable *iface, VARIANT *p)
        V_VT(p) = VT_BSTR;
        hres = nscolor_to_str(color, &V_BSTR(p));
     }else {
-       ERR("SetBgColor failed: %08x\n", nsres);
+       ERR("SetBgColor failed: %08lx\n", nsres);
        hres = E_FAIL;
     }
 
@@ -1414,7 +1414,7 @@ static HRESULT WINAPI HTMLTable_get_rows(IHTMLTable *iface, IHTMLElementCollecti
 
     nsres = nsIDOMHTMLTableElement_GetRows(This->nstable, &nscol);
     if(NS_FAILED(nsres)) {
-        ERR("GetRows failed: %08x\n", nsres);
+        ERR("GetRows failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1435,7 +1435,7 @@ static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
     hres = var2str(&v, &val);
 
     if (FAILED(hres)){
-        ERR("Set Width(%s) failed when initializing a nsAString, err = %08x\n",
+        ERR("Set Width(%s) failed when initializing a nsAString, err = %08lx\n",
             debugstr_variant(&v), hres);
         return hres;
     }
@@ -1444,7 +1444,7 @@ static HRESULT WINAPI HTMLTable_put_width(IHTMLTable *iface, VARIANT v)
     nsAString_Finish(&val);
 
     if (NS_FAILED(nsres)){
-        ERR("Set Width(%s) failed, err = %08x\n", debugstr_variant(&v), nsres);
+        ERR("Set Width(%s) failed, err = %08lx\n", debugstr_variant(&v), nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -1480,7 +1480,7 @@ static HRESULT WINAPI HTMLTable_get_height(IHTMLTable *iface, VARIANT *p)
 static HRESULT WINAPI HTMLTable_put_dataPageSize(IHTMLTable *iface, LONG v)
 {
     HTMLTable *This = impl_from_IHTMLTable(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -1529,7 +1529,7 @@ static HRESULT WINAPI HTMLTable_get_tBodies(IHTMLTable *iface, IHTMLElementColle
 
     nsres = nsIDOMHTMLTableElement_GetTBodies(This->nstable, &nscol);
     if(NS_FAILED(nsres)) {
-        ERR("GetTBodies failed: %08x\n", nsres);
+        ERR("GetTBodies failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1596,17 +1596,17 @@ static HRESULT WINAPI HTMLTable_insertRow(IHTMLTable *iface, LONG index, IDispat
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %p)\n", This, index, row);
+    TRACE("(%p)->(%ld %p)\n", This, index, row);
     nsres = nsIDOMHTMLTableElement_InsertRow(This->nstable, index, &nselem);
     if(NS_FAILED(nsres)) {
-        ERR("Insert Row at %d failed: %08x\n", index, nsres);
+        ERR("Insert Row at %ld failed: %08lx\n", index, nsres);
         return E_FAIL;
     }
 
     hres = HTMLTableRow_Create(This->element.node.doc, (nsIDOMElement*)nselem, &elem);
     nsIDOMHTMLElement_Release(nselem);
     if (FAILED(hres)) {
-        ERR("Create TableRow failed: %08x\n", hres);
+        ERR("Create TableRow failed: %08lx\n", hres);
         return hres;
     }
 
@@ -1619,10 +1619,10 @@ static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index)
     HTMLTable *This = impl_from_IHTMLTable(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d)\n", This, index);
+    TRACE("(%p)->(%ld)\n", This, index);
     nsres = nsIDOMHTMLTableElement_DeleteRow(This->nstable, index);
     if(NS_FAILED(nsres)) {
-        ERR("Delete Row failed: %08x\n", nsres);
+        ERR("Delete Row failed: %08lx\n", nsres);
         return E_FAIL;
     }
     return S_OK;
@@ -1787,7 +1787,7 @@ static HRESULT WINAPI HTMLTable2_cells(IHTMLTable2 *iface, IHTMLElementCollectio
 static HRESULT WINAPI HTMLTable2_moveRow(IHTMLTable2 *iface, LONG indexFrom, LONG indexTo, IDispatch **row)
 {
     HTMLTable *This = impl_from_IHTMLTable2(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, indexFrom, indexTo, row);
+    FIXME("(%p)->(%ld %ld %p)\n", This, indexFrom, indexTo, row);
     return E_NOTIMPL;
 }
 
@@ -1875,7 +1875,7 @@ static HRESULT WINAPI HTMLTable3_put_summary(IHTMLTable3 *iface, BSTR v)
 
     nsAString_Finish(&str);
     if (NS_FAILED(nsres)) {
-        ERR("Set summary(%s) failed: %08x\n", debugstr_w(v), nsres);
+        ERR("Set summary(%s) failed: %08lx\n", debugstr_w(v), nsres);
         return E_FAIL;
     }
     return S_OK;
diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c
index f95b5590198..32a574ebcd5 100644
--- a/dlls/mshtml/htmltextarea.c
+++ b/dlls/mshtml/htmltextarea.c
@@ -122,7 +122,7 @@ static HRESULT WINAPI HTMLTextAreaElement_put_value(IHTMLTextAreaElement *iface,
     nsres = nsIDOMHTMLTextAreaElement_SetValue(This->nstextarea, &value_str);
     nsAString_Finish(&value_str);
     if(NS_FAILED(nsres)) {
-        ERR("SetValue failed: %08x\n", nsres);
+        ERR("SetValue failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -273,7 +273,7 @@ static HRESULT WINAPI HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement *ifa
 
     nsres = nsIDOMHTMLTextAreaElement_SetReadOnly(This->nstextarea, v != VARIANT_FALSE);
     if(NS_FAILED(nsres)) {
-        ERR("SetReadOnly failed: %08x\n", nsres);
+        ERR("SetReadOnly failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -290,7 +290,7 @@ static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *ifa
 
     nsres = nsIDOMHTMLTextAreaElement_GetReadOnly(This->nstextarea, &b);
     if(NS_FAILED(nsres)) {
-        ERR("GetReadOnly failed: %08x\n", nsres);
+        ERR("GetReadOnly failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -301,7 +301,7 @@ static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *ifa
 static HRESULT WINAPI HTMLTextAreaElement_put_rows(IHTMLTextAreaElement *iface, LONG v)
 {
     HTMLTextAreaElement *This = impl_from_IHTMLTextAreaElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -315,7 +315,7 @@ static HRESULT WINAPI HTMLTextAreaElement_get_rows(IHTMLTextAreaElement *iface,
 static HRESULT WINAPI HTMLTextAreaElement_put_cols(IHTMLTextAreaElement *iface, LONG v)
 {
     HTMLTextAreaElement *This = impl_from_IHTMLTextAreaElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c
index d899fa0adff..373515be444 100644
--- a/dlls/mshtml/htmltextnode.c
+++ b/dlls/mshtml/htmltextnode.c
@@ -150,7 +150,7 @@ static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, LONG *
 
     nsres = nsIDOMText_GetLength(This->nstext, &length);
     if(NS_FAILED(nsres))
-        ERR("GetLength failed: %08x\n", nsres);
+        ERR("GetLength failed: %08lx\n", nsres);
 
     *p = length;
     return S_OK;
@@ -164,11 +164,11 @@ static HRESULT WINAPI HTMLDOMTextNode_splitText(IHTMLDOMTextNode *iface, LONG of
     nsresult nsres;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %p)\n", This, offset, pRetNode);
+    TRACE("(%p)->(%ld %p)\n", This, offset, pRetNode);
 
     nsres = nsIDOMText_SplitText(This->nstext, offset, &text);
     if(NS_FAILED(nsres)) {
-        ERR("SplitText failed: %x08x\n", nsres);
+        ERR("SplitText failed: %lx08x\n", nsres);
         return E_FAIL;
     }
 
@@ -260,7 +260,7 @@ static HRESULT WINAPI HTMLDOMTextNode2_Invoke(IHTMLDOMTextNode2 *iface, DISPID d
 static HRESULT WINAPI HTMLDOMTextNode2_substringData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count, BSTR *string)
 {
     HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, offset, count, string);
+    FIXME("(%p)->(%ld %ld %p)\n", This, offset, count, string);
     return E_NOTIMPL;
 }
 
@@ -276,7 +276,7 @@ static HRESULT WINAPI HTMLDOMTextNode2_appendData(IHTMLDOMTextNode2 *iface, BSTR
     nsres = nsIDOMText_AppendData(This->nstext, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("AppendData failed: %08x\n", nsres);
+        ERR("AppendData failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -286,21 +286,21 @@ static HRESULT WINAPI HTMLDOMTextNode2_appendData(IHTMLDOMTextNode2 *iface, BSTR
 static HRESULT WINAPI HTMLDOMTextNode2_insertData(IHTMLDOMTextNode2 *iface, LONG offset, BSTR string)
 {
     HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
-    FIXME("(%p)->(%d %s)\n", This, offset, debugstr_w(string));
+    FIXME("(%p)->(%ld %s)\n", This, offset, debugstr_w(string));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDOMTextNode2_deleteData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count)
 {
     HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
-    FIXME("(%p)->(%d %d)\n", This, offset, count);
+    FIXME("(%p)->(%ld %ld)\n", This, offset, count);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDOMTextNode2_replaceData(IHTMLDOMTextNode2 *iface, LONG offset, LONG count, BSTR string)
 {
     HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode2(iface);
-    FIXME("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(string));
+    FIXME("(%p)->(%ld %ld %s)\n", This, offset, count, debugstr_w(string));
     return E_NOTIMPL;
 }
 
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 5aa2351f5f0..3784c3a9736 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -212,7 +212,7 @@ static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface)
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -314,7 +314,7 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if (This->console)
@@ -373,7 +373,7 @@ static HRESULT get_frame_by_index(HTMLOuterWindow *This, UINT32 index, HTMLOuter
 
     nsres = nsIDOMWindow_GetFrames(This->nswindow, &nsframes);
     if(NS_FAILED(nsres)) {
-        FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres);
+        FIXME("nsIDOMWindow_GetFrames failed: 0x%08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -388,7 +388,7 @@ static HRESULT get_frame_by_index(HTMLOuterWindow *This, UINT32 index, HTMLOuter
     nsres = nsIDOMWindowCollection_Item(nsframes, index, &mozwindow);
     nsIDOMWindowCollection_Release(nsframes);
     if(NS_FAILED(nsres)) {
-        FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres);
+        FIXME("nsIDOMWindowCollection_Item failed: 0x%08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -410,7 +410,7 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H
 
     nsres = nsIDOMWindow_GetFrames(This->nswindow, &nsframes);
     if(NS_FAILED(nsres)) {
-        FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres);
+        FIXME("nsIDOMWindow_GetFrames failed: 0x%08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -441,7 +441,7 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H
 
         nsres = nsIDOMWindowCollection_Item(nsframes, i, &mozwindow);
         if(NS_FAILED(nsres)) {
-            FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres);
+            FIXME("nsIDOMWindowCollection_Item failed: 0x%08lx\n", nsres);
             hres = E_FAIL;
             break;
         }
@@ -457,7 +457,7 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H
 
         hres = IHTMLElement_get_id(&window_iter->frame_element->element.IHTMLElement_iface, &id);
         if(FAILED(hres)) {
-            FIXME("IHTMLElement_get_id failed: 0x%08x\n", hres);
+            FIXME("IHTMLElement_get_id failed: 0x%08lx\n", hres);
             break;
         }
 
@@ -534,14 +534,14 @@ static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, LONG *p)
 
     nsres = nsIDOMWindow_GetFrames(This->outer_window->nswindow, &nscollection);
     if(NS_FAILED(nsres)) {
-        ERR("GetFrames failed: %08x\n", nsres);
+        ERR("GetFrames failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMWindowCollection_GetLength(nscollection, &length);
     nsIDOMWindowCollection_Release(nscollection);
     if(NS_FAILED(nsres)) {
-        ERR("GetLength failed: %08x\n", nsres);
+        ERR("GetLength failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -604,7 +604,7 @@ static HRESULT WINAPI HTMLWindow2_setTimeout(IHTMLWindow2 *iface, BSTR expressio
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
     VARIANT expr_var;
 
-    TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
+    TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
 
     V_VT(&expr_var) = VT_BSTR;
     V_BSTR(&expr_var) = expression;
@@ -616,7 +616,7 @@ static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, LONG timerID
 {
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
 
-    TRACE("(%p)->(%d)\n", This, timerID);
+    TRACE("(%p)->(%ld)\n", This, timerID);
 
     return clear_task_timer(This->inner_window, timerID);
 }
@@ -635,7 +635,7 @@ static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message)
         return E_UNEXPECTED;
 
     if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, title, ARRAY_SIZE(title))) {
-        WARN("Could not load message box title: %d\n", GetLastError());
+        WARN("Could not load message box title: %ld\n", GetLastError());
         return S_OK;
     }
 
@@ -668,7 +668,7 @@ static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message,
         return E_UNEXPECTED;
 
     if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, wszTitle, ARRAY_SIZE(wszTitle))) {
-        WARN("Could not load message box title: %d\n", GetLastError());
+        WARN("Could not load message box title: %ld\n", GetLastError());
         *confirmed = VARIANT_TRUE;
         return S_OK;
     }
@@ -699,7 +699,7 @@ static INT_PTR CALLBACK prompt_dlgproc(HWND hwnd, UINT msg,
             WCHAR wszTitle[100];
 
             if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, wszTitle, ARRAY_SIZE(wszTitle))) {
-                WARN("Could not load message box title: %d\n", GetLastError());
+                WARN("Could not load message box title: %ld\n", GetLastError());
                 EndDialog(hwnd, wparam);
                 return FALSE;
             }
@@ -952,7 +952,7 @@ static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
     nsres = nsIDOMWindow_SetName(This->outer_window->nswindow, &name_str);
     nsAString_Finish(&name_str);
     if(NS_FAILED(nsres))
-        ERR("SetName failed: %08x\n", nsres);
+        ERR("SetName failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1383,11 +1383,11 @@ static HRESULT WINAPI HTMLWindow2_scroll(IHTMLWindow2 *iface, LONG x, LONG y)
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d %d)\n", This, x, y);
+    TRACE("(%p)->(%ld %ld)\n", This, x, y);
 
     nsres = nsIDOMWindow_Scroll(This->outer_window->nswindow, x, y);
     if(NS_FAILED(nsres)) {
-        ERR("ScrollBy failed: %08x\n", nsres);
+        ERR("ScrollBy failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1409,7 +1409,7 @@ static HRESULT WINAPI HTMLWindow2_setInterval(IHTMLWindow2 *iface, BSTR expressi
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
     VARIANT expr;
 
-    TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
+    TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
 
     V_VT(&expr) = VT_BSTR;
     V_BSTR(&expr) = expression;
@@ -1420,7 +1420,7 @@ static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, LONG timerI
 {
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
 
-    TRACE("(%p)->(%d)\n", This, timerID);
+    TRACE("(%p)->(%ld)\n", This, timerID);
 
     return clear_task_timer(This->inner_window, timerID);
 }
@@ -1467,11 +1467,11 @@ static HRESULT WINAPI HTMLWindow2_scrollBy(IHTMLWindow2 *iface, LONG x, LONG y)
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d %d)\n", This, x, y);
+    TRACE("(%p)->(%ld %ld)\n", This, x, y);
 
     nsres = nsIDOMWindow_ScrollBy(This->outer_window->nswindow, x, y);
     if(NS_FAILED(nsres))
-        ERR("ScrollBy failed: %08x\n", nsres);
+        ERR("ScrollBy failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1481,11 +1481,11 @@ static HRESULT WINAPI HTMLWindow2_scrollTo(IHTMLWindow2 *iface, LONG x, LONG y)
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
     nsresult nsres;
 
-    TRACE("(%p)->(%d %d)\n", This, x, y);
+    TRACE("(%p)->(%ld %ld)\n", This, x, y);
 
     nsres = nsIDOMWindow_ScrollTo(This->outer_window->nswindow, x, y);
     if(NS_FAILED(nsres))
-        ERR("ScrollTo failed: %08x\n", nsres);
+        ERR("ScrollTo failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1493,28 +1493,28 @@ static HRESULT WINAPI HTMLWindow2_scrollTo(IHTMLWindow2 *iface, LONG x, LONG y)
 static HRESULT WINAPI HTMLWindow2_moveTo(IHTMLWindow2 *iface, LONG x, LONG y)
 {
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
-    FIXME("(%p)->(%d %d)\n", This, x, y);
+    FIXME("(%p)->(%ld %ld)\n", This, x, y);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLWindow2_moveBy(IHTMLWindow2 *iface, LONG x, LONG y)
 {
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
-    FIXME("(%p)->(%d %d)\n", This, x, y);
+    FIXME("(%p)->(%ld %ld)\n", This, x, y);
     return S_FALSE;
 }
 
 static HRESULT WINAPI HTMLWindow2_resizeTo(IHTMLWindow2 *iface, LONG x, LONG y)
 {
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
-    FIXME("(%p)->(%d %d)\n", This, x, y);
+    FIXME("(%p)->(%ld %ld)\n", This, x, y);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLWindow2_resizeBy(IHTMLWindow2 *iface, LONG x, LONG y)
 {
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
-    FIXME("(%p)->(%d %d)\n", This, x, y);
+    FIXME("(%p)->(%ld %ld)\n", This, x, y);
     return S_FALSE;
 }
 
@@ -1685,7 +1685,7 @@ static HRESULT WINAPI HTMLWindow3_get_screenLeft(IHTMLWindow3 *iface, LONG *p)
 
     nsres = nsIDOMWindow_GetScreenX(This->outer_window->nswindow, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetScreenX failed: %08x\n", nsres);
+        ERR("GetScreenX failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1701,7 +1701,7 @@ static HRESULT WINAPI HTMLWindow3_get_screenTop(IHTMLWindow3 *iface, LONG *p)
 
     nsres = nsIDOMWindow_GetScreenY(This->outer_window->nswindow, p);
     if(NS_FAILED(nsres)) {
-        ERR("GetScreenY failed: %08x\n", nsres);
+        ERR("GetScreenY failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1773,7 +1773,7 @@ static HRESULT WINAPI HTMLWindow3_setTimeout(IHTMLWindow3 *iface, VARIANT *expre
 {
     HTMLWindow *This = impl_from_IHTMLWindow3(iface);
 
-    TRACE("(%p)->(%s %d %s %p)\n", This, debugstr_variant(expression), msec, debugstr_variant(language), timerID);
+    TRACE("(%p)->(%s %ld %s %p)\n", This, debugstr_variant(expression), msec, debugstr_variant(language), timerID);
 
     return window_set_timer(This->inner_window, expression, msec, language, TIMER_TIMEOUT, timerID);
 }
@@ -1783,7 +1783,7 @@ static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expr
 {
     HTMLWindow *This = impl_from_IHTMLWindow3(iface);
 
-    TRACE("(%p)->(%p %d %p %p)\n", This, expression, msec, language, timerID);
+    TRACE("(%p)->(%p %ld %p %p)\n", This, expression, msec, language, timerID);
 
     return window_set_timer(This->inner_window, expression, msec, language, TIMER_INTERVAL, timerID);
 }
@@ -2365,7 +2365,7 @@ static HRESULT WINAPI HTMLWindow7_getComputedStyle(IHTMLWindow7 *iface, IHTMLDOM
     IHTMLElement_Release(elem);
     nsAString_Finish(&pseudo_elt_str);
     if(NS_FAILED(nsres)) {
-        FIXME("GetComputedStyle failed: %08x\n", nsres);
+        FIXME("GetComputedStyle failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2435,7 +2435,7 @@ static HRESULT WINAPI HTMLWindow7_get_innerWidth(IHTMLWindow7 *iface, LONG *p)
 
     nsres = nsIDOMWindow_GetInnerWidth(This->outer_window->nswindow, &ret);
     if(NS_FAILED(nsres)) {
-        ERR("GetInnerWidth failed: %08x\n", nsres);
+        ERR("GetInnerWidth failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2453,7 +2453,7 @@ static HRESULT WINAPI HTMLWindow7_get_innerHeight(IHTMLWindow7 *iface, LONG *p)
 
     nsres = nsIDOMWindow_GetInnerHeight(This->outer_window->nswindow, &ret);
     if(NS_FAILED(nsres)) {
-        ERR("GetInnerWidth failed: %08x\n", nsres);
+        ERR("GetInnerWidth failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2471,7 +2471,7 @@ static HRESULT WINAPI HTMLWindow7_get_pageXOffset(IHTMLWindow7 *iface, LONG *p)
 
     nsres = nsIDOMWindow_GetPageXOffset(This->outer_window->nswindow, &ret);
     if(NS_FAILED(nsres)) {
-        ERR("GetPageXOffset failed: %08x\n", nsres);
+        ERR("GetPageXOffset failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2489,7 +2489,7 @@ static HRESULT WINAPI HTMLWindow7_get_pageYOffset(IHTMLWindow7 *iface, LONG *p)
 
     nsres = nsIDOMWindow_GetPageYOffset(This->outer_window->nswindow, &ret);
     if(NS_FAILED(nsres)) {
-        ERR("GetPageYOffset failed: %08x\n", nsres);
+        ERR("GetPageYOffset failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2774,7 +2774,7 @@ static HRESULT WINAPI HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow *iface,
     IUri *uri;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %s %s %s %s %s %x)\n", This, debugstr_w(url), debugstr_w(arg2), debugstr_w(arg3), debugstr_w(arg4),
+    TRACE("(%p)->(%s %s %s %s %s %s %lx)\n", This, debugstr_w(url), debugstr_w(arg2), debugstr_w(arg3), debugstr_w(arg4),
           debugstr_variant(post_data_var), debugstr_variant(headers_var), flags);
 
     if(!window || !window->browser)
@@ -2895,7 +2895,7 @@ static HRESULT WINAPI TravelLogClient_FindWindowByIndex(ITravelLogClient *iface,
 {
     HTMLWindow *This = impl_from_ITravelLogClient(iface);
 
-    FIXME("(%p)->(%d %p) semi-stub\n", This, dwID, ppunk);
+    FIXME("(%p)->(%ld %p) semi-stub\n", This, dwID, ppunk);
 
     *ppunk = NULL;
     return E_FAIL;
@@ -2911,7 +2911,7 @@ static HRESULT WINAPI TravelLogClient_GetWindowData(ITravelLogClient *iface, ISt
 static HRESULT WINAPI TravelLogClient_LoadHistoryPosition(ITravelLogClient *iface, LPWSTR pszUrlLocation, DWORD dwPosition)
 {
     HTMLWindow *This = impl_from_ITravelLogClient(iface);
-    FIXME("(%p)->(%s %d)\n", This, debugstr_w(pszUrlLocation), dwPosition);
+    FIXME("(%p)->(%s %ld)\n", This, debugstr_w(pszUrlLocation), dwPosition);
     return E_NOTIMPL;
 }
 
@@ -3009,7 +3009,7 @@ static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo *i
 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo *iface, DWORD dwGuidKind, GUID *pGUID)
 {
     HTMLWindow *This = impl_from_IProvideMultipleClassInfo(iface);
-    FIXME("(%p)->(%u %p)\n", This, dwGuidKind, pGUID);
+    FIXME("(%p)->(%lu %p)\n", This, dwGuidKind, pGUID);
     return E_NOTIMPL;
 }
 
@@ -3025,7 +3025,7 @@ static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleCl
         DWORD dwFlags, ITypeInfo **pptiCoClass, DWORD *pdwTIFlags, ULONG *pcdispidReserved, IID *piidPrimary, IID *piidSource)
 {
     HTMLWindow *This = impl_from_IProvideMultipleClassInfo(iface);
-    FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
+    FIXME("(%p)->(%lu %lx %p %p %p %p %p)\n", This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource);
     return E_NOTIMPL;
 }
 
@@ -3274,7 +3274,7 @@ static HRESULT WINAPI WindowDispEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
+    TRACE("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
 
     return IDispatchEx_GetTypeInfo(&This->inner_window->event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
 }
@@ -3287,7 +3287,7 @@ static HRESULT WINAPI WindowDispEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid
     UINT i;
     HRESULT hres;
 
-    WARN("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
+    WARN("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
 
     for(i=0; i < cNames; i++) {
         /* We shouldn't use script's IDispatchEx here, so we shouldn't use GetDispID */
@@ -3305,7 +3305,7 @@ static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMembe
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
+    TRACE("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
           lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 
     /* FIXME: Use script dispatch */
@@ -3383,7 +3383,7 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName,
     HTMLInnerWindow *window = This->inner_window;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
+    TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(bstrName), grfdex, pid);
 
     hres = search_window_props(window, bstrName, grfdex, pid);
     if(hres != DISP_E_UNKNOWNNAME)
@@ -3438,7 +3438,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
     HTMLWindow *This = impl_from_IDispatchEx(iface);
     HTMLInnerWindow *window = This->inner_window;
 
-    TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
+    TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
 
     switch(id) {
     case DISPID_IHTMLWINDOW2_LOCATION: {
@@ -3488,7 +3488,7 @@ static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR b
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
+    TRACE("(%p)->(%s %lx)\n", This, debugstr_w(bstrName), grfdex);
 
     return IDispatchEx_DeleteMemberByName(&This->inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex);
 }
@@ -3497,7 +3497,7 @@ static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISP
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%x)\n", This, id);
+    TRACE("(%p)->(%lx)\n", This, id);
 
     return IDispatchEx_DeleteMemberByDispID(&This->inner_window->event_target.dispex.IDispatchEx_iface, id);
 }
@@ -3506,7 +3506,7 @@ static HRESULT WINAPI WindowDispEx_GetMemberProperties(IDispatchEx *iface, DISPI
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
+    TRACE("(%p)->(%lx %lx %p)\n", This, id, grfdexFetch, pgrfdex);
 
     return IDispatchEx_GetMemberProperties(&This->inner_window->event_target.dispex.IDispatchEx_iface, id, grfdexFetch,
             pgrfdex);
@@ -3516,7 +3516,7 @@ static HRESULT WINAPI WindowDispEx_GetMemberName(IDispatchEx *iface, DISPID id,
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%x %p)\n", This, id, pbstrName);
+    TRACE("(%p)->(%lx %p)\n", This, id, pbstrName);
 
     return IDispatchEx_GetMemberName(&This->inner_window->event_target.dispex.IDispatchEx_iface, id, pbstrName);
 }
@@ -3525,7 +3525,7 @@ static HRESULT WINAPI WindowDispEx_GetNextDispID(IDispatchEx *iface, DWORD grfde
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
 
-    TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
+    TRACE("(%p)->(%lx %lx %p)\n", This, grfdex, id, pid);
 
     return IDispatchEx_GetNextDispID(&This->inner_window->event_target.dispex.IDispatchEx_iface, grfdex, id, pid);
 }
@@ -3641,7 +3641,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
             if(hres == S_OK)
                 TRACE("%s <<<\n", debugstr_w(prop->name));
             else
-                WARN("%s <<< %08x\n", debugstr_w(prop->name), hres);
+                WARN("%s <<< %08lx\n", debugstr_w(prop->name), hres);
             IDispatchEx_Release(iface);
         }else {
             FIXME("No IDispatchEx\n");
@@ -3929,14 +3929,14 @@ HRESULT update_window_doc(HTMLInnerWindow *window)
 
     nsres = nsIDOMWindow_GetDocument(outer_window->nswindow, &nsdoc);
     if(NS_FAILED(nsres) || !nsdoc) {
-        ERR("GetDocument failed: %08x\n", nsres);
+        ERR("GetDocument failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
     nsIDOMDocument_Release(nsdoc);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres);
+        ERR("Could not get nsIDOMHTMLDocument iface: %08lx\n", nsres);
         return E_FAIL;
     }
 
diff --git a/dlls/mshtml/ifacewrap.c b/dlls/mshtml/ifacewrap.c
index 519053e223f..502ba80604a 100644
--- a/dlls/mshtml/ifacewrap.c
+++ b/dlls/mshtml/ifacewrap.c
@@ -63,7 +63,7 @@ static ULONG WINAPI wrapper_AddRef(IUnknown *iface)
     iface_wrapper_t *This = impl_from_IUnknown(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -73,7 +73,7 @@ static ULONG WINAPI wrapper_Release(IUnknown *iface)
     iface_wrapper_t *This = impl_from_IUnknown(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         IUnknown_Release(This->iface);
diff --git a/dlls/mshtml/loadopts.c b/dlls/mshtml/loadopts.c
index 5b2697f2ce2..7bea46924ed 100644
--- a/dlls/mshtml/loadopts.c
+++ b/dlls/mshtml/loadopts.c
@@ -82,7 +82,7 @@ static ULONG WINAPI HtmlLoadOptions_AddRef(IHtmlLoadOptions *iface)
     HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -92,7 +92,7 @@ static ULONG WINAPI HtmlLoadOptions_Release(IHtmlLoadOptions *iface)
     HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         load_opt *iter = This->opts, *last;
@@ -117,7 +117,7 @@ static HRESULT WINAPI HtmlLoadOptions_QueryOption(IHtmlLoadOptions *iface, DWORD
     HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
     load_opt *iter;
 
-    TRACE("(%p)->(%d %p %p)\n", This, dwOption, pBuffer, pcbBuf);
+    TRACE("(%p)->(%ld %p %p)\n", This, dwOption, pBuffer, pcbBuf);
 
     for(iter = This->opts; iter; iter = iter->next) {
         if(iter->option == dwOption)
@@ -146,7 +146,7 @@ static HRESULT WINAPI HtmlLoadOptions_SetOption(IHtmlLoadOptions *iface, DWORD d
     HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
     load_opt *iter = NULL;
 
-    TRACE("(%p)->(%d %p %d)\n", This, dwOption, pBuffer, cbBuf);
+    TRACE("(%p)->(%ld %p %ld)\n", This, dwOption, pBuffer, cbBuf);
 
     for(iter = This->opts; iter; iter = iter->next) {
         if(iter->option == dwOption)
diff --git a/dlls/mshtml/main.c b/dlls/mshtml/main.c
index f2a255d265a..bbaed1f1967 100644
--- a/dlls/mshtml/main.c
+++ b/dlls/mshtml/main.c
@@ -102,7 +102,7 @@ UINT cp_from_charset_string(BSTR charset)
 
     hres = IMultiLanguage2_GetCharsetInfo(mlang, charset, &info);
     if(FAILED(hres)) {
-        FIXME("GetCharsetInfo failed: %08x\n", hres);
+        FIXME("GetCharsetInfo failed: %08lx\n", hres);
         return CP_UTF8;
     }
 
@@ -119,7 +119,7 @@ BSTR charset_string_from_cp(UINT cp)
 
     hres = IMultiLanguage2_GetCodePageInfo(mlang, cp, GetUserDefaultUILanguage(), &info);
     if(FAILED(hres)) {
-        ERR("GetCodePageInfo failed: %08x\n", hres);
+        ERR("GetCodePageInfo failed: %08lx\n", hres);
         return SysAllocString(NULL);
     }
 
@@ -182,7 +182,7 @@ static BOOL WINAPI load_compat_settings(INIT_ONCE *once, void *param, void **con
             break;
         index++;
         if(res != ERROR_SUCCESS) {
-            WARN("RegEnumKey failed: %u\n", GetLastError());
+            WARN("RegEnumKey failed: %lu\n", GetLastError());
             continue;
         }
 
@@ -397,7 +397,7 @@ static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
 {
     ClassFactory *This = impl_from_IClassFactory(iface);
     ULONG ref = InterlockedIncrement(&This->ref);
-    TRACE("(%p) ref = %u\n", This, ref);
+    TRACE("(%p) ref = %lu\n", This, ref);
     return ref;
 }
 
@@ -406,7 +406,7 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
     ClassFactory *This = impl_from_IClassFactory(iface);
     ULONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref = %u\n", This, ref);
+    TRACE("(%p) ref = %lu\n", This, ref);
 
     if(!ref) {
         heap_free(This);
@@ -647,7 +647,7 @@ static HRESULT register_server(BOOL do_register)
         heap_free(pse[i].pszValue);
 
     if(FAILED(hres))
-        ERR("RegInstall failed: %08x\n", hres);
+        ERR("RegInstall failed: %08lx\n", hres);
 
     return hres;
 }
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c
index 4352e93eba3..3355139ad31 100644
--- a/dlls/mshtml/mutation.c
+++ b/dlls/mshtml/mutation.c
@@ -180,7 +180,7 @@ static nsresult run_insert_comment(HTMLDocumentNode *doc, nsISupports *comment_i
 
     nsres = nsISupports_QueryInterface(comment_iface, &IID_nsIDOMComment, (void**)&nscomment);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDOMComment iface:%08x\n", nsres);
+        ERR("Could not get nsIDOMComment iface:%08lx\n", nsres);
         return nsres;
     }
 
@@ -312,14 +312,14 @@ static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_ifa
 
     nsres = nsISupports_QueryInterface(script_iface, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
+        ERR("Could not get nsIDOMHTMLScriptElement: %08lx\n", nsres);
         return nsres;
     }
 
     if(parser_iface) {
         nsres = nsISupports_QueryInterface(parser_iface, &IID_nsIParser, (void**)&nsparser);
         if(NS_FAILED(nsres)) {
-            ERR("Could not get nsIParser iface: %08x\n", nsres);
+            ERR("Could not get nsIParser iface: %08lx\n", nsres);
             nsparser = NULL;
         }
     }
@@ -472,7 +472,7 @@ void process_document_response_headers(HTMLDocumentNode *doc, IBinding *binding)
         compat_mode_t document_mode;
         WCHAR *header;
 
-        TRACE("size %u\n", size);
+        TRACE("size %lu\n", size);
 
         header = heap_strdupAtoW(buf);
         if(header && parse_ua_compatible(header, &document_mode)) {
@@ -564,7 +564,7 @@ static nsrefcnt NSAPI nsRunnable_AddRef(nsIRunnable *iface)
     nsRunnable *This = impl_from_nsIRunnable(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -574,7 +574,7 @@ static nsrefcnt NSAPI nsRunnable_Release(nsIRunnable *iface)
     nsRunnable *This = impl_from_nsIRunnable(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         htmldoc_release(&This->doc->basedoc);
@@ -939,7 +939,7 @@ void init_document_mutation(HTMLDocumentNode *doc)
 
     nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDocument, (void**)&nsdoc);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDocument: %08x\n", nsres);
+        ERR("Could not get nsIDocument: %08lx\n", nsres);
         return;
     }
 
@@ -954,7 +954,7 @@ void release_document_mutation(HTMLDocumentNode *doc)
 
     nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDocument, (void**)&nsdoc);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDocument: %08x\n", nsres);
+        ERR("Could not get nsIDocument: %08lx\n", nsres);
         return;
     }
 
@@ -994,12 +994,12 @@ void init_mutation(nsIComponentManager *component_manager)
     nsres = nsIComponentManager_GetClassObject(component_manager, &NS_ICONTENTUTILS_CID,
             &IID_nsIFactory, (void**)&factory);
     if(NS_FAILED(nsres)) {
-        ERR("Could not create nsIContentUtils service: %08x\n", nsres);
+        ERR("Could not create nsIContentUtils service: %08lx\n", nsres);
         return;
     }
 
     nsres = nsIFactory_CreateInstance(factory, NULL, &IID_nsIContentUtils, (void**)&content_utils);
     nsIFactory_Release(factory);
     if(NS_FAILED(nsres))
-        ERR("Could not create nsIContentUtils instance: %08x\n", nsres);
+        ERR("Could not create nsIContentUtils instance: %08lx\n", nsres);
 }
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 8cbe0ec9304..e750ff28ee1 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -88,7 +88,7 @@ static nsrefcnt NSAPI nsInputStream_AddRef(nsIInputStream *iface)
     nsProtocolStream *This = impl_from_nsIInputStream(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -99,7 +99,7 @@ static nsrefcnt NSAPI nsInputStream_Release(nsIInputStream *iface)
     nsProtocolStream *This = impl_from_nsIInputStream(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -161,9 +161,9 @@ static nsresult NSAPI nsInputStream_ReadSegments(nsIInputStream *iface,
 
     nsres = aWriter(&This->nsIInputStream_iface, aClousure, This->buf, 0, aCount, &written);
     if(NS_FAILED(nsres))
-        TRACE("aWriter failed: %08x\n", nsres);
+        TRACE("aWriter failed: %08lx\n", nsres);
     else if(written != This->buf_size)
-        FIXME("written %d != buf_size %d\n", written, This->buf_size);
+        FIXME("written %d != buf_size %ld\n", written, This->buf_size);
 
     This->buf_size -= written; 
 
@@ -261,7 +261,7 @@ static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
     BSCallback *This = impl_from_IBindStatusCallback(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref = %d\n", This, ref);
+    TRACE("(%p) ref = %ld\n", This, ref);
 
     return ref;
 }
@@ -271,7 +271,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
     BSCallback *This = impl_from_IBindStatusCallback(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref = %d\n", This, ref);
+    TRACE("(%p) ref = %ld\n", This, ref);
 
     if(!ref) {
         release_request_data(&This->request_data);
@@ -293,7 +293,7 @@ static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *ifa
 {
     BSCallback *This = impl_from_IBindStatusCallback(iface);
 
-    TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind);
+    TRACE("(%p)->(%ld %p)\n", This, dwReserved, pbind);
 
     IBinding_AddRef(pbind);
     This->binding = pbind;
@@ -314,7 +314,7 @@ static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface,
 static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
 {
     BSCallback *This = impl_from_IBindStatusCallback(iface);
-    FIXME("(%p)->(%d)\n", This, reserved);
+    FIXME("(%p)->(%ld)\n", This, reserved);
     return E_NOTIMPL;
 }
 
@@ -323,7 +323,7 @@ static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface,
 {
     BSCallback *This = impl_from_IBindStatusCallback(iface);
 
-    TRACE("%p)->(%u %u %u %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
+    TRACE("%p)->(%lu %lu %lu %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
             debugstr_w(szStatusText));
 
     return This->vtbl->on_progress(This, ulStatusCode, szStatusText);
@@ -335,7 +335,7 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac
     BSCallback *This = impl_from_IBindStatusCallback(iface);
     HRESULT hres;
 
-    TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
+    TRACE("(%p)->(%08lx %s)\n", This, hresult, debugstr_w(szError));
 
     /* NOTE: IE7 calls GetBindResult here */
 
@@ -403,7 +403,7 @@ static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *if
 {
     BSCallback *This = impl_from_IBindStatusCallback(iface);
 
-    TRACE("(%p)->(%08x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
+    TRACE("(%p)->(%08lx %ld %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
 
     return This->vtbl->read_data(This, pstgmed->u.pstm);
 }
@@ -460,7 +460,7 @@ static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface,
     BSCallback *This = impl_from_IHttpNegotiate2(iface);
     HRESULT hres;
 
-    TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders),
+    TRACE("(%p)->(%s %s %ld %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders),
           dwReserved, pszAdditionalHeaders);
 
     *pszAdditionalHeaders = NULL;
@@ -487,7 +487,7 @@ static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD dwR
 {
     BSCallback *This = impl_from_IHttpNegotiate2(iface);
 
-    TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
+    TRACE("(%p)->(%ld %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
           debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
 
     return This->vtbl->on_response(This, dwResponseCode, szResponseHeaders);
@@ -497,7 +497,7 @@ static HRESULT WINAPI HttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface,
         BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
 {
     BSCallback *This = impl_from_IHttpNegotiate2(iface);
-    TRACE("(%p)->(%p %p %ld)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
+    TRACE("(%p)->(%p %p %Id)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
     return E_NOTIMPL; /* FIXME */
 }
 
@@ -546,7 +546,7 @@ static HRESULT WINAPI InternetBindInfo_GetBindString(IInternetBindInfo *iface,
         ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
 {
     BSCallback *This = impl_from_IInternetBindInfo(iface);
-    FIXME("(%p)->(%u %p %u %p)\n", This, ulStringType, ppwzStr, cEl, pcElFetched);
+    FIXME("(%p)->(%lu %p %lu %p)\n", This, ulStringType, ppwzStr, cEl, pcElFetched);
     return E_NOTIMPL;
 }
 
@@ -863,7 +863,7 @@ HRESULT start_binding(HTMLInnerWindow *inner_window, BSCallback *bscallback, IBi
     hres = IMoniker_BindToStorage(bscallback->mon, bctx, NULL, &IID_IStream, (void**)&str);
     IBindCtx_Release(bctx);
     if(FAILED(hres)) {
-        WARN("BindToStorage failed: %08x\n", hres);
+        WARN("BindToStorage failed: %08lx\n", hres);
         bscallback->window = NULL;
         return hres;
     }
@@ -990,7 +990,7 @@ static HRESULT on_start_nsrequest(nsChannelBSC *This)
     nsres = nsIStreamListener_OnStartRequest(This->nslistener,
             (nsIRequest*)&This->nschannel->nsIHttpChannel_iface, This->nscontext);
     if(NS_FAILED(nsres)) {
-        FIXME("OnStartRequest failed: %08x\n", nsres);
+        FIXME("OnStartRequest failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1032,7 +1032,7 @@ static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
                  (nsIRequest*)&This->nschannel->nsIHttpChannel_iface, This->nscontext,
                  request_result);
         if(NS_FAILED(nsres))
-            WARN("OnStopRequest failed: %08x\n", nsres);
+            WARN("OnStopRequest failed: %08lx\n", nsres);
     }
 
     if(This->nschannel) {
@@ -1040,7 +1040,7 @@ static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
             nsres = nsILoadGroup_RemoveRequest(This->nschannel->load_group,
                     (nsIRequest*)&This->nschannel->nsIHttpChannel_iface, NULL, request_result);
             if(NS_FAILED(nsres))
-                ERR("RemoveRequest failed: %08x\n", nsres);
+                ERR("RemoveRequest failed: %08lx\n", nsres);
         }
         if(This->nschannel->binding == This)
             This->nschannel->binding = NULL;
@@ -1132,7 +1132,7 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
                 &This->nsstream->nsIInputStream_iface, This->bsc.read-This->nsstream->buf_size,
                 This->nsstream->buf_size);
         if(NS_FAILED(nsres))
-            ERR("OnDataAvailable failed: %08x\n", nsres);
+            ERR("OnDataAvailable failed: %08lx\n", nsres);
 
         if(This->nsstream->buf_size == sizeof(This->nsstream->buf)) {
             ERR("buffer is full\n");
@@ -1183,7 +1183,7 @@ static nsrefcnt NSAPI nsAsyncVerifyRedirectCallback_AddRef(nsIAsyncVerifyRedirec
     nsRedirectCallback *This = impl_from_nsIAsyncVerifyRedirectCallback(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1193,7 +1193,7 @@ static nsrefcnt NSAPI nsAsyncVerifyRedirectCallback_Release(nsIAsyncVerifyRedire
     nsRedirectCallback *This = impl_from_nsIAsyncVerifyRedirectCallback(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         IBindStatusCallback_Release(&This->bsc->bsc.IBindStatusCallback_iface);
@@ -1210,7 +1210,7 @@ static nsresult NSAPI nsAsyncVerifyRedirectCallback_OnRedirectVerifyCallback(nsI
     nsChannel *old_nschannel;
     nsresult nsres;
 
-    TRACE("(%p)->(%08x)\n", This, result);
+    TRACE("(%p)->(%08lx)\n", This, result);
 
     old_nschannel = This->bsc->nschannel;
     nsIHttpChannel_AddRef(&This->nschannel->nsIHttpChannel_iface);
@@ -1220,7 +1220,7 @@ static nsresult NSAPI nsAsyncVerifyRedirectCallback_OnRedirectVerifyCallback(nsI
         nsres = nsILoadGroup_AddRequest(This->nschannel->load_group, (nsIRequest*)&This->nschannel->nsIHttpChannel_iface,
                 NULL);
         if(NS_FAILED(nsres))
-            ERR("AddRequest failed: %08x\n", nsres);
+            ERR("AddRequest failed: %08lx\n", nsres);
     }
 
     if(This->bsc->is_doc_channel && This->bsc->bsc.window && This->bsc->bsc.window->base.outer_window) {
@@ -1239,7 +1239,7 @@ static nsresult NSAPI nsAsyncVerifyRedirectCallback_OnRedirectVerifyCallback(nsI
             nsres = nsILoadGroup_RemoveRequest(old_nschannel->load_group,
                     (nsIRequest*)&old_nschannel->nsIHttpChannel_iface, NULL, NS_OK);
             if(NS_FAILED(nsres))
-                ERR("RemoveRequest failed: %08x\n", nsres);
+                ERR("RemoveRequest failed: %08lx\n", nsres);
         }
         nsIHttpChannel_Release(&old_nschannel->nsIHttpChannel_iface);
     }
@@ -1524,7 +1524,7 @@ static HRESULT handle_redirect(nsChannelBSC *This, const WCHAR *new_url)
                 &callback->nsIAsyncVerifyRedirectCallback_iface);
 
         if(NS_FAILED(nsres))
-            FIXME("AsyncOnChannelRedirect failed: %08x\n", hres);
+            FIXME("AsyncOnChannelRedirect failed: %08lx\n", hres);
         else if(This->nschannel != callback->nschannel)
             FIXME("nschannel not updated\n");
 
@@ -1717,7 +1717,7 @@ static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code,
         headers = wcschr(response_headers, '\r');
         hres = process_response_status_text(response_headers, headers, &str);
         if(FAILED(hres)) {
-            WARN("parsing headers failed: %08x\n", hres);
+            WARN("parsing headers failed: %08lx\n", hres);
             return hres;
         }
 
@@ -1728,7 +1728,7 @@ static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code,
             headers += 2;
             hres = process_response_headers(This, headers);
             if(FAILED(hres)) {
-                WARN("parsing headers failed: %08x\n", hres);
+                WARN("parsing headers failed: %08lx\n", hres);
                 return hres;
             }
         }
@@ -1959,7 +1959,7 @@ void channelbsc_set_channel(nsChannelBSC *This, nsChannel *channel, nsIStreamLis
         heap_free(This->bsc.request_data.headers);
         This->bsc.request_data.headers = NULL;
         if(FAILED(hres))
-            WARN("parse_headers failed: %08x\n", hres);
+            WARN("parse_headers failed: %08lx\n", hres);
     }
 }
 
@@ -2072,7 +2072,7 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri)
     nsAString_Finish(&nsfrag_str);
     nsIDOMLocation_Release(nslocation);
     if(NS_FAILED(nsres))
-        ERR("SetHash failed: %08x\n", nsres);
+        ERR("SetHash failed: %08lx\n", nsres);
 
     /*
      * IE supports scrolling to anchor elements with "#hash" ids (note that '#' is part of the id),
@@ -2309,7 +2309,7 @@ HRESULT navigate_new_window(HTMLOuterWindow *window, IUri *uri, const WCHAR *nam
             IWebBrowser2_Release(web_browser);
         }
     }else {
-        WARN("Could not create InternetExplorer instance: %08x\n", hres);
+        WARN("Could not create InternetExplorer instance: %08lx\n", hres);
     }
 
     IBindStatusCallback_Release(&bsc->bsc.IBindStatusCallback_iface);
@@ -2472,7 +2472,7 @@ static HRESULT translate_uri(HTMLOuterWindow *window, IUri *orig_uri, BSTR *ret_
         hres = IDocHostUIHandler_TranslateUrl(window->browser->doc->hostui, 0, display_uri,
                 &translated_url);
         if(hres == S_OK && translated_url) {
-            TRACE("%08x %s -> %s\n", hres, debugstr_w(display_uri), debugstr_w(translated_url));
+            TRACE("%08lx %s -> %s\n", hres, debugstr_w(display_uri), debugstr_w(translated_url));
             SysFreeString(display_uri);
             hres = create_uri(translated_url, 0, &uri);
             CoTaskMemFree(translated_url);
diff --git a/dlls/mshtml/npplugin.c b/dlls/mshtml/npplugin.c
index dc34727cdb5..a1c38e5ed1a 100644
--- a/dlls/mshtml/npplugin.c
+++ b/dlls/mshtml/npplugin.c
@@ -218,14 +218,14 @@ static nsIDOMElement *get_dom_element(NPP instance)
 
     nsres = nsISupports_QueryInterface(instance_unk, &IID_nsIPluginInstance, (void**)&plugin_instance);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIPluginInstance interface: %08x\n", nsres);
+        ERR("Could not get nsIPluginInstance interface: %08lx\n", nsres);
         return NULL;
     }
 
     nsres = nsIPluginInstance_GetDOMElement(plugin_instance, &elem);
     nsIPluginInstance_Release(plugin_instance);
     if(NS_FAILED(nsres)) {
-        ERR("GetDOMElement failed: %08x\n", nsres);
+        ERR("GetDOMElement failed: %08lx\n", nsres);
         return NULL;
     }
 
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 32ae792625c..e34861b13fa 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -102,7 +102,7 @@ nsresult create_nsfile(const PRUnichar *path, nsIFile **ret)
     nsAString_Finish(&str);
 
     if(NS_FAILED(nsres))
-        WARN("NS_NewLocalFile failed: %08x\n", nsres);
+        WARN("NS_NewLocalFile failed: %08lx\n", nsres);
     return nsres;
 }
 
@@ -142,7 +142,7 @@ static nsrefcnt NSAPI nsSingletonEnumerator_AddRef(nsISimpleEnumerator *iface)
     nsSingletonEnumerator *This = impl_from_nsISimpleEnumerator(iface);
     nsrefcnt ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -152,7 +152,7 @@ static nsrefcnt NSAPI nsSingletonEnumerator_Release(nsISimpleEnumerator *iface)
     nsSingletonEnumerator *This = impl_from_nsISimpleEnumerator(iface);
     nsrefcnt ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->value)
@@ -253,7 +253,7 @@ static nsresult create_profile_directory(void)
 
     hres = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path);
     if(FAILED(hres)) {
-        ERR("SHGetFolderPath failed: %08x\n", hres);
+        ERR("SHGetFolderPath failed: %08lx\n", hres);
         return NS_ERROR_FAILURE;
     }
 
@@ -264,14 +264,14 @@ static nsresult create_profile_directory(void)
 
     nsres = nsIFile_Exists(profile_directory, &exists);
     if(NS_FAILED(nsres)) {
-        ERR("Exists failed: %08x\n", nsres);
+        ERR("Exists failed: %08lx\n", nsres);
         return nsres;
     }
 
     if(!exists) {
         nsres = nsIFile_Create(profile_directory, 1, 0700);
         if(NS_FAILED(nsres))
-            ERR("Create failed: %08x\n", nsres);
+            ERR("Create failed: %08lx\n", nsres);
     }
 
     return nsres;
@@ -369,7 +369,7 @@ static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
         nsres = nsIBaseWindow_SetSize(This->window,
                 LOWORD(lParam), HIWORD(lParam), TRUE);
         if(NS_FAILED(nsres))
-            WARN("SetSize failed: %08x\n", nsres);
+            WARN("SetSize failed: %08lx\n", nsres);
         break;
 
     case WM_PARENTNOTIFY:
@@ -533,7 +533,7 @@ static void set_preferences(void)
     nsres = nsIServiceManager_GetServiceByContractID(pServMgr, NS_PREFERENCES_CONTRACTID,
             &IID_nsIPrefBranch, (void**)&pref);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get preference service: %08x\n", nsres);
+        ERR("Could not get preference service: %08lx\n", nsres);
         return;
     }
 
@@ -560,7 +560,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
 
     nsres = NS_InitXPCOM2(&pServMgr, gre_dir, (nsIDirectoryServiceProvider*)&nsDirectoryServiceProvider2);
     if(NS_FAILED(nsres)) {
-        ERR("NS_InitXPCOM2 failed: %08x\n", nsres);
+        ERR("NS_InitXPCOM2 failed: %08lx\n", nsres);
         FreeLibrary(xul_handle);
         return FALSE;
     }
@@ -574,7 +574,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
 
     nsres = nsIServiceManager_QueryInterface(pServMgr, &IID_nsIComponentManager, (void**)&pCompMgr);
     if(NS_FAILED(nsres))
-        ERR("Could not get nsIComponentManager: %08x\n", nsres);
+        ERR("Could not get nsIComponentManager: %08lx\n", nsres);
 
     init_nsio(pCompMgr);
     init_mutation(pCompMgr);
@@ -583,14 +583,14 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
     nsres = nsIServiceManager_GetServiceByContractID(pServMgr, NS_CATEGORYMANAGER_CONTRACTID,
             &IID_nsICategoryManager, (void**)&cat_mgr);
     if(NS_FAILED(nsres))
-        ERR("Could not get category manager service: %08x\n", nsres);
+        ERR("Could not get category manager service: %08lx\n", nsres);
 
     nsres = NS_GetComponentRegistrar(&registrar);
     if(NS_SUCCEEDED(nsres)) {
         register_nsservice(registrar, pServMgr);
         nsIComponentRegistrar_Release(registrar);
     }else {
-        ERR("NS_GetComponentRegistrar failed: %08x\n", nsres);
+        ERR("NS_GetComponentRegistrar failed: %08lx\n", nsres);
     }
 
     init_node_cc();
@@ -611,7 +611,7 @@ static BOOL load_xul(WCHAR *gecko_path)
     xul_handle = LoadLibraryExW(gecko_path, 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
     gecko_path[len] = 0;
     if(!xul_handle) {
-        WARN("Could not load XUL: %d\n", GetLastError());
+        WARN("Could not load XUL: %ld\n", GetLastError());
         return FALSE;
     }
 
@@ -920,7 +920,7 @@ HRESULT return_nsstr(nsresult nsres, nsAString *nsstr, BSTR *p)
     HRESULT hres = S_OK;
 
     if(NS_FAILED(nsres)) {
-        WARN("failed: %08x\n", nsres);
+        WARN("failed: %08lx\n", nsres);
         nsAString_Finish(nsstr);
         return map_nsresult(nsres);
     }
@@ -944,7 +944,7 @@ HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, unsigned flags, V
     HRESULT hres = S_OK;
 
     if(NS_FAILED(nsres)) {
-        ERR("failed: %08x\n", nsres);
+        ERR("failed: %08lx\n", nsres);
         nsAString_Finish(nsstr);
         return map_nsresult(nsres);
     }
@@ -1107,14 +1107,14 @@ static HRESULT nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNo
 
     nsres = nsIDOMNode_GetNodeType(nsnode, &type);
     if(NS_FAILED(nsres)) {
-        ERR("GetType failed: %08x\n", nsres);
+        ERR("GetType failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     if(type != DOCUMENT_NODE) {
         nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIContent, (void**)&nscontent);
         if(NS_FAILED(nsres)) {
-            ERR("Could not get nsIContent interface: %08x\n", nsres);
+            ERR("Could not get nsIContent interface: %08lx\n", nsres);
             return E_FAIL;
         }
     }
@@ -1158,7 +1158,7 @@ static HRESULT nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNo
                 nsnode_to_nsstring_rec(serializer, child_node, str);
                 nsIDOMNode_Release(child_node);
             }else {
-                ERR("Item failed: %08x\n", nsres);
+                ERR("Item failed: %08lx\n", nsres);
             }
         }
 
@@ -1183,19 +1183,19 @@ HRESULT nsnode_to_nsstring(nsIDOMNode *nsnode, nsAString *str)
             NS_HTMLSERIALIZER_CONTRACTID, NULL, &IID_nsIContentSerializer,
             (void**)&serializer);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIContentSerializer: %08x\n", nsres);
+        ERR("Could not get nsIContentSerializer: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIContentSerializer_Init(serializer, 0, 100, NULL, FALSE, FALSE /* FIXME */);
     if(NS_FAILED(nsres))
-        ERR("Init failed: %08x\n", nsres);
+        ERR("Init failed: %08lx\n", nsres);
 
     hres = nsnode_to_nsstring_rec(serializer, nsnode, str);
     if(SUCCEEDED(hres)) {
         nsres = nsIContentSerializer_Flush(serializer, str);
         if(NS_FAILED(nsres))
-            ERR("Flush failed: %08x\n", nsres);
+            ERR("Flush failed: %08lx\n", nsres);
     }
 
     nsIContentSerializer_Release(serializer);
@@ -1221,7 +1221,7 @@ void setup_editor_controller(GeckoBrowser *This)
     nsres = get_nsinterface((nsISupports*)This->webbrowser, &IID_nsIEditingSession,
             (void**)&editing_session);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIEditingSession: %08x\n", nsres);
+        ERR("Could not get nsIEditingSession: %08lx\n", nsres);
         return;
     }
 
@@ -1229,7 +1229,7 @@ void setup_editor_controller(GeckoBrowser *This)
             This->doc->basedoc.window->window_proxy, &This->editor);
     nsIEditingSession_Release(editing_session);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get editor: %08x\n", nsres);
+        ERR("Could not get editor: %08lx\n", nsres);
         return;
     }
 
@@ -1238,14 +1238,14 @@ void setup_editor_controller(GeckoBrowser *This)
     if(NS_SUCCEEDED(nsres)) {
         nsres = nsIControllerContext_SetCommandContext(ctrlctx, (nsISupports *)This->editor);
         if(NS_FAILED(nsres))
-            ERR("SetCommandContext failed: %08x\n", nsres);
+            ERR("SetCommandContext failed: %08lx\n", nsres);
         nsres = nsIControllerContext_QueryInterface(ctrlctx, &IID_nsIController,
                 (void**)&This->editor_controller);
         nsIControllerContext_Release(ctrlctx);
         if(NS_FAILED(nsres))
-            ERR("Could not get nsIController interface: %08x\n", nsres);
+            ERR("Could not get nsIController interface: %08lx\n", nsres);
     }else {
-        ERR("Could not create edit controller: %08x\n", nsres);
+        ERR("Could not create edit controller: %08lx\n", nsres);
     }
 }
 
@@ -1320,7 +1320,7 @@ void set_viewer_zoom(GeckoBrowser *browser, float factor)
 
     nsres = nsIContentViewer_SetFullZoom(content_viewer, factor);
     if(NS_FAILED(nsres))
-        ERR("SetFullZoom failed: %08x\n", nsres);
+        ERR("SetFullZoom failed: %08lx\n", nsres);
 
     nsIContentViewer_Release(content_viewer);
 }
@@ -1341,7 +1341,7 @@ float get_viewer_zoom(GeckoBrowser *browser)
 
     nsres = nsIContentViewer_GetFullZoom(content_viewer, &factor);
     if(NS_FAILED(nsres))
-        ERR("GetFullZoom failed: %08x\n", nsres);
+        ERR("GetFullZoom failed: %08lx\n", nsres);
     TRACE("Got %f\n", factor);
 
     nsIContentViewer_Release(content_viewer);
@@ -1387,7 +1387,7 @@ static nsrefcnt NSAPI nsWeakReference_AddRef(nsIWeakReference *iface)
     nsWeakReference *This = impl_from_nsIWeakReference(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1397,7 +1397,7 @@ static nsrefcnt NSAPI nsWeakReference_Release(nsIWeakReference *iface)
     nsWeakReference *This = impl_from_nsIWeakReference(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         assert(!This->browser);
@@ -1480,7 +1480,7 @@ static nsrefcnt NSAPI nsWebBrowserChrome_AddRef(nsIWebBrowserChrome *iface)
     GeckoBrowser *This = impl_from_nsIWebBrowserChrome(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1490,7 +1490,7 @@ static nsrefcnt NSAPI nsWebBrowserChrome_Release(nsIWebBrowserChrome *iface)
     GeckoBrowser *This = impl_from_nsIWebBrowserChrome(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->doc)
@@ -1569,7 +1569,7 @@ static nsresult NSAPI nsWebBrowserChrome_SizeBrowserTo(nsIWebBrowserChrome *ifac
         LONG aCX, LONG aCY)
 {
     GeckoBrowser *This = impl_from_nsIWebBrowserChrome(iface);
-    WARN("(%p)->(%d %d)\n", This, aCX, aCY);
+    WARN("(%p)->(%ld %ld)\n", This, aCX, aCY);
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -1591,7 +1591,7 @@ static nsresult NSAPI nsWebBrowserChrome_ExitModalEventLoop(nsIWebBrowserChrome
         nsresult aStatus)
 {
     GeckoBrowser *This = impl_from_nsIWebBrowserChrome(iface);
-    WARN("(%p)->(%08x)\n", This, aStatus);
+    WARN("(%p)->(%08lx)\n", This, aStatus);
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -1915,7 +1915,7 @@ static nsresult NSAPI nsEmbeddingSiteWindow_SetDimensions(nsIEmbeddingSiteWindow
         UINT32 flags, LONG x, LONG y, LONG cx, LONG cy)
 {
     GeckoBrowser *This = impl_from_nsIEmbeddingSiteWindow(iface);
-    WARN("(%p)->(%08x %d %d %d %d)\n", This, flags, x, y, cx, cy);
+    WARN("(%p)->(%08x %ld %ld %ld %ld)\n", This, flags, x, y, cx, cy);
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -2175,20 +2175,20 @@ static HRESULT init_browser(GeckoBrowser *browser)
     nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr, NS_WEBBROWSER_CONTRACTID,
             NULL, &IID_nsIWebBrowser, (void**)&browser->webbrowser);
     if(NS_FAILED(nsres)) {
-        ERR("Creating WebBrowser failed: %08x\n", nsres);
+        ERR("Creating WebBrowser failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIWebBrowser_SetContainerWindow(browser->webbrowser, &browser->nsIWebBrowserChrome_iface);
     if(NS_FAILED(nsres)) {
-        ERR("SetContainerWindow failed: %08x\n", nsres);
+        ERR("SetContainerWindow failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIWebBrowser_QueryInterface(browser->webbrowser, &IID_nsIBaseWindow,
             (void**)&browser->window);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIBaseWindow interface: %08x\n", nsres);
+        ERR("Could not get nsIBaseWindow interface: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2198,7 +2198,7 @@ static HRESULT init_browser(GeckoBrowser *browser)
         nsres = nsIWebBrowserSetup_SetProperty(wbsetup, SETUP_IS_CHROME_WRAPPER, FALSE);
         nsIWebBrowserSetup_Release(wbsetup);
         if(NS_FAILED(nsres)) {
-            ERR("SetProperty(SETUP_IS_CHROME_WRAPPER) failed: %08x\n", nsres);
+            ERR("SetProperty(SETUP_IS_CHROME_WRAPPER) failed: %08lx\n", nsres);
             return E_FAIL;
         }
     }else {
@@ -2209,14 +2209,14 @@ static HRESULT init_browser(GeckoBrowser *browser)
     nsres = nsIWebBrowser_QueryInterface(browser->webbrowser, &IID_nsIWebNavigation,
             (void**)&browser->navigation);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIWebNavigation interface: %08x\n", nsres);
+        ERR("Could not get nsIWebNavigation interface: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIWebBrowser_QueryInterface(browser->webbrowser, &IID_nsIWebBrowserFocus,
             (void**)&browser->focus);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIWebBrowserFocus interface: %08x\n", nsres);
+        ERR("Could not get nsIWebBrowserFocus interface: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2238,42 +2238,42 @@ static HRESULT init_browser(GeckoBrowser *browser)
     if(NS_SUCCEEDED(nsres)) {
         nsres = nsIBaseWindow_Create(browser->window);
         if(NS_FAILED(nsres)) {
-            WARN("Creating window failed: %08x\n", nsres);
+            WARN("Creating window failed: %08lx\n", nsres);
             return E_FAIL;
         }
 
         nsIBaseWindow_SetVisibility(browser->window, FALSE);
         nsIBaseWindow_SetEnabled(browser->window, FALSE);
     }else {
-        ERR("InitWindow failed: %08x\n", nsres);
+        ERR("InitWindow failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIWebBrowser_SetParentURIContentListener(browser->webbrowser,
             &browser->nsIURIContentListener_iface);
     if(NS_FAILED(nsres))
-        ERR("SetParentURIContentListener failed: %08x\n", nsres);
+        ERR("SetParentURIContentListener failed: %08lx\n", nsres);
 
     nsres = nsIWebBrowser_QueryInterface(browser->webbrowser, &IID_nsIScrollable, (void**)&scrollable);
     if(NS_SUCCEEDED(nsres)) {
         nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable,
                 ScrollOrientation_Y, Scrollbar_Always);
         if(NS_FAILED(nsres))
-            ERR("Could not set default Y scrollbar prefs: %08x\n", nsres);
+            ERR("Could not set default Y scrollbar prefs: %08lx\n", nsres);
 
         nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable,
                 ScrollOrientation_X, Scrollbar_Auto);
         if(NS_FAILED(nsres))
-            ERR("Could not set default X scrollbar prefs: %08x\n", nsres);
+            ERR("Could not set default X scrollbar prefs: %08lx\n", nsres);
 
         nsIScrollable_Release(scrollable);
     }else {
-        ERR("Could not get nsIScrollable: %08x\n", nsres);
+        ERR("Could not get nsIScrollable: %08lx\n", nsres);
     }
 
     nsres = nsIWebBrowser_GetContentDOMWindow(browser->webbrowser, &mozwindow);
     if(NS_FAILED(nsres)) {
-        ERR("GetContentDOMWindow failed: %08x\n", nsres);
+        ERR("GetContentDOMWindow failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -2417,7 +2417,7 @@ nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow)
 
     nsres = nsIDOMWindow_GetInnerWindow(nswindow, &inner_window);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get inner window: %08x\n", nsres);
+        ERR("Could not get inner window: %08lx\n", nsres);
         return NULL;
     }
 
@@ -2442,7 +2442,7 @@ nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow)
     nsISupports_Release(nspri);
     nsIGlobalObject_Release(nsglo);
     if(NS_FAILED(nsres)) {
-        ERR("nsIXMLHttpRequest_Init failed: %08x\n", nsres);
+        ERR("nsIXMLHttpRequest_Init failed: %08lx\n", nsres);
         return NULL;
     }
 
diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c
index 21908b09563..e7d99151669 100644
--- a/dlls/mshtml/nsevents.c
+++ b/dlls/mshtml/nsevents.c
@@ -58,7 +58,7 @@ static LONG release_listener(nsDocumentEventListener *This)
 {
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -100,7 +100,7 @@ static nsrefcnt NSAPI nsDOMEventListener_AddRef(nsIDOMEventListener *iface)
     nsEventListener *This = impl_from_nsIDOMEventListener(iface);
     LONG ref = InterlockedIncrement(&This->This->ref);
 
-    TRACE("(%p) ref=%d\n", This->This, ref);
+    TRACE("(%p) ref=%ld\n", This->This, ref);
 
     return ref;
 }
@@ -302,14 +302,14 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
 
     nsres = nsIDOMEvent_GetTarget(nsevent, &event_target);
     if(NS_FAILED(nsres) || !event_target) {
-        ERR("GetEventTarget failed: %08x\n", nsres);
+        ERR("GetEventTarget failed: %08lx\n", nsres);
         return NS_OK;
     }
 
     nsres = nsIDOMEventTarget_QueryInterface(event_target, &IID_nsIDOMNode, (void**)&nsnode);
     nsIDOMEventTarget_Release(event_target);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDOMNode: %08x\n", nsres);
+        ERR("Could not get nsIDOMNode: %08lx\n", nsres);
         return NS_OK;
     }
 
@@ -366,7 +366,7 @@ static void init_event(nsIDOMEventTarget *target, const PRUnichar *type,
     nsres = nsIDOMEventTarget_AddEventListener(target, &type_str, listener, capture, FALSE, 1);
     nsAString_Finish(&type_str);
     if(NS_FAILED(nsres))
-        ERR("AddEventTarget failed: %08x\n", nsres);
+        ERR("AddEventTarget failed: %08lx\n", nsres);
 
 }
 
@@ -423,7 +423,7 @@ static void detach_nslistener(HTMLDocumentNode *doc, const WCHAR *type, nsEventL
     nsAString_Finish(&type_str);
     nsIDOMEventTarget_Release(target);
     if(NS_FAILED(nsres))
-        ERR("RemoveEventTarget failed: %08x\n", nsres);
+        ERR("RemoveEventTarget failed: %08lx\n", nsres);
 }
 
 void detach_nsevent(HTMLDocumentNode *doc, const WCHAR *type)
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index f921acf4dce..fc6602eddf4 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -71,7 +71,7 @@ static BOOL ensure_uri(nsWineURI *This)
     if(!This->uri) {
         hres = IUriBuilder_CreateUriSimple(This->uri_builder, 0, 0, &This->uri);
         if(FAILED(hres)) {
-            WARN("CreateUriSimple failed: %08x\n", hres);
+            WARN("CreateUriSimple failed: %08lx\n", hres);
             return FALSE;
         }
     }
@@ -147,7 +147,7 @@ static HRESULT combine_url(IUri *base_uri, const WCHAR *rel_url, IUri **ret)
                 ret, 0);
     IUri_Release(uri_nofrag);
     if(FAILED(hres))
-        WARN("CoInternetCombineUrlEx failed: %08x\n", hres);
+        WARN("CoInternetCombineUrlEx failed: %08lx\n", hres);
     return hres;
 }
 
@@ -286,14 +286,14 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post
 
     nsres = get_nsinterface((nsISupports*)window->nswindow, &IID_nsIWebNavigation, (void**)&web_navigation);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIWebNavigation interface: %08x\n", nsres);
+        ERR("Could not get nsIWebNavigation interface: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIWebNavigation_QueryInterface(web_navigation, &IID_nsIDocShell, (void**)&doc_shell);
     nsIWebNavigation_Release(web_navigation);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDocShell: %08x\n", nsres);
+        ERR("Could not get nsIDocShell: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -331,7 +331,7 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post
     nsIDocShell_Release(doc_shell);
     nsIDocShellLoadInfo_Release(load_info);
     if(NS_FAILED(nsres)) {
-        WARN("LoadURI failed: %08x\n", nsres);
+        WARN("LoadURI failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -541,7 +541,7 @@ static nsrefcnt NSAPI nsChannel_AddRef(nsIHttpChannel *iface)
     nsChannel *This = impl_from_nsIHttpChannel(iface);
     nsrefcnt ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -608,7 +608,7 @@ static nsresult NSAPI nsChannel_Cancel(nsIHttpChannel *iface, nsresult aStatus)
 {
     nsChannel *This = impl_from_nsIHttpChannel(iface);
 
-    TRACE("(%p)->(%08x)\n", This, aStatus);
+    TRACE("(%p)->(%08lx)\n", This, aStatus);
 
     if(This->binding && This->binding->bsc.binding)
         IBinding_Abort(This->binding->bsc.binding);
@@ -909,7 +909,7 @@ static HTMLOuterWindow *get_channel_window(nsChannel *This)
 
         nsres = nsILoadGroup_GetGroupObserver(This->load_group, &req_observer);
         if(NS_FAILED(nsres)) {
-            ERR("GetGroupObserver failed: %08x\n", nsres);
+            ERR("GetGroupObserver failed: %08lx\n", nsres);
             return NULL;
         }
 
@@ -917,7 +917,7 @@ static HTMLOuterWindow *get_channel_window(nsChannel *This)
             nsres = nsIRequestObserver_QueryInterface(req_observer, &IID_nsIWebProgress, (void**)&web_progress);
             nsIRequestObserver_Release(req_observer);
             if(NS_FAILED(nsres)) {
-                ERR("Could not get nsIWebProgress iface: %08x\n", nsres);
+                ERR("Could not get nsIWebProgress iface: %08lx\n", nsres);
                 return NULL;
             }
         }
@@ -926,7 +926,7 @@ static HTMLOuterWindow *get_channel_window(nsChannel *This)
     if(!web_progress && This->notif_callback) {
         nsres = nsIInterfaceRequestor_GetInterface(This->notif_callback, &IID_nsIWebProgress, (void**)&web_progress);
         if(NS_FAILED(nsres)) {
-            ERR("GetInterface(IID_nsIWebProgress failed: %08x\n", nsres);
+            ERR("GetInterface(IID_nsIWebProgress failed: %08lx\n", nsres);
             return NULL;
         }
     }
@@ -939,7 +939,7 @@ static HTMLOuterWindow *get_channel_window(nsChannel *This)
     nsres = nsIWebProgress_GetDOMWindow(web_progress, &mozwindow);
     nsIWebProgress_Release(web_progress);
     if(NS_FAILED(nsres) || !mozwindow) {
-        ERR("GetDOMWindow failed: %08x\n", nsres);
+        ERR("GetDOMWindow failed: %08lx\n", nsres);
         return NULL;
     }
 
@@ -983,7 +983,7 @@ static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc
 
     hres = CreateURLMonikerEx2(NULL, This->uri->uri, &mon, 0);
     if(FAILED(hres)) {
-        WARN("CreateURLMoniker failed: %08x\n", hres);
+        WARN("CreateURLMoniker failed: %08lx\n", hres);
         return NS_ERROR_UNEXPECTED;
     }
 
@@ -1046,7 +1046,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
             TRACE("opening %s\n", debugstr_w(uri_str));
             SysFreeString(uri_str);
         }else {
-            WARN("GetDisplayUri failed: %08x\n", hres);
+            WARN("GetDisplayUri failed: %08lx\n", hres);
         }
     }
 
@@ -1086,7 +1086,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
         nsres = nsILoadGroup_AddRequest(This->load_group, (nsIRequest*)&This->nsIHttpChannel_iface,
                 aContext);
         if(NS_FAILED(nsres))
-            ERR("AddRequest failed: %08x\n", nsres);
+            ERR("AddRequest failed: %08lx\n", nsres);
     }
 
     IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
@@ -2258,7 +2258,7 @@ static BOOL ensure_uri_builder(nsWineURI *This)
 
         hres = CreateIUriBuilder(This->uri, 0, 0, &This->uri_builder);
         if(FAILED(hres)) {
-            WARN("CreateIUriBuilder failed: %08x\n", hres);
+            WARN("CreateIUriBuilder failed: %08lx\n", hres);
             return FALSE;
         }
     }
@@ -2278,7 +2278,7 @@ static nsresult get_uri_string(nsWineURI *This, Uri_PROPERTY prop, nsACString *r
 
     hres = IUri_GetPropertyBSTR(This->uri, prop, &val, 0);
     if(FAILED(hres)) {
-        WARN("GetPropertyBSTR failed: %08x\n", hres);
+        WARN("GetPropertyBSTR failed: %08lx\n", hres);
         return NS_ERROR_UNEXPECTED;
     }
 
@@ -2341,7 +2341,7 @@ static nsrefcnt NSAPI nsURI_AddRef(nsIFileURL *iface)
     nsWineURI *This = impl_from_nsIFileURL(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -2351,7 +2351,7 @@ static nsrefcnt NSAPI nsURI_Release(nsIFileURL *iface)
     nsWineURI *This = impl_from_nsIFileURL(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->uri)
@@ -2394,7 +2394,7 @@ static nsresult NSAPI nsURI_SetSpec(nsIFileURL *iface, const nsACString *aSpec)
     hres = create_uri(spec, 0, &uri);
     heap_free(spec);
     if(FAILED(hres)) {
-        WARN("create_uri failed: %08x\n", hres);
+        WARN("create_uri failed: %08lx\n", hres);
         return NS_ERROR_FAILURE;
     }
 
@@ -2462,7 +2462,7 @@ static nsresult NSAPI nsURI_GetScheme(nsIFileURL *iface, nsACString *aScheme)
 
     hres = IUri_GetScheme(This->uri, &scheme);
     if(FAILED(hres)) {
-        WARN("GetScheme failed: %08x\n", hres);
+        WARN("GetScheme failed: %08lx\n", hres);
         return NS_ERROR_UNEXPECTED;
     }
 
@@ -2655,7 +2655,7 @@ static nsresult NSAPI nsURI_GetHostPort(nsIFileURL *iface, nsACString *aHostPort
 
     hres = IUri_GetAuthority(This->uri, &val);
     if(FAILED(hres)) {
-        WARN("GetAuthority failed: %08x\n", hres);
+        WARN("GetAuthority failed: %08lx\n", hres);
         return NS_ERROR_UNEXPECTED;
     }
 
@@ -2731,7 +2731,7 @@ static nsresult NSAPI nsURI_GetPort(nsIFileURL *iface, LONG *aPort)
 
     hres = IUri_GetPort(This->uri, &port);
     if(FAILED(hres)) {
-        WARN("GetPort failed: %08x\n", hres);
+        WARN("GetPort failed: %08lx\n", hres);
         return NS_ERROR_UNEXPECTED;
     }
 
@@ -2744,7 +2744,7 @@ static nsresult NSAPI nsURI_SetPort(nsIFileURL *iface, LONG aPort)
     nsWineURI *This = impl_from_nsIFileURL(iface);
     HRESULT hres;
 
-    TRACE("(%p)->(%d)\n", This, aPort);
+    TRACE("(%p)->(%ld)\n", This, aPort);
 
     if(!ensure_uri_builder(This))
         return NS_ERROR_UNEXPECTED;
@@ -2856,7 +2856,7 @@ static nsresult NSAPI nsURI_Clone(nsIFileURL *iface, nsIURI **_retval)
 
     nsres = create_nsuri(This->uri, &wine_uri);
     if(NS_FAILED(nsres)) {
-        WARN("create_nsuri failed: %08x\n", nsres);
+        WARN("create_nsuri failed: %08lx\n", nsres);
         return nsres;
     }
 
@@ -3039,7 +3039,7 @@ static nsresult NSAPI nsURI_CloneIgnoreRef(nsIFileURL *iface, nsIURI **_retval)
     nsres = create_nsuri(uri, &wine_uri);
     IUri_Release(uri);
     if(NS_FAILED(nsres)) {
-        WARN("create_nsuri failed: %08x\n", nsres);
+        WARN("create_nsuri failed: %08lx\n", nsres);
         return nsres;
     }
 
@@ -3293,7 +3293,7 @@ static nsresult NSAPI nsFileURL_GetFile(nsIFileURL *iface, nsIFile **aFile)
 
     hres = CoInternetParseIUri(This->uri, PARSE_PATH_FROM_URL, 0, path, ARRAY_SIZE(path), &size, 0);
     if(FAILED(hres)) {
-        WARN("CoInternetParseIUri failed: %08x\n", hres);
+        WARN("CoInternetParseIUri failed: %08lx\n", hres);
         return NS_ERROR_FAILURE;
     }
 
@@ -3410,14 +3410,14 @@ static nsresult NSAPI nsStandardURL_Init(nsIStandardURL *iface, UINT32 aUrlType,
         const nsACString *aSpec, const char *aOriginCharset, nsIURI *aBaseURI)
 {
     nsWineURI *This = impl_from_nsIStandardURL(iface);
-    FIXME("(%p)->(%d %d %s %s %p)\n", This, aUrlType, aDefaultPort, debugstr_nsacstr(aSpec), debugstr_a(aOriginCharset), aBaseURI);
+    FIXME("(%p)->(%d %ld %s %s %p)\n", This, aUrlType, aDefaultPort, debugstr_nsacstr(aSpec), debugstr_a(aOriginCharset), aBaseURI);
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 static nsresult NSAPI nsStandardURL_SetDefaultPort(nsIStandardURL *iface, LONG aNewDefaultPort)
 {
     nsWineURI *This = impl_from_nsIStandardURL(iface);
-    FIXME("(%p)->(%d)\n", This, aNewDefaultPort);
+    FIXME("(%p)->(%ld)\n", This, aNewDefaultPort);
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -3587,7 +3587,7 @@ static nsrefcnt NSAPI nsProtocolHandler_AddRef(nsIProtocolHandler *iface)
     nsProtocolHandler *This = impl_from_nsIProtocolHandler(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -3597,7 +3597,7 @@ static nsrefcnt NSAPI nsProtocolHandler_Release(nsIProtocolHandler *iface)
     nsProtocolHandler *This = impl_from_nsIProtocolHandler(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->nshandler)
@@ -3685,7 +3685,7 @@ static nsresult NSAPI nsProtocolHandler_AllowPort(nsIProtocolHandler *iface,
 {
     nsProtocolHandler *This = impl_from_nsIProtocolHandler(iface);
 
-    TRACE("(%p)->(%d %s %p)\n", This, port, debugstr_a(scheme), _retval);
+    TRACE("(%p)->(%ld %s %p)\n", This, port, debugstr_a(scheme), _retval);
 
     if(This->nshandler)
         return nsIProtocolHandler_AllowPort(This->nshandler, port, scheme, _retval);
@@ -3745,7 +3745,7 @@ static nsresult NSAPI nsIOServiceHook_NewChannel(nsIIOServiceHook *iface, nsIURI
 
     nsres = nsIURI_QueryInterface(aURI, &IID_nsWineURI, (void**)&wine_uri);
     if(NS_FAILED(nsres)) {
-        TRACE("Could not get nsWineURI: %08x\n", nsres);
+        TRACE("Could not get nsWineURI: %08lx\n", nsres);
         return NS_SUCCESS_DEFAULT_ACTION;
     }
 
@@ -3844,7 +3844,7 @@ static nsresult NSAPI nsIOServiceHook_NewURI(nsIIOServiceHook *iface, const nsAC
             if(!ensure_uri(base_wine_uri))
                 return NS_ERROR_UNEXPECTED;
         }else {
-            WARN("Could not get base nsWineURI: %08x\n", nsres);
+            WARN("Could not get base nsWineURI: %08lx\n", nsres);
         }
     }
 
@@ -3870,7 +3870,7 @@ static nsresult NSAPI nsIOServiceHook_NewURI(nsIIOServiceHook *iface, const nsAC
     }else {
         hres = create_uri(new_spec, 0, &urlmon_uri);
         if(FAILED(hres))
-            WARN("create_uri failed: %08x\n", hres);
+            WARN("create_uri failed: %08lx\n", hres);
     }
 
     if(FAILED(hres))
@@ -3957,13 +3957,13 @@ void init_nsio(nsIComponentManager *component_manager)
     nsres = nsIComponentManager_GetClassObject(component_manager, &NS_IOSERVICE_CID,
                                                &IID_nsIFactory, (void**)&old_factory);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get factory: %08x\n", nsres);
+        ERR("Could not get factory: %08lx\n", nsres);
         return;
     }
 
     nsres = nsIFactory_CreateInstance(old_factory, NULL, &IID_nsIIOService, (void**)&nsio);
     if(NS_FAILED(nsres)) {
-        ERR("Couldn not create nsIOService instance %08x\n", nsres);
+        ERR("Couldn not create nsIOService instance %08lx\n", nsres);
         nsIFactory_Release(old_factory);
         return;
     }
@@ -3990,7 +3990,7 @@ nsresult create_onload_blocker_request(nsIRequest **ret)
     nsres = nsIIOService_NewChannel(nsio, &spec, NULL, NULL, &channel);
     nsACString_Finish(&spec);
     if(NS_FAILED(nsres)) {
-        ERR("Failed to create channel: %08x\n", nsres);
+        ERR("Failed to create channel: %08lx\n", nsres);
         return nsres;
     }
 
diff --git a/dlls/mshtml/nsservice.c b/dlls/mshtml/nsservice.c
index 55a65cfeae6..9d7b9e13df5 100644
--- a/dlls/mshtml/nsservice.c
+++ b/dlls/mshtml/nsservice.c
@@ -388,11 +388,11 @@ void register_nsservice(nsIComponentRegistrar *registrar, nsIServiceManager *ser
     nsres = nsIComponentRegistrar_RegisterFactory(registrar, &NS_PROMPTSERVICE_CID,
             "Prompt Service", NS_PROMPTSERVICE_CONTRACTID, &nsPromptServiceFactory.nsIFactory_iface);
     if(NS_FAILED(nsres))
-        ERR("RegisterFactory failed: %08x\n", nsres);
+        ERR("RegisterFactory failed: %08lx\n", nsres);
 
     nsres = nsIComponentRegistrar_RegisterFactory(registrar, &NS_TOOLTIPTEXTPROVIDER_CID,
             NS_TOOLTIPTEXTPROVIDER_CLASSNAME, NS_TOOLTIPTEXTPROVIDER_CONTRACTID,
             &nsTooltipTextFactory.nsIFactory_iface);
     if(NS_FAILED(nsres))
-        ERR("RegisterFactory failed: %08x\n", nsres);
+        ERR("RegisterFactory failed: %08lx\n", nsres);
 }
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index 22d350bedd8..a044d24aea2 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -52,13 +52,13 @@ void do_ns_command(HTMLDocumentNode *doc, const char *cmd, nsICommandParams *nsp
 
     nsres = get_nsinterface((nsISupports*)doc->browser->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsICommandManager: %08x\n", nsres);
+        ERR("Could not get nsICommandManager: %08lx\n", nsres);
         return;
     }
 
     nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, doc->window->base.outer_window->window_proxy);
     if(NS_FAILED(nsres))
-        ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres);
+        ERR("DoCommand(%s) failed: %08lx\n", debugstr_a(cmd), nsres);
 
     nsICommandManager_Release(cmdmgr);
 }
@@ -96,31 +96,31 @@ static inline HTMLDocument *impl_from_IOleCommandTarget(IOleCommandTarget *iface
 
 static HRESULT exec_open(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_new(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_save(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_save_as(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_save_copy_as(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
@@ -240,7 +240,7 @@ static HRESULT exec_print(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pva
     nsIPrintSettings *settings;
     nsresult nsres;
 
-    TRACE("(%p)->(%d %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
+    TRACE("(%p)->(%ld %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
 
     if(pvaOut)
         FIXME("unsupported pvaOut\n");
@@ -248,13 +248,13 @@ static HRESULT exec_print(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pva
     nsres = get_nsinterface((nsISupports*)doc->browser->webbrowser, &IID_nsIWebBrowserPrint,
             (void**)&nsprint);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIWebBrowserPrint: %08x\n", nsres);
+        ERR("Could not get nsIWebBrowserPrint: %08lx\n", nsres);
         return S_OK;
     }
 
     nsres = nsIWebBrowserPrint_GetGlobalPrintSettings(nsprint, &settings);
     if(NS_FAILED(nsres))
-        ERR("GetCurrentPrintSettings failed: %08x\n", nsres);
+        ERR("GetCurrentPrintSettings failed: %08lx\n", nsres);
 
     set_default_templates(settings);
 
@@ -297,7 +297,7 @@ static HRESULT exec_print(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pva
             }
 
             if(opts_cnt >= 3)
-                FIXME("Unsupported opts_cnt %d\n", opts_cnt);
+                FIXME("Unsupported opts_cnt %ld\n", opts_cnt);
 
             SafeArrayUnaccessData(V_ARRAY(pvaIn));
             break;
@@ -309,7 +309,7 @@ static HRESULT exec_print(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pva
 
     nsres = nsIWebBrowserPrint_Print(nsprint, settings, NULL);
     if(NS_FAILED(nsres))
-        ERR("Print failed: %08x\n", nsres);
+        ERR("Print failed: %08lx\n", nsres);
 
     nsIWebBrowserPrint_Release(nsprint);
 
@@ -318,37 +318,37 @@ static HRESULT exec_print(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pva
 
 static HRESULT exec_print_preview(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_page_setup(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_spell(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_properties(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_cut(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_copy(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    TRACE("(%p)->(%d %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
+    TRACE("(%p)->(%ld %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
 
     do_ns_command(doc, NSCMD_COPY, NULL);
     return S_OK;
@@ -356,25 +356,25 @@ static HRESULT exec_copy(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaI
 
 static HRESULT exec_paste(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_paste_special(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_undo(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_rendo(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
@@ -395,19 +395,19 @@ static HRESULT exec_select_all(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT
 
 static HRESULT exec_clear_selection(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_zoom(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_get_zoom_range(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
@@ -450,7 +450,7 @@ static HRESULT exec_refresh(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *p
     refresh_task_t *task;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
+    TRACE("(%p)->(%ld %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
 
     if(doc != doc->browser->doc->basedoc.doc_node) {
         FIXME("Unsupported on frame documents\n");
@@ -485,37 +485,37 @@ static HRESULT exec_refresh(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *p
 
 static HRESULT exec_stop(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_stop_download(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_find(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_delete(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_enable_interaction(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_on_unload(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    TRACE("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    TRACE("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
 
     /* Tests show that we have nothing more to do here */
 
@@ -529,37 +529,37 @@ static HRESULT exec_on_unload(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT
 
 static HRESULT exec_show_page_setup(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_show_print(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_close(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_set_print_template(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_get_print_template(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    FIXME("(%p)->(%d %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
+    FIXME("(%p)->(%ld %p %p)\n", doc, nCmdexecopt, pvaIn, pvaOut);
     return E_NOTIMPL;
 }
 
 static HRESULT exec_optical_zoom(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 {
-    TRACE("(%p)->(%d %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
+    TRACE("(%p)->(%ld %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
 
     if(pvaIn && V_VT(pvaIn) != VT_I4) {
         FIXME("Unsupported argument %s\n", debugstr_variant(pvaIn));
@@ -584,7 +584,7 @@ static HRESULT query_mshtml_copy(HTMLDocumentNode *doc, OLECMD *cmd)
 
 static HRESULT exec_mshtml_copy(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 {
-    TRACE("(%p)->(%08x %p %p)\n", doc, cmdexecopt, in, out);
+    TRACE("(%p)->(%08lx %p %p)\n", doc, cmdexecopt, in, out);
 
     if(doc->browser->usermode == EDITMODE)
         return editor_exec_copy(doc, cmdexecopt, in, out);
@@ -605,7 +605,7 @@ static HRESULT exec_mshtml_cut(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT
     nsIClipboardCommands *clipboard_commands;
     nsresult nsres;
 
-    TRACE("(%p)->(%08x %p %p)\n", doc, cmdexecopt, in, out);
+    TRACE("(%p)->(%08lx %p %p)\n", doc, cmdexecopt, in, out);
 
     if(doc->browser->usermode == EDITMODE)
         return editor_exec_cut(doc, cmdexecopt, in, out);
@@ -617,7 +617,7 @@ static HRESULT exec_mshtml_cut(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT
     nsres = nsIClipboardCommands_CutSelection(clipboard_commands);
     nsIClipboardCommands_Release(clipboard_commands);
     if(NS_FAILED(nsres)) {
-        ERR("Paste failed: %08x\n", nsres);
+        ERR("Paste failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -636,7 +636,7 @@ static HRESULT exec_mshtml_paste(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIAN
     nsIClipboardCommands *clipboard_commands;
     nsresult nsres;
 
-    TRACE("(%p)->(%08x %p %p)\n", doc, cmdexecopt, in, out);
+    TRACE("(%p)->(%08lx %p %p)\n", doc, cmdexecopt, in, out);
 
     if(doc->browser->usermode == EDITMODE)
         return editor_exec_paste(doc, cmdexecopt, in, out);
@@ -648,7 +648,7 @@ static HRESULT exec_mshtml_paste(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIAN
     nsres = nsIClipboardCommands_Paste(clipboard_commands);
     nsIClipboardCommands_Release(clipboard_commands);
     if(NS_FAILED(nsres)) {
-        ERR("Paste failed: %08x\n", nsres);
+        ERR("Paste failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -665,7 +665,7 @@ static HRESULT query_selall_status(HTMLDocumentNode *doc, OLECMD *cmd)
 
 static HRESULT exec_browsemode(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 {
-    WARN("(%p)->(%08x %p %p)\n", doc, cmdexecopt, in, out);
+    WARN("(%p)->(%08lx %p %p)\n", doc, cmdexecopt, in, out);
 
     if(in || out)
         FIXME("unsupported args\n");
@@ -677,7 +677,7 @@ static HRESULT exec_browsemode(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT
 
 static HRESULT exec_editmode(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 {
-    TRACE("(%p)->(%08x %p %p)\n", doc, cmdexecopt, in, out);
+    TRACE("(%p)->(%08lx %p %p)\n", doc, cmdexecopt, in, out);
 
     if(in || out)
         FIXME("unsupported args\n");
@@ -687,20 +687,20 @@ static HRESULT exec_editmode(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *i
 
 static HRESULT exec_htmleditmode(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 {
-    FIXME("(%p)->(%08x %p %p)\n", doc, cmdexecopt, in, out);
+    FIXME("(%p)->(%08lx %p %p)\n", doc, cmdexecopt, in, out);
     return S_OK;
 }
 
 static HRESULT exec_baselinefont3(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
 {
-    FIXME("(%p)->(%08x %p %p)\n", doc, cmdexecopt, in, out);
+    FIXME("(%p)->(%08lx %p %p)\n", doc, cmdexecopt, in, out);
     return S_OK;
 }
 
 static HRESULT exec_respectvisibility_indesign(HTMLDocumentNode *doc, DWORD cmdexecopt,
         VARIANT *in, VARIANT *out)
 {
-    TRACE("(%p)->(%x %s %p)\n", doc, cmdexecopt, debugstr_variant(in), out);
+    TRACE("(%p)->(%lx %s %p)\n", doc, cmdexecopt, debugstr_variant(in), out);
 
     /* This is turned on by default in Gecko. */
     if(!in || V_VT(in) != VT_BOOL || !V_BOOL(in))
@@ -832,7 +832,7 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
     HTMLDocument *This = impl_from_IOleCommandTarget(iface);
     HRESULT hres;
 
-    TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
+    TRACE("(%p)->(%s %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
 
     if(pCmdText)
         FIXME("Unsupported pCmdText\n");
@@ -846,7 +846,7 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
 
         for(i=0; i<cCmds; i++) {
             if(prgCmds[i].cmdID < OLECMDID_OPEN || prgCmds[i].cmdID >= ARRAY_SIZE(exec_table)) {
-                WARN("Unsupported cmdID = %d\n", prgCmds[i].cmdID);
+                WARN("Unsupported cmdID = %ld\n", prgCmds[i].cmdID);
                 prgCmds[i].cmdf = 0;
             }else {
                 if(prgCmds[i].cmdID == OLECMDID_OPEN || prgCmds[i].cmdID == OLECMDID_NEW) {
@@ -870,7 +870,7 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
                     }
                 }else {
                     prgCmds[i].cmdf = exec_table[prgCmds[i].cmdID].cmdf;
-                    TRACE("cmdID = %d  returning %x\n", prgCmds[i].cmdID, prgCmds[i].cmdf);
+                    TRACE("cmdID = %ld  returning %lx\n", prgCmds[i].cmdID, prgCmds[i].cmdf);
                 }
             }
         }
@@ -886,7 +886,7 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
             if(hres == OLECMDERR_E_NOTSUPPORTED)
                 hres = query_from_table(This->doc_node, editmode_cmds, prgCmds+i);
             if(hres == OLECMDERR_E_NOTSUPPORTED)
-                FIXME("CGID_MSHTML: unsupported cmdID %d\n", prgCmds[i].cmdID);
+                FIXME("CGID_MSHTML: unsupported cmdID %ld\n", prgCmds[i].cmdID);
         }
 
         return (prgCmds[cCmds-1].cmdf & OLECMDF_SUPPORTED) ? S_OK : OLECMDERR_E_NOTSUPPORTED;
@@ -915,24 +915,24 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
 {
     HTMLDocument *This = impl_from_IOleCommandTarget(iface);
 
-    TRACE("(%p)->(%s %d %d %s %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, wine_dbgstr_variant(pvaIn), pvaOut);
+    TRACE("(%p)->(%s %ld %ld %s %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, wine_dbgstr_variant(pvaIn), pvaOut);
 
     if(!This->doc_node->browser)
         return E_UNEXPECTED;
 
     if(!pguidCmdGroup) {
         if(nCmdID < OLECMDID_OPEN || nCmdID >= ARRAY_SIZE(exec_table) || !exec_table[nCmdID].func) {
-            WARN("Unsupported cmdID = %d\n", nCmdID);
+            WARN("Unsupported cmdID = %ld\n", nCmdID);
             return OLECMDERR_E_NOTSUPPORTED;
         }
 
         return exec_table[nCmdID].func(This->doc_node, nCmdexecopt, pvaIn, pvaOut);
     }else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
-        FIXME("unsupported nCmdID %d of CGID_Explorer group\n", nCmdID);
+        FIXME("unsupported nCmdID %ld of CGID_Explorer group\n", nCmdID);
         TRACE("%p %p\n", pvaIn, pvaOut);
         return OLECMDERR_E_NOTSUPPORTED;
     }else if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
-        FIXME("unsupported nCmdID %d of CGID_ShellDocView group\n", nCmdID);
+        FIXME("unsupported nCmdID %ld of CGID_ShellDocView group\n", nCmdID);
         return OLECMDERR_E_NOTSUPPORTED;
     }else if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
         HRESULT hres = exec_from_table(This->doc_node, base_cmds, nCmdID, nCmdexecopt, pvaIn, pvaOut);
@@ -940,7 +940,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
             hres = exec_from_table(This->doc_node, editmode_cmds, nCmdID,
                                    nCmdexecopt, pvaIn, pvaOut);
         if(hres == OLECMDERR_E_NOTSUPPORTED)
-            FIXME("unsupported nCmdID %d of CGID_MSHTML group\n", nCmdID);
+            FIXME("unsupported nCmdID %ld of CGID_MSHTML group\n", nCmdID);
 
         return hres;
     }
diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index c7ce641a949..fe050c9cf0a 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -73,7 +73,7 @@ static ULONG WINAPI EnumUnknown_AddRef(IEnumUnknown *iface)
     EnumUnknown *This = impl_from_IEnumUnknown(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -83,7 +83,7 @@ static ULONG WINAPI EnumUnknown_Release(IEnumUnknown *iface)
     EnumUnknown *This = impl_from_IEnumUnknown(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -95,7 +95,7 @@ static HRESULT WINAPI EnumUnknown_Next(IEnumUnknown *iface, ULONG celt, IUnknown
 {
     EnumUnknown *This = impl_from_IEnumUnknown(iface);
 
-    TRACE("(%p)->(%u %p %p)\n", This, celt, rgelt, pceltFetched);
+    TRACE("(%p)->(%lu %p %p)\n", This, celt, rgelt, pceltFetched);
 
     /* FIXME: It's not clear if we should ever return something here */
     if(pceltFetched)
@@ -106,7 +106,7 @@ static HRESULT WINAPI EnumUnknown_Next(IEnumUnknown *iface, ULONG celt, IUnknown
 static HRESULT WINAPI EnumUnknown_Skip(IEnumUnknown *iface, ULONG celt)
 {
     EnumUnknown *This = impl_from_IEnumUnknown(iface);
-    FIXME("(%p)->(%u)\n", This, celt);
+    FIXME("(%p)->(%lu)\n", This, celt);
     return E_NOTIMPL;
 }
 
@@ -174,16 +174,16 @@ static void update_hostinfo(HTMLDocumentObj *This, DOCHOSTUIINFO *hostinfo)
         nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_Y,
                 (hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO) ? Scrollbar_Never : Scrollbar_Always);
         if(NS_FAILED(nsres))
-            ERR("Could not set default Y scrollbar prefs: %08x\n", nsres);
+            ERR("Could not set default Y scrollbar prefs: %08lx\n", nsres);
 
         nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_X,
                 hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO ? Scrollbar_Never : Scrollbar_Auto);
         if(NS_FAILED(nsres))
-            ERR("Could not set default X scrollbar prefs: %08x\n", nsres);
+            ERR("Could not set default X scrollbar prefs: %08lx\n", nsres);
 
         nsIScrollable_Release(scrollable);
     }else {
-        ERR("Could not get nsIScrollable: %08x\n", nsres);
+        ERR("Could not get nsIScrollable: %08lx\n", nsres);
     }
 }
 
@@ -322,7 +322,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
         hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
         hres = IDocHostUIHandler_GetHostInfo(This->doc_obj->hostui, &hostinfo);
         if(SUCCEEDED(hres)) {
-            TRACE("hostinfo = {%u %08x %08x %s %s}\n",
+            TRACE("hostinfo = {%lu %08lx %08lx %s %s}\n",
                     hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
                     debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
             update_hostinfo(This->doc_obj, &hostinfo);
@@ -470,7 +470,7 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
 
-    TRACE("(%p)->(%08x)\n", This, dwSaveOption);
+    TRACE("(%p)->(%08lx)\n", This, dwSaveOption);
 
     if(dwSaveOption == OLECLOSE_PROMPTSAVE)
         FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
@@ -489,14 +489,14 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
-    FIXME("(%p %d %p)->()\n", This, dwWhichMoniker, pmk);
+    FIXME("(%p %ld %p)->()\n", This, dwWhichMoniker, pmk);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
+    FIXME("(%p)->(%ld %ld %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
     return E_NOTIMPL;
 }
 
@@ -504,14 +504,14 @@ static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDa
                                         DWORD dwReserved)
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
-    FIXME("(%p)->(%p %x %d)\n", This, pDataObject, fCreation, dwReserved);
+    FIXME("(%p)->(%p %x %ld)\n", This, pDataObject, fCreation, dwReserved);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
-    FIXME("(%p)->(%d %p)\n", This, dwReserved, ppDataObject);
+    FIXME("(%p)->(%ld %p)\n", This, dwReserved, ppDataObject);
     return E_NOTIMPL;
 }
 
@@ -522,10 +522,10 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpms
     IOleDocumentSite *pDocSite;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
+    TRACE("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
 
     if(iVerb != OLEIVERB_SHOW && iVerb != OLEIVERB_UIACTIVATE && iVerb != OLEIVERB_INPLACEACTIVATE) { 
-        FIXME("iVerb = %d not supported\n", iVerb);
+        FIXME("iVerb = %ld not supported\n", iVerb);
         return E_NOTIMPL;
     }
 
@@ -591,7 +591,7 @@ static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
-    FIXME("(%p)->(%d %p)\n", This, dwFormOfType, pszUserType);
+    FIXME("(%p)->(%ld %p)\n", This, dwFormOfType, pszUserType);
     return E_NOTIMPL;
 }
 
@@ -599,7 +599,7 @@ static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect,
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
 
-    TRACE("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
+    TRACE("(%p)->(%ld %p)\n", This, dwDrawAspect, psizel);
 
     if (dwDrawAspect != DVASPECT_CONTENT)
         return E_INVALIDARG;
@@ -612,7 +612,7 @@ static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect,
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
 
-    TRACE("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
+    TRACE("(%p)->(%ld %p)\n", This, dwDrawAspect, psizel);
 
     if (dwDrawAspect != DVASPECT_CONTENT)
         return E_INVALIDARG;
@@ -646,7 +646,7 @@ static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
-    TRACE("(%p)->(%d)\n", This, dwConnection);
+    TRACE("(%p)->(%ld)\n", This, dwConnection);
 
     if(!This->doc_obj->advise_holder)
         return OLE_E_NOCONNECTION;
@@ -669,7 +669,7 @@ static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **pp
 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
 {
     HTMLDocument *This = impl_from_IOleObject(iface);
-    FIXME("(%p)->(%d %p)\n", This, dwAspect, pdwStatus);
+    FIXME("(%p)->(%ld %p)\n", This, dwAspect, pdwStatus);
     return E_NOTIMPL;
 }
 
@@ -740,7 +740,7 @@ static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSit
     HTMLDocument *This = impl_from_IOleDocument(iface);
     HRESULT hres;
 
-    TRACE("(%p)->(%p %p %d %p)\n", This, pIPSite, pstm, dwReserved, ppView);
+    TRACE("(%p)->(%p %p %ld %p)\n", This, pIPSite, pstm, dwReserved, ppView);
 
     if(!ppView)
         return E_INVALIDARG;
@@ -861,7 +861,7 @@ static HRESULT on_change_dlcontrol(HTMLDocument *This)
     
     hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_DLCONTROL, &res);
     if(SUCCEEDED(hres))
-        FIXME("unsupported dlcontrol %08x\n", V_I4(&res));
+        FIXME("unsupported dlcontrol %08lx\n", V_I4(&res));
 
     return S_OK;
 }
@@ -949,7 +949,7 @@ static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DIS
         return S_OK;
     }
 
-    FIXME("(%p) unsupported dispID=%d\n", This, dispID);
+    FIXME("(%p) unsupported dispID=%ld\n", This, dispID);
     return E_FAIL;
 }
 
@@ -1195,7 +1195,7 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObje
         UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
 {
     HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
-    FIXME("(%p)->(%u %lu %lu %p)\n", This, msg, wParam, lParam, lpResult);
+    FIXME("(%p)->(%u %Iu %Iu %p)\n", This, msg, wParam, lParam, lpResult);
     return E_NOTIMPL;
 }
 
@@ -1310,7 +1310,7 @@ static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFl
     HTMLDocument *This = impl_from_IOleContainer(iface);
     EnumUnknown *ret;
 
-    TRACE("(%p)->(%x %p)\n", This, grfFlags, ppenum);
+    TRACE("(%p)->(%lx %p)\n", This, grfFlags, ppenum);
 
     ret = heap_alloc(sizeof(*ret));
     if(!ret)
@@ -1433,7 +1433,7 @@ static HRESULT WINAPI ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety *ifac
         REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
 {
     HTMLDocument *This = impl_from_IObjectSafety(iface);
-    FIXME("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
+    FIXME("(%p)->(%s %lx %lx)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
 
     if(IsEqualGUID(&IID_IPersistMoniker, riid) &&
             dwOptionSetMask==INTERFACESAFE_FOR_UNTRUSTED_DATA &&
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c
index 7788b453b8d..0a2a6bb58cd 100644
--- a/dlls/mshtml/omnavigator.c
+++ b/dlls/mshtml/omnavigator.c
@@ -87,7 +87,7 @@ static ULONG WINAPI HTMLDOMImplementation_AddRef(IHTMLDOMImplementation *iface)
     HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -97,7 +97,7 @@ static ULONG WINAPI HTMLDOMImplementation_Release(IHTMLDOMImplementation *iface)
     HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         assert(!This->browser);
@@ -257,7 +257,7 @@ static HRESULT WINAPI HTMLDOMImplementation2_createHTMLDocument(IHTMLDOMImplemen
     nsres = nsIDOMDOMImplementation_CreateHTMLDocument(This->implementation, &title_str, &doc);
     nsAString_Finish(&title_str);
     if(NS_FAILED(nsres)) {
-        ERR("CreateHTMLDocument failed: %08x\n", nsres);
+        ERR("CreateHTMLDocument failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -332,7 +332,7 @@ HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementa
 
     nsres = nsIDOMHTMLDocument_GetImplementation(doc_node->nsdoc, &dom_implementation->implementation);
     if(NS_FAILED(nsres)) {
-        ERR("GetDOMImplementation failed: %08x\n", nsres);
+        ERR("GetDOMImplementation failed: %08lx\n", nsres);
         IHTMLDOMImplementation_Release(&dom_implementation->IHTMLDOMImplementation_iface);
         return E_FAIL;
     }
@@ -386,7 +386,7 @@ static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
     HTMLScreen *This = impl_from_IHTMLScreen(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -396,7 +396,7 @@ static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface)
     HTMLScreen *This = impl_from_IHTMLScreen(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -451,7 +451,7 @@ static HRESULT WINAPI HTMLScreen_get_colorDepth(IHTMLScreen *iface, LONG *p)
 static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
 {
     HTMLScreen *This = impl_from_IHTMLScreen(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -485,7 +485,7 @@ static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
 static HRESULT WINAPI HTMLScreen_put_updateInterval(IHTMLScreen *iface, LONG v)
 {
     HTMLScreen *This = impl_from_IHTMLScreen(iface);
-    FIXME("(%p)->(%d)\n", This, v);
+    FIXME("(%p)->(%ld)\n", This, v);
     return E_NOTIMPL;
 }
 
@@ -611,7 +611,7 @@ static ULONG WINAPI OmHistory_AddRef(IOmHistory *iface)
     OmHistory *This = impl_from_IOmHistory(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -621,7 +621,7 @@ static ULONG WINAPI OmHistory_Release(IOmHistory *iface)
     OmHistory *This = impl_from_IOmHistory(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -787,7 +787,7 @@ static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface)
     HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -797,7 +797,7 @@ static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface)
     HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->navigator)
@@ -943,7 +943,7 @@ static ULONG WINAPI HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection *ifa
     HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -953,7 +953,7 @@ static ULONG WINAPI HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection *if
     HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->navigator)
@@ -1079,7 +1079,7 @@ static ULONG WINAPI OmNavigator_AddRef(IOmNavigator *iface)
     OmNavigator *This = impl_from_IOmNavigator(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1089,7 +1089,7 @@ static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface)
     OmNavigator *This = impl_from_IOmNavigator(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->plugins)
@@ -1339,7 +1339,7 @@ static HRESULT get_language_string(LCID lcid, BSTR *p)
 
     len = LCIDToLocaleName(lcid, NULL, 0, 0);
     if(!len) {
-        WARN("LCIDToLocaleName failed: %u\n", GetLastError());
+        WARN("LCIDToLocaleName failed: %lu\n", GetLastError());
         return E_FAIL;
     }
 
@@ -1349,7 +1349,7 @@ static HRESULT get_language_string(LCID lcid, BSTR *p)
 
     len = LCIDToLocaleName(lcid, ret, len, 0);
     if(!len) {
-        WARN("LCIDToLocaleName failed: %u\n", GetLastError());
+        WARN("LCIDToLocaleName failed: %lu\n", GetLastError());
         SysFreeString(ret);
         return E_FAIL;
     }
@@ -1531,7 +1531,7 @@ static ULONG WINAPI HTMLPerformanceTiming_AddRef(IHTMLPerformanceTiming *iface)
     HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1541,7 +1541,7 @@ static ULONG WINAPI HTMLPerformanceTiming_Release(IHTMLPerformanceTiming *iface)
     HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -1897,7 +1897,7 @@ static ULONG WINAPI HTMLPerformanceNavigation_AddRef(IHTMLPerformanceNavigation
     HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1907,7 +1907,7 @@ static ULONG WINAPI HTMLPerformanceNavigation_Release(IHTMLPerformanceNavigation
     HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -2052,7 +2052,7 @@ static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface)
     HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -2062,7 +2062,7 @@ static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface)
     HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->timing)
@@ -2260,7 +2260,7 @@ static ULONG WINAPI HTMLNamespaceCollection_AddRef(IHTMLNamespaceCollection *ifa
     HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -2270,7 +2270,7 @@ static ULONG WINAPI HTMLNamespaceCollection_Release(IHTMLNamespaceCollection *if
     HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);
@@ -2415,7 +2415,7 @@ static ULONG WINAPI console_AddRef(IWineMSHTMLConsole *iface)
     struct console *console = impl_from_IWineMSHTMLConsole(iface);
     LONG ref = InterlockedIncrement(&console->ref);
 
-    TRACE("(%p) ref=%d\n", console, ref);
+    TRACE("(%p) ref=%ld\n", console, ref);
 
     return ref;
 }
@@ -2425,7 +2425,7 @@ static ULONG WINAPI console_Release(IWineMSHTMLConsole *iface)
     struct console *console = impl_from_IWineMSHTMLConsole(iface);
     LONG ref = InterlockedDecrement(&console->ref);
 
-    TRACE("(%p) ref=%d\n", console, ref);
+    TRACE("(%p) ref=%ld\n", console, ref);
 
     if(!ref) {
         release_dispex(&console->dispex);
diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c
index f6bb1887aca..73f255e753d 100644
--- a/dlls/mshtml/persist.c
+++ b/dlls/mshtml/persist.c
@@ -133,7 +133,7 @@ void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags)
         hres = IUriContainer_GetIUri(uri_container, &uri);
         IUriContainer_Release(uri_container);
         if(hres != S_OK) {
-            WARN("GetIUri failed: %08x\n", hres);
+            WARN("GetIUri failed: %08lx\n", hres);
             uri = NULL;
         }
     }
@@ -145,7 +145,7 @@ void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags)
         if(SUCCEEDED(hres)) {
             hres = create_uri(url, 0, &uri);
             if(FAILED(hres)) {
-                WARN("CreateUri failed: %08x\n", hres);
+                WARN("CreateUri failed: %08lx\n", hres);
                 set_current_uri(This, NULL);
                 This->url = SysAllocString(url);
                 CoTaskMemFree(url);
@@ -153,7 +153,7 @@ void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags)
             }
             CoTaskMemFree(url);
         }else {
-            WARN("GetDisplayName failed: %08x\n", hres);
+            WARN("GetDisplayName failed: %08lx\n", hres);
         }
     }
 
@@ -234,7 +234,7 @@ static void set_progress_proc(task_t *_task)
         hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
         if(SUCCEEDED(hres))
             /* FIXME: use hostinfo */
-            TRACE("hostinfo = {%u %08x %08x %s %s}\n",
+            TRACE("hostinfo = {%lu %08lx %08lx %s %s}\n",
                     hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
                     debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
     }
@@ -352,7 +352,7 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind
 
     hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url);
     if(FAILED(hres)) {
-        WARN("GetDisplayName failed: %08x\n", hres);
+        WARN("GetDisplayName failed: %08lx\n", hres);
         return hres;
     }
 
@@ -512,7 +512,7 @@ static HRESULT get_doc_string(HTMLDocumentNode *This, char **str)
 
     nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
     if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDOMNode failed: %08x\n", nsres);
+        ERR("Could not get nsIDOMNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -586,7 +586,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
     IMoniker *mon;
     HRESULT hres;
 
-    TRACE("(%p)->(%x %p %p %08x)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
+    TRACE("(%p)->(%x %p %p %08lx)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
 
     if(pibc) {
         IUnknown *unk = NULL;
@@ -789,7 +789,7 @@ static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
 static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
 {
     HTMLDocument *This = impl_from_IPersistFile(iface);
-    FIXME("(%p)->(%s %08x)\n", This, debugstr_w(pszFileName), dwMode);
+    FIXME("(%p)->(%s %08lx)\n", This, debugstr_w(pszFileName), dwMode);
     return E_NOTIMPL;
 }
 
@@ -806,7 +806,7 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileNam
     file = CreateFileW(pszFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                        FILE_ATTRIBUTE_NORMAL, NULL);
     if(file == INVALID_HANDLE_VALUE) {
-        WARN("Could not create file: %u\n", GetLastError());
+        WARN("Could not create file: %lu\n", GetLastError());
         return E_FAIL;
     }
 
@@ -893,7 +893,7 @@ static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, IStream
 
     hres = CreateURLMoniker(NULL, L"about:blank", &mon);
     if(FAILED(hres)) {
-        WARN("CreateURLMoniker failed: %08x\n", hres);
+        WARN("CreateURLMoniker failed: %08lx\n", hres);
         return hres;
     }
 
@@ -922,7 +922,7 @@ static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, IStream
 
     hres = IStream_Write(pStm, str, strlen(str), &written);
     if(FAILED(hres))
-        FIXME("Write failed: %08x\n", hres);
+        FIXME("Write failed: %08lx\n", hres);
 
     heap_free(str);
 
@@ -950,7 +950,7 @@ static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
 
     hres = CreateURLMoniker(NULL, L"about:blank", &mon);
     if(FAILED(hres)) {
-        WARN("CreateURLMoniker failed: %08x\n", hres);
+        WARN("CreateURLMoniker failed: %08lx\n", hres);
         return hres;
     }
 
@@ -1094,7 +1094,7 @@ static HRESULT WINAPI PersistHistory_SaveHistory(IPersistHistory *iface, IStream
 static HRESULT WINAPI PersistHistory_SetPositionCookie(IPersistHistory *iface, DWORD dwPositioncookie)
 {
     HTMLDocument *This = impl_from_IPersistHistory(iface);
-    FIXME("(%p)->(%x)\n", This, dwPositioncookie);
+    FIXME("(%p)->(%lx)\n", This, dwPositioncookie);
     return E_NOTIMPL;
 }
 
@@ -1161,10 +1161,10 @@ static HRESULT WINAPI HlinkTarget_Navigate(IHlinkTarget *iface, DWORD grfHLNF, L
 {
     HTMLDocument *This = impl_from_IHlinkTarget(iface);
 
-    TRACE("(%p)->(%08x %s)\n", This, grfHLNF, debugstr_w(pwzJumpLocation));
+    TRACE("(%p)->(%08lx %s)\n", This, grfHLNF, debugstr_w(pwzJumpLocation));
 
     if(grfHLNF)
-        FIXME("Unsupported grfHLNF=%08x\n", grfHLNF);
+        FIXME("Unsupported grfHLNF=%08lx\n", grfHLNF);
     if(pwzJumpLocation)
         FIXME("JumpLocation not supported\n");
 
@@ -1188,7 +1188,7 @@ static HRESULT WINAPI HlinkTarget_GetMoniker(IHlinkTarget *iface, LPCWSTR pwzLoc
         IMoniker **ppimkLocation)
 {
     HTMLDocument *This = impl_from_IHlinkTarget(iface);
-    FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(pwzLocation), dwAssign, ppimkLocation);
+    FIXME("(%p)->(%s %08lx %p)\n", This, debugstr_w(pwzLocation), dwAssign, ppimkLocation);
     return E_NOTIMPL;
 }
 
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index b6a2c57479c..043f9bad3a0 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -128,7 +128,7 @@ static ULONG WINAPI PropertyBag_AddRef(IPropertyBag *iface)
     PropertyBag *This = impl_from_IPropertyBag(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -138,7 +138,7 @@ static ULONG WINAPI PropertyBag_Release(IPropertyBag *iface)
     PropertyBag *This = impl_from_IPropertyBag(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         while(!list_empty(&This->props))
@@ -222,14 +222,14 @@ static HRESULT WINAPI PropertyBag2_Read(IPropertyBag2 *iface, ULONG cProperties,
         IErrorLog *pErrLog, VARIANT *pvarValue, HRESULT *phrError)
 {
     PropertyBag *This = impl_from_IPropertyBag2(iface);
-    FIXME("(%p)->(%d %p %p %p %p)\n", This, cProperties, pPropBag, pErrLog, pvarValue, phrError);
+    FIXME("(%p)->(%ld %p %p %p %p)\n", This, cProperties, pPropBag, pErrLog, pvarValue, phrError);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI PropertyBag2_Write(IPropertyBag2 *iface, ULONG cProperties, PROPBAG2 *pPropBag, VARIANT *pvarValue)
 {
     PropertyBag *This = impl_from_IPropertyBag2(iface);
-    FIXME("(%p)->(%d %p %s)\n", This, cProperties, pPropBag, debugstr_variant(pvarValue));
+    FIXME("(%p)->(%ld %p %s)\n", This, cProperties, pPropBag, debugstr_variant(pvarValue));
     return E_NOTIMPL;
 }
 
@@ -244,7 +244,7 @@ static HRESULT WINAPI PropertyBag2_GetPropertyInfo(IPropertyBag2 *iface, ULONG i
         PROPBAG2 *pPropBag, ULONG *pcProperties)
 {
     PropertyBag *This = impl_from_IPropertyBag2(iface);
-    FIXME("(%p)->(%u %u %p %p)\n", This, iProperty, cProperties, pPropBag, pcProperties);
+    FIXME("(%p)->(%lu %lu %p %p)\n", This, iProperty, cProperties, pPropBag, pcProperties);
     return E_NOTIMPL;
 }
 
@@ -252,7 +252,7 @@ static HRESULT WINAPI PropertyBag2_LoadObject(IPropertyBag2 *iface, LPCOLESTR ps
         IUnknown *pUnkObject, IErrorLog *pErrLog)
 {
     PropertyBag *This = impl_from_IPropertyBag2(iface);
-    FIXME("(%p)->(%s %x %p %p)\n", This, debugstr_w(pstrName), dwHint, pUnkObject, pErrLog);
+    FIXME("(%p)->(%s %lx %p %p)\n", This, debugstr_w(pstrName), dwHint, pUnkObject, pErrLog);
     return E_NOTIMPL;
 }
 
@@ -459,11 +459,11 @@ static void load_prop_bag(PluginHost *host, IPersistPropertyBag *persist_prop_ba
         hres = IPersistPropertyBag_Load(persist_prop_bag, prop_bag, NULL);
         IPropertyBag_Release(prop_bag);
         if(FAILED(hres))
-            WARN("Load failed: %08x\n", hres);
+            WARN("Load failed: %08lx\n", hres);
     }else {
         hres = IPersistPropertyBag_InitNew(persist_prop_bag);
         if(FAILED(hres))
-            WARN("InitNew failed: %08x\n", hres);
+            WARN("InitNew failed: %08lx\n", hres);
     }
 }
 
@@ -527,19 +527,19 @@ static void initialize_plugin_object(PluginHost *host)
         hres = IQuickActivate_QuickActivate(quick_activate, &container, &control);
         IQuickActivate_Release(quick_activate);
         if(FAILED(hres))
-            FIXME("QuickActivate failed: %08x\n", hres);
+            FIXME("QuickActivate failed: %08lx\n", hres);
     }else {
         DWORD status = 0;
 
         hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IOleObject, (void**)&ole_obj);
         if(SUCCEEDED(hres)) {
             hres = IOleObject_GetMiscStatus(ole_obj, DVASPECT_CONTENT, &status);
-            TRACE("GetMiscStatus returned %08x %x\n", hres, status);
+            TRACE("GetMiscStatus returned %08lx %lx\n", hres, status);
 
             hres = IOleObject_SetClientSite(ole_obj, &host->IOleClientSite_iface);
             IOleObject_Release(ole_obj);
             if(FAILED(hres)) {
-                FIXME("SetClientSite failed: %08x\n", hres);
+                FIXME("SetClientSite failed: %08lx\n", hres);
                 return;
             }
         }else {
@@ -556,11 +556,11 @@ static void initialize_plugin_object(PluginHost *host)
 
             hres = IViewObjectEx_SetAdvise(view_obj, DVASPECT_CONTENT, 0, (IAdviseSink*)&host->IAdviseSinkEx_iface);
             if(FAILED(hres))
-                WARN("SetAdvise failed: %08x\n", hres);
+                WARN("SetAdvise failed: %08lx\n", hres);
 
             hres = IViewObjectEx_GetViewStatus(view_obj, &view_status);
             IViewObjectEx_Release(view_obj);
-            TRACE("GetViewStatus returned %08x %x\n", hres, view_status);
+            TRACE("GetViewStatus returned %08lx %lx\n", hres, view_status);
         }
     }
 
@@ -603,7 +603,7 @@ static void embed_plugin_object(PluginHost *host)
     hres = IOleObject_DoVerb(ole_obj, OLEIVERB_INPLACEACTIVATE, NULL, &host->IOleClientSite_iface, 0, host->hwnd, &rect);
     IOleObject_Release(ole_obj);
     if(FAILED(hres))
-        WARN("DoVerb failed: %08x\n", hres);
+        WARN("DoVerb failed: %08lx\n", hres);
 
     if(host->ip_object) {
         HWND hwnd;
@@ -649,7 +649,7 @@ static void notif_enabled(PluginHost *plugin_host)
 
     hres = IUnknown_QueryInterface(plugin_host->plugin_unk, &IID_IDispatch, (void**)&disp);
     if(FAILED(hres)) {
-        FIXME("Could not get IDispatch iface: %08x\n", hres);
+        FIXME("Could not get IDispatch iface: %08lx\n", hres);
         return;
     }
 
@@ -915,7 +915,7 @@ static HRESULT WINAPI PHEventSink_GetTypeInfo(IDispatch *iface, UINT iTInfo,
         LCID lcid, ITypeInfo **ppTInfo)
 {
     PHEventSink *This = PHEventSink_from_IDispatch(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
+    FIXME("(%p)->(%d %ld %p)\n", This, iTInfo, lcid, ppTInfo);
     return E_NOTIMPL;
 }
 
@@ -923,7 +923,7 @@ static HRESULT WINAPI PHEventSink_GetIDsOfNames(IDispatch *iface, REFIID riid, L
         UINT cNames, LCID lcid, DISPID *rgDispId)
 {
     PHEventSink *This = PHEventSink_from_IDispatch(iface);
-    FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
+    FIXME("(%p)->(%s %p %u %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
     return E_NOTIMPL;
 }
 
@@ -935,7 +935,7 @@ static HRESULT WINAPI PHEventSink_Invoke(IDispatch *iface, DISPID dispIdMember,
     sink_entry_t *entry;
     HRESULT hres;
 
-    TRACE("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags,
+    TRACE("(%p)->(%ld %s %ld %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags,
           pDispParams, pVarResult, pExcepInfo, puArgErr);
 
     if(!This->host) {
@@ -945,7 +945,7 @@ static HRESULT WINAPI PHEventSink_Invoke(IDispatch *iface, DISPID dispIdMember,
 
     entry = find_sink_entry(This, dispIdMember);
     if(!entry || !entry->disp) {
-        WARN("No handler %d\n", dispIdMember);
+        WARN("No handler %ld\n", dispIdMember);
         if(pVarResult)
             V_VT(pVarResult) = VT_EMPTY;
         return S_OK;
@@ -953,7 +953,7 @@ static HRESULT WINAPI PHEventSink_Invoke(IDispatch *iface, DISPID dispIdMember,
 
     hres = IDispatch_QueryInterface(entry->disp, &IID_IDispatchEx, (void**)&dispex);
 
-    TRACE("(%p) %d >>>\n", This, entry->id);
+    TRACE("(%p) %ld >>>\n", This, entry->id);
     if(SUCCEEDED(hres)) {
         hres = IDispatchEx_InvokeEx(dispex, DISPID_VALUE, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, NULL);
         IDispatchEx_Release(dispex);
@@ -961,9 +961,9 @@ static HRESULT WINAPI PHEventSink_Invoke(IDispatch *iface, DISPID dispIdMember,
         hres = IDispatch_Invoke(entry->disp, DISPID_VALUE, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
     }
     if(SUCCEEDED(hres))
-        TRACE("(%p) %d <<<\n", This, entry->id);
+        TRACE("(%p) %ld <<<\n", This, entry->id);
     else
-        WARN("(%p) %d <<< %08x\n", This, entry->id, hres);
+        WARN("(%p) %ld <<< %08lx\n", This, entry->id, hres);
     return hres;
 }
 
@@ -1004,7 +1004,7 @@ static PHEventSink *create_event_sink(PluginHost *plugin_host, ITypeInfo *typein
 
     hres = IUnknown_QueryInterface(plugin_host->plugin_unk, &IID_IConnectionPointContainer, (void**)&cp_container);
     if(FAILED(hres)) {
-        WARN("Could not get IConnectionPointContainer iface: %08x\n", hres);
+        WARN("Could not get IConnectionPointContainer iface: %08lx\n", hres);
         return NULL;
     }
 
@@ -1033,7 +1033,7 @@ static PHEventSink *create_event_sink(PluginHost *plugin_host, ITypeInfo *typein
 
     IConnectionPoint_Release(cp);
     if(FAILED(hres)) {
-        WARN("Advise failed: %08x\n", hres);
+        WARN("Advise failed: %08lx\n", hres);
         return NULL;
     }
 
@@ -1114,7 +1114,7 @@ void bind_activex_event(HTMLDocumentNode *doc, HTMLPluginContainer *plugin_conta
         hres = IProvideClassInfo_GetClassInfo(provide_ci, &class_info);
         IProvideClassInfo_Release(provide_ci);
         if(FAILED(hres) || !class_info) {
-            WARN("GetClassInfo failed: %08x\n", hres);
+            WARN("GetClassInfo failed: %08lx\n", hres);
             return;
         }
 
@@ -1126,7 +1126,7 @@ void bind_activex_event(HTMLDocumentNode *doc, HTMLPluginContainer *plugin_conta
 
     hres = ITypeInfo_GetIDsOfNames(source_info, &event, 1, &id);
     if(FAILED(hres))
-        WARN("Could not get disp id: %08x\n", hres);
+        WARN("Could not get disp id: %08lx\n", hres);
     else if(!plugin_host->sink)
         plugin_host->sink = create_event_sink(plugin_host, source_info);
 
@@ -1177,7 +1177,7 @@ static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
     InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1187,7 +1187,7 @@ static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
     InPlaceFrame *This = impl_from_IOleInPlaceFrame(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -1357,7 +1357,7 @@ static ULONG WINAPI InPlaceUIWindow_AddRef(IOleInPlaceUIWindow *iface)
     InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1367,7 +1367,7 @@ static ULONG WINAPI InPlaceUIWindow_Release(IOleInPlaceUIWindow *iface)
     InPlaceUIWindow *This = impl_from_IOleInPlaceUIWindow(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -1508,7 +1508,7 @@ static ULONG WINAPI PHClientSite_AddRef(IOleClientSite *iface)
     PluginHost *This = impl_from_IOleClientSite(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1532,7 +1532,7 @@ static void release_plugin_ifaces(PluginHost *This)
         This->plugin_unk = NULL;
         ref = IUnknown_Release(unk);
 
-        TRACE("plugin ref = %d\n", ref);
+        TRACE("plugin ref = %ld\n", ref);
     }
 }
 
@@ -1541,7 +1541,7 @@ static ULONG WINAPI PHClientSite_Release(IOleClientSite *iface)
     PluginHost *This = impl_from_IOleClientSite(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_plugin_ifaces(This);
@@ -1571,7 +1571,7 @@ static HRESULT WINAPI PHClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAss
 {
     PluginHost *This = impl_from_IOleClientSite(iface);
 
-    TRACE("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
+    TRACE("(%p)->(%ld %ld %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
 
     switch(dwWhichMoniker) {
     case OLEWHICHMK_CONTAINER:
@@ -1584,7 +1584,7 @@ static HRESULT WINAPI PHClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAss
         IMoniker_AddRef(*ppmk);
         break;
     default:
-        FIXME("which %d\n", dwWhichMoniker);
+        FIXME("which %ld\n", dwWhichMoniker);
         return E_NOTIMPL;
     }
 
@@ -1674,7 +1674,7 @@ static void WINAPI PHAdviseSinkEx_OnDataChange(IAdviseSinkEx *iface, FORMATETC *
 static void WINAPI PHAdviseSinkEx_OnViewChange(IAdviseSinkEx *iface, DWORD dwAspect, LONG lindex)
 {
     PluginHost *This = impl_from_IAdviseSinkEx(iface);
-    FIXME("(%p)->(%d %d)\n", This, dwAspect, lindex);
+    FIXME("(%p)->(%ld %ld)\n", This, dwAspect, lindex);
 }
 
 static void WINAPI PHAdviseSinkEx_OnRename(IAdviseSinkEx *iface, IMoniker *pmk)
@@ -1698,7 +1698,7 @@ static void WINAPI PHAdviseSinkEx_OnClose(IAdviseSinkEx *iface)
 static void WINAPI PHAdviseSinkEx_OnViewStatusChange(IAdviseSinkEx *iface, DWORD dwViewStatus)
 {
     PluginHost *This = impl_from_IAdviseSinkEx(iface);
-    FIXME("(%p)->(%d)\n", This, dwViewStatus);
+    FIXME("(%p)->(%ld)\n", This, dwViewStatus);
 }
 
 static const IAdviseSinkExVtbl AdviseSinkExVtbl = {
@@ -1740,14 +1740,14 @@ static HRESULT WINAPI PHPropertyNotifySink_OnChanged(IPropertyNotifySink *iface,
 {
     PluginHost *This = impl_from_IPropertyNotifySink(iface);
 
-    TRACE("(%p)->(%d)\n", This, dispID);
+    TRACE("(%p)->(%ld)\n", This, dispID);
 
     switch(dispID) {
     case DISPID_READYSTATE:
         update_readystate(This);
         break;
     default :
-        FIXME("Unimplemented dispID %d\n", dispID);
+        FIXME("Unimplemented dispID %ld\n", dispID);
         return E_NOTIMPL;
     }
 
@@ -1757,7 +1757,7 @@ static HRESULT WINAPI PHPropertyNotifySink_OnChanged(IPropertyNotifySink *iface,
 static HRESULT WINAPI PHPropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
 {
     PluginHost *This = impl_from_IPropertyNotifySink(iface);
-    FIXME("(%p)->(%d)\n", This, dispID);
+    FIXME("(%p)->(%ld)\n", This, dispID);
     return E_NOTIMPL;
 }
 
@@ -1803,7 +1803,7 @@ static HRESULT WINAPI PHDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo,
         LCID lcid, ITypeInfo **ppTInfo)
 {
     PluginHost *This = impl_from_IDispatch(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
+    FIXME("(%p)->(%d %ld %p)\n", This, iTInfo, lcid, ppTInfo);
     return E_NOTIMPL;
 }
 
@@ -1811,7 +1811,7 @@ static HRESULT WINAPI PHDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid,
         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 {
     PluginHost *This = impl_from_IDispatch(iface);
-    FIXME("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
+    FIXME("(%p)->(%s %p %d %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
     return E_NOTIMPL;
 }
 
@@ -1819,7 +1819,7 @@ static HRESULT WINAPI PHDispatch_Invoke(IDispatch *iface, DISPID dispid,  REFIID
         WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
     PluginHost *This = impl_from_IDispatch(iface);
-    FIXME("(%p)->(%d %x %p %p)\n", This, dispid, wFlags, pDispParams, pVarResult);
+    FIXME("(%p)->(%ld %x %p %p)\n", This, dispid, wFlags, pDispParams, pVarResult);
     return E_NOTIMPL;
 }
 
@@ -1925,7 +1925,7 @@ static HRESULT WINAPI PHInPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
 
     hres = IOleInPlaceSite_GetWindowContext(This->doc->basedoc.doc_obj->ipsite, &ip_frame, &ip_window, &pr, &cr, frame_info);
     if(FAILED(hres)) {
-        WARN("GetWindowContext failed: %08x\n", hres);
+        WARN("GetWindowContext failed: %08lx\n", hres);
         return hres;
     }
 
@@ -1953,7 +1953,7 @@ static HRESULT WINAPI PHInPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
 static HRESULT WINAPI PHInPlaceSite_Scroll(IOleInPlaceSiteEx *iface, SIZE scrollExtent)
 {
     PluginHost *This = impl_from_IOleInPlaceSiteEx(iface);
-    FIXME("(%p)->({%d %d})\n", This, scrollExtent.cx, scrollExtent.cy);
+    FIXME("(%p)->({%ld %ld})\n", This, scrollExtent.cx, scrollExtent.cy);
     return E_NOTIMPL;
 }
 
@@ -2005,7 +2005,7 @@ static HRESULT WINAPI PHInPlaceSiteEx_OnInPlaceActivateEx(IOleInPlaceSiteEx *ifa
     HWND hwnd;
     HRESULT hres;
 
-    TRACE("(%p)->(%p %x)\n", This, pfNoRedraw, dwFlags);
+    TRACE("(%p)->(%p %lx)\n", This, pfNoRedraw, dwFlags);
 
     if(This->ip_object)
         return S_OK;
@@ -2104,14 +2104,14 @@ static HRESULT WINAPI PHControlSite_GetExtendedControl(IOleControlSite *iface, I
 static HRESULT WINAPI PHControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtlHimetric, POINTF *pPtfContainer, DWORD dwFlags)
 {
     PluginHost *This = impl_from_IOleControlSite(iface);
-    FIXME("(%p)->(%p %p %x)\n", This, pPtlHimetric, pPtfContainer, dwFlags);
+    FIXME("(%p)->(%p %p %lx)\n", This, pPtlHimetric, pPtfContainer, dwFlags);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI PHControlSite_TranslateAccelerator(IOleControlSite *iface, MSG *pMsg, DWORD grfModifiers)
 {
     PluginHost *This = impl_from_IOleControlSite(iface);
-    FIXME("(%p)->(%x)\n", This, grfModifiers);
+    FIXME("(%p)->(%lx)\n", This, grfModifiers);
     return E_NOTIMPL;
 }
 
@@ -2169,7 +2169,7 @@ static HRESULT WINAPI PHBindHost_CreateMoniker(IBindHost *iface, LPOLESTR szName
 {
     PluginHost *This = impl_from_IBindHost(iface);
 
-    TRACE("(%p)->(%s %p %p %x)\n", This, debugstr_w(szName), pBC, ppmk, dwReserved);
+    TRACE("(%p)->(%s %p %p %lx)\n", This, debugstr_w(szName), pBC, ppmk, dwReserved);
 
     if(!This->doc || !This->doc->window || !This->doc->window->mon) {
         FIXME("no moniker\n");
@@ -2342,7 +2342,7 @@ static ULONG WINAPI InstallCallback_AddRef(IBindStatusCallback *iface)
     InstallCallback *This = impl_from_IBindStatusCallback(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -2352,7 +2352,7 @@ static ULONG WINAPI InstallCallback_Release(IBindStatusCallback *iface)
     InstallCallback *This = impl_from_IBindStatusCallback(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -2364,7 +2364,7 @@ static HRESULT WINAPI InstallCallback_OnStartBinding(IBindStatusCallback *iface,
         DWORD dwReserved, IBinding *pib)
 {
     InstallCallback *This = impl_from_IBindStatusCallback(iface);
-    TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
+    TRACE("(%p)->(%lx %p)\n", This, dwReserved, pib);
     return S_OK;
 }
 
@@ -2378,7 +2378,7 @@ static HRESULT WINAPI InstallCallback_GetPriority(IBindStatusCallback *iface, LO
 static HRESULT WINAPI InstallCallback_OnLowResource(IBindStatusCallback *iface, DWORD dwReserved)
 {
     InstallCallback *This = impl_from_IBindStatusCallback(iface);
-    TRACE("(%p)->(%x)\n", This, dwReserved);
+    TRACE("(%p)->(%lx)\n", This, dwReserved);
     return S_OK;
 }
 
@@ -2386,7 +2386,7 @@ static HRESULT WINAPI InstallCallback_OnProgress(IBindStatusCallback *iface, ULO
         ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
 {
     InstallCallback *This = impl_from_IBindStatusCallback(iface);
-    TRACE("(%p)->(%u %u %u %s)\n", This, ulProgress, ulProgressMax, ulStatusCode, debugstr_w(szStatusText));
+    TRACE("(%p)->(%lu %lu %lu %s)\n", This, ulProgress, ulProgressMax, ulStatusCode, debugstr_w(szStatusText));
     return S_OK;
 }
 
@@ -2394,7 +2394,7 @@ static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface,
         HRESULT hresult, LPCWSTR szError)
 {
     InstallCallback *This = impl_from_IBindStatusCallback(iface);
-    TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
+    TRACE("(%p)->(%08lx %s)\n", This, hresult, debugstr_w(szError));
     return S_OK;
 }
 
@@ -2515,7 +2515,7 @@ static void install_codebase(const WCHAR *url)
     hres = AsyncInstallDistributionUnit(NULL, NULL, NULL, 0, 0, url, bctx, NULL, 0);
     IBindCtx_Release(bctx);
     if(FAILED(hres))
-        WARN("FAILED: %08x\n", hres);
+        WARN("FAILED: %08lx\n", hres);
 }
 
 static void check_codebase(HTMLInnerWindow *window, nsIDOMElement *nselem)
@@ -2598,7 +2598,7 @@ static IUnknown *create_activex_object(HTMLDocumentNode *doc, nsIDOMElement *nse
     hres = IInternetHostSecurityManager_ProcessUrlAction(&doc->IInternetHostSecurityManager_iface,
             URLACTION_ACTIVEX_RUN, (BYTE*)&policy, sizeof(policy), (BYTE*)clsid, sizeof(GUID), 0, 0);
     if(FAILED(hres) || policy != URLPOLICY_ALLOW) {
-        WARN("ProcessUrlAction returned %08x %x\n", hres, policy);
+        WARN("ProcessUrlAction returned %08lx %lx\n", hres, policy);
         return NULL;
     }
 
diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c
index d11c0132cf5..cc911c50f41 100644
--- a/dlls/mshtml/protocol.c
+++ b/dlls/mshtml/protocol.c
@@ -100,7 +100,7 @@ static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
         LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult,
         DWORD cchResult, DWORD* pcchResult, DWORD dwReserved)
 {
-    TRACE("%p)->(%s %s %08x %p %d %p %d)\n", iface, debugstr_w(pwzBaseUrl),
+    TRACE("%p)->(%s %s %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzBaseUrl),
             debugstr_w(pwzRelativeUrl), dwCombineFlags, pwzResult, cchResult,
             pcchResult, dwReserved);
 
@@ -110,7 +110,7 @@ static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1,
         LPCWSTR pwzUrl2, DWORD dwCompareFlags)
 {
-    TRACE("%p)->(%s %s %08x)\n", iface, debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
+    TRACE("%p)->(%s %s %08lx)\n", iface, debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
     return E_NOTIMPL;
 }
 
@@ -180,7 +180,7 @@ static ULONG WINAPI Protocol_AddRef(IUnknown *iface)
 {
     InternetProtocol *This = impl_from_IUnknown(iface);
     ULONG ref = InterlockedIncrement(&This->ref);
-    TRACE("(%p) ref=%d\n", iface, ref);
+    TRACE("(%p) ref=%ld\n", iface, ref);
     return ref;
 }
 
@@ -189,7 +189,7 @@ static ULONG WINAPI Protocol_Release(IUnknown *iface)
     InternetProtocol *This = impl_from_IUnknown(iface);
     ULONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%x\n", iface, ref);
+    TRACE("(%p) ref=%lx\n", iface, ref);
 
     if(!ref) {
         heap_free(This->data);
@@ -234,14 +234,14 @@ static HRESULT WINAPI InternetProtocol_Abort(IInternetProtocol *iface, HRESULT h
         DWORD dwOptions)
 {
     InternetProtocol *This = impl_from_IInternetProtocol(iface);
-    FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
+    FIXME("(%p)->(%08lx %08lx)\n", This, hrReason, dwOptions);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI InternetProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
 {
     InternetProtocol *This = impl_from_IInternetProtocol(iface);
-    TRACE("(%p)->(%08x)\n", This, dwOptions);
+    TRACE("(%p)->(%08lx)\n", This, dwOptions);
     return S_OK;
 }
 
@@ -263,7 +263,7 @@ static HRESULT WINAPI InternetProtocol_Read(IInternetProtocol *iface, void* pv,
 {
     InternetProtocol *This = impl_from_IInternetProtocol(iface);
 
-    TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
+    TRACE("(%p)->(%p %lu %p)\n", This, pv, cb, pcbRead);
 
     if(!This->data)
         return E_FAIL;
@@ -283,7 +283,7 @@ static HRESULT WINAPI InternetProtocol_Seek(IInternetProtocol *iface, LARGE_INTE
         DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition)
 {
     InternetProtocol *This = impl_from_IInternetProtocol(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
+    FIXME("(%p)->(%ld %ld %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
     return E_NOTIMPL;
 }
 
@@ -291,7 +291,7 @@ static HRESULT WINAPI InternetProtocol_LockRequest(IInternetProtocol *iface, DWO
 {
     InternetProtocol *This = impl_from_IInternetProtocol(iface);
 
-    TRACE("(%p)->(%d)\n", This, dwOptions);
+    TRACE("(%p)->(%ld)\n", This, dwOptions);
 
     return S_OK;
 }
@@ -351,7 +351,7 @@ static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUr
      * when the url does not have "about:" in the beginning.
      */
 
-    TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
+    TRACE("(%p)->(%s %p %p %08lx %Ix)\n", This, debugstr_w(szUrl), pOIProtSink,
             pOIBindInfo, grfPI, dwReserved);
 
     memset(&bindinfo, 0, sizeof(bindinfo));
@@ -361,7 +361,7 @@ static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUr
         return hres;
     ReleaseBindInfo(&bindinfo);
 
-    TRACE("bindf %x\n", grfBINDF);
+    TRACE("bindf %lx\n", grfBINDF);
 
     if(lstrlenW(szUrl) >= ARRAY_SIZE(wszAbout) && !memcmp(wszAbout, szUrl, sizeof(wszAbout))) {
         text = szUrl + ARRAY_SIZE(wszAbout);
@@ -425,7 +425,7 @@ static HRESULT WINAPI AboutProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, L
         PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
         DWORD* pcchResult, DWORD dwReserved)
 {
-    TRACE("%p)->(%s %d %08x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), ParseAction,
+    TRACE("%p)->(%s %d %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), ParseAction,
             dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
 
     if(ParseAction == PARSE_SECURITY_URL) {
@@ -457,7 +457,7 @@ static HRESULT WINAPI AboutProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
         QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD* pcbBuf,
         DWORD dwReserved)
 {
-    TRACE("%p)->(%s %08x %08x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
+    TRACE("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
           cbBuffer, pcbBuf, dwReserved);
 
     switch(QueryOption) {
@@ -543,7 +543,7 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
 
     static const WCHAR wszRes[] = {'r','e','s',':','/','/'};
 
-    TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
+    TRACE("(%p)->(%s %p %p %08lx %Ix)\n", This, debugstr_w(szUrl), pOIProtSink,
             pOIBindInfo, grfPI, dwReserved);
 
     memset(&bindinfo, 0, sizeof(bindinfo));
@@ -557,7 +557,7 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
     url = heap_alloc(len*sizeof(WCHAR));
     hres = CoInternetParseUrl(szUrl, PARSE_ENCODE, 0, url, len, &len, 0);
     if(FAILED(hres)) {
-        WARN("CoInternetParseUrl failed: %08x\n", hres);
+        WARN("CoInternetParseUrl failed: %08lx\n", hres);
         heap_free(url);
         IInternetProtocolSink_ReportResult(pOIProtSink, hres, 0, NULL);
         return hres;
@@ -684,7 +684,7 @@ static HRESULT WINAPI ResProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPC
         PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
         DWORD* pcchResult, DWORD dwReserved)
 {
-    TRACE("%p)->(%s %d %x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), ParseAction,
+    TRACE("%p)->(%s %d %lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), ParseAction,
             dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
 
     if(ParseAction == PARSE_SECURITY_URL) {
@@ -758,7 +758,7 @@ static HRESULT WINAPI ResProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LP
         QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD* pcbBuf,
         DWORD dwReserved)
 {
-    TRACE("%p)->(%s %08x %08x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
+    TRACE("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
           cbBuffer, pcbBuf, dwReserved);
 
     switch(QueryOption) {
@@ -822,7 +822,7 @@ static HRESULT WINAPI JSProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCW
         PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
         DWORD* pcchResult, DWORD dwReserved)
 {
-    TRACE("%p)->(%s %d %x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), ParseAction,
+    TRACE("%p)->(%s %d %lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), ParseAction,
           dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
 
     switch(ParseAction) {
@@ -843,7 +843,7 @@ static HRESULT WINAPI JSProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPC
         QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD* pcbBuf,
         DWORD dwReserved)
 {
-    TRACE("%p)->(%s %08x %08x %p %d %p %d)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
+    TRACE("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
           cbBuffer, pcbBuf, dwReserved);
 
     switch(QueryOption) {
diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c
index 375f76de40c..59d1a59b0b0 100644
--- a/dlls/mshtml/range.c
+++ b/dlls/mshtml/range.c
@@ -129,7 +129,7 @@ static void get_text_node_data(nsIDOMNode *node, nsAString *nsstr, const PRUnich
     nsres = nsIDOMText_GetData(nstext, nsstr);
     nsIDOMText_Release(nstext);
     if(NS_FAILED(nsres))
-        ERR("GetData failed: %08x\n", nsres);
+        ERR("GetData failed: %08lx\n", nsres);
 
     nsAString_GetData(nsstr, str);
 }
@@ -313,14 +313,14 @@ static void set_start_point(HTMLTxtRange *This, const rangepoint_t *start)
 {
     nsresult nsres = nsIDOMRange_SetStart(This->nsrange, start->node, start->off);
     if(NS_FAILED(nsres))
-        ERR("failed: %08x\n", nsres);
+        ERR("failed: %08lx\n", nsres);
 }
 
 static void set_end_point(HTMLTxtRange *This, const rangepoint_t *end)
 {
     nsresult nsres = nsIDOMRange_SetEnd(This->nsrange, end->node, end->off);
     if(NS_FAILED(nsres))
-        ERR("failed: %08x\n", nsres);
+        ERR("failed: %08lx\n", nsres);
 }
 
 static BOOL is_elem_tag(nsIDOMNode *node, LPCWSTR istag)
@@ -841,7 +841,7 @@ static ULONG WINAPI HTMLTxtRange_AddRef(IHTMLTxtRange *iface)
     HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -851,7 +851,7 @@ static ULONG WINAPI HTMLTxtRange_Release(IHTMLTxtRange *iface)
     HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->nsrange)
@@ -952,20 +952,20 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
     nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->nsdoc, &text_str, &text_node);
     nsAString_Finish(&text_str);
     if(NS_FAILED(nsres)) {
-        ERR("CreateTextNode failed: %08x\n", nsres);
+        ERR("CreateTextNode failed: %08lx\n", nsres);
         return S_OK;
     }
     nsres = nsIDOMRange_DeleteContents(This->nsrange);
     if(NS_FAILED(nsres))
-        ERR("DeleteContents failed: %08x\n", nsres);
+        ERR("DeleteContents failed: %08lx\n", nsres);
 
     nsres = nsIDOMRange_InsertNode(This->nsrange, (nsIDOMNode*)text_node);
     if(NS_FAILED(nsres))
-        ERR("InsertNode failed: %08x\n", nsres);
+        ERR("InsertNode failed: %08lx\n", nsres);
 
     nsres = nsIDOMRange_SetEndAfter(This->nsrange, (nsIDOMNode*)text_node);
     if(NS_FAILED(nsres))
-        ERR("SetEndAfter failed: %08x\n", nsres);
+        ERR("SetEndAfter failed: %08lx\n", nsres);
 
     return IHTMLTxtRange_collapse(&This->IHTMLTxtRange_iface, VARIANT_FALSE);
 }
@@ -1064,7 +1064,7 @@ static HRESULT WINAPI HTMLTxtRange_inRange(IHTMLTxtRange *iface, IHTMLTxtRange *
     }
 
     if(NS_FAILED(nsres))
-        ERR("CompareBoundaryPoints failed: %08x\n", nsres);
+        ERR("CompareBoundaryPoints failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1095,7 +1095,7 @@ static HRESULT WINAPI HTMLTxtRange_isEqual(IHTMLTxtRange *iface, IHTMLTxtRange *
     }
 
     if(NS_FAILED(nsres))
-        ERR("CompareBoundaryPoints failed: %08x\n", nsres);
+        ERR("CompareBoundaryPoints failed: %08lx\n", nsres);
 
     return S_OK;
 }
@@ -1161,14 +1161,14 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA
 
         nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
         if(NS_FAILED(nsres) || !nsbody) {
-            ERR("Could not get body: %08x\n", nsres);
+            ERR("Could not get body: %08lx\n", nsres);
             break;
         }
 
         nsres = nsIDOMRange_SelectNodeContents(This->nsrange, (nsIDOMNode*)nsbody);
         nsIDOMHTMLElement_Release(nsbody);
         if(NS_FAILED(nsres)) {
-            ERR("Collapse failed: %08x\n", nsres);
+            ERR("Collapse failed: %08lx\n", nsres);
             break;
         }
 
@@ -1189,7 +1189,7 @@ static HRESULT WINAPI HTMLTxtRange_move(IHTMLTxtRange *iface, BSTR Unit,
     HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
     range_unit_t unit;
 
-    TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(Unit), Count, ActualCount);
+    TRACE("(%p)->(%s %ld %p)\n", This, debugstr_w(Unit), Count, ActualCount);
 
     unit = string_to_unit(Unit);
     if(unit == RU_UNKNOWN)
@@ -1231,7 +1231,7 @@ static HRESULT WINAPI HTMLTxtRange_move(IHTMLTxtRange *iface, BSTR Unit,
         FIXME("unimplemented unit %s\n", debugstr_w(Unit));
     }
 
-    TRACE("ret %d\n", *ActualCount);
+    TRACE("ret %ld\n", *ActualCount);
     return S_OK;
 }
 
@@ -1241,7 +1241,7 @@ static HRESULT WINAPI HTMLTxtRange_moveStart(IHTMLTxtRange *iface, BSTR Unit,
     HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
     range_unit_t unit;
 
-    TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(Unit), Count, ActualCount);
+    TRACE("(%p)->(%s %ld %p)\n", This, debugstr_w(Unit), Count, ActualCount);
 
     unit = string_to_unit(Unit);
     if(unit == RU_UNKNOWN)
@@ -1279,7 +1279,7 @@ static HRESULT WINAPI HTMLTxtRange_moveEnd(IHTMLTxtRange *iface, BSTR Unit,
     HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
     range_unit_t unit;
 
-    TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(Unit), Count, ActualCount);
+    TRACE("(%p)->(%s %ld %p)\n", This, debugstr_w(Unit), Count, ActualCount);
 
     unit = string_to_unit(Unit);
     if(unit == RU_UNKNOWN)
@@ -1320,7 +1320,7 @@ static HRESULT WINAPI HTMLTxtRange_select(IHTMLTxtRange *iface)
 
     nsres = nsIDOMWindow_GetSelection(This->doc->basedoc.window->nswindow, &nsselection);
     if(NS_FAILED(nsres)) {
-        ERR("GetSelection failed: %08x\n", nsres);
+        ERR("GetSelection failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1346,14 +1346,14 @@ static HRESULT WINAPI HTMLTxtRange_pasteHTML(IHTMLTxtRange *iface, BSTR html)
     nsres = nsIDOMRange_CreateContextualFragment(This->nsrange, &nsstr, &doc_frag);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
-        ERR("CreateContextualFragment failed: %08x\n", nsres);
+        ERR("CreateContextualFragment failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
     nsres = nsIDOMRange_InsertNode(This->nsrange, (nsIDOMNode*)doc_frag);
     nsIDOMDocumentFragment_Release(doc_frag);
     if(NS_FAILED(nsres)) {
-        ERR("InsertNode failed: %08x\n", nsres);
+        ERR("InsertNode failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1376,7 +1376,7 @@ static HRESULT WINAPI HTMLTxtRange_moveToElementText(IHTMLTxtRange *iface, IHTML
 
     nsres = nsIDOMRange_SelectNodeContents(This->nsrange, elem->node.nsnode);
     if(NS_FAILED(nsres)) {
-        ERR("SelectNodeContents failed: %08x\n", nsres);
+        ERR("SelectNodeContents failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -1478,7 +1478,7 @@ static HRESULT WINAPI HTMLTxtRange_compareEndPoints(IHTMLTxtRange *iface, BSTR h
 
     nsres = nsIDOMRange_CompareBoundaryPoints(This->nsrange, nscmpt, src_range->nsrange, &nsret);
     if(NS_FAILED(nsres))
-        ERR("CompareBoundaryPoints failed: %08x\n", nsres);
+        ERR("CompareBoundaryPoints failed: %08lx\n", nsres);
 
     *ret = nsret;
     return S_OK;
@@ -1488,14 +1488,14 @@ static HRESULT WINAPI HTMLTxtRange_findText(IHTMLTxtRange *iface, BSTR String,
         LONG count, LONG Flags, VARIANT_BOOL *Success)
 {
     HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
-    FIXME("(%p)->(%s %d %08x %p)\n", This, debugstr_w(String), count, Flags, Success);
+    FIXME("(%p)->(%s %ld %08lx %p)\n", This, debugstr_w(String), count, Flags, Success);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLTxtRange_moveToPoint(IHTMLTxtRange *iface, LONG x, LONG y)
 {
     HTMLTxtRange *This = impl_from_IHTMLTxtRange(iface);
-    FIXME("(%p)->(%d %d)\n", This, x, y);
+    FIXME("(%p)->(%ld %ld)\n", This, x, y);
     return E_NOTIMPL;
 }
 
@@ -1645,7 +1645,7 @@ static HRESULT WINAPI RangeCommandTarget_QueryStatus(IOleCommandTarget *iface, c
         ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
 {
     HTMLTxtRange *This = impl_from_IOleCommandTarget(iface);
-    FIXME("(%p)->(%s %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
+    FIXME("(%p)->(%s %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
     return E_NOTIMPL;
 }
 
@@ -1685,7 +1685,7 @@ static HRESULT WINAPI RangeCommandTarget_Exec(IOleCommandTarget *iface, const GU
 {
     HTMLTxtRange *This = impl_from_IOleCommandTarget(iface);
 
-    TRACE("(%p)->(%s %d %x %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
+    TRACE("(%p)->(%s %ld %lx %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
           nCmdexecopt, pvaIn, pvaOut);
 
     if(pguidCmdGroup && IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
@@ -1693,10 +1693,10 @@ static HRESULT WINAPI RangeCommandTarget_Exec(IOleCommandTarget *iface, const GU
         case IDM_INDENT:
             return exec_indent(This, pvaIn, pvaOut);
         default:
-            FIXME("Unsupported cmdid %d of CGID_MSHTML\n", nCmdID);
+            FIXME("Unsupported cmdid %ld of CGID_MSHTML\n", nCmdID);
         }
     }else {
-        FIXME("Unsupported cmd %d of group %s\n", nCmdID, debugstr_guid(pguidCmdGroup));
+        FIXME("Unsupported cmd %ld of group %s\n", nCmdID, debugstr_guid(pguidCmdGroup));
     }
 
     return E_NOTIMPL;
@@ -1779,7 +1779,7 @@ static ULONG WINAPI HTMLDOMRange_AddRef(IHTMLDOMRange *iface)
     HTMLDOMRange *This = impl_from_IHTMLDOMRange(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -1789,7 +1789,7 @@ static ULONG WINAPI HTMLDOMRange_Release(IHTMLDOMRange *iface)
     HTMLDOMRange *This = impl_from_IHTMLDOMRange(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->nsrange)
@@ -1881,14 +1881,14 @@ static HRESULT WINAPI HTMLDOMRange_get_commonAncestorContainer(IHTMLDOMRange *if
 static HRESULT WINAPI HTMLDOMRange_setStart(IHTMLDOMRange *iface, IDispatch *node, LONG offset)
 {
     HTMLDOMRange *This = impl_from_IHTMLDOMRange(iface);
-    FIXME("(%p)->(%p, %d)\n", This, node, offset);
+    FIXME("(%p)->(%p, %ld)\n", This, node, offset);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDOMRange_setEnd(IHTMLDOMRange *iface, IDispatch *node, LONG offset)
 {
     HTMLDOMRange *This = impl_from_IHTMLDOMRange(iface);
-    FIXME("(%p)->(%p, %d)\n", This, node, offset);
+    FIXME("(%p)->(%p, %ld)\n", This, node, offset);
     return E_NOTIMPL;
 }
 
@@ -2135,7 +2135,7 @@ static ULONG WINAPI MarkupPointer2_AddRef(IMarkupPointer2 *iface)
     MarkupPointer *This = impl_from_IMarkupPointer2(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -2145,7 +2145,7 @@ static ULONG WINAPI MarkupPointer2_Release(IMarkupPointer2 *iface)
     MarkupPointer *This = impl_from_IMarkupPointer2(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -2299,7 +2299,7 @@ static HRESULT WINAPI MarkupPointer2_FindText(IMarkupPointer2 *iface, OLECHAR *t
                                               IMarkupPointer *end_match, IMarkupPointer *end_search)
 {
     MarkupPointer *This = impl_from_IMarkupPointer2(iface);
-    FIXME("(%p)->(%s %x %p %p)\n", This, debugstr_w(text), flags, end_match, end_search);
+    FIXME("(%p)->(%s %lx %p %p)\n", This, debugstr_w(text), flags, end_match, end_search);
     return E_NOTIMPL;
 }
 
@@ -2320,7 +2320,7 @@ static HRESULT WINAPI MarkupPointer2_GetMarkupPosition(IMarkupPointer2 *iface, L
 static HRESULT WINAPI MarkupPointer2_MoveToMarkupPosition(IMarkupPointer2 *iface, IMarkupContainer *container, LONG mp)
 {
     MarkupPointer *This = impl_from_IMarkupPointer2(iface);
-    FIXME("(%p)->(%p %d)\n", This, container, mp);
+    FIXME("(%p)->(%p %ld)\n", This, container, mp);
     return E_NOTIMPL;
 }
 
diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c
index 2a0d86c9f76..e49449a61f8 100644
--- a/dlls/mshtml/script.c
+++ b/dlls/mshtml/script.c
@@ -99,14 +99,14 @@ static BOOL set_script_prop(ScriptHost *script_host, DWORD property, VARIANT *va
     hres = IActiveScript_QueryInterface(script_host->script, &IID_IActiveScriptProperty,
             (void**)&script_prop);
     if(FAILED(hres)) {
-        WARN("Could not get IActiveScriptProperty iface: %08x\n", hres);
+        WARN("Could not get IActiveScriptProperty iface: %08lx\n", hres);
         return FALSE;
     }
 
     hres = IActiveScriptProperty_SetProperty(script_prop, property, NULL, val);
     IActiveScriptProperty_Release(script_prop);
     if(FAILED(hres)) {
-        WARN("SetProperty(%x) failed: %08x\n", property, hres);
+        WARN("SetProperty(%lx) failed: %08lx\n", property, hres);
         return FALSE;
     }
 
@@ -124,19 +124,19 @@ static BOOL init_script_engine(ScriptHost *script_host)
 
     hres = IActiveScript_QueryInterface(script_host->script, &IID_IActiveScriptParse, (void**)&script_host->parse);
     if(FAILED(hres)) {
-        WARN("Could not get IActiveScriptParse: %08x\n", hres);
+        WARN("Could not get IActiveScriptParse: %08lx\n", hres);
         return FALSE;
     }
 
     hres = IActiveScript_QueryInterface(script_host->script, &IID_IObjectSafety, (void**)&safety);
     if(FAILED(hres)) {
-        FIXME("Could not get IObjectSafety: %08x\n", hres);
+        FIXME("Could not get IObjectSafety: %08lx\n", hres);
         return FALSE;
     }
 
     hres = IObjectSafety_GetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, &supported_opts, &enabled_opts);
     if(FAILED(hres)) {
-        FIXME("GetInterfaceSafetyOptions failed: %08x\n", hres);
+        FIXME("GetInterfaceSafetyOptions failed: %08lx\n", hres);
     }else if(!(supported_opts & INTERFACE_USES_DISPEX)) {
         FIXME("INTERFACE_USES_DISPEX is not supported\n");
     }else {
@@ -144,7 +144,7 @@ static BOOL init_script_engine(ScriptHost *script_host)
                 INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER,
                 INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER);
         if(FAILED(hres))
-            FIXME("SetInterfaceSafetyOptions failed: %08x\n", hres);
+            FIXME("SetInterfaceSafetyOptions failed: %08lx\n", hres);
     }
 
     IObjectSafety_Release(safety);
@@ -175,26 +175,26 @@ static BOOL init_script_engine(ScriptHost *script_host)
 
     hres = IActiveScriptParse_InitNew(script_host->parse);
     if(FAILED(hres)) {
-        WARN("InitNew failed: %08x\n", hres);
+        WARN("InitNew failed: %08lx\n", hres);
         return FALSE;
     }
 
     hres = IActiveScript_SetScriptSite(script_host->script, &script_host->IActiveScriptSite_iface);
     if(FAILED(hres)) {
-        WARN("SetScriptSite failed: %08x\n", hres);
+        WARN("SetScriptSite failed: %08lx\n", hres);
         IActiveScript_Close(script_host->script);
         return FALSE;
     }
 
     hres = IActiveScript_GetScriptState(script_host->script, &state);
     if(FAILED(hres))
-        WARN("GetScriptState failed: %08x\n", hres);
+        WARN("GetScriptState failed: %08lx\n", hres);
     else if(state != SCRIPTSTATE_INITIALIZED)
         FIXME("state = %x\n", state);
 
     hres = IActiveScript_SetScriptState(script_host->script, SCRIPTSTATE_STARTED);
     if(FAILED(hres)) {
-        WARN("Starting script failed: %08x\n", hres);
+        WARN("Starting script failed: %08lx\n", hres);
         return FALSE;
     }
 
@@ -205,14 +205,14 @@ static BOOL init_script_engine(ScriptHost *script_host)
         V_BOOL(&var) = VARIANT_TRUE;
         set_script_prop(script_host, SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION, &var);
     }else {
-       WARN("AddNamedItem failed: %08x\n", hres);
+       WARN("AddNamedItem failed: %08lx\n", hres);
     }
 
     hres = IActiveScript_QueryInterface(script_host->script, &IID_IActiveScriptParseProcedure2,
                                         (void**)&script_host->parse_proc);
     if(FAILED(hres)) {
         /* FIXME: QI for IActiveScriptParseProcedure */
-        WARN("Could not get IActiveScriptParseProcedure iface: %08x\n", hres);
+        WARN("Could not get IActiveScriptParseProcedure iface: %08lx\n", hres);
     }
 
     return TRUE;
@@ -308,7 +308,7 @@ static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface)
     ScriptHost *This = impl_from_IActiveScriptSite(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -318,7 +318,7 @@ static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface)
     ScriptHost *This = impl_from_IActiveScriptSite(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_script_engine(This);
@@ -345,10 +345,10 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPC
 {
     ScriptHost *This = impl_from_IActiveScriptSite(iface);
 
-    TRACE("(%p)->(%s %x %p %p)\n", This, debugstr_w(pstrName), dwReturnMask, ppiunkItem, ppti);
+    TRACE("(%p)->(%s %lx %p %p)\n", This, debugstr_w(pstrName), dwReturnMask, ppiunkItem, ppti);
 
     if(dwReturnMask != SCRIPTINFO_IUNKNOWN) {
-        FIXME("Unsupported mask %x\n", dwReturnMask);
+        FIXME("Unsupported mask %lx\n", dwReturnMask);
         return E_NOTIMPL;
     }
 
@@ -592,7 +592,7 @@ static HRESULT WINAPI ActiveScriptSiteDebug_GetDocumentContextFromPosition(IActi
             CTXARG_T dwSourceContext, ULONG uCharacterOffset, ULONG uNumChars, IDebugDocumentContext **ppsc)
 {
     ScriptHost *This = impl_from_IActiveScriptSiteDebug(iface);
-    FIXME("(%p)->(%s %u %u %p)\n", This, wine_dbgstr_longlong(dwSourceContext), uCharacterOffset,
+    FIXME("(%p)->(%s %lu %lu %p)\n", This, wine_dbgstr_longlong(dwSourceContext), uCharacterOffset,
           uNumChars, ppsc);
     return E_NOTIMPL;
 }
@@ -713,7 +713,7 @@ static ScriptHost *create_script_host(HTMLInnerWindow *window, const GUID *guid)
     hres = CoCreateInstance(&ret->guid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
             &IID_IActiveScript, (void**)&ret->script);
     if(FAILED(hres))
-        WARN("Could not load script engine: %08x\n", hres);
+        WARN("Could not load script engine: %08lx\n", hres);
     else if(!init_script_engine(ret))
         release_script_engine(ret);
 
@@ -817,7 +817,7 @@ static void parse_elem_text(ScriptHost *script_host, HTMLScriptElement *script_e
     if(SUCCEEDED(hres))
         TRACE("<<<\n");
     else
-        WARN("<<< %08x\n", hres);
+        WARN("<<< %08lx\n", hres);
 }
 
 typedef struct {
@@ -977,7 +977,7 @@ static HRESULT ScriptBSC_start_binding(BSCallback *bsc)
         if(NS_SUCCEEDED(nsres)) {
             nsres = nsILoadGroup_AddRequest(This->load_group, This->request, NULL);
             if(NS_FAILED(nsres))
-                ERR("AddRequest failed: %08x\n", nsres);
+                ERR("AddRequest failed: %08lx\n", nsres);
         }
     }
 
@@ -1005,7 +1005,7 @@ static HRESULT ScriptBSC_stop_binding(BSCallback *bsc, HRESULT result)
     if(SUCCEEDED(result)) {
         script_file_available(This);
     }else {
-        FIXME("binding failed %08x\n", result);
+        FIXME("binding failed %08lx\n", result);
         heap_free(This->buf);
         This->buf = NULL;
         This->size = 0;
@@ -1014,7 +1014,7 @@ static HRESULT ScriptBSC_stop_binding(BSCallback *bsc, HRESULT result)
     if(This->request) {
         nsres = nsILoadGroup_RemoveRequest(This->load_group, This->request, NULL, NS_OK);
         if(NS_FAILED(nsres))
-            ERR("RemoveRequest failed: %08x\n", nsres);
+            ERR("RemoveRequest failed: %08lx\n", nsres);
         nsIRequest_Release(This->request);
         This->request = NULL;
     }
@@ -1162,7 +1162,7 @@ static void parse_inline_script(ScriptHost *script_host, HTMLScriptElement *scri
     set_script_elem_readystate(script_elem, READYSTATE_INTERACTIVE);
 
     if(NS_FAILED(nsres)) {
-        ERR("GetText failed: %08x\n", nsres);
+        ERR("GetText failed: %08lx\n", nsres);
     }else if(*text) {
         parse_elem_text(script_host, script_elem, text);
     }
@@ -1189,7 +1189,7 @@ static BOOL parse_script_elem(ScriptHost *script_host, HTMLScriptElement *script
             return FALSE;
         }
     }else {
-        ERR("GetEvent failed: %08x\n", nsres);
+        ERR("GetEvent failed: %08lx\n", nsres);
     }
     nsAString_Finish(&event_str);
 
@@ -1198,7 +1198,7 @@ static BOOL parse_script_elem(ScriptHost *script_host, HTMLScriptElement *script
     nsAString_GetData(&src_str, &src);
 
     if(NS_FAILED(nsres)) {
-        ERR("GetSrc failed: %08x\n", nsres);
+        ERR("GetSrc failed: %08lx\n", nsres);
     }else if(*src) {
         load_script(script_elem, src, FALSE);
         is_complete = script_elem->parsed;
@@ -1269,7 +1269,7 @@ static BOOL get_script_guid(HTMLInnerWindow *window, nsIDOMHTMLScriptElement *ns
             return ret;
         }
     }else {
-        ERR("GetType failed: %08x\n", nsres);
+        ERR("GetType failed: %08lx\n", nsres);
     }
 
     nsres = nsIDOMHTMLScriptElement_QueryInterface(nsscript, &IID_nsIDOMElement, (void**)&nselem);
@@ -1395,7 +1395,7 @@ IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text)
             NULL, NULL, L"\"", 0 /* FIXME */, 0,
             SCRIPTPROC_HOSTMANAGESSOURCE|SCRIPTPROC_IMPLICIT_THIS|SCRIPTPROC_IMPLICIT_PARENTS, &disp);
     if(FAILED(hres)) {
-        WARN("ParseProcedureText failed: %08x\n", hres);
+        WARN("ParseProcedureText failed: %08lx\n", hres);
         return NULL;
     }
 
@@ -1432,7 +1432,7 @@ HRESULT exec_script(HTMLInnerWindow *window, const WCHAR *code, const WCHAR *lan
     if(SUCCEEDED(hres))
         TRACE("<<<\n");
     else
-        WARN("<<< %08x\n", hres);
+        WARN("<<< %08lx\n", hres);
 
     return hres;
 }
@@ -1463,7 +1463,7 @@ static EventTarget *find_event_target(HTMLDocumentNode *doc, HTMLScriptElement *
     nsAString_Init(&target_id_str, NULL);
     nsres = nsIDOMHTMLScriptElement_GetHtmlFor(script_elem->nsscript, &target_id_str);
     if(NS_FAILED(nsres)) {
-        ERR("GetScriptFor failed: %08x\n", nsres);
+        ERR("GetScriptFor failed: %08lx\n", nsres);
         nsAString_Finish(&target_id_str);
         return NULL;
     }
@@ -1566,7 +1566,7 @@ static IDispatch *parse_event_elem(HTMLDocumentNode *doc, HTMLScriptElement *scr
         if(FAILED(hres))
             disp = NULL;
     }else {
-        ERR("GetText failed: %08x\n", nsres);
+        ERR("GetText failed: %08lx\n", nsres);
         disp = NULL;
     }
     nsAString_Finish(&nsstr);
@@ -1603,7 +1603,7 @@ void bind_event_scripts(HTMLDocumentNode *doc)
     nsres = nsIDOMHTMLDocument_QuerySelectorAll(doc->nsdoc, &selector_str, &node_list);
     nsAString_Finish(&selector_str);
     if(NS_FAILED(nsres)) {
-        ERR("QuerySelectorAll failed: %08x\n", nsres);
+        ERR("QuerySelectorAll failed: %08lx\n", nsres);
         return;
     }
 
@@ -1616,7 +1616,7 @@ void bind_event_scripts(HTMLDocumentNode *doc)
     for(i=0; i < length; i++) {
         nsres = nsIDOMNodeList_Item(node_list, i, &script_node);
         if(NS_FAILED(nsres) || !script_node) {
-            ERR("Item(%d) failed: %08x\n", i, nsres);
+            ERR("Item(%d) failed: %08lx\n", i, nsres);
             continue;
         }
 
@@ -1717,13 +1717,13 @@ static BOOL use_gecko_script(IUri *uri)
 
     hres = IInternetSecurityManager_MapUrlToZone(get_security_manager(), display_uri, &zone, 0);
     if(FAILED(hres)) {
-        WARN("Could not map %s to zone: %08x\n", debugstr_w(display_uri), hres);
+        WARN("Could not map %s to zone: %08lx\n", debugstr_w(display_uri), hres);
         SysFreeString(display_uri);
         return TRUE;
     }
 
     SysFreeString(display_uri);
-    TRACE("zone %d\n", zone);
+    TRACE("zone %ld\n", zone);
     return zone == URLZONE_UNTRUSTED;
 }
 
@@ -1752,7 +1752,7 @@ void update_browser_script_mode(GeckoBrowser *browser, IUri *uri)
     }
 
     if(NS_FAILED(nsres))
-        ERR("JavaScript setup failed: %08x\n", nsres);
+        ERR("JavaScript setup failed: %08lx\n", nsres);
 }
 
 void release_script_hosts(HTMLInnerWindow *window)
diff --git a/dlls/mshtml/secmgr.c b/dlls/mshtml/secmgr.c
index a72099f33b9..02bdc41c369 100644
--- a/dlls/mshtml/secmgr.c
+++ b/dlls/mshtml/secmgr.c
@@ -64,7 +64,7 @@ static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSec
         DWORD *pcbSecurityId, DWORD_PTR dwReserved)
 {
     HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface);
-    FIXME("(%p)->(%p %p %lx)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
+    FIXME("(%p)->(%p %p %Ix)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
     return E_NOTIMPL;
 }
 
@@ -74,7 +74,7 @@ static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHost
     HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface);
     const WCHAR *url;
 
-    TRACE("(%p)->(%d %p %d %p %d %x %x)\n", This, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
+    TRACE("(%p)->(%ld %p %ld %p %ld %lx %lx)\n", This, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
 
     if(!This->basedoc.window)
         return E_UNEXPECTED;
@@ -179,7 +179,7 @@ static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHos
     const WCHAR *url;
     HRESULT hres;
 
-    TRACE("(%p)->(%s %p %p %p %d %x)\n", This, debugstr_guid(guidKey), ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
+    TRACE("(%p)->(%s %p %p %p %ld %lx)\n", This, debugstr_guid(guidKey), ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
 
     if(!This->basedoc.window)
         return E_UNEXPECTED;
@@ -202,7 +202,7 @@ static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHos
         }
 
         cs = (struct CONFIRMSAFETY*)pContext;
-        TRACE("cs = {%s %p %x}\n", debugstr_guid(&cs->clsid), cs->pUnk, cs->dwFlags);
+        TRACE("cs = {%s %p %lx}\n", debugstr_guid(&cs->clsid), cs->pUnk, cs->dwFlags);
 
         hres = IUnknown_QueryInterface(cs->pUnk, &IID_IActiveScript, (void**)&active_script);
         if(SUCCEEDED(hres)) {
@@ -221,7 +221,7 @@ static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHos
 
         *(DWORD*)*ppPolicy = policy;
         *pcbPolicy = sizeof(policy);
-        TRACE("policy %x\n", policy);
+        TRACE("policy %lx\n", policy);
         return S_OK;
     }
 
diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c
index 280fdaa84ad..307b7c922a0 100644
--- a/dlls/mshtml/selection.c
+++ b/dlls/mshtml/selection.c
@@ -81,7 +81,7 @@ static ULONG WINAPI HTMLSelectionObject_AddRef(IHTMLSelectionObject *iface)
     HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -91,7 +91,7 @@ static ULONG WINAPI HTMLSelectionObject_Release(IHTMLSelectionObject *iface)
     HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->nsselection)
@@ -167,21 +167,21 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
 
             nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
             if(NS_FAILED(nsres) || !nsbody) {
-                ERR("Could not get body: %08x\n", nsres);
+                ERR("Could not get body: %08lx\n", nsres);
                 return E_FAIL;
             }
 
             nsres = nsISelection_Collapse(This->nsselection, (nsIDOMNode*)nsbody, 0);
             nsIDOMHTMLElement_Release(nsbody);
             if(NS_FAILED(nsres))
-                ERR("Collapse failed: %08x\n", nsres);
+                ERR("Collapse failed: %08lx\n", nsres);
         }else if(nsrange_cnt > 1) {
-            FIXME("range_cnt = %d\n", nsrange_cnt);
+            FIXME("range_cnt = %ld\n", nsrange_cnt);
         }
 
         nsres = nsISelection_GetRangeAt(This->nsselection, 0, &nsrange);
         if(NS_FAILED(nsres))
-            ERR("GetRangeAt failed: %08x\n", nsres);
+            ERR("GetRangeAt failed: %08lx\n", nsres);
     }
 
     hres = HTMLTxtRange_Create(This->doc, nsrange, &range_obj);
diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c
index d90af3e658c..e937432c892 100644
--- a/dlls/mshtml/service.c
+++ b/dlls/mshtml/service.c
@@ -68,7 +68,7 @@ static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
     UndoManager *This = impl_from_IOleUndoManager(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -78,7 +78,7 @@ static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
     UndoManager *This = impl_from_IOleUndoManager(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
@@ -238,7 +238,7 @@ static ULONG WINAPI editsvcs_AddRef(IHTMLEditServices *iface)
     editsvcs *This = impl_from_IHTMLEditServices(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
     return ref;
 }
 
@@ -247,7 +247,7 @@ static ULONG WINAPI editsvcs_Release(IHTMLEditServices *iface)
     editsvcs *This = impl_from_IHTMLEditServices(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref)
         heap_free(This);
diff --git a/dlls/mshtml/svg.c b/dlls/mshtml/svg.c
index 75036cb39d6..bd52bd70108 100644
--- a/dlls/mshtml/svg.c
+++ b/dlls/mshtml/svg.c
@@ -487,14 +487,14 @@ static HRESULT WINAPI SVGSVGElement_get_currentTranslate(ISVGSVGElement *iface,
 static HRESULT WINAPI SVGSVGElement_suspendRedraw(ISVGSVGElement *iface, ULONG max_wait, ULONG *p)
 {
     SVGSVGElement *This = impl_from_ISVGSVGElement(iface);
-    FIXME("(%p)->(%u %p)\n", This, max_wait, p);
+    FIXME("(%p)->(%lu %p)\n", This, max_wait, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI SVGSVGElement_unsuspendRedraw(ISVGSVGElement *iface, ULONG id)
 {
     SVGSVGElement *This = impl_from_ISVGSVGElement(iface);
-    FIXME("(%p)->(%u)\n", This, id);
+    FIXME("(%p)->(%lu)\n", This, id);
     return E_NOTIMPL;
 }
 
@@ -1038,7 +1038,7 @@ static HRESULT WINAPI SVGTextContentElement_getSubStringLength(ISVGTextContentEl
                                                                LONG charnum, LONG nchars, float *p)
 {
     SVGTextContentElement *This = impl_from_ISVGTextContentElement(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, charnum, nchars, p);
+    FIXME("(%p)->(%ld %ld %p)\n", This, charnum, nchars, p);
     return E_NOTIMPL;
 }
 
@@ -1046,7 +1046,7 @@ static HRESULT WINAPI SVGTextContentElement_getStartPositionOfChar(ISVGTextConte
                                                                    LONG charnum, ISVGPoint **p)
 {
     SVGTextContentElement *This = impl_from_ISVGTextContentElement(iface);
-    FIXME("(%p)->(%d %p)\n", This, charnum, p);
+    FIXME("(%p)->(%ld %p)\n", This, charnum, p);
     return E_NOTIMPL;
 }
 
@@ -1054,7 +1054,7 @@ static HRESULT WINAPI SVGTextContentElement_getEndPositionOfChar(ISVGTextContent
                                                                  LONG charnum, ISVGPoint **p)
 {
     SVGTextContentElement *This = impl_from_ISVGTextContentElement(iface);
-    FIXME("(%p)->(%d %p)\n", This, charnum, p);
+    FIXME("(%p)->(%ld %p)\n", This, charnum, p);
     return E_NOTIMPL;
 }
 
@@ -1062,7 +1062,7 @@ static HRESULT WINAPI SVGTextContentElement_getExtentOfChar(ISVGTextContentEleme
                                                             LONG charnum, ISVGRect **p)
 {
     SVGTextContentElement *This = impl_from_ISVGTextContentElement(iface);
-    FIXME("(%p)->(%d %p)\n", This, charnum, p);
+    FIXME("(%p)->(%ld %p)\n", This, charnum, p);
     return E_NOTIMPL;
 }
 
@@ -1070,7 +1070,7 @@ static HRESULT WINAPI SVGTextContentElement_getRotationOfChar(ISVGTextContentEle
                                                               LONG charnum, float *p)
 {
     SVGTextContentElement *This = impl_from_ISVGTextContentElement(iface);
-    FIXME("(%p)->(%d %p)\n", This, charnum, p);
+    FIXME("(%p)->(%ld %p)\n", This, charnum, p);
     return E_NOTIMPL;
 }
 
@@ -1086,7 +1086,7 @@ static HRESULT WINAPI SVGTextContentElement_selectSubString(ISVGTextContentEleme
                                                             LONG charnum, LONG nchars)
 {
     SVGTextContentElement *This = impl_from_ISVGTextContentElement(iface);
-    FIXME("(%p)->(%d %d)\n", This, charnum, nchars);
+    FIXME("(%p)->(%ld %ld)\n", This, charnum, nchars);
     return E_NOTIMPL;
 }
 
diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c
index 67b7633a5b4..088742e902a 100644
--- a/dlls/mshtml/task.c
+++ b/dlls/mshtml/task.c
@@ -250,7 +250,7 @@ static void call_timer_disp(IDispatch *disp, enum timer_type timer_type)
     if(hres == S_OK)
         TRACE("%p %s <<<\n", disp, debugstr_timer_type(timer_type));
     else
-        WARN("%p %s <<< %08x\n", disp, debugstr_timer_type(timer_type), hres);
+        WARN("%p %s <<< %08lx\n", disp, debugstr_timer_type(timer_type), hres);
 
     VariantClear(&res);
 }
@@ -328,7 +328,7 @@ static LRESULT WINAPI hidden_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
     }
 
     if(msg > WM_USER)
-        FIXME("(%p %d %lx %lx)\n", hwnd, msg, wParam, lParam);
+        FIXME("(%p %d %Ix %Ix)\n", hwnd, msg, wParam, lParam);
 
     return DefWindowProcW(hwnd, msg, wParam, lParam);
 }
diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c
index 0f3371c069f..782459566f4 100644
--- a/dlls/mshtml/view.c
+++ b/dlls/mshtml/view.c
@@ -107,7 +107,7 @@ void update_title(HTMLDocumentObj *This)
 
 static LRESULT on_timer(HTMLDocumentObj *This)
 {
-    TRACE("(%p) %x\n", This, This->update);
+    TRACE("(%p) %lx\n", This, This->update);
 
     KillTimer(This->hwnd, TIMER_ID);
 
@@ -228,7 +228,7 @@ static HRESULT activate_window(HTMLDocumentObj *This)
 
     hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite);
     if(hres != S_OK) {
-        WARN("CanInPlaceActivate returned: %08x\n", hres);
+        WARN("CanInPlaceActivate returned: %08lx\n", hres);
         return FAILED(hres) ? hres : E_FAIL;
     }
 
@@ -236,7 +236,7 @@ static HRESULT activate_window(HTMLDocumentObj *This)
     hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &This->ip_window,
             &posrect, &cliprect, &frameinfo);
     if(FAILED(hres)) {
-        WARN("GetWindowContext failed: %08x\n", hres);
+        WARN("GetWindowContext failed: %08lx\n", hres);
         return hres;
     }
 
@@ -246,7 +246,7 @@ static HRESULT activate_window(HTMLDocumentObj *This)
 
     hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd);
     if(FAILED(hres)) {
-        WARN("GetWindow failed: %08x\n", hres);
+        WARN("GetWindow failed: %08lx\n", hres);
         return hres;
     }
 
@@ -288,7 +288,7 @@ static HRESULT activate_window(HTMLDocumentObj *This)
         hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite);
     }
     if(FAILED(hres)) {
-        WARN("OnInPlaceActivate failed: %08x\n", hres);
+        WARN("OnInPlaceActivate failed: %08lx\n", hres);
         This->in_place_active = FALSE;
         return hres;
     }
@@ -336,7 +336,7 @@ static LRESULT WINAPI tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
         RECT rect;
         POINT *pt = (POINT*)lParam;
 
-        TRACE("TTM_WINDOWFROMPOINT (%d,%d)\n", pt->x, pt->y);
+        TRACE("TTM_WINDOWFROMPOINT (%ld,%ld)\n", pt->x, pt->y);
 
         GetWindowRect(data->doc->hwnd, &rect);
 
@@ -375,7 +375,7 @@ void show_tooltip(HTMLDocumentObj *This, DWORD x, DWORD y, LPCWSTR text)
         NULL, (LPWSTR)text, 0};
     MSG msg = {This->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(x,y), 0, {x,y}};
 
-    TRACE("(%p)->(%d %d %s)\n", This, x, y, debugstr_w(text));
+    TRACE("(%p)->(%ld %ld %s)\n", This, x, y, debugstr_w(text));
 
     if(!This->tooltips_hwnd)
         create_tooltips_window(This);
@@ -615,7 +615,7 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
             call_set_active_object((IOleInPlaceUIWindow*)This->frame,
                     &This->basedoc.IOleInPlaceActiveObject_iface);
         }else {
-            FIXME("OnUIActivate failed: %08x\n", hres);
+            FIXME("OnUIActivate failed: %08lx\n", hres);
             IOleInPlaceFrame_Release(This->frame);
             This->frame = NULL;
             This->ui_active = FALSE;
@@ -666,10 +666,10 @@ static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
 static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
 {
     HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
-    TRACE("(%p)->(%x)\n", This, dwReserved);
+    TRACE("(%p)->(%lx)\n", This, dwReserved);
 
     if(dwReserved)
-        WARN("dwReserved = %d\n", dwReserved);
+        WARN("dwReserved = %ld\n", dwReserved);
 
     IOleDocumentView_Show(iface, FALSE);
     return S_OK;
@@ -748,7 +748,7 @@ static HRESULT WINAPI ViewObject_Draw(IViewObjectEx *iface, DWORD dwDrawAspect,
         LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This, dwDrawAspect, lindex, pvAspect,
+    FIXME("(%p)->(%ld %ld %p %p %p %p %p %p %p %Id)\n", This, dwDrawAspect, lindex, pvAspect,
             ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
     return E_NOTIMPL;
 }
@@ -757,7 +757,7 @@ static HRESULT WINAPI ViewObject_GetColorSet(IViewObjectEx *iface, DWORD dwDrawA
         DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d %d %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
+    FIXME("(%p)->(%ld %ld %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
     return E_NOTIMPL;
 }
 
@@ -765,14 +765,14 @@ static HRESULT WINAPI ViewObject_Freeze(IViewObjectEx *iface, DWORD dwDrawAspect
         void *pvAspect, DWORD *pdwFreeze)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
+    FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ViewObject_Unfreeze(IViewObjectEx *iface, DWORD dwFreeze)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d)\n", This, dwFreeze);
+    FIXME("(%p)->(%ld)\n", This, dwFreeze);
     return E_NOTIMPL;
 }
 
@@ -780,7 +780,7 @@ static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects,
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
 
-    TRACE("(%p)->(%d %d %p)\n", This, aspects, advf, pAdvSink);
+    TRACE("(%p)->(%ld %ld %p)\n", This, aspects, advf, pAdvSink);
 
     if(aspects != DVASPECT_CONTENT || advf != ADVF_PRIMEFIRST)
         FIXME("unsupported arguments\n");
@@ -805,14 +805,14 @@ static HRESULT WINAPI ViewObject_GetExtent(IViewObjectEx *iface, DWORD dwDrawAsp
                                 DVTARGETDEVICE* ptd, LPSIZEL lpsizel)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
+    FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ViewObject_GetRect(IViewObjectEx *iface, DWORD dwAspect, LPRECTL pRect)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d %p)\n", This, dwAspect, pRect);
+    FIXME("(%p)->(%ld %p)\n", This, dwAspect, pRect);
     return E_NOTIMPL;
 }
 
@@ -827,7 +827,7 @@ static HRESULT WINAPI ViewObject_QueryHitPoint(IViewObjectEx* iface, DWORD dwAsp
         LPCRECT pRectBounds, POINT ptlLoc, LONG lCloseHint, DWORD *pHitResult)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d %p (%d %d) %d %p)\n", This, dwAspect, pRectBounds, ptlLoc.x,
+    FIXME("(%p)->(%ld %p (%ld %ld) %ld %p)\n", This, dwAspect, pRectBounds, ptlLoc.x,
          ptlLoc.y, lCloseHint, pHitResult);
     return E_NOTIMPL;
 }
@@ -836,7 +836,7 @@ static HRESULT WINAPI ViewObject_QueryHitRect(IViewObjectEx *iface, DWORD dwAspe
         LPCRECT pRectBounds, LPCRECT pRectLoc, LONG lCloseHint, DWORD *pHitResult)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d %p %p %d %p)\n", This, dwAspect, pRectBounds, pRectLoc, lCloseHint, pHitResult);
+    FIXME("(%p)->(%ld %p %p %ld %p)\n", This, dwAspect, pRectBounds, pRectLoc, lCloseHint, pHitResult);
     return E_NOTIMPL;
 }
 
@@ -844,7 +844,7 @@ static HRESULT WINAPI ViewObject_GetNaturalExtent(IViewObjectEx *iface, DWORD dw
         DVTARGETDEVICE *ptd, HDC hicTargetDev, DVEXTENTINFO *pExtentInfo, LPSIZEL pSizel)
 {
     HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
-    FIXME("(%p)->(%d %d %p %p %p %p\n", This, dwAspect,lindex, ptd,
+    FIXME("(%p)->(%ld %ld %p %p %p %p\n", This, dwAspect,lindex, ptd,
             hicTargetDev, pExtentInfo, pSizel);
     return E_NOTIMPL;
 }
diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c
index cd8ba65b5b8..0ae69df3bda 100644
--- a/dlls/mshtml/xmlhttprequest.c
+++ b/dlls/mshtml/xmlhttprequest.c
@@ -71,7 +71,7 @@ static HRESULT return_nscstr(nsresult nsres, nsACString *nscstr, BSTR *p)
     int len;
 
     if(NS_FAILED(nsres)) {
-        ERR("failed: %08x\n", nsres);
+        ERR("failed: %08lx\n", nsres);
         nsACString_Finish(nscstr);
         return E_FAIL;
     }
@@ -173,7 +173,7 @@ static nsrefcnt NSAPI XMLHttpReqEventListener_AddRef(nsIDOMEventListener *iface)
     XMLHttpReqEventListener *This = impl_from_nsIDOMEventListener(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -183,7 +183,7 @@ static nsrefcnt NSAPI XMLHttpReqEventListener_Release(nsIDOMEventListener *iface
     XMLHttpReqEventListener *This = impl_from_nsIDOMEventListener(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         assert(!This->xhr);
@@ -253,7 +253,7 @@ static ULONG WINAPI HTMLXMLHttpRequest_AddRef(IHTMLXMLHttpRequest *iface)
     HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -263,7 +263,7 @@ static ULONG WINAPI HTMLXMLHttpRequest_Release(IHTMLXMLHttpRequest *iface)
     HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         if(This->event_listener)
@@ -321,7 +321,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_readyState(IHTMLXMLHttpRequest *ifa
         return E_POINTER;
     nsres = nsIXMLHttpRequest_GetReadyState(This->nsxhr, &val);
     if(NS_FAILED(nsres)) {
-        ERR("nsIXMLHttpRequest_GetReadyState failed: %08x\n", nsres);
+        ERR("nsIXMLHttpRequest_GetReadyState failed: %08lx\n", nsres);
         return E_FAIL;
     }
     *p = val;
@@ -364,21 +364,21 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *if
 
     hres = CoCreateInstance(&CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (void**)&xmldoc);
     if(FAILED(hres)) {
-        ERR("CoCreateInstance failed: %08x\n", hres);
+        ERR("CoCreateInstance failed: %08lx\n", hres);
         return hres;
     }
 
     hres = IHTMLXMLHttpRequest_get_responseText(iface, &str);
     if(FAILED(hres)) {
         IXMLDOMDocument_Release(xmldoc);
-        ERR("get_responseText failed: %08x\n", hres);
+        ERR("get_responseText failed: %08lx\n", hres);
         return hres;
     }
 
     hres = IXMLDOMDocument_loadXML(xmldoc, str, &vbool);
     SysFreeString(str);
     if(hres != S_OK || vbool != VARIANT_TRUE)
-        WARN("loadXML failed: %08x, returning an empty xmldoc\n", hres);
+        WARN("loadXML failed: %08lx, returning an empty xmldoc\n", hres);
 
     hres = IXMLDOMDocument_QueryInterface(xmldoc, &IID_IObjectSafety, (void**)&safety);
     assert(SUCCEEDED(hres));
@@ -404,7 +404,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_status(IHTMLXMLHttpRequest *iface,
 
     nsres = nsIXMLHttpRequest_GetStatus(This->nsxhr, &val);
     if(NS_FAILED(nsres)) {
-        ERR("nsIXMLHttpRequest_GetStatus failed: %08x\n", nsres);
+        ERR("nsIXMLHttpRequest_GetStatus failed: %08lx\n", nsres);
         return E_FAIL;
     }
     *p = val;
@@ -468,7 +468,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_abort(IHTMLXMLHttpRequest *iface)
 
     nsres = nsIXMLHttpRequest_SlowAbort(This->nsxhr);
     if(NS_FAILED(nsres)) {
-        ERR("nsIXMLHttpRequest_SlowAbort failed: %08x\n", nsres);
+        ERR("nsIXMLHttpRequest_SlowAbort failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -553,7 +553,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR b
     nsAString_Finish(&password);
 
     if(NS_FAILED(nsres)) {
-        ERR("nsIXMLHttpRequest_Open failed: %08x\n", nsres);
+        ERR("nsIXMLHttpRequest_Open failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -595,7 +595,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_send(IHTMLXMLHttpRequest *iface, VARIAN
     if(nsbody)
         nsIWritableVariant_Release(nsbody);
     if(NS_FAILED(nsres)) {
-        ERR("nsIXMLHttpRequest_Send failed: %08x\n", nsres);
+        ERR("nsIXMLHttpRequest_Send failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -691,7 +691,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_setRequestHeader(IHTMLXMLHttpRequest *i
     heap_free(header_u);
     heap_free(value_u);
     if(NS_FAILED(nsres)) {
-        ERR("SetRequestHeader failed: %08x\n", nsres);
+        ERR("SetRequestHeader failed: %08lx\n", nsres);
         return E_FAIL;
     }
 
@@ -755,7 +755,7 @@ static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo2 *iface, I
 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideClassInfo2 *iface, DWORD dwGuidKind, GUID *pGUID)
 {
     HTMLXMLHttpRequest *This = impl_from_IProvideClassInfo2(iface);
-    FIXME("(%p)->(%u %p)\n", This, dwGuidKind, pGUID);
+    FIXME("(%p)->(%lu %p)\n", This, dwGuidKind, pGUID);
     return E_NOTIMPL;
 }
 
@@ -859,7 +859,7 @@ static void HTMLXMLHttpRequest_bind_event(DispatchEx *dispex, eventid_t eid)
     nsres = nsIDOMEventTarget_AddEventListener(nstarget, &type_str, &This->event_listener->nsIDOMEventListener_iface, FALSE, TRUE, 2);
     nsAString_Finish(&type_str);
     if(NS_FAILED(nsres))
-        ERR("AddEventListener(%s) failed: %08x\n", debugstr_w(type_name), nsres);
+        ERR("AddEventListener(%s) failed: %08lx\n", debugstr_w(type_name), nsres);
 
     nsIDOMEventTarget_Release(nstarget);
 
@@ -937,7 +937,7 @@ static ULONG WINAPI HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory
     HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
     LONG ref = InterlockedIncrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     return ref;
 }
@@ -947,7 +947,7 @@ static ULONG WINAPI HTMLXMLHttpRequestFactory_Release(IHTMLXMLHttpRequestFactory
     HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
     LONG ref = InterlockedDecrement(&This->ref);
 
-    TRACE("(%p) ref=%d\n", This, ref);
+    TRACE("(%p) ref=%ld\n", This, ref);
 
     if(!ref) {
         release_dispex(&This->dispex);




More information about the wine-devel mailing list