Aric Stewart : imm32: ImmGetDescriptionA return does not include NULL byte.

Alexandre Julliard julliard at winehq.org
Fri Sep 27 11:33:13 CDT 2013


Module: wine
Branch: master
Commit: cae71ef219420b0e6d3340593e88511cb3d61295
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cae71ef219420b0e6d3340593e88511cb3d61295

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Sep 26 13:47:32 2013 -0500

imm32: ImmGetDescriptionA return does not include NULL byte.

---

 dlls/imm32/imm.c         |    5 ++++-
 dlls/imm32/tests/imm32.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 29bf4af..93e71af 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -1540,7 +1540,10 @@ UINT WINAPI ImmGetDescriptionA(
 
   HeapFree( GetProcessHeap(), 0, buf );
 
-  return len;
+  if (len == 0)
+    return 0;
+
+  return len - 1;
 }
 
 /***********************************************************************
diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c
index 7162f82..f92b2c1 100644
--- a/dlls/imm32/tests/imm32.c
+++ b/dlls/imm32/tests/imm32.c
@@ -665,13 +665,16 @@ static void test_ImmGetDescription(void)
 
     lret = ImmGetDescriptionA(hkl, descA, ret + 1);
     ok(lret, "ImmGetDescriptionA failed, expected != 0 received 0.\n");
-    todo_wine ok(lret == ret, "ImmGetDescriptionA failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
+    ok(lret == ret, "ImmGetDescriptionA failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
 
     ret /= 2; /* try to copy partially */
     lret = ImmGetDescriptionW(hkl, descW, ret + 1);
     ok(lret, "ImmGetDescriptionW failed, expected != 0 received 0.\n");
     ok(lret == ret, "ImmGetDescriptionW failed to return the correct amount of data. Expected %d, got %d.\n", ret, lret);
 
+    lret = ImmGetDescriptionA(hkl, descA, ret + 1);
+    ok(!lret, "ImmGetDescriptionA should fail\n");
+
     ret = ImmGetDescriptionW(hkl, descW, 1);
     ok(!ret, "ImmGetDescriptionW failed, expected 0 received %d.\n", ret);
 




More information about the wine-cvs mailing list