Alexandre Julliard : winedevice: Retrieve the page size from ntdll.
Alexandre Julliard
julliard at winehq.org
Wed Jan 9 13:30:37 CST 2013
Module: wine
Branch: master
Commit: 58176bba105c4e9af54f0ea9ef13fe06ce886819
URL: http://source.winehq.org/git/wine.git/?a=commit;h=58176bba105c4e9af54f0ea9ef13fe06ce886819
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jan 8 22:01:48 2013 +0100
winedevice: Retrieve the page size from ntdll.
---
programs/winedevice/device.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c
index e48218e..72bc124 100644
--- a/programs/winedevice/device.c
+++ b/programs/winedevice/device.c
@@ -66,7 +66,7 @@ static HMODULE load_driver_module( const WCHAR *name )
{
IMAGE_NT_HEADERS *nt;
const IMAGE_IMPORT_DESCRIPTOR *imports;
- size_t page_size = getpagesize();
+ SYSTEM_BASIC_INFORMATION info;
int i;
INT_PTR delta;
ULONG size;
@@ -80,7 +80,8 @@ static HMODULE load_driver_module( const WCHAR *name )
/* the loader does not apply relocations to non page-aligned binaries or executables,
* we have to do it ourselves */
- if (nt->OptionalHeader.SectionAlignment < page_size ||
+ NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL );
+ if (nt->OptionalHeader.SectionAlignment < info.PageSize ||
!(nt->FileHeader.Characteristics & IMAGE_FILE_DLL))
{
DWORD old;
@@ -94,10 +95,10 @@ static HMODULE load_driver_module( const WCHAR *name )
while (rel < end && rel->SizeOfBlock)
{
void *page = (char *)module + rel->VirtualAddress;
- VirtualProtect( page, page_size, PAGE_EXECUTE_READWRITE, &old );
+ VirtualProtect( page, info.PageSize, PAGE_EXECUTE_READWRITE, &old );
rel = LdrProcessRelocationBlock( page, (rel->SizeOfBlock - sizeof(*rel)) / sizeof(USHORT),
(USHORT *)(rel + 1), delta );
- if (old != PAGE_EXECUTE_READWRITE) VirtualProtect( page, page_size, old, NULL );
+ if (old != PAGE_EXECUTE_READWRITE) VirtualProtect( page, info.PageSize, old, NULL );
if (!rel) goto error;
}
/* make sure we don't try again */
More information about the wine-cvs
mailing list