advapi32/service: Set correct error when the service doesn't exist.

oldstable
Paul Vriens 2007-07-27 21:47:43 +02:00 committed by Alexandre Julliard
parent b67b66d7b3
commit 07af2fe2b5
2 changed files with 2 additions and 1 deletions

View File

@ -2352,6 +2352,8 @@ BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
SetLastError(ERROR_INSUFFICIENT_BUFFER); SetLastError(ERROR_INSUFFICIENT_BUFFER);
*lpcchBuffer = (size / sizeof(WCHAR)) - 1; *lpcchBuffer = (size / sizeof(WCHAR)) - 1;
} }
else if (ret == ERROR_FILE_NOT_FOUND)
SetLastError(ERROR_SERVICE_DOES_NOT_EXIST);
else else
SetLastError(ret); SetLastError(ret);
return FALSE; return FALSE;

View File

@ -420,7 +420,6 @@ static void test_get_displayname(void)
displaysize = -1; displaysize = -1;
ret = GetServiceDisplayNameA(scm_handle, deadbeef, NULL, &displaysize); ret = GetServiceDisplayNameA(scm_handle, deadbeef, NULL, &displaysize);
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
todo_wine
ok(GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST, ok(GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST,
"Expected ERROR_SERVICE_DOES_NOT_EXIST, got %d\n", GetLastError()); "Expected ERROR_SERVICE_DOES_NOT_EXIST, got %d\n", GetLastError());