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
e3321faf
Commit
e3321faf
authored
Aug 04, 2016
by
Sebastian Lackner
Committed by
Alexandre Julliard
Aug 04, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedevice: Get rid of static driver_module variable.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3b37db88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
device.c
programs/winedevice/device.c
+12
-10
No files found.
programs/winedevice/device.c
View file @
e3321faf
...
@@ -43,7 +43,6 @@ extern NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event );
...
@@ -43,7 +43,6 @@ extern NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event );
static
SERVICE_STATUS_HANDLE
service_handle
;
static
SERVICE_STATUS_HANDLE
service_handle
;
static
HANDLE
stop_event
;
static
HANDLE
stop_event
;
static
DRIVER_OBJECT
*
driver_obj
;
static
DRIVER_OBJECT
*
driver_obj
;
static
HMODULE
driver_module
;
/* find the LDR_MODULE corresponding to the driver module */
/* find the LDR_MODULE corresponding to the driver module */
static
LDR_MODULE
*
find_ldr_module
(
HMODULE
module
)
static
LDR_MODULE
*
find_ldr_module
(
HMODULE
module
)
...
@@ -216,22 +215,22 @@ static NTSTATUS WINAPI init_driver( DRIVER_OBJECT *driver_object, UNICODE_STRING
...
@@ -216,22 +215,22 @@ static NTSTATUS WINAPI init_driver( DRIVER_OBJECT *driver_object, UNICODE_STRING
NTSTATUS
status
;
NTSTATUS
status
;
const
IMAGE_NT_HEADERS
*
nt
;
const
IMAGE_NT_HEADERS
*
nt
;
const
WCHAR
*
driver_name
;
const
WCHAR
*
driver_name
;
HMODULE
module
;
/* Retrieve driver name from the keyname */
/* Retrieve driver name from the keyname */
driver_name
=
strrchrW
(
keyname
->
Buffer
,
'\\'
);
driver_name
=
strrchrW
(
keyname
->
Buffer
,
'\\'
);
driver_name
++
;
driver_name
++
;
driver_
module
=
load_driver
(
driver_name
,
keyname
);
module
=
load_driver
(
driver_name
,
keyname
);
if
(
!
driver_
module
)
if
(
!
module
)
return
STATUS_DLL_INIT_FAILED
;
return
STATUS_DLL_INIT_FAILED
;
driver_obj
=
driver_object
;
driver_obj
=
driver_object
;
driver_object
->
DriverSection
=
find_ldr_module
(
module
);
nt
=
RtlImageNtHeader
(
driver_
module
);
nt
=
RtlImageNtHeader
(
module
);
if
(
!
nt
->
OptionalHeader
.
AddressOfEntryPoint
)
return
STATUS_SUCCESS
;
if
(
!
nt
->
OptionalHeader
.
AddressOfEntryPoint
)
return
STATUS_SUCCESS
;
driver_object
->
DriverInit
=
(
PDRIVER_INITIALIZE
)((
char
*
)
module
+
nt
->
OptionalHeader
.
AddressOfEntryPoint
);
driver_object
->
DriverSection
=
find_ldr_module
(
driver_module
);
driver_object
->
DriverInit
=
(
PDRIVER_INITIALIZE
)((
char
*
)
driver_module
+
nt
->
OptionalHeader
.
AddressOfEntryPoint
);
if
(
WINE_TRACE_ON
(
relay
))
if
(
WINE_TRACE_ON
(
relay
))
WINE_DPRINTF
(
"%04x:Call driver init %p (obj=%p,str=%s)
\n
"
,
GetCurrentThreadId
(),
WINE_DPRINTF
(
"%04x:Call driver init %p (obj=%p,str=%s)
\n
"
,
GetCurrentThreadId
(),
...
@@ -254,8 +253,10 @@ static NTSTATUS WINAPI init_driver( DRIVER_OBJECT *driver_object, UNICODE_STRING
...
@@ -254,8 +253,10 @@ static NTSTATUS WINAPI init_driver( DRIVER_OBJECT *driver_object, UNICODE_STRING
}
}
/* call the driver unload function */
/* call the driver unload function */
static
void
unload_driver
(
HMODULE
module
,
DRIVER_OBJECT
*
driver_obj
)
static
void
unload_driver
(
DRIVER_OBJECT
*
driver_obj
)
{
{
LDR_MODULE
*
ldr
=
driver_obj
->
DriverSection
;
if
(
driver_obj
->
DriverUnload
)
if
(
driver_obj
->
DriverUnload
)
{
{
if
(
WINE_TRACE_ON
(
relay
))
if
(
WINE_TRACE_ON
(
relay
))
...
@@ -268,7 +269,8 @@ static void unload_driver( HMODULE module, DRIVER_OBJECT *driver_obj )
...
@@ -268,7 +269,8 @@ static void unload_driver( HMODULE module, DRIVER_OBJECT *driver_obj )
WINE_DPRINTF
(
"%04x:Ret driver unload %p (obj=%p)
\n
"
,
GetCurrentThreadId
(),
WINE_DPRINTF
(
"%04x:Ret driver unload %p (obj=%p)
\n
"
,
GetCurrentThreadId
(),
driver_obj
->
DriverUnload
,
driver_obj
);
driver_obj
->
DriverUnload
,
driver_obj
);
}
}
FreeLibrary
(
module
);
FreeLibrary
(
ldr
->
BaseAddress
);
IoDeleteDriver
(
driver_obj
);
IoDeleteDriver
(
driver_obj
);
}
}
...
@@ -349,7 +351,7 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
...
@@ -349,7 +351,7 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
SetServiceStatus
(
service_handle
,
&
status
);
SetServiceStatus
(
service_handle
,
&
status
);
wine_ntoskrnl_main_loop
(
stop_event
);
wine_ntoskrnl_main_loop
(
stop_event
);
unload_driver
(
driver_
module
,
driver_
obj
);
unload_driver
(
driver_obj
);
}
}
else
WINE_ERR
(
"driver %s failed to load
\n
"
,
wine_dbgstr_w
(
driver_name
)
);
else
WINE_ERR
(
"driver %s failed to load
\n
"
,
wine_dbgstr_w
(
driver_name
)
);
...
...
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