Commit 759ef459 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

Fix NetApiBufferReallocate and tests based on results from winetest.

parent 1811e198
......@@ -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
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment