Alexandre Julliard : kernel32/tests: Retrieve the page size only once.
Alexandre Julliard
julliard at winehq.org
Mon Sep 11 15:07:59 CDT 2017
Module: wine
Branch: master
Commit: 9b85cebf051762e25089c2ebf4cb0d889c4b1dfb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9b85cebf051762e25089c2ebf4cb0d889c4b1dfb
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Sep 11 11:18:48 2017 +0200
kernel32/tests: Retrieve the page size only once.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/virtual.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index 9b99464..4d9335e 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -36,6 +36,7 @@
#define MAPPING_SIZE 0x100000
static HINSTANCE hkernel32, hntdll;
+static SYSTEM_INFO si;
static LPVOID (WINAPI *pVirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD);
static BOOL (WINAPI *pVirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD);
static UINT (WINAPI *pGetWriteWatch)(DWORD,LPVOID,SIZE_T,LPVOID*,ULONG_PTR*,ULONG*);
@@ -3184,14 +3185,10 @@ static void test_VirtualProtect(void)
char *base, *ptr;
DWORD ret, old_prot, rw_prot, exec_prot, i, j;
MEMORY_BASIC_INFORMATION info;
- SYSTEM_INFO si;
void *addr;
SIZE_T size;
NTSTATUS status;
- GetSystemInfo(&si);
- trace("system page size %#x\n", si.dwPageSize);
-
SetLastError(0xdeadbeef);
base = VirtualAlloc(0, si.dwPageSize, MEM_RESERVE | MEM_COMMIT, PAGE_NOACCESS);
ok(base != NULL, "VirtualAlloc failed %d\n", GetLastError());
@@ -3381,10 +3378,6 @@ static void test_VirtualAlloc_protection(void)
char *base, *ptr;
DWORD ret, i;
MEMORY_BASIC_INFORMATION info;
- SYSTEM_INFO si;
-
- GetSystemInfo(&si);
- trace("system page size %#x\n", si.dwPageSize);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
@@ -3475,15 +3468,11 @@ static void test_CreateFileMapping_protection(void)
char *base, *ptr;
DWORD ret, i, alloc_prot, prot, old_prot;
MEMORY_BASIC_INFORMATION info;
- SYSTEM_INFO si;
char temp_path[MAX_PATH];
char file_name[MAX_PATH];
HANDLE hfile, hmap;
BOOL page_exec_supported = TRUE;
- GetSystemInfo(&si);
- trace("system page size %#x\n", si.dwPageSize);
-
GetTempPathA(MAX_PATH, temp_path);
GetTempFileNameA(temp_path, "map", 0, file_name);
@@ -3857,15 +3846,11 @@ static void test_mapping(void)
};
void *base, *nt_base, *ptr;
DWORD i, j, k, ret, old_prot, prev_prot;
- SYSTEM_INFO si;
char temp_path[MAX_PATH];
char file_name[MAX_PATH];
HANDLE hfile, hmap;
MEMORY_BASIC_INFORMATION info, nt_info;
- GetSystemInfo(&si);
- trace("system page size %#x\n", si.dwPageSize);
-
GetTempPathA(MAX_PATH, temp_path);
GetTempFileNameA(temp_path, "map", 0, file_name);
@@ -4201,6 +4186,9 @@ START_TEST(virtual)
pNtAllocateVirtualMemory = (void *)GetProcAddress( hntdll, "NtAllocateVirtualMemory" );
pNtFreeVirtualMemory = (void *)GetProcAddress( hntdll, "NtFreeVirtualMemory" );
+ GetSystemInfo(&si);
+ trace("system page size %#x\n", si.dwPageSize);
+
test_shared_memory(FALSE);
test_shared_memory_ro(FALSE, FILE_MAP_READ|FILE_MAP_WRITE);
test_shared_memory_ro(FALSE, FILE_MAP_COPY);
More information about the wine-cvs
mailing list