[Wine-devel] wineusb: ifdef changes

Alexander Morozov =?iso-8859-1?q?amorozov_=CE=C1_etersoft=2Eru?=
Чт Июн 19 17:19:43 MSD 2008


----------- следующая часть -----------
From c54ba4cca1d7e6a4f2a6f500b5294a57ef476910 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на builder.office.etersoft.ru>
Date: Thu, 19 Jun 2008 15:35:03 +0400
Subject: [PATCH] wineusb: ifdef changes

---
 programs/wineusb/main.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/programs/wineusb/main.c b/programs/wineusb/main.c
index 3e1ebd9..864376d 100644
--- a/programs/wineusb/main.c
+++ b/programs/wineusb/main.c
@@ -79,8 +79,10 @@ static DWORD WINAPI service_handler( DWORD ctrl, DWORD event_type, LPVOID event_
 
 static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
 {
+#if defined(HAVE_LIBUSB) && defined(HAVE_USB_H)
     HDEVINFO set;
     GUID guid = {0x36FC9E60, 0xC465, 0x11CF, {0x80,0x56,0x44,0x45,0x53,0x54,0x00,0x00}};
+#endif
     SERVICE_STATUS status;
 
     WINE_TRACE( "starting service\n" );
@@ -91,10 +93,6 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
     if (!service_handle)
         return;
 
-#ifndef HAVE_LIBUSB
-    return;
-#endif
-
     status.dwServiceType             = SERVICE_WIN32;
     status.dwCurrentState            = SERVICE_START_PENDING;
     status.dwControlsAccepted        = 0;
@@ -104,15 +102,14 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
     status.dwWaitHint                = 10000;
     SetServiceStatus( service_handle, &status );
 
+#if defined(HAVE_LIBUSB) && defined(HAVE_USB_H)
     set = SetupDiGetClassDevsW( &guid, NULL, 0, 0 );
     if (set != INVALID_HANDLE_VALUE)
     {
-#ifdef HAVE_USB_H
         UNICODE_STRING drvname;
         UCHAR pdo_info[PATH_MAX + 3] = {0};
         struct usb_device *dev;
         struct usb_bus *bus;
-#endif
         SP_DEVINFO_DATA devInfo = { sizeof(devInfo), { 0 } };
         DWORD size = 0, i = 0;
         USHORT vid, pid;
@@ -120,11 +117,9 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
         BYTE *buf;
         BOOL ret;
 
-#if defined(HAVE_LIBUSB) && defined(HAVE_USB_H)
         usb_init();
         usb_find_busses();
         usb_find_devices();
-#endif
 
         while (SetupDiEnumDeviceInfo( set, i++, &devInfo ))
         {
@@ -161,7 +156,6 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
             pid = strtol( str, NULL, 16 );
             HeapFree( GetProcessHeap(), 0, buf );
 
-#ifdef HAVE_USB_H
             for (bus = usb_busses; bus && ret; bus = bus->next)
                 for (dev = bus->devices; dev && ret; dev = dev->next)
                     if (dev->descriptor.idVendor == vid &&
@@ -203,12 +197,12 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
                         ret = FALSE;
                         break;
                     }
-#endif
         }
         SetupDiDestroyDeviceInfoList( set );
     }
     else
         WINE_ERR( "SetupDiGetClassDevsW failed\n" );
+#endif
 
     status.dwCurrentState     = SERVICE_STOPPED;
     status.dwControlsAccepted = 0;
-- 
1.5.4.5.GIT



Подробная информация о списке рассылки Wine-devel