Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
58176bba
Commit
58176bba
authored
Jan 08, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedevice: Retrieve the page size from ntdll.
parent
082f9895
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
device.c
programs/winedevice/device.c
+5
-4
No files found.
programs/winedevice/device.c
View file @
58176bba
...
...
@@ -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_s
ize
,
PAGE_EXECUTE_READWRITE
,
&
old
);
VirtualProtect
(
page
,
info
.
PageS
ize
,
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_s
ize
,
old
,
NULL
);
if
(
old
!=
PAGE_EXECUTE_READWRITE
)
VirtualProtect
(
page
,
info
.
PageS
ize
,
old
,
NULL
);
if
(
!
rel
)
goto
error
;
}
/* make sure we don't try again */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment