ReactOS  0.4.11-dev-721-g95bc44e
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)
 
HKEY SETUPDI_CreateDevKey (HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
 
HKEY SETUPDI_CreateDrvKey (HKEY RootKey, struct DeviceInfo *devInfo, UUID *ClassGuid, REGSAM samDesired)
 
HKEY SETUPDI_OpenDevKey (HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
 
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 4504 of file devinst.c.

Referenced by SetupDiSetDeviceInstallParamsW().

4506 {
4507  DWORD SupportedFlags =
4508  DI_NOVCP | /* 0x00000008 */
4509  DI_DIDCOMPAT | /* 0x00000010 */
4510  DI_DIDCLASS | /* 0x00000020 */
4511  DI_NEEDRESTART | /* 0x00000080 */
4512  DI_NEEDREBOOT | /* 0x00000100 */
4513  DI_RESOURCEPAGE_ADDED | /* 0x00002000 */
4514  DI_PROPERTIES_CHANGE | /* 0x00004000 */
4515  DI_ENUMSINGLEINF | /* 0x00010000 */
4516  DI_DONOTCALLCONFIGMG | /* 0x00020000 */
4517  DI_CLASSINSTALLPARAMS | /* 0x00100000 */
4518  DI_NODI_DEFAULTACTION | /* 0x00200000 */
4519  DI_QUIETINSTALL | /* 0x00800000 */
4520  DI_NOFILECOPY | /* 0x01000000 */
4521  DI_DRIVERPAGE_ADDED; /* 0x04000000 */
4522  DWORD SupportedFlagsEx =
4523  DI_FLAGSEX_CI_FAILED | /* 0x00000004 */
4524  DI_FLAGSEX_DIDINFOLIST | /* 0x00000010 */
4525  DI_FLAGSEX_DIDCOMPATINFO | /* 0x00000020 */
4526  DI_FLAGSEX_ALLOWEXCLUDEDDRVS | /* 0x00000800 */
4527  DI_FLAGSEX_NO_DRVREG_MODIFY | /* 0x00008000 */
4528  DI_FLAGSEX_INSTALLEDDRIVER; /* 0x04000000 */
4529  BOOL ret = FALSE;
4530 
4531  /* FIXME: add support for more flags */
4532 
4533  /* FIXME: DI_CLASSINSTALLPARAMS flag is not correctly used.
4534  * It should be checked before accessing to other values
4535  * of the SP_DEVINSTALL_PARAMS structure */
4536 
4537  if (DeviceInstallParams->Flags & ~SupportedFlags)
4538  {
4539  FIXME("Unknown Flags: 0x%08lx\n", DeviceInstallParams->Flags & ~SupportedFlags);
4541  }
4542  else if (DeviceInstallParams->FlagsEx & ~SupportedFlagsEx)
4543  {
4544  FIXME("Unknown FlagsEx: 0x%08lx\n", DeviceInstallParams->FlagsEx & ~SupportedFlagsEx);
4546  }
4547  else if ((DeviceInstallParams->Flags & DI_NOVCP)
4548  && (DeviceInstallParams->FileQueue == NULL || DeviceInstallParams->FileQueue == (HSPFILEQ)INVALID_HANDLE_VALUE))
4550  else
4551  {
4552  /* FIXME: check Reserved field */
4553  ret = TRUE;
4554  }
4555 
4556  return ret;
4557 }
#define TRUE
Definition: types.h:120
#define DI_NEEDREBOOT
Definition: setupapi.h:54
PVOID HSPFILEQ
Definition: fileqsup.h:56
#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:84
#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:84
#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:84
_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:84
#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 5300 of file devinst.c.

Referenced by SetupDiInstallDevice().

5303 {
5304  PWCHAR last;
5305 
5306  last = strrchrW(FullName, '\\');
5307  if (!last)
5308  {
5309  /* No directory specified */
5310  *IsOEMLocation = FALSE;
5311  }
5312  else
5313  {
5314  LPWSTR Windir;
5315  UINT ret;
5316 
5317  Windir = MyMalloc((MAX_PATH + 1 + strlenW(InfDirectory)) * sizeof(WCHAR));
5318  if (!Windir)
5319  {
5321  return FALSE;
5322  }
5323 
5324  ret = GetSystemWindowsDirectoryW(Windir, MAX_PATH);
5325  if (ret == 0 || ret > MAX_PATH)
5326  {
5327  MyFree(Windir);
5329  return FALSE;
5330  }
5331  if (*Windir && Windir[strlenW(Windir) - 1] != '\\')
5332  strcatW(Windir, BackSlash);
5333  strcatW(Windir, InfDirectory);
5334 
5335  if (strncmpiW(FullName, Windir, last - FullName) == 0)
5336  {
5337  /* The path is %SYSTEMROOT%\Inf */
5338  *IsOEMLocation = FALSE;
5339  }
5340  else
5341  {
5342  /* The file is in another place */
5343  *IsOEMLocation = TRUE;
5344  }
5345  MyFree(Windir);
5346  }
5347  return TRUE;
5348 }
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2396
#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 4019 of file devinst.c.

Referenced by SetupDiCallClassInstaller().

4022 {
4024 }
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:1716
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 3363 of file devinst.c.

Referenced by SetupDiSetDeviceRegistryPropertyA(), and SetupDiSetDeviceRegistryPropertyW().

3370 {
3371  BOOL ret = FALSE;
3372  struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
3373  struct DeviceInfo *deviceInfo;
3374 
3375  TRACE("%p %p %d %p %d\n", DeviceInfoSet, DeviceInfoData, Property,
3376  PropertyBuffer, PropertyBufferSize);
3377 
3379  {
3381  return FALSE;
3382  }
3383  if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
3384  {
3386  return FALSE;
3387  }
3388  if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)
3389  || !DeviceInfoData->Reserved)
3390  {
3392  return FALSE;
3393  }
3394 
3395  deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
3396 
3397  if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0])
3399  && PropertyMap[Property].nameA)
3400  {
3401  HKEY hKey;
3402  LONG l;
3403  hKey = SETUPDI_OpenDevKey(set->HKLM, deviceInfo, KEY_SET_VALUE);
3404  if (hKey == INVALID_HANDLE_VALUE)
3405  return FALSE;
3406  /* Write new data */
3407  if (isAnsi)
3408  {
3409  l = RegSetValueExA(
3410  hKey, PropertyMap[Property].nameA, 0,
3411  PropertyMap[Property].regType, PropertyBuffer,
3413  }
3414  else
3415  {
3416  l = RegSetValueExW(
3417  hKey, PropertyMap[Property].nameW, 0,
3418  PropertyMap[Property].regType, PropertyBuffer,
3420  }
3421  if (!l)
3422  ret = TRUE;
3423  else
3424  SetLastError(l);
3425  RegCloseKey(hKey);
3426  }
3427  else
3428  {
3429  ERR("Property 0x%lx not implemented\n", Property);
3431  }
3432 
3433  TRACE("Returning %d\n", ret);
3434  return ret;
3435 }
HKEY SETUPDI_OpenDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5826
#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:3103
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
if(!(yy_init))
Definition: macro.lex.yy.c:717
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ERR(fmt,...)
Definition: debug.h:109
#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 4695 of file devinst.c.

Referenced by SetupDiDeleteDeviceInfo().

4698 {
4700 
4701  ListEntry = deviceInfoSet->ListHead.Flink;
4702  while (ListEntry != &deviceInfoSet->ListHead)
4703  {
4704  if (deviceInfo == CONTAINING_RECORD(ListEntry, struct DeviceInfo, ListEntry))
4705  return TRUE;
4706 
4707  ListEntry = ListEntry->Flink;
4708  }
4709 
4710  return FALSE;
4711 }
#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
LIST_ENTRY ListEntry
static HKEY OpenHardwareProfileKey ( IN HKEY  HKLM,
IN DWORD  HwProfile,
IN DWORD  samDesired 
)
static

Definition at line 4640 of file devinst.c.

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

4644 {
4645  HKEY hHWProfilesKey = NULL;
4646  HKEY hHWProfileKey = NULL;
4648  LONG rc;
4649 
4650  rc = RegOpenKeyExW(HKLM,
4652  0,
4653  READ_CONTROL,
4654  &hHWProfilesKey);
4655  if (rc != ERROR_SUCCESS)
4656  {
4657  SetLastError(rc);
4658  goto cleanup;
4659  }
4660  if (HwProfile == 0)
4661  {
4662  rc = RegOpenKeyExW(hHWProfilesKey,
4664  0,
4666  &hHWProfileKey);
4667  }
4668  else
4669  {
4670  WCHAR subKey[5];
4671  snprintfW(subKey, 4, InstanceKeyFormat, HwProfile);
4672  subKey[4] = '\0';
4673  rc = RegOpenKeyExW(hHWProfilesKey,
4674  subKey,
4675  0,
4677  &hHWProfileKey);
4678  }
4679  if (rc != ERROR_SUCCESS)
4680  {
4681  SetLastError(rc);
4682  goto cleanup;
4683  }
4684  ret = hHWProfileKey;
4685 
4686 cleanup:
4687  if (hHWProfilesKey != NULL)
4688  RegCloseKey(hHWProfilesKey);
4689  if (hHWProfileKey != NULL && hHWProfileKey != ret)
4690  RegCloseKey(hHWProfileKey);
4691  return ret;
4692 }
#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:58
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 5025 of file devinst.c.

5028 {
5029 #ifndef __WINESRC__
5030  struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5031  struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5032  CONFIGRET cr;
5033 
5034  cr = CM_Enable_DevNode_Ex(deviceInfo->dnDevInst, 0, set->hMachine);
5035  if (cr != CR_SUCCESS)
5036  {
5038  return FALSE;
5039  }
5040 
5041  return TRUE;
5042 #else
5043  FIXME("Stub: ResetDevice(%p %p)\n", DeviceInfoSet, DeviceInfoData);
5044  return TRUE;
5045 #endif
5046 }
#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 3523 of file devinst.c.

Referenced by SetupDiInstallClassExW().

3524 {
3525  WCHAR FullBuffer[MAX_PATH];
3528  HKEY hClassKey;
3530 
3531  /* Obtain the Class GUID for this class */
3532  if (!SetupGetLineTextW(NULL,
3533  hInf,
3534  Version,
3536  Buffer,
3537  sizeof(Buffer) / sizeof(WCHAR),
3538  &RequiredSize))
3539  {
3540  return INVALID_HANDLE_VALUE;
3541  }
3542 
3543  /* Build the corresponding registry key name */
3544  lstrcpyW(FullBuffer, REGSTR_PATH_CLASS_NT);
3545  lstrcatW(FullBuffer, BackSlash);
3546  lstrcatW(FullBuffer, Buffer);
3547 
3548  /* Obtain the Class name for this class */
3549  if (!SetupGetLineTextW(NULL,
3550  hInf,
3551  Version,
3553  Buffer,
3554  sizeof(Buffer) / sizeof(WCHAR),
3555  &RequiredSize))
3556  {
3557  return INVALID_HANDLE_VALUE;
3558  }
3559 
3560  /* Try to open or create the registry key */
3561  TRACE("Opening class key %s\n", debugstr_w(FullBuffer));
3562 #if 0 // I keep this for reference...
3564  FullBuffer,
3565  0,
3566  KEY_SET_VALUE,
3567  &hClassKey))
3568  {
3569  /* Use RegCreateKeyExW */
3570  }
3571 #endif
3573  FullBuffer,
3574  0,
3575  NULL,
3577  KEY_SET_VALUE,
3578  NULL,
3579  &hClassKey,
3580  &Disposition))
3581  {
3582  ERR("RegCreateKeyExW(%s) failed\n", debugstr_w(FullBuffer));
3583  return INVALID_HANDLE_VALUE;
3584  }
3585  if (Disposition == REG_CREATED_NEW_KEY)
3586  TRACE("The class key %s was successfully created\n", debugstr_w(FullBuffer));
3587  else
3588  TRACE("The class key %s was successfully opened\n", debugstr_w(FullBuffer));
3589 
3590  TRACE( "setting value %s to %s\n", debugstr_w(REGSTR_VAL_CLASS), debugstr_w(Buffer) );
3591  if (RegSetValueExW(hClassKey,
3593  0,
3594  REG_SZ,
3595  (LPBYTE)Buffer,
3596  RequiredSize * sizeof(WCHAR)))
3597  {
3598  RegCloseKey(hClassKey);
3600  FullBuffer);
3601  return INVALID_HANDLE_VALUE;
3602  }
3603 
3604  return hClassKey;
3605 }
#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:84
_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 4978 of file devinst.c.

Referenced by SetupDiChangeState().

4980 {
4981  HKEY hKey = NULL;
4982  DWORD dwRegType, dwLength;
4983  DWORD hwProfile;
4984  LONG rc;
4985  DWORD ret = (DWORD)-1;
4986 
4987  rc = RegOpenKeyExW(((struct DeviceInfoSet *)DeviceInfoSet)->HKLM,
4989  0, /* Options */
4991  &hKey);
4992  if (rc != ERROR_SUCCESS)
4993  {
4994  SetLastError(rc);
4995  goto cleanup;
4996  }
4997 
4998  dwLength = sizeof(DWORD);
4999  rc = RegQueryValueExW(hKey,
5001  NULL,
5002  &dwRegType,
5003  (LPBYTE)&hwProfile, &dwLength);
5004  if (rc != ERROR_SUCCESS)
5005  {
5006  SetLastError(rc);
5007  goto cleanup;
5008  }
5009  else if (dwRegType != REG_DWORD || dwLength != sizeof(DWORD))
5010  {
5012  goto cleanup;
5013  }
5014 
5015  ret = hwProfile;
5016 
5017 cleanup:
5018  if (hKey != NULL)
5019  RegCloseKey(hKey);
5020 
5021  return ret;
5022 }
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:84
#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:58
#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
HKEY SETUPDI_CreateDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)

Definition at line 5656 of file devinst.c.

Referenced by SetupDiChangeState(), and SetupDiCreateDevRegKeyW().

5657 {
5658  HKEY enumKey, key = INVALID_HANDLE_VALUE;
5659  LONG l;
5660 
5662  if (!l)
5663  {
5664  l = RegCreateKeyExW(enumKey, devInfo->instanceId, 0, NULL, REG_OPTION_NON_VOLATILE, samDesired, NULL, &key, NULL);
5665  RegCloseKey(enumKey);
5666  }
5667  if (l)
5668  SetLastError(l);
5669  return key;
5670 }
static PMEMKEY RootKey
Definition: registry.c:55
#define REGSTR_PATH_SYSTEMENUM
Definition: regstr.h:483
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
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
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
r l[0]
Definition: byte_order.h:167
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
HANDLE HKEY
Definition: registry.h:24
#define SetLastError(x)
Definition: compat.h:409
HKEY key
Definition: reg.c:42
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
Definition: path.c:42
HKEY SETUPDI_CreateDrvKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
UUID ClassGuid,
REGSAM  samDesired 
)

Definition at line 5672 of file devinst.c.

Referenced by SetupDiCreateDevRegKeyW(), SetupDiInstallDevice(), and SetupDiRegisterCoDeviceInstallers().

5673 {
5675  LPWSTR lpGuidString = NULL;
5676  LPWSTR DriverKey = NULL; /* {GUID}\Index */
5677  LPWSTR pDeviceInstance; /* Points into DriverKey, on the Index field */
5678  DWORD Index; /* Index used in the DriverKey name */
5679  DWORD dwSize;
5681  DWORD rc;
5682  HKEY hHWProfileKey = INVALID_HANDLE_VALUE;
5683  HKEY hEnumKey = NULL;
5684  HKEY hClassKey = NULL;
5685  HKEY hDeviceKey = INVALID_HANDLE_VALUE;
5686  HKEY hKey = NULL;
5687 
5688  /* Open device key, to read Driver value */
5689  hDeviceKey = SETUPDI_OpenDevKey(RootKey, devInfo, KEY_QUERY_VALUE | KEY_SET_VALUE);
5690  if (hDeviceKey == INVALID_HANDLE_VALUE)
5691  goto cleanup;
5692 
5694  if (rc != ERROR_SUCCESS)
5695  {
5696  SetLastError(rc);
5697  goto cleanup;
5698  }
5699 
5700  rc = RegQueryValueExW(hDeviceKey, REGSTR_VAL_DRIVER, NULL, NULL, NULL, &dwSize);
5701  if (rc != ERROR_SUCCESS)
5702  {
5703  /* Create a new driver key */
5704 
5705  if (UuidToStringW(ClassGuid, &lpGuidString) != RPC_S_OK)
5706  goto cleanup;
5707 
5708  /* The driver key is in \System\CurrentControlSet\Control\Class\{GUID}\Index */
5709  DriverKey = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpGuidString) + 7) * sizeof(WCHAR) + sizeof(UNICODE_NULL));
5710  if (!DriverKey)
5711  {
5713  goto cleanup;
5714  }
5715 
5716  DriverKey[0] = '{';
5717  strcpyW(&DriverKey[1], lpGuidString);
5718  pDeviceInstance = &DriverKey[strlenW(DriverKey)];
5719  *pDeviceInstance++ = '}';
5720  *pDeviceInstance++ = '\\';
5721 
5722  /* Try all values for Index between 0 and 9999 */
5723  Index = 0;
5724  while (Index <= 9999)
5725  {
5726  sprintfW(pDeviceInstance, InstanceKeyFormat, Index);
5727  rc = RegCreateKeyExW(hClassKey,
5728  DriverKey,
5729  0,
5730  NULL,
5732 #if _WIN32_WINNT >= 0x502
5733  KEY_READ | KEY_WRITE,
5734 #else
5736 #endif
5737  NULL,
5738  &hKey,
5739  &Disposition);
5740  if (rc != ERROR_SUCCESS)
5741  {
5742  SetLastError(rc);
5743  goto cleanup;
5744  }
5745  if (Disposition == REG_CREATED_NEW_KEY)
5746  break;
5747  RegCloseKey(hKey);
5748  hKey = NULL;
5749  Index++;
5750  }
5751 
5752  if (Index > 9999)
5753  {
5754  /* Unable to create more than 9999 devices within the same class */
5756  goto cleanup;
5757  }
5758 
5759  /* Write the new Driver value */
5760  rc = RegSetValueExW(hDeviceKey, REGSTR_VAL_DRIVER, 0, REG_SZ, (const BYTE *)DriverKey, (strlenW(DriverKey) + 1) * sizeof(WCHAR));
5761  if (rc != ERROR_SUCCESS)
5762  {
5763  SetLastError(rc);
5764  goto cleanup;
5765  }
5766  }
5767  else
5768  {
5769  /* Open the existing driver key */
5770 
5771  DriverKey = HeapAlloc(GetProcessHeap(), 0, dwSize);
5772  if (!DriverKey)
5773  {
5775  goto cleanup;
5776  }
5777 
5778  rc = RegQueryValueExW(hDeviceKey, REGSTR_VAL_DRIVER, NULL, NULL, (LPBYTE)DriverKey, &dwSize);
5779  if (rc != ERROR_SUCCESS)
5780  {
5781  SetLastError(rc);
5782  goto cleanup;
5783  }
5784 
5785  rc = RegCreateKeyExW(hClassKey,
5786  DriverKey,
5787  0,
5788  NULL,
5790 #if _WIN32_WINNT >= 0x502
5791  KEY_READ | KEY_WRITE,
5792 #else
5794 #endif
5795  NULL,
5796  &hKey,
5797  &Disposition);
5798  if (rc != ERROR_SUCCESS)
5799  {
5800  SetLastError(rc);
5801  goto cleanup;
5802  }
5803  }
5804 
5805  key = hKey;
5806 
5807 cleanup:
5808  if (lpGuidString)
5809  RpcStringFreeW(&lpGuidString);
5810  HeapFree(GetProcessHeap(), 0, DriverKey);
5811  if (hHWProfileKey != INVALID_HANDLE_VALUE)
5812  RegCloseKey(hHWProfileKey);
5813  if (hEnumKey != NULL)
5814  RegCloseKey(hEnumKey);
5815  if (hClassKey != NULL)
5816  RegCloseKey(hClassKey);
5817  if (hDeviceKey != INVALID_HANDLE_VALUE)
5818  RegCloseKey(hDeviceKey);
5819  if (hKey != NULL && hKey != key)
5820  RegCloseKey(hKey);
5821 
5822  TRACE("Returning 0x%p\n", hKey);
5823  return hKey;
5824 }
HKEY SETUPDI_OpenDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5826
#define _WIN32_WINNT
Definition: precomp.h:14
#define REGSTR_VAL_DRIVER
Definition: regstr.h:385
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static PMEMKEY RootKey
Definition: registry.c:55
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
static const WCHAR InstanceKeyFormat[]
Definition: devinst.c:31
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD DWORD
Definition: winlogon.h:84
_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 UNICODE_NULL
static HKEY hEnumKey
Definition: umpnpmgr.c:65
smooth NULL
Definition: ftsmooth.c:416
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
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
#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
HANDLE HKEY
Definition: registry.h:24
static const UCHAR Index[8]
Definition: usbohci.c:18
#define SetLastError(x)
Definition: compat.h:409
RPC_STATUS WINAPI UuidToStringW(UUID *Uuid, RPC_WSTR *StringUuid)
Definition: rpcrt4_main.c:541
unsigned char BYTE
Definition: ntddk_ex.h:96
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define sprintfW
Definition: unicode.h:58
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 KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define HeapFree(x, y, z)
Definition: compat.h:394
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: path.c:42
static HKEY hClassKey
Definition: umpnpmgr.c:66
#define REGSTR_PATH_CLASS_NT
Definition: regstr.h:479
#define REG_SZ
Definition: layer.c:22
DWORD dwSize
Definition: wglext.h:734
static BOOL SETUPDI_DeleteDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo 
)
static

Definition at line 6003 of file devinst.c.

Referenced by SetupDiDeleteDevRegKey().

6004 {
6005  FIXME("\n");
6006  return FALSE;
6007 }
#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 6009 of file devinst.c.

Referenced by SetupDiDeleteDevRegKey().

6010 {
6011  FIXME("\n");
6012  return FALSE;
6013 }
#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
HKEY SETUPDI_OpenDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)

Definition at line 5826 of file devinst.c.

Referenced by IntSetupDiSetDeviceRegistryPropertyAW(), SETUPDI_CreateDrvKey(), SETUPDI_OpenDrvKey(), SetupDiGetDeviceRegistryPropertyW(), SetupDiInstallDevice(), and SetupDiOpenDevRegKey().

5827 {
5828  HKEY enumKey, key = INVALID_HANDLE_VALUE;
5829  LONG l;
5830 
5832  if (!l)
5833  {
5834  l = RegOpenKeyExW(enumKey, devInfo->instanceId, 0, samDesired, &key);
5835  RegCloseKey(enumKey);
5836  }
5837  if (l)
5838  SetLastError(l);
5839  return key;
5840 }
static PMEMKEY RootKey
Definition: registry.c:55
#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
HKEY SETUPDI_OpenDrvKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)

Definition at line 5842 of file devinst.c.

Referenced by SetupDiBuildDriverInfoList(), SetupDiCallClassInstaller(), SetupDiChangeState(), SetupDiGetClassDevPropertySheetsW(), SetupDiInstallDevice(), SetupDiOpenDevRegKey(), and SetupDiRegisterCoDeviceInstallers().

5843 {
5844  LPWSTR DriverKey = NULL;
5845  DWORD dwLength = 0;
5846  DWORD dwRegType;
5847  DWORD rc;
5848  HKEY hEnumKey = NULL;
5849  HKEY hKey = NULL;
5851 
5852  hKey = SETUPDI_OpenDevKey(RootKey, devInfo, KEY_QUERY_VALUE);
5853  if (hKey == INVALID_HANDLE_VALUE)
5854  goto cleanup;
5855  /* Read the 'Driver' key */
5856  rc = RegQueryValueExW(hKey, REGSTR_VAL_DRIVER, NULL, &dwRegType, NULL, &dwLength);
5857  if (rc != ERROR_SUCCESS)
5858  {
5859  SetLastError(rc);
5860  goto cleanup;
5861  }
5862  else if (dwRegType != REG_SZ)
5863  {
5865  goto cleanup;
5866  }
5867  DriverKey = HeapAlloc(GetProcessHeap(), 0, dwLength);
5868  if (!DriverKey)
5869  {
5871  goto cleanup;
5872  }
5873  rc = RegQueryValueExW(hKey, REGSTR_VAL_DRIVER, NULL, &dwRegType, (LPBYTE)DriverKey, &dwLength);
5874  if (rc != ERROR_SUCCESS)
5875  {
5876  SetLastError(rc);
5877  goto cleanup;
5878  }
5879  RegCloseKey(hKey);
5880  hKey = NULL;
5881  /* Need to open the driver key */
5882  rc = RegOpenKeyExW(
5883  RootKey,
5885  0, /* Options */
5886  READ_CONTROL,
5887  &hEnumKey);
5888  if (rc != ERROR_SUCCESS)
5889  {
5890  SetLastError(rc);
5891  goto cleanup;
5892  }
5893  rc = RegOpenKeyExW(
5894  hEnumKey,
5895  DriverKey,
5896  0, /* Options */
5897  samDesired,
5898  &hKey);
5899  if (rc != ERROR_SUCCESS)
5900  {
5901  SetLastError(rc);
5902  goto cleanup;
5903  }
5904  key = hKey;
5905 
5906 cleanup:
5907  if (hEnumKey != NULL)
5908  RegCloseKey(hEnumKey);
5909  if (hKey != NULL && hKey != key)
5910  RegCloseKey(hKey);
5911  if (DriverKey)
5912  HeapFree(GetProcessHeap(), 0, DriverKey);
5913  return key;
5914 }
HKEY SETUPDI_OpenDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5826
#define REGSTR_VAL_DRIVER
Definition: regstr.h:385
static PMEMKEY RootKey
Definition: registry.c:55
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned char * LPBYTE
Definition: typedefs.h:52
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD DWORD
Definition: winlogon.h:84
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:84
_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:3667
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 4029 of file devinst.c.

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

4033 {
4034  BOOL ret = FALSE;
4035 
4036  TRACE("%u %p %p\n", InstallFunction, DeviceInfoSet, DeviceInfoData);
4037 
4038  if (!DeviceInfoSet)
4044  else if (((struct DeviceInfoSet *)DeviceInfoSet)->HKLM != HKEY_LOCAL_MACHINE)
4046  else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4048  else
4049  {
4051 #define CLASS_COINSTALLER 0x1
4052 #define DEVICE_COINSTALLER 0x2
4053 #define CLASS_INSTALLER 0x4
4054  UCHAR CanHandle = 0;
4055  DEFAULT_CLASS_INSTALL_PROC DefaultHandler = NULL;
4056 
4057  switch (InstallFunction)
4058  {
4061  break;
4064  break;
4065  case DIF_ALLOW_INSTALL:
4066  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4067  break;
4068  case DIF_DETECT:
4069  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4070  break;
4072  CanHandle = CLASS_INSTALLER;
4073  break;
4074  case DIF_INSTALLDEVICE:
4076  DefaultHandler = SetupDiInstallDevice;
4077  break;
4079  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4080  DefaultHandler = SetupDiInstallDriverFiles;
4081  break;
4082  case DIF_INSTALLINTERFACES:
4084  DefaultHandler = SetupDiInstallDeviceInterfaces;
4085  break;
4088  break;
4090  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4091  break;
4093  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4094  break;
4096  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4097  break;
4099  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4100  break;
4101  case DIF_POWERMESSAGEWAKE:
4103  break;
4104  case DIF_PROPERTYCHANGE:
4106  DefaultHandler = SetupDiChangeState;
4107  break;
4109  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4110  DefaultHandler = SetupDiRegisterCoDeviceInstallers;
4111  break;
4112  case DIF_REGISTERDEVICE:
4113  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4114  DefaultHandler = IntSetupDiRegisterDeviceInfo;
4115  break;
4116  case DIF_REMOVE:
4118  DefaultHandler = SetupDiRemoveDevice;
4119  break;
4121  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4122  DefaultHandler = SetupDiSelectBestCompatDrv;
4123  break;
4124  case DIF_SELECTDEVICE:
4125  CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4126  DefaultHandler = SetupDiSelectDevice;
4127  break;
4128  case DIF_TROUBLESHOOTER:
4130  break;
4131  case DIF_UNREMOVE:
4133  DefaultHandler = SetupDiUnremoveDevice;
4134  break;
4135  default:
4136  ERR("Install function %u not supported\n", InstallFunction);
4138  }
4139 
4140  InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
4141  if (!SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams))
4142  /* Don't process this call, as a parameter is invalid */
4143  CanHandle = 0;
4144 
4145  if (CanHandle != 0)
4146  {
4147  LIST_ENTRY ClassCoInstallersListHead;
4148  LIST_ENTRY DeviceCoInstallersListHead;
4149  HMODULE ClassInstallerLibrary = NULL;
4150  CLASS_INSTALL_PROC ClassInstaller = NULL;
4153  HKEY hKey;
4154  DWORD dwRegType, dwLength;
4155  DWORD rc = NO_ERROR;
4156 
4157  InitializeListHead(&ClassCoInstallersListHead);
4158  InitializeListHead(&DeviceCoInstallersListHead);
4159 
4160  if (CanHandle & DEVICE_COINSTALLER)
4161  {
4162  hKey = SETUPDI_OpenDrvKey(((struct DeviceInfoSet *)DeviceInfoSet)->HKLM, (struct DeviceInfo *)DeviceInfoData->Reserved, KEY_QUERY_VALUE);
4163  if (hKey != INVALID_HANDLE_VALUE)
4164  {
4165  rc = RegQueryValueExW(hKey, REGSTR_VAL_COINSTALLERS_32, NULL, &dwRegType, NULL, &dwLength);
4166  if (rc == ERROR_SUCCESS && dwRegType == REG_MULTI_SZ)
4167  {
4168  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4169  if (KeyBuffer != NULL)
4170  {
4171  rc = RegQueryValueExW(hKey, REGSTR_VAL_COINSTALLERS_32, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4172  if (rc == ERROR_SUCCESS)
4173  {
4174  LPWSTR ptr;
4175  for (ptr = KeyBuffer; *ptr; ptr += strlenW(ptr) + 1)
4176  {
4177  /* Add coinstaller to DeviceCoInstallersListHead list */
4178  struct CoInstallerElement *coinstaller;
4179  TRACE("Got device coinstaller '%s'\n", debugstr_w(ptr));
4180  coinstaller = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CoInstallerElement));
4181  if (!coinstaller)
4182  continue;
4183  ZeroMemory(coinstaller, sizeof(struct CoInstallerElement));
4184  if (GetFunctionPointer(ptr, &coinstaller->Module, (PVOID*)&coinstaller->Function) == ERROR_SUCCESS)
4185  InsertTailList(&DeviceCoInstallersListHead, &coinstaller->ListEntry);
4186  else
4187  HeapFree(GetProcessHeap(), 0, coinstaller);
4188  }
4189  }
4190  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4191  }
4192  }
4193  RegCloseKey(hKey);
4194  }
4195  }
4196  if (CanHandle & CLASS_COINSTALLER)
4197  {
4198  rc = RegOpenKeyExW(
4201  0, /* Options */
4203  &hKey);
4204  if (rc == ERROR_SUCCESS)
4205  {
4206  WCHAR szGuidString[40];
4207  if (pSetupStringFromGuid(&DeviceInfoData->ClassGuid, szGuidString, ARRAYSIZE(szGuidString)) == ERROR_SUCCESS)
4208  {
4209  rc = RegQueryValueExW(hKey, szGuidString, NULL, &dwRegType, NULL, &dwLength);
4210  if (rc == ERROR_SUCCESS && dwRegType == REG_MULTI_SZ)
4211  {
4212  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4213  if (KeyBuffer != NULL)
4214  {
4215  rc = RegQueryValueExW(hKey, szGuidString, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4216  if (rc == ERROR_SUCCESS)
4217  {
4218  LPWSTR ptr;
4219  for (ptr = KeyBuffer; *ptr; ptr += strlenW(ptr) + 1)
4220  {
4221  /* Add coinstaller to ClassCoInstallersListHead list */
4222  struct CoInstallerElement *coinstaller;
4223  TRACE("Got class coinstaller '%s'\n", debugstr_w(ptr));
4224  coinstaller = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CoInstallerElement));
4225  if (!coinstaller)
4226  continue;
4227  ZeroMemory(coinstaller, sizeof(struct CoInstallerElement));
4228  if (GetFunctionPointer(ptr, &coinstaller->Module, (PVOID*)&coinstaller->Function) == ERROR_SUCCESS)
4229  InsertTailList(&ClassCoInstallersListHead, &coinstaller->ListEntry);
4230  else
4231  HeapFree(GetProcessHeap(), 0, coinstaller);
4232  }
4233  }
4234  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4235  }
4236  }
4237  }
4238  RegCloseKey(hKey);
4239  }
4240  }
4241  if ((CanHandle & CLASS_INSTALLER) && !(InstallParams.FlagsEx & DI_FLAGSEX_CI_FAILED))
4242  {
4243  hKey = SetupDiOpenClassRegKey(&DeviceInfoData->ClassGuid, KEY_QUERY_VALUE);
4244  if (hKey != INVALID_HANDLE_VALUE)
4245  {
4246  rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, &dwRegType, NULL, &dwLength);
4247  if (rc == ERROR_SUCCESS && dwRegType == REG_SZ)
4248  {
4249  LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4250  if (KeyBuffer != NULL)
4251  {
4252  rc = RegQueryValueExW(hKey, REGSTR_VAL_INSTALLER_32, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4253  if (rc == ERROR_SUCCESS)
4254  {
4255  /* Get ClassInstaller function pointer */
4256  TRACE("Got class installer '%s'\n", debugstr_w(KeyBuffer));
4257  if (GetFunctionPointer(KeyBuffer, &ClassInstallerLibrary, (PVOID*)&ClassInstaller) != ERROR_SUCCESS)
4258  {
4259  InstallParams.FlagsEx |= DI_FLAGSEX_CI_FAILED;
4260  SetupDiSetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams);
4261  }
4262  }
4263  HeapFree(GetProcessHeap(), 0, KeyBuffer);
4264  }
4265  }
4266  RegCloseKey(hKey);
4267  }
4268  }
4269 
4270  /* Call Class co-installers */
4271  Context.PostProcessing = FALSE;
4272  rc = NO_ERROR;
4273  ListEntry = ClassCoInstallersListHead.Flink;
4274  while (rc == NO_ERROR && ListEntry != &ClassCoInstallersListHead)
4275  {
4276  struct CoInstallerElement *coinstaller;
4277  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4278  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4279  coinstaller->PrivateData = Context.PrivateData;
4281  {
4282  coinstaller->DoPostProcessing = TRUE;
4283  rc = NO_ERROR;
4284  }
4285  ListEntry = ListEntry->Flink;
4286  }
4287 
4288  /* Call Device co-installers */
4289  ListEntry = DeviceCoInstallersListHead.Flink;
4290  while (rc == NO_ERROR && ListEntry != &DeviceCoInstallersListHead)
4291  {
4292  struct CoInstallerElement *coinstaller;
4293  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4294  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4295  coinstaller->PrivateData = Context.PrivateData;
4297  {
4298  coinstaller->DoPostProcessing = TRUE;
4299  rc = NO_ERROR;
4300  }
4301  ListEntry = ListEntry->Flink;
4302  }
4303 
4304  /* Call Class installer */
4305  if (ClassInstaller)
4306  {
4307  rc = (*ClassInstaller)(InstallFunction, DeviceInfoSet, DeviceInfoData);
4308  FreeFunctionPointer(ClassInstallerLibrary, ClassInstaller);
4309  }
4310  else
4311  rc = ERROR_DI_DO_DEFAULT;
4312 
4313  /* Call default handler */
4314  if (rc == ERROR_DI_DO_DEFAULT)
4315  {
4316  if (DefaultHandler && !(InstallParams.Flags & DI_NODI_DEFAULTACTION))
4317  {
4318  if ((*DefaultHandler)(DeviceInfoSet, DeviceInfoData))
4319  rc = NO_ERROR;
4320  else
4321  rc = GetLastError();
4322  }
4323  else
4324  rc = NO_ERROR;
4325  }
4326 
4327  /* Call Class co-installers that required postprocessing */
4328  Context.PostProcessing = TRUE;
4329  ListEntry = ClassCoInstallersListHead.Flink;
4330  while (ListEntry != &ClassCoInstallersListHead)
4331  {
4332  struct CoInstallerElement *coinstaller;
4333  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4334  if (coinstaller->DoPostProcessing)
4335  {
4336  Context.InstallResult = rc;
4337  Context.PrivateData = coinstaller->PrivateData;
4338  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4339  }
4340  FreeFunctionPointer(coinstaller->Module, coinstaller->Function);
4341  ListEntry = ListEntry->Flink;
4342  }
4343 
4344  /* Call Device co-installers that required postprocessing */
4345  ListEntry = DeviceCoInstallersListHead.Flink;
4346  while (ListEntry != &DeviceCoInstallersListHead)
4347  {
4348  struct CoInstallerElement *coinstaller;
4349  coinstaller = CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry);
4350  if (coinstaller->DoPostProcessing)
4351  {
4352  Context.InstallResult = rc;
4353  Context.PrivateData = coinstaller->PrivateData;
4354  rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4355  }
4356  FreeFunctionPointer(coinstaller->Module, coinstaller->Function);
4357  ListEntry = ListEntry->Flink;
4358  }
4359 
4360  /* Free allocated memory */
4361  while (!IsListEmpty(&ClassCoInstallersListHead))
4362  {
4363  ListEntry = RemoveHeadList(&ClassCoInstallersListHead);
4364  HeapFree(GetProcessHeap(), 0, CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry));
4365  }
4366  while (!IsListEmpty(&DeviceCoInstallersListHead))
4367  {
4368  ListEntry = RemoveHeadList(&DeviceCoInstallersListHead);
4369  HeapFree(GetProcessHeap(), 0, CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry));
4370  }
4371 
4372  ret = (rc == NO_ERROR);
4373  }
4374  }
4375 
4376  TRACE("Returning %d\n", ret);
4377  return ret;
4378 }
DWORD *typedef PVOID
Definition: winlogon.h:61
#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:2057
#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:4563
__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:1059
#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:84
#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:5354
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:4456
static BOOL WINAPI IntSetupDiRegisterDeviceInfo(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4019
#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
ULONG_PTR Reserved
Definition: setupapi.h:833
PVOID PrivateData
Definition: devinst.c:64
static const WCHAR HKLM[]
Definition: reginf.c:58
#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:5200
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:5060
Definition: typedefs.h:117
HKEY SETUPDI_OpenDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5842
#define ERR(fmt,...)
Definition: debug.h:109
#define DIF_INSTALLINTERFACES
Definition: setupapi.h:151
BOOL WINAPI SetupDiSelectDevice(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: devinst.c:5186
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
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:2093
#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:3623
#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 5060 of file devinst.c.

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

5063 {
5064  struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5065  struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5066  PSP_PROPCHANGE_PARAMS PropChange;
5067  HKEY hRootKey = INVALID_HANDLE_VALUE, hKey = INVALID_HANDLE_VALUE;
5068  LPCWSTR RegistryValueName;
5069  DWORD dwConfigFlags, dwLength, dwRegType;
5070  LONG rc;
5071  BOOL ret = FALSE;
5072 
5073  TRACE("%p %p\n", DeviceInfoSet, DeviceInfoData);
5074 
5075  if (!DeviceInfoData)
5076  PropChange = ((struct DeviceInfoSet *)DeviceInfoSet)->ClassInstallParams.PropChangeParams;
5077  else
5078  PropChange = ((struct DeviceInfo *)DeviceInfoData->Reserved)->ClassInstallParams.PropChangeParams;
5079  if (!PropChange)
5080  {
5082  goto cleanup;
5083  }
5084 
5085  if (PropChange->Scope == DICS_FLAG_GLOBAL)
5086  RegistryValueName = REGSTR_VAL_CONFIGFLAGS;
5087  else
5088  RegistryValueName = REGSTR_VAL_CSCONFIGFLAGS;
5089 
5090  switch (PropChange->StateChange)
5091  {
5092  case DICS_ENABLE:
5093  case DICS_DISABLE:
5094  {
5095  if (PropChange->Scope == DICS_FLAG_GLOBAL)
5096  hRootKey = set->HKLM;
5097  else /* PropChange->Scope == DICS_FLAG_CONFIGSPECIFIC */
5098  {
5099  hRootKey = OpenHardwareProfileKey(set->HKLM, PropChange->HwProfile, KEY_CREATE_SUB_KEY);
5100  if (hRootKey == INVALID_HANDLE_VALUE)
5101  goto cleanup;
5102  }
5103 
5104  /* Enable/disable device in registry */
5105  hKey = SETUPDI_OpenDrvKey(hRootKey, deviceInfo, KEY_QUERY_VALUE | KEY_SET_VALUE);
5107  hKey = SETUPDI_CreateDevKey(hRootKey, deviceInfo, KEY_QUERY_VALUE | KEY_SET_VALUE);
5108  if (hKey == INVALID_HANDLE_VALUE)
5109  break;
5110  dwLength = sizeof(DWORD);
5111  rc = RegQueryValueExW(
5112  hKey,
5113  RegistryValueName,
5114  NULL,
5115  &dwRegType,
5116  (LPBYTE)&dwConfigFlags, &dwLength);
5117  if (rc == ERROR_FILE_NOT_FOUND)
5118  dwConfigFlags = 0;
5119  else if (rc != ERROR_SUCCESS)
5120  {
5121  SetLastError(rc);
5122  goto cleanup;
5123  }
5124  else if (dwRegType != REG_DWORD || dwLength != sizeof(DWORD))
5125  {
5127  goto cleanup;
5128  }
5129  if (PropChange->StateChange == DICS_ENABLE)
5130  dwConfigFlags &= ~(PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED);
5131  else
5132  dwConfigFlags |= (PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED);
5133  rc = RegSetValueExW(
5134  hKey,
5135  RegistryValueName,
5136  0,
5137  REG_DWORD,
5138  (LPBYTE)&dwConfigFlags, sizeof(DWORD));
5139  if (rc != ERROR_SUCCESS)
5140  {
5141  SetLastError(rc);
5142  goto cleanup;
5143  }
5144 
5145  /* Enable/disable device if needed */
5146  if (PropChange->Scope == DICS_FLAG_GLOBAL
5147  || PropChange->HwProfile == 0
5148  || PropChange->HwProfile == SETUPAPI_GetCurrentHwProfile(DeviceInfoSet))
5149  {
5150  if (PropChange->StateChange == DICS_ENABLE)
5152  else
5154  }
5155  else
5156  ret = TRUE;
5157  break;
5158  }
5159  case DICS_PROPCHANGE:
5160  {
5162  break;
5163  }
5164  default:
5165  {
5166  ERR("Unknown StateChange 0x%lx\n", PropChange->StateChange);
5168  }
5169  }
5170 
5171 cleanup:
5172  if (hRootKey != INVALID_HANDLE_VALUE && hRootKey != set->HKLM)
5173  RegCloseKey(hRootKey);
5174 
5175  if (hKey != INVALID_HANDLE_VALUE)
5176  RegCloseKey(hKey);
5177 
5178  TRACE("Returning %d\n", ret);
5179  return ret;
5180 }
#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:4978
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#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:84
HKEY SETUPDI_CreateDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5656
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
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
BOOLEAN ResetDevice(IN LPCWSTR DeviceId)
Definition: devinst.c:19
#define SetLastError(x)
Definition: compat.h:409
static HKEY OpenHardwareProfileKey(IN HKEY HKLM, IN DWORD HwProfile, IN DWORD samDesired)
Definition: devinst.c:4640
int ret
HKEY SETUPDI_OpenDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5842
#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
Definition: _set.h:46
#define REG_DWORD
Definition: sdbapi.c:539
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
static BOOL StopDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5048
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:84
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:3667
#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:66
#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:84
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
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
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:3667
#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 1537 of file devinst.c.

1545 {
1546  BOOL ret;
1547  LPWSTR DeviceNameW = NULL;
1548  LPWSTR DeviceDescriptionW = NULL;
1549 
1550  TRACE("\n");
1551 
1552  if (DeviceName)
1553  {
1554  DeviceNameW = pSetupMultiByteToUnicode(DeviceName, CP_ACP);
1555  if (DeviceNameW == NULL) return FALSE;
1556  }
1557  if (DeviceDescription)
1558  {
1559  DeviceDescriptionW = pSetupMultiByteToUnicode(DeviceDescription, CP_ACP);
1560  if (DeviceDescriptionW == NULL)
1561  {
1562  MyFree(DeviceNameW);
1563  return FALSE;
1564  }
1565  }
1566 
1567  ret = SetupDiCreateDeviceInfoW(DeviceInfoSet, DeviceNameW, ClassGuid, DeviceDescriptionW,
1568  hwndParent, CreationFlags, DeviceInfoData);
1569 
1570  MyFree(DeviceNameW);
1571  MyFree(DeviceDescriptionW);
1572 
1573  return ret;
1574 }
#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:1579
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(), InstallDevInstEx(), 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)