Commit 20a9ec6c authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32/tests: Avoid some more compiler warning for HeapAlloc() invalid parameter tests.

parent 4d60ab37
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
#define HEAP_VALIDATE_ALL 0x20000000 #define HEAP_VALIDATE_ALL 0x20000000
#define HEAP_VALIDATE_PARAMS 0x40000000 #define HEAP_VALIDATE_PARAMS 0x40000000
/* use function pointers to avoid warnings for invalid parameter tests */
static LPVOID (WINAPI *pHeapAlloc)(HANDLE,DWORD,SIZE_T);
static LPVOID (WINAPI *pHeapReAlloc)(HANDLE,DWORD,LPVOID,SIZE_T);
static BOOL (WINAPI *pHeapQueryInformation)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T); static BOOL (WINAPI *pHeapQueryInformation)(HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T);
static BOOL (WINAPI *pGetPhysicallyInstalledSystemMemory)(ULONGLONG *); static BOOL (WINAPI *pGetPhysicallyInstalledSystemMemory)(ULONGLONG *);
static ULONG (WINAPI *pRtlGetNtGlobalFlags)(void); static ULONG (WINAPI *pRtlGetNtGlobalFlags)(void);
...@@ -89,12 +92,6 @@ static void test_heap(void) ...@@ -89,12 +92,6 @@ static void test_heap(void)
HGLOBAL hsecond; HGLOBAL hsecond;
SIZE_T size, size2; SIZE_T size, size2;
const SIZE_T max_size = 1024, init_size = 10; const SIZE_T max_size = 1024, init_size = 10;
/* use function pointers to avoid warnings for invalid parameter tests */
LPVOID (WINAPI *pHeapAlloc)(HANDLE,DWORD,SIZE_T);
LPVOID (WINAPI *pHeapReAlloc)(HANDLE,DWORD,LPVOID,SIZE_T);
pHeapAlloc = (void *)GetProcAddress( GetModuleHandleA("kernel32"), "HeapAlloc" );
pHeapReAlloc = (void *)GetProcAddress( GetModuleHandleA("kernel32"), "HeapReAlloc" );
/* Heap*() functions */ /* Heap*() functions */
mem = HeapAlloc(GetProcessHeap(), 0, 0); mem = HeapAlloc(GetProcessHeap(), 0, 0);
...@@ -941,7 +938,7 @@ static void test_heap_checks( DWORD flags ) ...@@ -941,7 +938,7 @@ static void test_heap_checks( DWORD flags )
ret = HeapFree( GetProcessHeap(), 0, p ); ret = HeapFree( GetProcessHeap(), 0, p );
ok( ret, "HeapFree failed\n" ); ok( ret, "HeapFree failed\n" );
p = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 17 ); p = pHeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 17 );
ok( p != NULL, "HeapAlloc failed\n" ); ok( p != NULL, "HeapAlloc failed\n" );
old = p[17]; old = p[17];
p[17] = 0xcc; p[17] = 0xcc;
...@@ -1006,7 +1003,7 @@ static void test_heap_checks( DWORD flags ) ...@@ -1006,7 +1003,7 @@ static void test_heap_checks( DWORD flags )
/* now test large blocks */ /* now test large blocks */
p = HeapAlloc( GetProcessHeap(), 0, large_size ); p = pHeapAlloc( GetProcessHeap(), 0, large_size );
ok( p != NULL, "HeapAlloc failed\n" ); ok( p != NULL, "HeapAlloc failed\n" );
ret = HeapValidate( GetProcessHeap(), 0, p ); ret = HeapValidate( GetProcessHeap(), 0, p );
...@@ -1221,6 +1218,9 @@ START_TEST(heap) ...@@ -1221,6 +1218,9 @@ START_TEST(heap)
int argc; int argc;
char **argv; char **argv;
pHeapAlloc = (void *)GetProcAddress( GetModuleHandleA("kernel32"), "HeapAlloc" );
pHeapReAlloc = (void *)GetProcAddress( GetModuleHandleA("kernel32"), "HeapReAlloc" );
pRtlGetNtGlobalFlags = (void *)GetProcAddress( GetModuleHandleA("ntdll.dll"), "RtlGetNtGlobalFlags" ); pRtlGetNtGlobalFlags = (void *)GetProcAddress( GetModuleHandleA("ntdll.dll"), "RtlGetNtGlobalFlags" );
argc = winetest_get_mainargs( &argv ); argc = winetest_get_mainargs( &argv );
......
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