Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a8b000c5
Commit
a8b000c5
authored
Jan 26, 2015
by
Michael Müller
Committed by
Alexandre Julliard
Feb 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedevice: Call DriverUnload function when unloading a driver.
Based on a patch by Alexander Morozov.
parent
7c8df7eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
device.c
programs/winedevice/device.c
+25
-4
No files found.
programs/winedevice/device.c
View file @
a8b000c5
...
...
@@ -167,8 +167,26 @@ static NTSTATUS init_driver( HMODULE module, UNICODE_STRING *keyname )
return
status
;
}
/* call the driver unload function */
static
void
unload_driver
(
HMODULE
module
,
DRIVER_OBJECT
*
driver_obj
)
{
if
(
driver_obj
->
DriverUnload
)
{
if
(
WINE_TRACE_ON
(
relay
))
WINE_DPRINTF
(
"%04x:Call driver unload %p (obj=%p)
\n
"
,
GetCurrentThreadId
(),
driver_obj
->
DriverUnload
,
driver_obj
);
driver_obj
->
DriverUnload
(
driver_obj
);
if
(
WINE_TRACE_ON
(
relay
))
WINE_DPRINTF
(
"%04x:Ret driver unload %p (obj=%p)
\n
"
,
GetCurrentThreadId
(),
driver_obj
->
DriverUnload
,
driver_obj
);
}
FreeLibrary
(
module
);
}
/* load the .sys module for a device driver */
static
BOOL
load_driver
(
void
)
static
HMODULE
load_driver
(
void
)
{
static
const
WCHAR
driversW
[]
=
{
'\\'
,
'd'
,
'r'
,
'i'
,
'v'
,
'e'
,
'r'
,
's'
,
'\\'
,
0
};
static
const
WCHAR
systemrootW
[]
=
{
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'R'
,
'o'
,
'o'
,
't'
,
'\\'
,
0
};
...
...
@@ -249,10 +267,10 @@ static BOOL load_driver(void)
module
=
load_driver_module
(
str
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
if
(
!
module
)
return
FALSE
;
if
(
!
module
)
return
NULL
;
init_driver
(
module
,
&
keypath
);
return
TRUE
;
return
module
;
}
static
DWORD
WINAPI
service_handler
(
DWORD
ctrl
,
DWORD
event_type
,
LPVOID
event_data
,
LPVOID
context
)
...
...
@@ -287,6 +305,7 @@ static DWORD WINAPI service_handler( DWORD ctrl, DWORD event_type, LPVOID event_
static
void
WINAPI
ServiceMain
(
DWORD
argc
,
LPWSTR
*
argv
)
{
SERVICE_STATUS
status
;
HMODULE
driver_module
;
WINE_TRACE
(
"starting service %s
\n
"
,
wine_dbgstr_w
(
driver_name
)
);
...
...
@@ -305,13 +324,15 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
status
.
dwWaitHint
=
10000
;
SetServiceStatus
(
service_handle
,
&
status
);
if
(
load_driver
())
driver_module
=
load_driver
();
if
(
driver_module
)
{
status
.
dwCurrentState
=
SERVICE_RUNNING
;
status
.
dwControlsAccepted
=
SERVICE_ACCEPT_STOP
|
SERVICE_ACCEPT_SHUTDOWN
;
SetServiceStatus
(
service_handle
,
&
status
);
wine_ntoskrnl_main_loop
(
stop_event
);
unload_driver
(
driver_module
,
&
driver_obj
);
}
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