diff --git a/reactos/lib/setupapi/cfgmgr.c b/reactos/lib/setupapi/cfgmgr.c index 4a0cec80e2c..8a7daadb739 100644 --- a/reactos/lib/setupapi/cfgmgr.c +++ b/reactos/lib/setupapi/cfgmgr.c @@ -19,25 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "winreg.h" -#include "setupapi.h" -#include "cfgmgr32.h" #include "setupapi_private.h" -#include "rpc.h" -#include "rpc_private.h" - -#include "pnp_c.h" - -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(setupapi); /* Registry key and value names */ diff --git a/reactos/lib/setupapi/devinst.c b/reactos/lib/setupapi/devinst.c index 1119d244dcf..39f5951754a 100644 --- a/reactos/lib/setupapi/devinst.c +++ b/reactos/lib/setupapi/devinst.c @@ -19,23 +19,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" -#include "wine/port.h" - -#include - -#include -#include "setupapi.h" -#include "wine/debug.h" -#include "wine/unicode.h" -#include "cfgmgr32.h" -#include "initguid.h" -#define NTOS_MODE_USER -#include - +#define INITGUID #include "setupapi_private.h" - WINE_DEFAULT_DEBUG_CHANNEL(setupapi); /* Unicode constants */ @@ -87,8 +73,6 @@ typedef DWORD IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN OUT PCOINSTALLER_CONTEXT_DATA Context); -#define SETUP_DEV_INFO_SET_MAGIC 0xd00ff057 - struct CoInstallerElement { LIST_ENTRY ListEntry; @@ -99,105 +83,6 @@ struct CoInstallerElement PVOID PrivateData; }; -struct DeviceInterface /* Element of DeviceInfoElement.InterfaceListHead */ -{ - LIST_ENTRY ListEntry; - - struct DeviceInfoElement* DeviceInfo; - GUID InterfaceClassGuid; - - - /* SPINT_ACTIVE : the interface is active/enabled - * SPINT_DEFAULT: the interface is the default interface for the device class FIXME??? - * SPINT_REMOVED: the interface is removed - */ - DWORD Flags; - - WCHAR SymbolicLink[0]; /* \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */ -}; - -/* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it - * has been already loaded once. Keep also a reference counter */ -struct InfFileDetails -{ - HINF hInf; - LONG References; -}; - -struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfoElement.DriverListHead */ -{ - LIST_ENTRY ListEntry; - - DWORD DriverRank; - SP_DRVINFO_DATA_V2_W Info; - SP_DRVINFO_DETAIL_DATA_W Details; - GUID ClassGuid; - LPWSTR MatchingId; - struct InfFileDetails *InfFileDetails; -}; - -struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */ -{ - LIST_ENTRY ListEntry; - - /* Reserved Field points to a struct DriverInfoElement */ - SP_DEVINSTALL_PARAMS_W InstallParams; - - /* Information about devnode: - * - DeviceName: - * "Root\*PNP0501" for example. - * It doesn't contain the unique ID for the device - * (points into the Data field at the end of the structure) - * WARNING: no NULL char exist between DeviceName and UniqueId - * in Data field! - * - UniqueId - * "5&1be2108e&0" or "0000" - * If DICD_GENERATE_ID is specified in creation flags, - * this unique ID is autogenerated using 4 digits, base 10 - * (points into the Data field at the end of the structure) - * - DeviceDescription - * String which identifies the device. Can be NULL. If not NULL, - * points into the Data field at the end of the structure - * - ClassGuid - * Identifies the class of this device. FIXME: can it be GUID_NULL? - * - CreationFlags - * Is a combination of: - * - DICD_GENERATE_ID - * the unique ID needs to be generated - * - DICD_INHERIT_CLASSDRVS - * inherit driver of the device info set (== same pointer) - */ - PCWSTR DeviceName; - PCWSTR UniqueId; - PCWSTR DeviceDescription; - GUID ClassGuid; - DWORD CreationFlags; - - /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */ - /* If the driver is not searched/detected, this list is empty */ - LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */ - - /* List of interfaces implemented by this device */ - LIST_ENTRY InterfaceListHead; /* List of struct DeviceInterface */ - - WCHAR Data[0]; -}; - -struct DeviceInfoSet /* HDEVINFO */ -{ - DWORD magic; /* SETUP_DEV_INFO_SET_MAGIC */ - GUID ClassGuid; /* If != GUID_NULL, only devices of this class can be in the device info set */ - HKEY HKLM; /* Local or distant HKEY_LOCAL_MACHINE registry key */ - - /* Reserved Field points to a struct DriverInfoElement */ - SP_DEVINSTALL_PARAMS_W InstallParams; - - /* If the driver is not searched/detected, this list is empty */ - LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */ - - LIST_ENTRY ListHead; /* List of struct DeviceInfoElement */ -}; - /*********************************************************************** * SetupDiBuildClassInfoList (SETUPAPI.@) */ @@ -5465,6 +5350,10 @@ SetupDiGetDriverInfoDetailW( { BOOL ret = FALSE; + TRACE("%p %p %p %p %lu %p\n", DeviceInfoSet, DeviceInfoData, + DriverInfoData, DriverInfoDetailData, + DriverInfoDetailDataSize, RequiredSize); + if (!DeviceInfoSet) SetLastError(ERROR_INVALID_PARAMETER); else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE) @@ -5482,7 +5371,7 @@ SetupDiGetDriverInfoDetailW( else if (DriverInfoDetailData && DriverInfoDetailData->cbSize != sizeof(SP_DRVINFO_DETAIL_DATA_W)) SetLastError(ERROR_INVALID_USER_BUFFER); else if (DriverInfoDetailData && DriverInfoDetailData->Reserved == 0) - SetLastError(ERROR_INVALID_PARAMETER); + SetLastError(ERROR_NO_DRIVER_SELECTED); else { struct DriverInfoElement *driverInfoElement; diff --git a/reactos/lib/setupapi/dirid.c b/reactos/lib/setupapi/dirid.c index 639da022258..65bcc55c684 100644 --- a/reactos/lib/setupapi/dirid.c +++ b/reactos/lib/setupapi/dirid.c @@ -18,21 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winternl.h" -#include "winerror.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "setupapi.h" -#include "shlobj.h" -#include "wine/unicode.h" #include "setupapi_private.h" -#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); diff --git a/reactos/lib/setupapi/diskspace.c b/reactos/lib/setupapi/diskspace.c index 6f513b68cfe..832dedde4ca 100644 --- a/reactos/lib/setupapi/diskspace.c +++ b/reactos/lib/setupapi/diskspace.c @@ -18,16 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "winreg.h" -#include "setupapi.h" -#include "wine/debug.h" +#include "setupapi_private.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); diff --git a/reactos/lib/setupapi/infparse.c b/reactos/lib/setupapi/infparse.c index c508db613ae..3c7f8d19134 100644 --- a/reactos/lib/setupapi/infparse.c +++ b/reactos/lib/setupapi/infparse.c @@ -25,20 +25,7 @@ * (IpSaveRestorePosition, IpFindNextMatchLine, ...). */ -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winternl.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "setupapi.h" -#include "setupx16.h" #include "setupapi_private.h" -#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); diff --git a/reactos/lib/setupapi/install.c b/reactos/lib/setupapi/install.c index 639259dc2bd..4326f0b1124 100644 --- a/reactos/lib/setupapi/install.c +++ b/reactos/lib/setupapi/install.c @@ -18,20 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winternl.h" -#include "winerror.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "setupapi.h" #include "setupapi_private.h" -#include "wine/unicode.h" -#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); diff --git a/reactos/lib/setupapi/misc.c b/reactos/lib/setupapi/misc.c index c8ad60ce01f..ec3b1782ddc 100644 --- a/reactos/lib/setupapi/misc.c +++ b/reactos/lib/setupapi/misc.c @@ -18,24 +18,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winreg.h" -#include "setupapi.h" - -#include "wine/unicode.h" -#include "wine/debug.h" - #include "setupapi_private.h" - WINE_DEFAULT_DEBUG_CHANNEL(setupapi); - /************************************************************************** * MyFree [SETUPAPI.@] * diff --git a/reactos/lib/setupapi/parser.c b/reactos/lib/setupapi/parser.c index b69f125d36e..9a9a9e4b03f 100644 --- a/reactos/lib/setupapi/parser.c +++ b/reactos/lib/setupapi/parser.c @@ -19,30 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" -#include "wine/port.h" - -#include -#include -#include -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "winreg.h" -#include "winternl.h" -#include "winerror.h" -#include "cfgmgr32.h" -#include "setupapi.h" #include "setupapi_private.h" -#include "wine/unicode.h" -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(setupapi); /* Unicode constants */ diff --git a/reactos/lib/setupapi/queue.c b/reactos/lib/setupapi/queue.c index d7bb0d1a39f..06d3184cc6f 100644 --- a/reactos/lib/setupapi/queue.c +++ b/reactos/lib/setupapi/queue.c @@ -18,21 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winternl.h" -#include "winerror.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "setupapi.h" -#include "wine/unicode.h" #include "setupapi_private.h" -#include "winver.h" -#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); diff --git a/reactos/lib/setupapi/rpc.c b/reactos/lib/setupapi/rpc.c index 44f19dd5590..d0bb283ef9e 100644 --- a/reactos/lib/setupapi/rpc.c +++ b/reactos/lib/setupapi/rpc.c @@ -18,12 +18,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include "rpc_private.h" +#include "setupapi_private.h" +WINE_DEFAULT_DEBUG_CHANNEL(setupapi); static RPC_BINDING_HANDLE LocalBindingHandle = NULL; static HSTRING_TABLE LocalStringTable = NULL; diff --git a/reactos/lib/setupapi/setupapi_private.h b/reactos/lib/setupapi/setupapi_private.h index 69ac9326ad3..8e154232f44 100644 --- a/reactos/lib/setupapi/setupapi_private.h +++ b/reactos/lib/setupapi/setupapi_private.h @@ -1,5 +1,6 @@ /* * Copyright 2001 Andreas Mohr + * Copyright 2005 Hervé Poussineau * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,11 +20,132 @@ #ifndef __SETUPAPI_PRIVATE_H #define __SETUPAPI_PRIVATE_H +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#define NTOS_MODE_USER +#include + +#include +#include "rpc_private.h" +#include "resource.h" + +#define SETUP_DEV_INFO_SET_MAGIC 0xd00ff057 + +struct DeviceInterface /* Element of DeviceInfoElement.InterfaceListHead */ +{ + LIST_ENTRY ListEntry; + + struct DeviceInfoElement* DeviceInfo; + GUID InterfaceClassGuid; + + + /* SPINT_ACTIVE : the interface is active/enabled + * SPINT_DEFAULT: the interface is the default interface for the device class FIXME??? + * SPINT_REMOVED: the interface is removed + */ + DWORD Flags; + + WCHAR SymbolicLink[0]; /* \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */ +}; + +/* We don't want to open the .inf file to read only one information in it, so keep a handle to it once it + * has been already loaded once. Keep also a reference counter */ +struct InfFileDetails +{ + HINF hInf; + LONG References; +}; + +struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfoElement.DriverListHead */ +{ + LIST_ENTRY ListEntry; + + DWORD DriverRank; + SP_DRVINFO_DATA_V2_W Info; + SP_DRVINFO_DETAIL_DATA_W Details; + GUID ClassGuid; + LPWSTR MatchingId; + struct InfFileDetails *InfFileDetails; +}; + +struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */ +{ + LIST_ENTRY ListEntry; + + /* Reserved Field points to a struct DriverInfoElement */ + SP_DEVINSTALL_PARAMS_W InstallParams; + + /* Information about devnode: + * - DeviceName: + * "Root\*PNP0501" for example. + * It doesn't contain the unique ID for the device + * (points into the Data field at the end of the structure) + * WARNING: no NULL char exist between DeviceName and UniqueId + * in Data field! + * - UniqueId + * "5&1be2108e&0" or "0000" + * If DICD_GENERATE_ID is specified in creation flags, + * this unique ID is autogenerated using 4 digits, base 10 + * (points into the Data field at the end of the structure) + * - DeviceDescription + * String which identifies the device. Can be NULL. If not NULL, + * points into the Data field at the end of the structure + * - ClassGuid + * Identifies the class of this device. FIXME: can it be GUID_NULL? + * - CreationFlags + * Is a combination of: + * - DICD_GENERATE_ID + * the unique ID needs to be generated + * - DICD_INHERIT_CLASSDRVS + * inherit driver of the device info set (== same pointer) + */ + PCWSTR DeviceName; + PCWSTR UniqueId; + PCWSTR DeviceDescription; + GUID ClassGuid; + DWORD CreationFlags; + + /* If CreationFlags contains DICD_INHERIT_CLASSDRVS, this list is invalid */ + /* If the driver is not searched/detected, this list is empty */ + LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */ + + /* List of interfaces implemented by this device */ + LIST_ENTRY InterfaceListHead; /* List of struct DeviceInterface */ + + WCHAR Data[0]; +}; + +struct DeviceInfoSet /* HDEVINFO */ +{ + DWORD magic; /* SETUP_DEV_INFO_SET_MAGIC */ + GUID ClassGuid; /* If != GUID_NULL, only devices of this class can be in the device info set */ + HKEY HKLM; /* Local or distant HKEY_LOCAL_MACHINE registry key */ + + /* Reserved Field points to a struct DriverInfoElement */ + SP_DEVINSTALL_PARAMS_W InstallParams; + + /* If the driver is not searched/detected, this list is empty */ + LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */ + + LIST_ENTRY ListHead; /* List of struct DeviceInfoElement */ +}; + #define COPYFILEDLGORD 1000 #define SOURCESTRORD 500 #define DESTSTRORD 501 #define PROGRESSORD 502 +extern HINSTANCE hInstance; +#define RC_STRING_MAX_SIZE 256 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles" #define REGPART_RENAME "\\Rename" diff --git a/reactos/lib/setupapi/setupcab.c b/reactos/lib/setupapi/setupcab.c index db45f77e666..38267d374b5 100644 --- a/reactos/lib/setupapi/setupcab.c +++ b/reactos/lib/setupapi/setupcab.c @@ -23,26 +23,7 @@ * */ -#include -#include -#include - -#include "wine/debug.h" -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "winreg.h" -#include "setupapi.h" #include "setupapi_private.h" -#include "fdi.h" -#include "wine/unicode.h" - -#include "fcntl.h" -#include "share.h" - -#include "wine/debug.h" HINSTANCE hInstance = 0; OSVERSIONINFOW OsVersionInfo; diff --git a/reactos/lib/setupapi/stringtable.c b/reactos/lib/setupapi/stringtable.c index 52c797877c1..c56d5b69267 100644 --- a/reactos/lib/setupapi/stringtable.c +++ b/reactos/lib/setupapi/stringtable.c @@ -18,17 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winreg.h" -#include "setupapi.h" - -#include "wine/debug.h" - +#include "setupapi_private.h" #define TABLE_DEFAULT_SIZE 256 diff --git a/reactos/lib/setupapi/stubs.c b/reactos/lib/setupapi/stubs.c index 810d71f0b61..14a56f69cb7 100644 --- a/reactos/lib/setupapi/stubs.c +++ b/reactos/lib/setupapi/stubs.c @@ -18,16 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - -#include "wine/debug.h" -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "winreg.h" -#include "setupapi.h" +#include "setupapi_private.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); diff --git a/reactos/lib/setupapi/virtcopy.c b/reactos/lib/setupapi/virtcopy.c index c506f4a8239..2c0876e878a 100644 --- a/reactos/lib/setupapi/virtcopy.c +++ b/reactos/lib/setupapi/virtcopy.c @@ -21,19 +21,7 @@ * This is bad ! We ought to have 16bit resource handling working. */ -#include -#include -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "winreg.h" -#include "wownt32.h" -#include "wingdi.h" -#include "winnls.h" -#include "setupapi.h" -#include "setupx16.h" #include "setupapi_private.h" -#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi);