ReactOS  0.4.10-dev-348-gbcec1fd
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 IntSetupDiSetDeviceRegistryPropertyAW (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize, BOOL isAnsi)
 
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 4589 of file devinst.c.

Referenced by SetupDiSetDeviceInstallParamsW().

4591 {
4592  DWORD SupportedFlags =
4593  DI_NOVCP | /* 0x00000008 */
4594  DI_DIDCOMPAT | /* 0x00000010 */
4595  DI_DIDCLASS | /* 0x00000020 */
4596  DI_NEEDRESTART | /* 0x00000080 */
4597  DI_NEEDREBOOT | /* 0x00000100 */
4598  DI_RESOURCEPAGE_ADDED | /* 0x00002000 */
4599  DI_PROPERTIES_CHANGE | /* 0x00004000 */
4600  DI_ENUMSINGLEINF | /* 0x00010000 */
4601  DI_DONOTCALLCONFIGMG | /* 0x00020000 */
4602  DI_CLASSINSTALLPARAMS | /* 0x00100000 */
4603  DI_NODI_DEFAULTACTION | /* 0x00200000 */
4604  DI_QUIETINSTALL | /* 0x00800000 */
4605  DI_NOFILECOPY | /* 0x01000000 */
4606  DI_DRIVERPAGE_ADDED; /* 0x04000000 */
4607  DWORD SupportedFlagsEx =
4608  DI_FLAGSEX_CI_FAILED | /* 0x00000004 */
4609  DI_FLAGSEX_DIDINFOLIST | /* 0x00000010 */
4610  DI_FLAGSEX_DIDCOMPATINFO | /* 0x00000020 */
4611  DI_FLAGSEX_ALLOWEXCLUDEDDRVS | /* 0x00000800 */
4612  DI_FLAGSEX_NO_DRVREG_MODIFY | /* 0x00008000 */
4613  DI_FLAGSEX_INSTALLEDDRIVER; /* 0x04000000 */
4614  BOOL ret = FALSE;
4615 
4616  /* FIXME: add support for more flags */
4617 
4618  /* FIXME: DI_CLASSINSTALLPARAMS flag is not correctly used.
4619  * It should be checked before accessing to other values
4620  * of the SP_DEVINSTALL_PARAMS structure */
4621 
4622  if (DeviceInstallParams->Flags & ~SupportedFlags)
4623  {
4624  FIXME("Unknown Flags: 0x%08lx\n", DeviceInstallParams->Flags & ~SupportedFlags);
4626  }
4627  else if (DeviceInstallParams->FlagsEx & ~SupportedFlagsEx)
4628  {
4629  FIXME("Unknown FlagsEx: 0x%08lx\n", DeviceInstallParams->FlagsEx & ~SupportedFlagsEx);
4631  }
4632  else if ((DeviceInstallParams->Flags & DI_NOVCP)
4633  && (DeviceInstallParams->FileQueue == NULL || DeviceInstallParams->FileQueue == (HSPFILEQ)INVALID_HANDLE_VALUE))
4635  else
4636  {
4637  /* FIXME: check Reserved field */
4638  ret = TRUE;
4639  }
4640 
4641  return ret;
4642 }
#define TRUE
Definition: types.h:120
#define DI_NEEDREBOOT
Definition: setupapi.h:54
PVOID HSPFILEQ
Definition: filequeue.h:52
#define DI_FLAGSEX_NO_DRVREG_MODIFY
Definition: setupapi.h:91
#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 FALSE
Definition: types.h:117
#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:416
#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 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
#define TRUE
Definition: types.h:120
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
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 FALSE
Definition: types.h:117
#define UNICODE_NULL
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#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
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 }
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
LIST_ENTRY InterfaceListHead
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ZeroMemory
Definition: winbase.h:1635
SP_DEVINSTALL_PARAMS_W InstallParams
DWORD DWORD
Definition: winlogon.h:75
_Null_terminated_ WCHAR * DEVINSTID_W
Definition: cfgmgr32.h:80
#define FALSE
Definition: types.h:117
static DWORD GetErrorCodeFromCrCode(const IN CONFIGRET cr)
Definition: devinst.c:92
CONFIGRET WINAPI CM_Locate_DevNode_ExW(_Out_ PDEVINST pdnDevInst, _In_opt_ DEVINSTID_W pDeviceID, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:5657
#define CR_SUCCESS
Definition: cfgmgr32.h:842
smooth NULL
Definition: ftsmooth.c:416
PCWSTR DeviceDescription
WCHAR Data[ANYSIZE_ARRAY]
struct DeviceInfoSet * set
GLsizeiptr size
Definition: glext.h:5919
#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
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#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 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: types.h:120
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
#define FALSE
Definition: types.h:117
BOOL DestroyDeviceInterface(struct DeviceInterface *deviceInterface)
Definition: interface.c:61
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
HMODULE hmodDevicePropPageProvider
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
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:117
LIST_ENTRY ListEntry
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
CONFIGRET WINAPI CM_Disconnect_Machine(_In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:1686
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
#define FALSE
Definition: types.h:117
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
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:117
LIST_ENTRY ListEntry
#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: types.h:120
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 5363 of file devinst.c.

Referenced by SetupDiInstallDevice().

5366 {
5367  PWCHAR last;
5368 
5369  last = strrchrW(FullName, '\\');
5370  if (!last)
5371  {
5372  /* No directory specified */
5373  *IsOEMLocation = FALSE;
5374  }
5375  else
5376  {
5377  LPWSTR Windir;
5378  UINT ret;
5379 
5380  Windir = MyMalloc((MAX_PATH + 1 + strlenW(InfDirectory)) * sizeof(WCHAR));
5381  if (!Windir)
5382  {
5384  return FALSE;
5385  }
5386 
5387  ret = GetSystemWindowsDirectoryW(Windir, MAX_PATH);
5388  if (ret == 0 || ret > MAX_PATH)
5389  {
5390  MyFree(Windir);
5392  return FALSE;
5393  }
5394  if (*Windir && Windir[strlenW(Windir) - 1] != '\\')
5395  strcatW(Windir, BackSlash);
5396  strcatW(Windir, InfDirectory);
5397 
5398  if (strncmpiW(FullName, Windir, last - FullName) == 0)
5399  {
5400  /* The path is %SYSTEMROOT%\Inf */
5401  *IsOEMLocation = FALSE;
5402  }
5403  else
5404  {
5405  /* The file is in another place */
5406  *IsOEMLocation = TRUE;
5407  }
5408  MyFree(Windir);
5409  }
5410  return TRUE;
5411 }
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2397
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
POINT last
Definition: font.c:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
uint16_t * PWCHAR
Definition: typedefs.h:54
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
#define FALSE
Definition: types.h:117
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
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 4104 of file devinst.c.

Referenced by SetupDiCallClassInstaller().

4107 {
4109 }
smooth NULL
Definition: ftsmooth.c:416
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
BOOL WINAPI IntSetupDiSetDeviceRegistryPropertyAW ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Property,
const BYTE PropertyBuffer,
DWORD  PropertyBufferSize,
BOOL  isAnsi 
)

Definition at line 3452 of file devinst.c.

Referenced by SetupDiSetDeviceRegistryPropertyA(), and SetupDiSetDeviceRegistryPropertyW().

3459 {
3460  BOOL ret = FALSE;
3461  struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
3462 
3463  TRACE("%p %p %d %p %d\n", DeviceInfoSet, DeviceInfoData, Property,
3464  PropertyBuffer, PropertyBufferSize);
3465 
3467  {
3469  return FALSE;
3470  }
3471  if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
3472  {
3474  return FALSE;
3475  }
3476  if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)
3477  || !DeviceInfoData->Reserved)
3478  {
3480  return FALSE;
3481  }
3482  if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0])
3484  && PropertyMap[Property].nameA)
3485  {
3486  HKEY hKey;
3487  LONG l;
3489  if (hKey == INVALID_HANDLE_VALUE)
3490  return FALSE;
3491  /* Write new data */
3492  if (isAnsi)
3493  {
3494  l = RegSetValueExA(
3495  hKey, PropertyMap[Property].nameA, 0,
3496  PropertyMap[Property].regType, PropertyBuffer,
3498  }
3499  else
3500  {
3501  l = RegSetValueExW(
3502  hKey, PropertyMap[Property].nameW, 0,
3503  PropertyMap[Property].regType, PropertyBuffer,
3505  }
3506  if (!l)
3507  ret = TRUE;
3508  else
3509  SetLastError(l);
3510  RegCloseKey(hKey);
3511  }
3512  else
3513  {
3514  ERR("Property 0x%lx not implemented\n", Property);
3516  }
3517 
3518  TRACE("Returning %d\n", ret);
3519  return ret;
3520 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define SETUP_DEVICE_INFO_SET_MAGIC
_In_ DWORD _Out_opt_ PDWORD _In_ DWORD PropertyBufferSize
Definition: setupapi.h:1548
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
static struct PropertyMapEntry PropertyMap[]
Definition: devinst.c:3236
ULONG_PTR Reserved
Definition: setupapi.h:833
static const WCHAR nameW[]
Definition: main.c:46
r l[0]
Definition: byte_order.h:167
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:4917
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
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:5804
#define ERR(fmt,...)
Definition: debug.h:109
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4831
Definition: _set.h:46
static BOOL IsDeviceInfoInDeviceInfoSet ( struct DeviceInfoSet deviceInfoSet,
struct DeviceInfo deviceInfo 
)
static

Definition at line 4780 of file devinst.c.

Referenced by SetupDiDeleteDeviceInfo().

4783 {
4784  PLIST_ENTRY ListEntry;
4785 
4786  ListEntry = deviceInfoSet->ListHead.Flink;
4787  while (ListEntry != &deviceInfoSet->ListHead)
4788  {
4789  if (deviceInfo == CONTAINING_RECORD(ListEntry, struct DeviceInfo, ListEntry))
4790  return TRUE;
4791 
4792  ListEntry = ListEntry->Flink;
4793  }
4794 
4795  return FALSE;
4796 }
#define TRUE
Definition: types.h:120
LIST_ENTRY ListHead
#define FALSE
Definition: types.h:117
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
Definition: typedefs.h:117
static HKEY OpenHardwareProfileKey ( IN HKEY  HKLM,
IN DWORD  HwProfile,
IN DWORD  samDesired 
)
static

Definition at line 4725 of file devinst.c.

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

4729 {
4730  HKEY hHWProfilesKey = NULL;
4731  HKEY hHWProfileKey = NULL;
4733  LONG rc;
4734 
4735  rc = RegOpenKeyExW(HKLM,
4737  0,
4738  READ_CONTROL,
4739  &hHWProfilesKey);
4740  if (rc != ERROR_SUCCESS)
4741  {
4742  SetLastError(rc);
4743  goto cleanup;
4744  }
4745  if (HwProfile == 0)
4746  {
4747  rc = RegOpenKeyExW(hHWProfilesKey,
4749  0,
4751  &hHWProfileKey);
4752  }
4753  else
4754  {
4755  WCHAR subKey[5];
4756  snprintfW(subKey, 4, InstanceKeyFormat, HwProfile);
4757  subKey[4] = '\0';
4758  rc = RegOpenKeyExW(hHWProfilesKey,
4759  subKey,
4760  0,
4762  &hHWProfileKey);
4763  }
4764  if (rc != ERROR_SUCCESS)
4765  {
4766  SetLastError(rc);
4767  goto cleanup;
4768  }
4769  ret = hHWProfileKey;
4770 
4771 cleanup:
4772  if (hHWProfilesKey != NULL)
4773  RegCloseKey(hHWProfilesKey);
4774  if (hHWProfileKey != NULL && hHWProfileKey != ret)
4775  RegCloseKey(hHWProfileKey);
4776  return ret;
4777 }
#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:416
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 5110 of file devinst.c.

5113 {
5114 #ifndef __WINESRC__
5115  struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5116  struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5117  CONFIGRET cr;
5118 
5119  cr = CM_Enable_DevNode_Ex(deviceInfo->dnDevInst, 0, set->hMachine);
5120  if (cr != CR_SUCCESS)
5121  {
5123  return FALSE;
5124  }
5125 
5126  return TRUE;
5127 #else
5128  FIXME("Stub: ResetDevice(%p %p)\n", DeviceInfoSet, DeviceInfoData);
5129  return TRUE;
5130 #endif
5131 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
#define SetLastError(x)
Definition: compat.h:409
DEVINST dnDevInst
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
IN OUT PSP_DEVINFO_DATA DeviceInfoData
Definition: devinst.c:49
Definition: _set.h:46
CONFIGRET WINAPI CM_Enable_DevNode_Ex(_In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:1750
HKEY SETUP_CreateClassKey ( HINF  hInf)

Definition at line 3608 of file devinst.c.

Referenced by SetupDiInstallClassExW().

3609 {
3610  WCHAR FullBuffer[MAX_PATH];
3613  HKEY hClassKey;
3615 
3616  /* Obtain the Class GUID for this class */
3617  if (!SetupGetLineTextW(NULL,
3618  hInf,
3619  Version,
3621  Buffer,
3622  sizeof(Buffer) / sizeof(WCHAR),
3623  &RequiredSize))
3624  {
3625  return INVALID_HANDLE_VALUE;
3626  }
3627 
3628  /* Build the corresponding registry key name */
3629  lstrcpyW(FullBuffer, REGSTR_PATH_CLASS_NT);
3630  lstrcatW(FullBuffer, BackSlash);
3631  lstrcatW(FullBuffer, Buffer);
3632 
3633  /* Obtain the Class name for this class */
3634  if (!SetupGetLineTextW(NULL,
3635  hInf,
3636  Version,
3638  Buffer,
3639  sizeof(Buffer) / sizeof(WCHAR),
3640  &RequiredSize))
3641  {
3642  return INVALID_HANDLE_VALUE;
3643  }
3644 
3645  /* Try to open or create the registry key */
3646  TRACE("Opening class key %s\n", debugstr_w(FullBuffer));
3647 #if 0 // I keep this for reference...
3649  FullBuffer,
3650  0,
3651  KEY_SET_VALUE,
3652  &hClassKey))
3653  {
3654  /* Use RegCreateKeyExW */
3655  }
3656 #endif
3658  FullBuffer,
3659  0,
3660  NULL,
3662  KEY_SET_VALUE,
3663  NULL,
3664  &hClassKey,
3665  &Disposition))
3666  {
3667  ERR("RegCreateKeyExW(%s) failed\n", debugstr_w(FullBuffer));
3668  return INVALID_HANDLE_VALUE;
3669  }
3670  if (Disposition == REG_CREATED_NEW_KEY)
3671  TRACE("The class key %s was successfully created\n", debugstr_w(FullBuffer));
3672  else
3673  TRACE("The class key %s was successfully opened\n", debugstr_w(FullBuffer));
3674 
3675  TRACE( "setting value %s to %s\n", debugstr_w(REGSTR_VAL_CLASS), debugstr_w(Buffer) );
3676  if (RegSetValueExW(hClassKey,
3678  0,
3679  REG_SZ,
3680  (LPBYTE)Buffer,
3681  RequiredSize * sizeof(WCHAR)))
3682  {
3683  RegCloseKey(hClassKey);
3685  FullBuffer);
3686  return INVALID_HANDLE_VALUE;
3687  }
3688 
3689  return hClassKey;
3690 }
#define REGSTR_VAL_CLASS
Definition: regstr.h:291
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
#define KEY_SET_VALUE
Definition: nt_native.h:1017
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1240
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD DWORD
Definition: winlogon.h:75
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
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
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
_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:4917
#define TRACE(s)
Definition: solgame.cpp:4
HANDLE HKEY
Definition: registry.h:24
#define MAX_PATH
Definition: compat.h:26
#define REGSTR_VAL_CLASSGUID
Definition: regstr.h:422
#define ERR(fmt,...)
Definition: debug.h:109
#define lstrcpyW
Definition: compat.h:406
static const WCHAR BackSlash[]
Definition: devinst.c:25
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:22
static DWORD SETUPAPI_GetCurrentHwProfile ( IN HDEVINFO  DeviceInfoSet)
static

Definition at line 5063 of file devinst.c.

Referenced by SetupDiChangeState().

5065 {
5066  HKEY hKey = NULL;
5067  DWORD dwRegType, dwLength;
5068  DWORD hwProfile;
5069  LONG rc;
5070  DWORD ret = (DWORD)-1;
5071 
5072  rc = RegOpenKeyExW(((struct DeviceInfoSet *)DeviceInfoSet)->HKLM,
5074  0, /* Options */
5076  &hKey);
5077  if (rc != ERROR_SUCCESS)
5078  {
5079  SetLastError(rc);
5080  goto cleanup;
5081  }
5082 
5083  dwLength = sizeof(DWORD);
5084  rc = RegQueryValueExW(hKey,
5086  NULL,
5087  &dwRegType,
5088  (LPBYTE)&hwProfile, &dwLength);
5089  if (rc != ERROR_SUCCESS)
5090  {
5091  SetLastError(rc);
5092  goto cleanup;
5093  }
5094  else if (dwRegType != REG_DWORD || dwLength != sizeof(DWORD))
5095  {
5097  goto cleanup;
5098  }
5099 
5100  ret = hwProfile;
5101 
5102 cleanup:
5103  if (hKey != NULL)
5104  RegCloseKey(hKey);
5105 
5106  return ret;
5107 }
static const GUID DWORD
Definition: devinst.c:39
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned char * LPBYTE
Definition: typedefs.h:52
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:416
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:4134
static DWORD DWORD * dwLength
Definition: fusion.c:83
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
int ret
#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
#define REG_DWORD
Definition: sdbapi.c:539
static BOOL SETUPDI_DeleteDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo 
)
static

Definition at line 5876 of file devinst.c.

Referenced by SetupDiDeleteDevRegKey().

5877 {
5878  FIXME("\n");
5879  return FALSE;
5880 }
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
static BOOL SETUPDI_DeleteDrvKey ( HKEY  RootKey,
struct DeviceInfo devInfo 
)
static

Definition at line 5882 of file devinst.c.

Referenced by SetupDiDeleteDevRegKey().

5883 {
5884  FIXME("\n");
5885  return FALSE;
5886 }
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
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:943
static HKEY SETUPDI_OpenDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)
static

Definition at line 5711 of file devinst.c.

Referenced by SETUPDI_OpenDrvKey(), and SetupDiOpenDevRegKey().

5712 {
5713  HKEY enumKey, key = INVALID_HANDLE_VALUE;
5714  LONG l;
5715 
5717  if (!l)
5718  {
5719  l = RegOpenKeyExW(enumKey, devInfo->instanceId, 0, samDesired, &key);
5720  RegCloseKey(enumKey);
5721  }
5722  if (l)
5723  SetLastError(l);
5724  return key;
5725 }
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:42
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 5727 of file devinst.c.

Referenced by SetupDiOpenDevRegKey().

5728 {
5729  LPWSTR DriverKey = NULL;
5730  DWORD dwLength = 0;
5731  DWORD dwRegType;
5732  DWORD rc;
5733  HKEY hEnumKey = NULL;
5734  HKEY hKey = NULL;
5736 
5737  hKey = SETUPDI_OpenDevKey(RootKey, devInfo, KEY_QUERY_VALUE);
5738  if (hKey == INVALID_HANDLE_VALUE)
5739  goto cleanup;
5740  /* Read the 'Driver' key */
5741  rc = RegQueryValueExW(hKey, REGSTR_VAL_DRIVER, NULL, &dwRegType, NULL, &dwLength);
5742  if (rc != ERROR_SUCCESS)
5743  {
5744  SetLastError(rc);
5745  goto cleanup;
5746  }
5747  else if (dwRegType != REG_SZ)
5748  {
5750  goto cleanup;
5751  }
5752  DriverKey = HeapAlloc(GetProcessHeap(), 0, dwLength);
5753  if (!DriverKey)
5754  {
5756  goto cleanup;
5757  }
5758  rc = RegQueryValueExW(hKey, REGSTR_VAL_DRIVER, NULL, &dwRegType, (LPBYTE)DriverKey, &dwLength);
5759  if (rc != ERROR_SUCCESS)
5760  {
5761  SetLastError(rc);
5762  goto cleanup;
5763  }
5764  RegCloseKey(hKey);
5765  hKey = NULL;
5766  /* Need to open the driver key */
5767  rc = RegOpenKeyExW(
5768  RootKey,
5770  0, /* Options */
5771  READ_CONTROL,
5772  &hEnumKey);
5773  if (rc != ERROR_SUCCESS)
5774  {
5775  SetLastError(rc);
5776  goto cleanup;
5777  }
5778  rc = RegOpenKeyExW(
5779  hEnumKey,
5780  DriverKey,
5781  0, /* Options */
5782  samDesired,
5783  &hKey);
5784  if (rc != ERROR_SUCCESS)
5785  {
5786  SetLastError(rc);
5787  goto cleanup;
5788  }
5789  key = hKey;
5790 
5791 cleanup:
5792  if (hEnumKey != NULL)
5793  RegCloseKey(hEnumKey);
5794  if (hKey != NULL && hKey != key)
5795  RegCloseKey(hKey);
5796  if (DriverKey)
5797  HeapFree(GetProcessHeap(), 0, DriverKey);
5798  return key;
5799 }
#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:52
static HKEY SETUPDI_OpenDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5711
#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:416
#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:4134
static DWORD DWORD * dwLength
Definition: fusion.c:83
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:42
#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:22
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:416
_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
#define FALSE
Definition: types.h:117
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:416
_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
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 TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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
#define FALSE
Definition: types.h:117
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:615
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:416
_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:4134
static DWORD DWORD * dwLength
Definition: fusion.c:83
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
ULONG PVOID Reserved
Definition: ntimage.h:533
#define DIBCI_NODISPLAYCLASS
Definition: setupapi.h:109
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DIBCI_NOINSTALLCLASS
Definition: setupapi.h:108
#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:3752
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 4114 of file devinst.c.

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

4118 {
4119  BOOL ret = FALSE;
4120 
4121  TRACE("%u %p %p\n", InstallFunction, DeviceInfoSet, DeviceInfoData);
4122 
4123  if (!DeviceInfoSet)
4129  else if (((struct DeviceInfoSet *)DeviceInfoSet)->HKLM != HKEY_LOCAL_MACHINE)
4131  else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4133  else
4134  {
4136 #define CLASS_COINSTALLER 0x1
4137 #define DEVICE_COINSTALLER 0x2
4138 #define CLASS_INSTALLER 0x4
4139  UCHAR CanHandle = 0;
4140  DEFAULT_CLASS_INSTALL_PROC DefaultHandler = NULL;
4141 
4142  switch (InstallFunction)
4143  {
4146  break;
4149  break;
4150  case DIF_ALLOW_INSTALL:
4151  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4152  break;
4153  case DIF_DETECT:
4154  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4155  break;
4157  CanHandle = CLASS_INSTALLER;
4158  break;
4159  case DIF_INSTALLDEVICE:
4161  DefaultHandler = SetupDiInstallDevice;
4162  break;
4164  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4165  DefaultHandler = SetupDiInstallDriverFiles;
4166  break;
4167  case DIF_INSTALLINTERFACES:
4169  DefaultHandler = SetupDiInstallDeviceInterfaces;
4170  break;
4173  break;
4175  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4176  break;
4178  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4179  break;
4181  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4182  break;
4184  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4185  break;
4186  case DIF_POWERMESSAGEWAKE:
4188  break;
4189  case DIF_PROPERTYCHANGE:
4191  DefaultHandler = SetupDiChangeState;
4192  break;
4194  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4195  DefaultHandler = SetupDiRegisterCoDeviceInstallers;
4196  break;
4197  case DIF_REGISTERDEVICE:
4198  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4199  DefaultHandler = IntSetupDiRegisterDeviceInfo;
4200  break;
4201  case DIF_REMOVE:
4203  DefaultHandler = SetupDiRemoveDevice;
4204  break;
4206  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4207  DefaultHandler = SetupDiSelectBestCompatDrv;
4208  break;
4209  case DIF_SELECTDEVICE:
4210  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4211  DefaultHandler = SetupDiSelectDevice;
4212  break;
4213  case DIF_TROUBLESHOOTER:
4215  break;
4216  case DIF_UNREMOVE:
4218  DefaultHandler = SetupDiUnremoveDevice;
4219  break;
4220  default:
4221  ERR("Install function %u not supported\n", InstallFunction);
4223  }
4224 
4225  InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
4226  if (!SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams))
4227  /* Don't process this call, as a parameter is invalid */
4228  CanHandle = 0;
4229 
4230  if (CanHandle != 0)
4231  {
4232  LIST_ENTRY ClassCoInstallersListHead;
4233  LIST_ENTRY DeviceCoInstallersListHead;
4234  HMODULE ClassInstallerLibrary = NULL;
4235  CLASS_INSTALL_PROC ClassInstaller = NULL;
4238  HKEY hKey;
4239  DWORD dwRegType, dwLength;
4240  DWORD rc = NO_ERROR;
4241 
4242  InitializeListHead(&ClassCoInstallersListHead);
4243  InitializeListHead(&DeviceCoInstallersListHead);
4244 
4245  if (CanHandle & DEVICE_COINSTALLER)
4246  {
4248  if (hKey != INVALID_HANDLE_VALUE)
4249  {
4250  rc = RegQueryValueExW(hKey, REGSTR_VAL_COINSTALLERS_32, NULL, &dwRegType, NULL, &dwLength);
4251  if (rc == ERROR_SUCCESS && dwRegType == REG_MULTI_SZ)
4252  {
4253  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4254  if (KeyBuffer != NULL)
4255  {
4256  rc = RegQueryValueExW(hKey, REGSTR_VAL_COINSTALLERS_32, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4257  if (rc == ERROR_SUCCESS)
4258  {
4259  LPWSTR ptr;
4260  for (ptr = KeyBuffer; *ptr; ptr += strlenW(ptr) + 1)
4261  {
4262  /* Add coinstaller to DeviceCoInstallersListHead list */
4263  struct CoInstallerElement *coinstaller;
4264  TRACE("Got device coinstaller '%s'\n", debugstr_w(ptr));
4265  coinstaller = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CoInstallerElement));
4266  if (!coinstaller)
4267  continue;
4268  ZeroMemory(coinstaller, sizeof(struct CoInstallerElement));
4269  if (GetFunctionPointer(ptr, &coinstaller->Module, (PVOID*)&coinstaller->Function) == ERROR_SUCCESS)
4270  InsertTailList(&DeviceCoInstallersListHead, &coinstaller->ListEntry);
4271  else
4272  HeapFree(GetProcessHeap(), 0, coinstaller);
4273  }
4274  }
4275  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4276  }
4277  }
4278  RegCloseKey(hKey);
4279  }
4280  }
4281  if (CanHandle & CLASS_COINSTALLER)
4282  {
4283  rc = RegOpenKeyExW(
4286  0, /* Options */
4288  &hKey);
4289  if (rc == ERROR_SUCCESS)
4290  {
4291  WCHAR szGuidString[40];
4292  if (pSetupStringFromGuid(&DeviceInfoData->ClassGuid, szGuidString, ARRAYSIZE(szGuidString)) == ERROR_SUCCESS)
4293  {
4294  rc = RegQueryValueExW(hKey, szGuidString, NULL, &dwRegType, NULL, &dwLength);
4295  if (rc == ERROR_SUCCESS && dwRegType == REG_MULTI_SZ)
4296  {
4297  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4298  if (KeyBuffer != NULL)
4299  {
4300  rc = RegQueryValueExW(hKey, szGuidString, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4301  if (rc == ERROR_SUCCESS)
4302  {
4303  LPWSTR ptr;
4304  for (ptr = KeyBuffer; *ptr; ptr += strlenW(ptr) + 1)
4305  {
4306  /* Add coinstaller to ClassCoInstallersListHead list */
4307  struct CoInstallerElement *coinstaller;
4308  TRACE("Got class coinstaller '%s'\n", debugstr_w(ptr));
4309  coinstaller = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CoInstallerElement));
4310  if (!coinstaller)
4311  continue;
4312  ZeroMemory(coinstaller, sizeof(struct CoInstallerElement));
4313  if (GetFunctionPointer(ptr, &coinstaller->Module, (PVOID*)&coinstaller->Function) == ERROR_SUCCESS)
4314  InsertTailList(&ClassCoInstallersListHead, &coinstaller->ListEntry);
4315  else
4316  HeapFree(GetProcessHeap(), 0, coinstaller);
4317  }
4318  }
4319  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4320  }
4321  }
4322  }
4323  RegCloseKey(hKey);
4324  }
4325  }
4326  if ((CanHandle & CLASS_INSTALLER) && !(InstallParams.FlagsEx & DI_FLAGSEX_CI_FAILED))
4327  {
4328  hKey = SetupDiOpenClassRegKey(&DeviceInfoData->ClassGuid, KEY_QUERY_VALUE);
4329  if (hKey != INVALID_HANDLE_VALUE)
4330  {
4331  rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, &dwRegType, NULL, &dwLength);
4332  if (rc == ERROR_SUCCESS && dwRegType == REG_SZ)
4333  {
4334  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4335  if (KeyBuffer != NULL)
4336  {
4337  rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4338  if (rc == ERROR_SUCCESS)
4339  {
4340  /* Get ClassInstaller function pointer */
4341  TRACE("Got class installer '%s'\n", debugstr_w(KeyBuffer));
4342  if (GetFunctionPointer(KeyBuffer, &ClassInstallerLibrary, (PVOID*)&ClassInstaller) != ERROR_SUCCESS)
4343  {
4344  InstallParams.FlagsEx |= DI_FLAGSEX_CI_FAILED;
4345  SetupDiSetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams);
4346  }
4347  }
4348  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4349  }
4350  }
4351  RegCloseKey(hKey);
4352  }
4353  }
4354 
4355  /* Call Class co-installers */
4356  Context.PostProcessing = FALSE;
4357  rc = NO_ERROR;
4358  ListEntry = ClassCoInstallersListHead.Flink;
4359  while (rc == NO_ERROR && ListEntry != &ClassCoInstallersListHead)
4360  {
4361  struct CoInstallerElement *coinstaller;
4362  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4363  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4364  coinstaller->PrivateData = Context.PrivateData;
4366  {
4367  coinstaller->DoPostProcessing = TRUE;
4368  rc = NO_ERROR;
4369  }
4370  ListEntry = ListEntry->Flink;
4371  }
4372 
4373  /* Call Device co-installers */
4374  ListEntry = DeviceCoInstallersListHead.Flink;
4375  while (rc == NO_ERROR && ListEntry != &DeviceCoInstallersListHead)
4376  {
4377  struct CoInstallerElement *coinstaller;
4378  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4379  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4380  coinstaller->PrivateData = Context.PrivateData;
4382  {
4383  coinstaller->DoPostProcessing = TRUE;
4384  rc = NO_ERROR;
4385  }
4386  ListEntry = ListEntry->Flink;
4387  }
4388 
4389  /* Call Class installer */
4390  if (ClassInstaller)
4391  {
4392  rc = (*ClassInstaller)(InstallFunction, DeviceInfoSet, DeviceInfoData);
4393  FreeFunctionPointer(ClassInstallerLibrary, ClassInstaller);
4394  }
4395  else
4396  rc = ERROR_DI_DO_DEFAULT;
4397 
4398  /* Call default handler */
4399  if (rc == ERROR_DI_DO_DEFAULT)
4400  {
4401  if (DefaultHandler && !(InstallParams.Flags & DI_NODI_DEFAULTACTION))
4402  {
4403  if ((*DefaultHandler)(DeviceInfoSet, DeviceInfoData))
4404  rc = NO_ERROR;
4405  else
4406  rc = GetLastError();
4407  }
4408  else
4409  rc = NO_ERROR;
4410  }
4411 
4412  /* Call Class co-installers that required postprocessing */
4413  Context.PostProcessing = TRUE;
4414  ListEntry = ClassCoInstallersListHead.Flink;
4415  while (ListEntry != &ClassCoInstallersListHead)
4416  {
4417  struct CoInstallerElement *coinstaller;
4418  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4419  if (coinstaller->DoPostProcessing)
4420  {
4421  Context.InstallResult = rc;
4422  Context.PrivateData = coinstaller->PrivateData;
4423  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4424  }
4425  FreeFunctionPointer(coinstaller->Module, coinstaller->Function);
4426  ListEntry = ListEntry->Flink;
4427  }
4428 
4429  /* Call Device co-installers that required postprocessing */
4430  ListEntry = DeviceCoInstallersListHead.Flink;
4431  while (ListEntry != &DeviceCoInstallersListHead)
4432  {
4433  struct CoInstallerElement *coinstaller;
4434  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4435  if (coinstaller->DoPostProcessing)
4436  {
4437  Context.InstallResult = rc;
4438  Context.PrivateData = coinstaller->PrivateData;
4439  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4440  }
4441  FreeFunctionPointer(coinstaller->Module, coinstaller->Function);
4442  ListEntry = ListEntry->Flink;
4443  }
4444 
4445  /* Free allocated memory */
4446  while (!IsListEmpty(&ClassCoInstallersListHead))
4447  {
4448  ListEntry = RemoveHeadList(&ClassCoInstallersListHead);
4449  HeapFree(GetProcessHeap(), 0, CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry));
4450  }
4451  while (!IsListEmpty(&DeviceCoInstallersListHead))
4452  {
4453  ListEntry = RemoveHeadList(&DeviceCoInstallersListHead);
4454  HeapFree(GetProcessHeap(), 0, CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry));
4455  }
4456 
4457  ret = (rc == NO_ERROR);
4458  }
4459  }
4460 
4461  TRACE("Returning %d\n", ret);
4462  return ret;
4463 }
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:2063
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4648
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DIF_ADDREMOTEPROPERTYPAGE_ADVANCED
Definition: setupapi.h:159
unsigned char * LPBYTE
Definition: typedefs.h:52
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
u32_t magic(void)
HMODULE Module
Definition: devinst.c:61
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define ZeroMemory
Definition: winbase.h:1635
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
#define FALSE
Definition: types.h:117
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:5417
static PVOID ptr
Definition: dispmode.c:27
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4541
static BOOL WINAPI IntSetupDiRegisterDeviceInfo(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4104
#define DIF_REGISTER_COINSTALLERS
Definition: setupapi.h:153
smooth NULL
Definition: ftsmooth.c:416
#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
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
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:119
#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:4134
static DWORD DWORD * dwLength
Definition: fusion.c:83
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
DWORD WINAPI pSetupStringFromGuid(LPGUID lpGUID, PWSTR pString, DWORD dwStringLen)
Definition: misc.c:1754
BOOL WINAPI SetupDiRegisterCoDeviceInstallers(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5271
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:5145
HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, REGSAM samDesired)
Definition: devinst.c:5804
Definition: typedefs.h:117
#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:5257
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:75
#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 DIREG_DRV
Definition: setupapi.h:182
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:2099
#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:3708
#define CLASS_COINSTALLER
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22
BOOL WINAPI SetupDiChangeState ( IN HDEVINFO  DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 5145 of file devinst.c.

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

5148 {
5149  PSP_PROPCHANGE_PARAMS PropChange;
5150  HKEY hKey = INVALID_HANDLE_VALUE;
5151  LPCWSTR RegistryValueName;
5152  DWORD dwConfigFlags, dwLength, dwRegType;
5153  LONG rc;
5154  BOOL ret = FALSE;
5155 
5156  TRACE("%p %p\n", DeviceInfoSet, DeviceInfoData);
5157 
5158  if (!DeviceInfoData)
5159  PropChange = ((struct DeviceInfoSet *)DeviceInfoSet)->ClassInstallParams.PropChangeParams;
5160  else
5161  PropChange = ((struct DeviceInfo *)DeviceInfoData->Reserved)->ClassInstallParams.PropChangeParams;
5162  if (!PropChange)
5163  {
5165  goto cleanup;
5166  }
5167 
5168  if (PropChange->Scope == DICS_FLAG_GLOBAL)
5169  RegistryValueName = REGSTR_VAL_CONFIGFLAGS;
5170  else
5171  RegistryValueName = REGSTR_VAL_CSCONFIGFLAGS;
5172 
5173  switch (PropChange->StateChange)
5174  {
5175  case DICS_ENABLE:
5176  case DICS_DISABLE:
5177  {
5178  /* Enable/disable device in registry */
5181  hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet, DeviceInfoData, PropChange->Scope, PropChange->HwProfile, DIREG_DEV, NULL, NULL);
5182  if (hKey == INVALID_HANDLE_VALUE)
5183  break;
5184  dwLength = sizeof(DWORD);
5185  rc = RegQueryValueExW(
5186  hKey,
5187  RegistryValueName,
5188  NULL,
5189  &dwRegType,
5190  (LPBYTE)&dwConfigFlags, &dwLength);
5191  if (rc == ERROR_FILE_NOT_FOUND)
5192  dwConfigFlags = 0;
5193  else if (rc != ERROR_SUCCESS)
5194  {
5195  SetLastError(rc);
5196  goto cleanup;
5197  }
5198  else if (dwRegType != REG_DWORD || dwLength != sizeof(DWORD))
5199  {
5201  goto cleanup;
5202  }
5203  if (PropChange->StateChange == DICS_ENABLE)
5204  dwConfigFlags &= ~(PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED);
5205  else
5206  dwConfigFlags |= (PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED);
5207  rc = RegSetValueExW(
5208  hKey,
5209  RegistryValueName,
5210  0,
5211  REG_DWORD,
5212  (LPBYTE)&dwConfigFlags, sizeof(DWORD));
5213  if (rc != ERROR_SUCCESS)
5214  {
5215  SetLastError(rc);
5216  goto cleanup;
5217  }
5218 
5219  /* Enable/disable device if needed */
5220  if (PropChange->Scope == DICS_FLAG_GLOBAL
5221  || PropChange->HwProfile == 0
5223  {
5224  if (PropChange->StateChange == DICS_ENABLE)
5226  else
5228  }
5229  else
5230  ret = TRUE;
5231  break;
5232  }
5233  case DICS_PROPCHANGE:
5234  {
5236  break;
5237  }
5238  default:
5239  {
5240  ERR("Unknown StateChange 0x%lx\n", PropChange->StateChange);
5242  }
5243  }
5244 
5245 cleanup:
5246  if (hKey != INVALID_HANDLE_VALUE)
5247  RegCloseKey(hKey);
5248 
5249  TRACE("Returning %d\n", ret);
5250  return ret;
5251 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static const GUID DWORD
Definition: devinst.c:39
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
unsigned char * LPBYTE
Definition: typedefs.h:52
static DWORD SETUPAPI_GetCurrentHwProfile(IN HDEVINFO DeviceInfoSet)
Definition: devinst.c:5063
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#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
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define DICS_DISABLE
Definition: setupapi.h:114
smooth NULL
Definition: ftsmooth.c:416
#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:4917
#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:4134
static DWORD DWORD * dwLength
Definition: fusion.c:83
HANDLE HKEY
Definition: registry.h:24
#define DIREG_DEV
Definition: setupapi.h:181
BOOLEAN ResetDevice(IN LPCWSTR DeviceId)
Definition: devinst.c:19
#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:5804
#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
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
#define REG_DWORD
Definition: sdbapi.c:539
static BOOL StopDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5133
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:416
_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
#define FALSE
Definition: types.h:117
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:416
_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
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 TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
#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 FALSE
Definition: types.h:117
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:615
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:416
_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:4134
static DWORD DWORD * dwLength
Definition: fusion.c:83
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
ULONG PVOID Reserved
Definition: ntimage.h:533
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#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
HKEY WINAPI SetupDiOpenClassRegKeyExW(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:3752
#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:416
_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:416
_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
#define FALSE
Definition: types.h:117
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SetLastError(x)
Definition: compat.h:409
ULONG PVOID Reserved
Definition: ntimage.h:533
int ret
GLenum GLsizei len
Definition: glext.h:6722
#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 TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
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 FALSE
Definition: types.h:117
#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:416
#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:83
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
UINTN VOID * Buffer
Definition: acefiex.h:370
ULONG PVOID Reserved
Definition: ntimage.h:533
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define ERROR_INVALID_CLASS
Definition: setupapi.h:297
HKEY WINAPI SetupDiOpenClassRegKeyExW(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:3752
#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:22
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:416
_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
#define FALSE
Definition: types.h:117
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
smooth NULL
Definition: ftsmooth.c:416
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
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:416
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:416
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
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:1195
#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:1635
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:416
static HWND hwndParent
Definition: cryptui.c:300
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
CONFIGRET WINAPI CM_Connect_MachineW(_In_opt_ PCWSTR UNCServerName, _Out_ PHMACHINE phMachine)
Definition: cfgmgr.c:1166
LIST_ENTRY DriverListHead
PVOID HDEVINFO
Definition: setupapi.h:664
#define SetLastError(x)
Definition: compat.h:409
ULONG PVOID Reserved
Definition: ntimage.h:533
#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_PTR SIZE_T
Definition: typedefs.h:78
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
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
#define TRUE
Definition: types.h:120
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 INVALID_HANDLE_VALUE
Definition: