I currently have a device utilizing the libusb0.dll file, I use inno script to install the dll's into their respective folders, the 32bit version into the syswow64 and the 64bit version into the system32 since I am using a 64bit pc.
The problem I am having is that when the device is not plugged in and I run the installer created by inno script it installs the dll's into their correct location, although when I plug in the usb device suddenly the dll's are either modified or are switched. To me it looks as if now the 64bit dll is in the syswow64 and the 32bit dll is in the system32. So basically my exe for the usb device will run when the device is not plugged in but does not work when I plug in the device because the dll's get modified when the device gets plugged in. I am not sure why this is happening.
The 32bit dll is 66.0kb and the 64bit dll is 74.5kb. Which leads me to believe that the 32bit dll is being replaced with the 64bit dll, not sure if this is exactly what is happening though.
Before plugging in usb device:
After plugging in usb device:
I have tested this by manually moving the dll's back to their respective locations and everything works fine, but if I run the installer again, the same thing happens, I plug in the usb device and it fails to work again, I get this error from the exe when trying to open it. which I believe is just telling me that either the dll is missing or in the wrong location.
How I am putting the dlls into the 2 folders:
Source: ..\lib_usb_win32\libusb-win32-bin\bin\amd64\{#LibUSB_AMD64_DLL}; DestDir: {sys}; DestName: libusb0.dll; FLags: replacesameversion restartreplace uninsneveruninstall; Check: Is64BitInstallMode
Source: ..\lib_usb_win32\libusb-win32-bin\bin\x86\{#LibUSB_X86_DLL}; DestDir: {syswow64}; DestName: libusb0.dll; FLags: replacesameversion restartreplace uninsneveruninstall; Check: Is64BitInstallMode
Source: ..\lib_usb_win32\libusb-win32-bin\bin\x86\{#LibUSB_X86_DLL}; DestDir: {sys}; DestName: libusb0.dll; FLags: replacesameversion restartreplace uninsneveruninstall; Check: "Not Is64BitInstallMode"
CodePudding user response:
I use inno script to install the dll's into their respective folders, the 32bit version into the syswow64 and the 64bit version into the system32 since I am using a 64bit pc.
That doesn't match the script in your question. In fact, the script exactly matches your symptom that they end up swapped.
Source: ..\lib_usb_win32\libusb-win32-bin\bin\amd64\{#LibUSB_AMD64_DLL}; DestDir: {syswow64}; DestName: libusb0.dll; FLags: replacesameversion restartreplace uninsneveruninstall; Check: Is64BitInstallMode
Is clearly putting the 64bit version into syswow64 where it doesn't belong.
Source: ..\lib_usb_win32\libusb-win32-bin\bin\x86\{#LibUSB_X86_DLL}; DestDir: {sys}; DestName: libusb0.dll; FLags: replacesameversion restartreplace uninsneveruninstall; Check: Is64BitInstallMode
Is clearly putting the 32bit version into system32 where it doesn't belong.
CodePudding user response:
I actually was able to figure out a fix, it seems that it was a windows issue, originally the dll's were in the wrong spots, inno studio was putting the 32 bit dll in the system32 and the 64bit dll was in the syswow64. I had fixed this issue by having inno script studio move the dll's into the correct folders, although for some reason windows was still adding the dll's to the wrong folders every time I would connect the usb device, even after I would remove them (And even after a system reset). I'm assuming somewhere in the system the drivers still had there original settings even after fixing it. So I assumed there was an error, but there actually wasnt, because after reformatting the drive and reinstalling windows it worked. I reinstalled the drivers and the dll's would stay in the correct folder even after plugging in the device, and now the application was running. So I guess what I really should ask now is why does this happen with windows, you would think that after a system reset, the drivers would be completely removed, when in fact they weren't which made testing my issue very difficult. I shouldn't have to format a drive every time I make changes to the drivers.