Fix NetApiBufferReallocate and tests based on results from winetest.

This commit is contained in:
Juan Lang 2004-04-21 22:24:38 +00:00 committed by Alexandre Julliard
parent 1811e198f7
commit 759ef45945
2 changed files with 6 additions and 3 deletions

View File

@ -62,7 +62,10 @@ NET_API_STATUS WINAPI NetApiBufferReallocate(LPVOID OldBuffer, DWORD NewByteCoun
TRACE("(%p, %ld, %p)\n", OldBuffer, NewByteCount, NewBuffer);
if (NewByteCount)
{
*NewBuffer = HeapReAlloc(GetProcessHeap(), 0, OldBuffer, NewByteCount);
if (OldBuffer)
*NewBuffer = HeapReAlloc(GetProcessHeap(), 0, OldBuffer, NewByteCount);
else
*NewBuffer = HeapAlloc(GetProcessHeap(), 0, NewByteCount);
return *NewBuffer ? NERR_Success : GetLastError();
}
else

View File

@ -64,8 +64,8 @@ void run_apibuf_tests(void)
ok(pNetApiBufferSize(NULL, &dwSize) == ERROR_INVALID_PARAMETER, "Error for NULL pointer\n");
/* border reallocate cases */
ok(pNetApiBufferReallocate(0, 1500, (LPVOID *) &p) != NERR_Success, "(Re)allocated\n");
ok(p == NULL, "Some memory got allocated\n");
ok(pNetApiBufferReallocate(0, 1500, (LPVOID *) &p) == NERR_Success, "Reallocate with OldBuffer = NULL failed\n");
ok(p != NULL, "No memory got allocated\n");
ok(pNetApiBufferAllocate(1024, (LPVOID *)&p) == NERR_Success, "Memory not reserved\n");
ok(pNetApiBufferReallocate(p, 0, (LPVOID *) &p) == NERR_Success, "Not freed\n");
ok(p == NULL, "Pointer not cleared\n");