driver: pass current process id in file close flow
https://github.com/daynix/UsbDk/issues/81 OnClose -> RemoveRedirect -> NotifyRedirectorRemovalStarted NotifyRedirectorRemovalStarted passes process id to ModifyOne in order to avoid stopping redirection if another not related process just opens the filter device and then closes it. Example (before this commit): Start VM and use remote-viewer to it. Separate application 'App' registers notification on USB device interface arrival. When new device comes, the application opens a file using symbolic link name and closes it. Redirect USB device to VM. The UsbDk forces device to be reenumerated. Open-close operation from the 'App' unexpectedly discards device redirection. After this commit: because the 'App' process is not an owner of the redirection, OnClose will not cause removal of the redirection. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
This commit is contained in:
parent
14dd054ae3
commit
4de57a9ff6
1 changed files with 2 additions and 1 deletions
|
|
@ -1081,7 +1081,8 @@ bool CUsbDkControlDevice::NotifyRedirectorAttached(CRegText *DeviceID, CRegText
|
|||
|
||||
bool CUsbDkControlDevice::NotifyRedirectorRemovalStarted(const USB_DK_DEVICE_ID &ID)
|
||||
{
|
||||
return m_Redirections.ModifyOne(&ID, [](CUsbDkRedirection *R){ R->NotifyRedirectionRemovalStarted(); });
|
||||
ULONG pid = (ULONG)(ULONG_PTR)PsGetCurrentProcessId();
|
||||
return m_Redirections.ModifyOne(&ID, [](CUsbDkRedirection *R){ R->NotifyRedirectionRemovalStarted(); }, pid);
|
||||
}
|
||||
|
||||
bool CUsbDkControlDevice::WaitForDetachment(const USB_DK_DEVICE_ID &ID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue