[PATCH 09/20] dlls/riched20/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Fri Mar 4 02:25:02 CST 2022


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

---
 dlls/riched20/tests/Makefile.in |    1 
 dlls/riched20/tests/editor.c    |  466 ++++++-----
 dlls/riched20/tests/richole.c   | 1622 ++++++++++++++++++++-------------------
 dlls/riched20/tests/txtsrv.c    |  194 ++---
 4 files changed, 1141 insertions(+), 1142 deletions(-)

diff --git a/dlls/riched20/tests/Makefile.in b/dlls/riched20/tests/Makefile.in
index 77416f1a9f2..34c00afa7cb 100644
--- a/dlls/riched20/tests/Makefile.in
+++ b/dlls/riched20/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = riched20.dll
 IMPORTS   = ole32 oleaut32 user32 gdi32
 
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 20bf0358712..03c07829ee4 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -318,12 +318,12 @@ static void check_EM_FINDTEXTEX(HWND hwnd, const char *name, struct find_s *f,
           "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %d\n",
           name, id, f->needle, f->start, f->end, f->flags, findloc);
       ok(ftw.chrgText.cpMin == f->expected_loc,
-          "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %d\n",
+          "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %ld\n",
           name, id, f->needle, f->start, f->end, f->flags, ftw.chrgText.cpMin);
       expected_end_loc = ((f->expected_loc == -1) ? -1
             : f->expected_loc + strlen(f->needle));
       ok(ftw.chrgText.cpMax == expected_end_loc,
-          "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, end at %d, expected %d\n",
+          "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, end at %ld, expected %d\n",
           name, id, f->needle, f->start, f->end, f->flags, ftw.chrgText.cpMax, expected_end_loc);
       HeapFree(GetProcessHeap(), 0, (void*)ftw.lpstrText);
   }else{
@@ -337,12 +337,12 @@ static void check_EM_FINDTEXTEX(HWND hwnd, const char *name, struct find_s *f,
           "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %d\n",
           name, id, f->needle, f->start, f->end, f->flags, findloc);
       ok(fta.chrgText.cpMin == f->expected_loc,
-          "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %d\n",
+          "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %ld\n",
           name, id, f->needle, f->start, f->end, f->flags, fta.chrgText.cpMin);
       expected_end_loc = ((f->expected_loc == -1) ? -1
             : f->expected_loc + strlen(f->needle));
       ok(fta.chrgText.cpMax == expected_end_loc,
-          "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, end at %d, expected %d\n",
+          "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, end at %ld, expected %d\n",
           name, id, f->needle, f->start, f->end, f->flags, fta.chrgText.cpMax, expected_end_loc);
   }
 }
@@ -515,7 +515,7 @@ static void test_EM_LINELENGTH(void)
 
   for (i = 0; i < 10; i++) {
     result = SendMessageA(hwndRichEdit, EM_LINELENGTH, offset_test[i][0], 0);
-    ok(result == offset_test[i][1], "Length of line at offset %d is %ld, expected %d\n",
+    ok(result == offset_test[i][1], "Length of line at offset %d is %Id, expected %d\n",
         offset_test[i][0], result, offset_test[i][1]);
   }
 
@@ -536,7 +536,7 @@ static void test_EM_LINELENGTH(void)
     SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text1);
     for (i = 0; i < ARRAY_SIZE(offset_test1); i++) {
       result = SendMessageA(hwndRichEdit, EM_LINELENGTH, offset_test1[i][0], 0);
-      ok(result == offset_test1[i][1], "Length of line at offset %d is %ld, expected %d\n",
+      ok(result == offset_test1[i][1], "Length of line at offset %d is %Id, expected %d\n",
          offset_test1[i][0], result, offset_test1[i][1]);
     }
   }
@@ -548,7 +548,7 @@ static int get_scroll_pos_y(HWND hwnd)
 {
   POINT p = {-1, -1};
   SendMessageA(hwnd, EM_GETSCROLLPOS, 0, (LPARAM)&p);
-  ok(p.x != -1 && p.y != -1, "p.x:%d p.y:%d\n", p.x, p.y);
+  ok(p.x != -1 && p.y != -1, "p.x:%ld p.y:%ld\n", p.x, p.y);
   return p.y;
 }
 
@@ -746,30 +746,30 @@ static void test_EM_POSFROMCHAR(void)
   SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"12345678901234");
   SendMessageA(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pt,
               SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0)-1);
-  ok(pt.x > 1, "pt.x = %d\n", pt.x);
+  ok(pt.x > 1, "pt.x = %ld\n", pt.x);
   xpos = pt.x;
   SendMessageA(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pt,
               SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0));
-  ok(pt.x > xpos, "pt.x = %d\n", pt.x);
+  ok(pt.x > xpos, "pt.x = %ld\n", pt.x);
   xpos = (rtl ? pt.x + 7 : pt.x);
   SendMessageA(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pt,
               SendMessageA(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0)+1);
-  ok(pt.x == xpos, "pt.x = %d\n", pt.x);
+  ok(pt.x == xpos, "pt.x = %ld\n", pt.x);
 
   /* Try a negative position. */
   SendMessageA(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pt, -1);
-  ok(pt.x == 1, "pt.x = %d\n", pt.x);
+  ok(pt.x == 1, "pt.x = %ld\n", pt.x);
 
   /* test negative indentation */
   SendMessageA(hwndRichEdit, WM_SETTEXT, 0,
           (LPARAM)"{\\rtf1\\pard\\fi-200\\li-200\\f1 TestSomeText\\par}");
   SendMessageA(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pt, 0);
-  ok(pt.x == 1, "pt.x = %d\n", pt.x);
+  ok(pt.x == 1, "pt.x = %ld\n", pt.x);
 
   fmt.cbSize = sizeof(fmt);
   SendMessageA(hwndRichEdit, EM_GETPARAFORMAT, 0, (LPARAM)&fmt);
-  ok(fmt.dxStartIndent == -400, "got %d\n", fmt.dxStartIndent);
-  ok(fmt.dxOffset == 200, "got %d\n", fmt.dxOffset);
+  ok(fmt.dxStartIndent == -400, "got %ld\n", fmt.dxStartIndent);
+  ok(fmt.dxOffset == 200, "got %ld\n", fmt.dxOffset);
   ok(fmt.wAlignment == PFA_LEFT, "got %d\n", fmt.wAlignment);
 
   DestroyWindow(hwndRichEdit);
@@ -808,13 +808,13 @@ static void test_EM_SETCHARFORMAT(void)
   memset(&cf2, 0, sizeof(CHARFORMAT2A));
   cf2.cbSize = sizeof(CHARFORMAT2A);
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
-  ok(cf2.dwMask == CFM_ALL2, "got %08x\n", cf2.dwMask);
+  ok(cf2.dwMask == CFM_ALL2, "got %08lx\n", cf2.dwMask);
   expect_effects = CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR;
   if (cf2.wWeight > 550) expect_effects |= CFE_BOLD;
-  ok(cf2.dwEffects == expect_effects, "got %08x\n", cf2.dwEffects);
-  ok(cf2.yOffset == 0, "got %d\n", cf2.yOffset);
+  ok(cf2.dwEffects == expect_effects, "got %08lx\n", cf2.dwEffects);
+  ok(cf2.yOffset == 0, "got %ld\n", cf2.yOffset);
   ok(cf2.sSpacing == 0, "got %d\n", cf2.sSpacing);
-  ok(cf2.lcid == GetSystemDefaultLCID(), "got %x\n", cf2.lcid);
+  ok(cf2.lcid == GetSystemDefaultLCID(), "got %lx\n", cf2.lcid);
   ok(cf2.sStyle == 0, "got %d\n", cf2.sStyle);
   ok(cf2.wKerning == 0, "got %d\n", cf2.wKerning);
   ok(cf2.bAnimation == 0, "got %d\n", cf2.bAnimation);
@@ -969,9 +969,9 @@ static void test_EM_SETCHARFORMAT(void)
           (cf2.dwMask & CFM_SUPERSCRIPT) == CFM_SUPERSCRIPT)
           ||
           (cf2.dwMask & tested_effects[i]) == tested_effects[i]),
-        "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
+        "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
     ok((cf2.dwEffects & tested_effects[i]) == 0,
-        "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x clear\n", i, cf2.dwEffects, tested_effects[i]);
+        "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x clear\n", i, cf2.dwEffects, tested_effects[i]);
 
     memset(&cf2, 0, sizeof(CHARFORMAT2A));
     cf2.cbSize = sizeof(CHARFORMAT2A);
@@ -990,9 +990,9 @@ static void test_EM_SETCHARFORMAT(void)
           (cf2.dwMask & CFM_SUPERSCRIPT) == CFM_SUPERSCRIPT)
           ||
           (cf2.dwMask & tested_effects[i]) == tested_effects[i]),
-        "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
+        "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
     ok((cf2.dwEffects & tested_effects[i]) == tested_effects[i],
-        "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x\n", i, cf2.dwEffects, tested_effects[i]);
+        "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x\n", i, cf2.dwEffects, tested_effects[i]);
 
     memset(&cf2, 0, sizeof(CHARFORMAT2A));
     cf2.cbSize = sizeof(CHARFORMAT2A);
@@ -1002,9 +1002,9 @@ static void test_EM_SETCHARFORMAT(void)
           (cf2.dwMask & CFM_SUPERSCRIPT) == CFM_SUPERSCRIPT)
           ||
           (cf2.dwMask & tested_effects[i]) == tested_effects[i]),
-        "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
+        "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
     ok((cf2.dwEffects & tested_effects[i]) == 0,
-        "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x clear\n", i, cf2.dwEffects, tested_effects[i]);
+        "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x clear\n", i, cf2.dwEffects, tested_effects[i]);
 
     memset(&cf2, 0, sizeof(CHARFORMAT2A));
     cf2.cbSize = sizeof(CHARFORMAT2A);
@@ -1014,7 +1014,7 @@ static void test_EM_SETCHARFORMAT(void)
           (cf2.dwMask & CFM_SUPERSCRIPT) == 0)
           ||
           (cf2.dwMask & tested_effects[i]) == 0),
-        "%d, cf2.dwMask == 0x%08x expected mask 0x%08x clear\n", i, cf2.dwMask, tested_effects[i]);
+        "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x clear\n", i, cf2.dwMask, tested_effects[i]);
 
     DestroyWindow(hwndRichEdit);
   }
@@ -1050,9 +1050,9 @@ static void test_EM_SETCHARFORMAT(void)
           (cf2.dwMask & CFM_SUPERSCRIPT) == CFM_SUPERSCRIPT)
           ||
           (cf2.dwMask & tested_effects[i]) == tested_effects[i]),
-        "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
+        "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
     ok((cf2.dwEffects & tested_effects[i]) == 0,
-        "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x clear\n", i, cf2.dwEffects, tested_effects[i]);
+        "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x clear\n", i, cf2.dwEffects, tested_effects[i]);
 
     memset(&cf2, 0, sizeof(CHARFORMAT2A));
     cf2.cbSize = sizeof(CHARFORMAT2A);
@@ -1062,9 +1062,9 @@ static void test_EM_SETCHARFORMAT(void)
           (cf2.dwMask & CFM_SUPERSCRIPT) == CFM_SUPERSCRIPT)
           ||
           (cf2.dwMask & tested_effects[i]) == tested_effects[i]),
-        "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
+        "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, tested_effects[i]);
     ok((cf2.dwEffects & tested_effects[i]) == tested_effects[i],
-        "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x\n", i, cf2.dwEffects, tested_effects[i]);
+        "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x\n", i, cf2.dwEffects, tested_effects[i]);
 
     memset(&cf2, 0, sizeof(CHARFORMAT2A));
     cf2.cbSize = sizeof(CHARFORMAT2A);
@@ -1074,9 +1074,9 @@ static void test_EM_SETCHARFORMAT(void)
           (cf2.dwMask & CFM_SUPERSCRIPT) == 0)
           ||
           (cf2.dwMask & tested_effects[i]) == 0),
-        "%d, cf2.dwMask == 0x%08x expected mask 0x%08x clear\n", i, cf2.dwMask, tested_effects[i]);
+        "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x clear\n", i, cf2.dwMask, tested_effects[i]);
     ok((cf2.dwEffects & tested_effects[i]) == tested_effects[i],
-        "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x set\n", i, cf2.dwEffects, tested_effects[i]);
+        "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x set\n", i, cf2.dwEffects, tested_effects[i]);
 
     DestroyWindow(hwndRichEdit);
   }
@@ -1102,9 +1102,9 @@ static void test_EM_SETCHARFORMAT(void)
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
 
   ok (((cf2.dwMask & CFM_BOLD) == CFM_BOLD),
-      "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, CFM_BOLD);
+      "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, CFM_BOLD);
   ok((cf2.dwEffects & CFE_BOLD) == CFE_BOLD,
-      "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
+      "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
 
 
   /* Set two effects on an empty selection */
@@ -1137,9 +1137,9 @@ static void test_EM_SETCHARFORMAT(void)
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
 
   ok (((cf2.dwMask & (CFM_BOLD|CFM_ITALIC)) == (CFM_BOLD|CFM_ITALIC)),
-      "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, (CFM_BOLD|CFM_ITALIC));
+      "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, (CFM_BOLD|CFM_ITALIC));
   ok((cf2.dwEffects & (CFE_BOLD|CFE_ITALIC)) == (CFE_BOLD|CFE_ITALIC),
-      "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x\n", i, cf2.dwEffects, (CFE_BOLD|CFE_ITALIC));
+      "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x\n", i, cf2.dwEffects, (CFE_BOLD|CFE_ITALIC));
 
   /* Setting the (empty) selection to exactly the same place as before should
      NOT clear the insertion style! */
@@ -1172,9 +1172,9 @@ static void test_EM_SETCHARFORMAT(void)
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
 
   ok (((cf2.dwMask & CFM_BOLD) == CFM_BOLD),
-      "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, CFM_BOLD);
+      "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, CFM_BOLD);
   ok((cf2.dwEffects & CFE_BOLD) == CFE_BOLD,
-      "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
+      "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
 
   /* Moving the selection will clear the insertion style */
   SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"wine");
@@ -1207,9 +1207,9 @@ static void test_EM_SETCHARFORMAT(void)
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
 
   ok(((cf2.dwMask & CFM_BOLD) == CFM_BOLD),
-      "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, CFM_BOLD);
+      "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, CFM_BOLD);
   ok((cf2.dwEffects & CFE_BOLD) == 0,
-      "%d, cf2.dwEffects == 0x%08x not expecting effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
+      "%d, cf2.dwEffects == 0x%08lx not expecting effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
 
   /* Ditto with EM_EXSETSEL */
   SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"wine");
@@ -1244,9 +1244,9 @@ static void test_EM_SETCHARFORMAT(void)
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
 
   ok (((cf2.dwMask & CFM_BOLD) == CFM_BOLD),
-      "%d, cf2.dwMask == 0x%08x expected mask 0x%08x\n", i, cf2.dwMask, CFM_BOLD);
+      "%d, cf2.dwMask == 0x%08lx expected mask 0x%08x\n", i, cf2.dwMask, CFM_BOLD);
   ok((cf2.dwEffects & CFE_BOLD) == CFE_BOLD,
-      "%d, cf2.dwEffects == 0x%08x expected effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
+      "%d, cf2.dwEffects == 0x%08lx expected effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
 
   /* show that wWeight is at the correct offset in CHARFORMAT2A */
   memset(&cf2, 0, sizeof(cf2));
@@ -1304,8 +1304,8 @@ static void test_EM_SETCHARFORMAT(void)
   cf2.cbSize = sizeof(CHARFORMAT2A);
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
   ok((cf2.dwMask & (CFM_UNDERLINE | CFM_UNDERLINETYPE)) == (CFM_UNDERLINE | CFM_UNDERLINETYPE),
-     "got %08x\n", cf2.dwMask);
-  ok(!(cf2.dwEffects & CFE_UNDERLINE), "got %08x\n", cf2.dwEffects);
+     "got %08lx\n", cf2.dwMask);
+  ok(!(cf2.dwEffects & CFE_UNDERLINE), "got %08lx\n", cf2.dwEffects);
   ok(cf2.bUnderlineType == CFU_UNDERLINE, "got %x\n", cf2.bUnderlineType);
 
   /* simply touching bUnderlineType will toggle CFE_UNDERLINE */
@@ -1316,8 +1316,8 @@ static void test_EM_SETCHARFORMAT(void)
   cf2.cbSize = sizeof(CHARFORMAT2A);
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
   ok((cf2.dwMask & (CFM_UNDERLINE | CFM_UNDERLINETYPE)) == (CFM_UNDERLINE | CFM_UNDERLINETYPE),
-     "got %08x\n", cf2.dwMask);
-  ok(cf2.dwEffects & CFE_UNDERLINE, "got %08x\n", cf2.dwEffects);
+     "got %08lx\n", cf2.dwMask);
+  ok(cf2.dwEffects & CFE_UNDERLINE, "got %08lx\n", cf2.dwEffects);
   ok(cf2.bUnderlineType == CFU_UNDERLINE, "got %x\n", cf2.bUnderlineType);
 
   /* setting bUnderline to CFU_UNDERLINENONE clears CFE_UNDERLINE */
@@ -1328,8 +1328,8 @@ static void test_EM_SETCHARFORMAT(void)
   cf2.cbSize = sizeof(CHARFORMAT2A);
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
   ok((cf2.dwMask & (CFM_UNDERLINE | CFM_UNDERLINETYPE)) == (CFM_UNDERLINE | CFM_UNDERLINETYPE),
-     "got %08x\n", cf2.dwMask);
-  ok(!(cf2.dwEffects & CFE_UNDERLINE), "got %08x\n", cf2.dwEffects);
+     "got %08lx\n", cf2.dwMask);
+  ok(!(cf2.dwEffects & CFE_UNDERLINE), "got %08lx\n", cf2.dwEffects);
   ok(cf2.bUnderlineType == CFU_UNDERLINENONE, "got %x\n", cf2.bUnderlineType);
 
   /* another underline type also sets CFE_UNDERLINE */
@@ -1340,8 +1340,8 @@ static void test_EM_SETCHARFORMAT(void)
   cf2.cbSize = sizeof(CHARFORMAT2A);
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
   ok((cf2.dwMask & (CFM_UNDERLINE | CFM_UNDERLINETYPE)) == (CFM_UNDERLINE | CFM_UNDERLINETYPE),
-     "got %08x\n", cf2.dwMask);
-  ok(cf2.dwEffects & CFE_UNDERLINE, "got %08x\n", cf2.dwEffects);
+     "got %08lx\n", cf2.dwMask);
+  ok(cf2.dwEffects & CFE_UNDERLINE, "got %08lx\n", cf2.dwEffects);
   ok(cf2.bUnderlineType == CFU_UNDERLINEDOUBLE, "got %x\n", cf2.bUnderlineType);
 
   /* However explicitly clearing CFE_UNDERLINE results in it remaining cleared */
@@ -1353,8 +1353,8 @@ static void test_EM_SETCHARFORMAT(void)
   cf2.cbSize = sizeof(CHARFORMAT2A);
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
   ok((cf2.dwMask & (CFM_UNDERLINE | CFM_UNDERLINETYPE)) == (CFM_UNDERLINE | CFM_UNDERLINETYPE),
-     "got %08x\n", cf2.dwMask);
-  ok(!(cf2.dwEffects & CFE_UNDERLINE), "got %08x\n", cf2.dwEffects);
+     "got %08lx\n", cf2.dwMask);
+  ok(!(cf2.dwEffects & CFE_UNDERLINE), "got %08lx\n", cf2.dwEffects);
   ok(cf2.bUnderlineType == CFU_UNDERLINEDOUBLE, "got %x\n", cf2.bUnderlineType);
 
   /* And turing it back on again by just setting CFE_UNDERLINE */
@@ -1365,8 +1365,8 @@ static void test_EM_SETCHARFORMAT(void)
   cf2.cbSize = sizeof(CHARFORMAT2A);
   SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
   ok((cf2.dwMask & (CFM_UNDERLINE | CFM_UNDERLINETYPE)) == (CFM_UNDERLINE | CFM_UNDERLINETYPE),
-     "got %08x\n", cf2.dwMask);
-  ok(cf2.dwEffects & CFE_UNDERLINE, "got %08x\n", cf2.dwEffects);
+     "got %08lx\n", cf2.dwMask);
+  ok(cf2.dwEffects & CFE_UNDERLINE, "got %08lx\n", cf2.dwEffects);
   ok(cf2.bUnderlineType == CFU_UNDERLINEDOUBLE, "got %x\n", cf2.bUnderlineType);
 
   /* Check setting CFM_ALL2/CFM_EFFECTS2 in CHARFORMAT(A/W). */
@@ -1483,7 +1483,7 @@ static void test_EM_SETTEXTMODE(void)
 
   /*Compare the two formattings*/
     ok((cf2.dwMask == cf2test.dwMask) && (cf2.dwEffects == cf2test.dwEffects),
-      "two formats found in plain text mode - cf2.dwEffects: %x cf2test.dwEffects: %x\n",
+      "two formats found in plain text mode - cf2.dwEffects: %lx cf2test.dwEffects: %lx\n",
        cf2.dwEffects, cf2test.dwEffects);
   /*Test TM_RICHTEXT by: switching back to Rich Text mode
                          printing "wine" in the current format(normal)
@@ -1525,7 +1525,7 @@ static void test_EM_SETTEXTMODE(void)
 
   /*Test that the two formattings are not the same*/
   todo_wine ok((cf2.dwMask == cf2test.dwMask) && (cf2.dwEffects != cf2test.dwEffects),
-      "expected different formats - cf2.dwMask: %x, cf2test.dwMask: %x, cf2.dwEffects: %x, cf2test.dwEffects: %x\n",
+      "expected different formats - cf2.dwMask: %lx, cf2test.dwMask: %lx, cf2.dwEffects: %lx, cf2test.dwEffects: %lx\n",
       cf2.dwMask, cf2test.dwMask, cf2.dwEffects, cf2test.dwEffects);
 
   DestroyWindow(hwndRichEdit);
@@ -1542,7 +1542,7 @@ static void test_SETPARAFORMAT(void)
   fmt.wAlignment = PFA_LEFT;
 
   ret = SendMessageA(hwndRichEdit, EM_SETPARAFORMAT, 0, (LPARAM)&fmt);
-  ok(ret != 0, "expected non-zero got %d\n", ret);
+  ok(ret != 0, "expected non-zero got %ld\n", ret);
 
   fmt.cbSize = sizeof(PARAFORMAT2);
   fmt.dwMask = -1;
@@ -1553,8 +1553,8 @@ static void test_SETPARAFORMAT(void)
   ret &= ~PFM_TABLEROWDELIMITER;
   fmt.dwMask &= ~PFM_TABLEROWDELIMITER;
 
-  ok(ret == expectedMask, "expected %x got %x\n", expectedMask, ret);
-  ok(fmt.dwMask == expectedMask, "expected %x got %x\n", expectedMask, fmt.dwMask);
+  ok(ret == expectedMask, "expected %lx got %lx\n", expectedMask, ret);
+  ok(fmt.dwMask == expectedMask, "expected %lx got %lx\n", expectedMask, fmt.dwMask);
 
   /* Test some other paraformat field defaults */
   ok( fmt.wNumbering == 0, "got %d\n", fmt.wNumbering );
@@ -1617,7 +1617,7 @@ static void test_TM_PLAINTEXT(void)
   /*Test that they are the same as plain text allows only one formatting*/
 
   ok((cf2.dwMask == cf2test.dwMask) && (cf2.dwEffects == cf2test.dwEffects),
-     "two selections' formats differ - cf2.dwMask: %x, cf2test.dwMask %x, cf2.dwEffects: %x, cf2test.dwEffects: %x\n",
+     "two selections' formats differ - cf2.dwMask: %lx, cf2test.dwMask %lx, cf2.dwEffects: %lx, cf2test.dwEffects: %lx\n",
      cf2.dwMask, cf2test.dwMask, cf2.dwEffects, cf2test.dwEffects);
   
   /*Fill the control with a "wine" string, which when inserted will be bold*/
@@ -1670,7 +1670,7 @@ static void test_TM_PLAINTEXT(void)
   /*Compare the two formattings. They should be the same.*/
 
   ok((cf2.dwMask == cf2test.dwMask) && (cf2.dwEffects == cf2test.dwEffects),
-     "Copied text retained formatting - cf2.dwMask: %x, cf2test.dwMask: %x, cf2.dwEffects: %x, cf2test.dwEffects: %x\n",
+     "Copied text retained formatting - cf2.dwMask: %lx, cf2test.dwMask: %lx, cf2.dwEffects: %lx, cf2test.dwEffects: %lx\n",
      cf2.dwMask, cf2test.dwMask, cf2.dwEffects, cf2test.dwEffects);
   DestroyWindow(hwndRichEdit);
 }
@@ -1758,7 +1758,7 @@ static void test_EM_GETTEXTRANGE(void)
     textRange.chrg.cpMin = 4;
     textRange.chrg.cpMax = 11;
     result = SendMessageA(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
-    ok(result == 7, "EM_GETTEXTRANGE returned %ld\n", result);
+    ok(result == 7, "EM_GETTEXTRANGE returned %Id\n", result);
     ok(!strcmp(expect, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
 
     SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text2);
@@ -1767,7 +1767,7 @@ static void test_EM_GETTEXTRANGE(void)
     textRange.chrg.cpMin = 4;
     textRange.chrg.cpMax = 11;
     result = SendMessageA(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
-    ok(result == 7, "EM_GETTEXTRANGE returned %ld\n", result);
+    ok(result == 7, "EM_GETTEXTRANGE returned %Id\n", result);
     ok(!strcmp(expect, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
 
     /* cpMax of text length is used instead of -1 in this case */
@@ -1775,7 +1775,7 @@ static void test_EM_GETTEXTRANGE(void)
     textRange.chrg.cpMin = 0;
     textRange.chrg.cpMax = -1;
     result = SendMessageA(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
-    ok(result == strlen(text2), "EM_GETTEXTRANGE returned %ld\n", result);
+    ok(result == strlen(text2), "EM_GETTEXTRANGE returned %Id\n", result);
     ok(!strcmp(text2, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
 
     /* cpMin < 0 causes no text to be copied, and 0 to be returned */
@@ -1783,7 +1783,7 @@ static void test_EM_GETTEXTRANGE(void)
     textRange.chrg.cpMin = -1;
     textRange.chrg.cpMax = 1;
     result = SendMessageA(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
-    ok(result == 0, "EM_GETTEXTRANGE returned %ld\n", result);
+    ok(result == 0, "EM_GETTEXTRANGE returned %Id\n", result);
     ok(!strcmp(text2, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
 
     /* cpMax of -1 is not replaced with text length if cpMin != 0 */
@@ -1791,7 +1791,7 @@ static void test_EM_GETTEXTRANGE(void)
     textRange.chrg.cpMin = 1;
     textRange.chrg.cpMax = -1;
     result = SendMessageA(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
-    ok(result == 0, "EM_GETTEXTRANGE returned %ld\n", result);
+    ok(result == 0, "EM_GETTEXTRANGE returned %Id\n", result);
     ok(!strcmp(text2, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
 
     /* no end character is copied if cpMax - cpMin < 0 */
@@ -1799,7 +1799,7 @@ static void test_EM_GETTEXTRANGE(void)
     textRange.chrg.cpMin = 5;
     textRange.chrg.cpMax = 5;
     result = SendMessageA(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
-    ok(result == 0, "EM_GETTEXTRANGE returned %ld\n", result);
+    ok(result == 0, "EM_GETTEXTRANGE returned %Id\n", result);
     ok(!strcmp(text2, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
 
     /* cpMax of text length is used if cpMax > text length*/
@@ -1807,7 +1807,7 @@ static void test_EM_GETTEXTRANGE(void)
     textRange.chrg.cpMin = 0;
     textRange.chrg.cpMax = 1000;
     result = SendMessageA(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
-    ok(result == strlen(text2), "EM_GETTEXTRANGE returned %ld\n", result);
+    ok(result == strlen(text2), "EM_GETTEXTRANGE returned %Id\n", result);
     ok(!strcmp(text2, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
 
     /* Test with multibyte character */
@@ -1819,7 +1819,7 @@ static void test_EM_GETTEXTRANGE(void)
         textRange.chrg.cpMin = 4;
         textRange.chrg.cpMax = 8;
         result = SendMessageA(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
-        ok(result == 5, "EM_GETTEXTRANGE returned %ld\n", result);
+        ok(result == 5, "EM_GETTEXTRANGE returned %Id\n", result);
         ok(!strcmp("ef\x8e\xf0g", buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
     }
 
@@ -1839,14 +1839,14 @@ static void test_EM_GETSELTEXT(void)
 
     SendMessageA(hwndRichEdit, EM_SETSEL, 4, 11);
     result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)buffer);
-    ok(result == 7, "EM_GETSELTEXT returned %ld\n", result);
+    ok(result == 7, "EM_GETSELTEXT returned %Id\n", result);
     ok(!strcmp(expect, buffer), "EM_GETSELTEXT filled %s\n", buffer);
 
     SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text2);
 
     SendMessageA(hwndRichEdit, EM_SETSEL, 4, 11);
     result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)buffer);
-    ok(result == 7, "EM_GETSELTEXT returned %ld\n", result);
+    ok(result == 7, "EM_GETSELTEXT returned %Id\n", result);
     ok(!strcmp(expect, buffer), "EM_GETSELTEXT filled %s\n", buffer);
 
     /* Test with multibyte character */
@@ -1857,7 +1857,7 @@ static void test_EM_GETSELTEXT(void)
         SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"abcdef\x8e\xf0ghijk");
         SendMessageA(hwndRichEdit, EM_SETSEL, 4, 8);
         result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, 0, (LPARAM)buffer);
-        ok(result == 5, "EM_GETSELTEXT returned %ld\n", result);
+        ok(result == 5, "EM_GETSELTEXT returned %Id\n", result);
         ok(!strcmp("ef\x8e\xf0g", buffer), "EM_GETSELTEXT filled %s\n", buffer);
     }
 
@@ -1882,7 +1882,7 @@ static void test_EM_SETOPTIONS(void)
     ok(hwndRichEdit != NULL, "class: %s, error: %d\n",
        RICHEDIT_CLASS20A, (int) GetLastError());
     options = SendMessageA(hwndRichEdit, EM_GETOPTIONS, 0, 0);
-    ok(options == 0, "Incorrect initial options %x\n", options);
+    ok(options == 0, "Incorrect initial options %lx\n", options);
     DestroyWindow(hwndRichEdit);
 
     hwndRichEdit = CreateWindowA(RICHEDIT_CLASS20A, NULL,
@@ -1895,7 +1895,7 @@ static void test_EM_SETOPTIONS(void)
     options = SendMessageA(hwndRichEdit, EM_GETOPTIONS, 0, 0);
     /* WS_[VH]SCROLL cause the ECO_AUTO[VH]SCROLL options to be set */
     ok(options == (ECO_AUTOVSCROLL|ECO_AUTOHSCROLL),
-       "Incorrect initial options %x\n", options);
+       "Incorrect initial options %lx\n", options);
 
     /* NEGATIVE TESTING - NO OPTIONS SET */
     SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text);
@@ -1933,7 +1933,7 @@ static void test_EM_SETOPTIONS(void)
     SetWindowLongA(hwndRichEdit, GWL_STYLE, dwStyle|optionStyles);
     options = SendMessageA(hwndRichEdit, EM_GETOPTIONS, 0, 0);
     ok(options == oldOptions,
-       "Options set by SetWindowLong (%x -> %x)\n", oldOptions, options);
+       "Options set by SetWindowLong (%lx -> %lx)\n", oldOptions, options);
 
     DestroyWindow(hwndRichEdit);
 }
@@ -3744,14 +3744,14 @@ static void test_WM_SETTEXT(void)
 
 #define TEST_SETTEXT(a, b) \
   result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)a); \
-  ok (result == 1, "WM_SETTEXT returned %ld instead of 1\n", result); \
+  ok (result == 1, "WM_SETTEXT returned %Id instead of 1\n", result); \
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buf); \
   ok (result == lstrlenA(buf), \
-	"WM_GETTEXT returned %ld instead of expected %u\n", \
+	"WM_GETTEXT returned %Id instead of expected %u\n", \
 	result, lstrlenA(buf)); \
   result = strcmp(b, buf); \
   ok(result == 0, \
-        "WM_SETTEXT round trip: strcmp = %ld, text=\"%s\"\n", result, buf);
+        "WM_SETTEXT round trip: strcmp = %Id, text=\"%s\"\n", result, buf);
 
   TEST_SETTEXT(TestItem1, TestItem1)
   TEST_SETTEXT(TestItem2, TestItem2_after)
@@ -3772,13 +3772,13 @@ static void test_WM_SETTEXT(void)
 
 #define TEST_SETTEXTW(a, b) \
   result = SendMessageW(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)a); \
-  ok (result == 1, "WM_SETTEXT returned %ld instead of 1\n", result); \
+  ok (result == 1, "WM_SETTEXT returned %Id instead of 1\n", result); \
   result = SendMessageW(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)bufW); \
   ok (result == lstrlenW(bufW), \
-	"WM_GETTEXT returned %ld instead of expected %u\n", \
+	"WM_GETTEXT returned %Id instead of expected %u\n", \
 	result, lstrlenW(bufW)); \
   result = lstrcmpW(b, bufW); \
-  ok(result == 0, "WM_SETTEXT round trip: strcmp = %ld\n", result);
+  ok(result == 0, "WM_SETTEXT round trip: strcmp = %Id\n", result);
 
   hwndRichEdit = CreateWindowW(RICHEDIT_CLASS20W, NULL,
                                ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE,
@@ -3794,14 +3794,14 @@ static void test_WM_SETTEXT(void)
   /* Single-line richedit */
   hwndRichEdit = new_richedit_with_style(NULL, 0);
   result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"line1\r\nline2");
-  ok(result == 1, "WM_SETTEXT returned %ld, expected 12\n", result);
+  ok(result == 1, "WM_SETTEXT returned %Id, expected 12\n", result);
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buf);
-  ok(result == 5, "WM_GETTEXT returned %ld, expected 5\n", result);
+  ok(result == 5, "WM_GETTEXT returned %Id, expected 5\n", result);
   ok(!strcmp(buf, "line1"), "WM_GETTEXT returned incorrect string '%s'\n", buf);
   result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"{\\rtf1 ABC\\rtlpar\\par DEF\\par HIJ\\pard\\par}");
-  ok(result == 1, "WM_SETTEXT returned %ld, expected 1\n", result);
+  ok(result == 1, "WM_SETTEXT returned %Id, expected 1\n", result);
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buf);
-  ok(result == 3, "WM_GETTEXT returned %ld, expected 3\n", result);
+  ok(result == 3, "WM_GETTEXT returned %Id, expected 3\n", result);
   ok(!strcmp(buf, "ABC"), "WM_GETTEXT returned incorrect string '%s'\n", buf);
   DestroyWindow(hwndRichEdit);
 }
@@ -3814,7 +3814,7 @@ static DWORD CALLBACK test_esCallback_written_1(DWORD_PTR dwCookie,
                                                 LONG *pcb)
 {
   char** str = (char**)dwCookie;
-  ok(*pcb == cb || *pcb == 0, "cb %d, *pcb %d\n", cb, *pcb);
+  ok(*pcb == cb || *pcb == 0, "cb %ld, *pcb %ld\n", cb, *pcb);
   *pcb = 0;
   if (cb > 0) {
     memcpy(*str, pbBuff, cb);
@@ -3861,23 +3861,23 @@ static void test_EM_STREAMOUT(void)
   ok(r == 12, "streamed text length is %d, expecting 12\n", r);
   ok(strcmp(buf, TestItem1) == 0,
         "streamed text different, got %s\n", buf);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
 
   /* RTF mode writes the final end of para \r if it's part of the selection */
   p = buf;
   result = SendMessageA(hwndRichEdit, EM_STREAMOUT, SF_RTF, (LPARAM)&es);
   ok (count_pars(buf) == 1, "got %s\n", buf);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
   p = buf;
   SendMessageA(hwndRichEdit, EM_SETSEL, 0, 12);
   result = SendMessageA(hwndRichEdit, EM_STREAMOUT, SF_RTF|SFF_SELECTION, (LPARAM)&es);
   ok (count_pars(buf) == 0, "got %s\n", buf);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
   p = buf;
   SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1);
   result = SendMessageA(hwndRichEdit, EM_STREAMOUT, SF_RTF|SFF_SELECTION, (LPARAM)&es);
   ok (count_pars(buf) == 1, "got %s\n", buf);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
 
   SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)TestItem2);
   p = buf;
@@ -3886,7 +3886,7 @@ static void test_EM_STREAMOUT(void)
   es.pfnCallback = test_WM_SETTEXT_esCallback;
   memset(buf, 0, sizeof(buf));
   result = SendMessageA(hwndRichEdit, EM_STREAMOUT, SF_TEXT, (LPARAM)&es);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
   r = strlen(buf);
   /* Here again, \r gets converted to \r\n, like WM_GETTEXT */
   ok(r == 14, "streamed text length is %d, expecting 14\n", r);
@@ -3897,17 +3897,17 @@ static void test_EM_STREAMOUT(void)
   p = buf;
   result = SendMessageA(hwndRichEdit, EM_STREAMOUT, SF_RTF, (LPARAM)&es);
   ok (count_pars(buf) == 2, "got %s\n", buf);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
   p = buf;
   SendMessageA(hwndRichEdit, EM_SETSEL, 0, 13);
   result = SendMessageA(hwndRichEdit, EM_STREAMOUT, SF_RTF|SFF_SELECTION, (LPARAM)&es);
   ok (count_pars(buf) == 1, "got %s\n", buf);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
   p = buf;
   SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1);
   result = SendMessageA(hwndRichEdit, EM_STREAMOUT, SF_RTF|SFF_SELECTION, (LPARAM)&es);
   ok (count_pars(buf) == 2, "got %s\n", buf);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
 
   SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)TestItem3);
   p = buf;
@@ -3916,7 +3916,7 @@ static void test_EM_STREAMOUT(void)
   es.pfnCallback = test_WM_SETTEXT_esCallback;
   memset(buf, 0, sizeof(buf));
   result = SendMessageA(hwndRichEdit, EM_STREAMOUT, SF_TEXT, (LPARAM)&es);
-  ok(result == streamout_written, "got %ld expected %d\n", result, streamout_written);
+  ok(result == streamout_written, "got %Id expected %ld\n", result, streamout_written);
   r = strlen(buf);
   ok(r == 14, "streamed text length is %d, expecting 14\n", r);
   ok(strcmp(buf, TestItem3) == 0,
@@ -3933,7 +3933,7 @@ static void test_EM_STREAMOUT(void)
   ok(r == 14, "streamed text length is %d, expecting 14\n", r);
   ok(strcmp(buf, TestItem3) == 0,
         "streamed text different, got %s\n", buf);
-  ok(result == 0, "got %ld expected 0\n", result);
+  ok(result == 0, "got %Id expected 0\n", result);
 
 
   DestroyWindow(hwndRichEdit);
@@ -4879,7 +4879,7 @@ static void test_EM_GETMODIFY(void)
   cf2.dwEffects = CFE_ITALIC ^ cf2.dwEffects;
   SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2);
   result = SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2);
-  ok(result == 1, "EM_SETCHARFORMAT returned %ld instead of 1\n", result);
+  ok(result == 1, "EM_SETCHARFORMAT returned %Id instead of 1\n", result);
   result = SendMessageA(hwndRichEdit, EM_GETMODIFY, 0, 0);
   ok (result != 0,
       "EM_GETMODIFY returned zero, instead of non-zero for EM_SETCHARFORMAT\n");
@@ -4955,7 +4955,7 @@ static void check_EM_EXSETSEL(HWND hwnd, const struct exsetsel_s *setsel, int id
     cr.cpMax = setsel->max;
     result = SendMessageA(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr);
 
-    ok(result == setsel->expected_retval, "EM_EXSETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
+    ok(result == setsel->expected_retval, "EM_EXSETSEL(%d): expected: %Id actual: %Id\n", id, setsel->expected_retval, result);
 
     SendMessageA(hwnd, EM_GETSEL, (WPARAM)&start, (LPARAM)&end);
 
@@ -4992,12 +4992,12 @@ static void test_EM_EXSETSEL(void)
         /*                                                 012345     6  78901 */
         cr.cpMin = 4; cr.cpMax = 8;
         result =  SendMessageA(hwndRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr);
-        ok(result == 8, "EM_EXSETSEL return %ld expected 8\n", result);
+        ok(result == 8, "EM_EXSETSEL return %Id expected 8\n", result);
         result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, sizeof(bufA), (LPARAM)bufA);
         ok(!strcmp(bufA, "ef\x8e\xf0g"), "EM_GETSELTEXT return incorrect string\n");
         SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
-        ok(cr.cpMin == 4, "Selection start incorrectly: %d expected 4\n", cr.cpMin);
-        ok(cr.cpMax == 8, "Selection end incorrectly: %d expected 8\n", cr.cpMax);
+        ok(cr.cpMin == 4, "Selection start incorrectly: %ld expected 4\n", cr.cpMin);
+        ok(cr.cpMax == 8, "Selection end incorrectly: %ld expected 8\n", cr.cpMax);
     }
 
     DestroyWindow(hwndRichEdit);
@@ -5009,7 +5009,7 @@ static void check_EM_SETSEL(HWND hwnd, const struct exsetsel_s *setsel, int id)
 
     result = SendMessageA(hwnd, EM_SETSEL, setsel->min, setsel->max);
 
-    ok(result == setsel->expected_retval, "EM_SETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
+    ok(result == setsel->expected_retval, "EM_SETSEL(%d): expected: %Id actual: %Id\n", id, setsel->expected_retval, result);
 
     SendMessageA(hwnd, EM_GETSEL, (WPARAM)&start, (LPARAM)&end);
 
@@ -5050,7 +5050,7 @@ static void test_EM_SETSEL(void)
         SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"abcdef\x8e\xf0ghijk");
         /*                                                 012345     6  78901 */
         result =  SendMessageA(hwndRichEdit, EM_SETSEL, 4, 8);
-        ok(result == 8, "EM_SETSEL return %ld expected 8\n", result);
+        ok(result == 8, "EM_SETSEL return %Id expected 8\n", result);
         result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, sizeof(buffA), (LPARAM)buffA);
         ok(!strcmp(buffA, "ef\x8e\xf0g"), "EM_GETSELTEXT return incorrect string\n");
         result = SendMessageA(hwndRichEdit, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
@@ -5140,8 +5140,8 @@ static void test_EM_REPLACESEL(int redraw)
 
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 10, "EM_EXGETSEL returned cpMin=%d, expected 10\n", cr.cpMin);
-    ok(cr.cpMax == 10, "EM_EXGETSEL returned cpMax=%d, expected 10\n", cr.cpMax);
+    ok(cr.cpMin == 10, "EM_EXGETSEL returned cpMin=%ld, expected 10\n", cr.cpMin);
+    ok(cr.cpMax == 10, "EM_EXGETSEL returned cpMax=%ld, expected 10\n", cr.cpMax);
 
     SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
     r = strcmp(buffer, "RichEdit1\r\n");
@@ -5157,8 +5157,8 @@ static void test_EM_REPLACESEL(int redraw)
 
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 10, "EM_EXGETSEL returned cpMin=%d, expected 10\n", cr.cpMin);
-    ok(cr.cpMax == 10, "EM_EXGETSEL returned cpMax=%d, expected 10\n", cr.cpMax);
+    ok(cr.cpMin == 10, "EM_EXGETSEL returned cpMin=%ld, expected 10\n", cr.cpMin);
+    ok(cr.cpMax == 10, "EM_EXGETSEL returned cpMax=%ld, expected 10\n", cr.cpMax);
 
     /* The following tests show that richedit should handle the special \r\r\n
        sequence by turning it into a single space on insertion. However,
@@ -5171,8 +5171,8 @@ static void test_EM_REPLACESEL(int redraw)
     ok(2 == r, "EM_REPLACESEL returned %d, expected 4\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 2, "EM_EXGETSEL returned cpMin=%d, expected 2\n", cr.cpMin);
-    ok(cr.cpMax == 2, "EM_EXGETSEL returned cpMax=%d, expected 2\n", cr.cpMax);
+    ok(cr.cpMin == 2, "EM_EXGETSEL returned cpMin=%ld, expected 2\n", cr.cpMin);
+    ok(cr.cpMax == 2, "EM_EXGETSEL returned cpMax=%ld, expected 2\n", cr.cpMax);
 
     /* Test the actual string */
     getText.cb = 1024;
@@ -5193,8 +5193,8 @@ static void test_EM_REPLACESEL(int redraw)
     ok(r == 3, "EM_REPLACESEL returned %d, expected 3\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 1, "EM_EXGETSEL returned cpMin=%d, expected 1\n", cr.cpMin);
-    ok(cr.cpMax == 1, "EM_EXGETSEL returned cpMax=%d, expected 1\n", cr.cpMax);
+    ok(cr.cpMin == 1, "EM_EXGETSEL returned cpMin=%ld, expected 1\n", cr.cpMin);
+    ok(cr.cpMax == 1, "EM_EXGETSEL returned cpMax=%ld, expected 1\n", cr.cpMax);
 
     /* Test the actual string */
     getText.cb = 1024;
@@ -5215,8 +5215,8 @@ static void test_EM_REPLACESEL(int redraw)
     ok(r == 9, "EM_REPLACESEL returned %d, expected 9\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 7, "EM_EXGETSEL returned cpMin=%d, expected 7\n", cr.cpMin);
-    ok(cr.cpMax == 7, "EM_EXGETSEL returned cpMax=%d, expected 7\n", cr.cpMax);
+    ok(cr.cpMin == 7, "EM_EXGETSEL returned cpMin=%ld, expected 7\n", cr.cpMin);
+    ok(cr.cpMax == 7, "EM_EXGETSEL returned cpMax=%ld, expected 7\n", cr.cpMax);
 
     /* Test the actual string */
     getText.cb = 1024;
@@ -5237,8 +5237,8 @@ static void test_EM_REPLACESEL(int redraw)
     ok(r == 5, "EM_REPLACESEL returned %d, expected 5\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 2, "EM_EXGETSEL returned cpMin=%d, expected 2\n", cr.cpMin);
-    ok(cr.cpMax == 2, "EM_EXGETSEL returned cpMax=%d, expected 2\n", cr.cpMax);
+    ok(cr.cpMin == 2, "EM_EXGETSEL returned cpMin=%ld, expected 2\n", cr.cpMin);
+    ok(cr.cpMax == 2, "EM_EXGETSEL returned cpMax=%ld, expected 2\n", cr.cpMax);
 
     /* Test the actual string */
     getText.cb = 1024;
@@ -5259,8 +5259,8 @@ static void test_EM_REPLACESEL(int redraw)
     ok(r == 5, "EM_REPLACESEL returned %d, expected 5\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 3, "EM_EXGETSEL returned cpMin=%d, expected 3\n", cr.cpMin);
-    ok(cr.cpMax == 3, "EM_EXGETSEL returned cpMax=%d, expected 3\n", cr.cpMax);
+    ok(cr.cpMin == 3, "EM_EXGETSEL returned cpMin=%ld, expected 3\n", cr.cpMin);
+    ok(cr.cpMax == 3, "EM_EXGETSEL returned cpMax=%ld, expected 3\n", cr.cpMax);
 
     /* Test the actual string */
     getText.cb = 1024;
@@ -5281,8 +5281,8 @@ static void test_EM_REPLACESEL(int redraw)
     ok(r == 6, "EM_REPLACESEL returned %d, expected 6\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 5, "EM_EXGETSEL returned cpMin=%d, expected 5\n", cr.cpMin);
-    ok(cr.cpMax == 5, "EM_EXGETSEL returned cpMax=%d, expected 5\n", cr.cpMax);
+    ok(cr.cpMin == 5, "EM_EXGETSEL returned cpMin=%ld, expected 5\n", cr.cpMin);
+    ok(cr.cpMax == 5, "EM_EXGETSEL returned cpMax=%ld, expected 5\n", cr.cpMax);
 
     /* Test the actual string */
     getText.cb = 1024;
@@ -5303,8 +5303,8 @@ static void test_EM_REPLACESEL(int redraw)
     ok(2 == r, "EM_REPLACESEL returned %d, expected 2\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 2, "EM_EXGETSEL returned cpMin=%d, expected 2\n", cr.cpMin);
-    ok(cr.cpMax == 2, "EM_EXGETSEL returned cpMax=%d, expected 2\n", cr.cpMax);
+    ok(cr.cpMin == 2, "EM_EXGETSEL returned cpMin=%ld, expected 2\n", cr.cpMin);
+    ok(cr.cpMax == 2, "EM_EXGETSEL returned cpMax=%ld, expected 2\n", cr.cpMax);
 
     /* Test the actual string */
     getText.cb = 1024;
@@ -5325,8 +5325,8 @@ static void test_EM_REPLACESEL(int redraw)
     ok(r == 9, "EM_REPLACESEL returned %d, expected 9\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    ok(cr.cpMin == 7, "EM_EXGETSEL returned cpMin=%d, expected 7\n", cr.cpMin);
-    ok(cr.cpMax == 7, "EM_EXGETSEL returned cpMax=%d, expected 7\n", cr.cpMax);
+    ok(cr.cpMin == 7, "EM_EXGETSEL returned cpMin=%ld, expected 7\n", cr.cpMin);
+    ok(cr.cpMax == 7, "EM_EXGETSEL returned cpMax=%ld, expected 7\n", cr.cpMax);
 
     /* Test the actual string */
     getText.cb = 1024;
@@ -5352,8 +5352,8 @@ static void test_EM_REPLACESEL(int redraw)
         todo_wine ok(r == 5, "EM_REPLACESEL returned %d, expected 5\n", r);
         r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
         ok(r == 0, "EM_EXGETSEL returned %d, expected 0\n", r);
-        ok(cr.cpMin == 4, "EM_EXGETSEL returned cpMin=%d, expected 4\n", cr.cpMin);
-        ok(cr.cpMax == 4, "EM_EXGETSEL returned cpMax=%d, expected 4\n", cr.cpMax);
+        ok(cr.cpMin == 4, "EM_EXGETSEL returned cpMin=%ld, expected 4\n", cr.cpMin);
+        ok(cr.cpMax == 4, "EM_EXGETSEL returned cpMax=%ld, expected 4\n", cr.cpMax);
         r = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
         ok(!strcmp(buffer, "abc\x8e\xf0"), "WM_GETTEXT returned incorrect string\n");
         ok(r == 5, "WM_GETTEXT returned %d, expected 5\n", r);
@@ -5363,8 +5363,8 @@ static void test_EM_REPLACESEL(int redraw)
         todo_wine ok(r == 4, "EM_REPLACESEL returned %d, expected 4\n", r);
         r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
         ok(r == 0, "EM_EXGETSEL returned %d, expected 0\n", r);
-        todo_wine ok(cr.cpMin == 4, "EM_EXGETSEL returned cpMin=%d, expected 4\n", cr.cpMin);
-        todo_wine ok(cr.cpMax == 4, "EM_EXGETSEL returned cpMax=%d, expected 4\n", cr.cpMax);
+        todo_wine ok(cr.cpMin == 4, "EM_EXGETSEL returned cpMin=%ld, expected 4\n", cr.cpMin);
+        todo_wine ok(cr.cpMax == 4, "EM_EXGETSEL returned cpMax=%ld, expected 4\n", cr.cpMax);
         r = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
         todo_wine ok(!strcmp(buffer, "abc\x8e\xf0"), "WM_GETTEXT returned incorrect string\n");
         todo_wine ok(r == 5, "WM_GETTEXT returned %d, expected 5\n", r);
@@ -5375,8 +5375,8 @@ static void test_EM_REPLACESEL(int redraw)
     todo_wine ok(r == 12, "EM_REPLACESEL returned %d, expected 12\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    todo_wine ok(cr.cpMin == 12, "EM_EXGETSEL returned cpMin=%d, expected 12\n", cr.cpMin);
-    todo_wine ok(cr.cpMax == 12, "EM_EXGETSEL returned cpMax=%d, expected 12\n", cr.cpMax);
+    todo_wine ok(cr.cpMin == 12, "EM_EXGETSEL returned cpMin=%ld, expected 12\n", cr.cpMin);
+    todo_wine ok(cr.cpMax == 12, "EM_EXGETSEL returned cpMax=%ld, expected 12\n", cr.cpMax);
     SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
     todo_wine ok(!strcmp(buffer, "TestSomeText"), "WM_GETTEXT returned incorrect string\n");
 
@@ -5385,8 +5385,8 @@ static void test_EM_REPLACESEL(int redraw)
     todo_wine ok(r == 12, "EM_REPLACESEL returned %d, expected 12\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    todo_wine ok(cr.cpMin == 12, "EM_EXGETSEL returned cpMin=%d, expected 12\n", cr.cpMin);
-    todo_wine ok(cr.cpMax == 12, "EM_EXGETSEL returned cpMax=%d, expected 12\n", cr.cpMax);
+    todo_wine ok(cr.cpMin == 12, "EM_EXGETSEL returned cpMin=%ld, expected 12\n", cr.cpMin);
+    todo_wine ok(cr.cpMax == 12, "EM_EXGETSEL returned cpMax=%ld, expected 12\n", cr.cpMax);
     SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
     todo_wine ok(!strcmp(buffer, "TestSomeText"), "WM_GETTEXT returned incorrect string\n");
 
@@ -5396,8 +5396,8 @@ static void test_EM_REPLACESEL(int redraw)
     todo_wine ok(r == 12, "EM_REPLACESEL returned %d, expected 12\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    todo_wine ok(cr.cpMin == 13, "EM_EXGETSEL returned cpMin=%d, expected 13\n", cr.cpMin);
-    todo_wine ok(cr.cpMax == 13, "EM_EXGETSEL returned cpMax=%d, expected 13\n", cr.cpMax);
+    todo_wine ok(cr.cpMin == 13, "EM_EXGETSEL returned cpMin=%ld, expected 13\n", cr.cpMin);
+    todo_wine ok(cr.cpMax == 13, "EM_EXGETSEL returned cpMax=%ld, expected 13\n", cr.cpMax);
     SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
     todo_wine ok(!strcmp(buffer, "WTestSomeTextne"), "WM_GETTEXT returned incorrect string\n");
 
@@ -5407,8 +5407,8 @@ static void test_EM_REPLACESEL(int redraw)
     todo_wine ok(r == 12, "EM_REPLACESEL returned %d, expected 12\n", r);
     r = SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
     ok(0 == r, "EM_EXGETSEL returned %d, expected 0\n", r);
-    todo_wine ok(cr.cpMin == 13, "EM_EXGETSEL returned cpMin=%d, expected 13\n", cr.cpMin);
-    todo_wine ok(cr.cpMax == 13, "EM_EXGETSEL returned cpMax=%d, expected 13\n", cr.cpMax);
+    todo_wine ok(cr.cpMin == 13, "EM_EXGETSEL returned cpMin=%ld, expected 13\n", cr.cpMin);
+    todo_wine ok(cr.cpMax == 13, "EM_EXGETSEL returned cpMax=%ld, expected 13\n", cr.cpMax);
     SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
     todo_wine ok(!strcmp(buffer, "WTestSomeTextne"), "WM_GETTEXT returned incorrect string\n");
 
@@ -5695,7 +5695,7 @@ static void test_EM_FORMATRANGE(void)
     r = SendMessageA(hwndRichEdit, EM_FORMATRANGE, TRUE, (LPARAM)&fr);
     todo_wine {
     if (! skip_non_english)
-      ok(fr.rc.bottom == (stringsize.cy * tpp_y), "Expected bottom to be %d, got %d\n", (stringsize.cy * tpp_y), fr.rc.bottom);
+      ok(fr.rc.bottom == (stringsize.cy * tpp_y), "Expected bottom to be %ld, got %ld\n", (stringsize.cy * tpp_y), fr.rc.bottom);
     }
     if (fmtstrings[i].first)
       todo_wine {
@@ -5901,15 +5901,15 @@ static void test_EM_STREAMIN(void)
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
-  ok(result == 12, "got %ld, expected %d\n", result, 12);
+  ok(result == 12, "got %Id, expected %d\n", result, 12);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == 12,
-      "EM_STREAMIN: Test 0 returned %ld, expected 12\n", result);
+      "EM_STREAMIN: Test 0 returned %Id, expected 12\n", result);
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 0 set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == 0, "EM_STREAMIN: Test 0 set error %d, expected %d\n", es.dwError, 0);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0 set error %ld, expected %d\n", es.dwError, 0);
   /* Show that para fmts are ignored */
   range.cpMin = 2;
   range.cpMax = 2;
@@ -5917,8 +5917,8 @@ static void test_EM_STREAMIN(void)
   memset(&fmt, 0xcc, sizeof(fmt));
   fmt.cbSize = sizeof(fmt);
   result = SendMessageA(hwndRichEdit, EM_GETPARAFORMAT, 0, (LPARAM)&fmt);
-  ok(fmt.dxStartIndent == 0, "got %d\n", fmt.dxStartIndent);
-  ok(fmt.dxOffset == 0, "got %d\n", fmt.dxOffset);
+  ok(fmt.dxStartIndent == 0, "got %ld\n", fmt.dxStartIndent);
+  ok(fmt.dxOffset == 0, "got %ld\n", fmt.dxOffset);
   ok(fmt.wAlignment == PFA_LEFT, "got %d\n", fmt.wAlignment);
   ok((fmt.wEffects & PFE_RTLPARA) == 0, "got %x\n", fmt.wEffects);
 
@@ -5928,15 +5928,15 @@ static void test_EM_STREAMIN(void)
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
-  ok(result == 12, "got %ld, expected %d\n", result, 12);
+  ok(result == 12, "got %Id, expected %d\n", result, 12);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == 12,
-      "EM_STREAMIN: Test 0-a returned %ld, expected 12\n", result);
+      "EM_STREAMIN: Test 0-a returned %Id, expected 12\n", result);
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 0-a set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == 0, "EM_STREAMIN: Test 0-a set error %d, expected %d\n", es.dwError, 0);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0-a set error %ld, expected %d\n", es.dwError, 0);
   /* This time para fmts are processed */
   range.cpMin = 2;
   range.cpMax = 2;
@@ -5944,8 +5944,8 @@ static void test_EM_STREAMIN(void)
   memset(&fmt, 0xcc, sizeof(fmt));
   fmt.cbSize = sizeof(fmt);
   result = SendMessageA(hwndRichEdit, EM_GETPARAFORMAT, 0, (LPARAM)&fmt);
-  ok(fmt.dxStartIndent == 300, "got %d\n", fmt.dxStartIndent);
-  ok(fmt.dxOffset == -100, "got %d\n", fmt.dxOffset);
+  ok(fmt.dxStartIndent == 300, "got %ld\n", fmt.dxStartIndent);
+  ok(fmt.dxOffset == -100, "got %ld\n", fmt.dxOffset);
   ok(fmt.wAlignment == PFA_RIGHT, "got %d\n", fmt.wAlignment);
   ok((fmt.wEffects & PFE_RTLPARA) == PFE_RTLPARA, "got %x\n", fmt.wEffects);
 
@@ -5954,15 +5954,15 @@ static void test_EM_STREAMIN(void)
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
-  ok(result == 13, "got %ld, expected %d\n", result, 13);
+  ok(result == 13, "got %Id, expected %d\n", result, 13);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == 14,
-      "EM_STREAMIN: Test 0-b returned %ld, expected 14\n", result);
+      "EM_STREAMIN: Test 0-b returned %Id, expected 14\n", result);
   result = strcmp (buffer,"TestSomeText\r\n");
   ok (result  == 0,
       "EM_STREAMIN: Test 0-b set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == 0, "EM_STREAMIN: Test 0-b set error %d, expected %d\n", es.dwError, 0);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0-b set error %ld, expected %d\n", es.dwError, 0);
 
   /* Show that when using SFF_SELECTION the last \par is not ignored. */
   ptr = streamText0a;
@@ -5970,20 +5970,20 @@ static void test_EM_STREAMIN(void)
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
-  ok(result == 12, "got %ld, expected %d\n", result, 12);
+  ok(result == 12, "got %Id, expected %d\n", result, 12);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == 12,
-      "EM_STREAMIN: Test 0-a returned %ld, expected 12\n", result);
+      "EM_STREAMIN: Test 0-a returned %Id, expected 12\n", result);
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 0-a set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == 0, "EM_STREAMIN: Test 0-a set error %d, expected %d\n", es.dwError, 0);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0-a set error %ld, expected %d\n", es.dwError, 0);
 
   range.cpMin = 0;
   range.cpMax = -1;
   result = SendMessageA(hwndRichEdit, EM_EXSETSEL, 0, (LPARAM)&range);
-  ok (result == 13, "got %ld\n", result);
+  ok (result == 13, "got %Id\n", result);
 
   ptr = streamText0a;
   es.dwCookie = (DWORD_PTR)&ptr;
@@ -5991,104 +5991,104 @@ static void test_EM_STREAMIN(void)
   es.pfnCallback = test_EM_STREAMIN_esCallback;
 
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SFF_SELECTION | SF_RTF, (LPARAM)&es);
-  ok(result == 13, "got %ld, expected 13\n", result);
+  ok(result == 13, "got %Id, expected 13\n", result);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == 14,
-      "EM_STREAMIN: Test SFF_SELECTION 0-a returned %ld, expected 14\n", result);
+      "EM_STREAMIN: Test SFF_SELECTION 0-a returned %Id, expected 14\n", result);
   result = strcmp (buffer,"TestSomeText\r\n");
   ok (result  == 0,
       "EM_STREAMIN: Test SFF_SELECTION 0-a set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == 0, "EM_STREAMIN: Test SFF_SELECTION 0-a set error %d, expected %d\n", es.dwError, 0);
+  ok(es.dwError == 0, "EM_STREAMIN: Test SFF_SELECTION 0-a set error %ld, expected %d\n", es.dwError, 0);
 
   es.dwCookie = (DWORD_PTR)&streamText1;
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
-  ok(result == 12, "got %ld, expected %d\n", result, 12);
+  ok(result == 12, "got %Id, expected %d\n", result, 12);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == 12,
-      "EM_STREAMIN: Test 1 returned %ld, expected 12\n", result);
+      "EM_STREAMIN: Test 1 returned %Id, expected 12\n", result);
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 1 set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == 0, "EM_STREAMIN: Test 1 set error %d, expected %d\n", es.dwError, 0);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 1 set error %ld, expected %d\n", es.dwError, 0);
 
   es.dwCookie = (DWORD_PTR)&streamText2;
   es.dwError = 0;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
-  ok(result == 0, "got %ld, expected %d\n", result, 0);
+  ok(result == 0, "got %Id, expected %d\n", result, 0);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == 0,
-      "EM_STREAMIN: Test 2 returned %ld, expected 0\n", result);
+      "EM_STREAMIN: Test 2 returned %Id, expected 0\n", result);
   ok(!buffer[0], "EM_STREAMIN: Test 2 set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == -16, "EM_STREAMIN: Test 2 set error %d, expected %d\n", es.dwError, -16);
+  ok(es.dwError == -16, "EM_STREAMIN: Test 2 set error %ld, expected %d\n", es.dwError, -16);
 
   es.dwCookie = (DWORD_PTR)&streamText3;
   es.dwError = 0;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
-  ok(result == 0, "got %ld, expected %d\n", result, 0);
+  ok(result == 0, "got %Id, expected %d\n", result, 0);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == 0,
-      "EM_STREAMIN: Test 3 returned %ld, expected 0\n", result);
+      "EM_STREAMIN: Test 3 returned %Id, expected 0\n", result);
   ok(!buffer[0], "EM_STREAMIN: Test 3 set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == -16, "EM_STREAMIN: Test 3 set error %d, expected %d\n", es.dwError, -16);
+  ok(es.dwError == -16, "EM_STREAMIN: Test 3 set error %ld, expected %d\n", es.dwError, -16);
 
   es.dwCookie = (DWORD_PTR)&streamTextUTF8BOM;
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_TEXT, (LPARAM)&es);
-  ok(result == 18, "got %ld, expected %d\n", result, 18);
+  ok(result == 18, "got %Id, expected %d\n", result, 18);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok(result  == 15,
-      "EM_STREAMIN: Test UTF8WithBOM returned %ld, expected 15\n", result);
+      "EM_STREAMIN: Test UTF8WithBOM returned %Id, expected 15\n", result);
   result = strcmp (buffer,"TestUTF8WithBOM");
   ok(result  == 0,
       "EM_STREAMIN: Test UTF8WithBOM set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == 0, "EM_STREAMIN: Test UTF8WithBOM set error %d, expected %d\n", es.dwError, 0);
+  ok(es.dwError == 0, "EM_STREAMIN: Test UTF8WithBOM set error %ld, expected %d\n", es.dwError, 0);
 
   phase = 0;
   es.dwCookie = (DWORD_PTR)&phase;
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback_UTF8Split;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_TEXT, (LPARAM)&es);
-  ok(result == 8, "got %ld\n", result);
+  ok(result == 8, "got %Id\n", result);
 
   WideCharToMultiByte(CP_ACP, 0, UTF8Split_exp, -1, tmp, sizeof(tmp), NULL, NULL);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok(result  == 3,
-      "EM_STREAMIN: Test UTF8Split returned %ld\n", result);
+      "EM_STREAMIN: Test UTF8Split returned %Id\n", result);
   result = memcmp (buffer, tmp, 3);
   ok(result  == 0,
       "EM_STREAMIN: Test UTF8Split set wrong text: Result: %s\n",buffer);
-  ok(es.dwError == 0, "EM_STREAMIN: Test UTF8Split set error %d, expected %d\n", es.dwError, 0);
+  ok(es.dwError == 0, "EM_STREAMIN: Test UTF8Split set error %ld, expected %d\n", es.dwError, 0);
 
   es.dwCookie = (DWORD_PTR)&cookieForStream4;
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback2;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_TEXT, (LPARAM)&es);
-  ok(result == length4, "got %ld, expected %d\n", result, length4);
+  ok(result == length4, "got %Id, expected %d\n", result, length4);
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == length4,
-      "EM_STREAMIN: Test 4 returned %ld, expected %d\n", result, length4);
-  ok(es.dwError == 0, "EM_STREAMIN: Test 4 set error %d, expected %d\n", es.dwError, 0);
+      "EM_STREAMIN: Test 4 returned %Id, expected %d\n", result, length4);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 4 set error %ld, expected %d\n", es.dwError, 0);
 
   es.dwCookie = (DWORD_PTR)&cookieForStream5;
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback2;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_TEXT | SF_UNICODE, (LPARAM)&es);
-  ok(result == sizeof(streamText5), "got %ld, expected %u\n", result, (UINT)sizeof(streamText5));
+  ok(result == sizeof(streamText5), "got %Id, expected %u\n", result, (UINT)sizeof(streamText5));
 
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (result  == length5,
-      "EM_STREAMIN: Test 5 returned %ld, expected %d\n", result, length5);
-  ok(es.dwError == 0, "EM_STREAMIN: Test 5 set error %d, expected %d\n", es.dwError, 0);
+      "EM_STREAMIN: Test 5 returned %Id, expected %d\n", result, length5);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 5 set error %ld, expected %d\n", es.dwError, 0);
 
   DestroyWindow(hwndRichEdit);
 
@@ -6099,7 +6099,7 @@ static void test_EM_STREAMIN(void)
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_esCallback;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_TEXT, (LPARAM)&es);
-  ok(result == 12, "got %ld, expected %d\n", result, 12);
+  ok(result == 12, "got %Id, expected %d\n", result, 12);
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (!strcmp(buffer, "line1"),
       "EM_STREAMIN: Unexpected text '%s'\n", buffer);
@@ -6111,7 +6111,7 @@ static void test_EM_STREAMIN(void)
   es.dwError = 0;
   es.pfnCallback = test_EM_STREAMIN_null_bytes;
   result = SendMessageA(hwndRichEdit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
-  ok(result == 16, "got %ld, expected %d\n", result, 16);
+  ok(result == 16, "got %Id, expected %d\n", result, 16);
   result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
   ok (!strcmp(buffer, "Th is  is a test"), "EM_STREAMIN: Unexpected text '%s'\n", buffer);
 }
@@ -6212,7 +6212,7 @@ static void test_unicode_conversions(void)
         WPARAM wparam = (wm_set_text == WM_SETTEXT) ? 0 : (WPARAM)&stex; \
         assert(wm_set_text == WM_SETTEXT || wm_set_text == EM_SETTEXTEX); \
         ret = SendMessageA(hwnd, wm_set_text, wparam, (LPARAM)txt); \
-        ok(ret, "SendMessageA(%02x) error %u\n", wm_set_text, GetLastError()); \
+        ok(ret, "SendMessageA(%02x) error %lu\n", wm_set_text, GetLastError()); \
     } while(0)
 #define expect_textA(hwnd, wm_get_text, txt) \
     do { \
@@ -6221,7 +6221,7 @@ static void test_unicode_conversions(void)
         assert(wm_get_text == WM_GETTEXT || wm_get_text == EM_GETTEXTEX); \
         memset(bufA, 0xAA, sizeof(bufA)); \
         ret = SendMessageA(hwnd, wm_get_text, wparam, (LPARAM)bufA); \
-        ok(ret, "SendMessageA(%02x) error %u\n", wm_get_text, GetLastError()); \
+        ok(ret, "SendMessageA(%02x) error %lu\n", wm_get_text, GetLastError()); \
         ret = lstrcmpA(bufA, txt); \
         ok(!ret, "%02x: strings do not match: expected %s got %s\n", wm_get_text, txt, bufA); \
     } while(0)
@@ -6232,7 +6232,7 @@ static void test_unicode_conversions(void)
         WPARAM wparam = (wm_set_text == WM_SETTEXT) ? 0 : (WPARAM)&stex; \
         assert(wm_set_text == WM_SETTEXT || wm_set_text == EM_SETTEXTEX); \
         ret = SendMessageW(hwnd, wm_set_text, wparam, (LPARAM)txt); \
-        ok(ret, "SendMessageW(%02x) error %u\n", wm_set_text, GetLastError()); \
+        ok(ret, "SendMessageW(%02x) error %lu\n", wm_set_text, GetLastError()); \
     } while(0)
 #define expect_textW(hwnd, wm_get_text, txt) \
     do { \
@@ -6241,7 +6241,7 @@ static void test_unicode_conversions(void)
         assert(wm_get_text == WM_GETTEXT || wm_get_text == EM_GETTEXTEX); \
         memset(bufW, 0xAA, sizeof(bufW)); \
         ret = SendMessageW(hwnd, wm_get_text, wparam, (LPARAM)bufW); \
-        ok(ret, "SendMessageW(%02x) error %u\n", wm_get_text, GetLastError()); \
+        ok(ret, "SendMessageW(%02x) error %lu\n", wm_get_text, GetLastError()); \
         ret = lstrcmpW(bufW, txt); \
         ok(!ret, "%02x: strings do not match: expected[0] %x got[0] %x\n", wm_get_text, txt[0], bufW[0]); \
     } while(0)
@@ -6258,7 +6258,7 @@ static void test_unicode_conversions(void)
 
     hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
                            0, 0, 200, 60, 0, 0, 0, 0);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
 
     ret = IsWindowUnicode(hwnd);
     ok(ret, "RichEdit20W should be unicode under NT\n");
@@ -6318,7 +6318,7 @@ static void test_unicode_conversions(void)
 
     hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP,
                            0, 0, 200, 60, 0, 0, 0, 0);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
 
     ret = IsWindowUnicode(hwnd);
     ok(!ret, "RichEdit20A should NOT be unicode\n");
@@ -6366,7 +6366,7 @@ static void test_WM_CHAR(void)
     /* single-line control must IGNORE carriage returns */
     hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
                            0, 0, 200, 60, 0, 0, 0, 0);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
     disable_beep( hwnd );
 
     p = char_list;
@@ -6387,7 +6387,7 @@ static void test_WM_CHAR(void)
     /* multi-line control inserts CR normally */
     hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE,
                            0, 0, 200, 60, 0, 0, 0, 0);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
 
     p = char_list;
     while (*p != '\0') {
@@ -6419,7 +6419,7 @@ static void test_EM_GETTEXTLENGTHEX(void)
     /* single line */
     hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
                            0, 0, 200, 60, 0, 0, 0, 0);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
 
     gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
     gtl.codepage = CP_ACP;
@@ -6464,7 +6464,7 @@ static void test_EM_GETTEXTLENGTHEX(void)
     /* multi line */
     hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP | ES_MULTILINE,
                            0, 0, 200, 60, 0, 0, 0, 0);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
 
     gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
     gtl.codepage = CP_ACP;
@@ -6549,7 +6549,7 @@ static void test_EM_GETTEXTLENGTHEX(void)
     gtl.codepage = 1200;
     ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
     ok(ret == E_INVALIDARG,
-       "GTL_NUMCHARS | GTL_NUMBYTES gave %i, expected %i\n", ret, E_INVALIDARG);
+       "GTL_NUMCHARS | GTL_NUMBYTES gave %i, expected %li\n", ret, E_INVALIDARG);
 
     DestroyWindow(hwnd);
 }
@@ -6810,24 +6810,24 @@ static void link_notify_test(const char *desc, int i, HWND hwnd, HWND parent,
         ok(enlink.nmhdr.hwndFrom == hwnd,
            "%s test %i: Expected hwnd %p got %p\n", desc, i, hwnd, enlink.nmhdr.hwndFrom);
         ok(enlink.nmhdr.idFrom == 0,
-           "%s test %i: Expected idFrom 0 got 0x%lx\n", desc, i, enlink.nmhdr.idFrom);
+           "%s test %i: Expected idFrom 0 got 0x%Ix\n", desc, i, enlink.nmhdr.idFrom);
         ok(enlink.msg == msg,
            "%s test %i: Expected msg 0x%x got 0x%x\n", desc, i, msg, enlink.msg);
         if (msg == WM_SETCURSOR)
         {
             ok(enlink.wParam == 0,
-               "%s test %i: Expected wParam 0 got 0x%lx\n", desc, i, enlink.wParam);
+               "%s test %i: Expected wParam 0 got 0x%Ix\n", desc, i, enlink.wParam);
         }
         else
         {
             ok(enlink.wParam == wParam,
-               "%s test %i: Expected wParam 0x%lx got 0x%lx\n", desc, i, wParam, enlink.wParam);
+               "%s test %i: Expected wParam 0x%Ix got 0x%Ix\n", desc, i, wParam, enlink.wParam);
         }
         ok(enlink.lParam == MAKELPARAM(CURSOR_CLIENT_X, CURSOR_CLIENT_Y),
-           "%s test %i: Expected lParam 0x%lx got 0x%lx\n",
+           "%s test %i: Expected lParam 0x%Ix got 0x%Ix\n",
            desc, i, MAKELPARAM(CURSOR_CLIENT_X, CURSOR_CLIENT_Y), enlink.lParam);
         ok(enlink.chrg.cpMin == 0 && enlink.chrg.cpMax == 31,
-           "%s test %i: Expected link range [0,31) got [%i,%i)\n", desc, i, enlink.chrg.cpMin, enlink.chrg.cpMax);
+           "%s test %i: Expected link range [0,31) got [%li,%li)\n", desc, i, enlink.chrg.cpMin, enlink.chrg.cpMax);
     }
     else
     {
@@ -6970,7 +6970,7 @@ static void test_undo_coalescing(void)
     /* multi-line control inserts CR normally */
     hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE,
                            0, 0, 200, 60, 0, 0, 0, 0);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
     disable_beep( hwnd );
 
     result = SendMessageA(hwnd, EM_CANUNDO, 0, 0);
@@ -7379,7 +7379,7 @@ static void test_autoscroll(void)
         ok(lines == 1, "%d lines instead of 1\n", lines);
         ret = SendMessageA(hwnd, EM_GETSCROLLPOS, 0, (LPARAM)&pt);
         ok(ret == 1, "EM_GETSCROLLPOS returned %d instead of 1\n", ret);
-        ok(pt.y == 0, "y scroll position is %d after clearing text.\n", pt.y);
+        ok(pt.y == 0, "y scroll position is %ld after clearing text.\n", pt.y);
         ret = GetWindowLongA(hwnd, GWL_STYLE);
         ok(!(ret & WS_VSCROLL), "Scrollbar is still shown (style=%x).\n", (UINT)ret);
     }
@@ -8083,7 +8083,7 @@ static void test_dialogmode(void)
 
     hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
         100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
-    ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
+    ok(hwButton!=NULL, "CreateWindow failed with error code %ld\n", GetLastError());
 
     memset(&dm_messages, 0, sizeof(dm_messages));
     r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
@@ -8143,7 +8143,7 @@ static void test_dialogmode(void)
 
     hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
         100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
-    ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
+    ok(hwButton!=NULL, "CreateWindow failed with error code %ld\n", GetLastError());
 
     memset(&dm_messages, 0, sizeof(dm_messages));
     r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
@@ -8197,7 +8197,7 @@ static void test_dialogmode(void)
 
     hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
         100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
-    ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
+    ok(hwButton!=NULL, "CreateWindow failed with error code %ld\n", GetLastError());
 
     memset(&dm_messages, 0, sizeof(dm_messages));
     r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
@@ -8227,7 +8227,7 @@ static void test_dialogmode(void)
 
     hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
         100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
-    ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
+    ok(hwButton!=NULL, "CreateWindow failed with error code %ld\n", GetLastError());
 
     memset(&dm_messages, 0, sizeof(dm_messages));
     r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
@@ -8360,7 +8360,7 @@ static void test_enter(void)
   {
     /* Set the text to the initial text */
     result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)testenteritems[i].initialtext);
-    ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result);
+    ok (result == 1, "[%d] WM_SETTEXT returned %Id instead of 1\n", i, result);
 
     /* Send Enter */
     SendMessageA(hwndRichEdit, EM_SETSEL, testenteritems[i].cursor, testenteritems[i].cursor);
@@ -8415,7 +8415,7 @@ static void test_enter(void)
   getText.codepage = CP_ACP;
 
   result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"");
-  ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result);
+  ok (result == 1, "[%d] WM_SETTEXT returned %Id instead of 1\n", i, result);
   SendMessageW(hwndRichEdit, WM_CHAR, 'T', 0);
   SendMessageW(hwndRichEdit, WM_KEYDOWN, VK_RETURN, 0);
 
@@ -8427,7 +8427,7 @@ static void test_enter(void)
   ok (result == 0, "[%d] EM_GETTEXTEX, GT_DEFAULT unexpected '%s', expected '%s'\n", i, resultbuf, expectedbuf);
 
   result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"");
-  ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result);
+  ok (result == 1, "[%d] WM_SETTEXT returned %Id instead of 1\n", i, result);
   SendMessageW(hwndRichEdit, WM_CHAR, 'T', 0);
   SendMessageW(hwndRichEdit, WM_CHAR, '\r', 0);
 
@@ -8460,7 +8460,7 @@ static void test_WM_CREATE(void)
     ok(!strcmp(buf, "line1"), "buf = %s\n", buf);
 
     res = SendMessageA(rich_edit, EM_GETSEL, 0, 0);
-    ok(res == 0, "SendMessage(EM_GETSEL) returned %lx\n", res);
+    ok(res == 0, "SendMessage(EM_GETSEL) returned %Ix\n", res);
 
     DestroyWindow(rich_edit);
 
@@ -8473,7 +8473,7 @@ static void test_WM_CREATE(void)
     ok(!strcmp(buf, "line1\r\nline2"), "buf = %s\n", buf);
 
     res = SendMessageA(rich_edit, EM_GETSEL, 0, 0);
-    ok(res == 0, "SendMessage(EM_GETSEL) returned %lx\n", res);
+    ok(res == 0, "SendMessage(EM_GETSEL) returned %Ix\n", res);
 
     DestroyWindow(rich_edit);
 }
@@ -8523,12 +8523,12 @@ static void test_EM_SETREADONLY(void)
     res = SendMessageA(richedit, EM_SETREADONLY, TRUE, 0);
     ok(res == 1, "EM_SETREADONLY\n");
     dwStyle = GetWindowLongA(richedit, GWL_STYLE);
-    ok(dwStyle & ES_READONLY, "got wrong value: 0x%x\n", dwStyle);
+    ok(dwStyle & ES_READONLY, "got wrong value: 0x%lx\n", dwStyle);
 
     res = SendMessageA(richedit, EM_SETREADONLY, FALSE, 0);
     ok(res == 1, "EM_SETREADONLY\n");
     dwStyle = GetWindowLongA(richedit, GWL_STYLE);
-    ok(!(dwStyle & ES_READONLY), "got wrong value: 0x%x\n", dwStyle);
+    ok(!(dwStyle & ES_READONLY), "got wrong value: 0x%lx\n", dwStyle);
 
     DestroyWindow(richedit);
 }
@@ -8553,8 +8553,8 @@ static void _test_font_size(unsigned line, HWND hwnd, LONG size, LONG expected_s
     res = SendMessageA(hwnd, EM_SETFONTSIZE, size, 0);
     SendMessageA(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
     isundo = SendMessageA(hwnd, EM_CANUNDO, 0, 0);
-    ok_(__FILE__,line)(res == expected_res, "EM_SETFONTSIZE unexpected return value: %lx.\n", res);
-    ok_(__FILE__,line)(twips2points(cf.yHeight) == expected_size, "got wrong font size: %d, expected: %d\n",
+    ok_(__FILE__,line)(res == expected_res, "EM_SETFONTSIZE unexpected return value: %Ix.\n", res);
+    ok_(__FILE__,line)(twips2points(cf.yHeight) == expected_size, "got wrong font size: %ld, expected: %ld\n",
                        twips2points(cf.yHeight), expected_size);
     ok_(__FILE__,line)(isundo == expected_undo, "get wrong undo mark: %d, expected: %d.\n",
                        isundo, expected_undo);
@@ -8653,11 +8653,11 @@ static void test_alignment_style(void)
         pf.dwMask = -1;
 
         SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
-        ok(pf.wAlignment == align_mask[i], "(i = %d) got %d expected %d\n",
+        ok(pf.wAlignment == align_mask[i], "(i = %d) got %d expected %ld\n",
            i, pf.wAlignment, align_mask[i]);
         dwStyle = GetWindowLongW(richedit, GWL_STYLE);
         ok((i ? (dwStyle & align_style[i]) : (!(dwStyle & 0x0000000f))) ,
-           "(i = %d) didn't set right align style: 0x%x\n", i, dwStyle);
+           "(i = %d) didn't set right align style: 0x%lx\n", i, dwStyle);
 
 
         /* Based on test_reset_default_para_fmt() */
@@ -8670,13 +8670,13 @@ static void test_alignment_style(void)
         SendMessageW(richedit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
 
         SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
-        ok(pf.wAlignment == new_align, "got %d expect %d\n", pf.wAlignment, new_align);
+        ok(pf.wAlignment == new_align, "got %d expect %ld\n", pf.wAlignment, new_align);
 
         SendMessageW(richedit, EM_SETSEL, 0, -1);
         SendMessageW(richedit, WM_CUT, 0, 0);
 
         SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
-        ok(pf.wAlignment == align_mask[i], "got %d expect %d\n", pf.wAlignment, align_mask[i]);
+        ok(pf.wAlignment == align_mask[i], "got %d expect %ld\n", pf.wAlignment, align_mask[i]);
 
         DestroyWindow(richedit);
     }
@@ -8749,17 +8749,17 @@ static void test_rtf(void)
     es.dwError = 0;
     es.pfnCallback = test_EM_STREAMIN_esCallback;
     result = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es );
-    ok( result == 11, "got %ld\n", result );
+    ok( result == 11, "got %Id\n", result );
 
     result = SendMessageW( edit, WM_GETTEXT, ARRAY_SIZE(buf), (LPARAM)buf );
-    ok( result == ARRAY_SIZE(expect_specials), "got %ld\n", result );
+    ok( result == ARRAY_SIZE(expect_specials), "got %Id\n", result );
     ok( !memcmp( buf, expect_specials, sizeof(expect_specials) ), "got %s\n", wine_dbgstr_w(buf) );
 
     /* Show that \rtlpar propagates to the second paragraph and is
        reset by \pard in the third. */
     es.dwCookie = (DWORD_PTR)&pard;
     result = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es );
-    ok( result == 11, "got %ld\n", result );
+    ok( result == 11, "got %Id\n", result );
 
     fmt.cbSize = sizeof(fmt);
     SendMessageW( edit, EM_SETSEL, 1, 1 );
@@ -8778,14 +8778,14 @@ static void test_rtf(void)
     /* Test \highlight */
     es.dwCookie = (DWORD_PTR)&highlight;
     result = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es );
-    ok( result == 3, "got %ld\n", result );
+    ok( result == 3, "got %Id\n", result );
     SendMessageW( edit, EM_SETSEL, 1, 1 );
     memset( &cf, 0, sizeof(cf) );
     cf.cbSize = sizeof(cf);
     SendMessageW( edit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
-    ok( (cf.dwEffects & (CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR)) == 0, "got %08x\n", cf.dwEffects );
-    ok( cf.crTextColor == RGB(128,128,128), "got %08x\n", cf.crTextColor );
-    ok( cf.crBackColor == RGB(192,192,192), "got %08x\n", cf.crBackColor );
+    ok( (cf.dwEffects & (CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR)) == 0, "got %08lx\n", cf.dwEffects );
+    ok( cf.crTextColor == RGB(128,128,128), "got %08lx\n", cf.crTextColor );
+    ok( cf.crBackColor == RGB(192,192,192), "got %08lx\n", cf.crBackColor );
 
     DestroyWindow( edit );
 }
@@ -8826,13 +8826,13 @@ static void test_eop_char_fmt(void)
         cf.cbSize = sizeof(cf);
         cf.dwMask = CFM_SIZE;
         SendMessageW( edit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
-        ok( cf.dwMask & CFM_SIZE, "%d: got %08x\n", i, cf.dwMask );
+        ok( cf.dwMask & CFM_SIZE, "%d: got %08lx\n", i, cf.dwMask );
         if (i < 6) expect_height = 160;
         else if (i < 13) expect_height = 250;
         else if (i < 18) expect_height = 260;
         else if (i == 18 || i == 25) expect_height = 250;
         else expect_height = 220;
-        ok( cf.yHeight == expect_height, "%d: got %d\n", i, cf.yHeight );
+        ok( cf.yHeight == expect_height, "%d: got %ld\n", i, cf.yHeight );
     }
 
     DestroyWindow( edit );
@@ -8864,10 +8864,10 @@ static void test_para_numbering(void)
     es.dwError = 0;
     es.pfnCallback = test_EM_STREAMIN_esCallback;
     result = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es );
-    ok( result == lstrlenW( expect_numbers_txt ), "got %ld\n", result );
+    ok( result == lstrlenW( expect_numbers_txt ), "got %Id\n", result );
 
     result = SendMessageW( edit, EM_GETTEXTEX, (WPARAM)&get_text, (LPARAM)buf );
-    ok( result == lstrlenW( expect_numbers_txt ), "got %ld\n", result );
+    ok( result == lstrlenW( expect_numbers_txt ), "got %Id\n", result );
     ok( !lstrcmpW( buf, expect_numbers_txt ), "got %s\n", wine_dbgstr_w(buf) );
 
     SendMessageW( edit, EM_SETSEL, 1, 1 );
@@ -8879,8 +8879,8 @@ static void test_para_numbering(void)
     ok( fmt.wNumberingStart == 2, "got %d\n", fmt.wNumberingStart );
     ok( fmt.wNumberingStyle == PFNS_PERIOD, "got %04x\n", fmt.wNumberingStyle );
     ok( fmt.wNumberingTab == 1000, "got %d\n", fmt.wNumberingTab );
-    ok( fmt.dxStartIndent == 560, "got %d\n", fmt.dxStartIndent );
-    ok( fmt.dxOffset == -200, "got %d\n", fmt.dxOffset );
+    ok( fmt.dxStartIndent == 560, "got %ld\n", fmt.dxStartIndent );
+    ok( fmt.dxOffset == -200, "got %ld\n", fmt.dxOffset );
 
     /* Second para should have identical fmt */
     SendMessageW( edit, EM_SETSEL, 10, 10 );
@@ -8895,13 +8895,13 @@ static void test_para_numbering(void)
     cf.cbSize = sizeof(cf);
     cf.dwMask = CFM_SIZE;
     SendMessageW( edit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
-    ok( cf.yHeight == 200, "got %d\n", cf.yHeight );
+    ok( cf.yHeight == 200, "got %ld\n", cf.yHeight );
 
     SendMessageW( edit, EM_SETSEL, 18, 19 );
     cf.cbSize = sizeof(cf);
     cf.dwMask = CFM_SIZE;
     SendMessageW( edit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
-    ok( cf.yHeight == 200, "got %d\n", cf.yHeight );
+    ok( cf.yHeight == 200, "got %ld\n", cf.yHeight );
 
     DestroyWindow( edit );
 }
@@ -8950,11 +8950,11 @@ static void test_EM_SELECTIONTYPE(void)
 
     SendMessageA(hwnd, EM_SETSEL, 0, 1);
     hr = IRichEditOle_GetClientSite(reole, &clientsite);
-    ok(hr == S_OK, "IRichEditOle_GetClientSite failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IRichEditOle_GetClientSite failed: 0x%08lx\n", hr);
     fill_reobject_struct(&reo1, REO_CP_SELECTION, NULL, NULL, clientsite, 10, 10,
                          DVASPECT_CONTENT, 0, 1);
     hr = IRichEditOle_InsertObject(reole, &reo1);
-    ok(hr == S_OK, "IRichEditOle_InsertObject failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IRichEditOle_InsertObject failed: 0x%08lx\n", hr);
     IOleClientSite_Release(clientsite);
 
     SendMessageA(hwnd, EM_SETSEL, 0, 1);
@@ -8971,11 +8971,11 @@ static void test_EM_SELECTIONTYPE(void)
 
     SendMessageA(hwnd, EM_SETSEL, 2, 3);
     hr = IRichEditOle_GetClientSite(reole, &clientsite);
-    ok(hr == S_OK, "IRichEditOle_GetClientSite failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IRichEditOle_GetClientSite failed: 0x%08lx\n", hr);
     fill_reobject_struct(&reo2, REO_CP_SELECTION, NULL, NULL, clientsite, 10, 10,
                          DVASPECT_CONTENT, 0, 2);
     hr = IRichEditOle_InsertObject(reole, &reo2);
-    ok(hr == S_OK, "IRichEditOle_InsertObject failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IRichEditOle_InsertObject failed: 0x%08lx\n", hr);
     IOleClientSite_Release(clientsite);
 
     SendMessageA(hwnd, EM_SETSEL, 0, 2);
@@ -9020,7 +9020,7 @@ static void test_window_classes(void)
            test[i].class, test[i].success ? "succeed" : "fail");
         if (!hwnd)
             todo_wine
-            ok(GetLastError() == ERROR_CANNOT_FIND_WND_CLASS, "got %u\n", GetLastError());
+            ok(GetLastError() == ERROR_CANNOT_FIND_WND_CLASS, "got %lu\n", GetLastError());
         else
             DestroyWindow(hwnd);
     }
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 8d8ba5b1e9d..08c1ce8ced4 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -45,7 +45,7 @@ static void _expect_ref(IUnknown* obj, ULONG ref, int line)
     ULONG rc;
     IUnknown_AddRef(obj);
     rc = IUnknown_Release(obj);
-    ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
+    ok_(__FILE__,line)(rc == ref, "expected refcount %ld, got %ld\n", ref, rc);
 }
 
 static HWND new_window(LPCSTR lpClassName, DWORD dwStyle, HWND parent)
@@ -123,14 +123,14 @@ static void _check_typeinfo(IDispatch* disp, REFIID expected_riid, int line)
 
     count = 10;
     hr = IDispatch_GetTypeInfoCount(disp, &count);
-    ok_(__FILE__,line)(hr == S_OK, "IDispatch_GetTypeInfoCount failed: 0x%08x.\n", hr);
+    ok_(__FILE__,line)(hr == S_OK, "IDispatch_GetTypeInfoCount failed: 0x%08lx.\n", hr);
     ok_(__FILE__,line)(count == 1, "got wrong count: %u.\n", count);
 
     hr = IDispatch_GetTypeInfo(disp, 0, LOCALE_SYSTEM_DEFAULT, &typeinfo);
-    ok_(__FILE__,line)(hr == S_OK, "IDispatch_GetTypeInfo failed: 0x%08x.\n", hr);
+    ok_(__FILE__,line)(hr == S_OK, "IDispatch_GetTypeInfo failed: 0x%08lx.\n", hr);
 
     hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
-    ok_(__FILE__,line)(hr == S_OK, "ITypeInfo_GetTypeAttr failed: 0x%08x.\n", hr);
+    ok_(__FILE__,line)(hr == S_OK, "ITypeInfo_GetTypeAttr failed: 0x%08lx.\n", hr);
     ok_(__FILE__,line)(IsEqualGUID(&typeattr->guid, expected_riid),
                        "Unexpected type guid: %s.\n", wine_dbgstr_guid(&typeattr->guid));
 
@@ -174,17 +174,17 @@ static void test_Interfaces(void)
   CHECK_TYPEINFO(txtDoc, &IID_ITextDocument);
 
   hres = ITextDocument_GetSelection(txtDoc, NULL);
-  ok(hres == E_INVALIDARG, "ITextDocument_GetSelection: 0x%x\n", hres);
+  ok(hres == E_INVALIDARG, "ITextDocument_GetSelection: 0x%lx\n", hres);
 
   EXPECT_REF(txtDoc, 4);
 
   hres = ITextDocument_GetSelection(txtDoc, &txtSel);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextDocument_QueryInterface(txtDoc, &IID_IUnknown, (void **)&unk);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextSelection_QueryInterface(txtSel, &IID_IUnknown, (void **)&unk2);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(unk != unk2, "unknowns are the same\n");
   IUnknown_Release(unk2);
   IUnknown_Release(unk);
@@ -193,7 +193,7 @@ static void test_Interfaces(void)
   EXPECT_REF(txtSel, 2);
 
   hres = ITextDocument_GetSelection(txtDoc, &txtSel2);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(txtSel2 == txtSel, "got %p, %p\n", txtSel, txtSel2);
 
   EXPECT_REF(txtDoc, 4);
@@ -244,7 +244,7 @@ static void test_Interfaces(void)
   ITextDocument_Release(txtDoc);
   IRichEditOle_Release(reOle);
   refcount = IRichEditOle_Release(reOle);
-  ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+  ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
   DestroyWindow(w);
 
   /* Methods should return CO_E_RELEASED if the backing document has
@@ -260,7 +260,7 @@ static void test_Interfaces(void)
   ok(reOle != NULL, "EM_GETOLEINTERFACE\n");
 
   hres = IRichEditOle_QueryInterface(reOle, &IID_ITextDocument2Old, (void **)&txtDoc2Old);
-  ok(hres == S_OK, "IRichEditOle_QueryInterface failed: 0x%08x.\n", hres);
+  ok(hres == S_OK, "IRichEditOle_QueryInterface failed: 0x%08lx.\n", hres);
   ok(txtDoc2Old != NULL, "IRichEditOle_QueryInterface\n");
   CHECK_TYPEINFO(txtDoc2Old, &IID_ITextDocument);
   ITextDocument2Old_Release(txtDoc2Old);
@@ -318,7 +318,7 @@ static void test_ITextDocument_Open(void)
       touch_file(filename);
       create_interfaces(&w, &reOle, &txtDoc, &txtSel);
       hres = ITextDocument_Open(txtDoc, &testfile, tomConstantsSingle[i], CP_ACP);
-      todo_wine ok(hres == S_OK, "ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_ACP hres:0x%x\n",
+      todo_wine ok(hres == S_OK, "ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_ACP hres:0x%lx\n",
          tomConstantsSingle[i], hres);
       release_interfaces(&w, &reOle, &txtDoc, &txtSel);
       DeleteFileW(filename);
@@ -326,7 +326,7 @@ static void test_ITextDocument_Open(void)
       touch_file(filename);
       create_interfaces(&w, &reOle, &txtDoc, &txtSel);
       hres = ITextDocument_Open(txtDoc, &testfile, tomConstantsSingle[i], CP_UTF8);
-      todo_wine ok(hres == S_OK, "ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_UTF8 hres:0x%x\n",
+      todo_wine ok(hres == S_OK, "ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_UTF8 hres:0x%lx\n",
          tomConstantsSingle[i], hres);
       release_interfaces(&w, &reOle, &txtDoc, &txtSel);
       DeleteFileW(filename);
@@ -337,7 +337,7 @@ static void test_ITextDocument_Open(void)
       touch_file(filename);
       create_interfaces(&w, &reOle, &txtDoc, &txtSel);
       hres = ITextDocument_Open(txtDoc, &testfile, tomConstantsMulti[i], CP_ACP);
-      todo_wine ok(hres == S_OK, "ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_ACP hres:0x%x\n",
+      todo_wine ok(hres == S_OK, "ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_ACP hres:0x%lx\n",
          tomConstantsMulti[i], hres);
       release_interfaces(&w, &reOle, &txtDoc, &txtSel);
       DeleteFileW(filename);
@@ -345,7 +345,7 @@ static void test_ITextDocument_Open(void)
       touch_file(filename);
       create_interfaces(&w, &reOle, &txtDoc, &txtSel);
       hres = ITextDocument_Open(txtDoc, &testfile, tomConstantsMulti[i], CP_UTF8);
-      todo_wine ok(hres == S_OK, "ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_UTF8 hres:0x%x\n",
+      todo_wine ok(hres == S_OK, "ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_UTF8 hres:0x%lx\n",
          tomConstantsMulti[i], hres);
       release_interfaces(&w, &reOle, &txtDoc, &txtSel);
       DeleteFileW(filename);
@@ -421,7 +421,7 @@ static void test_ITextDocument_Open(void)
   DeleteFileW(filename);
   hres = ITextDocument_Open(txtDoc, &testfile, tomText, CP_ACP);
 todo_wine {
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(is_existing_file(filename) == TRUE, "a file should be created default\n");
 }
   release_interfaces(&w, &reOle, &txtDoc, &txtSel);
@@ -432,7 +432,7 @@ todo_wine {
   create_interfaces(&w, &reOle, &txtDoc, &txtSel);
   hres = ITextDocument_Open(txtDoc, &testfile, tomShareDenyRead, CP_ACP);
   todo_wine
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   SetLastError(0xdeadbeef);
   hFile = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
                           FILE_ATTRIBUTE_NORMAL, NULL);
@@ -445,7 +445,7 @@ todo_wine {
   create_interfaces(&w, &reOle, &txtDoc, &txtSel);
   hres = ITextDocument_Open(txtDoc, &testfile, tomShareDenyWrite, CP_ACP);
   todo_wine
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   SetLastError(0xdeadbeef);
   hFile = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
                           FILE_ATTRIBUTE_NORMAL, NULL);
@@ -459,7 +459,7 @@ todo_wine {
   SetLastError(0xdeadbeef);
   hres = ITextDocument_Open(txtDoc, &testfile, tomShareDenyWrite|tomShareDenyRead, CP_ACP);
   todo_wine
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hFile = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
                           FILE_ATTRIBUTE_NORMAL, NULL);
   todo_wine ok(GetLastError() == ERROR_SHARING_VIOLATION, "ITextDocument_Open should fail\n");
@@ -475,7 +475,7 @@ todo_wine {
   create_interfaces(&w, &reOle, &txtDoc, &txtSel);
   hres = ITextDocument_Open(txtDoc, &testfile, tomReadOnly, CP_ACP);
   todo_wine
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   result = SendMessageA(w, WM_GETTEXT, 1024, (LPARAM)bufACP);
   todo_wine ok(result == 12, "ITextDocument_Open: Test ASCII returned %d, expected 12\n", result);
   result = strcmp(bufACP, chACP);
@@ -490,7 +490,7 @@ todo_wine {
   create_interfaces(&w, &reOle, &txtDoc, &txtSel);
   hres = ITextDocument_Open(txtDoc, &testfile, tomReadOnly, CP_UTF8);
   todo_wine
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   result = SendMessageA(w, WM_GETTEXT, 1024, (LPARAM)bufACP);
   todo_wine ok(result == 15, "ITextDocument_Open: Test UTF-8 returned %d, expected 15\n", result);
   result = strcmp(bufACP, &chUTF8[3]);
@@ -505,7 +505,7 @@ todo_wine {
   create_interfaces(&w, &reOle, &txtDoc, &txtSel);
   hres = ITextDocument_Open(txtDoc, &testfile, tomReadOnly, 1200);
   todo_wine
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   result = SendMessageW(w, WM_GETTEXT, 1024, (LPARAM)bufUnicode);
   todo_wine ok(result == 12, "ITextDocument_Open: Test UTF-16 returned %d, expected 12\n", result);
   result = lstrcmpW(bufUnicode, &chUTF16[1]);
@@ -602,73 +602,73 @@ static void test_GetText(void)
 
   /* ITextRange */
   hres = ITextDocument_Range(txtDoc, 0, 4, &range);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetText(range, &bstr);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(!lstrcmpW(bstr, bufW1), "got wrong text: %s\n", wine_dbgstr_w(bstr));
 
   SysFreeString(bstr);
   ITextRange_Release(range);
 
   hres = ITextDocument_Range(txtDoc, 4, 0, &range);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetText(range, &bstr);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(!lstrcmpW(bstr, bufW1), "got wrong text: %s\n", wine_dbgstr_w(bstr));
 
   SysFreeString(bstr);
   ITextRange_Release(range);
 
   hres = ITextDocument_Range(txtDoc, 1, 1, &range);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetText(range, &bstr);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(!bstr, "got wrong text: %s\n", wine_dbgstr_w(bstr));
   if (!is64bit)
   {
     hres = ITextRange_GetText(range, NULL);
-    ok(hres == E_INVALIDARG, "got 0x%08x\n", hres);
+    ok(hres == E_INVALIDARG, "got 0x%08lx\n", hres);
   }
   ITextRange_Release(range);
 
   hres = ITextDocument_Range(txtDoc, 8, 12, &range);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetText(range, &bstr);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(!lstrcmpW(bstr, bufW3), "got wrong text: %s\n", wine_dbgstr_w(bstr));
 
   SysFreeString(bstr);
   ITextRange_Release(range);
 
   hres = ITextDocument_Range(txtDoc, 8, 13, &range);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetText(range, &bstr);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(!lstrcmpW(bstr, bufW2), "got wrong text: %s\n", wine_dbgstr_w(bstr));
 
   SysFreeString(bstr);
   ITextRange_Release(range);
 
   hres = ITextDocument_Range(txtDoc, 12, 13, &range);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetText(range, &bstr);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(!lstrcmpW(bstr, bufW5), "got wrong text: %s\n", wine_dbgstr_w(bstr));
 
   SysFreeString(bstr);
   ITextRange_Release(range);
 
   hres = ITextDocument_Range(txtDoc, 0, -1, &range);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetText(range, &bstr);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(!bstr, "got wrong text: %s\n", wine_dbgstr_w(bstr));
   ITextRange_Release(range);
 
   hres = ITextDocument_Range(txtDoc, -1, 9, &range);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetText(range, &bstr);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(!lstrcmpW(bstr, bufW6), "got wrong text: %s\n", wine_dbgstr_w(bstr));
 
   SysFreeString(bstr);
@@ -679,22 +679,22 @@ static void test_GetText(void)
   if (is64bit) {
     bstr = (void*)0xdeadbeef;
     hres = ITextSelection_GetText(txtSel, &bstr);
-    ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+    ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
     todo_wine
     ok(bstr == NULL, "got %p\n", bstr);
 
     bstr = (void*)0xdeadbeef;
     hres = ITextRange_GetText(range, &bstr);
-    ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+    ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
     todo_wine
     ok(bstr == NULL, "got %p\n", bstr);
   }
   else {
     hres = ITextSelection_GetText(txtSel, NULL);
-    ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+    ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
     hres = ITextRange_GetText(range, NULL);
-    ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+    ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
   }
 
   ITextRange_Release(range);
@@ -713,28 +713,28 @@ static void test_ITextDocument_Range(void)
 
   create_interfaces(&w, &reOle, &txtDoc, NULL);
   hres = ITextDocument_Range(txtDoc, 0, 0, &txtRge);
-  ok(hres == S_OK, "ITextDocument_Range fails 0x%x.\n", hres);
+  ok(hres == S_OK, "ITextDocument_Range fails 0x%lx.\n", hres);
   EXPECT_REF(txtRge, 1);
 
   hres = ITextDocument_Range(txtDoc, 0, 0, &range2);
-  ok(hres == S_OK, "ITextDocument_Range fails 0x%x.\n", hres);
+  ok(hres == S_OK, "ITextDocument_Range fails 0x%lx.\n", hres);
   ok(range2 != txtRge, "A new pointer should be returned\n");
   ITextRange_Release(range2);
 
   hres = ITextDocument_Range(txtDoc, 0, 0, NULL);
-  ok(hres == E_INVALIDARG, "ITextDocument_Range should fail 0x%x.\n", hres);
+  ok(hres == E_INVALIDARG, "ITextDocument_Range should fail 0x%lx.\n", hres);
 
   SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
 
   hres = ITextDocument_Range(txtDoc, 8, 30, &range2);
-  ok(hres == S_OK, "ITextDocument_Range fails 0x%x.\n", hres);
+  ok(hres == S_OK, "ITextDocument_Range fails 0x%lx.\n", hres);
   hres = ITextRange_GetStart(range2, &value);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(value == 8, "got %d\n", value);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(value == 8, "got %ld\n", value);
 
   hres = ITextRange_GetEnd(range2, &value);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(value == 13, "got %d\n", value);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(value == 13, "got %ld\n", value);
   ITextRange_Release(range2);
 
   release_interfaces(&w, &reOle, &txtDoc, NULL);
@@ -758,11 +758,11 @@ static void test_ITextRange_GetChar(void)
   create_interfaces(&w, &reOle, &txtDoc, NULL);
   SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   pch = 0xdeadbeef;
   hres = ITextRange_GetChar(txtRge, &pch);
   ok(hres == S_OK, "ITextRange_GetChar\n");
-  ok(pch == 'T', "got wrong char: %c\n", pch);
+  ok(pch == 'T', "got wrong char: %c\n", (char)pch);
   ITextRange_Release(txtRge);
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
@@ -770,11 +770,11 @@ static void test_ITextRange_GetChar(void)
   create_interfaces(&w, &reOle, &txtDoc, NULL);
   SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   pch = 0xdeadbeef;
   hres = ITextRange_GetChar(txtRge, &pch);
   ok(hres == S_OK, "ITextRange_GetChar\n");
-  ok(pch == 'T', "got wrong char: %c\n", pch);
+  ok(pch == 'T', "got wrong char: %c\n", (char)pch);
   ITextRange_Release(txtRge);
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
@@ -782,11 +782,11 @@ static void test_ITextRange_GetChar(void)
   create_interfaces(&w, &reOle, &txtDoc, NULL);
   SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   pch = 0xdeadbeef;
   hres = ITextRange_GetChar(txtRge, &pch);
   ok(hres == S_OK, "ITextRange_GetChar\n");
-  ok(pch == '\r', "got wrong char: %c\n", pch);
+  ok(pch == '\r', "got wrong char: %c\n", (char)pch);
   ITextRange_Release(txtRge);
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
@@ -794,11 +794,11 @@ static void test_ITextRange_GetChar(void)
   create_interfaces(&w, &reOle, &txtDoc, NULL);
   SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   pch = 0xdeadbeef;
   hres = ITextRange_GetChar(txtRge, &pch);
   ok(hres == S_OK, "ITextRange_GetChar\n");
-  ok(pch == '\r', "got wrong char: %c\n", pch);
+  ok(pch == '\r', "got wrong char: %c\n", (char)pch);
   ITextRange_Release(txtRge);
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
@@ -806,17 +806,17 @@ static void test_ITextRange_GetChar(void)
   SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
   first = 12; lim = 12;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_GetChar(txtRge, NULL);
   ok(hres == E_INVALIDARG, "ITextRange_GetChar\n");
 
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
   hres = ITextRange_GetChar(txtRge, NULL);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextRange_GetChar(txtRge, &pch);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   ITextRange_Release(txtRge);
 }
@@ -833,9 +833,9 @@ static void check_range(HWND w, ITextDocument* doc, int first, int lim,
   si.fMask = SIF_POS | SIF_RANGE;
 
   hres = ITextDocument_Range(doc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_ScrollIntoView(txtRge, bStart);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   GetScrollInfo(w, SB_VERT, &si);
   if (expected_nonzero) {
     ok(si.nPos != 0,
@@ -877,10 +877,10 @@ static void test_ITextRange_ScrollIntoView(void)
   check_range(w, txtDoc, 0, 20, tomEnd, 1);
 
   hres = ITextDocument_Range(txtDoc, 0, 0, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   release_interfaces(&w, &reOle, &txtDoc, NULL);
   hres = ITextRange_ScrollIntoView(txtRge, tomStart);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
   ITextRange_Release(txtRge);
 }
 
@@ -903,28 +903,28 @@ static void test_ITextSelection_GetChar(void)
   pch = 0xdeadbeef;
   hres = ITextSelection_GetChar(txtSel, &pch);
   ok(hres == S_OK, "ITextSelection_GetChar\n");
-  ok(pch == 'T', "got wrong char: %c\n", pch);
+  ok(pch == 'T', "got wrong char: %c\n", (char)pch);
 
   first = 0; lim = 0;
   SendMessageA(w, EM_SETSEL, first, lim);
   pch = 0xdeadbeef;
   hres = ITextSelection_GetChar(txtSel, &pch);
   ok(hres == S_OK, "ITextSelection_GetChar\n");
-  ok(pch == 'T', "got wrong char: %c\n", pch);
+  ok(pch == 'T', "got wrong char: %c\n", (char)pch);
 
   first = 12; lim = 12;
   SendMessageA(w, EM_SETSEL, first, lim);
   pch = 0xdeadbeef;
   hres = ITextSelection_GetChar(txtSel, &pch);
   ok(hres == S_OK, "ITextSelection_GetChar\n");
-  ok(pch == '\r', "got wrong char: %c\n", pch);
+  ok(pch == '\r', "got wrong char: %c\n", (char)pch);
 
   first = 13; lim = 13;
   SendMessageA(w, EM_SETSEL, first, lim);
   pch = 0xdeadbeef;
   hres = ITextSelection_GetChar(txtSel, &pch);
   ok(hres == S_OK, "ITextSelection_GetChar\n");
-  ok(pch == '\r', "got wrong char: %c\n", pch);
+  ok(pch == '\r', "got wrong char: %c\n", (char)pch);
 
   hres = ITextSelection_GetChar(txtSel, NULL);
   ok(hres == E_INVALIDARG, "ITextSelection_GetChar\n");
@@ -932,10 +932,10 @@ static void test_ITextSelection_GetChar(void)
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
   hres = ITextSelection_GetChar(txtSel, NULL);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_GetChar(txtSel, &pch);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   ITextSelection_Release(txtSel);
 }
@@ -956,206 +956,206 @@ static void test_ITextRange_GetStart_GetEnd(void)
 
   first = 1; lim = 6;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   start = 0xdeadbeef;
   hres = ITextRange_GetStart(txtRge, &start);
   ok(hres == S_OK, "ITextRange_GetStart\n");
-  ok(start == 1, "got wrong start value: %d\n", start);
+  ok(start == 1, "got wrong start value: %ld\n", start);
   end = 0xdeadbeef;
   hres = ITextRange_GetEnd(txtRge, &end);
   ok(hres == S_OK, "ITextRange_GetEnd\n");
-  ok(end == 6, "got wrong end value: %d\n", end);
+  ok(end == 6, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   first = 6; lim = 1;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   start = 0xdeadbeef;
   hres = ITextRange_GetStart(txtRge, &start);
   ok(hres == S_OK, "ITextRange_GetStart\n");
-  ok(start == 1, "got wrong start value: %d\n", start);
+  ok(start == 1, "got wrong start value: %ld\n", start);
   end = 0xdeadbeef;
   hres = ITextRange_GetEnd(txtRge, &end);
   ok(hres == S_OK, "ITextRange_GetEnd\n");
-  ok(end == 6, "got wrong end value: %d\n", end);
+  ok(end == 6, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   first = -1; lim = 13;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   start = 0xdeadbeef;
   hres = ITextRange_GetStart(txtRge, &start);
   ok(hres == S_OK, "ITextRange_GetStart\n");
-  ok(start == 0, "got wrong start value: %d\n", start);
+  ok(start == 0, "got wrong start value: %ld\n", start);
   end = 0xdeadbeef;
   hres = ITextRange_GetEnd(txtRge, &end);
   ok(hres == S_OK, "ITextRange_GetEnd\n");
-  ok(end == 13, "got wrong end value: %d\n", end);
+  ok(end == 13, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   first = 13; lim = 13;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   start = 0xdeadbeef;
   hres = ITextRange_GetStart(txtRge, &start);
   ok(hres == S_OK, "ITextRange_GetStart\n");
-  ok(start == 12, "got wrong start value: %d\n", start);
+  ok(start == 12, "got wrong start value: %ld\n", start);
   end = 0xdeadbeef;
   hres = ITextRange_GetEnd(txtRge, &end);
   ok(hres == S_OK, "ITextRange_GetEnd\n");
-  ok(end == 12, "got wrong end value: %d\n", end);
+  ok(end == 12, "got wrong end value: %ld\n", end);
 
   /* SetStart */
   hres = ITextRange_SetStart(txtRge, 0);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   /* same value */
   hres = ITextRange_SetStart(txtRge, 0);
-  ok(hres == S_FALSE, "got 0x%08x\n", hres);
+  ok(hres == S_FALSE, "got 0x%08lx\n", hres);
 
   hres = ITextRange_SetStart(txtRge, 1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   /* negative resets to 0, return value is S_FALSE when
      position wasn't changed */
   hres = ITextRange_SetStart(txtRge, -1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextRange_SetStart(txtRge, -1);
-  ok(hres == S_FALSE, "got 0x%08x\n", hres);
+  ok(hres == S_FALSE, "got 0x%08lx\n", hres);
 
   hres = ITextRange_SetStart(txtRge, 0);
-  ok(hres == S_FALSE, "got 0x%08x\n", hres);
+  ok(hres == S_FALSE, "got 0x%08lx\n", hres);
 
   start = -1;
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 0, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 0, "got %ld\n", start);
 
   /* greater than initial end, but less than total char count */
   hres = ITextRange_SetStart(txtRge, 1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextRange_SetEnd(txtRge, 3);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextRange_SetStart(txtRge, 10);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 10, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 10, "got %ld\n", start);
 
   end = 0;
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 10, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 10, "got %ld\n", end);
 
   /* more that total text length */
   hres = ITextRange_SetStart(txtRge, 50);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 12, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 12, "got %ld\n", start);
 
   end = 0;
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 12, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 12, "got %ld\n", end);
 
   /* SetEnd */
   hres = ITextRange_SetStart(txtRge, 0);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   /* same value */
   hres = ITextRange_SetEnd(txtRge, 5);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextRange_SetEnd(txtRge, 5);
-  ok(hres == S_FALSE, "got 0x%08x\n", hres);
+  ok(hres == S_FALSE, "got 0x%08lx\n", hres);
 
   /* negative resets to 0 */
   hres = ITextRange_SetEnd(txtRge, -1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   end = -1;
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 0, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 0, "got %ld\n", end);
 
   start = -1;
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 0, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 0, "got %ld\n", start);
 
   /* greater than initial end, but less than total char count */
   hres = ITextRange_SetStart(txtRge, 3);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextRange_SetEnd(txtRge, 1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 1, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 1, "got %ld\n", start);
 
   end = 0;
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 1, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 1, "got %ld\n", end);
 
   /* more than total count */
   hres = ITextRange_SetEnd(txtRge, 50);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 1, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 1, "got %ld\n", start);
 
   end = 0;
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 13, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 13, "got %ld\n", end);
 
   /* zero */
   hres = ITextRange_SetEnd(txtRge, 0);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 0, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 0, "got %ld\n", start);
 
   end = 0;
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 0, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 0, "got %ld\n", end);
 
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
   /* detached range */
   hres = ITextRange_SetStart(txtRge, 0);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextRange_SetEnd(txtRge, 3);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextRange_GetStart(txtRge, NULL);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextRange_GetEnd(txtRge, NULL);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   ITextRange_Release(txtRge);
 }
@@ -1179,190 +1179,190 @@ static void test_ITextSelection_GetStart_GetEnd(void)
   start = 0xdeadbeef;
   hres = ITextSelection_GetStart(txtSel, &start);
   ok(hres == S_OK, "ITextSelection_GetStart\n");
-  ok(start == 2, "got wrong start value: %d\n", start);
+  ok(start == 2, "got wrong start value: %ld\n", start);
   end = 0xdeadbeef;
   hres = ITextSelection_GetEnd(txtSel, &end);
   ok(hres == S_OK, "ITextSelection_GetEnd\n");
-  ok(end == 5, "got wrong end value: %d\n", end);
+  ok(end == 5, "got wrong end value: %ld\n", end);
 
   first = 5; lim = 2;
   SendMessageA(w, EM_SETSEL, first, lim);
   start = 0xdeadbeef;
   hres = ITextSelection_GetStart(txtSel, &start);
   ok(hres == S_OK, "ITextSelection_GetStart\n");
-  ok(start == 2, "got wrong start value: %d\n", start);
+  ok(start == 2, "got wrong start value: %ld\n", start);
   end = 0xdeadbeef;
   hres = ITextSelection_GetEnd(txtSel, &end);
   ok(hres == S_OK, "ITextSelection_GetEnd\n");
-  ok(end == 5, "got wrong end value: %d\n", end);
+  ok(end == 5, "got wrong end value: %ld\n", end);
 
   first = 0; lim = -1;
   SendMessageA(w, EM_SETSEL, first, lim);
   start = 0xdeadbeef;
   hres = ITextSelection_GetStart(txtSel, &start);
   ok(hres == S_OK, "ITextSelection_GetStart\n");
-  ok(start == 0, "got wrong start value: %d\n", start);
+  ok(start == 0, "got wrong start value: %ld\n", start);
   end = 0xdeadbeef;
   hres = ITextSelection_GetEnd(txtSel, &end);
   ok(hres == S_OK, "ITextSelection_GetEnd\n");
-  ok(end == 13, "got wrong end value: %d\n", end);
+  ok(end == 13, "got wrong end value: %ld\n", end);
 
   first = 13; lim = 13;
   SendMessageA(w, EM_SETSEL, first, lim);
   start = 0xdeadbeef;
   hres = ITextSelection_GetStart(txtSel, &start);
   ok(hres == S_OK, "ITextSelection_GetStart\n");
-  ok(start == 12, "got wrong start value: %d\n", start);
+  ok(start == 12, "got wrong start value: %ld\n", start);
   end = 0xdeadbeef;
   hres = ITextSelection_GetEnd(txtSel, &end);
   ok(hres == S_OK, "ITextSelection_GetEnd\n");
-  ok(end == 12, "got wrong end value: %d\n", end);
+  ok(end == 12, "got wrong end value: %ld\n", end);
 
   /* SetStart/SetEnd */
   hres = ITextSelection_SetStart(txtSel, 0);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   /* same value */
   hres = ITextSelection_SetStart(txtSel, 0);
-  ok(hres == S_FALSE, "got 0x%08x\n", hres);
+  ok(hres == S_FALSE, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_SetStart(txtSel, 1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   /* negative resets to 0, return value is S_FALSE when
      position wasn't changed */
   hres = ITextSelection_SetStart(txtSel, -1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_SetStart(txtSel, -1);
-  ok(hres == S_FALSE, "got 0x%08x\n", hres);
+  ok(hres == S_FALSE, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_SetStart(txtSel, 0);
-  ok(hres == S_FALSE, "got 0x%08x\n", hres);
+  ok(hres == S_FALSE, "got 0x%08lx\n", hres);
 
   start = -1;
   hres = ITextSelection_GetStart(txtSel, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 0, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 0, "got %ld\n", start);
 
   /* greater than initial end, but less than total char count */
   hres = ITextSelection_SetStart(txtSel, 1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_SetEnd(txtSel, 3);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_SetStart(txtSel, 10);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextSelection_GetStart(txtSel, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 10, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 10, "got %ld\n", start);
 
   end = 0;
   hres = ITextSelection_GetEnd(txtSel, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 10, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 10, "got %ld\n", end);
 
   /* more that total text length */
   hres = ITextSelection_SetStart(txtSel, 50);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextSelection_GetStart(txtSel, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 12, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 12, "got %ld\n", start);
 
   end = 0;
   hres = ITextSelection_GetEnd(txtSel, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 12, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 12, "got %ld\n", end);
 
   /* SetEnd */
   hres = ITextSelection_SetStart(txtSel, 0);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   /* same value */
   hres = ITextSelection_SetEnd(txtSel, 5);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_SetEnd(txtSel, 5);
-  ok(hres == S_FALSE, "got 0x%08x\n", hres);
+  ok(hres == S_FALSE, "got 0x%08lx\n", hres);
 
   /* negative resets to 0 */
   hres = ITextSelection_SetEnd(txtSel, -1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   end = -1;
   hres = ITextSelection_GetEnd(txtSel, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 0, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 0, "got %ld\n", end);
 
   start = -1;
   hres = ITextSelection_GetStart(txtSel, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 0, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 0, "got %ld\n", start);
 
   /* greater than initial end, but less than total char count */
   hres = ITextSelection_SetStart(txtSel, 3);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_SetEnd(txtSel, 1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextSelection_GetStart(txtSel, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 1, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 1, "got %ld\n", start);
 
   end = 0;
   hres = ITextSelection_GetEnd(txtSel, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 1, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 1, "got %ld\n", end);
 
   /* more than total count */
   hres = ITextSelection_SetEnd(txtSel, 50);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextSelection_GetStart(txtSel, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 1, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 1, "got %ld\n", start);
 
   end = 0;
   hres = ITextSelection_GetEnd(txtSel, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 13, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 13, "got %ld\n", end);
 
   /* zero */
   hres = ITextSelection_SetEnd(txtSel, 0);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
 
   start = 0;
   hres = ITextSelection_GetStart(txtSel, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 0, "got %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 0, "got %ld\n", start);
 
   end = 0;
   hres = ITextSelection_GetEnd(txtSel, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 0, "got %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 0, "got %ld\n", end);
 
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
   /* detached selection */
   hres = ITextSelection_GetStart(txtSel, NULL);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_GetStart(txtSel, &start);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_GetEnd(txtSel, NULL);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_GetEnd(txtSel, &end);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   ITextSelection_Release(txtSel);
 }
@@ -1382,17 +1382,17 @@ static void test_ITextRange_GetDuplicate(void)
   SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
   first = 0; lim = 4;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "ITextDocument_Range fails 0x%x.\n", hres);
+  ok(hres == S_OK, "ITextDocument_Range fails 0x%lx.\n", hres);
 
   hres = ITextRange_GetDuplicate(txtRge, &txtRgeDup);
   ok(hres == S_OK, "ITextRange_GetDuplicate\n");
   ok(txtRgeDup != txtRge, "A new pointer should be returned\n");
   hres = ITextRange_GetStart(txtRgeDup, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == first, "got wrong value: %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == first, "got wrong value: %ld\n", start);
   hres = ITextRange_GetEnd(txtRgeDup, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == lim, "got wrong value: %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == lim, "got wrong value: %ld\n", end);
 
   ITextRange_Release(txtRgeDup);
 
@@ -1402,10 +1402,10 @@ static void test_ITextRange_GetDuplicate(void)
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
   hres = ITextRange_GetDuplicate(txtRge, NULL);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextRange_GetDuplicate(txtRge, &txtRgeDup);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   ITextRange_Release(txtRge);
 }
@@ -1425,98 +1425,98 @@ static void test_ITextRange_Collapse(void)
 
   first = 4; lim = 8;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_Collapse(txtRge, tomTrue);
   ok(hres == S_OK, "ITextRange_Collapse\n");
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 4, "got wrong start value: %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 4, "got wrong start value: %ld\n", start);
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 4, "got wrong end value: %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 4, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_Collapse(txtRge, tomStart);
   ok(hres == S_OK, "ITextRange_Collapse\n");
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 4, "got wrong start value: %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 4, "got wrong start value: %ld\n", start);
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 4, "got wrong end value: %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 4, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_Collapse(txtRge, tomFalse);
   ok(hres == S_OK, "ITextRange_Collapse\n");
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 8, "got wrong start value: %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 8, "got wrong start value: %ld\n", start);
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 8, "got wrong end value: %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 8, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_Collapse(txtRge, tomEnd);
   ok(hres == S_OK, "ITextRange_Collapse\n");
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 8, "got wrong start value: %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 8, "got wrong start value: %ld\n", start);
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 8, "got wrong end value: %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 8, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   /* tomStart is the default */
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_Collapse(txtRge, 256);
   ok(hres == S_OK, "ITextRange_Collapse\n");
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 4, "got wrong start value: %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 4, "got wrong start value: %ld\n", start);
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 4, "got wrong end value: %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 4, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   first = 6; lim = 6;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_Collapse(txtRge, tomEnd);
   ok(hres == S_FALSE, "ITextRange_Collapse\n");
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 6, "got wrong start value: %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 6, "got wrong start value: %ld\n", start);
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 6, "got wrong end value: %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 6, "got wrong end value: %ld\n", end);
   ITextRange_Release(txtRge);
 
   first = 8; lim = 8;
   hres = ITextDocument_Range(txtDoc, first, lim, &txtRge);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   hres = ITextRange_Collapse(txtRge, tomStart);
   ok(hres == S_FALSE, "ITextRange_Collapse\n");
   hres = ITextRange_GetStart(txtRge, &start);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(start == 8, "got wrong start value: %d\n", start);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(start == 8, "got wrong start value: %ld\n", start);
   hres = ITextRange_GetEnd(txtRge, &end);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
-  ok(end == 8, "got wrong end value: %d\n", end);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
+  ok(end == 8, "got wrong end value: %ld\n", end);
 
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
   hres = ITextRange_Collapse(txtRge, tomStart);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextRange_Collapse(txtRge, tomUndefined);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   ITextRange_Release(txtRge);
 }
@@ -1539,61 +1539,61 @@ static void test_ITextSelection_Collapse(void)
   hres = ITextSelection_Collapse(txtSel, tomTrue);
   ok(hres == S_OK, "ITextSelection_Collapse\n");
   SendMessageA(w, EM_GETSEL, (LPARAM)&start, (WPARAM)&end);
-  ok(start == 4, "got wrong start value: %d\n", start);
-  ok(end == 4, "got wrong end value: %d\n", end);
+  ok(start == 4, "got wrong start value: %ld\n", start);
+  ok(end == 4, "got wrong end value: %ld\n", end);
 
   SendMessageA(w, EM_SETSEL, first, lim);
   hres = ITextSelection_Collapse(txtSel, tomStart);
   ok(hres == S_OK, "ITextSelection_Collapse\n");
   SendMessageA(w, EM_GETSEL, (LPARAM)&start, (WPARAM)&end);
-  ok(start == 4, "got wrong start value: %d\n", start);
-  ok(end == 4, "got wrong end value: %d\n", end);
+  ok(start == 4, "got wrong start value: %ld\n", start);
+  ok(end == 4, "got wrong end value: %ld\n", end);
 
   SendMessageA(w, EM_SETSEL, first, lim);
   hres = ITextSelection_Collapse(txtSel, tomFalse);
   ok(hres == S_OK, "ITextSelection_Collapse\n");
   SendMessageA(w, EM_GETSEL, (LPARAM)&start, (WPARAM)&end);
-  ok(start == 8, "got wrong start value: %d\n", start);
-  ok(end == 8, "got wrong end value: %d\n", end);
+  ok(start == 8, "got wrong start value: %ld\n", start);
+  ok(end == 8, "got wrong end value: %ld\n", end);
 
   SendMessageA(w, EM_SETSEL, first, lim);
   hres = ITextSelection_Collapse(txtSel, tomEnd);
   ok(hres == S_OK, "ITextSelection_Collapse\n");
   SendMessageA(w, EM_GETSEL, (LPARAM)&start, (WPARAM)&end);
-  ok(start == 8, "got wrong start value: %d\n", start);
-  ok(end == 8, "got wrong end value: %d\n", end);
+  ok(start == 8, "got wrong start value: %ld\n", start);
+  ok(end == 8, "got wrong end value: %ld\n", end);
 
   /* tomStart is the default */
   SendMessageA(w, EM_SETSEL, first, lim);
   hres = ITextSelection_Collapse(txtSel, 256);
   ok(hres == S_OK, "ITextSelection_Collapse\n");
   SendMessageA(w, EM_GETSEL, (LPARAM)&start, (WPARAM)&end);
-  ok(start == 4, "got wrong start value: %d\n", start);
-  ok(end == 4, "got wrong end value: %d\n", end);
+  ok(start == 4, "got wrong start value: %ld\n", start);
+  ok(end == 4, "got wrong end value: %ld\n", end);
 
   first = 6; lim = 6;
   SendMessageA(w, EM_SETSEL, first, lim);
   hres = ITextSelection_Collapse(txtSel, tomEnd);
   ok(hres == S_FALSE, "ITextSelection_Collapse\n");
   SendMessageA(w, EM_GETSEL, (LPARAM)&start, (WPARAM)&end);
-  ok(start == 6, "got wrong start value: %d\n", start);
-  ok(end == 6, "got wrong end value: %d\n", end);
+  ok(start == 6, "got wrong start value: %ld\n", start);
+  ok(end == 6, "got wrong end value: %ld\n", end);
 
   first = 8; lim = 8;
   SendMessageA(w, EM_SETSEL, first, lim);
   hres = ITextSelection_Collapse(txtSel, tomStart);
   ok(hres == S_FALSE, "ITextSelection_Collapse\n");
   SendMessageA(w, EM_GETSEL, (LPARAM)&start, (WPARAM)&end);
-  ok(start == 8, "got wrong start value: %d\n", start);
-  ok(end == 8, "got wrong end value: %d\n", end);
+  ok(start == 8, "got wrong start value: %ld\n", start);
+  ok(end == 8, "got wrong end value: %ld\n", end);
 
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 
   hres = ITextSelection_Collapse(txtSel, tomStart);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   hres = ITextSelection_Collapse(txtSel, tomUndefined);
-  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+  ok(hres == CO_E_RELEASED, "got 0x%08lx\n", hres);
 
   ITextSelection_Release(txtSel);
 }
@@ -1611,54 +1611,54 @@ static void test_GetClientSite(void)
 
   create_interfaces(&w, &reOle, &txtDoc, NULL);
   hres = IRichEditOle_GetClientSite(reOle, &clientSite);
-  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
   EXPECT_REF(clientSite, 1);
 
   hres = IOleClientSite_QueryInterface(clientSite, &IID_IRichEditOle, (void **)&reOle1);
-  ok(hres == E_NOINTERFACE, "IOleClientSite_QueryInterface: %x\n", hres);
+  ok(hres == E_NOINTERFACE, "IOleClientSite_QueryInterface: %lx\n", hres);
 
   hres = IRichEditOle_GetClientSite(reOle, &clientSite1);
-  ok(hres == S_OK, "got 0x%08x\n", hres);
+  ok(hres == S_OK, "got 0x%08lx\n", hres);
   ok(clientSite != clientSite1, "got %p, %p\n", clientSite, clientSite1);
   IOleClientSite_Release(clientSite1);
 
   hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleClientSite, (void **)&clientSite1);
-  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08lx\n", hres);
   ok(clientSite == clientSite1, "Should not return a new pointer.\n");
   EXPECT_REF(clientSite, 2);
 
   /* IOleWindow interface */
   hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleWindow, (void **)&oleWin);
-  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08lx\n", hres);
   refcount1 = get_refcount((IUnknown *)clientSite);
   refcount2 = get_refcount((IUnknown *)oleWin);
   ok(refcount1 == refcount2, "got wrong ref count.\n");
 
   hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleWindow, (void **)&oleWin1);
-  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08lx\n", hres);
   ok(oleWin == oleWin1, "Should not return a new pointer.\n");
   refcount1 = get_refcount((IUnknown *)clientSite);
   refcount2 = get_refcount((IUnknown *)oleWin);
   ok(refcount1 == refcount2, "got wrong ref count.\n");
 
   hres = IOleWindow_QueryInterface(oleWin, &IID_IOleClientSite, (void **)&clientSite2);
-  ok(hres == S_OK, "IOleWindow_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleWindow_QueryInterface: 0x%08lx\n", hres);
   ok(clientSite2 == clientSite1, "got wrong pointer\n");
 
   /* IOleInPlaceSite interface */
   hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleInPlaceSite, (void **)&olePlace);
-  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08lx\n", hres);
   refcount1 = get_refcount((IUnknown *)olePlace);
   refcount2 = get_refcount((IUnknown *)clientSite);
   ok(refcount1 == refcount2, "got wrong ref count.\n");
 
   hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleInPlaceSite, (void **)&olePlace1);
-  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08lx\n", hres);
   ok(olePlace == olePlace1, "Should not return a new pointer.\n");
   IOleInPlaceSite_Release(olePlace1);
 
   hres = IOleWindow_QueryInterface(oleWin, &IID_IOleInPlaceSite, (void **)&olePlace1);
-  ok(hres == S_OK, "IOleWindow_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleWindow_QueryInterface: 0x%08lx\n", hres);
   refcount1 = get_refcount((IUnknown *)olePlace1);
   refcount2 = get_refcount((IUnknown *)oleWin);
   ok(refcount1 == refcount2, "got wrong ref count.\n");
@@ -1685,16 +1685,16 @@ static void test_IOleWindow_GetWindow(void)
 
   create_interfaces(&w, &reOle, &txtDoc, NULL);
   hres = IRichEditOle_GetClientSite(reOle, &clientSite);
-  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
 
   hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleWindow, (void **)&oleWin);
-  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08lx\n", hres);
   hres = IOleWindow_GetWindow(oleWin, &hwnd);
-  ok(hres == S_OK, "IOleClientSite_GetWindow: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleClientSite_GetWindow: 0x%08lx\n", hres);
   ok(w == hwnd, "got wrong pointer\n");
 
   hres = IOleWindow_GetWindow(oleWin, NULL);
-  ok(hres == E_INVALIDARG, "IOleClientSite_GetWindow: 0x%08x\n", hres);
+  ok(hres == E_INVALIDARG, "IOleClientSite_GetWindow: 0x%08lx\n", hres);
 
   IOleWindow_Release(oleWin);
   IOleClientSite_Release(clientSite);
@@ -1713,16 +1713,16 @@ static void test_IOleInPlaceSite_GetWindow(void)
 
   create_interfaces(&w, &reOle, &txtDoc, NULL);
   hres = IRichEditOle_GetClientSite(reOle, &clientSite);
-  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
 
   hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleInPlaceSite, (void **)&olePlace);
-  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08lx\n", hres);
   hres = IOleInPlaceSite_GetWindow(olePlace, &hwnd);
-  ok(hres == S_OK, "IOleInPlaceSite_GetWindow: 0x%08x\n", hres);
+  ok(hres == S_OK, "IOleInPlaceSite_GetWindow: 0x%08lx\n", hres);
   ok(w == hwnd, "got wrong pointer.\n");
 
   hres = IOleInPlaceSite_GetWindow(olePlace, NULL);
-  ok(hres == E_INVALIDARG, "IOleInPlaceSite_GetWindow: 0x%08x\n", hres);
+  ok(hres == E_INVALIDARG, "IOleInPlaceSite_GetWindow: 0x%08lx\n", hres);
 
   IOleInPlaceSite_Release(olePlace);
   IOleClientSite_Release(clientSite);
@@ -1748,11 +1748,11 @@ static void test_GetFont(void)
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
 
   hr = ITextDocument_GetSelection(doc, &selection);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   hr = ITextSelection_GetFont(selection, &font);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   hr = ITextSelection_GetFont(selection, &font2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(font != font2, "got %p, %p\n", font, font2);
   ITextFont_Release(font2);
   ITextFont_Release(font);
@@ -1762,17 +1762,17 @@ static void test_GetFont(void)
   EXPECT_REF(doc, 3);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   EXPECT_REF(reOle, 3);
   EXPECT_REF(doc, 3);
   EXPECT_REF(range, 1);
 
   hr = ITextRange_GetFont(range, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetFont(range, &font);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   EXPECT_REF(reOle, 3);
   EXPECT_REF(doc, 3);
@@ -1780,7 +1780,7 @@ static void test_GetFont(void)
   EXPECT_REF(font, 1);
 
   hr = ITextRange_GetFont(range, &font2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(font != font2, "got %p, %p\n", font, font2);
 
   EXPECT_REF(reOle, 3);
@@ -1793,27 +1793,27 @@ static void test_GetFont(void)
 
   /* set different font style within a range */
   hr = ITextFont_GetItalic(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetSize(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   size = 0.0;
   hr = ITextFont_GetSize(font, &size);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(size > 0.0, "size %.2f\n", size);
 
   value = 0;
   hr = ITextFont_GetLanguageID(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == GetSystemDefaultLCID(), "got lcid %x, user lcid %x\n", value,
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == GetSystemDefaultLCID(), "got lcid %lx, user lcid %lx\n", value,
       GetSystemDefaultLCID());
 
   /* range is non-italic */
   value = tomTrue;
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   cf.cbSize = sizeof(CHARFORMAT2A);
   cf.dwMask = CFM_ITALIC|CFM_SIZE;
@@ -1827,22 +1827,22 @@ static void test_GetFont(void)
   /* now range is partially italicized */
   value = tomFalse;
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   size = 0.0;
   hr = ITextFont_GetSize(font, &size);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(size == tomUndefined, "size %.2f\n", size);
 
   ITextFont_Release(font);
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_GetFont(range, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetFont(range, &font2);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   ITextRange_Release(range);
 }
@@ -1865,17 +1865,17 @@ static void test_GetPara(void)
   EXPECT_REF(doc, 3);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   EXPECT_REF(reOle, 3);
   EXPECT_REF(doc, 3);
   EXPECT_REF(range, 1);
 
   hr = ITextRange_GetPara(range, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetPara(range, &para);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   EXPECT_REF(reOle, 3);
   EXPECT_REF(doc, 3);
@@ -1883,7 +1883,7 @@ static void test_GetPara(void)
   EXPECT_REF(para, 1);
 
   hr = ITextRange_GetPara(range, &para2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(para != para2, "got %p, %p\n", para, para2);
 
   EXPECT_REF(reOle, 3);
@@ -1900,7 +1900,7 @@ static void test_GetPara(void)
   EXPECT_REF(selection, 2);
 
   hr = ITextSelection_GetPara(selection, &para);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   EXPECT_REF(reOle, 3);
   EXPECT_REF(doc, 3);
@@ -1908,7 +1908,7 @@ static void test_GetPara(void)
   EXPECT_REF(para, 1);
 
   hr = ITextSelection_GetPara(selection, &para2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(para != para2, "got %p, %p\n", para, para2);
 
   ITextPara_Release(para);
@@ -1916,16 +1916,16 @@ static void test_GetPara(void)
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_GetPara(range, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetPara(range, &para);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_GetPara(selection, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_GetPara(selection, &para);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   ITextSelection_Release(selection);
   ITextRange_Release(range);
@@ -1948,32 +1948,32 @@ static void test_dispatch(void)
 
   range = NULL;
   hr = ITextDocument_Range(doc, 0, 0, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(range != NULL, "got %p\n", range);
 
   dispid = 123;
   nameW = (WCHAR*)testnameW;
   hr = ITextRange_GetIDsOfNames(range, &IID_NULL, &nameW, 1, LOCALE_USER_DEFAULT, &dispid);
-  ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr);
-  ok(dispid == DISPID_UNKNOWN, "got %d\n", dispid);
+  ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08lx\n", hr);
+  ok(dispid == DISPID_UNKNOWN, "got %ld\n", dispid);
 
   dispid = 123;
   nameW = (WCHAR*)testname2W;
   hr = ITextRange_GetIDsOfNames(range, &IID_NULL, &nameW, 1, LOCALE_USER_DEFAULT, &dispid);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(dispid == DISPID_VALUE, "got %d\n", dispid);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(dispid == DISPID_VALUE, "got %ld\n", dispid);
 
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   /* try dispatch methods on detached range */
   hr = ITextRange_GetTypeInfoCount(range, &count);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   dispid = 123;
   nameW = (WCHAR*)testname2W;
   hr = ITextRange_GetIDsOfNames(range, &IID_NULL, &nameW, 1, LOCALE_USER_DEFAULT, &dispid);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(dispid == DISPID_VALUE, "got %d\n", dispid);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(dispid == DISPID_VALUE, "got %ld\n", dispid);
 
   ITextRange_Release(range);
 }
@@ -1986,64 +1986,64 @@ static void test_detached_font_getters(ITextFont *font, BOOL duplicate)
   BSTR str;
 
   hr = ITextFont_GetBold(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetBold(font, &value);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetForeColor(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetForeColor(font, &value);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetItalic(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetLanguageID(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetLanguageID(font, &value);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetName(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetName(font, &str);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetSize(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetSize(font, &size);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetStrikeThrough(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetStrikeThrough(font, &value);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetSubscript(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetSubscript(font, &value);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetSuperscript(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetSuperscript(font, &value);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetUnderline(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetUnderline(font, &value);
-  ok(hr == hrexp, "got 0x%08x\n", hr);
+  ok(hr == hrexp, "got 0x%08lx\n", hr);
 }
 
 static void test_textfont_global_defaults(ITextFont *font)
@@ -2055,124 +2055,124 @@ static void test_textfont_global_defaults(ITextFont *font)
 
   value = tomUndefined;
   hr = ITextFont_GetAllCaps(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetAnimation(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetBackColor(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomAutoColor, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomAutoColor, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetBold(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse || value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse || value == tomTrue, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetEmboss(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetForeColor(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomAutoColor, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomAutoColor, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetHidden(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetEngrave(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   valuef = 1.0;
   hr = ITextFont_GetKerning(font, &valuef);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(valuef == 0.0, "got %.2f\n", valuef);
 
   value = tomUndefined;
   hr = ITextFont_GetLanguageID(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == GetSystemDefaultLCID(), "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == GetSystemDefaultLCID(), "got %ld\n", value);
 
   str = NULL;
   hr = ITextFont_GetName(font, &str);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(!lstrcmpW(sysW, str), "%s\n", wine_dbgstr_w(str));
   SysFreeString(str);
 
   value = tomUndefined;
   hr = ITextFont_GetOutline(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   valuef = 1.0;
   hr = ITextFont_GetPosition(font, &valuef);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(valuef == 0.0, "got %.2f\n", valuef);
 
   value = tomUndefined;
   hr = ITextFont_GetProtected(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetShadow(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   valuef = 0.0;
   hr = ITextFont_GetSize(font, &valuef);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(valuef >= 0.0, "got %.2f\n", valuef);
 
   value = tomUndefined;
   hr = ITextFont_GetSmallCaps(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   valuef = 1.0;
   hr = ITextFont_GetSpacing(font, &valuef);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(valuef == 0.0, "got %.2f\n", valuef);
 
   value = tomUndefined;
   hr = ITextFont_GetStrikeThrough(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetSubscript(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetSuperscript(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetUnderline(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomUndefined;
   hr = ITextFont_GetWeight(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == FW_NORMAL || value == FW_BOLD, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == FW_NORMAL || value == FW_BOLD, "got %ld\n", value);
 }
 
 static void test_textfont_undefined(ITextFont *font)
@@ -2183,118 +2183,118 @@ static void test_textfont_undefined(ITextFont *font)
 
   value = tomFalse;
   hr = ITextFont_GetAllCaps(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetAnimation(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetBackColor(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetBold(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetEmboss(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetForeColor(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetHidden(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetEngrave(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   valuef = 0.0;
   hr = ITextFont_GetKerning(font, &valuef);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(valuef == tomUndefined, "got %.2f\n", valuef);
 
   value = tomFalse;
   hr = ITextFont_GetLanguageID(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetOutline(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   valuef = 0.0;
   hr = ITextFont_GetPosition(font, &valuef);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(valuef == tomUndefined, "got %.2f\n", valuef);
 
   value = tomFalse;
   hr = ITextFont_GetProtected(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetShadow(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   valuef = 0.0;
   hr = ITextFont_GetSize(font, &valuef);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(valuef == tomUndefined, "got %.2f\n", valuef);
 
   value = tomFalse;
   hr = ITextFont_GetSmallCaps(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   valuef = 0.0;
   hr = ITextFont_GetSpacing(font, &valuef);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(valuef == tomUndefined, "got %.2f\n", valuef);
 
   value = tomFalse;
   hr = ITextFont_GetStrikeThrough(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetSubscript(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetSuperscript(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetUnderline(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 
   value = tomFalse;
   hr = ITextFont_GetWeight(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUndefined, "got %ld\n", value);
 }
 
 static inline FLOAT twips_to_points(LONG value)
@@ -2322,39 +2322,39 @@ static void test_ITextFont(void)
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
 
   hr = ITextDocument_Range(doc, 0, 10, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetFont(range, &font);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_Reset(font, tomUseTwips);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_Reset(font, tomUsePoints);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetName(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   /* default font size unit is point */
   size = 0.0;
   hr = ITextFont_GetSize(font, &size);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   /* set to some non-zero values */
   hr = ITextFont_SetPosition(font, 20.0);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_SetKerning(font, 10.0);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   position = 0.0;
   hr = ITextFont_GetPosition(font, &position);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   kerning = 0.0;
   hr = ITextFont_GetKerning(font, &kerning);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   memset(&cf, 0, sizeof(cf));
   cf.cbSize = sizeof(cf);
@@ -2364,31 +2364,31 @@ static void test_ITextFont(void)
   SendMessageA(hwnd, EM_SETSEL, 0, 10);
   ret = SendMessageA(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
   ok(ret, "got %d\n", ret);
-  ok(size == twips_to_points(cf.yHeight), "got yHeight %d, size %.2f\n", cf.yHeight, size);
-  ok(position == twips_to_points(cf.yOffset), "got yOffset %d, position %.2f\n", cf.yOffset, position);
+  ok(size == twips_to_points(cf.yHeight), "got yHeight %ld, size %.2f\n", cf.yHeight, size);
+  ok(position == twips_to_points(cf.yOffset), "got yOffset %ld, position %.2f\n", cf.yOffset, position);
   ok(kerning == twips_to_points(cf.wKerning), "got wKerning %d, kerning %.2f\n", cf.wKerning, kerning);
 
   hr = ITextFont_Reset(font, tomUseTwips);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_Reset(font, tomUsePoints);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetDuplicate(font, &font2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_Reset(font2, tomUseTwips);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextFont_Reset(font2, tomUsePoints);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   ITextFont_Release(font2);
 
   /* default font name */
   str = NULL;
   hr = ITextFont_GetName(font, &str);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(!lstrcmpW(str, sysW), "got %s\n", wine_dbgstr_w(str));
   SysFreeString(str);
 
@@ -2405,7 +2405,7 @@ static void test_ITextFont(void)
   /* still original name */
   str = NULL;
   hr = ITextFont_GetName(font, &str);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(!lstrcmpW(str, sysW), "got %s\n", wine_dbgstr_w(str));
   SysFreeString(str);
 
@@ -2415,7 +2415,7 @@ static void test_ITextFont(void)
 
   str = NULL;
   hr = ITextFont_GetName(font, &str);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(!lstrcmpW(str, sysW), "got %s\n", wine_dbgstr_w(str));
   SysFreeString(str);
 
@@ -2426,18 +2426,18 @@ static void test_ITextFont(void)
 
   str = NULL;
   hr = ITextFont_GetName(font, &str);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(!lstrcmpW(str, arialW), "got %s\n", wine_dbgstr_w(str));
   SysFreeString(str);
 
   /* GetDuplicate() */
   hr = ITextFont_GetDuplicate(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   EXPECT_REF(range, 2);
   font2 = NULL;
   hr = ITextFont_GetDuplicate(font, &font2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   EXPECT_REF(range, 2);
 
   /* set whole range to italic */
@@ -2451,75 +2451,75 @@ static void test_ITextFont(void)
 
   value = tomFalse;
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomTrue, "got %ld\n", value);
 
   /* duplicate retains original value */
   value = tomTrue;
   hr = ITextFont_GetItalic(font2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   /* get a duplicate from a cloned font */
   hr = ITextFont_GetDuplicate(font2, &font3);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ITextFont_Release(font3);
 
   ITextRange_Release(range);
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextFont_GetDuplicate(font, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   test_detached_font_getters(font, FALSE);
   test_detached_font_getters(font2, TRUE);
 
   /* get a duplicate of detached font */
   hr = ITextFont_GetDuplicate(font2, &font3);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ITextFont_Release(font3);
 
   /* reset detached font to undefined */
   value = tomUndefined;
   hr = ITextFont_GetBold(font2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value != tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value != tomUndefined, "got %ld\n", value);
 
   /* reset to undefined for detached font */
   hr = ITextFont_Reset(font2, tomUndefined);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   test_textfont_undefined(font2);
 
   /* font is detached, default means global TOM defaults */
   hr = ITextFont_Reset(font2, tomDefault);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   test_textfont_global_defaults(font2);
 
   hr = ITextFont_GetDuplicate(font2, &font3);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   test_textfont_global_defaults(font2);
 
   hr = ITextFont_Reset(font2, tomApplyNow);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   test_textfont_global_defaults(font2);
 
   hr = ITextFont_Reset(font2, tomApplyLater);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   test_textfont_global_defaults(font2);
 
   hr = ITextFont_Reset(font2, tomTrackParms);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   test_textfont_global_defaults(font2);
 
   hr = ITextFont_SetItalic(font2, tomUndefined);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetItalic(font2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextFont_Reset(font2, tomCacheParms);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   test_textfont_global_defaults(font2);
 
   ITextFont_Release(font3);
@@ -2527,11 +2527,11 @@ static void test_ITextFont(void)
 
   font2 = (void*)0xdeadbeef;
   hr = ITextFont_GetDuplicate(font, &font2);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
   ok(font2 == NULL, "got %p\n", font2);
 
   hr = ITextFont_Reset(font, tomDefault);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   ITextFont_Release(font);
 
@@ -2540,32 +2540,32 @@ static void test_ITextFont(void)
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
 
   hr = ITextDocument_Range(doc, 0, 10, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetFont(range, &font);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   value = tomUndefined;
   hr = ITextFont_GetBold(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value != tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value != tomUndefined, "got %ld\n", value);
 
   /* reset to undefined for attached font */
   hr = ITextFont_Reset(font, tomUndefined);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   value = tomUndefined;
   hr = ITextFont_GetBold(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value != tomUndefined, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value != tomUndefined, "got %ld\n", value);
 
   /* tomCacheParms/tomTrackParms */
   hr = ITextFont_Reset(font, tomCacheParms);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   memset(&cf, 0, sizeof(cf));
   cf.cbSize = sizeof(CHARFORMAT2A);
@@ -2578,65 +2578,65 @@ static void test_ITextFont(void)
 
   /* still cached value */
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextFont_Reset(font, tomTrackParms);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomTrue, "got %ld\n", value);
 
   /* switch back to cache - value retained */
   hr = ITextFont_Reset(font, tomCacheParms);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomTrue, "got %ld\n", value);
 
   /* tomApplyLater */
   hr = ITextFont_Reset(font, tomApplyLater);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_SetItalic(font, tomFalse);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   cf.dwEffects = 0;
   SendMessageA(hwnd, EM_SETSEL, 0, 10);
   ret = SendMessageA(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
   ok(ret, "got %d\n", ret);
-  ok((cf.dwEffects & CFE_ITALIC) == CFE_ITALIC, "got 0x%08x\n", cf.dwEffects);
+  ok((cf.dwEffects & CFE_ITALIC) == CFE_ITALIC, "got 0x%08lx\n", cf.dwEffects);
 
   hr = ITextFont_Reset(font, tomApplyNow);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   cf.dwEffects = 0;
   SendMessageA(hwnd, EM_SETSEL, 0, 10);
   ret = SendMessageA(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
   ok(ret, "got %d\n", ret);
-  ok((cf.dwEffects & CFE_ITALIC) == 0, "got 0x%08x\n", cf.dwEffects);
+  ok((cf.dwEffects & CFE_ITALIC) == 0, "got 0x%08lx\n", cf.dwEffects);
 
   hr = ITextFont_SetItalic(font, tomUndefined);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextFont_SetItalic(font, tomAutoColor);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   cf.dwEffects = 0;
   SendMessageA(hwnd, EM_SETSEL, 0, 10);
   ret = SendMessageA(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
   ok(ret, "got %d\n", ret);
-  ok((cf.dwEffects & CFE_ITALIC) == 0, "got 0x%08x\n", cf.dwEffects);
+  ok((cf.dwEffects & CFE_ITALIC) == 0, "got 0x%08lx\n", cf.dwEffects);
 
   ITextRange_Release(range);
   ITextFont_Release(font);
@@ -2657,41 +2657,41 @@ static void test_Delete(void)
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextDocument_Range(doc, 1, 2, &range2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetEnd(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 4, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 4, "got %ld\n", value);
 
   /* unit type doesn't matter is count is 0 */
   value = 0;
   hr = ITextRange_Delete(range2, tomSentence, 0, &value);
 todo_wine {
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 1, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 1, "got %ld\n", value);
 }
   value = 1;
   hr = ITextRange_Delete(range2, tomCharacter, 0, &value);
 todo_wine {
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == 0, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == 0, "got %ld\n", value);
 }
   hr = ITextRange_GetEnd(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   todo_wine
-  ok(value == 3, "got %d\n", value);
+  ok(value == 3, "got %ld\n", value);
 
   hr = ITextRange_GetStart(range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 1, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 1, "got %ld\n", value);
 
   hr = ITextRange_GetEnd(range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   todo_wine
-  ok(value == 1, "got %d\n", value);
+  ok(value == 1, "got %ld\n", value);
 
   ITextRange_Release(range);
   ITextRange_Release(range2);
@@ -2714,72 +2714,72 @@ static void test_SetText(void)
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextDocument_Range(doc, 0, 4, &range2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   value = 1;
   hr = ITextRange_GetStart(range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 0, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 0, "got %ld\n", value);
 
   value = 0;
   hr = ITextRange_GetEnd(range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 4, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 4, "got %ld\n", value);
 
   hr = ITextRange_SetText(range, NULL);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   value = 1;
   hr = ITextRange_GetEnd(range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 0, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 0, "got %ld\n", value);
 
   str = SysAllocString(textW);
   hr = ITextRange_SetText(range, str);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   SysFreeString(str);
 
   value = 1;
   hr = ITextRange_GetStart(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 0, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 0, "got %ld\n", value);
 
   value = 0;
   hr = ITextRange_GetEnd(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 9, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 9, "got %ld\n", value);
 
   value = 1;
   hr = ITextRange_GetStart(range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 0, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 0, "got %ld\n", value);
 
   value = 0;
   hr = ITextRange_GetEnd(range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 0, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 0, "got %ld\n", value);
 
   str = SysAllocStringLen(NULL, 0);
   hr = ITextRange_SetText(range, str);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   value = 1;
   hr = ITextRange_GetEnd(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 0, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 0, "got %ld\n", value);
   SysFreeString(str);
 
   ITextRange_Release(range2);
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_SetText(range, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   str = SysAllocStringLen(NULL, 0);
   hr = ITextRange_SetText(range, str);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
   SysFreeString(str);
 
   ITextRange_Release(range);
@@ -2801,93 +2801,93 @@ static void test_InRange(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextDocument_Range(doc, 0, 4, &range2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   /* matches selection */
   hr = ITextDocument_Range(doc, 1, 2, &range3);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_InRange(range, NULL, NULL);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextRange_InRange(range, NULL, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextRange_InRange(range, range2, NULL);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   value = tomFalse;
   hr = ITextRange_InRange(range, range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomTrue, "got %ld\n", value);
 
   /* selection */
   hr = ITextSelection_InRange(selection, NULL, NULL);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextSelection_InRange(selection, NULL, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextSelection_InRange(selection, range2, NULL);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextSelection_InRange(selection, range2, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomTrue;
   hr = ITextSelection_InRange(selection, range3, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   /* seems to work on ITextSelection ranges only */
   value = tomFalse;
   hr = ITextSelection_InRange(selection, (ITextRange*)selection, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomTrue, "got %ld\n", value);
 
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_InRange(range, NULL, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextRange_InRange(range, NULL, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextRange_InRange(range, range2, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextRange_InRange(range, range2, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   /* selection */
   hr = ITextSelection_InRange(selection, NULL, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextSelection_InRange(selection, NULL, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextSelection_InRange(selection, range2, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextSelection_InRange(selection, range2, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   ITextRange_Release(range);
   ITextRange_Release(range2);
@@ -2911,98 +2911,98 @@ static void test_ITextRange_IsEqual(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextDocument_Range(doc, 0, 4, &range2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   /* matches selection */
   hr = ITextDocument_Range(doc, 1, 2, &range3);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_IsEqual(range, NULL, NULL);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextRange_IsEqual(range, NULL, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextRange_IsEqual(range, range2, NULL);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   value = tomFalse;
   hr = ITextRange_IsEqual(range, range2, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomTrue, "got %ld\n", value);
 
   value = tomTrue;
   hr = ITextRange_IsEqual(range, range3, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   /* selection */
   hr = ITextSelection_IsEqual(selection, NULL, NULL);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextSelection_IsEqual(selection, NULL, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextSelection_IsEqual(selection, range2, NULL);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextSelection_IsEqual(selection, range2, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   value = tomTrue;
   hr = ITextSelection_IsEqual(selection, range3, &value);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   /* seems to work on ITextSelection ranges only */
   value = tomFalse;
   hr = ITextSelection_IsEqual(selection, (ITextRange*)selection, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomTrue, "got %ld\n", value);
 
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_IsEqual(range, NULL, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextRange_IsEqual(range, NULL, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextRange_IsEqual(range, range2, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextRange_IsEqual(range, range2, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   /* selection */
   hr = ITextSelection_IsEqual(selection, NULL, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextSelection_IsEqual(selection, NULL, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   hr = ITextSelection_IsEqual(selection, range2, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = tomTrue;
   hr = ITextSelection_IsEqual(selection, range2, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   ITextRange_Release(range);
   ITextRange_Release(range2);
@@ -3026,29 +3026,29 @@ static void test_Select(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_Select(range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   value = 1;
   hr = ITextSelection_GetStart(selection, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 0, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 0, "got %ld\n", value);
 
   hr = ITextRange_Select(range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_Select(selection);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_Select(range);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_Select(selection);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   ITextRange_Release(range);
   ITextSelection_Release(selection);
@@ -3070,41 +3070,41 @@ static void test_GetStoryType(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetStoryType(range, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   value = tomTextFrameStory;
   hr = ITextRange_GetStoryType(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUnknownStory, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUnknownStory, "got %ld\n", value);
 
   hr = ITextSelection_GetStoryType(selection, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   value = tomTextFrameStory;
   hr = ITextSelection_GetStoryType(selection, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomUnknownStory, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomUnknownStory, "got %ld\n", value);
 
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_GetStoryType(range, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = 123;
   hr = ITextRange_GetStoryType(range, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == 123, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == 123, "got %ld\n", value);
 
   hr = ITextSelection_GetStoryType(selection, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = 123;
   hr = ITextSelection_GetStoryType(selection, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == 123, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == 123, "got %ld\n", value);
 
   ITextRange_Release(range);
   ITextSelection_Release(selection);
@@ -3127,68 +3127,68 @@ static void test_SetFont(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextDocument_Range(doc, 5, 2, &range2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   EXPECT_REF(range, 1);
   hr = ITextRange_GetFont(range, &font);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   EXPECT_REF(range, 2);
 
   EXPECT_REF(range2, 1);
   hr = ITextRange_GetFont(range2, &font2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   EXPECT_REF(range2, 2);
 
   hr = ITextRange_SetFont(range, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   /* setting same font, no-op */
   EXPECT_REF(range, 2);
   hr = ITextRange_SetFont(range, font);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   EXPECT_REF(range, 2);
 
   EXPECT_REF(range2, 2);
   EXPECT_REF(range, 2);
   hr = ITextRange_SetFont(range, font2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   EXPECT_REF(range2, 2);
   EXPECT_REF(range, 2);
 
   /* originally range 0-4 is non-italic */
   value = tomTrue;
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomFalse, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomFalse, "got %ld\n", value);
 
   /* set range 5-2 to italic, then set this font to range 0-4 */
   hr = ITextFont_SetItalic(font2, tomTrue);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_SetFont(range, font2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   value = tomFalse;
   hr = ITextFont_GetItalic(font, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == tomTrue, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == tomTrue, "got %ld\n", value);
 
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_SetFont(range, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextRange_SetFont(range, font);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_SetFont(selection, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_SetFont(selection, font);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   ITextFont_Release(font);
   ITextFont_Release(font2);
@@ -3225,7 +3225,7 @@ static void _check_reobject_struct(IRichEditOle *reole, LONG index, DWORD flags,
   reobj.cbStruct = sizeof(reobj);
   reobj.cp = cp;
   hr = IRichEditOle_GetObject(reole, index, &reobj, flags);
-  ok(hr == S_OK, "IRichEditOle_GetObject failed: %#x.\n", hr);
+  ok(hr == S_OK, "IRichEditOle_GetObject failed: %#lx.\n", hr);
   ok_(__FILE__,line)(reobj.poleobj == poleobj, "got wrong object interface.\n");
   ok_(__FILE__,line)(reobj.pstg == pstg, "got wrong storage interface.\n");
   ok_(__FILE__,line)(reobj.polesite == polesite, "got wrong site interface.\n");
@@ -3239,10 +3239,10 @@ static void _insert_reobject(IRichEditOle *reole, REOBJECT *reobj, LONG cp, DWOR
   IOleClientSite *clientsite;
   HRESULT hr;
   hr = IRichEditOle_GetClientSite(reole, &clientsite);
-  ok_(__FILE__,line)(hr == S_OK, "IRichEditOle_GetClientSite got hr %#x.\n", hr);
+  ok_(__FILE__,line)(hr == S_OK, "IRichEditOle_GetClientSite got hr %#lx.\n", hr);
   fill_reobject_struct(reobj, cp, NULL, NULL, clientsite, 10, 10, DVASPECT_CONTENT, 0, user);
   hr = IRichEditOle_InsertObject(reole, reobj);
-  ok_(__FILE__,line)(hr == S_OK, "IRichEditOle_InsertObject got hr %#x.\n", hr);
+  ok_(__FILE__,line)(hr == S_OK, "IRichEditOle_InsertObject got hr %#lx.\n", hr);
   IOleClientSite_Release(clientsite);
 }
 
@@ -3273,25 +3273,25 @@ static void test_InsertObject(void)
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
 
   hr = IRichEditOle_InsertObject(reole, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   /* insert object1 in (0, 1)*/
   SendMessageA(hwnd, EM_SETSEL, 0, 1);
   INSERT_REOBJECT(reole, &reo1, REO_CP_SELECTION, 1);
   count = IRichEditOle_GetObjectCount(reole);
-  ok(count == 1, "got wrong object count: %d\n", count);
+  ok(count == 1, "got wrong object count: %ld\n", count);
 
   /* insert object2 in (2, 3)*/
   SendMessageA(hwnd, EM_SETSEL, 2, 3);
   INSERT_REOBJECT(reole, &reo2, REO_CP_SELECTION, 2);
   count = IRichEditOle_GetObjectCount(reole);
-  ok(count == 2, "got wrong object count: %d\n", count);
+  ok(count == 2, "got wrong object count: %ld\n", count);
 
   /* insert object3 in (1, 2)*/
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
   INSERT_REOBJECT(reole, &reo3, REO_CP_SELECTION, 3);
   count = IRichEditOle_GetObjectCount(reole);
-  ok(count == 3, "got wrong object count: %d\n", count);
+  ok(count == 3, "got wrong object count: %ld\n", count);
 
   /* tests below show that order of rebject (from 0 to 2) is: reo1,reo3,reo2 */
   CHECK_REOBJECT_STRUCT(reole, 0, REO_GETOBJ_ALL_INTERFACES, 0, NULL, NULL, reo1.polesite, 1);
@@ -3299,32 +3299,32 @@ static void test_InsertObject(void)
   CHECK_REOBJECT_STRUCT(reole, 2, REO_GETOBJ_ALL_INTERFACES, 0, NULL, NULL, reo2.polesite, 2);
 
   hr = IRichEditOle_GetObject(reole, 2, NULL, REO_GETOBJ_ALL_INTERFACES);
-  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08lx\n", hr);
 
   received_reo.cbStruct = 0;
   hr = IRichEditOle_GetObject(reole, 2, &received_reo, REO_GETOBJ_ALL_INTERFACES);
-  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08lx\n", hr);
 
   CHECK_REOBJECT_STRUCT(reole, 2, REO_GETOBJ_PSTG, 0, NULL, NULL, NULL, 2);
   CHECK_REOBJECT_STRUCT(reole, 2, REO_GETOBJ_POLESITE, 0, NULL, NULL, reo2.polesite, 2);
 
   hr = IRichEditOle_GetObject(reole, 3, &received_reo, REO_GETOBJ_POLESITE);
-  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08lx\n", hr);
 
   hr = IRichEditOle_GetObject(reole, 4, &received_reo, REO_GETOBJ_POLESITE);
-  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08lx\n", hr);
 
   hr = IRichEditOle_GetObject(reole, 1024, &received_reo, REO_GETOBJ_POLESITE);
-  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08lx\n", hr);
 
   hr = IRichEditOle_GetObject(reole, -10, &received_reo, REO_GETOBJ_POLESITE);
-  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08lx\n", hr);
 
   /* received_reo will be zeroed before be used */
   received_reo.cbStruct = sizeof(received_reo);
   received_reo.polesite = (IOleClientSite *)0xdeadbeef;
   hr = IRichEditOle_GetObject(reole, 2, &received_reo, REO_GETOBJ_NO_INTERFACES);
-  ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08x\n", hr);
+  ok(hr == S_OK, "IRichEditOle_GetObject failed: 0x%08lx\n", hr);
   ok(received_reo.polesite == NULL, "Got wrong site interface.\n");
 
   CHECK_REOBJECT_STRUCT(reole, REO_IOB_USE_CP, REO_GETOBJ_ALL_INTERFACES, 0, NULL, NULL, reo1.polesite, 1);
@@ -3336,9 +3336,9 @@ static void test_InsertObject(void)
   received_reo.dwUser = 4;
   received_reo.cp = 4;
   hr = IRichEditOle_GetObject(reole, REO_IOB_USE_CP, &received_reo, REO_GETOBJ_ALL_INTERFACES);
-  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08lx\n", hr);
   ok(received_reo.polesite == (IOleClientSite *)0xdeadbeef, "Got wrong site interface.\n");
-  ok(received_reo.dwUser == 4, "Got wrong user-defined value: %d.\n", received_reo.dwUser);
+  ok(received_reo.dwUser == 4, "Got wrong user-defined value: %ld.\n", received_reo.dwUser);
 
   SendMessageA(hwnd, EM_SETSEL, 0, 1);
   CHECK_REOBJECT_STRUCT(reole, REO_IOB_SELECTION, REO_GETOBJ_ALL_INTERFACES, 0, NULL, NULL, reo1.polesite, 1);
@@ -3365,7 +3365,7 @@ static void test_InsertObject(void)
   received_reo.cbStruct = sizeof(received_reo);
   received_reo.cp = 0;
   hr = IRichEditOle_GetObject(reole, REO_IOB_SELECTION, &received_reo, REO_GETOBJ_ALL_INTERFACES);
-  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "IRichEditOle_GetObject should fail: 0x%08lx\n", hr);
 
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
 
@@ -3375,16 +3375,16 @@ static void test_InsertObject(void)
 
   SendMessageW(hwnd, EM_SETSEL, 2, 3);
   result = SendMessageW(hwnd, EM_SELECTIONTYPE, 0, 0);
-  ok(result == SEL_TEXT, "Got selection type: %x.\n", result);
+  ok(result == SEL_TEXT, "Got selection type: %lx.\n", result);
 
   SendMessageW(hwnd, EM_SETSEL, 3, 4);
   result = SendMessageW(hwnd, EM_SELECTIONTYPE, 0, 0);
-  ok(result == SEL_OBJECT, "Got selection type: %x.\n", result);
+  ok(result == SEL_OBJECT, "Got selection type: %lx.\n", result);
   CHECK_REOBJECT_STRUCT(reole, REO_IOB_SELECTION, REO_GETOBJ_ALL_INTERFACES, 1, NULL, NULL, reo1.polesite, 1);
 
   SendMessageW(hwnd, EM_SETSEL, 2, 4);
   result = SendMessageW(hwnd, EM_SELECTIONTYPE, 0, 0);
-  ok(result == (SEL_TEXT | SEL_OBJECT), "Got selection type: %x.\n", result);
+  ok(result == (SEL_TEXT | SEL_OBJECT), "Got selection type: %lx.\n", result);
 
   SendMessageW(hwnd, EM_SETSEL, 5, 6);
   CHECK_REOBJECT_STRUCT(reole, REO_IOB_SELECTION, REO_GETOBJ_ALL_INTERFACES, 1, NULL, NULL, reo2.polesite, 2);
@@ -3396,40 +3396,40 @@ static void test_InsertObject(void)
   gettextex.lpDefaultChar = NULL;
   gettextex.lpUsedDefChar = NULL;
   result = SendMessageW(hwnd, EM_GETTEXTEX, (WPARAM)&gettextex, (LPARAM)buffer);
-  ok(result == lstrlenW(expected_string), "Got wrong length: %d.\n", result);
+  ok(result == lstrlenW(expected_string), "Got wrong length: %ld.\n", result);
   todo_wine ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));
 
   gettextex.flags = GT_RAWTEXT;
   memset(buffer, 0, sizeof(buffer));
   result = SendMessageW(hwnd, EM_GETTEXTEX, (WPARAM)&gettextex, (LPARAM)buffer);
-  ok(result == lstrlenW(expected_string), "Got wrong length: %d.\n", result);
+  ok(result == lstrlenW(expected_string), "Got wrong length: %ld.\n", result);
   todo_wine ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));
 
   gettextex.flags = GT_NOHIDDENTEXT;
   memset(buffer, 0, sizeof(buffer));
   result = SendMessageW(hwnd, EM_GETTEXTEX, (WPARAM)&gettextex, (LPARAM)buffer);
-  ok(result == lstrlenW(expected_string), "Got wrong length: %d.\n", result);
+  ok(result == lstrlenW(expected_string), "Got wrong length: %ld.\n", result);
   todo_wine ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));
 
   gettextex.flags = GT_SELECTION;
   memset(buffer, 0, sizeof(buffer));
   SendMessageW(hwnd, EM_SETSEL, 0, -1);
   result = SendMessageW(hwnd, EM_GETTEXTEX, (WPARAM)&gettextex, (LPARAM)buffer);
-  ok(result == lstrlenW(expected_string), "Got wrong length: %d.\n", result);
+  ok(result == lstrlenW(expected_string), "Got wrong length: %ld.\n", result);
   todo_wine ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));
 
   expected_string = L"abc d efg";
   gettextex.flags = GT_USECRLF;
   memset(buffer, 0, sizeof(buffer));
   result = SendMessageW(hwnd, EM_GETTEXTEX, (WPARAM)&gettextex, (LPARAM)buffer);
-  ok(result == lstrlenW(expected_string), "Got wrong length: %d.\n", result);
+  ok(result == lstrlenW(expected_string), "Got wrong length: %ld.\n", result);
   ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));
 
   expected_stringA = "abc d efg";
   memset(bufferA, 0, sizeof(bufferA));
   SendMessageA(hwnd, EM_SETSEL, 0, -1);
   result = SendMessageA(hwnd, EM_GETSELTEXT, (WPARAM)sizeof(bufferA), (LPARAM)bufferA);
-  ok(result == strlen(expected_stringA), "Got wrong length: %d.\n", result);
+  ok(result == strlen(expected_stringA), "Got wrong length: %ld.\n", result);
   ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
 
   memset(bufferA, 0, sizeof(bufferA));
@@ -3437,39 +3437,39 @@ static void test_InsertObject(void)
   textrange.chrg.cpMin = 0;
   textrange.chrg.cpMax = 11;
   result = SendMessageA(hwnd, EM_GETTEXTRANGE, 0, (LPARAM)&textrange);
-  ok(result == strlen(expected_stringA), "Got wrong length: %d.\n", result);
+  ok(result == strlen(expected_stringA), "Got wrong length: %ld.\n", result);
   ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
 
   expected_string = L"abc\xfffc""d\xfffc""efg\r";
   hr = ITextDocument_Range(doc, 0, 11, &range);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   hr = ITextRange_GetText(range, &bstr);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   ok(lstrlenW(bstr) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(bstr));
   todo_wine ok(!lstrcmpW(bstr, expected_string), "Got text: %s.\n", wine_dbgstr_w(bstr));
   SysFreeString(bstr);
   hr = ITextRange_SetRange(range, 3, 4);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   hr = ITextRange_GetChar(range, &result);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
-  todo_wine ok(result == 0xfffc, "Got char: %c\n", result);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
+  todo_wine ok(result == 0xfffc, "Got char: %lc\n", (WCHAR)result);
   ITextRange_Release(range);
 
   SendMessageW(hwnd, EM_SETSEL, 0, -1);
   hr = ITextSelection_GetText(selection, &bstr);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   ok(lstrlenW(bstr) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(bstr));
   todo_wine ok(!lstrcmpW(bstr, expected_string), "Got text: %s.\n", wine_dbgstr_w(bstr));
   SysFreeString(bstr);
   SendMessageW(hwnd, EM_SETSEL, 3, 4);
   result = 0;
   hr = ITextSelection_GetChar(selection, &result);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
-  todo_wine ok(result == 0xfffc, "Got char: %c\n", result);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
+  todo_wine ok(result == 0xfffc, "Got char: %lc\n", (WCHAR)result);
 
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"");
   result = SendMessageW(hwnd, EM_SETTEXTMODE, (WPARAM)TM_PLAINTEXT, 0);
-  ok(!result, "Got result %x.\n", result);
+  ok(!result, "Got result %lx.\n", result);
   /* "abc|d|efg" */
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
   INSERT_REOBJECT(reole, &reo1, 3, 1);
@@ -3479,14 +3479,14 @@ static void test_InsertObject(void)
   charrange.cpMin = 0;
   charrange.cpMax = 11;
   hr = IRichEditOle_GetClipboardData(reole, &charrange, 1, &dataobject);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   formatetc.cfFormat = CF_UNICODETEXT;
   formatetc.dwAspect = DVASPECT_CONTENT;
   formatetc.ptd = NULL;
   formatetc.tymed = TYMED_HGLOBAL;
   formatetc.lindex = -1;
   hr = IDataObject_GetData(dataobject, &formatetc, &stgmedium);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   string = GlobalLock(stgmedium.hGlobal);
   ok(lstrlenW(string) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(string));
   ok(!lstrcmpW(string, expected_string), "Got wrong content: %s.\n", debugstr_w(string));
@@ -3499,20 +3499,20 @@ static void test_InsertObject(void)
   gettextex.lpDefaultChar = NULL;
   gettextex.lpUsedDefChar = NULL;
   result = SendMessageW(hwnd, EM_GETTEXTEX, (WPARAM)&gettextex, (LPARAM)buffer);
-  ok(result == lstrlenW(expected_string), "Got wrong length: %d.\n", result);
+  ok(result == lstrlenW(expected_string), "Got wrong length: %ld.\n", result);
   todo_wine ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));
 
   gettextex.flags = GT_RAWTEXT;
   memset(buffer, 0, sizeof(buffer));
   result = SendMessageW(hwnd, EM_GETTEXTEX, (WPARAM)&gettextex, (LPARAM)buffer);
-  ok(result == lstrlenW(expected_string), "Got wrong length: %d.\n", result);
+  ok(result == lstrlenW(expected_string), "Got wrong length: %ld.\n", result);
   todo_wine ok(!lstrcmpW(buffer, expected_string), "Got wrong content: %s.\n", debugstr_w(buffer));
 
   expected_stringA = "abc d efg";
   memset(bufferA, 0, sizeof(bufferA));
   SendMessageA(hwnd, EM_SETSEL, 0, -1);
   result = SendMessageA(hwnd, EM_GETSELTEXT, (WPARAM)sizeof(bufferA), (LPARAM)bufferA);
-  ok(result == strlen(expected_stringA), "Got wrong length: %d.\n", result);
+  ok(result == strlen(expected_stringA), "Got wrong length: %ld.\n", result);
   ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
 
   memset(bufferA, 0, sizeof(bufferA));
@@ -3520,35 +3520,35 @@ static void test_InsertObject(void)
   textrange.chrg.cpMin = 0;
   textrange.chrg.cpMax = 11;
   result = SendMessageA(hwnd, EM_GETTEXTRANGE, 0, (LPARAM)&textrange);
-  ok(result == strlen(expected_stringA), "Got wrong length: %d.\n", result);
+  ok(result == strlen(expected_stringA), "Got wrong length: %ld.\n", result);
   ok(!strcmp(bufferA, expected_stringA), "Got wrong content: %s.\n", bufferA);
 
   expected_string = L"abc\xfffc""d\xfffc""efg";
   hr = ITextDocument_Range(doc, 0, 11, &range);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   hr = ITextRange_GetText(range, &bstr);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   todo_wine ok(lstrlenW(bstr) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(bstr));
   todo_wine ok(!lstrcmpW(bstr, expected_string), "Got text: %s.\n", wine_dbgstr_w(bstr));
   SysFreeString(bstr);
   hr = ITextRange_SetRange(range, 3, 4);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   hr = ITextRange_GetChar(range, &result);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
-  todo_wine ok(result == 0xfffc, "Got char: %c\n", result);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
+  todo_wine ok(result == 0xfffc, "Got char: %lc\n", (WCHAR)result);
   ITextRange_Release(range);
 
   SendMessageW(hwnd, EM_SETSEL, 0, -1);
   hr = ITextSelection_GetText(selection, &bstr);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
   todo_wine ok(lstrlenW(bstr) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(bstr));
   todo_wine ok(!lstrcmpW(bstr, expected_string), "Got text: %s.\n", wine_dbgstr_w(bstr));
   SysFreeString(bstr);
   SendMessageW(hwnd, EM_SETSEL, 3, 4);
   result = 0;
   hr = ITextSelection_GetChar(selection, &result);
-  ok(hr == S_OK, "Got hr %#x.\n", hr);
-  todo_wine ok(result == 0xfffc, "Got char: %c\n", result);
+  ok(hr == S_OK, "Got hr %#lx.\n", hr);
+  todo_wine ok(result == 0xfffc, "Got char: %lc\n", (WCHAR)result);
 
   release_interfaces(&hwnd, &reole, &doc, &selection);
 }
@@ -3569,53 +3569,53 @@ static void test_GetStoryLength(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetStoryLength(range, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   value = 0;
   hr = ITextRange_GetStoryLength(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 13, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 13, "got %ld\n", value);
 
   hr = ITextSelection_GetStoryLength(selection, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   value = 0;
   hr = ITextSelection_GetStoryLength(selection, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 13, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 13, "got %ld\n", value);
 
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"");
 
   value = 0;
   hr = ITextRange_GetStoryLength(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 1, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 1, "got %ld\n", value);
 
   value = 0;
   hr = ITextSelection_GetStoryLength(selection, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 1, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 1, "got %ld\n", value);
 
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextRange_GetStoryLength(range, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = 100;
   hr = ITextRange_GetStoryLength(range, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == 100, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == 100, "got %ld\n", value);
 
   hr = ITextSelection_GetStoryLength(selection, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   value = 100;
   hr = ITextSelection_GetStoryLength(selection, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
-  ok(value == 100, "got %d\n", value);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
+  ok(value == 100, "got %ld\n", value);
 
   ITextSelection_Release(selection);
   ITextRange_Release(range);
@@ -3638,15 +3638,15 @@ static void test_ITextSelection_GetDuplicate(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextSelection_GetDuplicate(selection, NULL);
-  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+  ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
   EXPECT_REF(selection, 2);
 
   hr = ITextSelection_GetDuplicate(selection, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_GetDuplicate(selection, &range2);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   ok(range != range2, "got %p, %p\n", range, range2);
 
   EXPECT_REF(selection, 2);
@@ -3657,39 +3657,39 @@ static void test_ITextSelection_GetDuplicate(void)
 
   value = 0;
   hr = ITextRange_GetStart(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 1, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 1, "got %ld\n", value);
 
   value = 0;
   hr = ITextRange_GetEnd(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 2, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 2, "got %ld\n", value);
 
   SendMessageA(hwnd, EM_SETSEL, 2, 3);
 
   value = 0;
   hr = ITextRange_GetStart(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 1, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 1, "got %ld\n", value);
 
   value = 0;
   hr = ITextRange_GetEnd(range, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 2, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 2, "got %ld\n", value);
 
   hr = ITextRange_QueryInterface(range, &IID_ITextSelection, (void**)&sel2);
-  ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
+  ok(hr == E_NOINTERFACE, "got 0x%08lx\n", hr);
 
   release_interfaces(&hwnd, &reOle, &doc, NULL);
 
   hr = ITextSelection_GetDuplicate(selection, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_GetDuplicate(selection, &range);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextRange_GetFont(range, &font);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   ITextSelection_Release(selection);
   ITextRange_Release(range);
@@ -3702,9 +3702,9 @@ static void _reset_range(ITextRange *range, LONG start, LONG end, int line)
   HRESULT hr;
 
   hr = ITextRange_SetStart(range, start);
-  ok_(__FILE__,line)(hr == S_OK, "SetStart failed: 0x%08x\n", hr);
+  ok_(__FILE__,line)(hr == S_OK, "SetStart failed: 0x%08lx\n", hr);
   hr = ITextRange_SetEnd(range, end);
-  ok_(__FILE__,line)(hr == S_OK, "SetEnd failed: 0x%08x\n", hr);
+  ok_(__FILE__,line)(hr == S_OK, "SetEnd failed: 0x%08lx\n", hr);
 }
 
 #define CHECK_RANGE(range,expected_start,expected_end) \
@@ -3715,12 +3715,12 @@ static void _check_range(ITextRange* range, LONG expected_start, LONG expected_e
   LONG value;
 
   hr = ITextRange_GetStart(range, &value);
-  ok_(__FILE__,line)(hr == S_OK, "GetStart failed: 0x%08x\n", hr);
-  ok_(__FILE__,line)(value == expected_start, "Expected start %d got %d\n",
+  ok_(__FILE__,line)(hr == S_OK, "GetStart failed: 0x%08lx\n", hr);
+  ok_(__FILE__,line)(value == expected_start, "Expected start %ld got %ld\n",
                      expected_start, value);
   hr = ITextRange_GetEnd(range, &value);
-  ok_(__FILE__,line)(hr == S_OK, "GetEnd failed: 0x%08x\n", hr);
-  ok_(__FILE__,line)(value == expected_end, "Expected end %d got %d\n",
+  ok_(__FILE__,line)(hr == S_OK, "GetEnd failed: 0x%08lx\n", hr);
+  ok_(__FILE__,line)(value == expected_end, "Expected end %ld got %ld\n",
                      expected_end, value);
 }
 
@@ -3731,9 +3731,9 @@ static void _reset_selection(ITextSelection *selection, LONG start, LONG end, in
   HRESULT hr;
 
   hr = ITextSelection_SetStart(selection, start);
-  ok_(__FILE__,line)(hr == S_OK, "SetStart failed: 0x%08x\n", hr);
+  ok_(__FILE__,line)(hr == S_OK, "SetStart failed: 0x%08lx\n", hr);
   hr = ITextSelection_SetEnd(selection, end);
-  ok_(__FILE__,line)(hr == S_OK, "SetEnd failed: 0x%08x\n", hr);
+  ok_(__FILE__,line)(hr == S_OK, "SetEnd failed: 0x%08lx\n", hr);
 }
 
 #define CHECK_SELECTION(selection,expected_start,expected_end) \
@@ -3744,12 +3744,12 @@ static void _check_selection(ITextSelection *selection, LONG expected_start, LON
   LONG value;
 
   hr = ITextSelection_GetStart(selection, &value);
-  ok_(__FILE__,line)(hr == S_OK, "GetStart failed: 0x%08x\n", hr);
-  ok_(__FILE__,line)(value == expected_start, "Expected start %d got %d\n",
+  ok_(__FILE__,line)(hr == S_OK, "GetStart failed: 0x%08lx\n", hr);
+  ok_(__FILE__,line)(value == expected_start, "Expected start %ld got %ld\n",
                      expected_start, value);
   hr = ITextSelection_GetEnd(selection, &value);
-  ok_(__FILE__,line)(hr == S_OK, "GetEnd failed: 0x%08x\n", hr);
-  ok_(__FILE__,line)(value == expected_end, "Expected end %d got %d\n",
+  ok_(__FILE__,line)(hr == S_OK, "GetEnd failed: 0x%08lx\n", hr);
+  ok_(__FILE__,line)(value == expected_end, "Expected end %ld got %ld\n",
                      expected_end, value);
 }
 
@@ -3767,31 +3767,31 @@ static void test_ITextRange_SetRange(void)
   ITextDocument_Range(txtDoc, 0, 0, &txtRge);
 
   hr = ITextRange_SetRange(txtRge, 2, 4);
-  ok(hr == S_OK, "got 0x%08x.\n", hr);
+  ok(hr == S_OK, "got 0x%08lx.\n", hr);
   CHECK_RANGE(txtRge, 2, 4);
 
   hr = ITextRange_SetRange(txtRge, 2, 4);
-  ok(hr == S_FALSE, "got 0x%08x.\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx.\n", hr);
   CHECK_RANGE(txtRge, 2, 4);
 
   hr = ITextRange_SetRange(txtRge, 4, 2);
-  ok(hr == S_FALSE, "got 0x%08x.\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx.\n", hr);
   CHECK_RANGE(txtRge, 2, 4);
 
   hr = ITextRange_SetRange(txtRge, 14, 14);
-  ok(hr == S_OK, "got 0x%08x.\n", hr);
+  ok(hr == S_OK, "got 0x%08lx.\n", hr);
   CHECK_RANGE(txtRge, 12, 12);
 
   hr = ITextRange_SetRange(txtRge, 15, 15);
-  ok(hr == S_FALSE, "got 0x%08x.\n", hr);
+  ok(hr == S_FALSE, "got 0x%08lx.\n", hr);
   CHECK_RANGE(txtRge, 12, 12);
 
   hr = ITextRange_SetRange(txtRge, 14, 1);
-  ok(hr == S_OK, "got 0x%08x.\n", hr);
+  ok(hr == S_OK, "got 0x%08lx.\n", hr);
   CHECK_RANGE(txtRge, 1, 13);
 
   hr = ITextRange_SetRange(txtRge, -1, 4);
-  ok(hr == S_OK, "got 0x%08x.\n", hr);
+  ok(hr == S_OK, "got 0x%08lx.\n", hr);
   CHECK_RANGE(txtRge, 0, 4);
 
   ITextRange_Release(txtRge);
@@ -3814,14 +3814,14 @@ static void test_Expand(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextDocument_Range(doc, 0, 4, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_Expand(range, tomStory, NULL);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   CHECK_RANGE(range, 0, 13);
 
   hr = ITextSelection_Expand(selection, tomStory, NULL);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
   CHECK_SELECTION(selection, 0, 13);
 
   RESET_RANGE(range, 1, 2);
@@ -3829,29 +3829,29 @@ static void test_Expand(void)
 
   value = 0;
   hr = ITextRange_Expand(range, tomStory, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 12, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 12, "got %ld\n", value);
   CHECK_RANGE(range, 0, 13);
 
   value = 0;
   hr = ITextSelection_Expand(selection, tomStory, &value);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(value == 12, "got %d\n", value);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(value == 12, "got %ld\n", value);
   CHECK_SELECTION(selection, 0, 13);
 
   release_interfaces(&hwnd, &reole, &doc, NULL);
 
   hr = ITextRange_Expand(range, tomStory, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextRange_Expand(range, tomStory, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_Expand(selection, tomStory, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_Expand(selection, tomStory, &value);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   ITextSelection_Release(selection);
   ITextRange_Release(range);
@@ -3873,99 +3873,99 @@ static void test_MoveEnd_story(void)
   SendMessageA(hwnd, EM_SETSEL, 1, 2);
 
   hr = ITextDocument_Range(doc, 1, 2, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   hr = ITextRange_MoveEnd(range, tomStory, 0, &delta);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(delta == 0, "got %d\n", delta);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(delta == 0, "got %ld\n", delta);
   CHECK_RANGE(range, 1, 2);
 
   hr = ITextRange_MoveEnd(range, tomStory, -1, &delta);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(delta == -1, "got %d\n", delta);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(delta == -1, "got %ld\n", delta);
   CHECK_RANGE(range, 0, 0);
 
   hr = ITextRange_MoveEnd(range, tomStory, 1, &delta);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(delta == 1, "got %d\n", delta);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(delta == 1, "got %ld\n", delta);
   CHECK_RANGE(range, 0, 12);
 
   hr = ITextRange_MoveEnd(range, tomStory, 1, &delta);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(delta == 0, "got %d\n", delta);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(delta == 0, "got %ld\n", delta);
   CHECK_RANGE(range, 0, 12);
 
   RESET_RANGE(range, 1, 2);
 
   hr = ITextRange_MoveEnd(range, tomStory, 3, &delta);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(delta == 1, "got %d\n", delta);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(delta == 1, "got %ld\n", delta);
   CHECK_RANGE(range, 1, 12);
 
   RESET_RANGE(range, 2, 3);
 
   hr = ITextRange_MoveEnd(range, tomStory, -3, &delta);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(delta == -1, "got %d\n", delta);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(delta == -1, "got %ld\n", delta);
   CHECK_RANGE(range, 0, 0);
 
   hr = ITextRange_MoveEnd(range, tomStory, -1, &delta);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(delta == 0, "got %d\n", delta);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(delta == 0, "got %ld\n", delta);
   CHECK_RANGE(range, 0, 0);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, 0, &delta);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(delta == 0, "got %d\n", delta);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(delta == 0, "got %ld\n", delta);
   CHECK_SELECTION(selection, 1, 2);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, -1, &delta);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(delta == -1, "got %d\n", delta);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(delta == -1, "got %ld\n", delta);
   CHECK_SELECTION(selection, 0, 0);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, 1, &delta);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(delta == 1, "got %d\n", delta);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(delta == 1, "got %ld\n", delta);
   CHECK_SELECTION(selection, 0, 12);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, 1, &delta);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(delta == 0, "got %d\n", delta);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(delta == 0, "got %ld\n", delta);
   CHECK_SELECTION(selection, 0, 12);
 
   RESET_SELECTION(selection, 1, 2);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, 3, &delta);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(delta == 1, "got %d\n", delta);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(delta == 1, "got %ld\n", delta);
   CHECK_SELECTION(selection, 1, 12);
 
   RESET_SELECTION(selection, 2, 3);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, -3, &delta);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
-  ok(delta == -1, "got %d\n", delta);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
+  ok(delta == -1, "got %ld\n", delta);
   CHECK_SELECTION(selection, 0, 0);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, -1, &delta);
-  ok(hr == S_FALSE, "got 0x%08x\n", hr);
-  ok(delta == 0, "got %d\n", delta);
+  ok(hr == S_FALSE, "got 0x%08lx\n", hr);
+  ok(delta == 0, "got %ld\n", delta);
   CHECK_SELECTION(selection, 0, 0);
 
   release_interfaces(&hwnd, &reole, &doc, NULL);
 
   hr = ITextRange_MoveEnd(range, tomStory, 1, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextRange_MoveEnd(range, tomStory, 1, &delta);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, 1, NULL);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   hr = ITextSelection_MoveEnd(selection, tomStory, 1, &delta);
-  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(hr == CO_E_RELEASED, "got 0x%08lx\n", hr);
 
   ITextSelection_Release(selection);
   ITextRange_Release(range);
@@ -3984,15 +3984,15 @@ static void test_character_movestart(ITextRange *range, int textlen, int i, int
         expected_start = textlen;
     expected_delta = expected_start - i;
     hr = ITextRange_SetRange(range, i, j);
-    ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
+    ok(SUCCEEDED(hr), "got 0x%08lx\n", hr);
     hr = ITextRange_MoveStart(range, tomCharacter, target - i, &delta);
     if (expected_start == i) {
-        ok(hr == S_FALSE, "(%d,%d) move by %d got hr=0x%08x\n", i, j, target - i, hr);
-        ok(delta == 0, "(%d,%d) move by %d got delta %d\n", i, j, target - i, delta);
+        ok(hr == S_FALSE, "(%d,%d) move by %ld got hr=0x%08lx\n", i, j, target - i, hr);
+        ok(delta == 0, "(%d,%d) move by %ld got delta %ld\n", i, j, target - i, delta);
         CHECK_RANGE(range, i, j);
     } else {
-        ok(hr == S_OK, "(%d,%d) move by %d got hr=0x%08x\n", i, j, target - i, hr);
-        ok(delta == expected_delta, "(%d,%d) move by %d got delta %d\n", i, j, target - i, delta);
+        ok(hr == S_OK, "(%d,%d) move by %ld got hr=0x%08lx\n", i, j, target - i, hr);
+        ok(delta == expected_delta, "(%d,%d) move by %ld got delta %ld\n", i, j, target - i, delta);
         if (expected_start <= j)
             CHECK_RANGE(range, expected_start, j);
         else
@@ -4013,15 +4013,15 @@ static void test_character_moveend(ITextRange *range, int textlen, int i, int j,
         expected_end = textlen + 1;
     expected_delta = expected_end - j;
     hr = ITextRange_SetRange(range, i, j);
-    ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
+    ok(SUCCEEDED(hr), "got 0x%08lx\n", hr);
     hr = ITextRange_MoveEnd(range, tomCharacter, target - j, &delta);
     if (expected_end == j) {
-        ok(hr == S_FALSE, "(%d,%d) move by %d got hr=0x%08x\n", i, j, target - j, hr);
-        ok(delta == 0, "(%d,%d) move by %d got delta %d\n", i, j, target - j, delta);
+        ok(hr == S_FALSE, "(%d,%d) move by %ld got hr=0x%08lx\n", i, j, target - j, hr);
+        ok(delta == 0, "(%d,%d) move by %ld got delta %ld\n", i, j, target - j, delta);
         CHECK_RANGE(range, i, j);
     } else {
-        ok(hr == S_OK, "(%d,%d) move by %d got hr=0x%08x\n", i, j, target - j, hr);
-        ok(delta == expected_delta, "(%d,%d) move by %d got delta %d\n", i, j, target - j, delta);
+        ok(hr == S_OK, "(%d,%d) move by %ld got hr=0x%08lx\n", i, j, target - j, hr);
+        ok(delta == expected_delta, "(%d,%d) move by %ld got delta %ld\n", i, j, target - j, delta);
         if (i <= expected_end)
             CHECK_RANGE(range, i, expected_end);
         else
@@ -4062,15 +4062,15 @@ static void test_character_move(ITextRange *range, int textlen, int i, int j, LO
     }
 
     hr = ITextRange_SetRange(range, i, j);
-    ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
+    ok(SUCCEEDED(hr), "got 0x%08lx\n", hr);
     hr = ITextRange_Move(range, tomCharacter, move_by, &delta);
     if (expected_delta == 0) {
-        ok(hr == S_FALSE, "(%d,%d) move by %d got hr=0x%08x\n", i, j, move_by, hr);
-        ok(delta == 0, "(%d,%d) move by %d got delta %d\n", i, j, move_by, delta);
+        ok(hr == S_FALSE, "(%d,%d) move by %ld got hr=0x%08lx\n", i, j, move_by, hr);
+        ok(delta == 0, "(%d,%d) move by %ld got delta %ld\n", i, j, move_by, delta);
         CHECK_RANGE(range, expected_location, expected_location);
     } else {
-        ok(hr == S_OK, "(%d,%d) move by %d got hr=0x%08x\n", i, j, move_by, hr);
-        ok(delta == expected_delta, "(%d,%d) move by %d got delta %d\n", i, j, move_by, delta);
+        ok(hr == S_OK, "(%d,%d) move by %ld got hr=0x%08lx\n", i, j, move_by, hr);
+        ok(delta == expected_delta, "(%d,%d) move by %ld got delta %ld\n", i, j, move_by, delta);
         CHECK_RANGE(range, expected_location, expected_location);
     }
 }
@@ -4081,22 +4081,22 @@ static void test_character_startof(ITextRange *range, int textlen, int i, int j)
     LONG delta;
 
     hr = ITextRange_SetRange(range, i, j);
-    ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
+    ok(SUCCEEDED(hr), "got 0x%08lx\n", hr);
     hr = ITextRange_StartOf(range, tomCharacter, tomMove, &delta);
     if (i == j) {
-        ok(hr == S_FALSE, "(%d,%d) tomMove got hr=0x%08x\n", i, j, hr);
-        ok(delta == 0, "(%d,%d) tomMove got delta %d\n", i, j, delta);
+        ok(hr == S_FALSE, "(%d,%d) tomMove got hr=0x%08lx\n", i, j, hr);
+        ok(delta == 0, "(%d,%d) tomMove got delta %ld\n", i, j, delta);
     } else {
-        ok(hr == S_OK, "(%d,%d) tomMove got hr=0x%08x\n", i, j, hr);
-        ok(delta == -1, "(%d,%d) tomMove got delta %d\n", i, j, delta);
+        ok(hr == S_OK, "(%d,%d) tomMove got hr=0x%08lx\n", i, j, hr);
+        ok(delta == -1, "(%d,%d) tomMove got delta %ld\n", i, j, delta);
     }
     CHECK_RANGE(range, i, i);
 
     hr = ITextRange_SetRange(range, i, j);
-    ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
+    ok(SUCCEEDED(hr), "got 0x%08lx\n", hr);
     hr = ITextRange_StartOf(range, tomCharacter, tomExtend, &delta);
-    ok(hr == S_FALSE, "(%d,%d) tomExtend got hr=0x%08x\n", i, j, hr);
-    ok(delta == 0, "(%d,%d) tomExtend got delta %d\n", i, j, delta);
+    ok(hr == S_FALSE, "(%d,%d) tomExtend got hr=0x%08lx\n", i, j, hr);
+    ok(delta == 0, "(%d,%d) tomExtend got delta %ld\n", i, j, delta);
     CHECK_RANGE(range, i, j);
 }
 
@@ -4107,7 +4107,7 @@ static void test_character_endof(ITextRange *range, int textlen, int i, int j)
     LONG delta;
 
     hr = ITextRange_SetRange(range, i, j);
-    ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
+    ok(SUCCEEDED(hr), "got 0x%08lx\n", hr);
     hr = ITextRange_EndOf(range, tomCharacter, tomMove, &delta);
 
     /* A character "end", apparently cannot be before the very first character */
@@ -4116,23 +4116,23 @@ static void test_character_endof(ITextRange *range, int textlen, int i, int j)
         ++end;
 
     if (i == end) {
-        ok(hr == S_FALSE, "(%d,%d) tomMove got hr=0x%08x\n", i, j, hr);
-        ok(delta == 0, "(%d,%d) tomMove got delta %d\n", i, j, delta);
+        ok(hr == S_FALSE, "(%d,%d) tomMove got hr=0x%08lx\n", i, j, hr);
+        ok(delta == 0, "(%d,%d) tomMove got delta %ld\n", i, j, delta);
     } else {
-        ok(hr == S_OK, "(%d,%d) tomMove got hr=0x%08x\n", i, j, hr);
-        ok(delta == 1, "(%d,%d) tomMove got delta %d\n", i, j, delta);
+        ok(hr == S_OK, "(%d,%d) tomMove got hr=0x%08lx\n", i, j, hr);
+        ok(delta == 1, "(%d,%d) tomMove got delta %ld\n", i, j, delta);
     }
     CHECK_RANGE(range, end, end);
 
     hr = ITextRange_SetRange(range, i, j);
-    ok(SUCCEEDED(hr), "got 0x%08x\n", hr);
+    ok(SUCCEEDED(hr), "got 0x%08lx\n", hr);
     hr = ITextRange_EndOf(range, tomCharacter, tomExtend, &delta);
     if (0 < j) {
-        ok(hr == S_FALSE, "(%d,%d) tomExtend got hr=0x%08x\n", i, j, hr);
-        ok(delta == 0, "(%d,%d) tomExtend got delta %d\n", i, j, delta);
+        ok(hr == S_FALSE, "(%d,%d) tomExtend got hr=0x%08lx\n", i, j, hr);
+        ok(delta == 0, "(%d,%d) tomExtend got delta %ld\n", i, j, delta);
     } else {
-        ok(hr == S_OK, "(%d,%d) tomExtend got hr=0x%08x\n", i, j, hr);
-        ok(delta == 1, "(%d,%d) tomExtend got delta %d\n", i, j, delta);
+        ok(hr == S_OK, "(%d,%d) tomExtend got hr=0x%08lx\n", i, j, hr);
+        ok(delta == 1, "(%d,%d) tomExtend got delta %ld\n", i, j, delta);
     }
     CHECK_RANGE(range, i, end);
 }
@@ -4153,7 +4153,7 @@ static void test_character_movement(void)
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
 
   hr = ITextDocument_Range(doc, 0, 0, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   /* Exhaustive test of every possible combination of (start,end) locations,
    * against every possible target location to move to. */
@@ -4185,12 +4185,12 @@ static void _clipboard_range_contains(ITextRange *range, LONG start, LONG end, c
   const char *clipboard_text;
 
   hr = ITextRange_SetRange(range, start, end);
-  ok_(__FILE__,line)(SUCCEEDED(hr), "SetRange failed: 0x%08x\n", hr);
+  ok_(__FILE__,line)(SUCCEEDED(hr), "SetRange failed: 0x%08lx\n", hr);
   hr = ITextRange_Copy(range, NULL);
-  ok_(__FILE__,line)(hr == S_OK, "Copy failed: 0x%08x\n", hr);
+  ok_(__FILE__,line)(hr == S_OK, "Copy failed: 0x%08lx\n", hr);
 
   clipboard_open = OpenClipboard(NULL);
-  ok_(__FILE__,line)(clipboard_open, "OpenClipboard failed: %d\n", GetLastError());
+  ok_(__FILE__,line)(clipboard_open, "OpenClipboard failed: %ld\n", GetLastError());
   global = GetClipboardData(CF_TEXT);
   ok_(__FILE__,line)(global != NULL, "GetClipboardData failed: %p\n", global);
   clipboard_text = GlobalLock(global);
@@ -4214,7 +4214,7 @@ static void test_clipboard(void)
   SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)text_in);
 
   hr = ITextDocument_Range(doc, 0, 0, &range);
-  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(hr == S_OK, "got 0x%08lx\n", hr);
 
   CLIPBOARD_RANGE_CONTAINS(range, 0, 5, "ab\r\n c")
   CLIPBOARD_RANGE_CONTAINS(range, 0, 0, "ab\r\n c")
@@ -4228,20 +4228,20 @@ static void test_clipboard(void)
 
   /* Cut can be undone */
   hr = ITextRange_SetRange(range, 0, 1);
-  ok(SUCCEEDED(hr), "SetRange failed: 0x%08x\n", hr);
+  ok(SUCCEEDED(hr), "SetRange failed: 0x%08lx\n", hr);
   hr = ITextRange_Cut(range, NULL);
-  ok(hr == S_OK, "Cut failed: 0x%08x\n", hr);
+  ok(hr == S_OK, "Cut failed: 0x%08lx\n", hr);
   CLIPBOARD_RANGE_CONTAINS(range, 0, 4, "b\r\n c");
   hr = ITextDocument_Undo(doc, 1, NULL);
-  todo_wine ok(hr == S_OK, "Undo failed: 0x%08x\n", hr);
+  todo_wine ok(hr == S_OK, "Undo failed: 0x%08lx\n", hr);
   TODO_CLIPBOARD_RANGE_CONTAINS(range, 0, 5, "ab\r\n c");
 
   /* Cannot cut when read-only */
   SendMessageA(hwnd, EM_SETREADONLY, TRUE, 0);
   hr = ITextRange_SetRange(range, 0, 1);
-  ok(SUCCEEDED(hr), "SetRange failed: 0x%08x\n", hr);
+  ok(SUCCEEDED(hr), "SetRange failed: 0x%08lx\n", hr);
   hr = ITextRange_Cut(range, NULL);
-  ok(hr == E_ACCESSDENIED, "got 0x%08x\n", hr);
+  ok(hr == E_ACCESSDENIED, "got 0x%08lx\n", hr);
 
   release_interfaces(&hwnd, &reole, &doc, NULL);
   ITextSelection_Release(selection);
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
index 22082201fbc..16904347919 100644
--- a/dlls/riched20/tests/txtsrv.c
+++ b/dlls/riched20/tests/txtsrv.c
@@ -173,7 +173,7 @@ static BOOL __thiscall ITextHostImpl_TxSetScrollRange(ITextHost *iface, INT fnBa
                                                       INT nMaxPos, BOOL fRedraw)
 {
     ITextHostTestImpl *This = impl_from_ITextHost(iface);
-    TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%d, nMaxPos=%d, fRedraw=%d)\n",
+    TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%ld, nMaxPos=%d, fRedraw=%d)\n",
                This, fnBar, nMinPos, nMaxPos, fRedraw);
     return FALSE;
 }
@@ -289,7 +289,7 @@ static HRESULT __thiscall ITextHostImpl_TxActivate(ITextHost *iface, LONG *plOld
 static HRESULT __thiscall ITextHostImpl_TxDeactivate(ITextHost *iface, LONG lNewState)
 {
     ITextHostTestImpl *This = impl_from_ITextHost(iface);
-    TRACECALL("Call to TxDeactivate(%p, lNewState=%d)\n", This, lNewState);
+    TRACECALL("Call to TxDeactivate(%p, lNewState=%ld)\n", This, lNewState);
     return E_NOTIMPL;
 }
 
@@ -392,7 +392,7 @@ static HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, c
 static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *iface, DWORD dwMask, DWORD *pdwBits)
 {
     ITextHostTestImpl *This = impl_from_ITextHost(iface);
-    TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08x, pdwBits=%p)\n",
+    TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08lx, pdwBits=%p)\n",
               This, dwMask, pdwBits);
     *pdwBits = This->props & dwMask;
     return S_OK;
@@ -403,7 +403,7 @@ static int en_update_sent;
 static HRESULT __thiscall ITextHostImpl_TxNotify( ITextHost *iface, DWORD code, void *data )
 {
     ITextHostTestImpl *This = impl_from_ITextHost(iface);
-    TRACECALL( "Call to TxNotify(%p, code = %#x, data = %p)\n", This, code, data );
+    TRACECALL( "Call to TxNotify(%p, code = %#lx, data = %p)\n", This, code, data );
     switch (code)
     {
     case EN_VSCROLL:
@@ -629,8 +629,8 @@ static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
        CreateTextServices which is then queried to obtain a
        ITextServices object. */
     result = pCreateTextServices(NULL, &dummyTextHost->ITextHost_iface, &init);
-    ok(result == S_OK, "Did not return S_OK when created (result =  %x)\n", result);
-    ok(dummyTextHost->refCount == 1, "host ref %d\n", dummyTextHost->refCount);
+    ok(result == S_OK, "Did not return S_OK when created (result =  %lx)\n", result);
+    ok(dummyTextHost->refCount == 1, "host ref %ld\n", dummyTextHost->refCount);
     if (result != S_OK) {
         CoTaskMemFree(dummyTextHost);
         win_skip("CreateTextServices failed.\n");
@@ -638,7 +638,7 @@ static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
     }
 
     result = IUnknown_QueryInterface(init, pIID_ITextServices, (void**)txtserv);
-    ok((result == S_OK) && (*txtserv != NULL), "Querying interface failed (result = %x, txtserv = %p)\n", result, *txtserv);
+    ok((result == S_OK) && (*txtserv != NULL), "Querying interface failed (result = %lx, txtserv = %p)\n", result, *txtserv);
     IUnknown_Release(init);
     if (!((result == S_OK) && (*txtserv != NULL))) {
         CoTaskMemFree(dummyTextHost);
@@ -682,21 +682,21 @@ static void test_TxGetText(void)
         return;
 
     hres = ITextServices_TxGetText(txtserv, &rettext);
-    ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
+    ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
     SysFreeString(rettext);
 
     hres = ITextServices_TxSetText(txtserv, L"abcdefg");
-    ok(hres == S_OK, "Got hres: %#x.\n", hres);
+    ok(hres == S_OK, "Got hres: %#lx.\n", hres);
     hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&reole);
-    ok(hres == S_OK, "Got hres: %#x.\n", hres);
+    ok(hres == S_OK, "Got hres: %#lx.\n", hres);
     hres = IRichEditOle_GetClientSite(reole, &clientsite);
-    ok(hres == S_OK, "Got hres: %#x.\n", hres);
+    ok(hres == S_OK, "Got hres: %#lx.\n", hres);
     expected_string = L"abc\xfffc""defg";
     fill_reobject_struct(&reobject, 3, NULL, NULL, clientsite, 10, 10, DVASPECT_CONTENT, 0, 1);
     hres = IRichEditOle_InsertObject(reole, &reobject);
-    ok(hres == S_OK, "Got hres: %#x.\n", hres);
+    ok(hres == S_OK, "Got hres: %#lx.\n", hres);
     hres = ITextServices_TxGetText(txtserv, &rettext);
-    ok(hres == S_OK, "Got hres: %#x.\n", hres);
+    ok(hres == S_OK, "Got hres: %#lx.\n", hres);
     ok(lstrlenW(rettext) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(rettext));
     todo_wine ok(!lstrcmpW(rettext, expected_string), "Got wrong content: %s.\n", debugstr_w(rettext));
     SysFreeString(rettext);
@@ -719,10 +719,10 @@ static void test_TxSetText(void)
         return;
 
     hres = ITextServices_TxSetText(txtserv, settext);
-    ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
+    ok(hres == S_OK, "ITextServices_TxSetText failed (result = %lx)\n", hres);
 
     hres = ITextServices_TxGetText(txtserv, &rettext);
-    ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
+    ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
 
     ok(SysStringLen(rettext) == 4,
                  "String returned of wrong length (expected 4, got %d)\n", SysStringLen(rettext));
@@ -734,10 +734,10 @@ static void test_TxSetText(void)
     /* Null-pointer should behave the same as empty-string */
 
     hres = ITextServices_TxSetText(txtserv, 0);
-    ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
+    ok(hres == S_OK, "ITextServices_TxSetText failed (result = %lx)\n", hres);
 
     hres = ITextServices_TxGetText(txtserv, &rettext);
-    ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
+    ok(hres == S_OK, "ITextServices_TxGetText failed (result = %lx)\n", hres);
     ok(SysStringLen(rettext) == 0,
                  "String returned of wrong length (expected 0, got %d)\n", SysStringLen(rettext));
 
@@ -756,10 +756,10 @@ static void _check_txgetnaturalsize(HRESULT res, LONG width, LONG height, HDC hd
     DrawTextW(hdc, string, -1, &expected_rect, DT_LEFT | DT_CALCRECT | DT_NOCLIP | DT_EDITCONTROL | DT_WORDBREAK);
     expected_width = expected_rect.right - expected_rect.left;
     expected_height = expected_rect.bottom - expected_rect.top;
-    ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08x.\n", res);
+    ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08lx.\n", res);
     todo_wine ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1,
-                       "got wrong width: %d, expected: %d {+1}.\n", width, expected_width);
-    ok_(__FILE__,line)(height == expected_height, "got wrong height: %d, expected: %d.\n",
+                       "got wrong width: %ld, expected: %ld {+1}.\n", width, expected_width);
+    ok_(__FILE__,line)(height == expected_height, "got wrong height: %ld, expected: %ld.\n",
                        height, expected_height);
 }
 
@@ -793,11 +793,11 @@ static void test_TxGetNaturalSize(void)
     hf = GetStockObject(DEFAULT_GUI_FONT);
     hf_to_cf(hf, &cf);
     result = ITextServices_TxSendMessage(txtserv, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf, &lresult);
-    ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08x.\n", result);
+    ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08lx.\n", result);
     SelectObject(hdcDraw, hf);
 
     result = ITextServices_TxSetText(txtserv, test_text);
-    ok(result == S_OK, "ITextServices_TxSetText failed: 0x%08x.\n", result);
+    ok(result == S_OK, "ITextServices_TxSetText failed: 0x%08lx.\n", result);
 
     extent.cx = -1; extent.cy = -1;
     width = rect.right - rect.left;
@@ -835,26 +835,26 @@ static void test_TxDraw(void)
 
     hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, 0, TXTVIEW_INACTIVE );
-    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+    ok( hr == E_INVALIDARG, "got %08lx\n", hr );
     hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, NULL,
                                NULL, NULL, 0, TXTVIEW_INACTIVE );
-    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+    ok( hr == E_INVALIDARG, "got %08lx\n", hr );
     hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, (RECTL *)&client, NULL,
                                NULL, NULL, 0, TXTVIEW_INACTIVE );
-    ok( hr == E_FAIL, "got %08x\n", hr );
+    ok( hr == E_FAIL, "got %08lx\n", hr );
     hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
                                NULL, NULL, 0, TXTVIEW_INACTIVE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
                                NULL, NULL, 0, TXTVIEW_ACTIVE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = ITextServices_OnTxInPlaceActivate( txtserv, &client );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, 0, TXTVIEW_INACTIVE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = ITextServices_OnTxInPlaceDeactivate( txtserv );
 
@@ -929,15 +929,15 @@ static void test_COM(void)
     /* COM aggregation */
     hr = pCreateTextServices(&unk_obj.IUnknown_iface, &texthost.ITextHost_iface,
                              &unk_obj.inner_unk);
-    ok(hr == S_OK, "CreateTextServices failed: %08x\n", hr);
+    ok(hr == S_OK, "CreateTextServices failed: %08lx\n", hr);
     hr = IUnknown_QueryInterface(unk_obj.inner_unk, pIID_ITextServices, (void**)&textsrv);
-    ok(hr == S_OK, "QueryInterface for IID_ITextServices failed: %08x\n", hr);
+    ok(hr == S_OK, "QueryInterface for IID_ITextServices failed: %08lx\n", hr);
     refcount = ITextServices_AddRef(textsrv);
     ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
     refcount = ITextServices_Release(textsrv);
     ok(refcount == unk_obj.ref, "CreateTextServices just pretends to support COM aggregation\n");
     refcount = ITextServices_Release(textsrv);
-    ok(refcount == 19, "Refcount should be back at 19 but is %u\n", refcount);
+    ok(refcount == 19, "Refcount should be back at 19 but is %lu\n", refcount);
 
     IUnknown_Release(unk_obj.inner_unk);
 }
@@ -963,92 +963,92 @@ static void test_QueryInterface(void)
         return;
 
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
 
     /* IID_IRichEditOle */
     hres = ITextServices_QueryInterface(txtserv, &IID_IRichEditOle, (void **)&txtsrv_reole);
-    ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
+    ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
     refcount = get_refcount((IUnknown *)txtsrv_reole);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
 
     hres = ITextServices_QueryInterface( txtserv, &IID_IUnknown, (void **)&unk );
-    ok( hres == S_OK, "got 0x%08x\n", hres );
+    ok( hres == S_OK, "got 0x%08lx\n", hres );
     hres = IRichEditOle_QueryInterface( txtsrv_reole, &IID_IUnknown, (void **)&unk2 );
-    ok( hres == S_OK, "got 0x%08x\n", hres );
+    ok( hres == S_OK, "got 0x%08lx\n", hres );
     ok( unk == unk2, "unknowns differ\n" );
     IUnknown_Release( unk2 );
     IUnknown_Release( unk );
 
     hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument, (void **)&txtdoc);
-    ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
+    ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
     refcount = get_refcount((IUnknown *)txtsrv_reole);
-    ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
 
     ITextDocument_Release(txtdoc);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
 
     hres = IRichEditOle_QueryInterface(txtsrv_reole, &IID_ITextDocument2Old, (void **)&txtdoc2old);
-    ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
+    ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08lx\n", hres);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
     refcount = get_refcount((IUnknown *)txtsrv_reole);
-    ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
 
     ITextDocument2Old_Release(txtdoc2old);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
     IRichEditOle_Release(txtsrv_reole);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
 
     /* IID_ITextDocument */
     hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument, (void **)&txtsrv_txtdoc);
-    ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
+    ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
     refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
 
     hres = ITextDocument_QueryInterface(txtsrv_txtdoc, &IID_IRichEditOle, (void **)&reole);
-    ok(hres == S_OK, "ITextDocument_QueryInterface: 0x%08x\n", hres);
+    ok(hres == S_OK, "ITextDocument_QueryInterface: 0x%08lx\n", hres);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
     refcount = get_refcount((IUnknown *)txtsrv_txtdoc);
-    ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
 
     IRichEditOle_Release(reole);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
     ITextDocument_Release(txtsrv_txtdoc);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
 
     /* ITextDocument2Old */
     hres = ITextServices_QueryInterface(txtserv, &IID_ITextDocument2Old, (void **)&txtsrv_txtdoc2old);
-    ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08x\n", hres);
+    ok(hres == S_OK, "ITextServices_QueryInterface: 0x%08lx\n", hres);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
     refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
 
     hres = ITextDocument2Old_QueryInterface(txtsrv_txtdoc2old, &IID_IRichEditOle, (void **)&reole);
-    ok(hres == S_OK, "ITextDocument2Old_QueryInterface: 0x%08x\n", hres);
+    ok(hres == S_OK, "ITextDocument2Old_QueryInterface: 0x%08lx\n", hres);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
     refcount = get_refcount((IUnknown *)txtsrv_txtdoc2old);
-    ok(refcount == 3, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 3, "got wrong ref count: %ld\n", refcount);
 
     IRichEditOle_Release(reole);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 2, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 2, "got wrong ref count: %ld\n", refcount);
     ITextDocument2Old_Release(txtsrv_txtdoc2old);
     refcount = get_refcount((IUnknown *)txtserv);
-    ok(refcount == 1, "got wrong ref count: %d\n", refcount);
+    ok(refcount == 1, "got wrong ref count: %ld\n", refcount);
 
     ITextServices_Release(txtserv);
     ITextHost_Release(host);
@@ -1069,13 +1069,13 @@ static void test_default_format(void)
 
     cf2.cbSize = sizeof(CHARFORMAT2W);
     result = ITextServices_TxSendMessage(txtserv, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf2, &lresult);
-    ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08x.\n", result);
+    ok(result == S_OK, "ITextServices_TxSendMessage failed: 0x%08lx.\n", result);
 
     ITextHostImpl_TxGetCharFormat(host, &host_cf);
     ok(!lstrcmpW(host_cf->szFaceName, cf2.szFaceName), "got wrong font name: %s.\n", wine_dbgstr_w(cf2.szFaceName));
-    ok(cf2.yHeight == host_cf->yHeight, "got wrong yHeight: %d, expected %d.\n", cf2.yHeight, host_cf->yHeight);
+    ok(cf2.yHeight == host_cf->yHeight, "got wrong yHeight: %ld, expected %ld.\n", cf2.yHeight, host_cf->yHeight);
     expected_effects = (cf2.dwEffects & ~(CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR));
-    ok(host_cf->dwEffects == expected_effects, "got wrong dwEffects: %x, expected %x.\n", cf2.dwEffects, expected_effects);
+    ok(host_cf->dwEffects == expected_effects, "got wrong dwEffects: %lx, expected %lx.\n", cf2.dwEffects, expected_effects);
     ok(cf2.bPitchAndFamily == host_cf->bPitchAndFamily, "got wrong bPitchAndFamily: %x, expected %x.\n",
        cf2.bPitchAndFamily, host_cf->bPitchAndFamily);
     ok(cf2.bCharSet == host_cf->bCharSet, "got wrong bCharSet: %x, expected %x.\n", cf2.bCharSet, host_cf->bCharSet);
@@ -1100,17 +1100,17 @@ static void test_TxGetScroll(void)
     host_impl = impl_from_ITextHost( host );
 
     ret = ITextServices_TxGetHScroll(txtserv, NULL, NULL, NULL, NULL, NULL);
-    ok(ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret);
+    ok(ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret);
 
     ret = ITextServices_TxGetVScroll(txtserv, NULL, NULL, NULL, NULL, NULL);
-    ok(ret == S_OK, "ITextServices_TxGetVScroll failed: 0x%08x.\n", ret);
+    ok(ret == S_OK, "ITextServices_TxGetVScroll failed: 0x%08lx.\n", ret);
 
     ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
-    ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
-    ok( min_pos == 0, "got %d\n", min_pos );
-    ok( max_pos == 0, "got %d\n", max_pos );
-    ok( pos == 0, "got %d\n", pos );
-    ok( page == 0, "got %d\n", page );
+    ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
+    ok( min_pos == 0, "got %ld\n", min_pos );
+    ok( max_pos == 0, "got %ld\n", max_pos );
+    ok( pos == 0, "got %ld\n", pos );
+    ok( page == 0, "got %ld\n", page );
     ok( !enabled, "got %d\n", enabled );
 
     host_impl->scrollbars = WS_VSCROLL;
@@ -1121,26 +1121,26 @@ static void test_TxGetScroll(void)
                                          0, 0, 400, 400, 0, 0, 0, NULL );
     host_impl->client_rect = client;
     ret = ITextServices_OnTxInPlaceActivate( txtserv, &client );
-    ok( ret == S_OK, "got 0x%08x.\n", ret );
+    ok( ret == S_OK, "got 0x%08lx.\n", ret );
 
     ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
-    ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
-    ok( min_pos == 0, "got %d\n", min_pos );
+    ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
+    ok( min_pos == 0, "got %ld\n", min_pos );
     todo_wine
-    ok( max_pos == 0, "got %d\n", max_pos );
-    ok( pos == 0, "got %d\n", pos );
-    ok( page == client.bottom, "got %d\n", page );
+    ok( max_pos == 0, "got %ld\n", max_pos );
+    ok( pos == 0, "got %ld\n", pos );
+    ok( page == client.bottom, "got %ld\n", page );
     ok( !enabled, "got %d\n", enabled );
 
     ret = ITextServices_TxSetText( txtserv, lorem );
-    ok( ret == S_OK, "got 0x%08x.\n", ret );
+    ok( ret == S_OK, "got 0x%08lx.\n", ret );
 
     ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
-    ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
-    ok( min_pos == 0, "got %d\n", min_pos );
-    ok( max_pos > client.bottom, "got %d\n", max_pos );
-    ok( pos == 0, "got %d\n", pos );
-    ok( page == client.bottom, "got %d\n", page );
+    ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
+    ok( min_pos == 0, "got %ld\n", min_pos );
+    ok( max_pos > client.bottom, "got %ld\n", max_pos );
+    ok( pos == 0, "got %ld\n", pos );
+    ok( page == client.bottom, "got %ld\n", page );
     ok( enabled, "got %d\n", enabled );
 
     host_impl->scrollbars = WS_VSCROLL | ES_DISABLENOSCROLL;
@@ -1148,12 +1148,12 @@ static void test_TxGetScroll(void)
     ITextServices_TxSetText( txtserv, L"short" );
 
     ret = ITextServices_TxGetVScroll( txtserv, &min_pos, &max_pos, &pos, &page, &enabled );
-    ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08x.\n", ret );
-    ok( min_pos == 0, "got %d\n", min_pos );
+    ok( ret == S_OK, "ITextServices_TxGetHScroll failed: 0x%08lx.\n", ret );
+    ok( min_pos == 0, "got %ld\n", min_pos );
     todo_wine
-    ok( max_pos == 0, "got %d\n", max_pos );
-    ok( pos == 0, "got %d\n", pos );
-    ok( page == client.bottom, "got %d\n", page );
+    ok( max_pos == 0, "got %ld\n", max_pos );
+    ok( pos == 0, "got %ld\n", pos );
+    ok( page == client.bottom, "got %ld\n", page );
     ok( !enabled, "got %d\n", enabled );
 
     DestroyWindow( host_impl->window );
@@ -1183,33 +1183,33 @@ static void test_notifications( void )
                                          0, 0, 400, 400, 0, 0, 0, NULL );
     host_impl->client_rect = client;
     hr = ITextServices_OnTxInPlaceActivate( txtserv, &client );
-    ok( hr == S_OK, "got 0x%08x.\n", hr );
+    ok( hr == S_OK, "got 0x%08lx.\n", hr );
 
     hr = ITextServices_TxSendMessage( txtserv, EM_SETEVENTMASK, 0, ENM_SCROLL, &res );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     /* check EN_VSCROLL notification is sent */
     en_vscroll_sent = 0;
     hr = ITextServices_TxSendMessage( txtserv, WM_VSCROLL, SB_LINEDOWN, 0, &res );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( en_vscroll_sent == 1, "got %d\n", en_vscroll_sent );
 
     hr = ITextServices_TxSendMessage( txtserv, WM_VSCROLL, SB_BOTTOM, 0, &res );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( en_vscroll_sent == 2, "got %d\n", en_vscroll_sent );
 
     /* but not when the thumb is moved */
     hr = ITextServices_TxSendMessage( txtserv, WM_VSCROLL, MAKEWPARAM( SB_THUMBTRACK, 0 ), 0, &res );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = ITextServices_TxSendMessage( txtserv, WM_VSCROLL, MAKEWPARAM( SB_THUMBPOSITION, 0 ), 0, &res );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( en_vscroll_sent == 2, "got %d\n", en_vscroll_sent );
 
     /* EN_UPDATE is sent by TxDraw() */
     en_update_sent = 0;
     hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, NULL, NULL, NULL, NULL,
                                NULL, NULL, 0, TXTVIEW_ACTIVE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( en_update_sent == 1, "got %d\n", en_update_sent );
 
     DestroyWindow( host_impl->window );




More information about the wine-devel mailing list