Alexx999 / IntelUsbSwitcher

19 stars 4 forks source link

Driver load failed. #1

Open attackslugYT opened 5 years ago

attackslugYT commented 5 years ago

Was using this excellent little program to livestream last year, worked great.

Now it gives me a "driver load failed" when I try to load it up.

Not sure if a Windows update (I'm on 8.1) or something else managed to break things.

Have tried uninstalling/reinstalling, and stop/starting the service.

usbswitcher

Alexx999 commented 5 years ago

I don't have Win8.1 around but I've just tried on Win8.0 VM and it surely loads driver just fine. On a side note, I've used freely available signed driver (as I don't have required certificates to sign it myself) so it might be AV solution flagging it as risky.

Alexx999 commented 5 years ago

OK, I just got the same on my PC but it was fixed by rebooting my PC. Apparently, UI app doesn't like many restarts :)

attackslugYT commented 5 years ago

Thus far I've tried:

  1. adding a folder exception to Bitdefender.
  2. repairing .NET
  3. manually installing/starting the service with installutil (shows as running, same error screen though)

This morning I've been tinkering with UEFI settings, but so far nothing has worked.

I'll try uninstalling Bitdefender next I suppose.

VitToCode commented 4 years ago

Good job, thank you. Same for me if I build (with many hardest obstacles) the app from the latest code commit. But easily built app from the first commit https://github.com/Alexx999/IntelUsbSwitcher/tree/eb37749d1822fe91e4e09b500bf13c3ac4999922 and it forks fine on Win10x64. BTW I need the opposite function, I need to use xHCI for second USB port which was hardware USB2.0 on ASUS laptop x55x series and it can be re-solder with USB 3.0 (and few additional electric components) in accordance to boardview. So I made those hardware mods and find this software solution to set bits on D0h and D8h.

Samhayne commented 3 years ago

Same problem here... image

It worked for many months.

My mistake today: I rapidly clicked the Stop/Enable Service buttons. Suddenly the UsbSwitcher window froze for a minute and when it came back the service wasn't running any more. I restarted my machine several times now and uninstalled and reinstalled... but the UsbSwitcher won't work any more. Also the service won't show up among the other services.

Tried to debug it. That directio.dll seems to load but Init() returns false. image Why would it stop working all of a sudden and for good?

@Alexx999 Please help us poor souls.

Edit: I managed to fix it by debugging the driver. The problem was that somehow I got my machine in a state where on init the DirectIO driver would create a required file in a temporary folder (C:\Users[username]\AppData\Local\Temp\DirectIO.sys), delete it and afterwards it would fail b/c it can't load it... of course.

So I went into line 204 of https://github.com/allenyllee/directio/blob/master/library/directiolib.c and removed that "DeleteFile( DriverPath );" line.

After building and starting the USB Switcher the driver was fine again and everything worked. Though it would fail after a second start, because the USB switcher service didn't stop, keeping a handle on the mentioned directio.sys file. So I had to stop the Intel USB Switcher service manually before I could restart. This may be due to the fact that after some tryout reinstalling the service didn't install properly any more and I had to install it manually using C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe\InstallUtil.exe C:\Program Files (x86)\Setup\UsbSwitcher.Service.exe

But for whatever reason this one successful run with my hacked dll seems to have fixed my machine's weird state again. Probably by properly (un)registering stuff once. ...which makes somewhat sense es everything started with rapidly starting/stopping the service from the UI.

After a restart I deinstalled USB Switcher, reinstalled it and made sure I'm using the original DriverIO.dll again.

Finally everything registered/installed properly again and now everything works again.

tl;dr I could fix it for me but didn't REALLY get to the bottom of the problem. If you also feel like debugging and want to compile the directio.dll , this may save you some time:

1) Get the sources from https://github.com/allenyllee/directio 2) Install the ancient WDK 7.1.0 from https://www.microsoft.com/download/confirmation.aspx?id=11800 (The current WDK version wasn't compatible any more, lacking the required makefile.def / environment variable for the MAKEFILE) 3) From the Start menu invoke the x64 Free Build environment, navigate to the driver folder and invoke nmake. (actually I did this with the current Window Driver Kit but that old one should work as well) 4) Get CygWin, install the cpp stuff from the devel category (you need the i686-w64-mingw32.exe to compile) 5) Find the GNUmakefile in directio's library folder and in it rename i686-PC-mingw32 to i686-w64-mingw32 6) Copy the DirectIO project into your Cygwin home folder (for me: C:\cygwin64\home{username}) 7) Start the Cygwin terminal, navigate to the just copied folder, enter the library subfolder and type "make". 8) You should have some freshly compiled dlls now

(Dropping this as it took me one day to find out what to do)

Here are my hacked dlls with that file deletion line removed... in case it helps. https://www.dropbox.com/s/6dey3ar7zp19dvc/DirectIO_hacked_dlls.zip?dl=0 You probably just need the x64bit version and have to replace this one: C:\Users[username]\AppData\Local\Temp\UsbSwitcher.Core\0.2.1.0\x64\directio.dll

But again... it may break other things.

mcr-1701 commented 2 months ago

Here are my hacked dlls with that file deletion line removed... in case it helps. https://www.dropbox.com/s/6dey3ar7zp19dvc/DirectIO_hacked_dlls.zip?dl=0 You probably just need the x64bit version and have to replace this one: C:\Users[username]\AppData\Local\Temp\UsbSwitcher.Core\0.2.1.0\x64\directio.dll > But again... it may break other things.

@Samhayne I just wanted to say thank you for your help. I had exactly the same issues as you described your hacked dlls sorted my issue for me

Which is amazing you're a lifesaver man