26#define MAPPING_SIZE 0x100000
50#define ROUND_SIZE(addr,size) \
51 (((SIZE_T)(size) + ((UINT_PTR)(addr) & page_mask) + page_mask) & ~page_mask)
86 const unsigned int alloc_size = 1<<15;
88 SIZE_T bytes_written = 0, bytes_read = 0,
i;
96 if ((!pVirtualAllocEx) || (!pVirtualFreeEx)) {
97 win_skip(
"Virtual{Alloc,Free}Ex not available\n");
111 for (
i = 0;
i < alloc_size;
i++)
115 ok(
b && (bytes_written == alloc_size),
"%lu bytes written\n",
118 ok(
b && (bytes_read == alloc_size),
"%lu bytes read\n", bytes_read);
119 ok(!
memcmp(
src,
dst, alloc_size),
"Data from remote process differs\n");
126 ok( !
b,
"WriteProcessMemory succeeded\n" );
130 ok( bytes_written == 0,
"%lu bytes written\n", bytes_written );
132 ok( !
b,
"ReadProcessMemory succeeded\n" );
134 ok( bytes_read == 0,
"%lu bytes written\n", bytes_read );
139 ok( !
b,
"WriteProcessMemory succeeded\n" );
143 ok( bytes_written == 0,
"%lu bytes written\n", bytes_written );
145 ok( !
b,
"ReadProcessMemory succeeded\n" );
147 ok( bytes_read == 0,
"%lu bytes written\n", bytes_read );
161 ok(addr1 ==
NULL,
"VirtualAllocEx should fail on zero-sized allocation\n");
163 "got %u, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
166 ok(addr1 !=
NULL,
"VirtualAllocEx failed\n");
171 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
172 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
174 ok(
info.RegionSize == 0x10000,
"%lx != 0x10000\n",
info.RegionSize);
176 ok(
info.Protect == 0,
"%x != PAGE_NOACCESS\n",
info.Protect);
181 "VirtualProtectEx should fail on a not committed memory\n");
183 "got %u, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
186 ok(addr1 == addr2,
"VirtualAllocEx failed\n");
190 "VirtualQueryEx failed\n");
191 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
192 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
194 ok(
info.RegionSize == 0x1000,
"%lx != 0x1000\n",
info.RegionSize);
203 "VirtualProtectEx should fail on a not committed memory\n");
205 "got %u, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
209 ok(old_prot ==
PAGE_NOACCESS,
"wrong old protection: got %04x instead of PAGE_NOACCESS\n", old_prot);
213 ok(old_prot ==
PAGE_READONLY,
"wrong old protection: got %04x instead of PAGE_READONLY\n", old_prot);
215 ok(!pVirtualFreeEx(
hProcess, addr1, 0x10000, 0),
216 "VirtualFreeEx should fail with type 0\n");
218 "got %u, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
224 "VirtualFreeEx should fail\n");
226 "got %u, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
244 ok(addr1 ==
NULL,
"VirtualAlloc should fail on zero-sized allocation\n");
246 "got %d, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
249 ok(addr1 !=
NULL,
"VirtualAlloc failed\n");
253 "VirtualQuery failed\n");
254 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
255 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
257 ok(
info.RegionSize == 0x10000,
"%lx != 0x10000\n",
info.RegionSize);
259 ok(
info.Protect == 0,
"%x != PAGE_NOACCESS\n",
info.Protect);
264 "VirtualProtect should fail on a not committed memory\n");
266 "got %d, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
269 ok(addr1 == addr2,
"VirtualAlloc failed\n");
273 "VirtualQuery failed\n");
274 ok(
info.BaseAddress == addr1,
"%p != %p\n",
info.BaseAddress, addr1);
275 ok(
info.AllocationBase == addr1,
"%p != %p\n",
info.AllocationBase, addr1);
277 ok(
info.RegionSize == 0x1000,
"%lx != 0x1000\n",
info.RegionSize);
286 "VirtualProtect should fail on a not committed memory\n");
288 "got %d, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
292 "wrong old protection: got %04x instead of PAGE_NOACCESS\n", old_prot);
296 "wrong old protection: got %04x instead of PAGE_READONLY\n", old_prot);
299 "VirtualQuery failed\n");
300 ok(
info.RegionSize == 0x1000,
"%lx != 0x1000\n",
info.RegionSize);
303 memset( addr1, 0x55, 20 );
304 ok( *(
DWORD *)addr1 == 0x55555555,
"wrong data %x\n", *(
DWORD *)addr1 );
307 ok( addr2 == addr1,
"VirtualAlloc failed err %u\n",
GetLastError() );
308 ok( *(
DWORD *)addr1 == 0x55555555 || *(
DWORD *)addr1 == 0,
"wrong data %x\n", *(
DWORD *)addr1 );
310 "VirtualQuery failed\n");
311 ok(
info.RegionSize == 0x1000,
"%lx != 0x1000\n",
info.RegionSize);
316 ok( (
char *)addr2 == (
char *)addr1 + 0x1000,
"VirtualAlloc failed\n" );
319 "VirtualQuery failed\n");
320 ok(
info.RegionSize == 0xf000,
"%lx != 0xf000\n",
info.RegionSize);
322 ok(
info.Protect == 0,
"%x != 0\n",
info.Protect);
325 ok( !addr2,
"VirtualAlloc failed\n" );
331 ok(!addr2,
"VirtualAlloc succeeded\n");
336 ok(!addr2,
"VirtualAlloc succeeded\n");
341 ok(!addr2,
"VirtualAlloc succeeded\n");
346 "VirtualProtect succeeded\n");
350 ok(!
VirtualProtect(addr1, 0x1000, 0, &old_prot),
"VirtualProtect succeeded\n");
354 ok(!
VirtualFree(addr1, 0x10000, 0),
"VirtualFree should fail with type 0\n");
356 "got %d, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
361 "got %d, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
368 "got %d, expected ERROR_INVALID_PARAMETER\n",
GetLastError());
374 ok(addr1 !=
NULL,
"VirtualAlloc failed\n");
375 ok(!((
ULONG_PTR)addr1 & 0xffff),
"returned memory %p is not aligned to 64k\n", addr1);
378 ok(addr2 == addr1,
"VirtualAlloc returned %p, expected %p\n", addr2, addr1);
382 addr2 = (
char *)addr1 + 0x1000;
389 addr2 = (
char *)addr1 + 0x1000;
402 "NtAllocateVirtualMemory returned %08x\n",
status);
416 ok(!addr2,
"VirtualAlloc unexpectedly succeeded\n");
421 addr2 = (
char *)addr1 + 0x1000;
432 static const char testfile[] =
"testfile.xxx";
490 ok( !
ptr,
"MapViewOfFile succeeded\n" );
497 ok( !
ptr,
"MapViewOfFile succeeded\n" );
533 ok( !
ptr,
"MapViewOfFile FILE_MAP_WRITE succeeded\n" );
561 ok( !
ptr,
"MapViewOfFile FILE_MAP_WRITE succeeded\n" );
570 ok( !
mapping,
"CreateFileMappingA succeeded\n" );
582 ok( !
mapping,
"CreateFileMapping PAGE_READWRITE succeeded\n" );
605 ok( !
mapping,
"CreateFileMapping PAGE_READWRITE succeeded\n" );
611 ok( !
mapping,
"CreateFileMapping PAGE_WRITECOPY succeeded\n" );
617 ok( !
mapping,
"CreateFileMapping PAGE_READONLY succeeded\n" );
640 ok( !
ptr,
"MapViewOfFile FILE_MAP_WRITE succeeded\n" );
652 ok(
info.RegionSize == 4096,
"%lx != 4096\n",
info.RegionSize );
665 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %u\n", info_size );
669 ok(
section_info.Size.QuadPart ==
info.RegionSize,
"NtQuerySection wrong size %x%08x / %08lx\n",
678 ok( !
ptr,
"MapViewOfFile succeeded\n" );
690 ok(
info.RegionSize == 4096,
"%lx != 4096\n",
info.RegionSize );
704 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %u\n", info_size );
708 ok(
section_info.Size.QuadPart ==
info.RegionSize,
"NtQuerySection wrong size %x%08x / %08lx\n",
731 ok(
ptr != ptr2,
"MapViewOfFile returned same pointer\n" );
735 ok(
info.BaseAddress ==
ptr,
"BaseAddress should have been %p but was %p instead\n",
ptr,
info.BaseAddress);
736 ok(
info.AllocationBase ==
ptr,
"AllocationBase should have been %p but was %p instead\n",
ptr,
info.AllocationBase);
740 "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n",
info.AllocationProtect);
741 ok(
info.Protect == 0,
"Protect should have been 0 instead of 0x%x\n",
info.Protect);
746 ok(
info.BaseAddress == ptr2,
747 "BaseAddress should have been %p but was %p instead\n", ptr2,
info.BaseAddress);
748 ok(
info.AllocationBase == ptr2,
749 "AllocationBase should have been %p but was %p instead\n", ptr2,
info.AllocationBase);
751 "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n",
info.AllocationProtect);
753 "RegionSize should have been 0x%x but was 0x%lx\n",
MAPPING_SIZE,
info.RegionSize);
755 ok(
info.Protect == 0,
"Protect should have been 0 instead of 0x%x\n",
info.Protect);
763 ok(
info.BaseAddress ==
ptr,
"BaseAddress should have been %p but was %p instead\n",
ptr,
info.BaseAddress);
764 ok(
info.AllocationBase ==
ptr,
"AllocationBase should have been %p but was %p instead\n",
ptr,
info.AllocationBase);
765 ok(
info.RegionSize == 0x10000,
"RegionSize should have been 0x10000 but was 0x%lx\n",
info.RegionSize);
766 ok(
info.State ==
MEM_COMMIT,
"State should have been MEM_COMMIT instead of 0x%x\n",
info.State);
769 "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n",
info.AllocationProtect);
777 ok(
info.BaseAddress == ptr2,
778 "BaseAddress should have been %p but was %p instead\n", ptr2,
info.BaseAddress);
779 ok(
info.AllocationBase == ptr2,
780 "AllocationBase should have been %p but was %p instead\n", ptr2,
info.AllocationBase);
782 "AllocationProtect should have been PAGE_READWRITE but was 0x%x\n",
info.AllocationProtect);
783 ok(
info.RegionSize == 0x10000,
784 "RegionSize should have been 0x10000 but was 0x%lx\n",
info.RegionSize);
786 "State should have been MEM_COMMIT instead of 0x%x\n",
info.State);
788 "Protect should have been PAGE_READWRITE instead of 0x%x\n",
info.Protect);
795 ok( !
ret,
"VirtualFree succeeded\n" );
810 "got %u, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
814 "got %u, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
816 ok( !
UnmapViewOfFile((
void *)0xdeadbeef),
"UnmapViewOfFile should fail on VirtualAlloc mem\n" );
818 "got %u, expected ERROR_INVALID_ADDRESS\n",
GetLastError());
832 ok( map2 != 0,
"OpenFileMappingA failed with error %d\n",
GetLastError() );
841 ok( !
ret,
"memory is not accessible\n" );
845 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
856 ok( map2 == 0,
"OpenFileMappingA succeeded\n" );
862 ok(
mapping != 0,
"CreateFileMappingA failed\n" );
870 ok( !
ret,
"memory is not accessible\n" );
874 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
887 ok(
ret,
"memory is accessible\n" );
891 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
893 ok(
info.AllocationBase ==
NULL,
"%p != NULL\n",
info.AllocationBase);
894 ok(
info.AllocationProtect == 0,
"%#x != 0\n",
info.AllocationProtect);
912 ok( map2 != 0,
"OpenFileMappingA failed with error %d\n",
GetLastError() );
919 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %u\n", info_size );
930 ok( !
ret,
"memory is not accessible\n" );
934 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
945 ok( map2 == 0,
"OpenFileMappingA succeeded\n" );
951 ok(
mapping != 0,
"CreateFileMappingA failed\n" );
959 ok( !
ret,
"memory is not accessible\n" );
963 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
976 ok(
ret,
"memory is accessible\n" );
980 ok(
info.BaseAddress ==
ptr,
"got %p != expected %p\n",
info.BaseAddress,
ptr);
982 ok(
info.AllocationBase ==
NULL,
"%p != NULL\n",
info.AllocationBase);
983 ok(
info.AllocationProtect == 0,
"%#x != 0\n",
info.AllocationProtect);
1015 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %u\n", info_size );
1019 ok(
section_info.Size.QuadPart == 36,
"NtQuerySection wrong size %x%08x\n",
1030 ok( info_size ==
sizeof(
section_info),
"NtQuerySection wrong size %u\n", info_size );
1034 ok(
section_info.Size.QuadPart == 0x3456,
"NtQuerySection wrong size %x%08x\n",
1055 ok(
section_info.Size.QuadPart == 0x3452,
"NtQuerySection wrong size %x%08x\n",
1076 ok(
section_info.Size.QuadPart == 0x4000,
"NtQuerySection wrong size %x%08x\n",
1107 static const char testfile[] =
"testfile.xxx";
1108 static const char data[] =
"test data for NtMapViewOfSection";
1117 if (!pNtMapViewOfSection || !pNtUnmapViewOfSection)
1119 win_skip(
"NtMapViewOfSection not available\n" );
1132 ok(
mapping != 0,
"CreateFileMapping failed\n" );
1142 ok( !((
ULONG_PTR)
ptr & 0xffff),
"returned memory %p is not aligned to 64k\n",
ptr );
1145 ok(
ret,
"ReadProcessMemory failed\n" );
1159 ok( !
status,
"NtUnmapViewOfSection failed status %x\n",
status );
1170 ok( !
status,
"NtUnmapViewOfSection failed status %x\n",
status );
1181 ok( !
status,
"NtUnmapViewOfSection failed status %x\n",
status );
1199 ptr2 = (
char *)
ptr + 42;
1206 ptr2 = (
char *)
ptr + 0x1000;
1213 ptr2 = (
char *)
ptr + 0x1000;
1219 ptr2 = (
char *)
ptr + 0x1000;
1225 ptr2 = (
char *)
ptr + 0x1001;
1231 ptr2 = (
char *)
ptr + 0x1000;
1237 if (
sizeof(
void *) ==
sizeof(
int) && (!pIsWow64Process ||
1248 ptr2 = (
char *)
ptr + 42;
1256 ptr2 = (
char *)
ptr + 0x1000;
1262 ok( (
char *)ptr2 == (
char *)
ptr + 0x1000,
1263 "expected address %p, got %p\n", (
char *)
ptr + 0x1000, ptr2 );
1265 ok( !
status,
"NtUnmapViewOfSection failed status %x\n",
status );
1268 ptr2 = (
char *)
ptr + 0x1001;
1274 ok( (
char *)ptr2 == (
char *)
ptr + 0x1000,
1275 "expected address %p, got %p\n", (
char *)
ptr + 0x1000, ptr2 );
1277 ok( !
status,
"NtUnmapViewOfSection failed status %x\n",
status );
1279 ptr2 = (
char *)
ptr + 0x2000;
1285 ok( (
char *)ptr2 == (
char *)
ptr + 0x2000,
1286 "expected address %p, got %p\n", (
char *)
ptr + 0x2000, ptr2 );
1288 ok( !
status,
"NtUnmapViewOfSection failed status %x\n",
status );
1292 ptr2 = (
char *)
ptr + 0x1000;
1302 ok( !
status,
"NtUnmapViewOfSection failed status %x\n",
status );
1314 static const char testfile[] =
"testfile.xxx";
1320 if (!pNtAreMappedFilesTheSame)
1322 win_skip(
"NtAreMappedFilesTheSame not available\n" );
1346 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1352 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1361 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1369 "NtAreMappedFilesTheSame returned %x\n",
status );
1371 status = pNtAreMappedFilesTheSame(
ptr, (
char *)
ptr + 30 );
1373 "NtAreMappedFilesTheSame returned %x\n",
status );
1378 status = pNtAreMappedFilesTheSame(
ptr, (
void *)0xdeadbeef );
1380 "NtAreMappedFilesTheSame returned %x\n",
status );
1393 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1439 status = pNtAreMappedFilesTheSame(
ptr, ptr2 );
1460 "Wine Test Mapping");
1466 "Wine Test Mapping");
1473 "WINE TEST MAPPING");
1485 ok( !handle2,
"OpenFileMapping succeeded\n");
1494 void *
ptr = (
void *)0xdeadbeef;
1498 ok(
ret ==
FALSE,
"Expected IsBadReadPtr to return FALSE, got %d\n",
ret);
1501 ok(
ret ==
TRUE,
"Expected IsBadReadPtr to return TRUE, got %d\n",
ret);
1504 ok(
ret ==
FALSE,
"Expected IsBadReadPtr to return FALSE, got %d\n",
ret);
1507 ok(
ret ==
TRUE,
"Expected IsBadReadPtr to return TRUE, got %d\n",
ret);
1510 ok(
ret ==
FALSE,
"Expected IsBadReadPtr to return FALSE, got %d\n",
ret);
1513 ok(
ret ==
FALSE,
"Expected IsBadReadPtr to return FALSE, got %d\n",
ret);
1519 void *
ptr = (
void *)0xdeadbeef;
1523 ok(
ret ==
FALSE,
"Expected IsBadWritePtr to return FALSE, got %d\n",
ret);
1526 ok(
ret ==
TRUE,
"Expected IsBadWritePtr to return TRUE, got %d\n",
ret);
1529 ok(
ret ==
FALSE,
"Expected IsBadWritePtr to return FALSE, got %d\n",
ret);
1532 ok(
ret ==
TRUE,
"Expected IsBadWritePtr to return TRUE, got %d\n",
ret);
1535 ok(
ret ==
FALSE,
"Expected IsBadWritePtr to return FALSE, got %d\n",
ret);
1538 ok(
ret ==
FALSE,
"Expected IsBadWritePtr to return FALSE, got %d\n",
ret);
1544 void *
ptr = (
void *)0xdeadbeef;
1548 ok(
ret ==
TRUE,
"Expected IsBadCodePtr to return TRUE, got %d\n",
ret);
1551 ok(
ret ==
TRUE,
"Expected IsBadCodePtr to return TRUE, got %d\n",
ret);
1554 ok(
ret ==
FALSE,
"Expected IsBadCodePtr to return FALSE, got %d\n",
ret);
1559 static const char pipename[] =
"\\\\.\\pipe\\test_write_watch_pipe";
1560 static const char testdata[] =
"Hello World";
1563 HANDLE readpipe, writepipe;
1571 if (!pGetWriteWatch || !pResetWriteWatch)
1573 win_skip(
"GetWriteWatch not supported\n" );
1582 win_skip(
"MEM_WRITE_WATCH not supported\n" );
1588 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
1590 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%lx\n",
info.RegionSize );
1598 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1607 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1619 base[pagesize + 1] = 0x44;
1638 base[2*pagesize + 3] = 0x11;
1639 base[4*pagesize + 8] = 0x11;
1654 ret = pResetWriteWatch(
base, 3*pagesize );
1663 *(
DWORD *)(
base + 2*pagesize - 2) = 0xdeadbeef;
1694 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
1695 ok(
info.RegionSize == 3*pagesize,
"wrong RegionSize 0x%lx\n",
info.RegionSize );
1712 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
1713 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%lx\n",
info.RegionSize );
1728 ok( !
success,
"ConnectNamedPipe unexpectedly succeeded\n" );
1745 ok( !
success,
"ReadFile unexpectedly succeeded\n" );
1756 ok( num_bytes ==
sizeof(
testdata),
"wrong number of bytes written\n" );
1761 ok( num_bytes ==
sizeof(
testdata),
"wrong number of bytes read\n" );
1782 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1787 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1793 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1799 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1805 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1811 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1817 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1823 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1829 ok(
ret == ~0
u,
"GetWriteWatch succeeded %u\n",
ret );
1833 ret = pResetWriteWatch(
base, 0 );
1834 ok(
ret == ~0
u,
"ResetWriteWatch succeeded %u\n",
ret );
1839 ok(
ret == ~0
u,
"ResetWriteWatch succeeded %u\n",
ret );
1852 ok( !
ret,
"GetWriteWatch failed %u\n",
ret );
1856 ok( !
ret,
"GetWriteWatch failed %u\n",
ret );
1860 ok( !
ret,
"GetWriteWatch failed %u\n",
ret );
1862 ret = pResetWriteWatch(
base, 0 );
1863 ok( !
ret,
"ResetWriteWatch failed %u\n",
ret );
1866 ok( !
ret,
"ResetWriteWatch failed %u\n",
ret );
1876 ok( !
base,
"VirtualAlloc succeeded\n" );
1895 base[5*pagesize + 200] = 3;
1914 "wrong count %lu\n",
count );
1920#if defined(__i386__) || defined(__x86_64__)
1924 volatile char *
p = (
char *)&
p;
1927 while (
p >= (
char *)
NtCurrentTeb()->DeallocationStack + 4 * 0x1000)
1933 ok(
arg == (
void *)0xdeadbeef,
"expected 0xdeadbeef, got %p\n",
arg );
1937static void test_stack_commit(
void)
1940 static const char code_call_on_stack[] = {
1944 0x8b, 0x4c, 0x24, 0x0c,
1945 0x8b, 0x54, 0x24, 0x10,
1946 0x8b, 0x44, 0x24, 0x14,
1958 static const char code_call_on_stack[] = {
1963 0x49, 0x83, 0xe0, 0xf0,
1964 0x49, 0x83, 0xe8, 0x20,
1972 void *old_stack, *old_stack_base, *old_stack_limit;
1973 void *new_stack, *new_stack_base;
1978 memcpy( call_on_stack, code_call_on_stack,
sizeof(code_call_on_stack) );
1983 new_stack_base = (
char *)new_stack + 0x400000;
1994 result = call_on_stack( stack_commit_func, (
void *)0xdeadbeef, new_stack_base );
2009static LONG num_guard_page_calls;
2014 trace(
"exception: %08x flags:%x addr:%p\n",
2027static void test_guard_page(
void)
2047 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
2049 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%lx\n",
info.RegionSize );
2069 ok( !
success,
"VirtualLock unexpectedly succeeded\n" );
2078 ok( *
value == 1,
"memory block contains wrong value, expected 1, got 0x%x\n", *
value );
2086 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
2088 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%lx\n",
info.RegionSize );
2100 frame.
Handler = guard_page_handler;
2107 ok(
old_value == 0x101,
"memory block contains wrong value, expected 0x101, got 0x%x\n",
old_value );
2108 ok( num_guard_page_calls == 1,
"expected one callback of guard page handler, got %d calls\n", num_guard_page_calls );
2122 frame.
Handler = guard_page_handler;
2128 ok(
old_value == 0x102,
"memory block contains wrong value, expected 0x102, got 0x%x\n",
old_value );
2129 ok( *
value == 2,
"memory block contains wrong value, expected 2, got 0x%x\n", *
value );
2130 ok( num_guard_page_calls == 1,
"expected one callback of guard page handler, got %d calls\n", num_guard_page_calls );
2138 ok( *
value == 2,
"memory block contains wrong value, expected 2, got 0x%x\n", *
value );
2146 if (!pGetWriteWatch || !pResetWriteWatch)
2148 win_skip(
"GetWriteWatch not supported, skipping combined guard page / write watch tests\n" );
2155 win_skip(
"MEM_WRITE_WATCH not supported\n" );
2163 ok(
info.BaseAddress ==
base,
"BaseAddress %p instead of %p\n",
info.BaseAddress,
base );
2165 ok(
info.RegionSize ==
size,
"wrong RegionSize 0x%lx\n",
info.RegionSize );
2176 frame.
Handler = guard_page_handler;
2183 ok( num_guard_page_calls == 1,
"expected one callback of guard page handler, got %d calls\n", num_guard_page_calls );
2197 frame.
Handler = guard_page_handler;
2203 ok(
old_value == 0x102,
"memory block contains wrong value, expected 0x102, got 0x%x\n",
old_value );
2204 ok( *
value == 1,
"memory block contains wrong value, expected 1, got 0x%x\n", *
value );
2205 ok( num_guard_page_calls == 1,
"expected one callback of guard page handler, got %d calls\n", num_guard_page_calls );
2221 ok( !
success,
"VirtualLock unexpectedly succeeded\n" );
2235 ok( *
value == 1,
"memory block contains wrong value, expected 1, got 0x%x\n", *
value );
2241 results[0] = (
void *)0xdeadbeef;
2252static LONG num_execute_fault_calls;
2260 trace(
"exception: %08x flags:%x addr:%p info[0]:%ld info[1]:%p\n",
2266 "ExceptionCode is %08x instead of STATUS_ACCESS_VIOLATION or STATUS_GUARD_PAGE_VIOLATION\n", rec->
ExceptionCode );
2304 trace(
"exception: %08x flags:%x addr:%p info[0]:%ld info[1]:%p\n",
2310 "ExceptionCode is %08x instead of STATUS_ACCESS_VIOLATION\n", rec->
ExceptionCode );
2330 frame.
Handler = execute_fault_seh_handler;
2348 frame.
Handler = execute_fault_seh_handler;
2373 ok(
arg == 0x11223344,
"arg is 0x%08x instead of 0x11223344\n",
arg );
2375 ok(
arg != 0x11223344,
"arg is unexpectedly 0x11223344\n" );
2384static void test_atl_thunk_emulation(
ULONG dep_flags )
2386 static const char code_jmp[] = {0xE9, 0x00, 0x00, 0x00, 0x00};
2387 static const char code_atl1[] = {0xC7, 0x44, 0x24, 0x04, 0x44, 0x33, 0x22, 0x11, 0xE9, 0x00, 0x00, 0x00, 0x00};
2388 static const char code_atl2[] = {0xB9, 0x44, 0x33, 0x22, 0x11, 0xE9, 0x00, 0x00, 0x00, 0x00};
2389 static const char code_atl3[] = {0xBA, 0x44, 0x33, 0x22, 0x11, 0xB9, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xE1};
2390 static const char code_atl4[] = {0xB9, 0x44, 0x33, 0x22, 0x11, 0xB8, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xE0};
2391 static const char code_atl5[] = {0x59, 0x58, 0x51, 0xFF, 0x60, 0x04};
2392 static const char cls_name[] =
"atl_thunk_class";
2403 trace(
"Running DEP tests with ProcessExecuteFlags = %d\n", dep_flags );
2406 if (old_flags != dep_flags)
2411 win_skip(
"Skipping DEP tests with ProcessExecuteFlags = %d\n", dep_flags );
2414 ok( !
ret,
"NtSetInformationProcess failed with status %08x\n",
ret );
2415 restore_flags =
TRUE;
2423 if (!pGetProcessDEPPolicy)
2424 win_skip(
"GetProcessDEPPolicy not supported\n" );
2428 BOOL policy_permanent = 0xdeadbeef;
2429 DWORD policy_flags = 0xdeadbeef;
2437 memcpy(
base, code_atl2,
sizeof(code_atl2) );
2448 ret |= PROCESS_DEP_ENABLE;
2450 ret |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
2452 ok( policy_flags ==
ret,
"expected policy flags %d, got %d\n",
ret, policy_flags );
2453 ok( !policy_permanent ||
broken(policy_permanent == 0x44),
2454 "expected policy permanent FALSE, got %d\n", policy_permanent );
2469 memset( &wc, 0,
sizeof(wc) );
2480 hWnd =
CreateWindowExA(0,
cls_name,
"Test",
WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2484 ok(
ret == 42,
"SendMessage returned unexpected result %d\n",
ret );
2494 ok(
ret == 42,
"call returned wrong result, expected 42, got %d\n",
ret );
2495 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2498 trace(
"DEP hardware support is not available\n" );
2499 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2504 trace(
"DEP hardware support is available\n" );
2505 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2508 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2517 ok(
ret == 42,
"call returned wrong result, expected 42, got %d\n",
ret );
2518 ok( num_guard_page_calls == 1,
"expected one STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2520 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2522 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2525 ok(
ret == 42,
"call returned wrong result, expected 42, got %d\n",
ret );
2526 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2527 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2531 memcpy(
base, code_atl1,
sizeof(code_atl1) );
2538 ok(
ret == 43,
"SendMessage returned unexpected result %d\n",
ret );
2546 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2547 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2549 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2551 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2561 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2562 ok( num_guard_page_calls == 1,
"expected one STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2564 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2566 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2569 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2570 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2571 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2578 if (pRtlAddVectoredExceptionHandler && pRtlRemoveVectoredExceptionHandler)
2580 PVOID vectored_handler;
2585 vectored_handler = pRtlAddVectoredExceptionHandler(
TRUE, &execute_fault_vec_handler );
2586 ok( vectored_handler != 0,
"RtlAddVectoredExceptionHandler failed\n" );
2590 pRtlRemoveVectoredExceptionHandler( vectored_handler );
2592 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2593 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2596 win_skip(
"RtlAddVectoredExceptionHandler or RtlRemoveVectoredExceptionHandler not found\n" );
2601 memcpy(
base, code_atl2,
sizeof(code_atl2) );
2609 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2610 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2612 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2614 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2616 memcpy(
base, code_atl3,
sizeof(code_atl3) );
2624 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2625 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2627 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2629 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2631 memcpy(
base, code_atl4,
sizeof(code_atl4) );
2639 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2640 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2642 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2644 ok( num_execute_fault_calls == 0 ||
broken(num_execute_fault_calls == 1) ,
2645 "expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2647 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2649 memcpy(
base, code_atl5,
sizeof(code_atl5) );
2655 ret = call_proc_excpt( (
void *)
base, &
ret - 1 );
2657 ok(
ret == 44,
"call returned wrong result, expected 44, got %d\n",
ret );
2658 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2660 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2662 ok( num_execute_fault_calls == 0 ||
broken(num_execute_fault_calls == 1) ,
2663 "expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2665 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2687 win_skip(
"MEM_WRITE_WATCH not supported\n" );
2711 memset( &wc, 0,
sizeof(wc) );
2722 hWnd =
CreateWindowExA(0,
cls_name,
"Test",
WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2726 ok(
ret == 42,
"SendMessage returned unexpected result %d\n",
ret );
2741 ok(
ret == 42,
"call returned wrong result, expected 42, got %d\n",
ret );
2742 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2744 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2746 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2754 ok(
ret == 42,
"call returned wrong result, expected 42, got %d\n",
ret );
2755 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2756 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2765 ok(
ret == 42,
"call returned wrong result, expected 42, got %d\n",
ret );
2766 ok( num_guard_page_calls == 1,
"expected one STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2768 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2770 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2773 ok(
ret == 42,
"call returned wrong result, expected 42, got %d\n",
ret );
2774 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2775 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2784 memcpy(
base, code_atl1,
sizeof(code_atl1) );
2797 ok(
ret == 43,
"SendMessage returned unexpected result %d\n",
ret );
2805 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2806 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2808 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2810 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2818 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2819 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2820 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2830 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2831 ok( num_guard_page_calls == 1,
"expected one STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2833 ok( num_execute_fault_calls == 1,
"expected one STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2835 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2838 ok(
ret == 43,
"call returned wrong result, expected 43, got %d\n",
ret );
2839 ok( num_guard_page_calls == 0,
"expected no STATUS_GUARD_PAGE_VIOLATION exception, got %d exceptions\n", num_guard_page_calls );
2840 ok( num_execute_fault_calls == 0,
"expected no STATUS_ACCESS_VIOLATION exception, got %d exceptions\n", num_execute_fault_calls );
2872 ok( !
ret,
"NtSetInformationProcess failed with status %08x\n",
ret );
2882 DWORD prot_set, prot_get;
2919 DWORD ret, old_prot, rw_prot, exec_prot,
i,
j;
2935 ok(!
ret,
"VirtualProtect should fail\n");
2937 old_prot = 0xdeadbeef;
2940 ok(old_prot ==
PAGE_NOACCESS,
"got %#x != expected PAGE_NOACCESS\n", old_prot);
2948 old_prot = 0xdeadbeef;
2951 ok(old_prot ==
PAGE_NOACCESS,
"got %#x != expected PAGE_NOACCESS\n", old_prot);
2953 for (
i = 0;
i <
sizeof(td)/
sizeof(td[0]);
i++)
2966 old_prot = 0xdeadbeef;
2972 ok(old_prot ==
PAGE_NOACCESS,
"%d: got %#x != expected PAGE_NOACCESS\n",
i, old_prot);
2979 ok(
info.Protect == td[
i].prot_get,
"%d: got %#x != expected %#x\n",
i,
info.Protect, td[
i].prot_get);
2987 ok(!
ret,
"%d: VirtualProtect should fail\n",
i);
2991 old_prot = 0xdeadbeef;
2996 ok(old_prot == td[
i].prot_get,
"%d: got %#x != expected %#x\n",
i, old_prot, td[
i].prot_get);
2998 ok(old_prot ==
PAGE_NOACCESS,
"%d: got %#x != expected PAGE_NOACCESS\n",
i, old_prot);
3003 for (
i = 0;
i <= 4;
i++)
3007 for (
j = 0;
j <= 4;
j++)
3009 DWORD prot = exec_prot | rw_prot;
3013 if ((rw_prot && exec_prot) || (!rw_prot && !exec_prot))
3015 ok(!
ptr,
"VirtualAlloc(%02x) should fail\n", prot);
3022 ok(!
ptr,
"VirtualAlloc(%02x) should fail\n", prot);
3034 if ((rw_prot && exec_prot) || (!rw_prot && !exec_prot))
3036 ok(!
ret,
"VirtualProtect(%02x) should fail\n", prot);
3043 ok(!
ret,
"VirtualProtect(%02x) should fail\n", prot);
3053 exec_prot = 1 << (
i + 4);
3061 switch (prot & 0xff)
3123 for (
i = 0;
i <
sizeof(td)/
sizeof(td[0]);
i++)
3137 ok(
info.Protect == td[
i].prot,
"%d: got %#x != expected %#x\n",
i,
info.Protect, td[
i].prot);
3139 ok(
info.AllocationProtect == td[
i].prot,
"%d: %#x != %#x\n",
i,
info.AllocationProtect, td[
i].prot);
3150 ok(
info.Protect == td[
i].prot,
"%d: got %#x != expected %#x\n",
i,
info.Protect, td[
i].prot);
3161 ok(!
base,
"%d: VirtualAlloc should fail\n",
i);
3173 DWORD prot_after_write;
3210 DWORD ret,
i, alloc_prot, prot, old_prot;
3230 for (
i = 0;
i <
sizeof(td)/
sizeof(td[0]);
i++)
3243 page_exec_supported =
FALSE;
3244 ok(
broken(!hmap),
"%d: CreateFileMapping doesn't support PAGE_EXECUTE\n",
i);
3250 page_exec_supported =
FALSE;
3251 ok(
broken(!hmap),
"%d: CreateFileMapping doesn't support PAGE_EXECUTE_WRITECOPY\n",
i);
3255 ok(hmap != 0,
"%d: CreateFileMapping(%04x) error %d\n",
i, td[
i].prot,
GetLastError());
3278 ok(
info.Protect == td[
i].prot,
"%d: got %#x != expected %#x\n",
i,
info.Protect, td[
i].prot);
3283 ok(!
ptr,
"%d: VirtualAlloc(%02x) should fail\n",
i, td[
i].prot);
3294 ok(!
ret,
"%d: VirtualProtect(%02x) should fail\n",
i, td[
i].prot);
3303 ok(!hmap,
"%d: CreateFileMapping should fail\n",
i);
3318 old_prot = 0xdeadbeef;
3322 ok(old_prot == alloc_prot,
"got %#x != expected %#x\n", old_prot, alloc_prot);
3324 for (
i = 0;
i <
sizeof(td)/
sizeof(td[0]);
i++)
3333 ok(
info.AllocationProtect == alloc_prot,
"%d: %#x != %#x\n",
i,
info.AllocationProtect, alloc_prot);
3337 old_prot = 0xdeadbeef;
3347 ok(
broken(!
ret),
"%d: VirtualProtect doesn't support PAGE_EXECUTE\n",
i);
3353 ok(
broken(!
ret),
"%d: VirtualProtect doesn't support PAGE_EXECUTE\n",
i);
3359 ok(
broken(!
ret),
"%d: VirtualProtect doesn't support PAGE_EXECUTE_WRITECOPY\n",
i);
3365 ok(old_prot ==
PAGE_NOACCESS,
"%d: got %#x != expected PAGE_NOACCESS\n",
i, old_prot);
3378 ok(
info.Protect == prot,
"%d: got %#x != expected %#x\n",
i,
info.Protect, prot);
3380 ok(
info.AllocationProtect == alloc_prot,
"%d: %#x != %#x\n",
i,
info.AllocationProtect, alloc_prot);
3393 ok(
info.Protect == td[
i].prot_after_write,
"%d: got %#x != expected %#x\n",
i,
info.Protect, td[
i].prot_after_write);
3398 ok(!
ret,
"%d: VirtualProtect should fail\n",
i);
3403 old_prot = 0xdeadbeef;
3409 ok(old_prot == td[
i].prot_after_write,
"%d: got %#x != expected %#x\n",
i, old_prot, td[
i].prot_after_write);
3419#define ACCESS_READ 0x01
3420#define ACCESS_WRITE 0x02
3421#define ACCESS_EXECUTE 0x04
3422#define ACCESS_WRITECOPY 0x08
3454 DWORD map_access, view_access, prot_access;
3460 if (view_access == prot_access)
return TRUE;
3461 if (!view_access)
return FALSE;
3463 if ((view_access & prot_access) != prot_access)
return FALSE;
3464 if ((map_access & prot_access) == prot_access)
return TRUE;
3491 return (view_prot &
access) == view_prot;
3503 if (!pNtMapViewOfSection)
return NULL;
3510 access &= ~FILE_MAP_EXECUTE;
3537 &
count, 1 , 0, protect);
3549 static const DWORD page_prot[] =
3612 for (
i = 0;
i <
sizeof(page_prot)/
sizeof(page_prot[0]);
i++)
3621 ok(!hmap,
"CreateFileMapping(PAGE_NOACCESS) should fail\n");
3627 ok(hmap != 0,
"CreateFileMapping(PAGE_READWRITE) error %d\n",
GetLastError());
3642 ok(
broken(!hmap),
"%d: CreateFileMapping doesn't support PAGE_EXECUTE\n",
i);
3648 ok(
broken(!hmap),
"%d: CreateFileMapping doesn't support PAGE_EXECUTE_WRITECOPY\n",
i);
3653 ok(hmap != 0,
"%d: CreateFileMapping(%04x) error %d\n",
i, page_prot[
i],
GetLastError());
3655 for (
j = 0;
j <
sizeof(
view)/
sizeof(
view[0]);
j++)
3672 "%d: (%04x/%04x) NT %p kernel %p\n",
j, page_prot[
i],
view[
j].
access, nt_base,
base);
3699 "%d: (%04x) got %#x, expected %#x\n",
j,
view[
j].access,
info.Protect,
view[
j].prot);
3701 ok(
info.AllocationProtect ==
info.Protect,
"%d: (%04x) got %#x, expected %#x\n",
j,
view[
j].access,
info.AllocationProtect,
info.Protect);
3705 if (nt_base &&
base)
3710 "%d: (%04x) got %#x, expected %#x\n",
j,
view[
j].access, nt_info.
Protect,
info.Protect);
3718 prev_prot =
info.Protect;
3720 for (
k = 0;
k <
sizeof(page_prot)/
sizeof(page_prot[0]);
k++)
3724 old_prot = 0xdeadbeef;
3731 ok(
broken(!
ret),
"VirtualProtect doesn't support PAGE_EXECUTE\n");
3737 ok(
broken(!
ret),
"VirtualProtect doesn't support PAGE_EXECUTE\n");
3743 ok(
broken(!
ret),
"VirtualProtect doesn't support PAGE_EXECUTE_WRITECOPY\n");
3749 ok(
broken(!
ret),
"VirtualProtect doesn't support PAGE_EXECUTE_WRITECOPY view properly\n");
3753 ok(
ret,
"VirtualProtect error %d, map %#x, view %#x, requested prot %#x\n",
GetLastError(), page_prot[
i],
view[
j].prot, page_prot[
k]);
3754 ok(old_prot == prev_prot,
"got %#x, expected %#x\n", old_prot, prev_prot);
3755 prev_prot = page_prot[
k];
3762 ok(
broken(
ret),
"VirtualProtect should fail, map %#x, view %#x, requested prot %#x\n", page_prot[
i],
view[
j].prot, page_prot[
k]);
3763 skip(
"Incompatible map and view are not properly handled on this platform\n");
3767 ok(!
ret,
"VirtualProtect should fail, map %#x, view %#x, requested prot %#x\n", page_prot[
i],
view[
j].prot, page_prot[
k]);
3772 for (
k = 0;
k <
sizeof(page_prot)/
sizeof(page_prot[0]);
k++)
3777 ok(!
ptr,
"VirtualAlloc(%02x) should fail\n", page_prot[
k]);
3810 ok(*
p == 0x1a2b3c4d,
"expected 0x1a2b3c4d in child, got %#x\n", *
p);
3871 ok(*
p == 0xdeadbeef,
"*p = %x, expected 0xdeadbeef\n", *
p);
3873 ok(!*
p,
"*p = %x, expected 0\n", *
p);
3897 if (!pNtQuerySection)
3899 win_skip(
"NtQuerySection is not available\n");
3935 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
3936 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
3937 ok(
info.basic.Attributes ==
SEC_FILE,
"expected SEC_FILE, got %#x\n",
info.basic.Attributes);
3938 ok(
info.basic.Size.QuadPart ==
fsize,
"expected %#lx, got %#x/%08x\n",
fsize,
info.basic.Size.HighPart,
info.basic.Size.LowPart);
3957 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
3958 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
3959 ok(
info.basic.Attributes ==
SEC_FILE,
"expected SEC_FILE, got %#x\n",
info.basic.Attributes);
3960 ok(
info.basic.Size.QuadPart ==
fsize,
"expected %#lx, got %#x/%08x\n",
fsize,
info.basic.Size.HighPart,
info.basic.Size.LowPart);
3976 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
3977 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
4003 ok(
ret ==
sizeof(
info.image),
"wrong returned size %u\n",
ret);
4006 ok(
info.image.ZeroBits == 0,
"expected 0, got %#x\n",
info.image.ZeroBits);
4016 ok(
info.image.ImageContainsCode ==
TRUE,
"expected 1, got %#x\n",
info.image.ImageContainsCode);
4022 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
4023 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
4038 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
4039 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
4041 ok(
info.basic.Attributes ==
SEC_FILE,
"expected SEC_FILE, got %#x\n",
info.basic.Attributes);
4042 ok(
info.basic.Size.QuadPart ==
fsize,
"expected %#lx, got %#x/%08x\n",
fsize,
info.basic.Size.HighPart,
info.basic.Size.LowPart);
4054 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
4055 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
4056 ok(
info.basic.Attributes ==
SEC_FILE,
"expected SEC_FILE, got %#x\n",
info.basic.Attributes);
4057 ok(
info.basic.Size.QuadPart ==
fsize,
"expected %#lx, got %#x/%08x\n",
fsize,
info.basic.Size.HighPart,
info.basic.Size.LowPart);
4070 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
4071 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
4072 ok(
info.basic.Attributes ==
SEC_COMMIT,
"expected SEC_COMMIT, got %#x\n",
info.basic.Attributes);
4073 ok(
info.basic.Size.QuadPart == 4096,
"expected 4096, got %#x/%08x\n",
info.basic.Size.HighPart,
info.basic.Size.LowPart);
4083 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
4084 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
4085 ok(
info.basic.Attributes ==
SEC_COMMIT,
"expected SEC_COMMIT, got %#x\n",
info.basic.Attributes);
4086 ok(
info.basic.Size.QuadPart == 4096,
"expected 4096, got %#x/%08x\n",
info.basic.Size.HighPart,
info.basic.Size.LowPart);
4099 ok(
ret ==
sizeof(
info.basic),
"wrong returned size %u\n",
ret);
4100 ok(
info.basic.BaseAddress ==
NULL,
"expected NULL, got %p\n",
info.basic.BaseAddress);
4102 ok(
info.basic.Size.QuadPart == 4096,
"expected 4096, got %#x/%08x\n",
info.basic.Size.HighPart,
info.basic.Size.LowPart);
4113#if defined(__REACTOS__) && defined(_M_AMD64)
4116 skip(
"ROSTESTS-369: Skipping kernel32_winetest:virtual because it crashes on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n");
4167 pRtlAddVectoredExceptionHandler = (
void *)
GetProcAddress(
hntdll,
"RtlAddVectoredExceptionHandler" );
4168 pRtlRemoveVectoredExceptionHandler = (
void *)
GetProcAddress(
hntdll,
"RtlRemoveVectoredExceptionHandler" );
4192#if defined(__i386__) || defined(__x86_64__)
4193 test_stack_commit();
static struct _test_info results[8]
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#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_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)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
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 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)
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
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#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
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
#define memcpy(s1, s2, n)
#define ERROR_ALREADY_EXISTS
#define FILE_FLAG_OVERLAPPED
#define ERROR_FILE_NOT_FOUND
#define sprintf(buf, format,...)
static const OBJECT_ATTRIBUTES const LARGE_INTEGER ULONG
static void test_shared_memory(BOOL is_child)
static void test_shared_memory_ro(BOOL is_child, DWORD child_access)
static void test_CreateFileMapping(void)
static void test_NtQuerySection(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 void test_mapping(void)
static void ULONG *static PVECTORED_EXCEPTION_HANDLER
static void test_NtMapViewOfSection(void)
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 HANDLE create_target_process(const char *arg)
static void test_VirtualAlloc(void)
#define ROUND_SIZE(addr, size)
static void test_VirtualAlloc_protection(void)
static DWORD page_prot_to_access(DWORD prot)
static PIMAGE_NT_HEADERS image_nt_header(HMODULE module)
static UINT_PTR page_mask
static SECTION_INFORMATION_CLASS
static void test_MapViewOfFile(void)
static void test_IsBadReadPtr(void)
static void test_VirtualAllocEx(void)
static BOOL is_compatible_protection(DWORD map_prot, DWORD view_prot, DWORD prot)
static void test_VirtualProtect(void)
static BOOL is_mem_writable(DWORD prot)
static void test_IsBadWritePtr(void)
#define todo_wine_if(is_todo)
static const char cls_name[]
unsigned __int3264 UINT_PTR
#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 PVOID ProcessInformation, IN ULONG ProcessInformationLength)
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
#define STATUS_INVALID_VIEW_SIZE
#define STATUS_INVALID_ADDRESS
#define STATUS_MAPPED_ALIGNMENT
#define STATUS_SECTION_NOT_IMAGE
#define STATUS_INVALID_PARAMETER_9
#define STATUS_INVALID_PARAMETER_4
#define STATUS_INVALID_IMAGE_NOT_MZ
#define STATUS_INVALID_FILE_FOR_SECTION
#define STATUS_ACCESS_VIOLATION
#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_INVALID_PARAMETER_3
#define STATUS_INVALID_PARAMETER_5
#define STATUS_NOT_SAME_DEVICE
#define IMAGE_NT_SIGNATURE
#define IMAGE_DOS_SIGNATURE
int winetest_get_mainargs(char ***pargv)
void winetest_wait_child_process(HANDLE process)
#define EXCEPTION_EXECUTE_FAULT
#define EXCEPTION_READ_FAULT
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)
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 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 ERROR_PARTIAL_COPY
#define ERROR_PATH_NOT_FOUND
#define WRITE_WATCH_FLAG_RESET
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 SECTION_MAP_EXECUTE_EXPLICIT