cezanne / usbip-win

USB/IP for Windows
GNU General Public License v3.0
1.94k stars 349 forks source link

Fix build issues for VStudio 2019 CE and installation failure of the wdm driver #251

Closed vadimgrn closed 3 years ago

vadimgrn commented 3 years ago
  1. Fix: there are build errors if use the latest Visual Studio 2019 Community Edition
  2. Improvement: more precise error mapping for urb status between Linux - Windows
  3. Fix: vhci wdm driver can't be used after installation (status is not OK in the Device Manager)
cezanne commented 3 years ago

@vadimgrn : Thanks for your PR. I have uploaded several commits on dev_temp branch. They are built from your ab77ab2..723f9d5. e4a8f34 will be done later.

cezanne commented 3 years ago

@vadimgrn : I've done to apply your PR into dev_temp branch. Please understand for selective pull from your commits. Your work is very helpful.

vadimgrn commented 3 years ago

You've added at least one bug and removed most of my changes without explanation. But it is your repository and your rules.

cezanne commented 3 years ago

@vadimgrn :

You've added at least one bug removed most of my changes without explanation.

I'm sorry for that. For my late explanation for removal or modifications of your commits,

I believe to merge most of your great works, but please let me know about removed codes and the bug.

vadimgrn commented 3 years ago

driver/vhci/vhci_plugin.c

else {
        vpdo->num_configurations = dsc_dev->bNumConfigurations;
    } else {
        /* TODO: can happen? */
        vpdo->vendor = 0;
        vpdo->product = 0;
        vpdo->revision = 0;
        vpdo->usbclass = 0;
        vpdo->subclass = 0;
        vpdo->protocol = 0;
        vpdo->speed = USB_SPEED_LOW; // must be USB_SPEED_UNKNOWN
        vpdo->num_configurations = 1; // MUST BE ZERO, number of configurations is not known
    }
cezanne commented 3 years ago

@vadimgrn : Your comment is definitely correct.

But my intention is that the current implementation changes codes less and is consistent with composite detection logic. Currently, there's no mechanism to update 0 num_configurations. I think that the current code would be fine because the else part is never called. usbpi.exe does not proceed to attach if it fails to get the descriptor.

vadimgrn commented 3 years ago

In such case the else section should be removed. If I were you, I would replace all lines in else section with NT_ASSERT(!"message" ).

cezanne commented 3 years ago

@vadimgrn : I agree. I'll do it later.

cezanne commented 3 years ago

@vadimgrn : I agree. I'll do it later.

Those codes are removed without leaving assert at 62de496. They are unreachable codes and confusing.