101 ok(
mem !=
NULL,
"memory not allocated for size 0\n");
105 ok(
mem ==
NULL,
"memory allocated by HeapReAlloc\n");
113 "HeapSize returned %lu instead of %lu or %lu\n", heap_size,
size,
resize_9x(
size));
119 ok(
mem !=
NULL,
"memory not allocated for size 0\n");
121 ok(msecond ==
NULL,
"HeapReAlloc(~0 - 7) should have failed\n");
123 ok(msecond ==
NULL,
"HeapReAlloc(~0) should have failed\n");
126 ok(
mem ==
NULL,
"memory allocated for size ~0\n");
129 ok(msecond !=
NULL,
"HeapReAlloc(0) should have succeeded\n");
132 "HeapSize should have returned 0 instead of %lu\n",
size);
137 ok(
mem !=
NULL,
"failed for size 512K\n" );
139 "512K block not 16-byte aligned\n" );
144 ok(gbl !=
NULL,
"global memory not allocated for size 0\n");
147 ok(gbl !=
NULL,
"Can't realloc global memory\n");
149 ok(
size >= 10 &&
size <= 16,
"Memory not resized to size 10, instead size=%ld\n",
size);
152 ok(gbl !=
NULL,
"GlobalReAlloc should not fail on size 0\n");
155 ok(
size == 0,
"Memory not resized to size 0, instead size=%ld\n",
size);
158 ok(
size == 0,
"Memory should have been freed, size=%ld\n",
size);
161 ok(gbl ==
NULL,
"global realloc allocated memory\n");
171 ok(
flags == 1,
"returned 0x%04x with %d (expected '0x0001')\n",
176 ok( msecond ==
mem,
"returned %p with %d (expected '%p')\n",
180 ok(
flags == 2,
"returned 0x%04x with %d (expected '0x0002')\n",
189 ok(
flags ,
"returned 0x%04x with %d (expected '!= 0')\n",
196 "returned %d with %d (expected '0' with: ERROR_SUCCESS or " 200 ok( !
flags ,
"returned 0x%04x with %d (expected '0')\n",
209 "returned %d with %d (expected '0' with: ERROR_NOT_LOCKED or " 217 "returned %p with 0x%08x (expected %p with ERROR_INVALID_HANDLE)\n",
222 "returned %p with 0x%08x (expected %p with ERROR_INVALID_HANDLE)\n",
228 "returned %p with 0x%08x (expected %p with ERROR_NOACCESS)\n",
234 "returned 0x%04x with 0x%08x (expected GMEM_INVALID_HANDLE with " 239 "returned %ld with 0x%08x (expected '0' with ERROR_INVALID_HANDLE)\n",
245 "returned %p with 0x%08x (expected NULL with ERROR_INVALID_HANDLE)\n",
255 "returned %d with %d (expected ERROR_INVALID_HANDLE)\n",
265 if (
sizeof(
void *) != 8)
273 "Expected ERROR_INVALID_HANDLE or ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
282 "got %p with %x (expected %p or NULL) @%ld\n", hsecond,
GetLastError(), gbl,
size);
292 "got %p with %x (expected non-NULL) @%ld\n", hsecond,
GetLastError(),
size);
294 ok(
mem == hsecond,
"got %p (expected %p) @%ld\n",
mem, hsecond,
size);
303 "Expected 1 or 0, got %d\n",
res);
308 "Expected 1 or 0, got %d\n",
res);
318 "Expected 1 or 0, got %d\n",
res);
324 if (
sizeof(
void *) != 8)
331 "Expected ERROR_INVALID_HANDLE or ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
343 ok(gbl !=
NULL,
"local memory not allocated for size 0\n");
346 ok(gbl !=
NULL,
"Can't realloc local memory\n");
348 ok(
size >= 10 &&
size <= 16,
"Memory not resized to size 10, instead size=%ld\n",
size);
351 ok(gbl !=
NULL,
"LocalReAlloc should not fail on size 0\n");
354 ok(
size == 0,
"Memory not resized to size 0, instead size=%ld\n",
size);
357 ok(
size == 0,
"Memory should have been freed, size=%ld\n",
size);
360 ok(gbl ==
NULL,
"local realloc allocated memory\n");
369 ok(
flags == 1,
"returned 0x%04x with %d (expected '0x0001')\n",
374 ok( msecond ==
mem,
"returned %p with %d (expected '%p')\n",
378 ok(
flags == 2,
"returned 0x%04x with %d (expected '0x0002')\n",
387 ok(
flags ,
"returned 0x%04x with %d (expected '!= 0')\n",
394 "returned %d with %d (expected '0' with: ERROR_SUCCESS or " 398 ok( !
flags ,
"returned 0x%04x with %d (expected '0')\n",
407 "returned %d with %d (expected '0' with: ERROR_NOT_LOCKED or " 415 "returned %p with 0x%08x (expected %p with ERROR_INVALID_HANDLE)\n",
420 "returned 0x%04x with 0x%08x (expected LMEM_INVALID_HANDLE with " 425 "returned %ld with 0x%08x (expected '0' with ERROR_INVALID_HANDLE)\n",
431 "returned %p with 0x%08x (expected NULL with ERROR_INVALID_HANDLE)\n",
438 "returned %d with %d (expected '0' with ERROR_INVALID_HANDLE)\n",
447 "got %p with %x (expected %p or NULL) @%ld\n", hsecond,
GetLastError(), gbl,
size);
457 "got %p with %x (expected non-NULL) @%ld\n", hsecond,
GetLastError(),
size);
459 ok(
mem == hsecond,
"got %p (expected %p) @%ld\n",
mem, hsecond,
size);
467 ok(
res == 0,
"Expected 0, got %d\n",
res);
476 "wrong size %lu\n",
size );
481 ok(gbl !=
NULL,
"returned NULL\n");
487 "returned %p with 0x%x/%d (expected 'NULL' with: ERROR_DISCARDED or " 494 ok(gbl !=
NULL,
"returned NULL\n");
497 ok(gbl !=
mem,
"unexpectedly equal.\n");
502 ok(size2 == 0x123,
"got %lu\n", size2);
508 ok(gbl !=
NULL,
"returned NULL\n");
511 ok(gbl ==
mem,
"got %p, %p.\n", gbl,
mem);
#define ERROR_INVALID_PARAMETER
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
BOOL NTAPI LocalUnlock(HLOCAL hMem)
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
UINT NTAPI GlobalFlags(HGLOBAL hMem)
static SIZE_T resize_9x(SIZE_T size)
#define ERROR_INVALID_HANDLE
#define GMEM_INVALID_HANDLE
#define ERROR_NOT_ENOUGH_MEMORY
DWORD WINAPI GetLastError(VOID)
SIZE_T NTAPI LocalSize(HLOCAL hMem)
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
#define LMEM_INVALID_HANDLE
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
LPVOID NTAPI LocalLock(HLOCAL hMem)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
UINT NTAPI LocalFlags(HLOCAL hMem)
#define GetProcAddress(x, y)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
#define HeapFree(x, y, z)