Correct incorrect use of arguments to QueryServiceConfigW.
authorTroy Rollo <wine@troy.rollo.name>
Fri, 4 Mar 2005 10:47:41 +0000 (10:47 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 4 Mar 2005 10:47:41 +0000 (10:47 +0000)
dlls/advapi32/service.c

index f40ef39cbcfdbc026feb4798bd66a32318e5462b..75521c2360cb6a38423f65d10c92d3fb96506bdd 100644 (file)
@@ -1803,15 +1803,15 @@ QueryServiceConfigW( SC_HANDLE hService,
     if( ( r == ERROR_SUCCESS ) && ( type == REG_SZ ) )
         total += sz;
 
+    *pcbBytesNeeded = total;
+
     /* if there's not enough memory, return an error */
-    if( total > *pcbBytesNeeded )
+    if( total > cbBufSize )
     {
-        *pcbBytesNeeded = total;
         SetLastError( ERROR_INSUFFICIENT_BUFFER );
         return FALSE;
     }
 
-    *pcbBytesNeeded = total;
     ZeroMemory( lpServiceConfig, total );
 
     sz = sizeof val;