Return an empty string for service dependencies when there are no

dependencies, rather than a NULL pointer, which causes some apps to
SEGV.
This commit is contained in:
Troy Rollo 2005-03-04 12:32:50 +00:00 committed by Alexandre Julliard
parent 64db533173
commit 4021f530d7
1 changed files with 9 additions and 1 deletions

View File

@ -1792,6 +1792,8 @@ QueryServiceConfigW( SC_HANDLE hService,
r = RegQueryValueExW( hKey, szDependencies, 0, &type, NULL, &sz );
if( ( r == ERROR_SUCCESS ) && ( type == REG_MULTI_SZ ) )
total += sz;
else
total += sizeof(WCHAR);
sz = 0;
r = RegQueryValueExW( hKey, szStart, 0, &type, NULL, &sz );
@ -1862,12 +1864,18 @@ QueryServiceConfigW( SC_HANDLE hService,
sz = n;
r = RegQueryValueExW( hKey, szDependencies, 0, &type, p, &sz );
lpServiceConfig->lpDependencies = (LPWSTR) p;
if( ( r == ERROR_SUCCESS ) || ( type == REG_SZ ) )
{
lpServiceConfig->lpDependencies = (LPWSTR) p;
p += sz;
n -= sz;
}
else
{
*(WCHAR *) p = 0;
p += sizeof(WCHAR);
n -= sizeof(WCHAR);
}
if( n < 0 )
ERR("Buffer overflow!\n");