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
dd2624a2
Commit
dd2624a2
authored
Apr 09, 2018
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Apr 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedevice: Improve error handling when a driver fails to load.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b5c1a8f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
device.c
programs/winedevice/device.c
+15
-5
No files found.
programs/winedevice/device.c
View file @
dd2624a2
...
...
@@ -50,12 +50,15 @@ static SC_HANDLE manager_handle;
static
BOOL
shutdown_in_progress
;
static
HANDLE
stop_event
;
#define EVENT_STARTED 0
#define EVENT_ERROR 1
struct
wine_driver
{
struct
wine_rb_entry
entry
;
SERVICE_STATUS_HANDLE
handle
;
HANDLE
started
;
HANDLE
events
[
2
]
;
DRIVER_OBJECT
*
driver_obj
;
WCHAR
name
[
1
];
};
...
...
@@ -391,7 +394,7 @@ static void WINAPI async_create_driver( PTP_CALLBACK_INSTANCE instance, void *co
goto
error
;
}
SetEvent
(
driver
->
started
);
SetEvent
(
driver
->
events
[
EVENT_STARTED
]
);
EnterCriticalSection
(
&
drivers_cs
);
driver
->
driver_obj
=
driver_obj
;
...
...
@@ -401,6 +404,7 @@ static void WINAPI async_create_driver( PTP_CALLBACK_INSTANCE instance, void *co
return
;
error:
SetEvent
(
driver
->
events
[
EVENT_ERROR
]);
EnterCriticalSection
(
&
drivers_cs
);
wine_rb_remove
(
&
wine_drivers
,
&
driver
->
entry
);
LeaveCriticalSection
(
&
drivers_cs
);
...
...
@@ -416,6 +420,7 @@ static NTSTATUS create_driver( const WCHAR *driver_name )
TP_CALLBACK_ENVIRON
environment
;
struct
wine_driver
*
driver
;
DWORD
length
;
DWORD
ret
;
length
=
FIELD_OFFSET
(
struct
wine_driver
,
name
[
strlenW
(
driver_name
)
+
1
]
);
if
(
!
(
driver
=
HeapAlloc
(
GetProcessHeap
(),
0
,
length
)))
...
...
@@ -444,14 +449,18 @@ static NTSTATUS create_driver( const WCHAR *driver_name )
environment
.
Version
=
1
;
environment
.
CleanupGroup
=
cleanup_group
;
driver
->
started
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
driver
->
events
[
EVENT_STARTED
]
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
driver
->
events
[
EVENT_ERROR
]
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
/* don't block the service control handler */
if
(
!
TrySubmitThreadpoolCallback
(
async_create_driver
,
driver
,
&
environment
))
async_create_driver
(
NULL
,
driver
);
/* Windows wait 30 Seconds */
if
(
WaitForSingleObject
(
driver
->
started
,
30000
)
==
WAIT_TIMEOUT
)
ret
=
WaitForMultipleObjects
(
2
,
driver
->
events
,
FALSE
,
30000
);
if
(
ret
==
WAIT_OBJECT_0
+
EVENT_ERROR
)
return
STATUS_UNSUCCESSFUL
;
else
if
(
ret
==
WAIT_TIMEOUT
)
return
ERROR_SERVICE_REQUEST_TIMEOUT
;
return
STATUS_SUCCESS
;
...
...
@@ -462,7 +471,8 @@ static void wine_drivers_rb_destroy( struct wine_rb_entry *entry, void *context
if
(
unload_driver
(
entry
,
TRUE
)
!=
STATUS_SUCCESS
)
{
struct
wine_driver
*
driver
=
WINE_RB_ENTRY_VALUE
(
entry
,
struct
wine_driver
,
entry
);
CloseHandle
(
driver
->
started
);
CloseHandle
(
driver
->
events
[
EVENT_STARTED
]);
CloseHandle
(
driver
->
events
[
EVENT_ERROR
]);
ObDereferenceObject
(
driver
->
driver_obj
);
CloseServiceHandle
(
(
void
*
)
driver
->
handle
);
HeapFree
(
GetProcessHeap
(),
0
,
driver
);
...
...
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