daynix / UsbDk

Usb Drivers Development Kit for Windows
Apache License 2.0
535 stars 142 forks source link

UsbDk_StopRedirect need open UsbDk device link? #56

Closed goldendeng closed 5 years ago

goldendeng commented 6 years ago

I have a question about this code:UsbDk_StopRedirect

In fact, it can stop redirection without using this operation.

YanVugenfirer commented 6 years ago

HI,

Can you please reconfigure https://github.com/daynix/UsbDk/blob/master/.appveyor.yml in your repo to send notifications to you instead of devel@daynix.com?

Thanks.

YanVugenfirer commented 6 years ago

Sorry, I didn't understand the question. What do you refer to as "it"?

Thanks.

goldendeng commented 6 years ago

I'm sorry about this, but I have changed it now.

goldendeng commented 6 years ago

I mean, no such code, this function can run normally, so I want to ask about the function of this code.

sameehj commented 6 years ago

@goldendeng So you are saying that the local variable "driverAccess" is not necessary in the UsbDk_StopRedirect function?

goldendeng commented 6 years ago

@sameehj Yes, I think so.

sameehj commented 6 years ago

You are right, can you please send a pull request that resolves this?

ybendito commented 5 years ago

Note that this is not a 'local variable'. This is an object with constructor that raises exception in case it can't access the driver from the helper at the moment of the call. It also creates additional handle on the driver's device file which is closed when the UsbDk_StopRedirect procedure is fully completed. Such referencing is typical to protect the flow from corner cases. I would revert the commit until there is more serious reason to remove this reference than just 'Stop redirect works without it'.

YanVugenfirer commented 5 years ago

I would revert the commit and rename the variable to reflect the actual functionality that happens during its creation.