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
e61498c0
Commit
e61498c0
authored
May 25, 2022
by
Zebediah Figura
Committed by
Alexandre Julliard
Jul 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineusb.sys: Move the libusb_cancel_transfer() call to a new Unix library.
parent
9513f8a1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
2 deletions
+109
-2
Makefile.in
dlls/wineusb.sys/Makefile.in
+2
-0
unixlib.c
dlls/wineusb.sys/unixlib.c
+50
-0
unixlib.h
dlls/wineusb.sys/unixlib.h
+38
-0
wineusb.c
dlls/wineusb.sys/wineusb.c
+19
-2
No files found.
dlls/wineusb.sys/Makefile.in
View file @
e61498c0
EXTRADEFS
=
-DWINE_NO_LONG_TYPES
MODULE
=
wineusb.sys
UNIXLIB
=
wineusb.so
IMPORTS
=
ntoskrnl
UNIX_LIBS
=
$(USB_LIBS)
UNIX_CFLAGS
=
$(USB_CFLAGS)
...
...
@@ -7,6 +8,7 @@ UNIX_CFLAGS = $(USB_CFLAGS)
EXTRADLLFLAGS
=
-Wl
,--subsystem,native
-mcygwin
C_SRCS
=
\
unixlib.c
\
wineusb.c
RC_SRCS
=
wineusb.rc
dlls/wineusb.sys/unixlib.c
0 → 100644
View file @
e61498c0
/*
* libusb backend
*
* Copyright 2020 Zebediah Figura
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep unix
#endif
#include <libusb.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "wine/debug.h"
#include "wine/list.h"
#include "unixlib.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wineusb
);
static
NTSTATUS
usb_cancel_transfer
(
void
*
args
)
{
const
struct
usb_cancel_transfer_params
*
params
=
args
;
int
ret
;
if
((
ret
=
libusb_cancel_transfer
(
params
->
transfer
))
<
0
)
ERR
(
"Failed to cancel transfer: %s
\n
"
,
libusb_strerror
(
ret
));
return
STATUS_SUCCESS
;
}
const
unixlib_entry_t
__wine_unix_call_funcs
[]
=
{
#define X(name) [unix_ ## name] = name
X
(
usb_cancel_transfer
),
};
dlls/wineusb.sys/unixlib.h
0 → 100644
View file @
e61498c0
/*
* wineusb Unix library interface
*
* Copyright 2022 Zebediah Figura for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_WINEUSB_UNIXLIB_H
#define __WINE_WINEUSB_UNIXLIB_H
#include "windef.h"
#include "winternl.h"
#include "wine/unixlib.h"
struct
usb_cancel_transfer_params
{
void
*
transfer
;
};
enum
unix_funcs
{
unix_usb_cancel_transfer
,
};
#endif
dlls/wineusb.sys/wineusb.c
View file @
e61498c0
...
...
@@ -36,6 +36,8 @@
#include "wine/list.h"
#include "wine/unicode.h"
#include "unixlib.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wineusb
);
#ifdef __ASM_USE_FASTCALL_WRAPPER
...
...
@@ -64,6 +66,8 @@ __ASM_STDCALL_FUNC( wrap_fastcall_func1, 8,
DECLARE_CRITICAL_SECTION
(
wineusb_cs
);
static
unixlib_handle_t
unix_handle
;
static
struct
list
device_list
=
LIST_INIT
(
device_list
);
struct
usb_device
...
...
@@ -712,9 +716,12 @@ static NTSTATUS usb_submit_urb(struct usb_device *device, IRP *irp)
for
(
entry
=
mark
->
Flink
;
entry
!=
mark
;
entry
=
entry
->
Flink
)
{
IRP
*
queued_irp
=
CONTAINING_RECORD
(
entry
,
IRP
,
Tail
.
Overlay
.
ListEntry
);
struct
usb_cancel_transfer_params
params
=
{
.
transfer
=
queued_irp
->
Tail
.
Overlay
.
DriverContext
[
0
],
};
if
((
ret
=
libusb_cancel_transfer
(
queued_irp
->
Tail
.
Overlay
.
DriverContext
[
0
]))
<
0
)
ERR
(
"Failed to cancel transfer: %s
\n
"
,
libusb_strerror
(
ret
));
__wine_unix_call
(
unix_handle
,
unix_usb_cancel_transfer
,
&
params
);
}
LeaveCriticalSection
(
&
wineusb_cs
);
...
...
@@ -930,10 +937,20 @@ static void WINAPI driver_unload(DRIVER_OBJECT *driver)
NTSTATUS
WINAPI
DriverEntry
(
DRIVER_OBJECT
*
driver
,
UNICODE_STRING
*
path
)
{
NTSTATUS
status
;
void
*
instance
;
int
err
;
TRACE
(
"driver %p, path %s.
\n
"
,
driver
,
debugstr_w
(
path
->
Buffer
));
RtlPcToFileHeader
(
DriverEntry
,
&
instance
);
if
((
status
=
NtQueryVirtualMemory
(
GetCurrentProcess
(),
instance
,
MemoryWineUnixFuncs
,
&
unix_handle
,
sizeof
(
unix_handle
),
NULL
)))
{
ERR
(
"Failed to initialize Unix library, status %#x.
\n
"
,
status
);
return
status
;
}
driver_obj
=
driver
;
if
((
err
=
libusb_init
(
NULL
)))
...
...
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