advapi32/service: Test for too small buffer.

This commit is contained in:
Paul Vriens 2007-07-29 22:29:11 +02:00 committed by Alexandre Julliard
parent 07af2fe2b5
commit 641e645276
1 changed files with 13 additions and 0 deletions

View File

@ -569,6 +569,19 @@ static void test_get_displayname(void)
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
}
/* Buffer is too small */
SetLastError(0xdeadbeef);
tempsize = displaysize;
displaysize = (tempsize / 2);
ret = GetServiceDisplayNameA(scm_handle, servicename, displayname, &displaysize);
ok(!ret, "Expected failure\n");
todo_wine
{
ok(displaysize == tempsize, "Expected the needed buffersize\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
}
/* Get the displayname */
SetLastError(0xdeadbeef);
ret = GetServiceDisplayNameA(scm_handle, servicename, displayname, &displaysize);