34#define HEAP_ADD_USER_INFO 0x00000100
35#define HEAP_PRIVATE 0x00001000
36#define HEAP_PAGE_ALLOCS 0x01000000
37#define HEAP_VALIDATE 0x10000000
38#define HEAP_VALIDATE_ALL 0x20000000
39#define HEAP_VALIDATE_PARAMS 0x40000000
41#define BLOCK_ALIGN (2 * sizeof(void *) - 1)
42#define ALIGN_BLOCK_SIZE(x) (((x) + BLOCK_ALIGN) & ~BLOCK_ALIGN)
66#define LOAD_FUNC(m, f) p ## f = (void *)GetProcAddress( m, #f );
123#define RTL_HEAP_ENTRY_BUSY 0x0001
124#define RTL_HEAP_ENTRY_REGION 0x0002
125#define RTL_HEAP_ENTRY_BLOCK 0x0010
126#define RTL_HEAP_ENTRY_UNCOMMITTED 0x1000
127#define RTL_HEAP_ENTRY_COMMITTED 0x4000
128#define RTL_HEAP_ENTRY_LFH 0x8000
181 SIZE_T alloc_size = 0x8000 *
sizeof(
void *),
size,
i;
203 ok( heap_count <= 6,
"GetProcessHeaps returned %lu\n", heap_count );
211 ok(
count == heap_count + 1,
"GetProcessHeaps returned %lu\n",
count );
214 ok( !((
ULONG_PTR)heap1 & 0xffff),
"wrong heap alignment\n" );
216 ok(
count == heap_count + 2,
"GetProcessHeaps returned %lu\n",
count );
218 ok(
count == heap_count + 2,
"GetProcessHeaps returned %lu\n",
count );
220 ok( heaps[heap_count + 0] ==
heap,
"got wrong heap\n" );
222 ok( heaps[heap_count + 1] == heap1,
"got wrong heap\n" );
228 ok(
count == heap_count,
"GetProcessHeaps returned %lu\n",
count );
246 ok( !
ret,
"HeapFree succeeded\n" );
251 ok( !
ret,
"HeapFree succeeded\n" );
257 ok( !
ptr,
"HeapReAlloc succeeded\n" );
264 ok( !ptr1,
"HeapReAlloc succeeded\n" );
267 ok( !
ret,
"HeapValidate succeeded\n" );
272 ok( !ptr1,
"HeapReAlloc succeeded\n" );
282 ok( !
ret,
"HeapValidate succeeded\n" );
290 ok( !ptr1,
"HeapReAlloc succeeded\n" );
292 ok( !ptr1,
"HeapReAlloc succeeded\n" );
299 ok( !
ret,
"HeapValidate succeeded\n" );
303 ok( !
ptr,
"HeapAlloc succeeded\n" );
339 ok( !(
align & (2 *
sizeof(
void *) - 1)),
"got wrong alignment\n" );
340 ok(
align & (2 *
sizeof(
void *)),
"got wrong alignment\n" );
354 ok( !(
align & (8 *
sizeof(
void *) - 1)),
"got wrong alignment\n" );
355 ok(
align & (8 *
sizeof(
void *)),
"got wrong alignment\n" );
369 ok( !
size && !
ptr[0],
"memory wasn't zeroed\n" );
378 ok( !
size && !
ptr[0],
"memory wasn't zeroed\n" );
387 ok( !
size && !
ptr[0],
"memory wasn't zeroed\n" );
394 ok( !
size && !
ptr[0],
"memory wasn't zeroed\n" );
398 ok( ptr1 ==
ptr,
"HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY failed, error %lu\n",
GetLastError() );
400 ok( ptr1 ==
ptr,
"HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY failed, error %lu\n",
GetLastError() );
407 ok( !
size && !
ptr[0],
"memory wasn't zeroed\n" );
414 ok( !
size && !
ptr[0],
"memory wasn't zeroed\n" );
418 ok( ptr1 ==
ptr,
"HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY failed, error %lu\n",
GetLastError() );
422 ok( ptr1 !=
ptr,
"HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY succeeded\n" );
447 ok(
FALSE,
"FIXME: The rest of this test crashes on ReactOS!\n");
454 ok(
size == alloc_size - (0x400 + 0x100 *
sizeof(
void *)),
460 ptr1 =
HeapAlloc(
heap, 0, alloc_size - (0x200 + 0x80 *
sizeof(
void *)) );
461 ok( !ptr1,
"HeapAlloc succeeded\n" );
485 ok( !ptr1,
"HeapAlloc succeeded\n" );
500 ok( !ptr1,
"HeapAlloc succeeded\n" );
516 ok( !
size && !
ptr[0],
"memory wasn't zeroed\n" );
523 ok( !
size && !
ptr[0],
"memory wasn't zeroed\n" );
526 ok( ptr1 ==
ptr,
"HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY failed, error %lu\n",
GetLastError() );
528 ok( ptr1 ==
ptr,
"HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY failed, error %lu\n",
GetLastError() );
541 memset( &rtl_entries, 0,
sizeof(rtl_entries) );
542 memset( &rtl_entry, 0xcd,
sizeof(rtl_entry) );
553 memset( &entries, 0,
sizeof(entries) );
568 ok( rtl_entries[
i].lpData == entries[
i].lpData,
"got lpData %p\n", rtl_entries[
i].lpData );
570 ok( rtl_entries[
i].cbOverhead == entries[
i].cbOverhead,
"got cbOverhead %#x\n", rtl_entries[
i].cbOverhead );
571 ok( rtl_entries[
i].iRegionIndex == entries[
i].iRegionIndex,
"got iRegionIndex %#x\n", rtl_entries[
i].iRegionIndex );
573 ok( rtl_entries[
i].
wFlags == 0,
"got wFlags %#x\n", rtl_entries[
i].
wFlags );
580 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
583 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
587 ok( rtl_entries[
i].
Region.dwCommittedSize == entries[
i].
Region.dwCommittedSize,
588 "got Region.dwCommittedSize %#lx\n", rtl_entries[
i].
Region.dwCommittedSize );
589 ok( rtl_entries[
i].
Region.dwUnCommittedSize == entries[
i].
Region.dwUnCommittedSize,
590 "got Region.dwUnCommittedSize %#lx\n", rtl_entries[
i].
Region.dwUnCommittedSize );
592 "got Region.lpFirstBlock %p\n", rtl_entries[
i].
Region.lpFirstBlock );
594 "got Region.lpLastBlock %p\n", rtl_entries[
i].
Region.lpLastBlock );
603 ok( entries[0].lpData ==
heap,
"got lpData %p\n", entries[0].lpData );
604 ok( entries[0].
cbData <= 0x1000 ,
"got cbData %#lx\n", entries[0].
cbData );
605 ok( entries[0].cbOverhead == 0,
"got cbOverhead %#x\n", entries[0].cbOverhead );
606 ok( entries[0].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[0].iRegionIndex );
608 ok( entries[0].
Region.dwCommittedSize == 0x400 *
sizeof(
void *),
609 "got Region.dwCommittedSize %#lx\n", entries[0].
Region.dwCommittedSize );
610 ok( entries[0].
Region.dwUnCommittedSize == 0x10000 - entries[0].
Region.dwCommittedSize ||
611 entries[0].
Region.dwUnCommittedSize == 0x10000 *
sizeof(
void *) - entries[0].
Region.dwCommittedSize ,
612 "got Region.dwUnCommittedSize %#lx\n", entries[0].
Region.dwUnCommittedSize );
616 "got Region.lpFirstBlock %p\n", entries[0].
Region.lpFirstBlock );
618 "got Region.lpLastBlock %p\n", entries[0].
Region.lpLastBlock );
620 ok( entries[1].
wFlags == 0,
"got wFlags %#x\n", entries[1].
wFlags );
621 ok( entries[1].lpData !=
NULL,
"got lpData %p\n", entries[1].lpData );
622 ok( entries[1].
cbData != 0,
"got cbData %#lx\n", entries[1].
cbData );
623 ok( entries[1].cbOverhead == 4 *
sizeof(
void *),
"got cbOverhead %#x\n", entries[1].cbOverhead );
624 ok( entries[1].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[1].iRegionIndex );
627 ok( entries[2].lpData == (
BYTE *)entries[0].lpData + entries[0].
Region.dwCommittedSize,
628 "got lpData %p\n", entries[2].
lpData );
629 ok( entries[2].lpData == (
BYTE *)entries[1].lpData + entries[1].
cbData + 2 * entries[1].cbOverhead,
630 "got lpData %p\n", entries[2].lpData );
631 ok( entries[2].
cbData == entries[0].
Region.dwUnCommittedSize - 0x1000 ||
632 entries[2].
cbData == entries[0].
Region.dwUnCommittedSize ,
633 "got cbData %#lx\n", entries[2].
cbData );
634 ok( entries[2].cbOverhead == 0,
"got cbOverhead %#x\n", entries[2].cbOverhead );
635 ok( entries[2].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[2].iRegionIndex );
644 memset( &rtl_entries, 0,
sizeof(rtl_entries) );
645 memset( &rtl_entry, 0xcd,
sizeof(rtl_entry) );
667 ok( !
memcmp( entries + 16, entries, 3 *
sizeof(
entry) ),
"entries differ\n" );
672 ok( rtl_entries[
i].lpData == entries[
i].lpData,
"got lpData %p\n", rtl_entries[
i].lpData );
674 ok( rtl_entries[
i].cbOverhead == entries[
i].cbOverhead,
"got cbOverhead %#x\n", rtl_entries[
i].cbOverhead );
675 ok( rtl_entries[
i].iRegionIndex == entries[
i].iRegionIndex,
"got iRegionIndex %#x\n", rtl_entries[
i].iRegionIndex );
677 ok( rtl_entries[
i].
wFlags == 0,
"got wFlags %#x\n", rtl_entries[
i].
wFlags );
684 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
687 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
691 ok( rtl_entries[
i].
Region.dwCommittedSize == entries[
i].
Region.dwCommittedSize,
692 "got Region.dwCommittedSize %#lx\n", rtl_entries[
i].
Region.dwCommittedSize );
693 ok( rtl_entries[
i].
Region.dwUnCommittedSize == entries[
i].
Region.dwUnCommittedSize,
694 "got Region.dwUnCommittedSize %#lx\n", rtl_entries[
i].
Region.dwUnCommittedSize );
696 "got Region.lpFirstBlock %p\n", rtl_entries[
i].
Region.lpFirstBlock );
698 "got Region.lpLastBlock %p\n", rtl_entries[
i].
Region.lpLastBlock );
709 "got wFlags %#x\n", entries[3].
wFlags );
713 ok( entries[3].lpData ==
ptr,
"got lpData %p\n", entries[3].lpData );
714 ok( entries[3].
cbData == 5 * alloc_size,
"got cbData %#lx\n", entries[3].
cbData );
718 ok( entries[3].cbOverhead == 0 || entries[3].cbOverhead == 8 *
sizeof(
void *) ,
719 "got cbOverhead %#x\n", entries[3].cbOverhead );
721 ok( entries[3].iRegionIndex == 64 ||
broken(entries[3].iRegionIndex == 0) ,
"got iRegionIndex %d\n", entries[3].iRegionIndex );
723 ok( entries[3].iRegionIndex == 64,
"got iRegionIndex %d\n", entries[3].iRegionIndex );
730 memset( &rtl_entries, 0,
sizeof(rtl_entries) );
731 memset( &rtl_entry, 0xcd,
sizeof(rtl_entry) );
753 ok( !
memcmp( entries + 16, entries, 4 *
sizeof(
entry) ),
"entries differ\n" );
758 ok( rtl_entries[
i].lpData == entries[
i].lpData,
"got lpData %p\n", rtl_entries[
i].lpData );
760 ok( rtl_entries[
i].cbOverhead == entries[
i].cbOverhead,
"got cbOverhead %#x\n", rtl_entries[
i].cbOverhead );
761 ok( rtl_entries[
i].iRegionIndex == entries[
i].iRegionIndex,
"got iRegionIndex %#x\n", rtl_entries[
i].iRegionIndex );
763 ok( rtl_entries[
i].
wFlags == 0,
"got wFlags %#x\n", rtl_entries[
i].
wFlags );
770 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
773 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
777 ok( rtl_entries[
i].
Region.dwCommittedSize == entries[
i].
Region.dwCommittedSize,
778 "got Region.dwCommittedSize %#lx\n", rtl_entries[
i].
Region.dwCommittedSize );
779 ok( rtl_entries[
i].
Region.dwUnCommittedSize == entries[
i].
Region.dwUnCommittedSize,
780 "got Region.dwUnCommittedSize %#lx\n", rtl_entries[
i].
Region.dwUnCommittedSize );
782 "got Region.lpFirstBlock %p\n", rtl_entries[
i].
Region.lpFirstBlock );
784 "got Region.lpLastBlock %p\n", rtl_entries[
i].
Region.lpLastBlock );
791 "got wFlags %#x\n", entries[4].
wFlags );
795 ok( entries[4].lpData == ptr1,
"got lpData %p\n", entries[4].lpData );
796 ok( entries[4].
cbData == 5 * alloc_size,
"got cbData %#lx\n", entries[4].
cbData );
797 ok( entries[4].cbOverhead == 0 || entries[4].cbOverhead == 8 *
sizeof(
void *) ,
798 "got cbOverhead %#x\n", entries[4].cbOverhead );
799 ok( entries[4].iRegionIndex == 64,
"got iRegionIndex %d\n", entries[4].iRegionIndex );
818 ok( !
memcmp( entries + 16, entries, 3 *
sizeof(
entry) ),
"entries differ\n" );
835 ok( !
memcmp( entries + 16, entries, 1 *
sizeof(
entry) ),
"entries differ\n" );
836 ok(
memcmp( entries + 17, entries + 2, 2 *
sizeof(
entry) ),
"entries differ\n" );
842 ok( entries[1].lpData ==
ptr,
"got lpData %p\n", entries[1].lpData );
843 ok( entries[1].
cbData == 123,
"got cbData %#lx\n", entries[1].
cbData );
844 ok( entries[1].cbOverhead != 0,
"got cbOverhead %#x\n", entries[1].cbOverhead );
845 ok( entries[1].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[1].iRegionIndex );
847 ok( entries[2].
wFlags == 0,
"got wFlags %#x\n", entries[2].
wFlags );
848 ok( entries[2].lpData == (
BYTE *)entries[1].lpData + entries[1].
cbData + entries[1].cbOverhead + 2 *
sizeof(
void *),
849 "got lpData %p\n", entries[2].lpData );
850 ok( entries[2].
cbData != 0,
"got cbData %#lx\n", entries[2].
cbData );
851 ok( entries[2].cbOverhead == 4 *
sizeof(
void *),
"got cbOverhead %#x\n", entries[2].cbOverhead );
852 ok( entries[2].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[2].iRegionIndex );
855 ok( entries[3].lpData == (
BYTE *)entries[0].lpData + entries[0].
Region.dwCommittedSize,
856 "got lpData %p\n", entries[3].
lpData );
857 ok( entries[3].lpData == (
BYTE *)entries[2].lpData + entries[2].
cbData + 2 * entries[2].cbOverhead,
858 "got lpData %p\n", entries[3].lpData );
859 ok( entries[3].
cbData == entries[0].
Region.dwUnCommittedSize - 0x1000 ||
860 entries[3].
cbData == entries[0].
Region.dwUnCommittedSize ,
861 "got cbData %#lx\n", entries[3].
cbData );
862 ok( entries[3].cbOverhead == 0,
"got cbOverhead %#x\n", entries[3].cbOverhead );
863 ok( entries[3].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[3].iRegionIndex );
883 ok( !
memcmp( entries + 16, entries, 2 *
sizeof(
entry) ),
"entries differ\n" );
884 ok(
memcmp( entries + 18, entries + 3, 2 *
sizeof(
entry) ),
"entries differ\n" );
890 ok( entries[2].lpData == ptr1,
"got lpData %p\n", entries[2].lpData );
891 ok( entries[2].
cbData == 456,
"got cbData %#lx\n", entries[2].
cbData );
892 ok( entries[2].cbOverhead != 0,
"got cbOverhead %#x\n", entries[2].cbOverhead );
893 ok( entries[2].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[2].iRegionIndex );
895 ok( entries[3].
wFlags == 0,
"got wFlags %#x\n", entries[3].
wFlags );
896 ok( entries[3].lpData == (
BYTE *)entries[2].lpData + entries[2].
cbData + entries[2].cbOverhead + 2 *
sizeof(
void *),
897 "got lpData %p\n", entries[3].lpData );
898 ok( entries[3].
cbData != 0,
"got cbData %#lx\n", entries[3].
cbData );
899 ok( entries[3].cbOverhead == 4 *
sizeof(
void *),
"got cbOverhead %#x\n", entries[3].cbOverhead );
900 ok( entries[3].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[3].iRegionIndex );
903 ok( entries[4].lpData == (
BYTE *)entries[0].lpData + entries[0].
Region.dwCommittedSize,
904 "got lpData %p\n", entries[4].
lpData );
905 ok( entries[4].lpData == (
BYTE *)entries[3].lpData + entries[3].
cbData + 2 * entries[3].cbOverhead,
906 "got lpData %p\n", entries[4].lpData );
907 ok( entries[4].
cbData == entries[0].
Region.dwUnCommittedSize - 0x1000 ||
908 entries[4].
cbData == entries[0].
Region.dwUnCommittedSize ,
909 "got cbData %#lx\n", entries[4].
cbData );
910 ok( entries[4].cbOverhead == 0,
"got cbOverhead %#x\n", entries[4].cbOverhead );
911 ok( entries[4].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[4].iRegionIndex );
927 ok( !
ret,
"HeapQueryInformation succeeded\n" );
937 ok( !
ret,
"HeapQueryInformation succeeded\n" );
943 ok( !
ret,
"HeapQueryInformation succeeded\n" );
947 compat_info = 0xdeadbeef;
950 ok( compat_info == 0,
"got compat_info %lu\n", compat_info );
965 ok( compat_info == 0 ||
broken(compat_info == 1) ,
"got HeapCompatibilityInformation %lu\n", compat_info );
967 ok( compat_info == 0,
"got HeapCompatibilityInformation %lu\n", compat_info );
975 ok( compat_info == 2,
"got HeapCompatibilityInformation %lu\n", compat_info );
982 ok( !
ret,
"HeapSetInformation succeeded\n" );
987 ok( !
ret,
"HeapSetInformation succeeded\n" );
991 ok( compat_info == 2,
"got HeapCompatibilityInformation %lu\n", compat_info );
1005 ok( compat_info == 0,
"got HeapCompatibilityInformation %lu\n", compat_info );
1010 ok( !
ret,
"HeapSetInformation succeeded\n" );
1018 ok( compat_info == 0,
"got HeapCompatibilityInformation %lu\n", compat_info );
1033 ok( compat_info == 0 ||
broken(compat_info == 1) ,
"got HeapCompatibilityInformation %lu\n", compat_info );
1035 ok( compat_info == 0,
"got HeapCompatibilityInformation %lu\n", compat_info );
1038 for (
i = 0;
i < 0x12;
i++) ptrs[
i] = pHeapAlloc(
heap, 0, 0 );
1044 ok( compat_info == 2 ||
broken(compat_info == 1) ,
"got HeapCompatibilityInformation %lu\n", compat_info );
1046 ok( compat_info == 2,
"got HeapCompatibilityInformation %lu\n", compat_info );
1064 ok( compat_info == 2,
"got HeapCompatibilityInformation %lu\n", compat_info );
1066 for (
i = 0;
i < 0x11;
i++) ptrs[
i] = pHeapAlloc(
heap, 0, 24 + 2 *
sizeof(
void *) );
1070 memset( &entries, 0xcd,
sizeof(entries) );
1086 ok( entries[0].lpData ==
heap,
"got lpData %p\n", entries[0].lpData );
1087 ok( entries[0].
cbData <= 0x1000 ,
"got cbData %#lx\n", entries[0].
cbData );
1088 ok( entries[0].cbOverhead == 0,
"got cbOverhead %#x\n", entries[0].cbOverhead );
1089 ok( entries[0].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[0].iRegionIndex );
1090 ok( entries[1].
wFlags == 0,
"got wFlags %#x\n", entries[1].
wFlags );
1096 for (
i = 0;
i < 0x12;
i++) ptrs[
i] = pHeapAlloc(
heap, 0, 24 + 2 *
sizeof(
void *) );
1100 memset( &entries, 0xcd,
sizeof(entries) );
1117 ok( entries[0].lpData ==
heap,
"got lpData %p\n", entries[0].lpData );
1118 ok( entries[0].
cbData <= 0x1000 ,
"got cbData %#lx\n", entries[0].
cbData );
1119 ok( entries[0].cbOverhead == 0,
"got cbOverhead %#x\n", entries[0].cbOverhead );
1120 ok( entries[0].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[0].iRegionIndex );
1122 ok( entries[1].
wFlags == 0,
"got wFlags %#x\n", entries[1].
wFlags );
1124 for (
i = 0;
i < 0x12;
i++)
1127 ok( entries[4 +
i].
wFlags == 0,
"got wFlags %#x\n", entries[4 +
i].
wFlags );
1129 ok( entries[4 +
i].
cbData == 0x20,
"got cbData %#lx\n", entries[4 +
i].
cbData );
1131 ok( entries[4 +
i].cbOverhead == 2 *
sizeof(
void *),
"got cbOverhead %#x\n", entries[4 +
i].cbOverhead );
1143 memset( &rtl_entries, 0,
sizeof(rtl_entries) );
1144 memset( &rtl_entry, 0xcd,
sizeof(rtl_entry) );
1158 ok( rtl_entries[
i].lpData == entries[
i].lpData,
"got lpData %p\n", rtl_entries[
i].lpData );
1160 ok( rtl_entries[
i].cbOverhead == entries[
i].cbOverhead,
"got cbOverhead %#x\n", rtl_entries[
i].cbOverhead );
1161 ok( rtl_entries[
i].iRegionIndex == entries[
i].iRegionIndex,
"got iRegionIndex %#x\n", rtl_entries[
i].iRegionIndex );
1166 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
1169 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
1173 ok( rtl_entries[
i].
Region.dwCommittedSize == entries[
i].
Region.dwCommittedSize,
1174 "got Region.dwCommittedSize %#lx\n", rtl_entries[
i].
Region.dwCommittedSize );
1175 ok( rtl_entries[
i].
Region.dwUnCommittedSize == entries[
i].
Region.dwUnCommittedSize,
1176 "got Region.dwUnCommittedSize %#lx\n", rtl_entries[
i].
Region.dwUnCommittedSize );
1178 "got Region.lpFirstBlock %p\n", rtl_entries[
i].
Region.lpFirstBlock );
1180 "got Region.lpLastBlock %p\n", rtl_entries[
i].
Region.lpLastBlock );
1185 for (
i = 0;
i < 0x12;
i++) ptrs[
i] = pHeapAlloc(
heap, 0, 24 + 2 *
sizeof(
void *) );
1188 memset( &entries, 0xcd,
sizeof(entries) );
1202 ok( entries[0].lpData ==
heap,
"got lpData %p\n", entries[0].lpData );
1203 ok( entries[0].
cbData <= 0x1000 ,
"got cbData %#lx\n", entries[0].
cbData );
1204 ok( entries[0].cbOverhead == 0,
"got cbOverhead %#x\n", entries[0].cbOverhead );
1205 ok( entries[0].iRegionIndex == 0,
"got iRegionIndex %d\n", entries[0].iRegionIndex );
1212 ok( entries[
i].
cbData == 0x18 + 2 *
sizeof(
void *),
"got cbData %#lx\n", entries[
i].
cbData );
1213 ok( entries[
i].cbOverhead == 0x8,
"got cbOverhead %#x\n", entries[
i].cbOverhead );
1225 memset( &rtl_entries, 0,
sizeof(rtl_entries) );
1226 memset( &rtl_entry, 0xcd,
sizeof(rtl_entry) );
1237 ok( rtl_entries[
i].lpData == entries[
i].lpData,
"got lpData %p\n", rtl_entries[
i].lpData );
1239 ok( rtl_entries[
i].cbOverhead == entries[
i].cbOverhead,
"got cbOverhead %#x\n", rtl_entries[
i].cbOverhead );
1240 ok( rtl_entries[
i].iRegionIndex == entries[
i].iRegionIndex,
"got iRegionIndex %#x\n", rtl_entries[
i].iRegionIndex );
1247 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
1251 "got wFlags %#x\n", rtl_entries[
i].
wFlags );
1255 ok( rtl_entries[
i].
Region.dwCommittedSize == entries[
i].
Region.dwCommittedSize,
1256 "got Region.dwCommittedSize %#lx\n", rtl_entries[
i].
Region.dwCommittedSize );
1257 ok( rtl_entries[
i].
Region.dwUnCommittedSize == entries[
i].
Region.dwUnCommittedSize,
1258 "got Region.dwUnCommittedSize %#lx\n", rtl_entries[
i].
Region.dwUnCommittedSize );
1260 "got Region.lpFirstBlock %p\n", rtl_entries[
i].
Region.lpFirstBlock );
1262 "got Region.lpLastBlock %p\n", rtl_entries[
i].
Region.lpLastBlock );
1283 thread_params.
flags = 0;
1294 thread_params.
flags = 0;
1315 thread_params.
flags = 0;
1328 thread_params.
flags = 0;
1361 ok( compat_info == 0 ||
broken(compat_info == 1) ,
"got HeapCompatibilityInformation %lu\n", compat_info );
1363 ok( compat_info == 0,
"got HeapCompatibilityInformation %lu\n", compat_info );
1366 for (
i = 0;
i < 0x12;
i++) ptrs[
i] = pHeapAlloc(
heap, 0, 0 );
1372 ok( compat_info == 2 ||
broken(compat_info == 1) ,
"got HeapCompatibilityInformation %lu\n", compat_info );
1374 ok( compat_info == 2,
"got HeapCompatibilityInformation %lu\n", compat_info );
1383 thread_params.
flags = 0;
1398 thread_params.
flags = 0;
1436 return ((
UINT_PTR)
handle & ((
sizeof(
void *) << 1) - 1)) ==
sizeof(
void *);
1441 static const UINT flags_tests[] =
1452 static const UINT realloc_flags_tests[] =
1463 static const char zero_buffer[100000] = {0};
1466 SIZE_T size, alloc_size, small_size = 12, nolfh_size = 0x20000;
1481 ok( !
mem,
"GlobalReAlloc succeeded\n" );
1490 memset( &walk_entry, 0xcd,
sizeof(walk_entry) );
1505 ok( !
mem,
"GlobalAlloc succeeded\n" );
1509 ok( !
mem,
"LocalAlloc succeeded\n" );
1524 for (
i = 0;
i < 0x12;
i++) globals[
i] = pGlobalAlloc(
GMEM_FIXED, small_size );
1525 for (
i = 0;
i < 0x12;
i++) pGlobalFree( globals[
i] );
1532 ok(
size >= 10 &&
size <= 16,
"GlobalSize returned %Iu\n",
size );
1536 ok(
size == 0,
"GlobalSize returned %Iu\n",
size );
1540 ok(
size >= 10 &&
size <= 16,
"GlobalSize returned %Iu\n",
size );
1541 tmp_mem = pGlobalFree(
mem );
1542 ok( !tmp_mem,
"GlobalFree failed, error %lu\n",
GetLastError() );
1544 ok(
size == 0,
"GlobalSize returned %Iu\n",
size );
1550 ok(
size == 0,
"GlobalSize returned %Iu\n",
size );
1552 ok( !
ret,
"HeapValidate succeeded\n" );
1553 ok(
entry->flags == 0xf,
"got unexpected flags %#Ix\n",
entry->flags );
1554 ok( !
entry->ptr,
"got unexpected ptr %p\n",
entry->ptr );
1562 ok(
size == 0,
"GlobalSize returned %Iu\n",
size );
1564 ok( !
ret,
"HeapValidate succeeded\n" );
1565 ok(
entry->flags == 0xb,
"got unexpected flags %#Ix\n",
entry->flags );
1566 ok( !
entry->ptr,
"got unexpected ptr %p\n",
entry->ptr );
1570 for (alloc_size = 1; alloc_size < 0x10000000; alloc_size <<= 5)
1576 ok( !((
UINT_PTR)
mem &
sizeof(
void *)),
"got unexpected ptr align\n" );
1577 ok( !((
UINT_PTR)
mem & (
sizeof(
void *) - 1)),
"got unexpected ptr align\n" );
1581 ok( !tmp_mem,
"GlobalFree failed, error %lu\n",
GetLastError() );
1585 ok( ((
UINT_PTR)
mem &
sizeof(
void *)),
"got unexpected entry align\n" );
1586 ok( !((
UINT_PTR)
mem & (
sizeof(
void *) - 1)),
"got unexpected entry align\n" );
1590 ok( !
ret,
"HeapValidate succeeded\n" );
1594 ok(
size == alloc_size,
"HeapSize returned %Iu\n",
size );
1596 tmp_mem = invalid_mem;
1597 tmp_flags = 0xdeadbeef;
1600 ok( tmp_mem ==
mem,
"got user ptr %p\n", tmp_mem );
1601 ok( tmp_flags == 0x200,
"got user flags %#lx\n", tmp_flags );
1606 ok( tmp_mem == invalid_mem,
"GlobalHandle returned unexpected handle\n" );
1614 ok( !((
UINT_PTR)
ptr &
sizeof(
void *)),
"got unexpected ptr align\n" );
1615 ok( !((
UINT_PTR)
ptr & (
sizeof(
void *) - 1)),
"got unexpected ptr align\n" );
1616 for (
i = 1;
i < 0xff; ++
i)
1618 ok(
entry->flags == ((
i<<16)|3),
"got unexpected flags %#Ix\n",
entry->flags );
1624 ok(
entry->flags == 0xff0003,
"got unexpected flags %#Ix\n",
entry->flags );
1625 for (
i = 1;
i < 0xff; ++
i)
1632 ok(
entry->flags == 0x3,
"got unexpected flags %#Ix\n",
entry->flags );
1634 tmp_mem = pGlobalFree(
mem );
1635 ok( !tmp_mem,
"GlobalFree failed, error %lu\n",
GetLastError() );
1636 ok( !!
entry->flags,
"got unexpected flags %#Ix\n",
entry->flags );
1637 ok( !((
UINT_PTR)
entry->flags &
sizeof(
void *)),
"got unexpected ptr align\n" );
1638 ok( !((
UINT_PTR)
entry->flags & (
sizeof(
void *) - 1)),
"got unexpected ptr align\n" );
1639 ok( !
entry->ptr,
"got unexpected ptr %p\n",
entry->ptr );
1644 ok(
entry->flags == 0xf,
"got unexpected flags %#Ix\n",
entry->flags );
1645 ok( !
entry->ptr,
"got unexpected ptr %p\n",
entry->ptr );
1654 ok(
entry->flags == 0x7,
"got unexpected flags %#Ix\n",
entry->flags );
1655 ok( !!
entry->ptr,
"got unexpected ptr %p\n",
entry->ptr );
1664 ok(
entry->flags == 0x8007,
"got unexpected flags %#Ix\n",
entry->flags );
1665 ok( !!
entry->ptr,
"got unexpected ptr %p\n",
entry->ptr );
1680 ok( tmp_mem ==
mem,
"GlobalHandle returned unexpected handle\n" );
1684 ok( !!tmp_ptr,
"GlobalLock failed, error %lu\n",
GetLastError() );
1685 ok( tmp_ptr ==
ptr,
"got ptr %p, expected %p\n", tmp_ptr,
ptr );
1694 ok( !
ret,
"GlobalUnlock succeeded\n" );
1700 ok( !
ret,
"GlobalUnlock succeeded\n" );
1703 ok( !tmp_mem,
"GlobalFree failed, error %lu\n",
GetLastError() );
1707 tmp_mem = pGlobalFree(
mem );
1708 ok( !tmp_mem,
"GlobalFree failed, error %lu\n",
GetLastError() );
1709 if (
sizeof(
void *) != 8)
1712 tmp_mem = pGlobalFree(
mem );
1713 ok( tmp_mem ==
mem,
"GlobalFree succeeded\n" );
1718 ok(
size == 0,
"GlobalSize succeeded\n" );
1725 tmp_mem = pGlobalFree(
mem );
1726 ok( !tmp_mem,
"GlobalFree failed, error %lu\n",
GetLastError() );
1728 tmp_mem = pGlobalFree(
mem );
1729 ok( tmp_mem ==
mem,
"GlobalFree succeeded\n" );
1737 ok(
size == 0,
"GlobalSize succeeded\n" );
1741 ok( !
ptr,
"GlobalLock succeeded\n" );
1750 ok( !tmp_mem,
"GlobalReAlloc succeeded\n" );
1755 if (
sizeof(
void *) != 8)
1760 ok( !tmp_mem,
"GlobalHandle succeeded\n" );
1766 ok(
FALSE,
"FIXME: invalid handle and invalid pointer tests crash on ReactOS!\n");
1771 tmp_mem = pGlobalFree( invalid_mem );
1772 ok( tmp_mem == invalid_mem,
"GlobalFree succeeded\n" );
1780 ok(
size == 0,
"GlobalSize succeeded\n" );
1784 ok( !
ptr,
"GlobalLock succeeded\n" );
1793 ok( !tmp_mem,
"GlobalReAlloc succeeded\n" );
1795 if (
sizeof(
void *) != 8)
1799 ok( !tmp_mem,
"GlobalHandle succeeded\n" );
1802 ret = pRtlGetUserInfoHeap(
GetProcessHeap(), 0, invalid_mem, (
void **)&tmp_ptr, &tmp_flags );
1813 tmp_mem = pGlobalFree( invalid_ptr );
1814 ok( tmp_mem == invalid_ptr,
"GlobalFree succeeded\n" );
1829 ok(
size == 0,
"GlobalSize succeeded\n" );
1833 ok( !
ptr,
"GlobalLock succeeded\n" );
1842 ok( !tmp_mem,
"GlobalReAlloc succeeded\n" );
1847 ok( !tmp_mem,
"GlobalHandle succeeded\n" );
1852 ret = pRtlGetUserInfoHeap(
GetProcessHeap(), 0, invalid_ptr, (
void **)&tmp_ptr, &tmp_flags );
1864 ok( !!tmp_mem,
"GlobalAlloc failed, error %lu\n",
GetLastError() );
1865 ok( tmp_mem ==
mem,
"got ptr %p, expected %p\n", tmp_mem,
mem );
1867 ok(
size == small_size,
"GlobalSize returned %Iu\n",
size );
1873 ok( !tmp_mem,
"GlobalReAlloc succeeded\n" );
1878 if (tmp_mem)
mem = tmp_mem;
1880 ok( !!tmp_mem,
"GlobalAlloc failed, error %lu\n",
GetLastError() );
1881 ok( tmp_mem ==
mem,
"got ptr %p, expected %p\n", tmp_mem,
mem );
1883 ok(
size == small_size,
"GlobalSize returned %Iu\n",
size );
1891 ok( !!tmp_mem,
"GlobalReAlloc failed, error %lu\n",
GetLastError() );
1895 ok( tmp_mem !=
mem,
"GlobalReAlloc didn't relocate memory\n" );
1898 ok(
ptr == tmp_mem,
"got ptr %p, expected %p\n",
ptr, tmp_mem );
1910 BOOL expect_convert;
1912 flags = realloc_flags_tests[
i];
1922 if (!expect_convert)
1924 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
1927 else ok( tmp_mem !=
mem,
"GlobalReAlloc returned %p\n", tmp_mem );
1931 ok(
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
1935 else ok( (
entry.flags & 0x7fff) == 0x3,
"got flags %#Ix\n",
entry.flags );
1937 if (tmp_mem)
mem = tmp_mem;
1941 else ok(
size == small_size,
"GlobalSize returned %Iu\n",
size );
1952 if (!expect_convert)
1954 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
1956 else ok( tmp_mem ==
mem,
"GlobalReAlloc returned %p\n", tmp_mem );
1960 ok(
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
1964 else ok( (
entry.flags & 0x7fff) == 0x3,
"got flags %#Ix\n",
entry.flags );
1966 if (tmp_mem)
mem = tmp_mem;
1970 else ok(
size == nolfh_size + 512,
"GlobalSize returned %Iu\n",
size );
1981 if (!expect_convert)
1983 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
1986 else todo_wine ok( tmp_mem !=
mem,
"GlobalReAlloc returned %p\n", tmp_mem );
1990 ok(
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
1994 else ok( (
entry.flags & 0x7fff) == 0x3,
"got flags %#Ix\n",
entry.flags );
1996 if (tmp_mem)
mem = tmp_mem;
2011 if (!expect_convert)
2013 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2015 else ok( tmp_mem ==
mem,
"GlobalReAlloc returned %p\n", tmp_mem );
2019 ok(
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2023 else ok( (
entry.flags & 0x7fff) == 0x3,
"got flags %#Ix\n",
entry.flags );
2025 if (tmp_mem)
mem = tmp_mem;
2029 else ok(
size == 10,
"GlobalSize returned %Iu\n",
size );
2040 if (!expect_convert)
2042 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2045 else ok( tmp_mem !=
mem,
"GlobalReAlloc returned %p\n", tmp_mem );
2049 ok(
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2053 else ok( (
entry.flags & 0x7fff) == 0x3,
"got flags %#Ix\n",
entry.flags );
2055 if (tmp_mem)
mem = tmp_mem;
2059 else ok(
size == small_size,
"GlobalSize returned %Iu\n",
size );
2070 if (!expect_convert)
2072 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2074 else ok( tmp_mem ==
mem,
"GlobalReAlloc returned %p\n", tmp_mem );
2078 ok(
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2082 else ok( (
entry.flags & 0x7fff) == 0x3,
"got flags %#Ix\n",
entry.flags );
2084 if (tmp_mem)
mem = tmp_mem;
2108 else ok( !tmp_mem,
"GlobalReAlloc succeeded\n" );
2125 else ok(
size == small_size,
"GlobalSize returned %Iu\n",
size );
2129 ok( !
ret,
"GlobalUnlock succeeded\n" );
2144 else ok( tmp_mem ==
mem,
"GlobalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
2147 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
2152 else ok(
size == 10,
"GlobalSize returned %Iu\n",
size );
2155 ok( !
ret,
"GlobalUnlock succeeded\n" );
2169 else ok( !tmp_mem,
"GlobalReAlloc succeeded\n" );
2172 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
2176 ok(
size == small_size,
"GlobalSize returned %Iu\n",
size );
2179 ok( !
ret,
"GlobalUnlock succeeded\n" );
2192 else ok( tmp_mem ==
mem,
"GlobalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
2199 else ok(
entry.ptr != expect_entry.
ptr,
"got unexpected ptr %p\n",
entry.ptr );
2205 else ok(
size == 512,
"GlobalSize returned %Iu\n",
size );
2219 else ok( tmp_mem ==
mem,
"GlobalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
2222 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
2227 else ok(
size == 10,
"GlobalSize returned %Iu\n",
size );
2242 else ok( tmp_mem ==
mem,
"GlobalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
2246 expect_entry.
flags |= 8;
2250 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
2255 else ok(
size == small_size,
"GlobalSize returned %Iu\n",
size );
2273 memset( &walk_entry, 0xcd,
sizeof(walk_entry) );
2294 ok( tmp_mem ==
mem,
"GlobalHandle returned unexpected handle\n" );
2301 ok(
size == 1,
"GlobalSize returned %Iu\n",
size );
2310 ok( !
ptr,
"GlobalLock succeeded\n" );
2334 ok(
mem !=
ptr,
"GlobalReAlloc returned unexpected handle\n" );
2346 ok( !!tmp_mem,
"GlobalReAlloc failed\n" );
2348 "GlobalReAlloc returned unexpected handle\n" );
2358 "GlobalReAlloc didn't clear memory\n" );
2361 ok( tmp_mem ==
mem,
"GlobalHandle returned unexpected handle\n" );
2365 ok( !tmp_mem,
"GlobalDiscard succeeded\n" );
2389 ok( !!tmp_mem,
"GlobalHandle failed, error %lu\n",
GetLastError() );
2390 ok( tmp_mem ==
ptr,
"GlobalHandle returned unexpected handle\n" );
2391 tmp_ptr = (
void *)0xdeadbeef;
2392 tmp_flags = 0xdeadbeef;
2395 ok( tmp_ptr == (
void *)0xdeadbeef,
"got user value %p\n", tmp_ptr );
2396 ok( tmp_flags == 0,
"got user flags %#lx\n", tmp_flags );
2403 static const UINT flags_tests[] =
2412 static const UINT realloc_flags_tests[] =
2423 static const char zero_buffer[100000] = {0};
2427 SIZE_T size, small_size = 12, nolfh_size = 0x20000;
2438 ok( !
mem,
"LocalReAlloc succeeded\n" );
2449 ok( !
mem,
"LocalAlloc succeeded\n" );
2453 ok( !
mem,
"GlobalAlloc succeeded\n" );
2468 for (
i = 0;
i < 0x12;
i++) locals[
i] = pLocalAlloc(
LMEM_FIXED, small_size );
2476 ok(
size >= 10 &&
size <= 16,
"LocalSize returned %Iu\n",
size );
2480 ok(
size == 0,
"LocalSize returned %Iu\n",
size );
2484 ok(
size >= 10 &&
size <= 16,
"LocalSize returned %Iu\n",
size );
2485 tmp_mem = pLocalFree(
mem );
2488 ok(
size == 0,
"LocalSize returned %Iu\n",
size );
2496 ok( tmp_mem ==
mem,
"LocalHandle returned unexpected handle\n" );
2500 ok( !!tmp_ptr,
"LocalLock failed, error %lu\n",
GetLastError() );
2501 ok( tmp_ptr ==
ptr,
"got ptr %p, expected %p\n", tmp_ptr,
ptr );
2510 ok( !
ret,
"LocalUnlock succeeded\n" );
2516 ok( !
ret,
"LocalUnlock succeeded\n" );
2524 tmp_mem = pLocalFree(
mem );
2527 tmp_mem = pLocalFree(
mem );
2528 ok( tmp_mem ==
mem,
"LocalFree succeeded\n" );
2536 ok(
size == 0,
"LocalSize succeeded\n" );
2540 ok( !
ptr,
"LocalLock succeeded\n" );
2544 ok( !
ret,
"LocalUnlock succeeded\n" );
2548 ok( !tmp_mem,
"LocalReAlloc succeeded\n" );
2550 if (
sizeof(
void *) != 8)
2554 ok( !tmp_mem,
"LocalHandle succeeded\n" );
2560 ok(
FALSE,
"FIXME: invalid handle and invalid pointer tests crash on ReactOS!\n");
2565 tmp_mem = pLocalFree( invalid_mem );
2566 ok( tmp_mem == invalid_mem,
"LocalFree succeeded\n" );
2574 ok(
size == 0,
"LocalSize succeeded\n" );
2578 ok( !
ptr,
"LocalLock succeeded\n" );
2582 ok( !
ret,
"LocalUnlock succeeded\n" );
2586 ok( !tmp_mem,
"LocalReAlloc succeeded\n" );
2588 if (
sizeof(
void *) != 8)
2592 ok( !tmp_mem,
"LocalHandle succeeded\n" );
2598 tmp_mem = pLocalFree( invalid_ptr );
2599 ok( tmp_mem == invalid_ptr,
"LocalFree succeeded\n" );
2618 ok(
size == 0,
"LocalSize succeeded\n" );
2622 ok( !
ptr,
"LocalLock succeeded\n" );
2626 ok( !
ret,
"LocalUnlock succeeded\n" );
2630 ok( !tmp_mem,
"LocalReAlloc succeeded\n" );
2635 ok( !tmp_mem,
"LocalHandle succeeded\n" );
2650 ok( !!tmp_mem,
"LocalAlloc failed, error %lu\n",
GetLastError() );
2651 ok( tmp_mem ==
mem,
"got ptr %p, expected %p\n", tmp_mem,
mem );
2653 ok(
size == small_size,
"LocalSize returned %Iu\n",
size );
2659 ok( !tmp_mem,
"LocalReAlloc succeeded\n" );
2664 if (tmp_mem)
mem = tmp_mem;
2666 ok( !!tmp_mem,
"LocalAlloc failed, error %lu\n",
GetLastError() );
2667 ok( tmp_mem ==
mem,
"got ptr %p, expected %p\n", tmp_mem,
mem );
2669 ok(
size == small_size,
"LocalSize returned %Iu\n",
size );
2677 ok( !!tmp_mem,
"LocalReAlloc failed, error %lu\n",
GetLastError() );
2681 ok( tmp_mem !=
mem,
"LocalReAlloc didn't relocate memory\n" );
2684 ok(
ptr == tmp_mem,
"got ptr %p, expected %p\n",
ptr, tmp_mem );
2692 skip(
"realloc_flags_tests invalid for WS03.\n");
2699 flags = realloc_flags_tests[
i];
2708 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2711 else ok( tmp_mem !=
mem,
"LocalReAlloc returned %p\n", tmp_mem );
2712 if (tmp_mem)
mem = tmp_mem;
2716 else ok(
size == small_size,
"LocalSize returned %Iu\n",
size );
2726 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2729 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p\n", tmp_mem );
2732 else ok(
size == nolfh_size + 512,
"LocalSize returned %Iu\n",
size );
2742 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2745 else todo_wine ok( tmp_mem !=
mem,
"LocalReAlloc returned %p\n", tmp_mem );
2746 if (tmp_mem)
mem = tmp_mem;
2760 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2763 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p\n", tmp_mem );
2766 else ok(
size == 10,
"LocalSize returned %Iu\n",
size );
2776 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2779 else ok( tmp_mem !=
mem,
"LocalReAlloc returned %p\n", tmp_mem );
2780 if (tmp_mem)
mem = tmp_mem;
2784 else ok(
size == small_size,
"LocalSize returned %Iu\n",
size );
2794 ok( !
is_mem_entry( tmp_mem ),
"unexpected moveable %p\n", tmp_mem );
2797 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p\n", tmp_mem );
2819 else ok( !tmp_mem,
"LocalReAlloc succeeded\n" );
2836 else ok(
size == small_size,
"LocalSize returned %Iu\n",
size );
2840 ok( !
ret,
"LocalUnlock succeeded\n" );
2855 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
2863 else ok(
size == nolfh_size + 512,
"LocalSize returned %Iu\n",
size );
2866 ok( !
ret,
"LocalUnlock succeeded\n" );
2881 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
2884 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
2889 else ok(
size == 10,
"LocalSize returned %Iu\n",
size );
2892 ok( !
ret,
"LocalUnlock succeeded\n" );
2907 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
2910 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
2915 else ok(
size == 10,
"LocalSize returned %Iu\n",
size );
2918 ok( !
ret,
"LocalUnlock succeeded\n" );
2932 else ok( !tmp_mem,
"LocalReAlloc succeeded\n" );
2935 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
2939 ok(
size == small_size,
"LocalSize returned %Iu\n",
size );
2942 ok( !
ret,
"LocalUnlock succeeded\n" );
2956 else ok( !tmp_mem,
"LocalReAlloc succeeded\n" );
2959 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
2963 ok(
size == nolfh_size,
"LocalSize returned %Iu\n",
size );
2966 ok( !
ret,
"LocalUnlock succeeded\n" );
2979 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
2986 else ok(
entry.ptr != expect_entry.
ptr,
"got unexpected ptr %p\n",
entry.ptr );
2992 else ok(
size == 512,
"LocalSize returned %Iu\n",
size );
3006 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
3009 ok(
entry.ptr == expect_entry.
ptr,
"got unexpected ptr %p\n",
entry.ptr );
3014 else ok(
size == nolfh_size + 512,
"LocalSize returned %Iu\n",
size );
3028 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
3031 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
3036 else ok(
size == 10,
"LocalSize returned %Iu\n",
size );
3050 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
3053 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
3058 else ok(
size == 10,
"LocalSize returned %Iu\n",
size );
3073 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
3077 expect_entry.
flags |= 8;
3081 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
3086 else ok(
size == small_size,
"LocalSize returned %Iu\n",
size );
3101 else ok( tmp_mem ==
mem,
"LocalReAlloc returned %p, error %lu\n", tmp_mem,
GetLastError() );
3105 expect_entry.
flags |= 8;
3109 ok(
entry.ptr == expect_entry.
ptr,
"got ptr %p was %p\n",
entry.ptr, expect_entry.
ptr );
3114 else ok(
size == nolfh_size,
"LocalSize returned %Iu\n",
size );
3129 ok( !
ret,
"LocalUnlock succeeded\n" );
3132 ok( tmp_mem ==
mem,
"LocalHandle returned unexpected handle\n" );
3143 ok(
size == 0,
"LocalSize returned %Iu\n",
size );
3153 ok( !
ptr,
"LocalLock succeeded\n" );
3177 ok(
mem ==
ptr,
"LocalReAlloc returned unexpected handle\n" );
3189 ok( !!tmp_mem,
"LocalReAlloc failed\n" );
3191 "LocalReAlloc returned unexpected handle\n" );
3201 "LocalReAlloc didn't clear memory\n" );
3204 ok( tmp_mem ==
mem,
"LocalHandle returned unexpected handle\n" );
3206 ok( !!tmp_mem,
"LocalDiscard failed, error %lu\n",
GetLastError() );
3207 ok( tmp_mem ==
mem,
"LocalDiscard returned unexpected handle\n" );
3231 ok( !!tmp_mem,
"LocalHandle failed, error %lu\n",
GetLastError() );
3232 ok( tmp_mem ==
ptr,
"LocalHandle returned unexpected handle\n" );
3233 tmp_ptr = (
void *)0xdeadbeef;
3234 tmp_flags = 0xdeadbeef;
3237 ok( tmp_ptr == (
void *)0xdeadbeef,
"got user value %p\n", tmp_ptr );
3238 ok( tmp_flags == 0,
"got user flags %#lx\n", tmp_flags );
3246 SIZE_T expect_size, diff, alloc_size, extra_size, tail_size = 0;
3247 unsigned char *ptr0, *ptr1, *ptr2,
tail;
3248 char tail_buf[64], padd_buf[64];
3249 void *tmp_ptr, **user_ptr;
3257 skip(
"skipping block tests\n" );
3261 if (!global_flags && !alloc_flags) extra_size = 8;
3262 else extra_size = 2 *
sizeof(
void *);
3264 if (heap_flags & padd_flags) extra_size += 2 *
sizeof(
void *);
3267 memset( tail_buf, 0xab,
sizeof(tail_buf) );
3268 memset( padd_buf, 0,
sizeof(padd_buf) );
3270 for (alloc_size = 0x20000 *
sizeof(
void *) - 0x3000; alloc_size > 0; alloc_size >>= 1)
3282 ok( !(
align & (2 *
sizeof(
void *) - 1)),
"wrong align\n" );
3284 expect_size =
max( alloc_size, 2 *
sizeof(
void *) );
3287 todo_wine_if( (!global_flags && alloc_size < 2 *
sizeof(
void *)) ||
3292 ok( diff == expect_size,
"got diff %#Ix exp %#Ix\n", diff, expect_size );
3293 ok( !
memcmp( ptr0 + alloc_size, tail_buf, tail_size ),
"missing block tail\n" );
3294 ok( !
memcmp( ptr1 + alloc_size, tail_buf, tail_size ),
"missing block tail\n" );
3295 ok( !
memcmp( ptr2 + alloc_size, tail_buf, tail_size ),
"missing block tail\n" );
3306 if (diff != expect_size)
3317 alloc_size = 0x20000 *
sizeof(
void *) - 0x2000;
3322 ok( !((
UINT_PTR)ptr0 & (2 *
sizeof(
void *) - 1)),
"got unexpected ptr align\n" );
3324 ok( !
memcmp( ptr0 + alloc_size, tail_buf, tail_size ),
"missing block tail\n" );
3332 for (alloc_size = 0x20000 *
sizeof(
void *) - 0x1000; alloc_size < 0x800000; alloc_size <<= 1)
3338 ptr1 = pHeapAlloc(
heap, alloc_flags, alloc_size );
3340 ptr2 = pHeapAlloc(
heap, alloc_flags, alloc_size );
3344 ok( !(
align & (8 *
sizeof(
void *) - 1)),
"wrong align\n" );
3346 expect_size =
max( alloc_size, 2 *
sizeof(
void *) );
3350 ok( diff > expect_size,
"got diff %#Ix\n", diff );
3352 tail = ptr0[alloc_size] | ptr1[alloc_size] | ptr2[alloc_size];
3353 ok( !
tail,
"got tail\n" );
3363 if (diff == expect_size || (
align & (8 *
sizeof(
void *) - 1)) ||
tail)
3378 if (!(heap_flags & padd_flags))
3380 alloc_size = 0x1000;
3389 expect_size =
max( alloc_size, 2 *
sizeof(
void *) );
3390 expect_size =
ALIGN_BLOCK_SIZE( expect_size + extra_size + 2 *
sizeof(
void *) );
3392 ok( diff == expect_size,
"got diff %#Ix\n", diff );
3394 ok( !
memcmp( ptr0 + alloc_size, tail_buf, tail_size ),
"missing block tail\n" );
3395 ok( !
memcmp( ptr1 + alloc_size, tail_buf, tail_size ),
"missing block tail\n" );
3396 ok( !
memcmp( ptr2 + alloc_size, tail_buf, tail_size ),
"missing block tail\n" );
3398 ok( !
memcmp( ptr0 + alloc_size + tail_size, padd_buf, 2 *
sizeof(
void *) ),
"unexpected padding\n" );
3400 tmp_ptr = (
void *)0xdeadbeef;
3401 tmp_flags = 0xdeadbeef;
3402 ret = pRtlGetUserInfoHeap(
heap, 0, ptr0, (
void **)&tmp_ptr, &tmp_flags );
3404 ok( tmp_ptr ==
NULL,
"got ptr %p\n", tmp_ptr );
3405 ok( tmp_flags == 0xc00,
"got flags %#lx\n", tmp_flags );
3407 tmp_ptr = (
void *)0xdeadbeef;
3408 tmp_flags = 0xdeadbeef;
3409 ret = pRtlGetUserInfoHeap(
heap, 0, ptr1, (
void **)&tmp_ptr, &tmp_flags );
3411 ok( tmp_ptr ==
NULL,
"got ptr %p\n", tmp_ptr );
3412 ok( tmp_flags == 0x200,
"got flags %#lx\n", tmp_flags );
3414 ret = pRtlSetUserValueHeap(
heap, 0, ptr0, (
void *)0xdeadbeef );
3417 ret = pRtlSetUserFlagsHeap(
heap, 0, ptr0, 0, 0x1000 );
3421 ok( !
ret,
"RtlSetUserFlagsHeap succeeded\n" );
3428 ret = pRtlSetUserFlagsHeap(
heap, 0, ptr0, 0x100, 0 );
3432 ok( !
ret,
"RtlSetUserFlagsHeap succeeded\n" );
3438 ret = pRtlSetUserFlagsHeap(
heap, 0, ptr0, 0x400, 0x200 );
3443 ret = pRtlGetUserInfoHeap(
heap, 0, ptr0, (
void **)&tmp_ptr, &tmp_flags );
3445 ok( tmp_ptr == (
void *)0xdeadbeef,
"got ptr %p\n", tmp_ptr );
3446 ok( tmp_flags == 0xa00 ||
broken(tmp_flags == 0xc00) ,
3447 "got flags %#lx\n", tmp_flags );
3449 user_ptr = (
void **)(ptr0 + alloc_size + tail_size);
3450 ok( user_ptr[1] == (
void *)0xdeadbeef,
"unexpected user value\n" );
3451 user_ptr[0] = (
void *)0xdeadbeef;
3452 user_ptr[1] = (
void *)0xdeadbee0;
3456 ret = pRtlGetUserInfoHeap(
heap, 0, ptr0, (
void **)&tmp_ptr, &tmp_flags );
3458 ok( tmp_ptr == (
void *)0xdeadbee0,
"got ptr %p\n", tmp_ptr );
3459 ok( tmp_flags == 0xa00 ||
broken(tmp_flags == 0xc00) ,
3460 "got flags %#lx\n", tmp_flags );
3481 ok(
p !=
NULL,
"HeapAlloc failed\n" );
3484 ok(
ret,
"HeapValidate failed\n" );
3489 ok(
p[14] == 0,
"wrong data %x\n",
p[14] );
3490 ok(
p[15] == 0,
"wrong data %x\n",
p[15] );
3491 ok(
p[16] == 0,
"wrong data %x\n",
p[16] );
3495 ok(
p[17] == 0xab,
"wrong padding %x\n",
p[17] );
3496 ok(
p[18] == 0xab,
"wrong padding %x\n",
p[18] );
3497 ok(
p[19] == 0xab,
"wrong padding %x\n",
p[19] );
3505 ok(
p[14] == 0xab,
"wrong padding %x\n",
p[14] );
3506 ok(
p[15] == 0xab,
"wrong padding %x\n",
p[15] );
3507 ok(
p[16] == 0xab,
"wrong padding %x\n",
p[16] );
3511 ok(
p[14] == 0,
"wrong padding %x\n",
p[14] );
3512 ok(
p[15] == 0,
"wrong padding %x\n",
p[15] );
3515 else skip(
"realloc in place failed\n");
3518 ok(
ret,
"HeapFree failed\n" );
3521 ok(
p !=
NULL,
"HeapAlloc failed\n" );
3528 ok( !
ret,
"HeapValidate succeeded\n" );
3537 ok( p2 ==
NULL,
"HeapReAlloc succeeded\n" );
3541 "HeapFree succeeded\n" );
3549 ok( p2 !=
NULL,
"HeapReAlloc failed\n" );
3554 ok(
ret,
"HeapFree failed\n" );
3562 ok( !!
p,
"HeapAlloc failed\n" );
3565 ok( p32[0] == 0xbaadf00d,
"got %#x\n", p32[0] );
3567 ok( tmp != 0xadf00d,
"got %#x\n", tmp );
3572 ok( !!
p,
"HeapReAlloc failed\n" );
3575 ok( p32[0] == 0xcccccccc,
"got %#x\n", p32[0] );
3576 ok( p32[1] << 8 == 0xcccccc00,
"got %#x\n", p32[1] );
3577 ok( p32[2] == 0xbaadf00d,
"got %#x\n", p32[2] );
3579 ok( tmp != 0xadf00d,
"got %#x\n", tmp );
3582 ok(
ret,
"failed.\n" );
3586 ok(
p !=
NULL,
"HeapAlloc failed\n" );
3590 ok(
ret,
"HeapFree failed\n" );
3594 ok(
p[16] == 0xee,
"wrong data %x\n",
p[16] );
3595 ok(
p[17] == 0xfe,
"wrong data %x\n",
p[17] );
3596 ok(
p[18] == 0xee,
"wrong data %x\n",
p[18] );
3597 ok(
p[19] == 0xfe,
"wrong data %x\n",
p[19] );
3600 ok(
ret,
"HeapValidate failed\n" );
3605 ok( !
ret,
"HeapValidate succeeded\n" );
3609 ok(
ret,
"HeapValidate failed\n" );
3615 ok(
p !=
NULL,
"HeapAlloc failed\n" );
3618 ok(
ret,
"HeapValidate failed\n" );
3621 ok(
size == large_size,
"Wrong size %Iu\n",
size );
3623 ok(
p[large_size - 2] == 0,
"wrong data %x\n",
p[large_size - 2] );
3624 ok(
p[large_size - 1] == 0,
"wrong data %x\n",
p[large_size - 1] );
3629 ok(
p[large_size] == 0,
"wrong data %x\n",
p[large_size] );
3630 ok(
p[large_size + 1] == 0,
"wrong data %x\n",
p[large_size + 1] );
3631 ok(
p[large_size + 2] == 0,
"wrong data %x\n",
p[large_size + 2] );
3635 ok(
ret,
"HeapFree failed\n" );
3643 for (
i = 0;
i < 32;
i++)
if (
p[
size +
i] != 0xab)
break;
3644 ok(
i >= 8,
"only %Iu tail bytes for size %Iu\n",
i,
size );
3664 sprintf( keyname,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\%s",
3666 if (!
strcmp( keyname +
strlen(keyname) - 3,
".so" )) keyname[
strlen(keyname) - 3] = 0;
3671 skip(
"Not authorized to change the image file execution options\n");
3674 ok( !
err,
"failed to create '%s' error %lu\n", keyname,
err );
3677 if (
flags == 0xdeadbeef)
3725 skip(
"test_heap_layout() is invalid on WS03.\n");
3737 struct heap expect_heap;
3738 memset( &expect_heap, 0xee,
sizeof(expect_heap) );
3742 ok( !
memcmp(
heap, &expect_heap,
sizeof(expect_heap) ),
"got unexpected data\n" );
3761 if (global_flags == 0xdeadbeef)
3766 skip(
"Session Manager flags not set\n" );
3779 if (global_flags && !pRtlGetNtGlobalFlags())
3781 win_skip(
"global flags not set\n" );
3786 trace(
"testing global flags %#lx, heap flags %08lx\n", global_flags, heap_flags );
3788 ok( pRtlGetNtGlobalFlags() == global_flags,
"got global flags %#lx\n", pRtlGetNtGlobalFlags() );
3835 MEMORYSTATUSEX memstatus;
3839 if (!pGetPhysicallyInstalledSystemMemory)
3841 win_skip(
"GetPhysicallyInstalledSystemMemory is not available\n");
3846 ret = pGetPhysicallyInstalledSystemMemory(
NULL);
3847 ok(!
ret,
"GetPhysicallyInstalledSystemMemory should fail\n");
3849 "expected ERROR_INVALID_PARAMETER, got %lu\n",
GetLastError());
3852 ret = pGetPhysicallyInstalledSystemMemory(&total_memory);
3856 ok(total_memory != 0,
"expected total_memory != 0\n");
3858 ok(
ret,
"GetPhysicallyInstalledSystemMemory unexpectedly failed (%lu)\n",
GetLastError());
3859 ok(total_memory != 0,
"expected total_memory != 0\n");
3862 memstatus.dwLength =
sizeof(memstatus);
3864 ok(
ret,
"GlobalMemoryStatusEx unexpectedly failed\n");
3866 ok(total_memory >= memstatus.ullTotalPhys / 1024 ||
broken(total_memory == 0) ,
3867 "expected total_memory >= memstatus.ullTotalPhys / 1024\n");
3869 ok(total_memory >= memstatus.ullTotalPhys / 1024,
3870 "expected total_memory >= memstatus.ullTotalPhys / 1024\n");
3879 MEMORYSTATUSEX memex = {0},
expect;
3887 ok( !
ret,
"GlobalMemoryStatusEx succeeded\n" );
3894 ok( !
status,
"NtQuerySystemInformation returned %#lx\n",
status );
3896 ok( !
status,
"NtQuerySystemInformation returned %#lx\n",
status );
3898 ok( !
status,
"NtQueryInformationProcess returned %#lx\n",
status );
3901 memex.dwLength =
sizeof(MEMORYSTATUSEX);
3903 ok(
ret,
"GlobalMemoryStatusEx succeeded\n" );
3905 ok( basic_info.
PageSize,
"got 0 PageSize\n" );
3906 ok( basic_info.MmNumberOfPhysicalPages,
"got 0 MmNumberOfPhysicalPages\n" );
3907 ok( !!basic_info.HighestUserAddress,
"got 0 HighestUserAddress\n" );
3908 ok( !!basic_info.LowestUserAddress,
"got 0 LowestUserAddress\n" );
3909 ok( perf_info->TotalCommittedPages,
"got 0 TotalCommittedPages\n" );
3910 ok( perf_info->TotalCommitLimit,
"got 0 TotalCommitLimit\n" );
3911 ok( perf_info->AvailablePages,
"got 0 AvailablePages\n" );
3913 expect.dwMemoryLoad = (memex.ullTotalPhys - memex.ullAvailPhys) / (memex.ullTotalPhys / 100);
3917 expect.ullAvailPageFile = (
ULONGLONG)(perf_info->TotalCommitLimit - perf_info->TotalCommittedPages) * basic_info.
PageSize;
3920 expect.ullAvailExtendedVirtual = 0;
3923#define IS_WITHIN_RANGE(a, b) (((a) - (b) + (256 * basic_info.PageSize)) <= (512 * basic_info.PageSize))
3925 ok( memex.dwMemoryLoad ==
expect.dwMemoryLoad,
"got dwMemoryLoad %lu\n", memex.dwMemoryLoad );
3926 ok( memex.ullTotalPhys ==
expect.ullTotalPhys,
"got ullTotalPhys %#I64x\n", memex.ullTotalPhys );
3927 ok(
IS_WITHIN_RANGE( memex.ullAvailPhys,
expect.ullAvailPhys ),
"got ullAvailPhys %#I64x\n", memex.ullAvailPhys );
3928 ok( memex.ullTotalPageFile ==
expect.ullTotalPageFile,
"got ullTotalPageFile %#I64x\n", memex.ullTotalPageFile );
3929 ok(
IS_WITHIN_RANGE( memex.ullAvailPageFile,
expect.ullAvailPageFile ),
"got ullAvailPageFile %#I64x\n", memex.ullAvailPageFile );
3930 ok( memex.ullTotalVirtual ==
expect.ullTotalVirtual,
"got ullTotalVirtual %#I64x\n", memex.ullTotalVirtual );
3931 ok( memex.ullAvailVirtual <=
expect.ullAvailVirtual,
"got ullAvailVirtual %#I64x\n", memex.ullAvailVirtual );
3932 ok( memex.ullAvailExtendedVirtual == 0,
"got ullAvailExtendedVirtual %#I64x\n", memex.ullAvailExtendedVirtual );
3934 ok(
mem.dwMemoryLoad == memex.dwMemoryLoad,
"got dwMemoryLoad %lu\n",
mem.dwMemoryLoad );
3935 ok(
mem.dwTotalPhys ==
min( ~(
SIZE_T)0 >> 1, memex.ullTotalPhys ) ||
3937 "got dwTotalPhys %#Ix\n",
mem.dwTotalPhys );
3940 "got dwAvailPhys %#Ix\n",
mem.dwAvailPhys );
3944 ok(
mem.dwTotalPageFile ==
min( ~(
SIZE_T)0, memex.ullTotalPageFile ),
"got dwTotalPageFile %#Ix\n",
mem.dwTotalPageFile );
3946 ok(
mem.dwTotalVirtual == memex.ullTotalVirtual,
"got dwTotalVirtual %#Ix\n",
mem.dwTotalVirtual );
3947 ok(
mem.dwAvailVirtual == memex.ullAvailVirtual,
"got dwAvailVirtual %#Ix\n",
mem.dwAvailVirtual );
3949#undef IS_WITHIN_RANGE
3962 p =
info.AllocationBase;
3974 *alloc_size =
p - *
base;
3979 static const SIZE_T default_heap_size = 0x10000, init_grow_size = 0x100000, max_grow_size = 0xfd0000;
3982 SIZE_T alloc_size, current_subheap_size;
3983 char *
base, *current_base;
3992 ok( alloc_size == initial_size + default_heap_size ||
broken( (initial_size && alloc_size == initial_size)
3993 || (!initial_size && (alloc_size == default_heap_size *
sizeof(
void*))) ) ,
3994 "got %#Ix.\n", alloc_size );
3996 current_subheap_size = alloc_size;
3997 for (
i = 0;
i < 100; ++
i)
4002 if (
base != current_base)
4004 current_base =
base;
4005 if (initial_subheap)
4007 current_subheap_size = init_grow_size;
4008 initial_subheap =
FALSE;
4012 current_subheap_size =
min( current_subheap_size * 2, max_grow_size );
4013 if (current_subheap_size == max_grow_size)
4014 max_size_reached =
TRUE;
4017 ok( alloc_size == current_subheap_size,
"got %#Ix.\n", alloc_size );
4020 ok( max_size_reached,
"Did not reach maximum subheap size.\n" );
4029 SIZE_T size, round_size = 0x400 *
sizeof(
void*);
4034 skip(
"test_heap_sizes() is invalid for WS03.\n");
4042 for (
i = 1;
i < 0x100;
i++)
4045 ok(
heap !=
NULL,
"%x: creation failed\n",
i * 0x100 );
4047 ok(
size == ((
i * 0x100 + round_size - 1) & ~(round_size - 1)),
4048 "%x: wrong size %Ix\n",
i * 0x100,
size );
4058#if defined(__REACTOS__) && defined(SKIPBADHEAP_K32_WINETEST)
4060 ok(
FALSE,
"FIXME: These tests are too rough on ReactOS heap manager on x64. It will eventually finish but it takes over an hour to complete the test suite with it which isn't acceptable.\n");
4080 if (pRtlGetNtGlobalFlags)
4094 else win_skip(
"RtlGetNtGlobalFlags not found, skipping heap debug tests\n" );
struct outqueuenode * tail
static void startup(void)
#define RegCloseKey(hKey)
#define ERROR_NOT_ENOUGH_MEMORY
#define ERROR_INSUFFICIENT_BUFFER
#define ERROR_INVALID_FUNCTION
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
#define ERROR_INVALID_PARAMETER
#define GetCurrentProcess()
#define ERROR_NO_MORE_ITEMS
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
#define ERROR_ACCESS_DENIED
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
BOOL WINAPI DECLSPEC_HOTPATCH GetPhysicallyInstalledSystemMemory(ULONGLONG *memory)
static void basename(LPCWSTR path, LPWSTR name)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP __int64 __cdecl llabs(__int64)
_ACRTIMP __msvcrt_ulong __cdecl strtoul(const char *, char **, int)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
_ACRTIMP char *__cdecl strrchr(const char *, int)
int align(int length, int align)
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLenum const GLfloat * params
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
BOOL WINAPI HeapQueryInformation(HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation OPTIONAL, SIZE_T HeapInformationLength OPTIONAL, PSIZE_T ReturnLength OPTIONAL)
HGLOBAL NTAPI GlobalHandle(LPCVOID pMem)
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
UINT NTAPI GlobalFlags(HGLOBAL hMem)
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
BOOL WINAPI HeapLock(HANDLE hHeap)
LPVOID NTAPI LocalLock(HLOCAL hMem)
BOOL NTAPI LocalUnlock(HLOCAL hMem)
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
BOOL WINAPI HeapUnlock(HANDLE hHeap)
VOID NTAPI GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
BOOL WINAPI HeapSetInformation(HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation OPTIONAL, SIZE_T HeapInformationLength OPTIONAL)
BOOL WINAPI HeapDestroy(HANDLE hHeap)
SIZE_T NTAPI LocalSize(HLOCAL hMem)
BOOL WINAPI HeapWalk(HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry)
HLOCAL NTAPI LocalHandle(LPCVOID pMem)
UINT NTAPI LocalFlags(HLOCAL hMem)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
DWORD WINAPI GetProcessHeaps(DWORD NumberOfHeaps, PHANDLE ProcessHeaps)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
BOOL NTAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
#define FLG_HEAP_DISABLE_COALESCING
#define FLG_HEAP_ENABLE_TAGGING
#define FLG_HEAP_PAGE_ALLOCS
#define FLG_POOL_ENABLE_TAGGING
#define FLG_HEAP_ENABLE_FREE_CHECK
#define FLG_HEAP_VALIDATE_PARAMETERS
#define FLG_HEAP_ENABLE_TAIL_CHECK
#define FLG_HEAP_VALIDATE_ALL
#define FLG_HEAP_ENABLE_TAG_BY_DLL
NTSYSAPI BOOLEAN WINAPI RtlSetUserFlagsHeap(HANDLE, ULONG, void *, ULONG, ULONG)
NTSYSAPI NTSTATUS WINAPI RtlWalkHeap(HANDLE, PVOID)
NTSYSAPI BOOLEAN WINAPI RtlGetUserInfoHeap(HANDLE, ULONG, void *, void **, ULONG *)
NTSYSAPI ULONG WINAPI RtlGetNtGlobalFlags(void)
NTSYSAPI BOOLEAN WINAPI RtlSetUserValueHeap(HANDLE, ULONG, void *, void *)
static ERESOURCE GlobalLock
#define SystemPerformanceInformation
struct _SYSTEM_PERFORMANCE_INFORMATION SYSTEM_PERFORMANCE_INFORMATION
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
#define todo_wine_if(is_todo)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
#define PROCESS_HEAP_ENTRY_DDESHARE
#define PROCESS_HEAP_UNCOMMITTED_RANGE
#define PROCESS_HEAP_ENTRY_MOVEABLE
#define PROCESS_HEAP_ENTRY_BUSY
#define LMEM_INVALID_HANDLE
#define PROCESS_HEAP_REGION
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
#define RTL_HEAP_ENTRY_BUSY
static void test_GetPhysicallyInstalledSystemMemory(void)
static void test_heap_sizes(void)
static void test_child_heap(const char *arg)
#define RTL_HEAP_ENTRY_REGION
static void test_GlobalAlloc(void)
static void test_LocalAlloc(void)
static void test_debug_heap(const char *argv0, DWORD flags)
static DWORD heap_flags_from_global_flag(DWORD flag)
static struct mem_entry * mem_entry_from_HANDLE(HLOCAL handle)
static void test_heap_checks(DWORD flags)
static void load_functions(void)
static void test_GlobalMemoryStatus(void)
#define HEAP_VALIDATE_PARAMS
#define ALIGN_BLOCK_SIZE(x)
#define HEAP_ADD_USER_INFO
static void get_valloc_info(void *mem, char **base, SIZE_T *alloc_size)
#define HEAP_VALIDATE_ALL
static void test_block_layout(HANDLE heap, DWORD global_flags, DWORD heap_flags, DWORD alloc_flags)
#define RTL_HEAP_ENTRY_UNCOMMITTED
static void test_heap_layout(HANDLE handle, DWORD global_flag, DWORD heap_flags)
#define RTL_HEAP_ENTRY_COMMITTED
static void test_HeapCreate(void)
static HEAP_INFORMATION_CLASS
static void test_heap_size(SIZE_T initial_size)
#define RTL_HEAP_ENTRY_LFH
#define RTL_HEAP_ENTRY_BLOCK
DWORD WINAPI heap_thread_proc(void *arg)
#define IS_WITHIN_RANGE(a, b)
static BOOL is_mem_entry(HLOCAL handle)
unsigned __int3264 UINT_PTR
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
@ HeapCompatibilityInformation
#define HEAP_FREE_CHECKING_ENABLED
#define HEAP_DISABLE_COALESCE_ON_FREE
#define HEAP_TAIL_CHECKING_ENABLED
#define HEAP_REALLOC_IN_PLACE_ONLY
#define HEAP_NO_SERIALIZE
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_writes_bytes_to_opt_(ProcessInformationLength, *ReturnLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
int winetest_get_mainargs(char ***pargv)
#define wait_child_process
#define _WIN32_WINNT_VISTA
static char argv0[MAX_PATH]
wchar_t const *const size_t const buffer_size
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
struct _PROCESS_HEAP_ENTRY::@3252::@3254 Region
struct rtl_heap_entry::@513::@515 Block
struct rtl_heap_entry::@513::@516 Region
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
#define CONTAINING_RECORD(address, type, field)
SIZE_T NTAPI VirtualQuery(IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
DWORD WINAPI GetLastError(void)
struct _MEMORYSTATUS MEMORYSTATUS
#define GMEM_INVALID_HANDLE
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
#define ERROR_GEN_FAILURE
#define HKEY_LOCAL_MACHINE