| 
Patch applied.
See http://libusb-win32.cvs.sourceforge.net/libusb-win32/libusb/src/install.c?revision=1.22&view=markup
Stephan
> Although libusb-win32 is not expected to operate on Windows NT 4 due to
> lack of OS support for USB, it would be helpful if applications linked
> against it could still run on NT, albeit without using USB.
> 
> The only thing standing in the way of this currently is the use of
> SetupCopyOEMInf() in usb_install_driver_np(). The NT4 SP6a version of
> setupapi.dll does not have this entrypoint so a runtime link error is
> generated when attempting to launch a program linked against
> libusb-win32.
> 
> I've devised the patch below following the same logic as was already in
> place for UpdateDriverForPlugAndPlayDevices() from newdev.dll. There is
> a slight variation in that we still link against setupapi at compile
> time to obtain the other 20 or so symbols we use from it since those are
> available on all platforms it seems. (I'd be willing to respin the patch
> to look up all setupapi.dll symbols, but that seemed like a more
> invasive change than necessary.) GetModuleHandle() is used to obtain a 
> handle to the already-loaded setupapi.dll and we look up only the 
> offending SetupCopyOEMInf() symbol from it.
> 
> With this change in place, my application (apcupsd, FWIW) rus 
> successfully in non-USB mode on NT4, and libusb self-installation
> continues to work on XP.
> 
> --Adam
> 
> 
> diff -u -r1.21 install.c
> --- src/install.c	11 Dec 2005 13:10:50 -0000	1.21
> +++ src/install.c	16 Aug 2006 12:11:32 -0000
> @@ -48,6 +48,8 @@
>                                                                    LPCSTR, 
>                                                                    DWORD,
>                                                                    PBOOL);
> +typedef BOOL (WINAPI * setup_copy_oem_inf_t)(PCSTR, PCSTR, DWORD, DWORD,
> +                                             PSTR, DWORD, PDWORD, PSTR*);
>  
>  /* advapi32.dll exports */
>  typedef SC_HANDLE (WINAPI * open_sc_manager_t)(LPCTSTR, LPCTSTR, DWORD);
> @@ -214,9 +216,11 @@
>    char *p;
>    int dev_index;
>    HINSTANCE newdev_dll = NULL;
> -  
> -  update_driver_for_plug_and_play_devices_t UpdateDriverForPlugAndPlayDevices;
> +  HMODULE setupapi_dll = NULL;
>  
> +  update_driver_for_plug_and_play_devices_t UpdateDriverForPlugAndPlayDevices;
> +  setup_copy_oem_inf_t SetupCopyOEMInf;
> +  
>    newdev_dll = LoadLibrary("newdev.dll");
>  
>    if(!newdev_dll)
> @@ -235,6 +239,22 @@
>        return -1;
>      }
>  
> +  setupapi_dll = GetModuleHandle("setupapi.dll");
> +  if(!setupapi_dll)
> +    {
> +      usb_error("usb_install_driver(): loading setupapi.dll failed\n");
> +      return -1;
> +    }
> +  SetupCopyOEMInf =  
> +    (setup_copy_oem_inf_t) 
> +    GetProcAddress(setupapi_dll, "SetupCopyOEMInfA");
> +
> +  if(!SetupCopyOEMInf)
> +    {
> +      usb_error("usb_install_driver(): loading setupapi.dll failed\n");
> +      return -1;
> +    }
> +
>  
>    dev_info_data.cbSize = sizeof(SP_DEVINFO_DATA);
>  
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Libusb-win32-devel mailing list
> Lib...@li...
> https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
 |