25#define WIN32_NO_STATUS
36#define MAPPING_SIZE 0x100000
82 const unsigned int alloc_size = 1<<15;
84 SIZE_T bytes_written = 0, bytes_read = 0,
i;
112 for (
i = 0;
i < alloc_size;
i++)
116 ok(
b && (bytes_written == alloc_size),
"%Iu bytes written\n",
119 ok(
b && (bytes_read == alloc_size),
"%Iu bytes read\n", bytes_read);
120 ok(!
memcmp(
src,
dst, alloc_size),
"Data from remote process differs\n");
121 bytes_written = 0xdeadbeef;
122 status = pNtWriteVirtualMemory(
hProcess, addr1,
src, alloc_size, &bytes_written );
124 ok( bytes_written == alloc_size,
"%Iu bytes written\n", bytes_written );
125 bytes_read = 0xdeadbeef;
129 ok( bytes_read == alloc_size,
"%Iu bytes read\n", bytes_read );
130 ok(!
memcmp(
src,
dst, alloc_size),
"Data from remote process differs\n");
133 bytes_written = 0xdeadbeef;
136 bytes_read = 0xdeadbeef;
139 bytes_written = 0xdeadbeef;
142 ok( bytes_written == 0,
"%Iu bytes written\n", bytes_written );
143 bytes_read = 0xdeadbeef;
146 ok( !bytes_read,
"%Iu bytes read\n", bytes_read );
152 bytes_written = 0xdeadbeef;
154 ok( !
b,
"WriteProcessMemory succeeded\n" );
158 ok( bytes_written == 0,
"%Iu bytes written\n", bytes_written );
159 bytes_read = 0xdeadbeef;
161 ok( !
b,
"ReadProcessMemory succeeded\n" );
166 ok( bytes_read == 0,
"%Iu bytes read\n", bytes_read );
168 ok( bytes_read == 0x2000,
"%Iu bytes read\n", bytes_read );
169 bytes_written = 0xdeadbeef;
170 status = pNtWriteVirtualMemory(
hProcess, addr1,
src, alloc_size, &bytes_written );
172 ok( bytes_written == 0,
"%Iu bytes written\n", bytes_written );
173 bytes_read = 0xdeadbeef;
180 bytes_written = 0xdeadbeef;
182 ok( !
b,
"WriteProcessMemory succeeded\n" );
186 ok( bytes_written == 0,
"%Iu bytes written\n", bytes_written );
187 bytes_read = 0xdeadbeef;
189 ok( !
b,
"ReadProcessMemory succeeded\n" );
193 ok( bytes_read == 0,
"%Iu bytes read\n", bytes_read );
194 bytes_written = 0xdeadbeef;
195 status = pNtWriteVirtualMemory(
hProcess, addr1,
src, alloc_size, &bytes_written );
197 ok( bytes_written == 0,
"%Iu bytes written\n", bytes_written );
198 bytes_read = 0xdeadbeef;
201 ok( bytes_read == 0,
"%Iu bytes read\n", bytes_read );
209 bytes_written = 0xdeadbeef;
211 ok( !
b,
"WriteProcessMemory succeeded\n" );
213 ok( bytes_written == 0xdeadbeef,
"%Iu bytes written\n", bytes_written );
214 status = pNtWriteVirtualMemory(
hProcess, addr1,
src, alloc_size, &bytes_written );
217 "wrong status %lx\n",
status );
219 ok( bytes_written == 0,
"%Iu bytes written\n", bytes_written );
223 bytes_written = 0xdeadbeef;
225 ok(
b,
"WriteProcessMemory failed\n" );
226 ok( bytes_written == alloc_size,
"%Iu bytes written\n", bytes_written );
227 bytes_written = 0xdeadbeef;
228 status = pNtWriteVirtualMemory(
hProcess, addr1,
src, alloc_size, &bytes_written );
231 "wrong status %lx\n",
status );
233 ok( bytes_written == 0,
"%Iu bytes written\n", bytes_written );
237 bytes_written = 0xdeadbeef;
240 ok( !
b ||
broken(
b),
"WriteProcessMemory succeeded\n" );
241 bytes_written = 0xdeadbeef;
242 status = pNtWriteVirtualMemory(
hProcess, addr1,
src, alloc_size, &bytes_written );
245 "wrong status %lx\n",
status );
246 ok( bytes_written == (
status ? 0x2000 : alloc_size),
"%Iu bytes written\n", bytes_written );
250 bytes_written = 0xdeadbeef;
253 ok( !
b ||
broken(
b),
"WriteProcessMemory succeeded\n" );
254 status = pNtWriteVirtualMemory(
hProcess, addr1,
src, alloc_size, &bytes_written );
257 "wrong status %lx\n",
status );
258 ok( bytes_written == (
status ? 0x2000 : alloc_size),
"%Iu bytes written\n", bytes_written );
269 ok(addr1 ==
NULL,
"VirtualAllocEx should fail on zero-sized allocation\n");
271 "got %lu, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
274 ok(addr1 !=
NULL,
"VirtualAllocEx failed\n");
279 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
280 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
282 ok(
info.RegionSize == 0x10000,
"%Ix != 0x10000\n",
info.RegionSize);
284 ok(
info.Protect == 0,
"%lx != PAGE_NOACCESS\n",
info.Protect);
289 "VirtualProtectEx should fail on a not committed memory\n");
291 "got %lu, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
294 ok(addr1 == addr2,
"VirtualAllocEx failed\n");
298 "VirtualQueryEx failed\n");
299 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
300 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
302 ok(
info.RegionSize == 0x1000,
"%Ix != 0x1000\n",
info.RegionSize);
311 "VirtualProtectEx should fail on a not committed memory\n");
313 "got %lu, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
317 ok(old_prot ==
PAGE_NOACCESS,
"wrong old protection: got %04lx instead of PAGE_NOACCESS\n", old_prot);
321 ok(old_prot ==
PAGE_READONLY,
"wrong old protection: got %04lx instead of PAGE_READONLY\n", old_prot);
324 "VirtualFreeEx should fail with type 0\n");
326 "got %lu, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
332 "VirtualFreeEx should fail\n");
334 "got %lu, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
350 ok(addr1 ==
NULL,
"VirtualAlloc should fail on zero-sized allocation\n");
352 "got %ld, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
355 ok(addr1 !=
NULL,
"VirtualAlloc failed\n");
359 "VirtualQuery failed\n");
360 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
361 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
363 ok(
info.RegionSize == 0x10000,
"%Ix != 0x10000\n",
info.RegionSize);
365 ok(
info.Protect == 0,
"%lx != PAGE_NOACCESS\n",
info.Protect);
370 "VirtualProtect should fail on a not committed memory\n");
372 "got %ld, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
375 ok(addr1 == addr2,
"VirtualAlloc failed\n");
379 "VirtualQuery failed\n");
380 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
381 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
383 ok(
info.RegionSize == 0x1000,
"%Ix != 0x1000\n",
info.RegionSize);
392 "VirtualProtect should fail on a not committed memory\n");
394 "got %ld, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
398 "wrong old protection: got %04lx instead of PAGE_NOACCESS\n", old_prot);
402 "wrong old protection: got %04lx instead of PAGE_READONLY\n", old_prot);
405 "VirtualQuery failed\n");
406 ok(
info.RegionSize == 0x1000,
"%Ix != 0x1000\n",
info.RegionSize);
409 memset( addr1, 0x55, 20 );
410 ok( *(
DWORD *)addr1 == 0x55555555,
"wrong data %lx\n", *(
DWORD *)addr1 );
413 ok( addr2 == addr1,
"VirtualAlloc failed err %lu\n",
GetLastError() );
414 ok( *(
DWORD *)addr1 == 0x55555555 || *(
DWORD *)addr1 == 0,
"wrong data %lx\n", *(
DWORD *)addr1 );
416 "VirtualQuery failed\n");
417 ok(
info.RegionSize == 0x1000,
"%Ix != 0x1000\n",
info.RegionSize);
422 ok( (
char *)addr2 == (
char *)addr1 + 0x1000,
"VirtualAlloc failed\n" );
425 "VirtualQuery failed\n");
426 ok(
info.RegionSize == 0xf000,
"%Ix != 0xf000\n",
info.RegionSize);
428 ok(
info.Protect == 0,
"%lx != 0\n",
info.Protect);
431 ok( !addr2,
"VirtualAlloc failed\n" );
437 ok(!addr2,
"VirtualAlloc succeeded\n");
442 ok(!addr2,
"VirtualAlloc succeeded\n");
447 ok(!addr2,
"VirtualAlloc succeeded\n");
452 "VirtualProtect succeeded\n");
456 ok(!
VirtualProtect(addr1, 0x1000, 0, &old_prot),
"VirtualProtect succeeded\n");
460 ok(!
VirtualFree(addr1, 0x10000, 0),
"VirtualFree should fail with type 0\n");
462 "got %ld, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
467 "got %ld, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
474 "got %ld, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
480 ok( addr1 !=
NULL,
"VirtualAlloc failed\n");
482 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
483 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
485 "wrong protect %lx\n",
info.AllocationProtect);
486 ok(
info.RegionSize == 0x2000,
"wrong size %Ix\n",
info.RegionSize);
494 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
495 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
497 "wrong protect %lx\n",
info.AllocationProtect);
499 "wrong size %Ix\n",
info.RegionSize);
502 "wrong protect %lx\n",
info.Protect);
507 "wrong protect %lx\n", old_prot );
509 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
510 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
512 "wrong protect %lx\n",
info.AllocationProtect);
513 ok(
info.RegionSize == 0x1000,
"wrong size %Ix\n",
info.RegionSize);
516 "wrong protect %lx\n",
info.Protect);
522 ok( addr1 !=
NULL,
"VirtualAlloc failed\n");
524 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
525 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
527 "wrong protect %lx\n",
info.AllocationProtect);
528 ok(
info.RegionSize == 0x2000,
"wrong size %Ix\n",
info.RegionSize);
536 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
537 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
539 ok(
info.RegionSize == 0x1000,
"wrong size %Ix\n",
info.RegionSize);
542 "wrong protect %lx\n",
info.Protect);
549 ok(addr1 !=
NULL,
"VirtualAlloc failed\n");
550 ok(!((
ULONG_PTR)addr1 & 0xffff),
"returned memory %p is not aligned to 64k\n", addr1);
553 ok(addr2 == addr1,
"VirtualAlloc returned %p, expected %p\n", addr2, addr1);
558 ok(!addr2,
"VirtualAlloc unexpectedly succeeded\n");
566 static const char testfile[] =
"testfile.xxx";
624 ok( !
ptr,
"MapViewOfFile succeeded\n" );
631 ok( !
ptr,
"MapViewOfFile succeeded\n" );
667 ok( !
ptr,
"MapViewOfFile FILE_MAP_WRITE succeeded\n" );
695 ok( !
ptr,
"MapViewOfFile FILE_MAP_WRITE succeeded\n" );
704 ok( !
mapping,
"CreateFileMappingA succeeded\n" );
716 ok( !
mapping,
"CreateFileMapping PAGE_READWRITE succeeded\n" );
739 ok( !
mapping,
"CreateFileMapping PAGE_READWRITE succeeded\n" );
745 ok( !
mapping,
"CreateFileMapping PAGE_WRITECOPY succeeded\n" );
751 ok( !
mapping,
"CreateFileMapping PAGE_READONLY succeeded\n" );
774 ok( !
ptr,
"MapViewOfFile FILE_MAP_WRITE succeeded\n" );
786 ok(
info.RegionSize == 4096,
"%Ix != 4096\n",
info.RegionSize );
796 info_size = (
SIZE_T)0xdeadbeef << 16;
800 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %Iu\n", info_size );
804 ok(
section_info.Size.QuadPart ==
info.RegionSize,
"NtQuerySection wrong size %lx%08lx / %08Ix\n",
813 ok( !
ptr,
"MapViewOfFile succeeded\n" );
825 ok(
info.RegionSize == 4096,
"%Ix != 4096\n",
info.RegionSize );
839 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %Iu\n", info_size );
843 ok(
section_info.Size.QuadPart ==
info.RegionSize,
"NtQuerySection wrong size %lx%08lx / %08Ix\n",
866 ok(
ptr != ptr2,
"MapViewOfFile returned same pointer\n" );
870 ok(
info.BaseAddress ==
ptr,
"BaseAddress should have been %p but was %p instead\n",
ptr,
info.BaseAddress);
871 ok(
info.AllocationBase ==
ptr,
"AllocationBase should have been %p but was %p instead\n",
ptr,
info.AllocationBase);
875 "AllocationProtect should have been PAGE_READWRITE but was 0x%lx\n",
info.AllocationProtect);
876 ok(
info.Protect == 0,
"Protect should have been 0 instead of 0x%lx\n",
info.Protect);
881 ok(
info.BaseAddress == ptr2,
882 "BaseAddress should have been %p but was %p instead\n", ptr2,
info.BaseAddress);
883 ok(
info.AllocationBase == ptr2,
884 "AllocationBase should have been %p but was %p instead\n", ptr2,
info.AllocationBase);
886 "AllocationProtect should have been PAGE_READWRITE but was 0x%lx\n",
info.AllocationProtect);
888 "RegionSize should have been 0x%x but was 0x%Ix\n",
MAPPING_SIZE,
info.RegionSize);
890 ok(
info.Protect == 0,
"Protect should have been 0 instead of 0x%lx\n",
info.Protect);
898 ok(
info.BaseAddress ==
ptr,
"BaseAddress should have been %p but was %p instead\n",
ptr,
info.BaseAddress);
899 ok(
info.AllocationBase ==
ptr,
"AllocationBase should have been %p but was %p instead\n",
ptr,
info.AllocationBase);
900 ok(
info.RegionSize == 0x10000,
"RegionSize should have been 0x10000 but was 0x%Ix\n",
info.RegionSize);
901 ok(
info.State ==
MEM_COMMIT,
"State should have been MEM_COMMIT instead of 0x%lx\n",
info.State);
904 "AllocationProtect should have been PAGE_READWRITE but was 0x%lx\n",
info.AllocationProtect);
912 ok(
info.BaseAddress == ptr2,
913 "BaseAddress should have been %p but was %p instead\n", ptr2,
info.BaseAddress);
914 ok(
info.AllocationBase == ptr2,
915 "AllocationBase should have been %p but was %p instead\n", ptr2,
info.AllocationBase);
917 "AllocationProtect should have been PAGE_READWRITE but was 0x%lx\n",
info.AllocationProtect);
918 ok(
info.RegionSize == 0x10000,
919 "RegionSize should have been 0x10000 but was 0x%Ix\n",
info.RegionSize);
921 "State should have been MEM_COMMIT instead of 0x%lx\n",
info.State);
923 "Protect should have been PAGE_READWRITE instead of 0x%lx\n",
info.Protect);
930 ok( !
ret,
"VirtualFree succeeded\n" );
956 ok(
info.BaseAddress ==
ptr,
"wrong BaseAddress %p/%p\n",
ptr,
info.BaseAddress);
957 ok(
info.AllocationBase ==
ptr,
"wrong AllocationBase %p/%p\n",
ptr,
info.AllocationBase);
969 ok(
info.BaseAddress ==
ptr,
"wrong BaseAddress %p/%p\n",
ptr,
info.BaseAddress);
970 ok(
info.AllocationBase ==
ptr,
"wrong AllocationBase %p/%p\n",
ptr,
info.AllocationBase);
971 ok(
info.RegionSize == 0x10000,
"wrong RegionSize 0x%Ix\n",
info.RegionSize);
981 ok( !
ret,
"VirtualFree succeeded\n" );
997 "NtQuerySection wrong attr %08lx\n",
section_info.Attributes );
1005 ok(
info.BaseAddress ==
ptr,
"wrong BaseAddress %p/%p\n",
ptr,
info.BaseAddress);
1006 ok(
info.AllocationBase ==
ptr,
"wrong AllocationBase %p/%p\n",
ptr,
info.AllocationBase);
1010 "wrong AllocationProtect 0x%lx\n",
info.AllocationProtect);
1019 ok(
info.BaseAddress ==
ptr,
"wrong BaseAddress %p/%p\n",
ptr,
info.BaseAddress);
1020 ok(
info.AllocationBase ==
ptr,
"wrong AllocationBase %p/%p\n",
ptr,
info.AllocationBase);
1021 ok(
info.RegionSize == 0x10000,
"wrong RegionSize 0x%Ix\n",
info.RegionSize);
1024 "wrong AllocationProtect 0x%lx\n",
info.AllocationProtect);
1039 "got %lu, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
1043 "got %lu, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
1045 ok( !
UnmapViewOfFile((
void *)0xdeadbeef),
"UnmapViewOfFile should fail on VirtualAlloc mem\n" );
1047 "got %lu, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
1061 ok( map2 != 0,
"OpenFileMappingA failed with error %ld\n",
GetLastError() );
1070 ok( !
ret,
"memory is not accessible\n" );
1074 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
1084 ok( map2 == 0,
"OpenFileMappingA succeeded\n" );
1089 ok(
mapping != 0,
"CreateFileMappingA failed\n" );
1096 ok( !
ret,
"memory is not accessible\n" );
1100 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
1113 ok(
ret,
"memory is accessible\n" );
1117 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
1119 ok(
info.AllocationBase ==
NULL,
"%p != NULL\n",
info.AllocationBase);
1120 ok(
info.AllocationProtect == 0,
"%#lx != 0\n",
info.AllocationProtect);
1122 ok(
info.Type == 0,
"%#lx != 0\n",
info.Type);
1138 ok( map2 != 0,
"OpenFileMappingA failed with error %ld\n",
GetLastError() );
1145 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %Iu\n", info_size );
1156 ok( !
ret,
"memory is not accessible\n" );
1160 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
1170 ok( map2 == 0,
"OpenFileMappingA succeeded\n" );
1175 ok(
mapping != 0,
"CreateFileMappingA failed\n" );
1182 ok( !
ret,
"memory is not accessible\n" );
1186 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
1199 ok(
ret,
"memory is accessible\n" );
1203 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
1205 ok(
info.AllocationBase ==
NULL,
"%p != NULL\n",
info.AllocationBase);
1206 ok(
info.AllocationProtect == 0,
"%#lx != 0\n",
info.AllocationProtect);
1208 ok(
info.Type == 0,
"%#lx != 0\n",
info.Type);
1238 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %Iu\n", info_size );
1242 ok(
section_info.Size.QuadPart == 36,
"NtQuerySection wrong size %lx%08lx\n",
1253 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %Iu\n", info_size );
1257 ok(
section_info.Size.QuadPart == 0x3456,
"NtQuerySection wrong size %lx%08lx\n",
1278 ok(
section_info.Size.QuadPart == 0x3452,
"NtQuerySection wrong size %lx%08lx\n",
1299 ok(
section_info.Size.QuadPart == 0x4000,
"NtQuerySection wrong size %lx%08lx\n",
1311 if (
sizeof(
SIZE_T) >
sizeof(
int))
1314 sizeof(image_info) + ((
SIZE_T)0x10000000 << 8),
NULL );
1336 static const char testfile[] =
"testfile.xxx";
1342 if (!pNtAreMappedFilesTheSame)
1344 win_skip(
"NtAreMappedFilesTheSame not available\n" );
1365 ok( map2 != 0,
"CreateFileMapping error %lu\n",
GetLastError() );
1368 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1374 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1380 ok( map2 != 0,
"CreateFileMapping error %lu\n",
GetLastError() );
1383 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1391 "NtAreMappedFilesTheSame returned %lx\n",
status );
1393 status = pNtAreMappedFilesTheSame(
ptr, (
char *)
ptr + 30 );
1395 "NtAreMappedFilesTheSame returned %lx\n",
status );
1400 status = pNtAreMappedFilesTheSame(
ptr, (
void *)0xdeadbeef );
1402 "NtAreMappedFilesTheSame returned %lx\n",
status );
1415 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1462 ok( map2 != 0,
"CreateFileMapping error %lu\n",
GetLastError() );
1465 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1467 status = pNtAreMappedFilesTheSame( ptr2,
ptr );
1542 "Wine Test Mapping");
1548 "Wine Test Mapping");
1555 "WINE TEST MAPPING");
1567 ok( !handle2,
"OpenFileMapping succeeded\n");
1594 flags | perm, 0, 0x1000,
"Wine Test Mapping" );
1595 if (sec_flag_tests[
i].
error)
1597 ok( !
handle,
"%u: CreateFileMapping succeeded\n",
i );
1606 "%u: CreateFileMapping failed with error %lu\n",
i,
GetLastError());
1614 DWORD expect = sec_flag_tests[
i].attrs ? sec_flag_tests[
i].attrs : sec_flag_tests[
i].flags;
1620 "%u: NtQuerySection wrong attr %08lx\n",
i,
info.Attributes );
1632 void *
ptr = (
void *)0xdeadbeef;
1636 ok(
ret ==
FALSE,
"Expected IsBadReadPtr to return FALSE, got %d\n",
ret);
1639 ok(
ret ==
TRUE,
"Expected IsBadReadPtr to return TRUE, got %d\n",
ret);
1642 ok(
ret ==
FALSE,
"Expected IsBadReadPtr to return FALSE, got %d\n",
ret);
1645 ok(
ret ==
TRUE,
"Expected IsBadReadPtr to return TRUE, got %d\n",
ret);
1648 ok(
ret ==
FALSE,
"Expected IsBadReadPtr to return FALSE, got %d\n",
ret);
1651 ok(
ret ==
FALSE,
"Expected IsBadReadPtr to return FALSE, got %d\n",
ret);
1654 ok(
ret ==
TRUE,
"Expected IsBadReadPtr to return TRUE, got %d\n",
ret);
1657 ok(
ret ==
TRUE,
"Expected IsBadReadPtr to return TRUE, got %d\n",
ret);
1663 void *
ptr = (
void *)0xdeadbeef;
1667 ok(
ret ==
FALSE,
"Expected IsBadWritePtr to return FALSE, got %d\n",
ret);
1670 ok(
ret ==
TRUE,
"Expected IsBadWritePtr to return TRUE, got %d\n",
ret);
1673 ok(
ret ==
FALSE,
"Expected IsBadWritePtr to return FALSE, got %d\n",
ret);
1676 ok(
ret ==
TRUE,
"Expected IsBadWritePtr to return TRUE, got %d\n",
ret);
1679 ok(
ret ==
FALSE,
"Expected IsBadWritePtr to return FALSE, got %d\n",
ret);
1682 ok(
ret ==
FALSE,
"Expected IsBadWritePtr to return FALSE, got %d\n",
ret);
1685 ok(
ret ==
TRUE,
"Expected IsBadWritePtr to return TRUE, got %d\n",
ret);
1688 ok(
ret ==
TRUE,
"Expected IsBadWritePtr to return TRUE, got %d\n",
ret);
1694 void *
ptr = (
void *)0xdeadbeef;
1698 ok(
ret ==
TRUE,
"Expected IsBadCodePtr to return TRUE, got %d\n",
ret);
1701 ok(
ret ==
TRUE,
"Expected IsBadCodePtr to return TRUE, got %d\n",
ret);
1704 ok(
ret ==
FALSE,
"Expected IsBadCodePtr to return FALSE, got %d\n",
ret);
1727 ok( num_bytes ==
sizeof(
testdata),
"%u: wrong number of bytes read %lu\n",
args->index, num_bytes );
1729 "%u: didn't receive expected data\n",
args->index );
1735 static const char pipename[] =
"\\\\.\\pipe\\test_write_watch_pipe";
1746 if (!pGetWriteWatch || !pResetWriteWatch)
1748 win_skip(
"GetWriteWatch not supported\n" );
1757 win_skip(
"MEM_WRITE_WATCH not supported\n" );
1763 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
1765 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%Ix\n",
info.RegionSize );
1773 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
1782 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
1794 base[pagesize + 1] = 0x44;
1813 base[2*pagesize + 3] = 0x11;
1814 base[4*pagesize + 8] = 0x11;
1829 ret = pResetWriteWatch(
base, 3*pagesize );
1838 *(
DWORD *)(
base + 2*pagesize - 2) = 0xdeadbeef;
1869 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
1870 ok(
info.RegionSize == 3*pagesize,
"wrong RegionSize 0x%Ix\n",
info.RegionSize );
1887 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
1888 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%Ix\n",
info.RegionSize );
1894 for (
i = 0;
i < 2;
i++)
1905 ok( !
success,
"%lu: ConnectNamedPipe unexpectedly succeeded\n",
i );
1923 ok( !
success,
"%lu: ReadFile unexpectedly succeeded\n",
i );
1935 ok( num_bytes ==
sizeof(
testdata),
"%lu: wrong number of bytes written %lu\n",
i, num_bytes );
1940 ok( num_bytes ==
sizeof(
testdata),
"%lu: wrong number of bytes read %lu\n",
i, num_bytes );
1955 for (
i = 0;
i < 2;
i++)
1972 args.pipe = readpipe;
1990 ok( num_bytes ==
sizeof(
testdata),
"%lu: wrong number of bytes written %lu\n",
i, num_bytes );
2015 ok( num_bytes == 2 * pagesize + 3,
"wrong bytes %lu\n", num_bytes );
2024 ok( num_bytes == 0,
"wrong bytes %lu\n", num_bytes );
2053 ok( !
success,
"ConnectNamedPipe unexpectedly succeeded\n" );
2072 ok( !
success,
"ReadFile unexpectedly succeeded\n" );
2074 overlapped2->
Internal = 0xdeadbeef;
2084 ok( num_bytes ==
sizeof(
testdata),
"wrong number of bytes written %lu\n", num_bytes );
2089 ok( num_bytes ==
sizeof(
testdata),
"wrong number of bytes read %lu\n", num_bytes );
2111 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2116 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2122 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2128 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2134 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2140 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2146 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2152 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2158 ok(
ret == ~0
u,
"GetWriteWatch succeeded %lu\n",
ret );
2162 ret = pResetWriteWatch(
base, 0 );
2163 ok(
ret == ~0
u,
"ResetWriteWatch succeeded %lu\n",
ret );
2168 ok(
ret == ~0
u,
"ResetWriteWatch succeeded %lu\n",
ret );
2181 ok( !
ret,
"GetWriteWatch failed %lu\n",
ret );
2185 ok( !
ret,
"GetWriteWatch failed %lu\n",
ret );
2189 ok( !
ret,
"GetWriteWatch failed %lu\n",
ret );
2191 ret = pResetWriteWatch(
base, 0 );
2192 ok( !
ret,
"ResetWriteWatch failed %lu\n",
ret );
2195 ok( !
ret,
"ResetWriteWatch failed %lu\n",
ret );
2205 ok( !
base,
"VirtualAlloc succeeded\n" );
2224 base[5*pagesize + 200] = 3;
2243 "wrong count %Iu\n",
count );
2249#if defined(__i386__) || defined(__x86_64__)
2253 volatile char *
p = (
char *)&
p;
2256 while (
p >= (
char *)
NtCurrentTeb()->DeallocationStack + 4 * 0x1000)
2262 ok(
arg == (
void *)0xdeadbeef,
"expected 0xdeadbeef, got %p\n",
arg );
2266static void test_stack_commit(
void)
2269 static const char code_call_on_stack[] = {
2273 0x8b, 0x4c, 0x24, 0x0c,
2274 0x8b, 0x54, 0x24, 0x10,
2275 0x8b, 0x44, 0x24, 0x14,
2287 static const char code_call_on_stack[] = {
2292 0x49, 0x83, 0xe0, 0xf0,
2293 0x49, 0x83, 0xe8, 0x20,
2301 void *old_stack, *old_stack_base, *old_stack_limit;
2302 void *new_stack, *new_stack_base;
2307 memcpy( call_on_stack, code_call_on_stack,
sizeof(code_call_on_stack) );
2312 new_stack_base = (
char *)new_stack + 0x400000;
2323 result = call_on_stack( stack_commit_func, (
void *)0xdeadbeef, new_stack_base );
2338static LONG num_guard_page_calls;
2343 trace(
"exception: %08lx flags:%lx addr:%p\n",
2356static void test_guard_page(
void)
2376 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
2378 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%Ix\n",
info.RegionSize );
2398 ok( !
success,
"VirtualLock unexpectedly succeeded\n" );
2407 ok( *
value == 1,
"memory block contains wrong value, expected 1, got 0x%lx\n", *
value );
2415 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
2417 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%Ix\n",
info.RegionSize );
2429 frame.
Handler = guard_page_handler;
2436 ok(
old_value == 0x101,
"memory block contains wrong value, expected 0x101, got 0x%lx\n",
old_value );
2437 ok( num_guard_page_calls == 1,
"expected one callback of guard page handler, got %ld calls\n", num_guard_page_calls );
2451 frame.
Handler = guard_page_handler;
2457 ok(
old_value == 0x102,
"memory block contains wrong value, expected 0x102, got 0x%lx\n",
old_value );
2458 ok( *
value == 2,
"memory block contains wrong value, expected 2, got 0x%lx\n", *
value );
2459 ok( num_guard_page_calls == 1,
"expected one callback of guard page handler, got %ld calls\n", num_guard_page_calls );
2467 ok( *
value == 2,
"memory block contains wrong value, expected 2, got 0x%lx\n", *
value );
2475 if (!pGetWriteWatch || !pResetWriteWatch)
2477 win_skip(
"GetWriteWatch not supported, skipping combined guard page / write watch tests\n" );
2484 win_skip(
"MEM_WRITE_WATCH not supported\n" );
2492 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
2494 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%Ix\n",
info.RegionSize );
2505 frame.
Handler = guard_page_handler;
2512 ok( num_guard_page_calls == 1,
"expected one callback of guard page handler, got %ld calls\n", num_guard_page_calls );
2526 frame.
Handler = guard_page_handler;
2532 ok(
old_value == 0x102,
"memory block contains wrong value, expected 0x102, got 0x%lx\n",
old_value );
2533 ok( *
value == 1,
"memory block contains wrong value, expected 1, got 0x%lx\n", *
value );
2534 ok( num_guard_page_calls == 1,
"expected one callback of guard page handler, got %ld calls\n", num_guard_page_calls );
2550 ok( !
success,
"VirtualLock unexpectedly succeeded\n" );
2564 ok( *
value == 1,
"memory block contains wrong value, expected 1, got 0x%lx\n", *
value );
2570 results[0] = (
void *)0xdeadbeef;
2581static LONG num_execute_fault_calls;
2589 trace(
"exception: %08lx flags:%lx addr:%p info[0]:%Id info[1]:%p\n",
2595 "ExceptionCode is %08lx instead of STATUS_ACCESS_VIOLATION or STATUS_GUARD_PAGE_VIOLATION\n", rec->
ExceptionCode );
2643 trace(
"exception: %08lx flags:%lx addr:%p info[0]:%Id info[1]:%p\n",
2649 "ExceptionCode is %08lx instead of STATUS_ACCESS_VIOLATION\n", rec->
ExceptionCode );
2669 frame.
Handler = execute_fault_seh_handler;
2687 frame.
Handler = execute_fault_seh_handler;
2712 ok(
arg == 0x11223344,
"arg is 0x%08lx instead of 0x11223344\n",
arg );
2714 ok(
arg != 0x11223344,
"arg is unexpectedly 0x11223344\n" );
2723static void test_atl_thunk_emulation(
ULONG dep_flags )
2725 static const char code_jmp[] = {0xE9, 0x00, 0x00, 0x00, 0x00};
2726 static const char code_atl1[] = {0xC7, 0x44, 0x24, 0x04, 0x44, 0x33, 0x22, 0x11, 0xE9, 0x00, 0x00, 0x00, 0x00};
2727 static const char code_atl2[] = {0xB9, 0x44, 0x33, 0x22, 0x11, 0xE9, 0x00, 0x00, 0x00, 0x00};
2728 static const char code_atl3[] = {0xBA, 0x44, 0x33, 0x22, 0x11, 0xB9, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xE1};
2729 static const char code_atl4[] = {0xB9, 0x44, 0x33, 0x22, 0x11, 0xB8, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xE0};
2730 static const char code_atl5[] = {0x59, 0x58, 0x51, 0xFF, 0x60, 0x04};
2731 static const char cls_name[] =
"atl_thunk_class";
2742 trace(
"Running DEP tests with ProcessExecuteFlags = %ld\n", dep_flags );
2745 if (old_flags != dep_flags)
2751 win_skip(
"Skipping DEP tests with ProcessExecuteFlags = %ld\n", dep_flags );
2754 ok( !
ret,
"NtSetInformationProcess failed with status %08lx\n",
ret );
2755 restore_flags =
TRUE;
2763 if (!pGetProcessDEPPolicy)
2764 win_skip(
"GetProcessDEPPolicy not supported\n" );
2768 BOOL policy_permanent = 0xdeadbeef;
2769 DWORD policy_flags = 0xdeadbeef;
2777 memcpy(
base, code_atl2,
sizeof(code_atl2) );
2788 ret |= PROCESS_DEP_ENABLE;
2790 ret |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
2792 ok( policy_flags ==
ret,
"expected policy flags %ld, got %ld\n",
ret, policy_flags );
2793 ok( !policy_permanent ||
broken(policy_permanent == 0x44),
2794 "expected policy permanent FALSE, got %d\n", policy_permanent );
2809 memset( &wc, 0,
sizeof(wc) );
2820 hWnd =
CreateWindowExA(0,
cls_name,
"Test",
WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2824 ok(
ret == 42,
"SendMessage returned unexpected result %ld\n",
ret );
2834 ok(
ret == 42,
"call returned wrong result, expected 42, got %ld\n",
ret );
2835 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
2838 trace(
"DEP hardware support is not available\n" );
2839 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2844 trace(
"DEP hardware support is available\n" );
2846 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2848 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2852 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2861 ok(
ret == 42,
"call returned wrong result, expected 42, got %ld\n",
ret );
2862 ok( num_guard_page_calls == 1,
"expected one STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
2865 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2867 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2870 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2873 ok(
ret == 42,
"call returned wrong result, expected 42, got %ld\n",
ret );
2874 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
2875 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2879 memcpy(
base, code_atl1,
sizeof(code_atl1) );
2886 ok(
ret == 43,
"SendMessage returned unexpected result %ld\n",
ret );
2894 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
2895 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
2898 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2900 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2903 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2913 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
2914 ok( num_guard_page_calls == 1,
"expected one STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
2917 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2919 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2922 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2925 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
2926 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
2927 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2934 if (pRtlAddVectoredExceptionHandler && pRtlRemoveVectoredExceptionHandler)
2936 PVOID vectored_handler;
2941 vectored_handler = pRtlAddVectoredExceptionHandler(
TRUE, &execute_fault_vec_handler );
2942 ok( vectored_handler != 0,
"RtlAddVectoredExceptionHandler failed\n" );
2946 pRtlRemoveVectoredExceptionHandler( vectored_handler );
2948 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
2950 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 2) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2952 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2956 win_skip(
"RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler not found\n" );
2961 memcpy(
base, code_atl2,
sizeof(code_atl2) );
2969 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
2970 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
2973 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2975 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2978 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2980 memcpy(
base, code_atl3,
sizeof(code_atl3) );
2988 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
2989 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
2992 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2994 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2997 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
2999 memcpy(
base, code_atl4,
sizeof(code_atl4) );
3007 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
3008 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3011 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3013 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3016 ok( num_execute_fault_calls == 0 ||
broken(num_execute_fault_calls == 1) ,
3017 "expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3019 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3021 memcpy(
base, code_atl5,
sizeof(code_atl5) );
3029 ok(
ret == 44,
"call returned wrong result, expected 44, got %ld\n",
ret );
3030 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3033 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3035 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3038 ok( num_execute_fault_calls == 0 ||
broken(num_execute_fault_calls == 1) ,
3039 "expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3041 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3063 win_skip(
"MEM_WRITE_WATCH not supported\n" );
3087 memset( &wc, 0,
sizeof(wc) );
3098 hWnd =
CreateWindowExA(0,
cls_name,
"Test",
WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
3102 ok(
ret == 42,
"SendMessage returned unexpected result %ld\n",
ret );
3117 ok(
ret == 42,
"call returned wrong result, expected 42, got %ld\n",
ret );
3118 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3121 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3123 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3126 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3134 ok(
ret == 42,
"call returned wrong result, expected 42, got %ld\n",
ret );
3135 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3136 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3145 ok(
ret == 42,
"call returned wrong result, expected 42, got %ld\n",
ret );
3146 ok( num_guard_page_calls == 1,
"expected one STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3149 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3151 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3154 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3157 ok(
ret == 42,
"call returned wrong result, expected 42, got %ld\n",
ret );
3158 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3159 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3168 memcpy(
base, code_atl1,
sizeof(code_atl1) );
3181 ok(
ret == 43,
"SendMessage returned unexpected result %ld\n",
ret );
3189 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
3190 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3193 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0),
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3195 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3198 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3206 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
3207 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3208 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3218 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
3219 ok( num_guard_page_calls == 1,
"expected one STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3222 ok( num_execute_fault_calls == 1 ||
broken(num_execute_fault_calls == 0) ,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3224 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3227 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3230 ok(
ret == 43,
"call returned wrong result, expected 43, got %ld\n",
ret );
3231 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %ld exceptions\n", num_guard_page_calls );
3232 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %ld exceptions\n", num_execute_fault_calls );
3264 ok( !
ret,
"NtSetInformationProcess failed with status %08lx\n",
ret );
3273 DWORD prot_set, prot_get;
3310 DWORD ret, old_prot, rw_prot, exec_prot,
i,
j;
3322 ok(!
ret,
"VirtualProtect should fail\n");
3324 old_prot = 0xdeadbeef;
3327 ok(old_prot ==
PAGE_NOACCESS,
"got %#lx != expected PAGE_NOACCESS\n", old_prot);
3335 old_prot = 0xdeadbeef;
3338 ok(old_prot ==
PAGE_NOACCESS,
"got %#lx != expected PAGE_NOACCESS\n", old_prot);
3353 old_prot = 0xdeadbeef;
3359 ok(old_prot ==
PAGE_NOACCESS,
"%ld: got %#lx != expected PAGE_NOACCESS\n",
i, old_prot);
3366 ok(
info.Protect == td[
i].prot_get,
"%ld: got %#lx != expected %#lx\n",
i,
info.Protect, td[
i].prot_get);
3374 ok(!
ret,
"%ld: VirtualProtect should fail\n",
i);
3378 old_prot = 0xdeadbeef;
3383 ok(old_prot == td[
i].prot_get,
"%ld: got %#lx != expected %#lx\n",
i, old_prot, td[
i].prot_get);
3385 ok(old_prot ==
PAGE_NOACCESS,
"%ld: got %#lx != expected PAGE_NOACCESS\n",
i, old_prot);
3390 for (
i = 0;
i <= 4;
i++)
3394 for (
j = 0;
j <= 4;
j++)
3396 DWORD prot = exec_prot | rw_prot;
3400 if ((rw_prot && exec_prot) || (!rw_prot && !exec_prot))
3402 ok(!
ptr,
"VirtualAlloc(%02lx) should fail\n", prot);
3409 ok(!
ptr,
"VirtualAlloc(%02lx) should fail\n", prot);
3421 if ((rw_prot && exec_prot) || (!rw_prot && !exec_prot))
3423 ok(!
ret,
"VirtualProtect(%02lx) should fail\n", prot);
3430 ok(!
ret,
"VirtualProtect(%02lx) should fail\n", prot);
3440 exec_prot = 1 << (
i + 4);
3448 switch (prot & 0xff)
3520 ok(
info.Protect == td[
i].prot,
"%ld: got %#lx != expected %#lx\n",
i,
info.Protect, td[
i].prot);
3522 ok(
info.AllocationProtect == td[
i].prot,
"%ld: %#lx != %#lx\n",
i,
info.AllocationProtect, td[
i].prot);
3533 ok(
info.Protect == td[
i].prot,
"%ld: got %#lx != expected %#lx\n",
i,
info.Protect, td[
i].prot);
3544 ok(!
base,
"%ld: VirtualAlloc should fail\n",
i);
3556 DWORD prot_after_write;
3622 page_exec_supported =
FALSE;
3623 ok(
broken(!hmap),
"%ld: CreateFileMapping doesn't support PAGE_EXECUTE\n",
i);
3629 page_exec_supported =
FALSE;
3630 ok(
broken(!hmap),
"%ld: CreateFileMapping doesn't support PAGE_EXECUTE_WRITECOPY\n",
i);
3634 ok(hmap != 0,
"%ld: CreateFileMapping(%04lx) error %ld\n",
i, td[
i].prot,
GetLastError());
3652 ok(!
ptr,
"%ld: VirtualAlloc(%02lx) should fail\n",
i, td[
i].prot);
3661 ok(!
ret,
"%ld: VirtualProtect(%02lx) should fail\n",
i, td[
i].prot);
3670 ok(!hmap,
"%ld: CreateFileMapping should fail\n",
i);
3679 ok(hmap != 0,
"%ld: CreateFileMapping error %ld\n",
i,
GetLastError());
3687 old_prot = 0xdeadbeef;
3691 ok(old_prot == alloc_prot,
"got %#lx != expected %#lx\n", old_prot, alloc_prot);
3700 ok(
info.AllocationProtect == alloc_prot,
"%ld: %#lx != %#lx\n",
i,
info.AllocationProtect, alloc_prot);
3704 old_prot = 0xdeadbeef;
3714 ok(
broken(!
ret),
"%ld: VirtualProtect doesn't support PAGE_EXECUTE\n",
i);
3720 ok(
broken(!
ret),
"%ld: VirtualProtect doesn't support PAGE_EXECUTE\n",
i);
3726 ok(
broken(!
ret),
"%ld: VirtualProtect doesn't support PAGE_EXECUTE_WRITECOPY\n",
i);
3732 ok(old_prot ==
PAGE_NOACCESS,
"%ld: got %#lx != expected PAGE_NOACCESS\n",
i, old_prot);
3739 ok(
info.Protect == td[
i].prot,
"%ld: got %#lx != expected %#lx\n",
i,
info.Protect, td[
i].prot);
3741 ok(
info.AllocationProtect == alloc_prot,
"%ld: %#lx != %#lx\n",
i,
info.AllocationProtect, alloc_prot);
3754 ok(
info.Protect == td[
i].prot_after_write,
"%ld: got %#lx != expected %#lx\n",
i,
info.Protect, td[
i].prot_after_write);
3759 ok(!
ret,
"%ld: VirtualProtect should fail\n",
i);
3764 old_prot = 0xdeadbeef;
3770 ok(old_prot == td[
i].prot_after_write,
"%ld: got %#lx != expected %#lx\n",
i, old_prot, td[
i].prot_after_write);
3781#define ACCESS_READ 0x01
3782#define ACCESS_WRITE 0x02
3783#define ACCESS_EXECUTE 0x04
3807 DWORD view_access, prot_access;
3812 return ((view_access & prot_access) == prot_access);
3841 default:
return prot;
3851 default:
return prot;
3858 access &= ~FILE_MAP_EXECUTE;
3871 return (view_access &
access) == view_access;
3882 if (!pNtMapViewOfSection)
return NULL;
3891 &
count, 1 , 0, protect);
3898 static const DWORD page_prot[] =
3942 DWORD i,
j,
k,
ret, old_prot, prev_prot, alloc_prot;
3947 trace(
"testing %s mapping flags %08lx %s\n", anon_mapping ?
"anonymous" :
"file",
3948 sec_flags, readonly ?
"readonly file" :
"" );
3959 ok(!hmap,
"%ld: CreateFileMapping(%04lx) should fail\n",
i, page_prot[
i]);
3961 "expected ERROR_ACCESS_DENIED, got %ld\n",
GetLastError());
3971 ok(!hmap,
"CreateFileMapping(PAGE_NOACCESS) should fail\n");
3980 ok(hmap != 0,
"CreateFileMapping(PAGE_READWRITE) error %ld\n",
GetLastError());
3989 ok(!hmap,
"CreateFileMapping(PAGE_EXECUTE) should fail\n");
3991 "expected ERROR_INVALID_PARAMETER, got %ld\n",
GetLastError());
4006 ok(
broken(!hmap),
"%ld: CreateFileMapping doesn't support PAGE_EXECUTE\n",
i);
4012 ok(
broken(!hmap),
"%ld: CreateFileMapping doesn't support PAGE_EXECUTE_WRITECOPY\n",
i);
4017 ok(hmap != 0,
"%ld: CreateFileMapping(%04lx) error %ld\n",
i, page_prot[
i],
GetLastError());
4036 "%ld: (%04lx/%04lx) NT %p kernel %p\n",
j, page_prot[
i],
view[
j].
access, nt_base,
base);
4049 ok(!
base,
"%ld: MapViewOfFile(%04lx/%04lx) should fail\n",
4073 "%ld: (%04lx) got %#lx, expected %#lx\n",
j,
view[
j].access,
info.Protect,
view[
j].prot);
4079 "%ld: (%04lx) got %#lx, expected %#lx\n",
j,
view[
j].access,
info.Protect,
view[
j].prot);
4080 ok(
info.AllocationBase ==
base,
"%ld: (%04lx) got %p, expected %p\n",
j,
view[
j].access,
info.AllocationBase,
base);
4085 ok(
info.AllocationProtect ==
info.Protect,
"%ld: (%04lx) got %#lx, expected %#lx\n",
4089 "%ld: (%04lx) got %#lx, expected MEM_MAPPED\n",
j,
view[
j].access,
info.Type);
4091 if (nt_base &&
base)
4096 "%ld: (%04lx) got %#lx, expected %#lx\n",
j,
view[
j].access, nt_info.
Protect,
info.Protect);
4101 ok(nt_info.
Type ==
info.Type,
"%ld: (%04lx) got %#lx, expected %#lx\n",
j,
view[
j].access, nt_info.
Type,
info.Type);
4104 prev_prot =
info.Protect;
4105 alloc_prot =
info.AllocationProtect;
4112 old_prot = 0xdeadbeef;
4119 ok(
broken(!
ret),
"VirtualProtect doesn't support PAGE_EXECUTE\n");
4124 ok(
ret,
"VirtualProtect error %ld, map %#lx, view %#lx, requested prot %#lx\n",
GetLastError(), page_prot[
i],
view[
j].prot, page_prot[
k]);
4126 ok(old_prot == prev_prot,
"got %#lx, expected %#lx\n", old_prot, prev_prot);
4127 prev_prot = actual_prot;
4132 ok(
info.Protect == actual_prot,
4133 "VirtualProtect wrong prot, map %#lx, view %#lx, requested prot %#lx got %#lx\n",
4134 page_prot[
i],
view[
j].prot, page_prot[
k],
info.Protect );
4138 ok(!
ret,
"VirtualProtect should fail, map %#lx, view %#lx, requested prot %#lx\n", page_prot[
i],
view[
j].prot, page_prot[
k]);
4152 ok(
ptr !=
NULL,
"VirtualAlloc error %lu, map %#lx, view %#lx, requested prot %#lx\n",
4159 "VirtualAlloc should fail, map %#lx, view %#lx, requested prot %#lx\n",
4160 page_prot[
i],
view[
j].prot, page_prot[
k]);
4168 ok(
info.Protect == page_prot[
k] ||
4172 "VirtualAlloc wrong prot, map %#lx, view %#lx, requested prot %#lx got %#lx\n",
4173 page_prot[
i],
view[
j].prot, page_prot[
k],
info.Protect );
4178 ok(!
ptr,
"VirtualAlloc(%02lx) should fail\n", page_prot[
k]);
4192 ok(
info.Protect ==
PAGE_READWRITE,
"VirtualProtect wrong prot, map %#lx, view %#lx got %#lx\n",
4195 ok(
info.RegionSize ==
si.
dwPageSize,
"wrong region size %#Ix after write, map %#lx, view %#lx got %#lx\n",
4198 prev_prot =
info.Protect;
4199 alloc_prot =
info.AllocationProtect;
4214 old_prot = 0xdeadbeef;
4221 ok(
broken(!
ret),
"VirtualProtect doesn't support PAGE_EXECUTE\n");
4226 ok(
ret,
"VirtualProtect error %ld, map %#lx, view %#lx, requested prot %#lx\n",
GetLastError(), page_prot[
i],
view[
j].prot, page_prot[
k]);
4228 ok(old_prot == prev_prot,
"got %#lx, expected %#lx\n", old_prot, prev_prot);
4234 "VirtualProtect wrong prot, map %#lx, view %#lx, requested prot %#lx got %#lx\n",
4235 page_prot[
i],
view[
j].prot, page_prot[
k],
info.Protect );
4236 prev_prot =
info.Protect;
4240 ok(!
ret,
"VirtualProtect should fail, map %#lx, view %#lx, requested prot %#lx\n", page_prot[
i],
view[
j].prot, page_prot[
k]);
4272 ok(num_bytes ==
sizeof(
data),
"num_bytes = %ld\n", num_bytes);
4318 ok(*
p == 0x1a2b3c4d,
"expected 0x1a2b3c4d in child, got %#lx\n", *
p);
4379 ok(*
p == 0xdeadbeef,
"*p = %lx, expected 0xdeadbeef\n", *
p);
4381 ok(!*
p,
"*p = %lx, expected 0\n", *
p);
4391 skip(
"Cannot build test_PrefetchVirtualMemory() until kernelbase is synced.\n");
4393 WIN32_MEMORY_RANGE_ENTRY entries[2];
4394 char stackmem[] =
"Test stack mem";
4395 static char testmem[] =
"Test memory range data";
4399 if (!pPrefetchVirtualMemory)
4401 skip(
"no PrefetchVirtualMemory in kernelbase\n");
4406 "PrefetchVirtualMemory unexpected success on 0 entries\n" );
4412 "PrefetchVirtualMemory unexpected status on 1 page-aligned entry: %ld\n",
GetLastError() );
4414 entries[0].VirtualAddress = testmem;
4415 entries[0].NumberOfBytes =
sizeof(testmem);
4418 "PrefetchVirtualMemory unexpected status on 1 entry: %ld\n",
GetLastError() );
4420 entries[0].VirtualAddress =
NULL;
4424 "PrefetchVirtualMemory unexpected status on 1 unmapped entry: %ld\n",
GetLastError() );
4432 "PrefetchVirtualMemory unexpected status on 2 page-aligned entries: %ld\n",
GetLastError() );
4457 ok(!
ret,
"ReadProcessMemory succeeded\n");
4458 ok(!copied,
"copied = %Id\n", copied);
4484#if defined(__REACTOS__) && defined(SKIPBADHEAP_K32_WINETEST)
4486 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");
4535 pRtlAddVectoredExceptionHandler = (
void *)
GetProcAddress(
hntdll,
"RtlAddVectoredExceptionHandler" );
4536 pRtlRemoveVectoredExceptionHandler = (
void *)
GetProcAddress(
hntdll,
"RtlRemoveVectoredExceptionHandler" );
4568#if defined(__i386__) || defined(__x86_64__)
4569 test_stack_commit();
static struct _test_info results[8]
#define InterlockedIncrement
#define InterlockedExchange
#define ReadProcessMemory(a, b, c, d, e)
@ ExceptionContinueExecution
#define ERROR_INVALID_ADDRESS
#define ERROR_INVALID_PARAMETER
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileMappingW(a, b, c, d, e, f)
#define CreateFileA(a, b, c, d, e, f, g)
#define GetCurrentProcess()
#define ERROR_NOT_SUPPORTED
#define ERROR_INVALID_HANDLE
#define ERROR_ACCESS_DENIED
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
BOOL NTAPI IsBadCodePtr(FARPROC lpfn)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI SetEndOfFile(HANDLE hFile)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
BOOL NTAPI WriteProcessMemory(IN HANDLE hProcess, IN LPVOID lpBaseAddress, IN LPCVOID lpBuffer, IN SIZE_T nSize, OUT SIZE_T *lpNumberOfBytesWritten)
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)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
BOOL WINAPI IsProcessorFeaturePresent(IN DWORD ProcessorFeature)
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)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP __msvcrt_long __cdecl strtol(const char *, char **, int)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
HANDLE NTAPI OpenFileMappingA(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCSTR lpName)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
#define STATUS_ACCESS_VIOLATION
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum const GLvoid * addr
GLuint GLint GLboolean GLint GLenum access
GLenum GLenum GLenum GLenum mapping
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
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 GLint GLint j
#define EXCEPTION_CONTINUE_SEARCH
#define EXCEPTION_CONTINUE_EXECUTION
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
_In_ BOOL _In_ HANDLE hProcess
#define todo_wine_if(is_todo)
#define memcpy(s1, s2, n)
#define ERROR_ALREADY_EXISTS
#define FILE_FLAG_OVERLAPPED
#define ERROR_FILE_NOT_FOUND
static PROCESS_INFORMATION pi
static void test_shared_memory(BOOL is_child)
static void test_PrefetchVirtualMemory(void)
static void SIZE_T *static PVECTORED_EXCEPTION_HANDLER
static void test_mappings(void)
static void test_shared_memory_ro(BOOL is_child, DWORD child_access)
static void test_CreateFileMapping(void)
static HINSTANCE hkernel32
static void test_IsBadCodePtr(void)
static void test_write_watch(void)
static BOOL is_compatible_access(DWORD map_prot, DWORD view_prot)
static void test_CreateFileMapping_protection(void)
static const OBJECT_ATTRIBUTES const LARGE_INTEGER ULONG
static void * map_view_of_file(HANDLE handle, DWORD access)
static void test_NtAreMappedFilesTheSame(void)
static const OBJECT_ATTRIBUTES const LARGE_INTEGER HANDLE
static DWORD map_prot_to_access(DWORD prot)
static DWORD file_access_to_prot(DWORD access)
static HANDLE create_target_process(const char *arg)
static void test_VirtualAlloc(void)
static void test_VirtualAlloc_protection(void)
static DWORD page_prot_to_access(DWORD prot)
static DWORD map_prot_no_write(DWORD prot)
static DWORD map_prot_written(DWORD prot)
static SECTION_INFORMATION_CLASS
static void test_MapViewOfFile(void)
static void test_IsBadReadPtr(void)
static HINSTANCE hkernelbase
static PVOID SIZE_T ULONG *static const void void SIZE_T *static void const void SIZE_T *static PWIN32_MEMORY_RANGE_ENTRY
static void test_VirtualAllocEx(void)
static DWORD CALLBACK read_pipe(void *arg)
static void test_VirtualProtect(void)
static void test_ReadProcessMemory(void)
static BOOL is_compatible_protection(DWORD view_prot, DWORD prot)
static BOOL is_mem_writable(DWORD prot)
static void test_IsBadWritePtr(void)
static void test_mapping(HANDLE hfile, DWORD sec_flags, BOOL readonly)
static const char cls_name[]
#define MEM_EXECUTE_OPTION_DISABLE
#define MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION
#define MEM_EXECUTE_OPTION_ENABLE
@ SectionBasicInformation
@ SectionImageInformation
BOOL WINAPI ConnectNamedPipe(IN HANDLE hNamedPipe, IN LPOVERLAPPED lpOverlapped)
HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
#define SECTION_MAP_EXECUTE
#define SECTION_MAP_WRITE
#define PAGE_EXECUTE_READ
#define PAGE_EXECUTE_WRITECOPY
#define PAGE_EXECUTE_READWRITE
NTSTATUS NTAPI NtSetInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _In_reads_bytes_(ProcessInformationLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength)
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)
#define STATUS_INVALID_VIEW_SIZE
#define STATUS_INVALID_ADDRESS
#define STATUS_SECTION_NOT_IMAGE
#define STATUS_INVALID_IMAGE_NOT_MZ
#define STATUS_INVALID_FILE_FOR_SECTION
#define STATUS_MAPPED_FILE_SIZE_ZERO
#define STATUS_CONFLICTING_ADDRESSES
#define STATUS_SECTION_TOO_BIG
#define STATUS_INVALID_INFO_CLASS
#define STATUS_GUARD_PAGE_VIOLATION
#define STATUS_PARTIAL_COPY
#define STATUS_NOT_SAME_DEVICE
int winetest_get_mainargs(char ***pargv)
#define wait_child_process
#define EXCEPTION_EXECUTE_FAULT
#define EXCEPTION_READ_FAULT
#define _WIN32_WINNT_VISTA
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
PEXCEPTION_RECORD ExceptionRecord
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
PEXCEPTION_ROUTINE Handler
struct _EXCEPTION_REGISTRATION_RECORD * Prev
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
#define STATUS_ACCESS_DENIED
#define STATUS_INFO_LENGTH_MISMATCH
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
LPVOID NTAPI VirtualAllocEx(IN HANDLE hProcess, IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
BOOL NTAPI VirtualProtectEx(IN HANDLE hProcess, IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
SIZE_T NTAPI VirtualQueryEx(IN HANDLE hProcess, IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
BOOL NTAPI VirtualUnlock(IN LPVOID lpAddress, IN SIZE_T dwSize)
SIZE_T NTAPI VirtualQuery(IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
BOOL NTAPI VirtualFreeEx(IN HANDLE hProcess, IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
BOOL NTAPI VirtualLock(IN LPVOID lpAddress, IN SIZE_T dwSize)
#define success(from, fromstr, to, tostr)
#define PIPE_ACCESS_INBOUND
DWORD WINAPI GetLastError(void)
#define NMPWAIT_USE_DEFAULT_WAIT
#define FILE_MAP_ALL_ACCESS
#define PIPE_TYPE_MESSAGE
#define ERROR_PARTIAL_COPY
#define ERROR_PATH_NOT_FOUND
#define ERROR_BAD_EXE_FORMAT
#define ERROR_PIPE_CONNECTED
#define WRITE_WATCH_FLAG_RESET
#define SEC_IMAGE_NO_EXECUTE
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
#define DUPLICATE_SAME_ACCESS