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
0115fdb6
Commit
0115fdb6
authored
Dec 22, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedevice: Make sure that all dependencies of the driver are relocated too.
parent
af871d83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
device.c
programs/winedevice/device.c
+21
-3
No files found.
programs/winedevice/device.c
View file @
0115fdb6
...
@@ -64,9 +64,11 @@ static LDR_MODULE *find_ldr_module( HMODULE module )
...
@@ -64,9 +64,11 @@ static LDR_MODULE *find_ldr_module( HMODULE module )
/* load the driver module file */
/* load the driver module file */
static
HMODULE
load_driver_module
(
const
WCHAR
*
name
)
static
HMODULE
load_driver_module
(
const
WCHAR
*
name
)
{
{
const
IMAGE_NT_HEADERS
*
nt
;
IMAGE_NT_HEADERS
*
nt
;
const
IMAGE_IMPORT_DESCRIPTOR
*
imports
;
size_t
page_size
=
getpagesize
();
size_t
page_size
=
getpagesize
();
int
delta
;
int
i
,
delta
;
ULONG
size
;
HMODULE
module
=
LoadLibraryW
(
name
);
HMODULE
module
=
LoadLibraryW
(
name
);
if
(
!
module
)
return
NULL
;
if
(
!
module
)
return
NULL
;
...
@@ -80,7 +82,6 @@ static HMODULE load_driver_module( const WCHAR *name )
...
@@ -80,7 +82,6 @@ static HMODULE load_driver_module( const WCHAR *name )
if
(
nt
->
OptionalHeader
.
SectionAlignment
<
page_size
||
if
(
nt
->
OptionalHeader
.
SectionAlignment
<
page_size
||
!
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
))
!
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
))
{
{
ULONG
size
;
DWORD
old
;
DWORD
old
;
IMAGE_BASE_RELOCATION
*
rel
,
*
end
;
IMAGE_BASE_RELOCATION
*
rel
,
*
end
;
...
@@ -98,8 +99,25 @@ static HMODULE load_driver_module( const WCHAR *name )
...
@@ -98,8 +99,25 @@ static HMODULE load_driver_module( const WCHAR *name )
if
(
old
!=
PAGE_EXECUTE_READWRITE
)
VirtualProtect
(
page
,
page_size
,
old
,
NULL
);
if
(
old
!=
PAGE_EXECUTE_READWRITE
)
VirtualProtect
(
page
,
page_size
,
old
,
NULL
);
if
(
!
rel
)
goto
error
;
if
(
!
rel
)
goto
error
;
}
}
/* make sure we don't try again */
nt
->
OptionalHeader
.
DataDirectory
[
IMAGE_DIRECTORY_ENTRY_BASERELOC
].
VirtualAddress
=
0
;
}
}
}
}
/* make sure imports are relocated too */
if
((
imports
=
RtlImageDirectoryEntryToData
(
module
,
TRUE
,
IMAGE_DIRECTORY_ENTRY_IMPORT
,
&
size
)))
{
for
(
i
=
0
;
imports
[
i
].
Name
&&
imports
[
i
].
FirstThunk
;
i
++
)
{
char
*
name
=
(
char
*
)
module
+
imports
[
i
].
Name
;
WCHAR
buffer
[
32
],
*
p
=
buffer
;
while
(
p
<
buffer
+
32
)
if
(
!
(
*
p
++
=
*
name
++
))
break
;
if
(
p
<=
buffer
+
32
)
FreeLibrary
(
load_driver_module
(
buffer
)
);
}
}
return
module
;
return
module
;
error:
error:
...
...
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