Paul Vriens : advapi32/service: Fix buffersize calculations for GetServiceDisplayNameW.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 27 07:34:50 CDT 2007


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

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Thu Jul 26 16:15:44 2007 +0200

advapi32/service: Fix buffersize calculations for GetServiceDisplayNameW.

---

 dlls/advapi32/service.c       |    4 ++++
 dlls/advapi32/tests/service.c |    3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index bee4847..0c37313 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -2356,6 +2356,10 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
             SetLastError(ret);
         return FALSE;
     }
+
+    /* Always return the correct needed size on success */
+    *lpcchBuffer = (size / sizeof(WCHAR)) - 1;
+
     return TRUE;
 }
 
diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c
index 77fc85a..8fc1af9 100644
--- a/dlls/advapi32/tests/service.c
+++ b/dlls/advapi32/tests/service.c
@@ -527,12 +527,9 @@ static void test_get_displayname(void)
        GetLastError() == ERROR_IO_PENDING /* W2K */ ||
        GetLastError() == 0xdeadbeef       /* NT4, XP, Vista */,
        "Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d\n", GetLastError());
-    todo_wine
-    {
     ok(displaysize == tempsizeW, "Expected the needed buffersize\n");
     ok(lstrlenW(displaynameW) == displaysize,
        "Expected the buffer to be the length of the string\n") ;
-    }
     ok(tempsize / 2 == tempsizeW,
        "Expected the needed buffersize (in bytes) to be the same for the A and W call\n");
 




More information about the wine-cvs mailing list