Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

Commit b5b2e17

Browse files
committed
windows: Always open with sharing enabled
In the past, there was desire to make hid_open() open devices exclusively, preventing devices from being opened more than once. Unfortunately, recent versions of Windows have made this largely impossible for many devices, as it appears that Windows itself is holding certain HID devices open or preventing them from being opened in exclusive mode. This patch will always open devices in SHARED mode on Windows.
1 parent d17db57 commit b5b2e17

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

windows/hid.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ static HANDLE open_device(const char *path, BOOL enumerate)
222222
{
223223
HANDLE handle;
224224
DWORD desired_access = (enumerate)? 0: (GENERIC_WRITE | GENERIC_READ);
225-
DWORD share_mode = (enumerate)?
226-
FILE_SHARE_READ|FILE_SHARE_WRITE:
227-
FILE_SHARE_READ;
225+
DWORD share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE;
228226

229227
handle = CreateFileA(path,
230228
desired_access,

0 commit comments

Comments
 (0)