ReactOS  r74405
devinst.c File Reference
#include "setupapi_private.h"
Include dependency graph for devinst.c:

Go to the source code of this file.

Classes

struct  CoInstallerElement
 
struct  GetSectionCallbackInfo
 
struct  PropertyMapEntry
 

Macros

#define CLASS_COINSTALLER   0x1
 
#define DEVICE_COINSTALLER   0x2
 
#define CLASS_INSTALLER   0x4
 

Typedefs

typedef IN HDEVINFO DeviceInfoSet
 
typedef IN HDEVINFO IN
PSP_DEVINFO_DATA
DeviceInfoData 
OPTIONAL
 
typedef IN OUT PSP_DEVINFO_DATA DeviceInfoData
 
typedef IN HDEVINFO IN
PSP_DEVINFO_DATA
DeviceInfoData IN OUT
PCOINSTALLER_CONTEXT_DATA 
Context
 

Functions

typedef DWORD (CALLBACK *CLASS_INSTALL_PROC)(IN DI_FUNCTION InstallFunction
 
typedef BOOL (WINAPI *DEFAULT_CLASS_INSTALL_PROC)(IN HDEVINFO DeviceInfoSet
 
static void SETUPDI_GuidToString (const GUID *guid, LPWSTR guidStr)
 
static DWORD GetErrorCodeFromCrCode (const IN CONFIGRET cr)
 
static BOOL CheckSectionValid (IN LPCWSTR SectionName, IN PSP_ALTPLATFORM_INFO PlatformInfo, IN BYTE ProductType, IN WORD SuiteMask, OUT PDWORD ScorePlatform, OUT PDWORD ScoreMajorVersion, OUT PDWORD ScoreMinorVersion, OUT PDWORD ScoreProductType, OUT PDWORD ScoreSuiteMask)
 
static BOOL GetSectionCallback (IN LPCWSTR SectionName, IN PVOID Context)
 
BOOL WINAPI SetupDiGetActualSectionToInstallExW (IN HINF InfHandle, IN PCWSTR InfSectionName, IN PSP_ALTPLATFORM_INFO AlternatePlatformInfo OPTIONAL, OUT PWSTR InfSectionWithExt OPTIONAL, IN DWORD InfSectionWithExtSize, OUT PDWORD RequiredSize OPTIONAL, OUT PWSTR *Extension OPTIONAL, IN PVOID Reserved)
 
BOOL CreateDeviceInfo (IN struct DeviceInfoSet *list, IN LPCWSTR InstancePath, IN LPCGUID pClassGuid, OUT struct DeviceInfo **pDeviceInfo)
 
static BOOL DestroyClassInstallParams (struct ClassInstallParams *installParams)
 
static BOOL DestroyDeviceInfo (struct DeviceInfo *deviceInfo)
 
static BOOL DestroyDeviceInfoSet (struct DeviceInfoSet *list)
 
BOOL WINAPI SetupDiBuildClassInfoList (DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiBuildClassInfoListExA (DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCSTR MachineName, PVOID Reserved)
 
BOOL WINAPI SetupDiBuildClassInfoListExW (DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
 
BOOL WINAPI SetupDiClassGuidsFromNameA (LPCSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiClassGuidsFromNameW (LPCWSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiClassGuidsFromNameExA (LPCSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCSTR MachineName, PVOID Reserved)
 
BOOL WINAPI SetupDiClassGuidsFromNameExW (LPCWSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
 
BOOL WINAPI SetupDiClassNameFromGuidA (const GUID *ClassGuid, PSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiClassNameFromGuidW (const GUID *ClassGuid, PWSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiClassNameFromGuidExA (const GUID *ClassGuid, PSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved)
 
BOOL WINAPI SetupDiClassNameFromGuidExW (const GUID *ClassGuid, PWSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved)
 
HDEVINFO WINAPI SetupDiCreateDeviceInfoList (const GUID *ClassGuid, HWND hwndParent)
 
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExA (const GUID *ClassGuid, HWND hwndParent, PCSTR MachineName, PVOID Reserved)
 
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW (const GUID *ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved)
 
HKEY WINAPI SetupDiCreateDevRegKeyA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCSTR InfSectionName)
 
static HKEY OpenHardwareProfileKey (IN HKEY HKLM, IN DWORD HwProfile, IN DWORD samDesired)
 
HKEY WINAPI SetupDiCreateDevRegKeyW (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName)
 
BOOL WINAPI SetupDiCreateDeviceInfoA (HDEVINFO DeviceInfoSet, PCSTR DeviceName, CONST GUID *ClassGuid, PCSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiCreateDeviceInfoW (HDEVINFO DeviceInfoSet, PCWSTR DeviceName, CONST GUID *ClassGuid, PCWSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiRegisterDeviceInfo (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Flags, PSP_DETSIG_CMPPROC CompareProc, PVOID CompareContext, PSP_DEVINFO_DATA DupDeviceInfoData)
 
BOOL WINAPI SetupDiEnumDeviceInfo (HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
 
BOOL WINAPI SetupDiGetDeviceInstanceIdA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiGetDeviceInstanceIdW (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PWSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiGetActualSectionToInstallA (HINF InfHandle, PCSTR InfSectionName, PSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PSTR *Extension)
 
BOOL WINAPI SetupDiGetActualSectionToInstallW (HINF InfHandle, PCWSTR InfSectionName, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PWSTR *Extension)
 
BOOL WINAPI SetupDiGetActualSectionToInstallExA (IN HINF InfHandle, IN PCSTR InfSectionName, IN PSP_ALTPLATFORM_INFO AlternatePlatformInfo OPTIONAL, OUT PSTR InfSectionWithExt OPTIONAL, IN DWORD InfSectionWithExtSize, OUT PDWORD RequiredSize OPTIONAL, OUT PSTR *Extension OPTIONAL, IN PVOID Reserved)
 
BOOL WINAPI SetupDiGetClassDescriptionA (const GUID *ClassGuid, PSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiGetClassDescriptionW (const GUID *ClassGuid, PWSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiGetClassDescriptionExA (const GUID *ClassGuid, PSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved)
 
BOOL WINAPI SetupDiGetClassDescriptionExW (const GUID *ClassGuid, PWSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved)
 
HDEVINFO WINAPI SetupDiGetClassDevsA (CONST GUID *class, LPCSTR enumstr, HWND parent, DWORD flags)
 
HDEVINFO WINAPI SetupDiGetClassDevsExA (const GUID *class, PCSTR enumstr, HWND parent, DWORD flags, HDEVINFO deviceset, PCSTR machine, PVOID reserved)
 
HDEVINFO WINAPI SetupDiGetClassDevsW (CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
 
HDEVINFO WINAPI SetupDiGetClassDevsExW (CONST GUID *class, PCWSTR enumstr, HWND parent, DWORD flags, HDEVINFO deviceset, PCWSTR machine, PVOID reserved)
 
BOOL WINAPI SetupDiGetDeviceInfoListDetailA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_LIST_DETAIL_DATA_A DevInfoData)
 
BOOL WINAPI SetupDiGetDeviceInfoListDetailW (HDEVINFO DeviceInfoSet, PSP_DEVINFO_LIST_DETAIL_DATA_W DevInfoData)
 
BOOL WINAPI SetupDiCreateDeviceInterfaceA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const GUID *InterfaceClassGuid, PCSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
 
BOOL WINAPI SetupDiCreateDeviceInterfaceW (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const GUID *InterfaceClassGuid, PCWSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
 
HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyA (HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved, REGSAM samDesired, HINF InfHandle, PCSTR InfSectionName)
 
HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyW (HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved, REGSAM samDesired, HINF InfHandle, PCWSTR InfSectionName)
 
BOOL WINAPI SetupDiDeleteDeviceInterfaceRegKey (HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved)
 
BOOL WINAPI SetupDiEnumDeviceInterfaces (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
 
BOOL WINAPI SetupDiDestroyDeviceInfoList (HDEVINFO devinfo)
 
BOOL WINAPI SetupDiGetDeviceInterfaceDetailA (HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_A DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiGetDeviceInterfaceDetailW (HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiGetDeviceRegistryPropertyA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupDiSetDeviceRegistryPropertyA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
 
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
 
BOOL WINAPI SetupDiInstallClassA (HWND hwndParent, PCSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue)
 
BOOL WINAPI SetupDiInstallClassExA (IN HWND hwndParent OPTIONAL, IN PCSTR InfFileName OPTIONAL, IN DWORD Flags, IN HSPFILEQ FileQueue OPTIONAL, IN CONST GUID *InterfaceClassGuid OPTIONAL, IN PVOID Reserved1, IN PVOID Reserved2)
 
HKEY SETUP_CreateClassKey (HINF hInf)
 
BOOL WINAPI SetupDiInstallClassW (HWND hwndParent, PCWSTR InfFileName, DWORD Flags, HSPFILEQ FileQueue)
 
HKEY WINAPI SetupDiOpenClassRegKey (const GUID *ClassGuid, REGSAM samDesired)
 
HKEY WINAPI SetupDiOpenClassRegKeyExA (const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCSTR MachineName, PVOID Reserved)
 
HKEY WINAPI SetupDiOpenClassRegKeyExW (const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
 
BOOL WINAPI SetupDiOpenDeviceInterfaceW (HDEVINFO DeviceInfoSet, PCWSTR DevicePath, DWORD OpenFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
 
BOOL WINAPI SetupDiOpenDeviceInterfaceA (HDEVINFO DeviceInfoSet, PCSTR DevicePath, DWORD OpenFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
 
BOOL WINAPI SetupDiSetClassInstallParamsA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_CLASSINSTALL_HEADER ClassInstallParams, DWORD ClassInstallParamsSize)
 
static BOOL WINAPI IntSetupDiRegisterDeviceInfo (IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiCallClassInstaller (DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiGetDeviceInstallParamsA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DEVINSTALL_PARAMS_A DeviceInstallParams)
 
BOOL WINAPI SetupDiGetDeviceInfoListClass (IN HDEVINFO DeviceInfoSet, OUT LPGUID ClassGuid)
 
BOOL WINAPI SetupDiGetDeviceInstallParamsW (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
 
static BOOL CheckDeviceInstallParameters (IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
 
BOOL WINAPI SetupDiSetDeviceInstallParamsW (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
 
BOOL WINAPI SetupDiSetDeviceInstallParamsA (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PSP_DEVINSTALL_PARAMS_A DeviceInstallParams)
 
static BOOL IsDeviceInfoInDeviceInfoSet (struct DeviceInfoSet *deviceInfoSet, struct DeviceInfo *deviceInfo)
 
BOOL WINAPI SetupDiDeleteDeviceInfo (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiOpenDeviceInfoA (IN HDEVINFO DeviceInfoSet, IN PCSTR DeviceInstanceId, IN HWND hwndParent OPTIONAL, IN DWORD OpenFlags, OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
 
BOOL WINAPI SetupDiOpenDeviceInfoW (IN HDEVINFO DeviceInfoSet, IN PCWSTR DeviceInstanceId, IN HWND hwndParent OPTIONAL, IN DWORD OpenFlags, OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
 
BOOL WINAPI SetupDiGetSelectedDevice (IN HDEVINFO DeviceInfoSet, OUT PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiSetSelectedDevice (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
static DWORD SETUPAPI_GetCurrentHwProfile (IN HDEVINFO DeviceInfoSet)
 
static BOOL ResetDevice (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
static BOOL StopDevice (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiChangeState (IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiSelectDevice (IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
 
BOOL WINAPI SetupDiRegisterCoDeviceInstallers (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
 
static BOOL InfIsFromOEMLocation (IN PCWSTR FullName, OUT LPBOOL IsOEMLocation)
 
BOOL WINAPI SetupDiInstallDevice (IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
 
static HKEY SETUPDI_OpenDevKey (HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
 
static HKEY SETUPDI_OpenDrvKey (HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
 
HKEY WINAPI SetupDiOpenDevRegKey (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
 
static BOOL SETUPDI_DeleteDevKey (HKEY RootKey, struct DeviceInfo *devInfo)
 
static BOOL SETUPDI_DeleteDrvKey (HKEY RootKey, struct DeviceInfo *devInfo)
 
BOOL WINAPI SetupDiDeleteDevRegKey (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType)
 

Variables

static const WCHAR BackSlash [] = {'\\',0}
 
static const WCHAR DateFormat [] = {'%','u','-','%','u','-','%','u',0}
 
static const WCHAR DotCoInstallers [] = {'.','C','o','I','n','s','t','a','l','l','e','r','s',0}
 
static const WCHAR DotHW [] = {'.','H','W',0}
 
static const WCHAR DotServices [] = {'.','S','e','r','v','i','c','e','s',0}
 
static const WCHAR InfDirectory [] = {'i','n','f','\\',0}
 
static const WCHAR InstanceKeyFormat [] = {'%','0','4','l','u',0}
 
static const WCHAR Version [] = {'V','e','r','s','i','o','n',0}
 
static const WCHAR VersionFormat [] = {'%','u','.','%','u','.','%','u','.','%','u',0}
 
static const WCHAR REGSTR_DRIVER_DATE [] = {'D','r','i','v','e','r','D','a','t','e',0}
 
static const WCHAR REGSTR_DRIVER_DATE_DATA [] = {'D','r','i','v','e','r','D','a','t','e','D','a','t','a',0}
 
static const WCHAR REGSTR_DRIVER_VERSION [] = {'D','r','i','v','e','r','V','e','r','s','i','o','n',0}
 
static const WCHAR REGSTR_SECURITY [] = {'S','e','c','u','r','i','t','y',0}
 
static const WCHAR REGSTR_UI_NUMBER_DESC_FORMAT [] = {'U','I','N','u','m','b','e','r','D','e','s','c','F','o','r','m','a','t',0}
 
static struct PropertyMapEntry PropertyMap []
 

Macro Definition Documentation

#define CLASS_COINSTALLER   0x1
#define CLASS_INSTALLER   0x4
#define DEVICE_COINSTALLER   0x2

Typedef Documentation

Definition at line 49 of file devinst.c.

Definition at line 44 of file devinst.c.

Definition at line 44 of file devinst.c.

Function Documentation

typedef BOOL ( WINAPI DEFAULT_CLASS_INSTALL_PROC)
static BOOL CheckDeviceInstallParameters ( IN PSP_DEVINSTALL_PARAMS_W  DeviceInstallParams)
static

Definition at line 4568 of file devinst.c.

Referenced by SetupDiSetDeviceInstallParamsW().

4570 {
4571  DWORD SupportedFlags =
4572  DI_NOVCP | /* 0x00000008 */
4573  DI_DIDCOMPAT | /* 0x00000010 */
4574  DI_DIDCLASS | /* 0x00000020 */
4575  DI_NEEDRESTART | /* 0x00000080 */
4576  DI_NEEDREBOOT | /* 0x00000100 */
4577  DI_RESOURCEPAGE_ADDED | /* 0x00002000 */
4578  DI_PROPERTIES_CHANGE | /* 0x00004000 */
4579  DI_ENUMSINGLEINF | /* 0x00010000 */
4580  DI_DONOTCALLCONFIGMG | /* 0x00020000 */
4581  DI_CLASSINSTALLPARAMS | /* 0x00100000 */
4582  DI_NODI_DEFAULTACTION | /* 0x00200000 */
4583  DI_QUIETINSTALL | /* 0x00800000 */
4584  DI_NOFILECOPY | /* 0x01000000 */
4585  DI_DRIVERPAGE_ADDED; /* 0x04000000 */
4586  DWORD SupportedFlagsEx =
4587  DI_FLAGSEX_CI_FAILED | /* 0x00000004 */
4588  DI_FLAGSEX_DIDINFOLIST | /* 0x00000010 */
4589  DI_FLAGSEX_DIDCOMPATINFO | /* 0x00000020 */
4590  DI_FLAGSEX_ALLOWEXCLUDEDDRVS | /* 0x00000800 */
4591  DI_FLAGSEX_NO_DRVREG_MODIFY | /* 0x00008000 */
4592  DI_FLAGSEX_INSTALLEDDRIVER; /* 0x04000000 */
4593  BOOL ret = FALSE;
4594 
4595  /* FIXME: add support for more flags */
4596 
4597  /* FIXME: DI_CLASSINSTALLPARAMS flag is not correctly used.
4598  * It should be checked before accessing to other values
4599  * of the SP_DEVINSTALL_PARAMS structure */
4600 
4601  if (DeviceInstallParams->Flags & ~SupportedFlags)
4602  {
4603  FIXME("Unknown Flags: 0x%08lx\n", DeviceInstallParams->Flags & ~SupportedFlags);
4605  }
4606  else if (DeviceInstallParams->FlagsEx & ~SupportedFlagsEx)
4607  {
4608  FIXME("Unknown FlagsEx: 0x%08lx\n", DeviceInstallParams->FlagsEx & ~SupportedFlagsEx);
4610  }
4611  else if ((DeviceInstallParams->Flags & DI_NOVCP)
4612  && (DeviceInstallParams->FileQueue == NULL || DeviceInstallParams->FileQueue == (HSPFILEQ)INVALID_HANDLE_VALUE))
4614  else
4615  {
4616  /* FIXME: check Reserved field */
4617  ret = TRUE;
4618  }
4619 
4620  return ret;
4621 }
#define DI_NEEDREBOOT
Definition: setupapi.h:54
PVOID HSPFILEQ
Definition: filequeue.h:52
#define DI_FLAGSEX_NO_DRVREG_MODIFY
Definition: setupapi.h:91
#define TRUE
Definition: numbers.c:17
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define DI_FLAGSEX_ALLOWEXCLUDEDDRVS
Definition: setupapi.h:87
#define DI_DRIVERPAGE_ADDED
Definition: setupapi.h:71
DWORD DWORD
Definition: winlogon.h:75
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
#define DI_DIDCLASS
Definition: setupapi.h:51
#define DI_DONOTCALLCONFIGMG
Definition: setupapi.h:63
#define DI_NOFILECOPY
Definition: setupapi.h:69
#define FIXME(fmt,...)
Definition: debug.h:110
#define DI_DIDCOMPAT
Definition: setupapi.h:50
#define DI_NOVCP
Definition: setupapi.h:49
smooth NULL
Definition: ftsmooth.c:464
#define DI_PROPERTIES_CHANGE
Definition: setupapi.h:60
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DI_NODI_DEFAULTACTION
Definition: setupapi.h:67
#define SetLastError(x)
Definition: compat.h:409
#define DI_QUIETINSTALL
Definition: setupapi.h:68
#define DI_RESOURCEPAGE_ADDED
Definition: setupapi.h:59
#define DI_CLASSINSTALLPARAMS
Definition: setupapi.h:66
int ret
#define DI_FLAGSEX_DIDINFOLIST
Definition: setupapi.h:80
#define DI_FLAGSEX_DIDCOMPATINFO
Definition: setupapi.h:81
#define DI_FLAGSEX_CI_FAILED
Definition: setupapi.h:79
#define DI_ENUMSINGLEINF
Definition: setupapi.h:62
#define FALSE
Definition: numbers.c:16
#define DI_NEEDRESTART
Definition: setupapi.h:53
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
static BOOL CheckSectionValid ( IN LPCWSTR  SectionName,
IN PSP_ALTPLATFORM_INFO  PlatformInfo,
IN BYTE  ProductType,
IN WORD  SuiteMask,
OUT PDWORD  ScorePlatform,
OUT PDWORD  ScoreMajorVersion,
OUT PDWORD  ScoreMinorVersion,
OUT PDWORD  ScoreProductType,
OUT PDWORD  ScoreSuiteMask 
)
static

Definition at line 122 of file devinst.c.

Referenced by GetSectionCallback().

132 {
133  LPWSTR Section = NULL;
134  //LPCWSTR pExtensionPlatform;
135  LPCWSTR pExtensionArchitecture;
136  LPWSTR Fields[6];
137  DWORD i;
138  BOOL ret = FALSE;
139 
140  //static const WCHAR ExtensionPlatformNone[] = {'.',0};
141  static const WCHAR ExtensionPlatformNT[] = {'.','N','T',0};
142  static const WCHAR ExtensionPlatformWindows[] = {'.','W','i','n',0};
143 
144  static const WCHAR ExtensionArchitectureNone[] = {0};
145  static const WCHAR ExtensionArchitecturealpha[] = {'a','l','p','h','a',0};
146  static const WCHAR ExtensionArchitectureamd64[] = {'A','M','D','6','4',0};
147  static const WCHAR ExtensionArchitectureia64[] = {'I','A','6','4',0};
148  static const WCHAR ExtensionArchitecturemips[] = {'m','i','p','s',0};
149  static const WCHAR ExtensionArchitectureppc[] = {'p','p','c',0};
150  static const WCHAR ExtensionArchitecturex86[] = {'x','8','6',0};
151 
152  TRACE("%s %p 0x%x 0x%x\n",
153  debugstr_w(SectionName), PlatformInfo, ProductType, SuiteMask);
154 
155  *ScorePlatform = *ScoreMajorVersion = *ScoreMinorVersion = *ScoreProductType = *ScoreSuiteMask = 0;
156 
157  Section = pSetupDuplicateString(SectionName);
158  if (!Section)
159  {
160  TRACE("pSetupDuplicateString() failed\n");
161  goto cleanup;
162  }
163 
164  /* Set various extensions values */
165  switch (PlatformInfo->Platform)
166  {
168  //pExtensionPlatform = ExtensionPlatformWindows;
169  break;
171  //pExtensionPlatform = ExtensionPlatformNT;
172  break;
173  default:
174  ERR("Unknown platform 0x%lx\n", PlatformInfo->Platform);
175  //pExtensionPlatform = ExtensionPlatformNone;
176  break;
177  }
178  switch (PlatformInfo->ProcessorArchitecture)
179  {
181  pExtensionArchitecture = ExtensionArchitecturealpha;
182  break;
184  pExtensionArchitecture = ExtensionArchitectureamd64;
185  break;
187  pExtensionArchitecture = ExtensionArchitectureia64;
188  break;
190  pExtensionArchitecture = ExtensionArchitecturex86;
191  break;
193  pExtensionArchitecture = ExtensionArchitecturemips;
194  break;
196  pExtensionArchitecture = ExtensionArchitectureppc;
197  break;
198  default:
199  ERR("Unknown processor architecture 0x%x\n", PlatformInfo->ProcessorArchitecture);
201  pExtensionArchitecture = ExtensionArchitectureNone;
202  break;
203  }
204 
205  /*
206  * Field[0] Platform
207  * Field[1] Architecture
208  * Field[2] Major version
209  * Field[3] Minor version
210  * Field[4] Product type
211  * Field[5] Suite mask
212  * Remark: these fields may be NULL if the information is not provided
213  */
214  Fields[0] = Section;
215  if (Fields[0] == NULL)
216  {
217  TRACE("No extension found\n");
218  *ScorePlatform = *ScoreMajorVersion = *ScoreMinorVersion = *ScoreProductType = *ScoreSuiteMask = ULONG_MAX;
219  ret = TRUE;
220  goto cleanup;
221  }
222  Fields[1] = Fields[0] + 1;
223  Fields[2] = Fields[3] = Fields[4] = Fields[5] = NULL;
224  for (i = 2; Fields[i - 1] != NULL && i < 6; i++)
225  {
226  Fields[i] = wcschr(Fields[i - 1], '.');
227  if (Fields[i])
228  {
229  Fields[i]++;
230  *(Fields[i] - 1) = UNICODE_NULL;
231  }
232  }
233  /* Take care of first 2 fields */
234  if (strncmpiW(Fields[0], ExtensionPlatformWindows, strlenW(ExtensionPlatformWindows)) == 0)
235  {
236  if (PlatformInfo->Platform != VER_PLATFORM_WIN32_WINDOWS)
237  {
238  TRACE("Mismatch on platform field\n");
239  goto cleanup;
240  }
241  Fields[1] += wcslen(ExtensionPlatformWindows) - 1;
242  }
243  else if (strncmpiW(Fields[0], ExtensionPlatformNT, strlenW(ExtensionPlatformNT)) == 0)
244  {
245  if (PlatformInfo->Platform != VER_PLATFORM_WIN32_NT)
246  {
247  TRACE("Mismatch on platform field\n");
248  goto cleanup;
249  }
250  Fields[1] += wcslen(ExtensionPlatformNT) - 1;
251  }
252  else
253  {
254  /* No platform specified */
255  *ScorePlatform |= 0x02;
256  }
257  if (strcmpiW(Fields[1], ExtensionArchitectureNone) == 0)
258  {
259  /* No architecture specified */
260  *ScorePlatform |= 0x01;
261  }
262  else if (strcmpiW(Fields[1], pExtensionArchitecture) != 0)
263  {
264  TRACE("Mismatch on architecture field ('%s' and '%s')\n",
265  debugstr_w(Fields[1]), debugstr_w(pExtensionArchitecture));
266  goto cleanup;
267  }
268 
269  /* Check if informations are matching */
270  if (Fields[2] && *Fields[2])
271  {
273  MajorVersion = strtoulW(Fields[2], NULL, 0);
274  if ((MajorVersion == 0 || MajorVersion == ULONG_MAX) &&
275  (errno == ERANGE || errno == EINVAL))
276  {
277  TRACE("Wrong MajorVersion ('%s')\n", debugstr_w(Fields[2]));
278  goto cleanup;
279  }
280  if (Fields[3] && *Fields[3])
281  {
282  MinorVersion = strtoulW(Fields[3], NULL, 0);
283  if ((MinorVersion == 0 || MinorVersion == ULONG_MAX) &&
284  (errno == ERANGE || errno == EINVAL))
285  {
286  TRACE("Wrong MinorVersion ('%s')\n", debugstr_w(Fields[3]));
287  goto cleanup;
288  }
289  }
290  if (PlatformInfo->MajorVersion < MajorVersion ||
291  (PlatformInfo->MajorVersion == MajorVersion && PlatformInfo->MinorVersion < MinorVersion))
292  {
293  TRACE("Mismatch on version field (%lu.%lu and %lu.%lu)\n",
294  MajorVersion, MinorVersion, PlatformInfo->MajorVersion, PlatformInfo->MinorVersion);
295  goto cleanup;
296  }
297  *ScoreMajorVersion = MajorVersion - PlatformInfo->MajorVersion;
298  if (MajorVersion == PlatformInfo->MajorVersion)
299  *ScoreMinorVersion = MinorVersion - PlatformInfo->MinorVersion;
300  else
301  *ScoreMinorVersion = MinorVersion;
302  }
303  else if (Fields[3] && *Fields[3])
304  {
305  TRACE("Minor version found without major version\n");
306  goto cleanup;
307  }
308  else
309  {
310  *ScoreMajorVersion = PlatformInfo->MajorVersion;
311  *ScoreMinorVersion = PlatformInfo->MinorVersion;
312  }
313 
314  if (Fields[4] && *Fields[4])
315  {
316  DWORD CurrentProductType;
317  CurrentProductType = strtoulW(Fields[4], NULL, 0);
318  if ((CurrentProductType == 0 || CurrentProductType == ULONG_MAX) &&
319  (errno == ERANGE || errno == EINVAL))
320  {
321  TRACE("Wrong Product type ('%s')\n", debugstr_w(Fields[4]));
322  goto cleanup;
323  }
324  if (CurrentProductType != ProductType)
325  {
326  TRACE("Mismatch on product type (0x%08lx and 0x%08x)\n",
327  CurrentProductType, ProductType);
328  goto cleanup;
329  }
330  }
331  else
332  *ScoreProductType = 1;
333 
334  if (Fields[5] && *Fields[5])
335  {
336  DWORD CurrentSuiteMask;
337  CurrentSuiteMask = strtoulW(Fields[5], NULL, 0);
338  if ((CurrentSuiteMask == 0 || CurrentSuiteMask == ULONG_MAX) &&
339  (errno == ERANGE || errno == EINVAL))
340  {
341  TRACE("Wrong Suite mask ('%s')\n", debugstr_w(Fields[5]));
342  goto cleanup;
343  }
344  if ((CurrentSuiteMask & ~SuiteMask) != 0)
345  {
346  TRACE("Mismatch on suite mask (0x%08lx and 0x%08x)\n",
347  CurrentSuiteMask, SuiteMask);
348  goto cleanup;
349  }
350  *ScoreSuiteMask = SuiteMask & ~CurrentSuiteMask;
351  }
352  else
353  *ScoreSuiteMask = SuiteMask;
354 
355  ret = TRUE;
356 
357 cleanup:
358  MyFree(Section);
359  return ret;
360 }
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
ULONG MinorVersion
Definition: ros_glue.cpp:5
ULONG MajorVersion
Definition: ros_glue.cpp:4
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define PROCESSOR_ARCHITECTURE_UNKNOWN
Definition: ketypes.h:115
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: arc.h:39
#define TRUE
Definition: numbers.c:17
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
int errno
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
#define PROCESSOR_ARCHITECTURE_MIPS
Definition: ketypes.h:106
DWORD DWORD
Definition: winlogon.h:75
#define PROCESSOR_ARCHITECTURE_IA64
Definition: ketypes.h:111
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define PROCESSOR_ARCHITECTURE_ALPHA
Definition: ketypes.h:107
LPWSTR WINAPI pSetupDuplicateString(LPCWSTR lpSrc)
Definition: misc.c:198
#define UNICODE_NULL
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:464
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define ERANGE
Definition: acclib.h:92
int ret
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define PROCESSOR_ARCHITECTURE_INTEL
Definition: ketypes.h:105
#define ERR(fmt,...)
Definition: debug.h:109
#define PROCESSOR_ARCHITECTURE_PPC
Definition: ketypes.h:108
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:235
#define FALSE
Definition: numbers.c:16
char * cleanup(char *str)
Definition: wpickclick.c:99
#define strtoulW(s1, s2, b)
Definition: unicode.h:41
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ULONG_MAX
Definition: limits.h:44
BOOL CreateDeviceInfo ( IN struct DeviceInfoSet list,
IN LPCWSTR  InstancePath,
IN LPCGUID  pClassGuid,
OUT struct DeviceInfo **  pDeviceInfo 
)

Definition at line 526 of file devinst.c.

Referenced by SETUP_CreateDevicesListFromEnumerator(), SETUP_CreateInterfaceList(), SetupDiCreateDeviceInfoW(), SetupDiOpenDeviceInfoW(), and SetupDiOpenDeviceInterfaceW().

531 {
532  DWORD size;
533  CONFIGRET cr;
534  struct DeviceInfo *deviceInfo;
535 
536  *pDeviceInfo = NULL;
537 
538  size = FIELD_OFFSET(struct DeviceInfo, Data) + (strlenW(InstancePath) + 1) * sizeof(WCHAR);
539  deviceInfo = HeapAlloc(GetProcessHeap(), 0, size);
540  if (!deviceInfo)
541  {
543  return FALSE;
544  }
545  ZeroMemory(deviceInfo, size);
546 
547  cr = CM_Locate_DevNode_ExW(&deviceInfo->dnDevInst, (DEVINSTID_W)InstancePath, CM_LOCATE_DEVNODE_PHANTOM, list->hMachine);
548  if (cr != CR_SUCCESS)
549  {
551  return FALSE;
552  }
553 
554  deviceInfo->set = list;
555  deviceInfo->InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
556  strcpyW(deviceInfo->Data, InstancePath);
557  deviceInfo->instanceId = deviceInfo->Data;
558  deviceInfo->UniqueId = strrchrW(deviceInfo->Data, '\\');
559  deviceInfo->DeviceDescription = NULL;
560  memcpy(&deviceInfo->ClassGuid, pClassGuid, sizeof(GUID));
561  deviceInfo->CreationFlags = 0;
562  InitializeListHead(&deviceInfo->DriverListHead);
564 
565  *pDeviceInfo = deviceInfo;
566  return TRUE;
567 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
LIST_ENTRY InterfaceListHead
#define TRUE
Definition: numbers.c:17
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ZeroMemory
Definition: winbase.h:1594
SP_DEVINSTALL_PARAMS_W InstallParams
DWORD DWORD
Definition: winlogon.h:75
_Null_terminated_ WCHAR * DEVINSTID_W
Definition: cfgmgr32.h:80
static DWORD GetErrorCodeFromCrCode(const IN CONFIGRET cr)
Definition: devinst.c:92
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:464
PCWSTR DeviceDescription
WCHAR Data[ANYSIZE_ARRAY]
struct DeviceInfoSet * set
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SetLastError(x)
Definition: compat.h:409
LIST_ENTRY DriverListHead
DEVINST dnDevInst
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: _list.h:228
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
GLsizeiptr size
Definition: glext.h:5919
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define CM_LOCATE_DEVNODE_PHANTOM
Definition: cfgmgr32.h:761
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
#define FALSE
Definition: numbers.c:16
CONFIGRET WINAPI CM_Locate_DevNode_ExW(PDEVINST pdnDevInst, DEVINSTID_W pDeviceID, ULONG ulFlags, HMACHINE hMachine)
Definition: cfgmgr.c:4218
#define list
Definition: rosglue.h:35
static BOOL DestroyClassInstallParams ( struct ClassInstallParams installParams)
static

Definition at line 571 of file devinst.c.

Referenced by DestroyDeviceInfo(), and DestroyDeviceInfoSet().

572 {
573  HeapFree(GetProcessHeap(), 0, installParams->PropChangeParams);
574  HeapFree(GetProcessHeap(), 0, installParams->AddPropertyPageData);
575  return TRUE;
576 }
#define TRUE
Definition: numbers.c:17
PSP_ADDPROPERTYPAGE_DATA AddPropertyPageData
#define GetProcessHeap()
Definition: compat.h:395
PSP_PROPCHANGE_PARAMS PropChangeParams
#define HeapFree(x, y, z)
Definition: compat.h:394
static BOOL DestroyDeviceInfo ( struct DeviceInfo deviceInfo)
static

Definition at line 579 of file devinst.c.

Referenced by DestroyDeviceInfoSet(), SetupDiCreateDeviceInfoW(), and SetupDiDeleteDeviceInfo().

580 {
582  struct DriverInfoElement *driverInfo;
583  struct DeviceInterface *deviceInterface;
584 
585  while (!IsListEmpty(&deviceInfo->DriverListHead))
586  {
587  ListEntry = RemoveHeadList(&deviceInfo->DriverListHead);
588  driverInfo = CONTAINING_RECORD(ListEntry, struct DriverInfoElement, ListEntry);
589  if (!DestroyDriverInfoElement(driverInfo))
590  return FALSE;
591  }
592  while (!IsListEmpty(&deviceInfo->InterfaceListHead))
593  {
594  ListEntry = RemoveHeadList(&deviceInfo->InterfaceListHead);
595  deviceInterface = CONTAINING_RECORD(ListEntry, struct DeviceInterface, ListEntry);
596  if (!DestroyDeviceInterface(deviceInterface))
597  return FALSE;
598  }
600  if (deviceInfo->hmodDevicePropPageProvider)
602  return HeapFree(GetProcessHeap(), 0, deviceInfo);
603 }
LIST_ENTRY InterfaceListHead
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
BOOL DestroyDeviceInterface(struct DeviceInterface *deviceInterface)
Definition: interface.c:61
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
HMODULE hmodDevicePropPageProvider
static BOOL DestroyClassInstallParams(struct ClassInstallParams *installParams)
Definition: devinst.c:571
#define FreeLibrary(x)
Definition: compat.h:405
#define GetProcessHeap()
Definition: compat.h:395
BOOL DestroyDriverInfoElement(struct DriverInfoElement *driverInfo)
Definition: driver.c:94
LIST_ENTRY DriverListHead
Definition: typedefs.h:118
LIST_ENTRY ListEntry
#define FALSE
Definition: numbers.c:16
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
struct ClassInstallParams ClassInstallParams
#define HeapFree(x, y, z)
Definition: compat.h:394
static BOOL DestroyDeviceInfoSet ( struct DeviceInfoSet list)
static

Definition at line 606 of file devinst.c.

Referenced by SetupDiDestroyDeviceInfoList().

607 {
609  struct DeviceInfo *deviceInfo;
610 
611  while (!IsListEmpty(&list->ListHead))
612  {
613  ListEntry = RemoveHeadList(&list->ListHead);
614  deviceInfo = CONTAINING_RECORD(ListEntry, struct DeviceInfo, ListEntry);
615  if (!DestroyDeviceInfo(deviceInfo))
616  return FALSE;
617  }
618  if (list->HKLM != HKEY_LOCAL_MACHINE)
619  RegCloseKey(list->HKLM);
622  if (list->hmodClassPropPageProvider)
624  return HeapFree(GetProcessHeap(), 0, list);
625 }
LIST_ENTRY ListHead
HMODULE hmodClassPropPageProvider
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
struct ClassInstallParams ClassInstallParams
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
static BOOL DestroyClassInstallParams(struct ClassInstallParams *installParams)
Definition: devinst.c:571
#define FreeLibrary(x)
Definition: compat.h:405
#define GetProcessHeap()
Definition: compat.h:395
static BOOL DestroyDeviceInfo(struct DeviceInfo *deviceInfo)
Definition: devinst.c:579
Definition: typedefs.h:118
LIST_ENTRY ListEntry
CONFIGRET WINAPI CM_Disconnect_Machine(HMACHINE hMachine)
Definition: cfgmgr.c:1073
#define FALSE
Definition: numbers.c:16
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
typedef DWORD ( CALLBACK CLASS_INSTALL_PROC)
static DWORD GetErrorCodeFromCrCode ( const IN CONFIGRET  cr)
static

Definition at line 92 of file devinst.c.

Referenced by CreateDeviceInfo(), ResetDevice(), SetupDiCreateDeviceInfoListExW(), and SetupDiCreateDeviceInfoW().

93 {
94  switch (cr)
95  {
99  case CR_FAILURE: return ERROR_GEN_FAILURE;
113  case CR_SUCCESS: return ERROR_SUCCESS;
114  default: return ERROR_GEN_FAILURE;
115  }
116 
117  /* Does not happen */
118 }
#define CR_NO_SUCH_REGISTRY_KEY
Definition: cfgmgr32.h:892
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
#define CR_ALREADY_SUCH_DEVINST
Definition: cfgmgr32.h:862
#define CR_ACCESS_DENIED
Definition: cfgmgr32.h:897
#define CR_INVALID_DEVICE_ID
Definition: cfgmgr32.h:876
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define ERROR_INVALID_COMPUTERNAME
Definition: winerror.h:713
#define CR_INVALID_PROPERTY
Definition: cfgmgr32.h:899
#define CR_OUT_OF_MEMORY
Definition: cfgmgr32.h:844
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
#define CR_FAILURE
Definition: cfgmgr32.h:865
#define CR_INVALID_DATA
Definition: cfgmgr32.h:877
#define CR_INVALID_DEVNODE
Definition: cfgmgr32.h:847
#define CR_INVALID_MACHINENAME
Definition: cfgmgr32.h:893
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define ERROR_DEVINST_ALREADY_EXISTS
Definition: setupapi.h:298
#define CR_NO_SUCH_DEVNODE
Definition: cfgmgr32.h:857
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
static BOOL GetSectionCallback ( IN LPCWSTR  SectionName,
IN PVOID  Context 
)
static

Definition at line 363 of file devinst.c.

Referenced by SetupDiGetActualSectionToInstallExW().

366 {
368  DWORD Score1, Score2, Score3, Score4, Score5;
369  BOOL ret;
370 
371  if (SectionName[info->PrefixLength] != '.')
372  return TRUE;
373 
374  ret = CheckSectionValid(
375  &SectionName[info->PrefixLength],
376  info->PlatformInfo,
377  info->ProductType,
378  info->SuiteMask,
379  &Score1, &Score2, &Score3, &Score4, &Score5);
380  if (!ret)
381  {
382  TRACE("Section %s not compatible\n", debugstr_w(SectionName));
383  return TRUE;
384  }
385  if (Score1 > info->BestScore1) goto done;
386  if (Score1 < info->BestScore1) goto bettersection;
387  if (Score2 > info->BestScore2) goto done;
388  if (Score2 < info->BestScore2) goto bettersection;
389  if (Score3 > info->BestScore3) goto done;
390  if (Score3 < info->BestScore3) goto bettersection;
391  if (Score4 > info->BestScore4) goto done;
392  if (Score4 < info->BestScore4) goto bettersection;
393  if (Score5 > info->BestScore5) goto done;
394  if (Score5 < info->BestScore5) goto bettersection;
395  goto done;
396 
397 bettersection:
398  strcpyW(info->BestSection, SectionName);
399  info->BestScore1 = Score1;
400  info->BestScore2 = Score2;
401  info->BestScore3 = Score3;
402  info->BestScore4 = Score4;
403  info->BestScore5 = Score5;
404 
405 done:
406  return TRUE;
407 }
#define TRUE
Definition: numbers.c:17
Definition: compobj.c:610
DWORD DWORD
Definition: winlogon.h:75
#define debugstr_w
Definition: kernel32.h:32
WCHAR BestSection[LINE_LEN+1]
Definition: devinst.c:73
IN HDEVINFO IN PSP_DEVINFO_DATA DeviceInfoData IN OUT PCOINSTALLER_CONTEXT_DATA Context
Definition: devinst.c:53
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL CheckSectionValid(IN LPCWSTR SectionName, IN PSP_ALTPLATFORM_INFO PlatformInfo, IN BYTE ProductType, IN WORD SuiteMask, OUT PDWORD ScorePlatform, OUT PDWORD ScoreMajorVersion, OUT PDWORD ScoreMinorVersion, OUT PDWORD ScoreProductType, OUT PDWORD ScoreSuiteMask)
Definition: devinst.c:122
int ret
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
PSP_ALTPLATFORM_INFO PlatformInfo
Definition: devinst.c:69
static BOOL InfIsFromOEMLocation ( IN PCWSTR  FullName,
OUT LPBOOL  IsOEMLocation 
)
static

Definition at line 5342 of file devinst.c.

Referenced by SetupDiInstallDevice().

5345 {
5346  PWCHAR last;
5347 
5348  last = strrchrW(FullName, '\\');
5349  if (!last)
5350  {
5351  /* No directory specified */
5352  *IsOEMLocation = FALSE;
5353  }
5354  else
5355  {
5356  LPWSTR Windir;
5357  UINT ret;
5358 
5359  Windir = MyMalloc((MAX_PATH + 1 + strlenW(InfDirectory)) * sizeof(WCHAR));
5360  if (!Windir)
5361  {
5363  return FALSE;
5364  }
5365 
5366  ret = GetSystemWindowsDirectoryW(Windir, MAX_PATH);
5367  if (ret == 0 || ret > MAX_PATH)
5368  {
5369  MyFree(Windir);
5371  return FALSE;
5372  }
5373  if (*Windir && Windir[strlenW(Windir) - 1] != '\\')
5374  strcatW(Windir, BackSlash);
5375  strcatW(Windir, InfDirectory);
5376 
5377  if (strncmpiW(FullName, Windir, last - FullName) == 0)
5378  {
5379  /* The path is %SYSTEMROOT%\Inf */
5380  *IsOEMLocation = FALSE;
5381  }
5382  else
5383  {
5384  /* The file is in another place */
5385  *IsOEMLocation = TRUE;
5386  }
5387  MyFree(Windir);
5388  }
5389  return TRUE;
5390 }
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2397
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
POINT last
Definition: font.c:43
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TRUE
Definition: numbers.c:17
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
uint16_t * PWCHAR
Definition: typedefs.h:55
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
static const WCHAR InfDirectory[]
Definition: devinst.c:30
#define MAX_PATH
Definition: compat.h:26
_In_ PSTRING FullName
Definition: rtlfuncs.h:1649
#define SetLastError(x)
Definition: compat.h:409
int ret
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
unsigned int UINT
Definition: ndis.h:50
static const WCHAR BackSlash[]
Definition: devinst.c:25
#define FALSE
Definition: numbers.c:16
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
static BOOL WINAPI IntSetupDiRegisterDeviceInfo ( IN HDEVINFO  DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 4082 of file devinst.c.

Referenced by SetupDiCallClassInstaller().

4085 {
4087 }
smooth NULL
Definition: ftsmooth.c:464
BOOL WINAPI SetupDiRegisterDeviceInfo(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Flags, PSP_DETSIG_CMPPROC CompareProc, PVOID CompareContext, PSP_DEVINFO_DATA DupDeviceInfoData)
Definition: devinst.c:1849
IN OUT PSP_DEVINFO_DATA DeviceInfoData
Definition: devinst.c:49
static BOOL IsDeviceInfoInDeviceInfoSet ( struct DeviceInfoSet deviceInfoSet,
struct DeviceInfo deviceInfo 
)
static

Definition at line 4759 of file devinst.c.

Referenced by SetupDiDeleteDeviceInfo().

4762 {
4763  PLIST_ENTRY ListEntry;
4764 
4765  ListEntry = deviceInfoSet->ListHead.Flink;
4766  while (ListEntry != &deviceInfoSet->ListHead)
4767  {
4768  if (deviceInfo == CONTAINING_RECORD(ListEntry, struct DeviceInfo, ListEntry))
4769  return TRUE;
4770 
4771  ListEntry = ListEntry->Flink;
4772  }
4773 
4774  return FALSE;
4775 }
LIST_ENTRY ListHead
#define TRUE
Definition: numbers.c:17
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
Definition: typedefs.h:118
#define FALSE
Definition: numbers.c:16
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
static HKEY OpenHardwareProfileKey ( IN HKEY  HKLM,
IN DWORD  HwProfile,
IN DWORD  samDesired 
)
static

Definition at line 4704 of file devinst.c.

Referenced by SetupDiCreateDevRegKeyW(), SetupDiDeleteDevRegKey(), and SetupDiOpenDevRegKey().

4708 {
4709  HKEY hHWProfilesKey = NULL;
4710  HKEY hHWProfileKey = NULL;
4712  LONG rc;
4713 
4714  rc = RegOpenKeyExW(HKLM,
4716  0,
4717  READ_CONTROL,
4718  &hHWProfilesKey);
4719  if (rc != ERROR_SUCCESS)
4720  {
4721  SetLastError(rc);
4722  goto cleanup;
4723  }
4724  if (HwProfile == 0)
4725  {
4726  rc = RegOpenKeyExW(hHWProfilesKey,
4728  0,
4730  &hHWProfileKey);
4731  }
4732  else
4733  {
4734  WCHAR subKey[5];
4735  snprintfW(subKey, 4, InstanceKeyFormat, HwProfile);
4736  subKey[4] = '\0';
4737  rc = RegOpenKeyExW(hHWProfilesKey,
4738  subKey,
4739  0,
4741  &hHWProfileKey);
4742  }
4743  if (rc != ERROR_SUCCESS)
4744  {
4745  SetLastError(rc);
4746  goto cleanup;
4747  }
4748  ret = hHWProfileKey;
4749 
4750 cleanup:
4751  if (hHWProfilesKey != NULL)
4752  RegCloseKey(hHWProfilesKey);
4753  if (hHWProfileKey != NULL && hHWProfileKey != ret)
4754  RegCloseKey(hHWProfileKey);
4755  return ret;
4756 }
#define snprintfW
Definition: unicode.h:60
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR InstanceKeyFormat[]
Definition: devinst.c:31
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define REGSTR_PATH_HWPROFILES
Definition: regstr.h:482
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:464
static const WCHAR HKLM[]
Definition: reginf.c:54
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
#define READ_CONTROL
Definition: nt_native.h:58
int ret
#define REGSTR_KEY_CURRENT
Definition: regstr.h:493
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
static BOOL ResetDevice ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 5089 of file devinst.c.

5092 {
5093 #ifndef __WINESRC__
5094  struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5095  struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5096  CONFIGRET cr;
5097 
5098  cr = CM_Enable_DevNode_Ex(deviceInfo->dnDevInst, 0, set->hMachine);
5099  if (cr != CR_SUCCESS)
5100  {
5102  return FALSE;
5103  }
5104 
5105  return TRUE;
5106 #else
5107  FIXME("Stub: ResetDevice(%p %p)\n", DeviceInfoSet, DeviceInfoData);
5108  return TRUE;
5109 #endif
5110 }
#define TRUE
Definition: numbers.c:17
static DWORD GetErrorCodeFromCrCode(const IN CONFIGRET cr)
Definition: devinst.c:92
#define FIXME(fmt,...)
Definition: debug.h:110
#define CR_SUCCESS
Definition: cfgmgr32.h:842
CONFIGRET WINAPI CM_Enable_DevNode_Ex(DEVINST dnDevInst, ULONG ulFlags, HMACHINE hMachine)
Definition: cfgmgr.c:1112
#define SetLastError(x)
Definition: compat.h:409
DEVINST dnDevInst
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define FALSE
Definition: numbers.c:16
IN OUT PSP_DEVINFO_DATA DeviceInfoData
Definition: devinst.c:49
Definition: _set.h:46
HKEY SETUP_CreateClassKey ( HINF  hInf)

Definition at line 3600 of file devinst.c.

Referenced by SetupDiInstallClassExW().

3601 {
3602  static const WCHAR slash[] = { '\\',0 };
3603  WCHAR FullBuffer[MAX_PATH];
3606  HKEY hClassKey;
3607 
3608  if (!SetupGetLineTextW(NULL,
3609  hInf,
3610  Version,
3612  Buffer,
3613  MAX_PATH,
3614  &RequiredSize))
3615  {
3616  return INVALID_HANDLE_VALUE;
3617  }
3618 
3619  lstrcpyW(FullBuffer, REGSTR_PATH_CLASS_NT);
3620  lstrcatW(FullBuffer, slash);
3621  lstrcatW(FullBuffer, Buffer);
3622 
3624  FullBuffer,
3625  0,
3626  KEY_SET_VALUE,
3627  &hClassKey))
3628  {
3629  if (!SetupGetLineTextW(NULL,
3630  hInf,
3631  Version,
3633  Buffer,
3634  MAX_PATH,
3635  &RequiredSize))
3636  {
3637  return INVALID_HANDLE_VALUE;
3638  }
3639 
3641  FullBuffer,
3642  0,
3643  NULL,
3645  KEY_SET_VALUE,
3646  NULL,
3647  &hClassKey,
3648  NULL))
3649  {
3650  return INVALID_HANDLE_VALUE;
3651  }
3652  }
3653 
3654  if (RegSetValueExW(hClassKey,
3656  0,
3657  REG_SZ,
3658  (LPBYTE)Buffer,
3659  RequiredSize * sizeof(WCHAR)))
3660  {
3661  RegCloseKey(hClassKey);
3663  FullBuffer);
3664  return INVALID_HANDLE_VALUE;
3665  }
3666 
3667  return hClassKey;
3668 }
#define REGSTR_VAL_CLASS
Definition: regstr.h:291
#define KEY_SET_VALUE
Definition: nt_native.h:1017
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:53
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1240
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1094
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:464
Definition: bufpool.h:45
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4884
HANDLE HKEY
Definition: registry.h:24
#define MAX_PATH
Definition: compat.h:26
#define REGSTR_VAL_CLASSGUID
Definition: regstr.h:761
#define lstrcpyW
Definition: compat.h:406
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static HKEY hClassKey
Definition: umpnpmgr.c:66
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REGSTR_PATH_CLASS_NT
Definition: regstr.h:479
BOOL WINAPI SetupGetLineTextW(PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required)
Definition: parser.c:1756
#define REG_SZ
Definition: layer.c:33
static DWORD SETUPAPI_GetCurrentHwProfile ( IN HDEVINFO  DeviceInfoSet)
static

Definition at line 5042 of file devinst.c.

Referenced by SetupDiChangeState().

5044 {
5045  HKEY hKey = NULL;
5046  DWORD dwRegType, dwLength;
5047  DWORD hwProfile;
5048  LONG rc;
5049  DWORD ret = (DWORD)-1;
5050 
5051  rc = RegOpenKeyExW(((struct DeviceInfoSet *)DeviceInfoSet)->HKLM,
5053  0, /* Options */
5055  &hKey);
5056  if (rc != ERROR_SUCCESS)
5057  {
5058  SetLastError(rc);
5059  goto cleanup;
5060  }
5061 
5062  dwLength = sizeof(DWORD);
5063  rc = RegQueryValueExW(hKey,
5065  NULL,
5066  &dwRegType,
5067  (LPBYTE)&hwProfile, &dwLength);
5068  if (rc != ERROR_SUCCESS)
5069  {
5070  SetLastError(rc);
5071  goto cleanup;
5072  }
5073  else if (dwRegType != REG_DWORD || dwLength != sizeof(DWORD))
5074  {
5076  goto cleanup;
5077  }
5078 
5079  ret = hwProfile;
5080 
5081 cleanup:
5082  if (hKey != NULL)
5083  RegCloseKey(hKey);
5084 
5085  return ret;
5086 }
static const GUID DWORD
Definition: devinst.c:39
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned char * LPBYTE
Definition: typedefs.h:53
DWORD DWORD
Definition: winlogon.h:75
#define REGSTR_VAL_CURRENTCONFIG
Definition: regstr.h:466
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:464
static const WCHAR HKLM[]
Definition: reginf.c:54
#define REGSTR_PATH_IDCONFIGDB
Definition: regstr.h:41
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4101
static DWORD DWORD * dwLength
Definition: fusion.c:70
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
int ret
#define REG_DWORD
Definition: nt_native.h:1497
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
static BOOL SETUPDI_DeleteDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo 
)
static

Definition at line 5855 of file devinst.c.

Referenced by SetupDiDeleteDevRegKey().

5856 {
5857  FIXME("\n");
5858  return FALSE;
5859 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define FALSE
Definition: numbers.c:16
static BOOL SETUPDI_DeleteDrvKey ( HKEY  RootKey,
struct DeviceInfo devInfo 
)
static

Definition at line 5861 of file devinst.c.

Referenced by SetupDiDeleteDevRegKey().

5862 {
5863  FIXME("\n");
5864  return FALSE;
5865 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define FALSE
Definition: numbers.c:16
static void SETUPDI_GuidToString ( const GUID guid,
LPWSTR  guidStr 
)
static

Definition at line 79 of file devinst.c.

Referenced by SetupDiCreateDeviceInterfaceRegKeyW(), and SetupDiOpenClassRegKeyExW().

80 {
81  static const WCHAR fmt[] = {'{','%','0','8','X','-','%','0','4','X','-',
82  '%','0','4','X','-','%','0','2','X','%','0','2','X','-','%','0','2',
83  'X','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','%',
84  '0','2','X','}',0};
85 
86  sprintfW(guidStr, fmt, guid->Data1, guid->Data2, guid->Data3,
87  guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
88  guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
89 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
static WCHAR guidStr[]
Definition: asn.c:531
#define sprintfW
Definition: unicode.h:58
Definition: dsound.c:958
static HKEY SETUPDI_OpenDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)
static

Definition at line 5690 of file devinst.c.

Referenced by SETUPDI_OpenDrvKey(), and SetupDiOpenDevRegKey().

5691 {
5692  HKEY enumKey, key = INVALID_HANDLE_VALUE;
5693  LONG l;
5694 
5696  if (!l)
5697  {
5698  l = RegOpenKeyExW(enumKey, devInfo->instanceId, 0, samDesired, &key);
5699  RegCloseKey(enumKey);
5700  }
5701  if (l)
5702  SetLastError(l);
5703  return key;
5704 }
static PMEMKEY RootKey
Definition: registry.c:40
#define REGSTR_PATH_SYSTEMENUM
Definition: regstr.h:483
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
r l[0]
Definition: byte_order.h:167
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
#define READ_CONTROL
Definition: nt_native.h:58
HKEY key
Definition: reg.c:48
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
Definition: path.c:42
static HKEY SETUPDI_OpenDrvKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)
static

Definition at line 5706 of file devinst.c.

Referenced by SetupDiOpenDevRegKey().

5707 {
5708  LPWSTR DriverKey = NULL;
5709  DWORD dwLength = 0;
5710  DWORD dwRegType;
5711  DWORD rc;
5712  HKEY hEnumKey = NULL;
5713  HKEY hKey = NULL;
5715 
5716  hKey = SETUPDI_OpenDevKey(RootKey, devInfo, KEY_QUERY_VALUE);
5717  if (hKey == INVALID_HANDLE_VALUE)
5718  goto cleanup;
5719  /* Read the 'Driver' key */
5720  rc = RegQueryValueExW(hKey, REGSTR_VAL_DRIVER, NULL, &dwRegType, NULL, &dwLength);
5721  if (rc != ERROR_SUCCESS)
5722  {
5723  SetLastError(rc);
5724  goto cleanup;
5725  }
5726  else if (dwRegType != REG_SZ)
5727  {
5729  goto cleanup;
5730  }
5731  DriverKey = HeapAlloc(GetProcessHeap(), 0, dwLength);
5732  if (!DriverKey)
5733  {
5735  goto cleanup;
5736  }
5737  rc = RegQueryValueExW(hKey, REGSTR_VAL_DRIVER, NULL, &dwRegType, (LPBYTE)DriverKey, &dwLength);
5738  if (rc != ERROR_SUCCESS)
5739  {
5740  SetLastError(rc);
5741  goto cleanup;
5742  }
5743  RegCloseKey(hKey);
5744  hKey = NULL;
5745  /* Need to open the driver key */
5746  rc = RegOpenKeyExW(
5747  RootKey,
5749  0, /* Options */
5750  READ_CONTROL,
5751  &hEnumKey);
5752  if (rc != ERROR_SUCCESS)
5753  {
5754  SetLastError(rc);
5755  goto cleanup;
5756  }
5757  rc = RegOpenKeyExW(
5758  hEnumKey,
5759  DriverKey,
5760  0, /* Options */
5761  samDesired,
5762  &hKey);
5763  if (rc != ERROR_SUCCESS)
5764  {
5765  SetLastError(rc);
5766  goto cleanup;
5767  }
5768  key = hKey;
5769 
5770 cleanup:
5771  if (hEnumKey != NULL)
5772  RegCloseKey(hEnumKey);
5773  if (hKey != NULL && hKey != key)
5774  RegCloseKey(hKey);
5775  if (DriverKey)
5776  HeapFree(GetProcessHeap(), 0, DriverKey);
5777  return key;
5778 }
#define REGSTR_VAL_DRIVER
Definition: regstr.h:385
static PMEMKEY RootKey
Definition: registry.c:40
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned char * LPBYTE
Definition: typedefs.h:53
static HKEY SETUPDI_OpenDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5690
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:464
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4101
static DWORD DWORD * dwLength
Definition: fusion.c:70
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
#define READ_CONTROL
Definition: nt_native.h:58
HKEY key
Definition: reg.c:48
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: path.c:42
#define REGSTR_PATH_CLASS_NT
Definition: regstr.h:479
#define REG_SZ
Definition: layer.c:33
BOOL WINAPI SetupDiBuildClassInfoList ( DWORD  Flags,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize 
)

Definition at line 643 of file devinst.c.

Referenced by test_SetupDiBuildClassInfoList().

648 {
649  TRACE("\n");
650  return SetupDiBuildClassInfoListExW(Flags, ClassGuidList,
652  NULL, NULL);
653 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:464
_In_ DWORD ClassGuidListSize
Definition: setupapi.h:1276
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI SetupDiBuildClassInfoListExW(DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:720
BOOL WINAPI SetupDiBuildClassInfoListExA ( DWORD  Flags,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize,
LPCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 673 of file devinst.c.

680 {
681  LPWSTR MachineNameW = NULL;
682  BOOL bResult;
683 
684  TRACE("0x%lx %p %lu %p %s %p\n", Flags, ClassGuidList,
686 
687  if (MachineName)
688  {
690  if (MachineNameW == NULL) return FALSE;
691  }
692 
693  bResult = SetupDiBuildClassInfoListExW(Flags, ClassGuidList,
695  MachineNameW, Reserved);
696 
697  MyFree(MachineNameW);
698 
699  return bResult;
700 }
#define CP_ACP
Definition: compat.h:99
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:464
_In_ DWORD ClassGuidListSize
Definition: setupapi.h:1276
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_a
Definition: kernel32.h:31
ULONG PVOID Reserved
Definition: ntimage.h:533
BOOL WINAPI SetupDiBuildClassInfoListExW(DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:720
#define FALSE
Definition: numbers.c:16
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
BOOL WINAPI SetupDiBuildClassInfoListExW ( DWORD  Flags,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize,
LPCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 720 of file devinst.c.

Referenced by SetupDiBuildClassInfoList(), SetupDiBuildClassInfoListExA(), and SetupDiGetClassImageListExW().

727 {
728  WCHAR szKeyName[40];
729  HKEY hClassesKey = INVALID_HANDLE_VALUE;
730  HKEY hClassKey;
731  DWORD dwLength;
732  DWORD dwIndex;
733  LONG lError;
734  DWORD dwGuidListIndex = 0;
735 
736  TRACE("0x%lx %p %lu %p %s %p\n", Flags, ClassGuidList,
738 
739  if (!RequiredSize)
740  {
742  return FALSE;
743  }
744  else if (!ClassGuidList && ClassGuidListSize > 0)
745  {
747  return FALSE;
748  }
749 
750  hClassesKey = SetupDiOpenClassRegKeyExW(NULL,
753  MachineName,
754  Reserved);
755  if (hClassesKey == INVALID_HANDLE_VALUE)
756  {
757  return FALSE;
758  }
759 
760  for (dwIndex = 0; ; dwIndex++)
761  {
762  dwLength = 40;
763  lError = RegEnumKeyExW(hClassesKey,
764  dwIndex,
765  szKeyName,
766  &dwLength,
767  NULL,
768  NULL,
769  NULL,
770  NULL);
771  TRACE("RegEnumKeyExW() returns %d\n", lError);
772  if (lError == ERROR_SUCCESS || lError == ERROR_MORE_DATA)
773  {
774  TRACE("Key name: %s\n", debugstr_w(szKeyName));
775 
776  if (RegOpenKeyExW(hClassesKey,
777  szKeyName,
778  0,
780  &hClassKey))
781  {
782  RegCloseKey(hClassesKey);
783  return FALSE;
784  }
785 
786  if (!RegQueryValueExW(hClassKey,
788  NULL,
789  NULL,
790  NULL,
791  NULL))
792  {
793  TRACE("'NoUseClass' value found!\n");
794  RegCloseKey(hClassKey);
795  continue;
796  }
797 
798  if ((Flags & DIBCI_NOINSTALLCLASS) &&
799  (!RegQueryValueExW(hClassKey,
801  NULL,
802  NULL,
803  NULL,
804  NULL)))
805  {
806  TRACE("'NoInstallClass' value found!\n");
807  RegCloseKey(hClassKey);
808  continue;
809  }
810 
811  if ((Flags & DIBCI_NODISPLAYCLASS) &&
812  (!RegQueryValueExW(hClassKey,
814  NULL,
815  NULL,
816  NULL,
817  NULL)))
818  {
819  TRACE("'NoDisplayClass' value found!\n");
820  RegCloseKey(hClassKey);
821  continue;
822  }
823 
824  RegCloseKey(hClassKey);
825 
826  TRACE("Guid: %s\n", debugstr_w(szKeyName));
827  if (dwGuidListIndex < ClassGuidListSize)
828  {
829  if (szKeyName[0] == '{' && szKeyName[37] == '}')
830  {
831  szKeyName[37] = 0;
832  }
833  TRACE("Guid: %p\n", &szKeyName[1]);
834 
835  UuidFromStringW(&szKeyName[1],
836  &ClassGuidList[dwGuidListIndex]);
837  }
838 
839  dwGuidListIndex++;
840  }
841 
842  if (lError != ERROR_SUCCESS)
843  break;
844  }
845 
846  RegCloseKey(hClassesKey);
847 
848  if (RequiredSize != NULL)
849  *RequiredSize = dwGuidListIndex;
850 
851  if (ClassGuidListSize < dwGuidListIndex)
852  {
854  return FALSE;
855  }
856 
857  return TRUE;
858 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define REGSTR_VAL_NOUSECLASS
Definition: regstr.h:238
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TRUE
Definition: numbers.c:17
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
DWORD DWORD
Definition: winlogon.h:75
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:590
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define DIOCR_INSTALLER
Definition: setupapi.h:176
smooth NULL
Definition: ftsmooth.c:464
_In_ DWORD ClassGuidListSize
Definition: setupapi.h:1276
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4101
static DWORD DWORD * dwLength
Definition: fusion.c:70
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
#define DIBCI_NODISPLAYCLASS
Definition: setupapi.h:109
#define ERROR_MORE_DATA
Definition: dderror.h:13
ULONG PVOID Reserved
Definition: ntimage.h:533
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DIBCI_NOINSTALLCLASS
Definition: setupapi.h:108
#define FALSE
Definition: numbers.c:16
#define REGSTR_VAL_NOINSTALLCLASS
Definition: regstr.h:239
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define REGSTR_VAL_NODISPLAYCLASS
Definition: regstr.h:240
HKEY WINAPI SetupDiOpenClassRegKeyExW(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:3730
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2541
static HKEY hClassKey
Definition: umpnpmgr.c:66
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
BOOL WINAPI SetupDiCallClassInstaller ( DI_FUNCTION  InstallFunction,
HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 4092 of file devinst.c.

Referenced by DisableNetworkAdapter(), CDeviceNode::EnableDevice(), EnableDevice(), EnumerateDrivers(), InstallCurrentDriver(), InstallSoftwareBusPnpEnumerator(), StartDevice(), CDeviceNode::UninstallDevice(), UpdateDevInfo(), and UpdateDriverDetailsDlg().

4096 {
4097  BOOL ret = FALSE;
4098 
4099  TRACE("%u %p %p\n", InstallFunction, DeviceInfoSet, DeviceInfoData);
4100 
4101  if (!DeviceInfoSet)
4107  else if (((struct DeviceInfoSet *)DeviceInfoSet)->HKLM != HKEY_LOCAL_MACHINE)
4109  else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4111  else
4112  {
4114 #define CLASS_COINSTALLER 0x1
4115 #define DEVICE_COINSTALLER 0x2
4116 #define CLASS_INSTALLER 0x4
4117  UCHAR CanHandle = 0;
4118  DEFAULT_CLASS_INSTALL_PROC DefaultHandler = NULL;
4119 
4120  switch (InstallFunction)
4121  {
4124  break;
4127  break;
4128  case DIF_ALLOW_INSTALL:
4129  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4130  break;
4131  case DIF_DETECT:
4132  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4133  break;
4135  CanHandle = CLASS_INSTALLER;
4136  break;
4137  case DIF_INSTALLDEVICE:
4139  DefaultHandler = SetupDiInstallDevice;
4140  break;
4142  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4143  DefaultHandler = SetupDiInstallDriverFiles;
4144  break;
4145  case DIF_INSTALLINTERFACES:
4147  DefaultHandler = SetupDiInstallDeviceInterfaces;
4148  break;
4151  break;
4153  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4154  break;
4156  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4157  break;
4159  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4160  break;
4162  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4163  break;
4164  case DIF_POWERMESSAGEWAKE:
4166  break;
4167  case DIF_PROPERTYCHANGE:
4169  DefaultHandler = SetupDiChangeState;
4170  break;
4172  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4173  DefaultHandler = SetupDiRegisterCoDeviceInstallers;
4174  break;
4175  case DIF_REGISTERDEVICE:
4176  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4177  DefaultHandler = IntSetupDiRegisterDeviceInfo;
4178  break;
4179  case DIF_REMOVE:
4181  DefaultHandler = SetupDiRemoveDevice;
4182  break;
4184  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4185  DefaultHandler = SetupDiSelectBestCompatDrv;
4186  break;
4187  case DIF_SELECTDEVICE:
4188  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4189  DefaultHandler = SetupDiSelectDevice;
4190  break;
4191  case DIF_TROUBLESHOOTER:
4193  break;
4194  case DIF_UNREMOVE:
4196  DefaultHandler = SetupDiUnremoveDevice;
4197  break;
4198  default:
4199  ERR("Install function %u not supported\n", InstallFunction);
4201  }
4202 
4203  InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
4204  if (!SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams))
4205  /* Don't process this call, as a parameter is invalid */
4206  CanHandle = 0;
4207 
4208  if (CanHandle != 0)
4209  {
4210  LIST_ENTRY ClassCoInstallersListHead;
4211  LIST_ENTRY DeviceCoInstallersListHead;
4212  HMODULE ClassInstallerLibrary = NULL;
4213  CLASS_INSTALL_PROC ClassInstaller = NULL;
4216  HKEY hKey;
4217  DWORD dwRegType, dwLength;
4218  DWORD rc = NO_ERROR;
4219 
4220  InitializeListHead(&ClassCoInstallersListHead);
4221  InitializeListHead(&DeviceCoInstallersListHead);
4222 
4223  if (CanHandle & DEVICE_COINSTALLER)
4224  {
4226  if (hKey != INVALID_HANDLE_VALUE)
4227  {
4228  rc = RegQueryValueExW(hKey, REGSTR_VAL_COINSTALLERS_32, NULL, &dwRegType, NULL, &dwLength);
4229  if (rc == ERROR_SUCCESS && dwRegType == REG_MULTI_SZ)
4230  {
4231  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4232  if (KeyBuffer != NULL)
4233  {
4234  rc = RegQueryValueExW(hKey, REGSTR_VAL_COINSTALLERS_32, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4235  if (rc == ERROR_SUCCESS)
4236  {
4237  LPWSTR ptr;
4238  for (ptr = KeyBuffer; *ptr; ptr += strlenW(ptr) + 1)
4239  {
4240  /* Add coinstaller to DeviceCoInstallersListHead list */
4241  struct CoInstallerElement *coinstaller;
4242  TRACE("Got device coinstaller '%s'\n", debugstr_w(ptr));
4243  coinstaller = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CoInstallerElement));
4244  if (!coinstaller)
4245  continue;
4246  ZeroMemory(coinstaller, sizeof(struct CoInstallerElement));
4247  if (GetFunctionPointer(ptr, &coinstaller->Module, (PVOID*)&coinstaller->Function) == ERROR_SUCCESS)
4248  InsertTailList(&DeviceCoInstallersListHead, &coinstaller->ListEntry);
4249  else
4250  HeapFree(GetProcessHeap(), 0, coinstaller);
4251  }
4252  }
4253  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4254  }
4255  }
4256  RegCloseKey(hKey);
4257  }
4258  }
4259  if (CanHandle & CLASS_COINSTALLER)
4260  {
4261  rc = RegOpenKeyExW(
4264  0, /* Options */
4266  &hKey);
4267  if (rc == ERROR_SUCCESS)
4268  {
4269  LPWSTR lpGuidString;
4270  if (UuidToStringW((UUID*)&DeviceInfoData->ClassGuid, &lpGuidString) == RPC_S_OK)
4271  {
4272  rc = RegQueryValueExW(hKey, lpGuidString, NULL, &dwRegType, NULL, &dwLength);
4273  if (rc == ERROR_SUCCESS && dwRegType == REG_MULTI_SZ)
4274  {
4275  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4276  if (KeyBuffer != NULL)
4277  {
4278  rc = RegQueryValueExW(hKey, lpGuidString, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4279  if (rc == ERROR_SUCCESS)
4280  {
4281  LPWSTR ptr;
4282  for (ptr = KeyBuffer; *ptr; ptr += strlenW(ptr) + 1)
4283  {
4284  /* Add coinstaller to ClassCoInstallersListHead list */
4285  struct CoInstallerElement *coinstaller;
4286  TRACE("Got class coinstaller '%s'\n", debugstr_w(ptr));
4287  coinstaller = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CoInstallerElement));
4288  if (!coinstaller)
4289  continue;
4290  ZeroMemory(coinstaller, sizeof(struct CoInstallerElement));
4291  if (GetFunctionPointer(ptr, &coinstaller->Module, (PVOID*)&coinstaller->Function) == ERROR_SUCCESS)
4292  InsertTailList(&ClassCoInstallersListHead, &coinstaller->ListEntry);
4293  else
4294  HeapFree(GetProcessHeap(), 0, coinstaller);
4295  }
4296  }
4297  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4298  }
4299  }
4300  RpcStringFreeW(&lpGuidString);
4301  }
4302  RegCloseKey(hKey);
4303  }
4304  }
4305  if ((CanHandle & CLASS_INSTALLER) && !(InstallParams.FlagsEx & DI_FLAGSEX_CI_FAILED))
4306  {
4307  hKey = SetupDiOpenClassRegKey(&DeviceInfoData->ClassGuid, KEY_QUERY_VALUE);
4308  if (hKey != INVALID_HANDLE_VALUE)
4309  {
4310  rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, &dwRegType, NULL, &dwLength);
4311  if (rc == ERROR_SUCCESS && dwRegType == REG_SZ)
4312  {
4313  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4314  if (KeyBuffer != NULL)
4315  {
4316  rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4317  if (rc == ERROR_SUCCESS)
4318  {
4319  /* Get ClassInstaller function pointer */
4320  TRACE("Got class installer '%s'\n", debugstr_w(KeyBuffer));
4321  if (GetFunctionPointer(KeyBuffer, &ClassInstallerLibrary, (PVOID*)&ClassInstaller) != ERROR_SUCCESS)
4322  {
4323  InstallParams.FlagsEx |= DI_FLAGSEX_CI_FAILED;
4324  SetupDiSetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams);
4325  }
4326  }
4327  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4328  }
4329  }
4330  RegCloseKey(hKey);
4331  }
4332  }
4333 
4334  /* Call Class co-installers */
4335  Context.PostProcessing = FALSE;
4336  rc = NO_ERROR;
4337  ListEntry = ClassCoInstallersListHead.Flink;
4338  while (rc == NO_ERROR && ListEntry != &ClassCoInstallersListHead)
4339  {
4340  struct CoInstallerElement *coinstaller;
4341  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4342  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4343  coinstaller->PrivateData = Context.PrivateData;
4345  {
4346  coinstaller->DoPostProcessing = TRUE;
4347  rc = NO_ERROR;
4348  }
4349  ListEntry = ListEntry->Flink;
4350  }
4351 
4352  /* Call Device co-installers */
4353  ListEntry = DeviceCoInstallersListHead.Flink;
4354  while (rc == NO_ERROR && ListEntry != &DeviceCoInstallersListHead)
4355  {
4356  struct CoInstallerElement *coinstaller;
4357  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4358  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4359  coinstaller->PrivateData = Context.PrivateData;
4361  {
4362  coinstaller->DoPostProcessing = TRUE;
4363  rc = NO_ERROR;
4364  }
4365  ListEntry = ListEntry->Flink;
4366  }
4367 
4368  /* Call Class installer */
4369  if (ClassInstaller)
4370  {
4371  rc = (*ClassInstaller)(InstallFunction, DeviceInfoSet, DeviceInfoData);
4372  FreeFunctionPointer(ClassInstallerLibrary, ClassInstaller);
4373  }
4374  else
4375  rc = ERROR_DI_DO_DEFAULT;
4376 
4377  /* Call default handler */
4378  if (rc == ERROR_DI_DO_DEFAULT)
4379  {
4380  if (DefaultHandler && !(InstallParams.Flags & DI_NODI_DEFAULTACTION))
4381  {
4382  if ((*DefaultHandler)(DeviceInfoSet, DeviceInfoData))
4383  rc = NO_ERROR;
4384  else
4385  rc = GetLastError();
4386  }
4387  else
4388  rc = NO_ERROR;
4389  }
4390 
4391  /* Call Class co-installers that required postprocessing */
4392  Context.PostProcessing = TRUE;
4393  ListEntry = ClassCoInstallersListHead.Flink;
4394  while (ListEntry != &ClassCoInstallersListHead)
4395  {
4396  struct CoInstallerElement *coinstaller;
4397  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4398  if (coinstaller->DoPostProcessing)
4399  {
4400  Context.InstallResult = rc;
4401  Context.PrivateData = coinstaller->PrivateData;
4402  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4403  }
4404  FreeFunctionPointer(coinstaller->Module, coinstaller->Function);
4405  ListEntry = ListEntry->Flink;
4406  }
4407 
4408  /* Call Device co-installers that required postprocessing */
4409  ListEntry = DeviceCoInstallersListHead.Flink;
4410  while (ListEntry != &DeviceCoInstallersListHead)
4411  {
4412  struct CoInstallerElement *coinstaller;
4413  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4414  if (coinstaller->DoPostProcessing)
4415  {
4416  Context.InstallResult = rc;
4417  Context.PrivateData = coinstaller->PrivateData;
4418  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4419  }
4420  FreeFunctionPointer(coinstaller->Module, coinstaller->Function);
4421  ListEntry = ListEntry->Flink;
4422  }
4423 
4424  /* Free allocated memory */
4425  while (!IsListEmpty(&ClassCoInstallersListHead))
4426  {
4427  ListEntry = RemoveHeadList(&ClassCoInstallersListHead);
4428  HeapFree(GetProcessHeap(), 0, CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry));
4429  }
4430  while (!IsListEmpty(&DeviceCoInstallersListHead))
4431  {
4432  ListEntry = RemoveHeadList(&DeviceCoInstallersListHead);
4433  HeapFree(GetProcessHeap(), 0, CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry));
4434  }
4435 
4436  ret = (rc == NO_ERROR);
4437  }
4438  }
4439 
4440  TRACE("Returning %d\n", ret);
4441  return ret;
4442 }
DWORD *typedef PVOID
Definition: winlogon.h:52
#define DIF_SELECTDEVICE
Definition: setupapi.h:120
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetupDiSelectBestCompatDrv(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: driver.c:2060
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:152
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4627
#define DIF_ADDREMOTEPROPERTYPAGE_ADVANCED
Definition: setupapi.h:159
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define TRUE
Definition: numbers.c:17
u32_t magic(void)
HMODULE Module
Definition: devinst.c:61
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1041
#define ZeroMemory
Definition: winbase.h:1594
BOOL WINAPI SetupDiUnremoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:78
#define REGSTR_PATH_CODEVICEINSTALLERS
Definition: regstr.h:480
#define DIF_NEWDEVICEWIZARD_PREANALYZE
Definition: setupapi.h:147
LIST_ENTRY ListEntry
Definition: devinst.c:59
SP_DEVINSTALL_PARAMS_W InstallParams
#define DIF_PROPERTYCHANGE
Definition: setupapi.h:137
#define InsertTailList(ListHead, Entry)
#define NO_ERROR
Definition: dderror.h:5
#define DIF_UNREMOVE
Definition: setupapi.h:141
#define DIF_NEWDEVICEWIZARD_POSTANALYZE
Definition: setupapi.h:148
#define DIF_DESTROYPRIVATEDATA
Definition: setupapi.h:131
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define SETUP_DEVICE_INFO_SET_MAGIC
DWORD DWORD
Definition: winlogon.h:75
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
COINSTALLER_PROC Function
Definition: devinst.c:62
BOOL DoPostProcessing
Definition: devinst.c:63
#define DIF_REGISTERDEVICE
Definition: setupapi.h:144
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define debugstr_w
Definition: kernel32.h:32
#define REGSTR_VAL_INSTALLER_32
Definition: regstr.h:487
BOOL WINAPI SetupDiInstallDevice(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5396
static PVOID ptr
Definition: dispmode.c:40
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4520
static BOOL WINAPI IntSetupDiRegisterDeviceInfo(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4082
#define DIF_REGISTER_COINSTALLERS
Definition: setupapi.h:153
smooth NULL
Definition: ftsmooth.c:464
#define DIF_ADDPROPERTYPAGE_ADVANCED
Definition: setupapi.h:154
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
#define DIF_NEWDEVICEWIZARD_FINISHINSTALL
Definition: setupapi.h:149
#define DIF_NEWDEVICEWIZARD_SELECT
Definition: setupapi.h:146
PVOID PrivateData
Definition: devinst.c:64
static const WCHAR HKLM[]
Definition: reginf.c:54
#define DIF_INSTALLDEVICE
Definition: setupapi.h:121
IN HDEVINFO IN PSP_DEVINFO_DATA DeviceInfoData IN OUT PCOINSTALLER_CONTEXT_DATA Context
Definition: devinst.c:53
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DI_NODI_DEFAULTACTION
Definition: setupapi.h:67
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4101
static DWORD DWORD * dwLength
Definition: fusion.c:70
HANDLE HKEY
Definition: registry.h:24
DWORD FreeFunctionPointer(IN HMODULE ModulePointer, IN PVOID FunctionPointer)
Definition: misc.c:105
DWORD GetFunctionPointer(IN PWSTR InstallerName, OUT HMODULE *ModulePointer, OUT PVOID *FunctionPointer)
Definition: misc.c:44
PVOID HDEVINFO
Definition: setupapi.h:664
#define DIF_TROUBLESHOOTER
Definition: setupapi.h:157
#define SetLastError(x)
Definition: compat.h:409
BOOL WINAPI SetupDiRegisterCoDeviceInstallers(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5250
RPC_STATUS WINAPI UuidToStringW(UUID *Uuid, RPC_WSTR *StringUuid)
Definition: rpcrt4_main.c:516
IN HDEVINFO DeviceInfoSet
Definition: devinst.c:44
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
#define DIF_POWERMESSAGEWAKE
Definition: setupapi.h:158
BOOL WINAPI SetupDiChangeState(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5124
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5783
Definition: typedefs.h:118
#define ERR(fmt,...)
Definition: debug.h:109
#define DIF_INSTALLINTERFACES
Definition: setupapi.h:151
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
BOOL WINAPI SetupDiSelectDevice(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: devinst.c:5236
BOOL WINAPI SetupDiRemoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:64
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
BOOL WINAPI SetupDiInstallDeviceInterfaces(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: interface.c:414
#define DI_FLAGSEX_CI_FAILED
Definition: setupapi.h:79
HANDLE HMODULE
Definition: typedefs.h:76
#define DEVICE_COINSTALLER
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
LIST_ENTRY ListEntry
#define ERROR_DI_DO_DEFAULT
Definition: setupapi.h:305
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define CLASS_INSTALLER
#define DIF_ALLOW_INSTALL
Definition: setupapi.h:143
#define DIF_REMOVE
Definition: setupapi.h:124
#define FALSE
Definition: numbers.c:16
#define DIREG_DRV
Definition: setupapi.h:182
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define DIF_NEWDEVICEWIZARD_PRESELECT
Definition: setupapi.h:145
#define DIF_SELECTBESTCOMPATDRV
Definition: setupapi.h:142
IN OUT PSP_DEVINFO_DATA DeviceInfoData
Definition: devinst.c:49
#define DIF_DETECT
Definition: setupapi.h:134
#define ERROR_DI_POSTPROCESSING_REQUIRED
Definition: setupapi.h:329
BOOL WINAPI SetupDiInstallDriverFiles(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: driver.c:2096
#define DIF_INSTALLDEVICEFILES
Definition: setupapi.h:140
#define REGSTR_VAL_COINSTALLERS_32
Definition: regstr.h:484
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
HKEY WINAPI SetupDiOpenClassRegKey(const GUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:3686
#define RPC_S_OK
Definition: rpcnterr.h:22
#define CLASS_COINSTALLER
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:33
BOOL WINAPI SetupDiChangeState ( IN HDEVINFO  DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 5124 of file devinst.c.

Referenced by CDeviceNode::EnableDevice(), and SetupDiCallClassInstaller().

5127 {
5128  PSP_PROPCHANGE_PARAMS PropChange;
5129  HKEY hKey = INVALID_HANDLE_VALUE;
5130  LPCWSTR RegistryValueName;
5131  DWORD dwConfigFlags, dwLength, dwRegType;
5132  LONG rc;
5133  BOOL ret = FALSE;
5134 
5135  TRACE("%p %p\n", DeviceInfoSet, DeviceInfoData);
5136 
5137  if (!DeviceInfoData)
5138  PropChange = ((struct DeviceInfoSet *)DeviceInfoSet)->ClassInstallParams.PropChangeParams;
5139  else
5140  PropChange = ((struct DeviceInfo *)DeviceInfoData->Reserved)->ClassInstallParams.PropChangeParams;
5141  if (!PropChange)
5142  {
5144  goto cleanup;
5145  }
5146 
5147  if (PropChange->Scope == DICS_FLAG_GLOBAL)
5148  RegistryValueName = REGSTR_VAL_CONFIGFLAGS;
5149  else
5150  RegistryValueName = REGSTR_VAL_CSCONFIGFLAGS;
5151 
5152  switch (PropChange->StateChange)
5153  {
5154  case DICS_ENABLE:
5155  case DICS_DISABLE:
5156  {
5157  /* Enable/disable device in registry */
5160  hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet, DeviceInfoData, PropChange->Scope, PropChange->HwProfile, DIREG_DEV, NULL, NULL);
5161  if (hKey == INVALID_HANDLE_VALUE)
5162  break;
5163  dwLength = sizeof(DWORD);
5164  rc = RegQueryValueExW(
5165  hKey,
5166  RegistryValueName,
5167  NULL,
5168  &dwRegType,
5169  (LPBYTE)&dwConfigFlags, &dwLength);
5170  if (rc == ERROR_FILE_NOT_FOUND)
5171  dwConfigFlags = 0;
5172  else if (rc != ERROR_SUCCESS)
5173  {
5174  SetLastError(rc);
5175  goto cleanup;
5176  }
5177  else if (dwRegType != REG_DWORD || dwLength != sizeof(DWORD))
5178  {
5180  goto cleanup;
5181  }
5182  if (PropChange->StateChange == DICS_ENABLE)
5183  dwConfigFlags &= ~(PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED);
5184  else
5185  dwConfigFlags |= (PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED);
5186  rc = RegSetValueExW(
5187  hKey,
5188  RegistryValueName,
5189  0,
5190  REG_DWORD,
5191  (LPBYTE)&dwConfigFlags, sizeof(DWORD));
5192  if (rc != ERROR_SUCCESS)
5193  {
5194  SetLastError(rc);
5195  goto cleanup;
5196  }
5197 
5198  /* Enable/disable device if needed */
5199  if (PropChange->Scope == DICS_FLAG_GLOBAL
5200  || PropChange->HwProfile == 0
5202  {
5203  if (PropChange->StateChange == DICS_ENABLE)
5205  else
5207  }
5208  else
5209  ret = TRUE;
5210  break;
5211  }
5212  case DICS_PROPCHANGE:
5213  {
5215  break;
5216  }
5217  default:
5218  {
5219  ERR("Unknown StateChange 0x%lx\n", PropChange->StateChange);
5221  }
5222  }
5223 
5224 cleanup:
5225  if (hKey != INVALID_HANDLE_VALUE)
5226  RegCloseKey(hKey);
5227 
5228  TRACE("Returning %d\n", ret);
5229  return ret;
5230 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static const GUID DWORD
Definition: devinst.c:39
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
BOOLEAN ResetDevice(IN LPCWSTR DeviceId)
Definition: devinst.c:19
unsigned char * LPBYTE
Definition: typedefs.h:53
static DWORD SETUPAPI_GetCurrentHwProfile(IN HDEVINFO DeviceInfoSet)
Definition: devinst.c:5042
#define TRUE
Definition: numbers.c:17
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1041
#define REGSTR_VAL_CONFIGFLAGS
Definition: regstr.h:388
#define CSCONFIGFLAG_DISABLED
Definition: regstr.h:401
#define DICS_ENABLE
Definition: setupapi.h:112
#define REGSTR_VAL_CSCONFIGFLAGS
Definition: regstr.h:389
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define DICS_DISABLE
Definition: setupapi.h:114
smooth NULL
Definition: ftsmooth.c:464
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:1405
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4884
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CONFIGFLAG_DISABLED
Definition: regstr.h:390
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4101
static DWORD DWORD * dwLength
Definition: fusion.c:70
HANDLE HKEY
Definition: registry.h:24
#define DIREG_DEV
Definition: setupapi.h:181
#define SetLastError(x)
Definition: compat.h:409
int ret
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5783
#define REG_DWORD
Definition: nt_native.h:1497
#define ERR(fmt,...)
Definition: debug.h:109
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
#define DICS_PROPCHANGE
Definition: setupapi.h:116
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define FALSE
Definition: numbers.c:16
char * cleanup(char *str)
Definition: wpickclick.c:99
IN OUT PSP_DEVINFO_DATA DeviceInfoData
Definition: devinst.c:49
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
static BOOL StopDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5112
BOOL WINAPI SetupDiClassGuidsFromNameA ( LPCSTR  ClassName,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize 
)

Definition at line 863 of file devinst.c.

Referenced by test_SetupDiClassGuidsFromNameA().

868 {
869  return SetupDiClassGuidsFromNameExA(ClassName, ClassGuidList,
871  NULL, NULL);
872 }
smooth NULL
Definition: ftsmooth.c:464
_In_ DWORD ClassGuidListSize
Definition: setupapi.h:1276
BOOL WINAPI SetupDiClassGuidsFromNameExA(LPCSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCSTR MachineName, PVOID Reserved)
Definition: devinst.c:891
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
BOOL WINAPI SetupDiClassGuidsFromNameExA ( LPCSTR  ClassName,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize,
LPCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 891 of file devinst.c.

Referenced by SetupDiClassGuidsFromNameA().

898 {
899  LPWSTR ClassNameW = NULL;
900  LPWSTR MachineNameW = NULL;
901  BOOL bResult;
902 
903  TRACE("%s %p %lu %p %s %p\n", debugstr_a(ClassName), ClassGuidList,
905 
906  if (!ClassName)
907  {
909  return FALSE;
910  }
911 
912  ClassNameW = pSetupMultiByteToUnicode(ClassName, CP_ACP);
913  if (ClassNameW == NULL)
914  return FALSE;
915 
916  if (MachineName)
917  {
919  if (MachineNameW == NULL)
920  {
921  MyFree(ClassNameW);
922  return FALSE;
923  }
924  }
925 
926  bResult = SetupDiClassGuidsFromNameExW(ClassNameW, ClassGuidList,
928  MachineNameW, Reserved);
929 
930  MyFree(MachineNameW);
931  MyFree(ClassNameW);
932 
933  return bResult;
934 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define CP_ACP
Definition: compat.h:99
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:464
_In_ DWORD ClassGuidListSize
Definition: setupapi.h:1276
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
ULONG PVOID Reserved
Definition: ntimage.h:533
#define FALSE
Definition: numbers.c:16
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
BOOL WINAPI SetupDiClassGuidsFromNameExW(LPCWSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:939
BOOL WINAPI SetupDiClassGuidsFromNameExW ( LPCWSTR  ClassName,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize,
LPCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 939 of file devinst.c.

Referenced by SetupDiClassGuidsFromNameExA(), and SetupDiClassGuidsFromNameW().

946 {
947  WCHAR szKeyName[40];
949  HKEY hClassesKey;
950  HKEY hClassKey;
951  DWORD dwLength;
952  DWORD dwIndex;
953  LONG lError;
954  DWORD dwGuidListIndex = 0;
955 
956  TRACE("%s %p %lu %p %s %p\n", debugstr_w(ClassName), ClassGuidList,
958 
959  if (!ClassName || !RequiredSize)
960  {
962  return FALSE;
963  }
964  if (!ClassGuidList && ClassGuidListSize > 0)
965  {
967  return FALSE;
968  }
969  *RequiredSize = 0;
970 
971  hClassesKey = SetupDiOpenClassRegKeyExW(NULL,
974  MachineName,
975  Reserved);
976  if (hClassesKey == INVALID_HANDLE_VALUE)
977  {
978  return FALSE;
979  }
980 
981  for (dwIndex = 0; ; dwIndex++)
982  {
983  dwLength = 40;
984  lError = RegEnumKeyExW(hClassesKey,
985  dwIndex,
986  szKeyName,
987  &dwLength,
988  NULL,
989  NULL,
990  NULL,
991  NULL);
992  TRACE("RegEnumKeyExW() returns %d\n", lError);
993  if (lError == ERROR_SUCCESS || lError == ERROR_MORE_DATA)
994  {
995  TRACE("Key name: %p\n", szKeyName);
996 
997  if (RegOpenKeyExW(hClassesKey,
998  szKeyName,
999  0,
1001  &hClassKey))
1002  {
1003  RegCloseKey(hClassesKey);
1004  return FALSE;
1005  }
1006 
1007  dwLength = MAX_CLASS_NAME_LEN * sizeof(WCHAR);
1008  if (!RegQueryValueExW(hClassKey,
1010  NULL,
1011  NULL,
1012  (LPBYTE)szClassName,
1013  &dwLength))
1014  {
1015  TRACE("Class name: %p\n", szClassName);
1016 
1017  if (strcmpiW(szClassName, ClassName) == 0)
1018  {
1019  TRACE("Found matching class name\n");
1020 
1021  TRACE("Guid: %p\n", szKeyName);
1022  if (dwGuidListIndex < ClassGuidListSize)
1023  {
1024  if (szKeyName[0] == '{' && szKeyName[37] == '}')
1025  {
1026  szKeyName[37] = 0;
1027  }
1028  TRACE("Guid: %p\n", &szKeyName[1]);
1029 
1030  UuidFromStringW(&szKeyName[1],
1031  &ClassGuidList[dwGuidListIndex]);
1032  }
1033 
1034  dwGuidListIndex++;
1035  }
1036  }
1037 
1038  RegCloseKey(hClassKey);
1039  }
1040 
1041  if (lError != ERROR_SUCCESS)
1042  break;
1043  }
1044 
1045  RegCloseKey(hClassesKey);
1046 
1047  if (RequiredSize != NULL)
1048  *RequiredSize = dwGuidListIndex;
1049 
1050  if (ClassGuidListSize < dwGuidListIndex)
1051  {
1053  return FALSE;
1054  }
1055 
1056  return TRUE;
1057 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define REGSTR_VAL_CLASS
Definition: regstr.h:291
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:53
#define TRUE
Definition: numbers.c:17
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
#define WCHAR
Definition: msvc.h:43
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:590
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define DIOCR_INSTALLER
Definition: setupapi.h:176
smooth NULL
Definition: ftsmooth.c:464
_In_ DWORD ClassGuidListSize
Definition: setupapi.h:1276
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR szClassName[]
Definition: clipbrd.c:11
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4101
static DWORD DWORD * dwLength
Definition: fusion.c:70
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_MORE_DATA
Definition: dderror.h:13
ULONG PVOID Reserved
Definition: ntimage.h:533
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define FALSE
Definition: numbers.c:16
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
HKEY WINAPI SetupDiOpenClassRegKeyExW(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:3730
#define MAX_CLASS_NAME_LEN
Definition: cfgmgr32.h:52
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2541
static HKEY hClassKey
Definition: umpnpmgr.c:66
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
BOOL WINAPI SetupDiClassGuidsFromNameW ( LPCWSTR  ClassName,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize 
)

Definition at line 877 of file devinst.c.

882 {
883  return SetupDiClassGuidsFromNameExW(ClassName, ClassGuidList,
885  NULL, NULL);
886 }
smooth NULL
Definition: ftsmooth.c:464
_In_ DWORD ClassGuidListSize
Definition: setupapi.h:1276
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
BOOL WINAPI SetupDiClassGuidsFromNameExW(LPCWSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:939
BOOL WINAPI SetupDiClassNameFromGuidA ( const GUID ClassGuid,
PSTR  ClassName,
DWORD  ClassNameSize,
PDWORD  RequiredSize 
)

Definition at line 1062 of file devinst.c.

Referenced by test_SetupDiBuildClassInfoList(), and test_SetupDiClassNameFromGuidA().

1067 {
1068  return SetupDiClassNameFromGuidExA(ClassGuid, ClassName,
1069  ClassNameSize, RequiredSize,
1070  NULL, NULL);
1071 }
smooth NULL
Definition: ftsmooth.c:464
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
BOOL WINAPI SetupDiClassNameFromGuidExA(const GUID *ClassGuid, PSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved)
Definition: devinst.c:1090
BOOL WINAPI SetupDiClassNameFromGuidExA ( const GUID ClassGuid,
PSTR  ClassName,
DWORD  ClassNameSize,
PDWORD  RequiredSize,
PCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 1090 of file devinst.c.

Referenced by SetupDiClassNameFromGuidA().

1097 {
1098  WCHAR ClassNameW[MAX_CLASS_NAME_LEN];
1099  LPWSTR MachineNameW = NULL;
1100  BOOL ret;
1101 
1102  if (MachineName)
1103  MachineNameW = pSetupMultiByteToUnicode(MachineName, CP_ACP);
1104  ret = SetupDiClassNameFromGuidExW(ClassGuid, ClassNameW, MAX_CLASS_NAME_LEN,
1105  RequiredSize, MachineNameW, Reserved);
1106  if (ret)
1107  {
1108  int len = WideCharToMultiByte(CP_ACP, 0, ClassNameW, -1, ClassName,
1109  ClassNameSize, NULL, NULL);
1110  if (len == 0 || len > ClassNameSize)
1111  {
1113  ret = FALSE;
1114  }
1115  }
1116  MyFree(MachineNameW);
1117  return ret;
1118 }
#define WideCharToMultiByte
Definition: compat.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
BOOL WINAPI SetupDiClassNameFromGuidExW(const GUID *ClassGuid, PWSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1123
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:464
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SetLastError(x)
Definition: compat.h:409
int ret
GLenum GLsizei len
Definition: glext.h:6722
ULONG PVOID Reserved
Definition: ntimage.h:533
#define FALSE
Definition: numbers.c:16
#define MAX_CLASS_NAME_LEN
Definition: cfgmgr32.h:52
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
BOOL WINAPI SetupDiClassNameFromGuidExW ( const GUID ClassGuid,
PWSTR  ClassName,
DWORD  ClassNameSize,
PDWORD  RequiredSize,
PCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 1123 of file devinst.c.

Referenced by SetupDiClassNameFromGuidExA(), and SetupDiClassNameFromGuidW().

1130 {
1131  HKEY hKey;
1132  DWORD dwLength;
1133  DWORD dwRegType;
1134  LONG rc;
1135  PWSTR Buffer;
1136 
1137  TRACE("%s %p %lu %p %s %p\n", debugstr_guid(ClassGuid), ClassName,
1138  ClassNameSize, RequiredSize, debugstr_w(MachineName), Reserved);
1139 
1140  /* Make sure there's a GUID */
1141  if (ClassGuid == NULL)
1142  {
1143  SetLastError(ERROR_INVALID_CLASS); /* On Vista: ERROR_INVALID_USER_BUFFER */
1144  return FALSE;
1145  }
1146 
1147  /* Make sure there's a real buffer when there's a size */
1148  if ((ClassNameSize > 0) && (ClassName == NULL))
1149  {
1150  SetLastError(ERROR_INVALID_PARAMETER); /* On Vista: ERROR_INVALID_USER_BUFFER */
1151  return FALSE;
1152  }
1153 
1154  /* Open the key for the GUID */
1156 
1157  if (hKey == INVALID_HANDLE_VALUE)
1158  return FALSE;
1159 
1160  /* Retrieve the class name data and close the key */
1161  rc = QueryRegistryValue(hKey, REGSTR_VAL_CLASS, (LPBYTE *) &Buffer, &dwRegType, &dwLength);
1162  RegCloseKey(hKey);
1163 
1164  /* Make sure we got the data */
1165  if (rc != ERROR_SUCCESS)
1166  {
1167  SetLastError(rc);
1168  return FALSE;
1169  }
1170 
1171  /* Make sure the data is a string */
1172  if (dwRegType != REG_SZ)
1173  {
1174  MyFree(Buffer);
1176  return FALSE;
1177  }
1178 
1179  /* Determine the length of the class name */
1180  dwLength /= sizeof(WCHAR);
1181 
1182  if ((dwLength == 0) || (Buffer[dwLength - 1] != UNICODE_NULL))
1183  /* Count the null-terminator */
1184  dwLength++;
1185 
1186  /* Inform the caller about the class name */
1187  if ((ClassName != NULL) && (dwLength <= ClassNameSize))
1188  {
1189  memcpy(ClassName, Buffer, (dwLength - 1) * sizeof(WCHAR));
1190  ClassName[dwLength - 1] = UNICODE_NULL;
1191  }
1192 
1193  /* Inform the caller about the required size */
1194  if (RequiredSize != NULL)
1196 
1197  /* Clean up the buffer */
1198  MyFree(Buffer);
1199 
1200  /* Make sure the buffer was large enough */
1201  if ((ClassName == NULL) || (dwLength > ClassNameSize))
1202  {
1204  return FALSE;
1205  }
1206 
1207  return TRUE;
1208 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define REGSTR_VAL_CLASS
Definition: regstr.h:291
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:53
#define TRUE
Definition: numbers.c:17
PVOID *typedef PWSTR
Definition: winlogon.h:57
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
#define WCHAR
Definition: msvc.h:43
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define UNICODE_NULL
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define DIOCR_INSTALLER
Definition: setupapi.h:176
smooth NULL
Definition: ftsmooth.c:464
#define debugstr_guid
Definition: kernel32.h:35
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
PVOID QueryRegistryValue(HANDLE RegHandle, PWCHAR ValueName, LPDWORD RegistryType, LPDWORD Length)
Definition: registry.c:67
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD DWORD * dwLength
Definition: fusion.c:70
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
UINTN VOID * Buffer
Definition: acefiex.h:370
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG PVOID Reserved
Definition: ntimage.h:533
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define ERROR_INVALID_CLASS
Definition: setupapi.h:297
#define FALSE
Definition: numbers.c:16
HKEY WINAPI SetupDiOpenClassRegKeyExW(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:3730
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:33
BOOL WINAPI SetupDiClassNameFromGuidW ( const GUID ClassGuid,
PWSTR  ClassName,
DWORD  ClassNameSize,
PDWORD  RequiredSize 
)

Definition at line 1076 of file devinst.c.

Referenced by PARSER_GetInfClassW(), and CClassNode::SetupNode().

1081 {
1082  return SetupDiClassNameFromGuidExW(ClassGuid, ClassName,
1083  ClassNameSize, RequiredSize,
1084  NULL, NULL);
1085 }
BOOL WINAPI SetupDiClassNameFromGuidExW(const GUID *ClassGuid, PWSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1123
smooth NULL
Definition: ftsmooth.c:464
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
BOOL WINAPI SetupDiCreateDeviceInfoA ( HDEVINFO  DeviceInfoSet,
PCSTR  DeviceName,
CONST GUID ClassGuid,
PCSTR  DeviceDescription,
HWND  hwndParent,
DWORD  CreationFlags,
PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 1670 of file devinst.c.

1678 {
1679  BOOL ret;
1680  LPWSTR DeviceNameW = NULL;
1681  LPWSTR DeviceDescriptionW = NULL;
1682 
1683  TRACE("\n");
1684 
1685  if (DeviceName)
1686  {
1687  DeviceNameW = pSetupMultiByteToUnicode(DeviceName, CP_ACP);
1688  if (DeviceNameW == NULL) return FALSE;
1689  }
1690  if (DeviceDescription)
1691  {
1692  DeviceDescriptionW = pSetupMultiByteToUnicode(DeviceDescription, CP_ACP);
1693  if (DeviceDescriptionW == NULL)
1694  {
1695  MyFree(DeviceNameW);
1696  return FALSE;
1697  }
1698  }
1699 
1700  ret = SetupDiCreateDeviceInfoW(DeviceInfoSet, DeviceNameW, ClassGuid, DeviceDescriptionW,
1701  hwndParent, CreationFlags, DeviceInfoData);
1702 
1703  MyFree(DeviceNameW);
1704  MyFree(DeviceDescriptionW);
1705 
1706  return ret;
1707 }
#define CP_ACP
Definition: compat.h:99
WCHAR DeviceName[]
Definition: adapter.cpp:21
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:464
static HWND hwndParent
Definition: cryptui.c:300
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
#define FALSE
Definition: numbers.c:16
BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO DeviceInfoSet, PCWSTR DeviceName, CONST GUID *ClassGuid, PCWSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1712
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
HDEVINFO WINAPI SetupDiCreateDeviceInfoList ( const GUID ClassGuid,
HWND  hwndParent 
)

Definition at line 1214 of file devinst.c.

Referenced by InstallSoftwareBusPnpEnumerator(), and SetupDiInstallClassExW().

1216 {
1217  return SetupDiCreateDeviceInfoListExW(ClassGuid, hwndParent, NULL, NULL);
1218 }
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1268
smooth NULL
Definition: ftsmooth.c:464
static HWND hwndParent
Definition: cryptui.c:300
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExA ( const GUID ClassGuid,
HWND  hwndParent,
PCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 1224 of file devinst.c.

1228 {
1229  LPWSTR MachineNameW = NULL;
1230  HDEVINFO hDevInfo;
1231 
1232  TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent,
1234 
1235  if (MachineName)
1236  {
1237  MachineNameW = pSetupMultiByteToUnicode(MachineName, CP_ACP);
1238  if (MachineNameW == NULL)
1239  return INVALID_HANDLE_VALUE;
1240  }
1241 
1242  hDevInfo = SetupDiCreateDeviceInfoListExW(ClassGuid, hwndParent,
1243  MachineNameW, Reserved);
1244 
1245  MyFree(MachineNameW);
1246 
1247  return hDevInfo;
1248 }
#define CP_ACP
Definition: compat.h:99
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1268
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:464
static HWND hwndParent
Definition: cryptui.c:300
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
PVOID HDEVINFO
Definition: setupapi.h:664
ULONG PVOID Reserved
Definition: ntimage.h:533
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW ( const GUID ClassGuid,
HWND  hwndParent,
PCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 1268 of file devinst.c.

Referenced by DevInstallW(), InstallDevInst(), CKsProxy::Load(), SetupDiCreateDeviceInfoList(), SetupDiCreateDeviceInfoListExA(), SetupDiGetClassDevsExW(), and CDeviceNode::SetupNode().

1272 {
1273  struct DeviceInfoSet *list = NULL;
1275  DWORD rc;
1276  CONFIGRET cr;
1278 
1279  TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent,
1281 
1282  if (MachineName != NULL)
1283  {
1285  if (len >= SP_MAX_MACHINENAME_LENGTH - 4)
1286  {
1288  goto cleanup;
1289  }
1290  if(len > 0)
1291  size += (len + 3) * sizeof(WCHAR);
1292  else
1293  MachineName = NULL;
1294  }
1295 
1296  if (Reserved != NULL)
1297  {
1299  return INVALID_HANDLE_VALUE;
1300  }
1301 
1302  list = MyMalloc(size);
1303  if (!list)
1304  {
1306  return INVALID_HANDLE_VALUE;
1307  }
1308  ZeroMemory(list, FIELD_OFFSET(struct DeviceInfoSet, szData));
1309 
1311  memcpy(&list->ClassGuid,
1312  ClassGuid ? ClassGuid : &GUID_NULL,
1313  sizeof(list->ClassGuid));
1317  if (MachineName)
1318  {
1320  if (rc != ERROR_SUCCESS)
1321  {
1323  goto cleanup;
1324  }
1325 
1326  list->szData[0] = list->szData[1] = '\\';
1327  strcpyW(list->szData + 2, MachineName);
1328  list->MachineName = list->szData;
1329  }
1330  else
1331  {
1332  list->HKLM = HKEY_LOCAL_MACHINE;
1333  list->MachineName = NULL;
1334  }
1335  cr = CM_Connect_MachineW(list->MachineName, &list->hMachine);
1336  if (cr != CR_SUCCESS)
1337  {
1339  goto cleanup;
1340  }
1342  InitializeListHead(&list->ListHead);
1343 
1344  return (HDEVINFO)list;
1345 
1346 cleanup:
1347  if (ret == INVALID_HANDLE_VALUE)
1348  {
1349  if (list)
1350  {
1351  if (list->HKLM != NULL && list->HKLM != HKEY_LOCAL_MACHINE)
1352  RegCloseKey(list->HKLM);
1353  MyFree(list);
1354  }
1355  }
1356  return ret;
1357 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define SP_MAX_MACHINENAME_LENGTH
Definition: setupapi.h:27
CONFIGRET WINAPI CM_Connect_MachineW(PCWSTR UNCServerName, PHMACHINE phMachine)
Definition: cfgmgr.c:718
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
LIST_ENTRY ListHead
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR szData[]
Definition: msipriv.h:1212
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
#define ZeroMemory
Definition: winbase.h:1594
SP_DEVINSTALL_PARAMS_W InstallParams
#define SETUP_DEVICE_INFO_SET_MAGIC
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static DWORD GetErrorCodeFromCrCode(const IN CONFIGRET cr)
Definition: devinst.c:92
#define debugstr_w
Definition: kernel32.h:32
#define CR_SUCCESS
Definition: cfgmgr32.h:842
LONG WINAPI RegConnectRegistryW(LPCWSTR lpMachineName, HKEY hKey, PHKEY phkResult)
Definition: reg.c:872
smooth NULL
Definition: ftsmooth.c:464
static HWND hwndParent
Definition: cryptui.c:300
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LIST_ENTRY DriverListHead
PVOID HDEVINFO
Definition: setupapi.h:664
#define SetLastError(x)
Definition: compat.h:409
#define DI_CLASSINSTALLPARAMS
Definition: setupapi.h:66
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GUID_NULL
Definition: ks.h:106
Definition: _list.h:228
GLenum GLsizei len
Definition: glext.h:6722
ULONG PVOID Reserved
Definition: ntimage.h:533
ULONG_PTR SIZE_T
Definition: typedefs.h:79
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
GLsizeiptr size
Definition: glext.h:5919
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
WCHAR szData[ANYSIZE_ARRAY]
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
#define ERROR_INVALID_MACHINENAME
Definition: setupapi.h:323
char * cleanup(char *str)
Definition: wpickclick.c:99
#define list
Definition: rosglue.h:35
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
BOOL WINAPI SetupDiCreateDeviceInfoW ( HDEVINFO  DeviceInfoSet,
PCWSTR  DeviceName,
CONST GUID ClassGuid,
PCWSTR  DeviceDescription,
HWND  hwndParent,
DWORD  CreationFlags,
PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 1712 of file devinst.c.

Referenced by SetupDiCreateDeviceInfoA().

1720 {
1721  struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
1722  struct DeviceInfo *deviceInfo = NULL;
1723  BOOL ret = FALSE;
1724  CONFIGRET cr;
1725  DEVINST RootDevInst;
1726  DEVINST DevInst;
1727  WCHAR GenInstanceId[MAX_DEVICE_ID_LEN];
1728 
1729  TRACE("%p %s %s %s %p %x %p\n", DeviceInfoSet, debugstr_w(DeviceName),
1731  hwndParent, CreationFlags, DeviceInfoData);
1732 
1733  if (!DeviceName)
1734  {
1736  return FALSE;
1737  }
1739  {
1741  return FALSE;
1742  }
1743  if (!ClassGuid)
1744  {
1746  return FALSE;
1747  }
1748  if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
1749  {
1751  return FALSE;
1752  }
1753  if (!IsEqualGUID(&set->ClassGuid, &GUID_NULL) &&
1754  !IsEqualGUID(ClassGuid, &set->ClassGuid))
1755  {
1757  return FALSE;
1758  }
1760  {
1761  TRACE("Unknown flags: 0x%08lx\n", CreationFlags & ~(DICD_GENERATE_ID | DICD_INHERIT_CLASSDRVS));
1763  return FALSE;
1764  }
1765 
1766  /* Get the root device instance */
1767  cr = CM_Locate_DevInst_ExW(&RootDevInst,
1768  NULL,
1770  set->hMachine);
1771  if (cr != CR_SUCCESS)
1772  {
1774  return FALSE;
1775  }
1776 
1777  /* Create the new device instance */
1778  cr = CM_Create_DevInst_ExW(&DevInst,
1780  RootDevInst,
1783  set->hMachine);
1784  if (cr != CR_SUCCESS)
1785  {
1787  return FALSE;
1788  }
1789 
1791  {
1792  /* Grab the actual instance ID that was created */
1793  cr = CM_Get_Device_ID_Ex(DevInst,
1794  GenInstanceId,
1796  0,
1797  set->hMachine);
1798  if (cr != CR_SUCCESS)
1799  {
1801  return FALSE;
1802  }
1803 
1804  DeviceName = GenInstanceId;
1805  TRACE("Using generated instance ID: %s\n", debugstr_w(DeviceName));
1806  }
1807 
1808  if (CreateDeviceInfo(set, DeviceName, ClassGuid, &deviceInfo))
1809  {
1810  InsertTailList(&set->ListHead, &deviceInfo->ListEntry);
1811 
1812  if (!DeviceInfoData)
1813  ret = TRUE;
1814  else
1815  {
1816  if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
1817  {
1819  }
1820  else
1821  {
1822  memcpy(&DeviceInfoData->ClassGuid, ClassGuid, sizeof(GUID));
1823  DeviceInfoData->DevInst = deviceInfo->dnDevInst;
1824  DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
1825  ret = TRUE;
1826  }
1827  }
1828  }
1829 
1830  if (ret == FALSE)
1831  {
1832  if (deviceInfo != NULL)
1833  {
1834  /* Remove deviceInfo from List */
1835  RemoveEntryList(&deviceInfo->ListEntry);
1836 
1837  /* Destroy deviceInfo */
1838  DestroyDeviceInfo(deviceInfo);
1839  }
1840  }
1841 
1842  TRACE("Returning %d\n", ret);
1843  return ret;
1844 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define DICD_INHERIT_CLASSDRVS
Definition: setupapi.h:111
LIST_ENTRY ListHead
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CM_Locate_DevInst_ExW
Definition: cfgmgr32.h:2395
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define TRUE
Definition: numbers.c:17
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DEVINSTID_A DEVINSTID
Definition: cfgmgr32.h:87
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define InsertTailList(ListHead, Entry)
#define SETUP_DEVICE_INFO_SET_MAGIC
BOOL CreateDeviceInfo(IN struct DeviceInfoSet *list, IN LPCWSTR InstancePath, IN LPCGUID pClassGuid, OUT struct DeviceInfo **pDeviceInfo)
Definition: devinst.c:526
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
static DWORD GetErrorCodeFromCrCode(const IN CONFIGRET cr)
Definition: devinst.c:92
#define debugstr_w
Definition: kernel32.h:32
#define ERROR_CLASS_MISMATCH
Definition: setupapi.h:292
#define CM_Get_Device_ID_Ex
Definition: cfgmgr32.h:1566
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:464
static HWND hwndParent
Definition: cryptui.c:300
#define debugstr_guid
Definition: kernel32.h:35
ULONG_PTR Reserved
Definition: setupapi.h:833
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CM_Create_DevInst_ExW
Definition: cfgmgr32.h:1117
#define SetLastError(x)
Definition: compat.h:409
int ret
static BOOL DestroyDeviceInfo(struct DeviceInfo *deviceInfo)
Definition: devinst.c:579
DEVINST dnDevInst
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GUID_NULL
Definition: ks.h:106
#define ERROR_INVALID_DATA
Definition: winerror.h:116
DWORD DEVINST
Definition: cfgmgr32.h:76
#define MAX_DEVICE_ID_LEN
Definition: cfgmgr32.h:49
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3944
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
LIST_ENTRY ListEntry
#define FALSE
Definition: numbers.c:16
#define ULONG_PTR
Definition: config.h:101
#define ERROR_INVALID_DEVINST_NAME
Definition: setupapi.h:296
#define CM_CREATE_DEVINST_GENERATE_ID
Definition: cfgmgr32.h:629
Definition: _set.h:46
#define CM_LOCATE_DEVINST_NORMAL
Definition: cfgmgr32.h:766
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define DICD_GENERATE_ID
Definition: setupapi.h:110
BOOL WINAPI SetupDiCreateDeviceInterfaceA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
const GUID InterfaceClassGuid,
PCSTR  ReferenceString,
DWORD  CreationFlags,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData 
)

Definition at line 2639 of file devinst.c.

2646 {
2647  BOOL ret;
2648  LPWSTR ReferenceStringW = NULL;
2649 
2650  TRACE("%p %p %s %s %08x %p\n", DeviceInfoSet, DeviceInfoData,
2651  debugstr_guid(InterfaceClassGuid), debugstr_a(ReferenceString),
2652  CreationFlags, DeviceInterfaceData);
2653 
2654  if (ReferenceString)
2655  {
2656  ReferenceStringW = pSetupMultiByteToUnicode(ReferenceString, CP_ACP);
2657  if (ReferenceStringW == NULL) return FALSE;
2658  }
2659 
2660  ret = SetupDiCreateDeviceInterfaceW(DeviceInfoSet, DeviceInfoData,
2661  InterfaceClassGuid, ReferenceStringW, CreationFlags,
2662  DeviceInterfaceData);
2663 
2664  MyFree(ReferenceStringW);
2665 
2666  return ret;
2667 }
BOOL WINAPI SetupDiCreateDeviceInterfaceW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const GUID *InterfaceClassGuid, PCWSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2672
#define CP_ACP
Definition: compat.h:99
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
_In_ CONST GUID _In_opt_ PUNICODE_STRING ReferenceString
Definition: iofuncs.h:1134
smooth NULL
Definition: ftsmooth.c:464
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_a
Definition: kernel32.h:31
int ret
#define FALSE
Definition: numbers.c:16
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyA ( HDEVINFO  DeviceInfoSet,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData,
DWORD  Reserved,
REGSAM  samDesired,
HINF  InfHandle,
PCSTR  InfSectionName 
)

Definition at line 2717 of file devinst.c.

2724 {
2725  HKEY key;
2726  PWSTR InfSectionNameW = NULL;
2727 
2728  TRACE("%p %p %d %08x %p %p\n", DeviceInfoSet, DeviceInterfaceData, Reserved,
2729  samDesired, InfHandle, InfSectionName);
2730  if (InfHandle)
2731  {
2732  if (!InfSectionName)
2733  {
2735  return INVALID_HANDLE_VALUE;
2736  }
2737  InfSectionNameW = pSetupMultiByteToUnicode(InfSectionName, CP_ACP);
2738  if (!InfSectionNameW)
2739  return INVALID_HANDLE_VALUE;
2740  }
2742  DeviceInterfaceData, Reserved, samDesired, InfHandle,
2743  InfSectionNameW);
2744  MyFree(InfSectionNameW);
2745  return key;
2746 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define CP_ACP
Definition: compat.h:99
PVOID *typedef PWSTR
Definition: winlogon.h:57
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved, REGSAM samDesired, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:2751