ReactOS 0.4.17-dev-470-gf9e3448
devinst.c File Reference
#include "setupapi_private.h"
#include <pseh/pseh2.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 DWORD(CALLBACKCLASS_INSTALL_PROC) (IN DI_FUNCTION InstallFunction, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
 
typedef BOOL(WINAPIDEFAULT_CLASS_INSTALL_PROC) (IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
 
typedef DWORD(CALLBACKCOINSTALLER_PROC) (IN DI_FUNCTION InstallFunction, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN OUT PCOINSTALLER_CONTEXT_DATA Context)
 

Functions

static void SETUPDI_GuidToString (const GUID *guid, LPWSTR guidStr)
 
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)
 
BOOL WINAPI SetupDiRestartDevices (HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
 
BOOL WINAPI SetupDiGetCustomDevicePropertyA (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN PCSTR CustomPropertyName, IN DWORD Flags, OUT PDWORD PropertyRegDataType OPTIONAL, OUT PBYTE PropertyBuffer, IN DWORD PropertyBufferSize, OUT PDWORD RequiredSize OPTIONAL)
 
BOOL WINAPI SetupDiGetCustomDevicePropertyW (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN PCWSTR CustomPropertyName, IN DWORD Flags, OUT PDWORD PropertyRegDataType OPTIONAL, OUT PBYTE PropertyBuffer, IN DWORD PropertyBufferSize, OUT PDWORD RequiredSize OPTIONAL)
 

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

◆ CLASS_COINSTALLER

#define CLASS_COINSTALLER   0x1

◆ CLASS_INSTALLER

#define CLASS_INSTALLER   0x4

◆ DEVICE_COINSTALLER

#define DEVICE_COINSTALLER   0x2

Typedef Documentation

◆ CLASS_INSTALL_PROC

typedef DWORD(CALLBACK * CLASS_INSTALL_PROC) (IN DI_FUNCTION InstallFunction, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)

Definition at line 43 of file devinst.c.

◆ COINSTALLER_PROC

Definition at line 52 of file devinst.c.

◆ DEFAULT_CLASS_INSTALL_PROC

typedef BOOL(WINAPI * DEFAULT_CLASS_INSTALL_PROC) (IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)

Definition at line 48 of file devinst.c.

Function Documentation

◆ CheckDeviceInstallParameters()

static BOOL CheckDeviceInstallParameters ( IN PSP_DEVINSTALL_PARAMS_W  DeviceInstallParams)
static

Definition at line 4545 of file devinst.c.

4547{
4548 DWORD SupportedFlags =
4549 DI_NOVCP | /* 0x00000008 */
4550 DI_DIDCOMPAT | /* 0x00000010 */
4551 DI_DIDCLASS | /* 0x00000020 */
4552 DI_NEEDRESTART | /* 0x00000080 */
4553 DI_NEEDREBOOT | /* 0x00000100 */
4554 DI_RESOURCEPAGE_ADDED | /* 0x00002000 */
4555 DI_PROPERTIES_CHANGE | /* 0x00004000 */
4556 DI_ENUMSINGLEINF | /* 0x00010000 */
4557 DI_DONOTCALLCONFIGMG | /* 0x00020000 */
4558 DI_CLASSINSTALLPARAMS | /* 0x00100000 */
4559 DI_NODI_DEFAULTACTION | /* 0x00200000 */
4560 DI_QUIETINSTALL | /* 0x00800000 */
4561 DI_NOFILECOPY | /* 0x01000000 */
4562 DI_DRIVERPAGE_ADDED; /* 0x04000000 */
4563 DWORD SupportedFlagsEx =
4564 DI_FLAGSEX_CI_FAILED | /* 0x00000004 */
4565 DI_FLAGSEX_DIDINFOLIST | /* 0x00000010 */
4566 DI_FLAGSEX_DIDCOMPATINFO | /* 0x00000020 */
4567 DI_FLAGSEX_ALLOWEXCLUDEDDRVS | /* 0x00000800 */
4568 DI_FLAGSEX_NO_DRVREG_MODIFY | /* 0x00008000 */
4569 DI_FLAGSEX_INSTALLEDDRIVER; /* 0x04000000 */
4570 BOOL ret = FALSE;
4571
4572 /* FIXME: add support for more flags */
4573
4574 /* FIXME: DI_CLASSINSTALLPARAMS flag is not correctly used.
4575 * It should be checked before accessing to other values
4576 * of the SP_DEVINSTALL_PARAMS structure */
4577
4578 if (DeviceInstallParams->Flags & ~SupportedFlags)
4579 {
4580 FIXME("Unknown Flags: 0x%08lx\n", DeviceInstallParams->Flags & ~SupportedFlags);
4582 }
4583 else if (DeviceInstallParams->FlagsEx & ~SupportedFlagsEx)
4584 {
4585 FIXME("Unknown FlagsEx: 0x%08lx\n", DeviceInstallParams->FlagsEx & ~SupportedFlagsEx);
4587 }
4588 else if ((DeviceInstallParams->Flags & DI_NOVCP)
4589 && (DeviceInstallParams->FileQueue == NULL || DeviceInstallParams->FileQueue == (HSPFILEQ)INVALID_HANDLE_VALUE))
4591 else
4592 {
4593 /* FIXME: check Reserved field */
4594 ret = TRUE;
4595 }
4596
4597 return ret;
4598}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DI_FLAGSEX_CI_FAILED
Definition: setupapi.h:81
#define DI_FLAGSEX_NO_DRVREG_MODIFY
Definition: setupapi.h:93
#define DI_NEEDRESTART
Definition: setupapi.h:55
#define DI_DIDCOMPAT
Definition: setupapi.h:52
#define DI_NODI_DEFAULTACTION
Definition: setupapi.h:69
#define DI_NOVCP
Definition: setupapi.h:51
#define DI_CLASSINSTALLPARAMS
Definition: setupapi.h:68
#define DI_QUIETINSTALL
Definition: setupapi.h:70
#define DI_RESOURCEPAGE_ADDED
Definition: setupapi.h:61
#define DI_FLAGSEX_DIDCOMPATINFO
Definition: setupapi.h:83
#define DI_ENUMSINGLEINF
Definition: setupapi.h:64
#define DI_DRIVERPAGE_ADDED
Definition: setupapi.h:73
#define DI_FLAGSEX_DIDINFOLIST
Definition: setupapi.h:82
#define DI_NEEDREBOOT
Definition: setupapi.h:56
#define DI_NOFILECOPY
Definition: setupapi.h:71
#define DI_PROPERTIES_CHANGE
Definition: setupapi.h:62
#define DI_FLAGSEX_ALLOWEXCLUDEDDRVS
Definition: setupapi.h:89
#define DI_DIDCLASS
Definition: setupapi.h:53
#define DI_DONOTCALLCONFIGMG
Definition: setupapi.h:65
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1448
#define ERROR_INVALID_FLAGS
Definition: winerror.h:907

Referenced by SetupDiSetDeviceInstallParamsW().

◆ CheckSectionValid()

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 124 of file devinst.c.

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

Referenced by GetSectionCallback().

◆ CreateDeviceInfo()

BOOL CreateDeviceInfo ( IN struct DeviceInfoSet list,
IN LPCWSTR  InstancePath,
IN LPCGUID  pClassGuid,
OUT struct DeviceInfo **  pDeviceInfo 
)

Definition at line 528 of file devinst.c.

533{
534 DWORD size;
535 CONFIGRET cr;
536 struct DeviceInfo *deviceInfo;
537
538 *pDeviceInfo = NULL;
539
540 size = FIELD_OFFSET(struct DeviceInfo, Data) + (strlenW(InstancePath) + 1) * sizeof(WCHAR);
541 deviceInfo = HeapAlloc(GetProcessHeap(), 0, size);
542 if (!deviceInfo)
543 {
545 return FALSE;
546 }
547 ZeroMemory(deviceInfo, size);
548
549 cr = CM_Locate_DevNode_ExW(&deviceInfo->dnDevInst, (DEVINSTID_W)InstancePath, CM_LOCATE_DEVNODE_PHANTOM, list->hMachine);
550 if (cr != CR_SUCCESS)
551 {
553 return FALSE;
554 }
555
556 deviceInfo->set = list;
557 deviceInfo->InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
558 strcpyW(deviceInfo->Data, InstancePath);
559 deviceInfo->instanceId = deviceInfo->Data;
560 deviceInfo->UniqueId = strrchrW(deviceInfo->Data, '\\');
561 deviceInfo->DeviceDescription = NULL;
562 memcpy(&deviceInfo->ClassGuid, pClassGuid, sizeof(GUID));
563 deviceInfo->CreationFlags = 0;
566
567 *pDeviceInfo = deviceInfo;
568 return TRUE;
569}
_Null_terminated_ WCHAR * DEVINSTID_W
Definition: cfgmgr32.h:80
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define CM_LOCATE_DEVNODE_PHANTOM
Definition: cfgmgr32.h:761
CONFIGRET WINAPI CM_Locate_DevNode_ExW(_Out_ PDEVINST pdnDevInst, _In_opt_ DEVINSTID_W pDeviceID, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:6077
Definition: list.h:37
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
DWORD GetErrorCodeFromCrCode(const IN CONFIGRET cr)
Definition: devinst.c:94
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
GLsizeiptr size
Definition: glext.h:5919
#define ZeroMemory
Definition: minwinbase.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define list
Definition: rosglue.h:35
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
PCWSTR DeviceDescription
LIST_ENTRY InterfaceListHead
WCHAR Data[ANYSIZE_ARRAY]
DEVINST dnDevInst
SP_DEVINSTALL_PARAMS_W InstallParams
LIST_ENTRY DriverListHead
struct DeviceInfoSet * set
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define strrchrW(s, c)
Definition: unicode.h:35
#define strcpyW(d, s)
Definition: unicode.h:29

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

◆ DestroyClassInstallParams()

static BOOL DestroyClassInstallParams ( struct ClassInstallParams installParams)
static

Definition at line 573 of file devinst.c.

574{
575 HeapFree(GetProcessHeap(), 0, installParams->PropChangeParams);
576 HeapFree(GetProcessHeap(), 0, installParams->AddPropertyPageData);
577 return TRUE;
578}
#define HeapFree(x, y, z)
Definition: compat.h:735
PSP_PROPCHANGE_PARAMS PropChangeParams
PSP_ADDPROPERTYPAGE_DATA AddPropertyPageData

Referenced by DestroyDeviceInfo(), and DestroyDeviceInfoSet().

◆ DestroyDeviceInfo()

static BOOL DestroyDeviceInfo ( struct DeviceInfo deviceInfo)
static

Definition at line 581 of file devinst.c.

582{
583 PLIST_ENTRY ListEntry;
584 struct DriverInfoElement *driverInfo;
585 struct DeviceInterface *deviceInterface;
586
587 while (!IsListEmpty(&deviceInfo->DriverListHead))
588 {
591 if (!DestroyDriverInfoElement(driverInfo))
592 return FALSE;
593 }
594 while (!IsListEmpty(&deviceInfo->InterfaceListHead))
595 {
597 deviceInterface = CONTAINING_RECORD(ListEntry, struct DeviceInterface, ListEntry);
598 if (!DestroyDeviceInterface(deviceInterface))
599 return FALSE;
600 }
602 if (deviceInfo->hmodDevicePropPageProvider)
604 return HeapFree(GetProcessHeap(), 0, deviceInfo);
605}
#define FreeLibrary(x)
Definition: compat.h:748
static BOOL DestroyClassInstallParams(struct ClassInstallParams *installParams)
Definition: devinst.c:573
BOOL DestroyDriverInfoElement(struct DriverInfoElement *driverInfo)
Definition: driver.c:94
BOOL DestroyDeviceInterface(struct DeviceInterface *deviceInterface)
Definition: interface.c:61
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
struct ClassInstallParams ClassInstallParams
HMODULE hmodDevicePropPageProvider
LIST_ENTRY ListEntry
Definition: typedefs.h:120
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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

◆ DestroyDeviceInfoSet()

static BOOL DestroyDeviceInfoSet ( struct DeviceInfoSet list)
static

Definition at line 608 of file devinst.c.

609{
610 PLIST_ENTRY ListEntry;
611 struct DeviceInfo *deviceInfo;
612
613 while (!IsListEmpty(&list->ListHead))
614 {
615 ListEntry = RemoveHeadList(&list->ListHead);
616 deviceInfo = CONTAINING_RECORD(ListEntry, struct DeviceInfo, ListEntry);
617 if (!DestroyDeviceInfo(deviceInfo))
618 return FALSE;
619 }
620 if (list->HKLM != HKEY_LOCAL_MACHINE)
621 RegCloseKey(list->HKLM);
622 CM_Disconnect_Machine(list->hMachine);
623 DestroyClassInstallParams(&list->ClassInstallParams);
624 if (list->hmodClassPropPageProvider)
625 FreeLibrary(list->hmodClassPropPageProvider);
626 return HeapFree(GetProcessHeap(), 0, list);
627}
#define RegCloseKey(hKey)
Definition: registry.h:49
CONFIGRET WINAPI CM_Disconnect_Machine(_In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:1892
static BOOL DestroyDeviceInfo(struct DeviceInfo *deviceInfo)
Definition: devinst.c:581
LIST_ENTRY ListEntry
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by SetupDiDestroyDeviceInfoList().

◆ GetErrorCodeFromCrCode()

DWORD GetErrorCodeFromCrCode ( const IN CONFIGRET  cr)

Definition at line 94 of file devinst.c.

95{
96 switch (cr)
97 {
101 case CR_FAILURE: return ERROR_GEN_FAILURE;
115 case CR_SUCCESS: return ERROR_SUCCESS;
116 default: return ERROR_GEN_FAILURE;
117 }
118
119 /* Does not happen */
120}
#define CR_INVALID_PROPERTY
Definition: cfgmgr32.h:899
#define CR_INVALID_DATA
Definition: cfgmgr32.h:877
#define CR_INVALID_DEVICE_ID
Definition: cfgmgr32.h:876
#define CR_OUT_OF_MEMORY
Definition: cfgmgr32.h:844
#define CR_FAILURE
Definition: cfgmgr32.h:865
#define CR_ACCESS_DENIED
Definition: cfgmgr32.h:897
#define CR_INVALID_MACHINENAME
Definition: cfgmgr32.h:893
#define CR_INVALID_FLAG
Definition: cfgmgr32.h:846
#define CR_ALREADY_SUCH_DEVINST
Definition: cfgmgr32.h:862
#define CR_NO_SUCH_DEVNODE
Definition: cfgmgr32.h:857
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
#define CR_CALL_NOT_IMPLEMENTED
Definition: cfgmgr32.h:898
#define CR_INVALID_POINTER
Definition: cfgmgr32.h:845
#define CR_NO_SUCH_VALUE
Definition: cfgmgr32.h:883
#define CR_NO_SUCH_REGISTRY_KEY
Definition: cfgmgr32.h:892
#define CR_INVALID_DEVNODE
Definition: cfgmgr32.h:847
#define CR_REGISTRY_ERROR
Definition: cfgmgr32.h:875
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ERROR_DEVINST_ALREADY_EXISTS
Definition: setupapi.h:306
#define ERROR_GEN_FAILURE
Definition: winerror.h:256
#define ERROR_INVALID_COMPUTERNAME
Definition: winerror.h:1042

Referenced by CreateDeviceInfo(), ResetDevice(), SETUP_CreateDevicesList(), SetupDiBuildClassInfoListExW(), SetupDiCreateDeviceInfoListExW(), SetupDiCreateDeviceInfoW(), SetupDiGetClassRegistryPropertyA(), SetupDiGetClassRegistryPropertyW(), SetupDiGetCustomDevicePropertyA(), SetupDiGetCustomDevicePropertyW(), SetupDiRestartDevices(), SetupDiSetClassRegistryPropertyA(), SetupDiSetClassRegistryPropertyW(), and StopDevice().

◆ GetSectionCallback()

static BOOL GetSectionCallback ( IN LPCWSTR  SectionName,
IN PVOID  Context 
)
static

Definition at line 365 of file devinst.c.

368{
370 DWORD Score1, Score2, Score3, Score4, Score5;
371 BOOL ret;
372
373 if (SectionName[info->PrefixLength] != '.')
374 return TRUE;
375
377 &SectionName[info->PrefixLength],
378 info->PlatformInfo,
379 info->ProductType,
380 info->SuiteMask,
381 &Score1, &Score2, &Score3, &Score4, &Score5);
382 if (!ret)
383 {
384 TRACE("Section %s not compatible\n", debugstr_w(SectionName));
385 return TRUE;
386 }
387 if (Score1 > info->BestScore1) goto done;
388 if (Score1 < info->BestScore1) goto bettersection;
389 if (Score2 > info->BestScore2) goto done;
390 if (Score2 < info->BestScore2) goto bettersection;
391 if (Score3 > info->BestScore3) goto done;
392 if (Score3 < info->BestScore3) goto bettersection;
393 if (Score4 > info->BestScore4) goto done;
394 if (Score4 < info->BestScore4) goto bettersection;
395 if (Score5 > info->BestScore5) goto done;
396 if (Score5 < info->BestScore5) goto bettersection;
397 goto done;
398
399bettersection:
400 strcpyW(info->BestSection, SectionName);
401 info->BestScore1 = Score1;
402 info->BestScore2 = Score2;
403 info->BestScore3 = Score3;
404 info->BestScore4 = Score4;
405 info->BestScore5 = Score5;
406
407done:
408 return TRUE;
409}
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:124
_In_ PVOID Context
Definition: storport.h:2269

Referenced by SetupDiGetActualSectionToInstallExW().

◆ InfIsFromOEMLocation()

static BOOL InfIsFromOEMLocation ( IN PCWSTR  FullName,
OUT LPBOOL  IsOEMLocation 
)
static

Definition at line 5357 of file devinst.c.

5360{
5361 PWCHAR last;
5362
5363 last = strrchrW(FullName, '\\');
5364 if (!last)
5365 {
5366 /* No directory specified */
5367 *IsOEMLocation = FALSE;
5368 }
5369 else
5370 {
5371 LPWSTR Windir;
5372 UINT ret;
5373
5374 Windir = MyMalloc((MAX_PATH + 1 + strlenW(InfDirectory)) * sizeof(WCHAR));
5375 if (!Windir)
5376 {
5378 return FALSE;
5379 }
5380
5382 if (ret == 0 || ret > MAX_PATH)
5383 {
5384 MyFree(Windir);
5386 return FALSE;
5387 }
5388 if (*Windir && Windir[strlenW(Windir) - 1] != '\\')
5389 strcatW(Windir, BackSlash);
5390 strcatW(Windir, InfDirectory);
5391
5392 if (strncmpiW(FullName, Windir, last - FullName) == 0)
5393 {
5394 /* The path is %SYSTEMROOT%\Inf */
5395 *IsOEMLocation = FALSE;
5396 }
5397 else
5398 {
5399 /* The file is in another place */
5400 *IsOEMLocation = TRUE;
5401 }
5402 MyFree(Windir);
5403 }
5404 return TRUE;
5405}
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2316
static const WCHAR BackSlash[]
Definition: devinst.c:27
static const WCHAR InfDirectory[]
Definition: devinst.c:32
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
unsigned int UINT
Definition: sysinfo.c:13
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
Definition: sync.c:64
uint16_t * PWCHAR
Definition: typedefs.h:56
#define strcatW(d, s)
Definition: unicode.h:30
_In_ PSTRING FullName
Definition: rtlfuncs.h:1665

Referenced by SetupDiInstallDevice().

◆ IntSetupDiRegisterDeviceInfo()

static BOOL WINAPI IntSetupDiRegisterDeviceInfo ( IN HDEVINFO  DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 4060 of file devinst.c.

4063{
4065}
BOOL WINAPI SetupDiRegisterDeviceInfo(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Flags, PSP_DETSIG_CMPPROC CompareProc, PVOID CompareContext, PSP_DEVINFO_DATA DupDeviceInfoData)
Definition: devinst.c:1711
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1531

Referenced by SetupDiCallClassInstaller().

◆ IntSetupDiSetDeviceRegistryPropertyAW()

BOOL WINAPI IntSetupDiSetDeviceRegistryPropertyAW ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Property,
const BYTE PropertyBuffer,
DWORD  PropertyBufferSize,
BOOL  isAnsi 
)

Definition at line 3404 of file devinst.c.

3411{
3412 BOOL ret = FALSE;
3413 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
3414 struct DeviceInfo *deviceInfo;
3415
3416 TRACE("%s(%p %p %d %p %d)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData, Property,
3418
3420 {
3422 return FALSE;
3423 }
3424 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
3425 {
3427 return FALSE;
3428 }
3431 {
3433 return FALSE;
3434 }
3435
3436 deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
3437
3438 if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0])
3440 && PropertyMap[Property].nameA)
3441 {
3442 HKEY hKey;
3443 LONG l;
3444 hKey = SETUPDI_OpenDevKey(set->HKLM, deviceInfo, KEY_SET_VALUE);
3446 return FALSE;
3447 /* Write new data */
3448 if (isAnsi)
3449 {
3450 l = RegSetValueExA(
3451 hKey, PropertyMap[Property].nameA, 0,
3454 }
3455 else
3456 {
3457 l = RegSetValueExW(
3461 }
3462 if (!l)
3463 ret = TRUE;
3464 else
3465 SetLastError(l);
3467 }
3468 else
3469 {
3470 ERR("Property 0x%lx not implemented\n", Property);
3472 }
3473
3474 TRACE("Returning %d\n", ret);
3475 return ret;
3476}
static const WCHAR nameW[]
Definition: main.c:49
r l[0]
Definition: byte_order.h:168
Definition: _set.h:50
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
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:4882
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
HKEY SETUPDI_OpenDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5887
static struct PropertyMapEntry PropertyMap[]
Definition: devinst.c:3144
FxAutoRegKey hKey
if(dx< 0)
Definition: linetemp.h:194
#define KEY_SET_VALUE
Definition: nt_native.h:1020
long LONG
Definition: pedump.c:60
_In_ DWORD _Out_opt_ PDWORD _In_ DWORD PropertyBufferSize
Definition: setupapi.h:1556
#define SETUP_DEVICE_INFO_SET_MAGIC
ULONG_PTR Reserved
Definition: setupapi.h:841
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4443

Referenced by SetupDiSetDeviceRegistryPropertyA(), and SetupDiSetDeviceRegistryPropertyW().

◆ IsDeviceInfoInDeviceInfoSet()

static BOOL IsDeviceInfoInDeviceInfoSet ( struct DeviceInfoSet deviceInfoSet,
struct DeviceInfo deviceInfo 
)
static

Definition at line 4736 of file devinst.c.

4739{
4740 PLIST_ENTRY ListEntry;
4741
4742 ListEntry = deviceInfoSet->ListHead.Flink;
4743 while (ListEntry != &deviceInfoSet->ListHead)
4744 {
4745 if (deviceInfo == CONTAINING_RECORD(ListEntry, struct DeviceInfo, ListEntry))
4746 return TRUE;
4747
4748 ListEntry = ListEntry->Flink;
4749 }
4750
4751 return FALSE;
4752}
LIST_ENTRY ListHead
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121

Referenced by SetupDiDeleteDeviceInfo().

◆ OpenHardwareProfileKey()

static HKEY OpenHardwareProfileKey ( IN HKEY  HKLM,
IN DWORD  HwProfile,
IN DWORD  samDesired 
)
static

Definition at line 4681 of file devinst.c.

4685{
4686 HKEY hHWProfilesKey = NULL;
4687 HKEY hHWProfileKey = NULL;
4689 LONG rc;
4690
4691 rc = RegOpenKeyExW(HKLM,
4693 0,
4695 &hHWProfilesKey);
4696 if (rc != ERROR_SUCCESS)
4697 {
4698 SetLastError(rc);
4699 goto cleanup;
4700 }
4701 if (HwProfile == 0)
4702 {
4703 rc = RegOpenKeyExW(hHWProfilesKey,
4705 0,
4707 &hHWProfileKey);
4708 }
4709 else
4710 {
4711 WCHAR subKey[5];
4712 snprintfW(subKey, 4, InstanceKeyFormat, HwProfile);
4713 subKey[4] = '\0';
4714 rc = RegOpenKeyExW(hHWProfilesKey,
4715 subKey,
4716 0,
4718 &hHWProfileKey);
4719 }
4720 if (rc != ERROR_SUCCESS)
4721 {
4722 SetLastError(rc);
4723 goto cleanup;
4724 }
4725 ret = hHWProfileKey;
4726
4727cleanup:
4728 if (hHWProfilesKey != NULL)
4729 RegCloseKey(hHWProfilesKey);
4730 if (hHWProfileKey != NULL && hHWProfileKey != ret)
4731 RegCloseKey(hHWProfileKey);
4732 return ret;
4733}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
static const WCHAR InstanceKeyFormat[]
Definition: devinst.c:33
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1021
#define READ_CONTROL
Definition: nt_native.h:58
static const WCHAR HKLM[]
Definition: reginf.c:58
#define REGSTR_KEY_CURRENT
Definition: regstr.h:493
#define REGSTR_PATH_HWPROFILES
Definition: regstr.h:482
#define snprintfW
Definition: unicode.h:60

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

◆ ResetDevice()

static BOOL ResetDevice ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 5066 of file devinst.c.

5069{
5070#ifndef __WINESRC__
5071 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5072 struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5073 CONFIGRET cr;
5074
5075 cr = CM_Enable_DevNode_Ex(deviceInfo->dnDevInst, 0, set->hMachine);
5076 if (cr != CR_SUCCESS)
5077 {
5079 return FALSE;
5080 }
5081
5082 return TRUE;
5083#else
5084 FIXME("Stub: ResetDevice(%p %p)\n", DeviceInfoSet, DeviceInfoData);
5085 return TRUE;
5086#endif
5087}
CONFIGRET WINAPI CM_Enable_DevNode_Ex(_In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:2012

Referenced by SetupDiChangeState(), and SetupDiInstallDevice().

◆ SETUP_CreateClassKey()

HKEY SETUP_CreateClassKey ( HINF  hInf)

Definition at line 3564 of file devinst.c.

3565{
3566 WCHAR FullBuffer[MAX_PATH];
3571
3572 /* Obtain the Class GUID for this class */
3574 hInf,
3575 Version,
3577 Buffer,
3578 sizeof(Buffer) / sizeof(WCHAR),
3579 &RequiredSize))
3580 {
3581 return INVALID_HANDLE_VALUE;
3582 }
3583
3584 /* Build the corresponding registry key name */
3585 lstrcpyW(FullBuffer, REGSTR_PATH_CLASS_NT);
3586 lstrcatW(FullBuffer, BackSlash);
3587 lstrcatW(FullBuffer, Buffer);
3588
3589 /* Obtain the Class name for this class */
3591 hInf,
3592 Version,
3594 Buffer,
3595 sizeof(Buffer) / sizeof(WCHAR),
3596 &RequiredSize))
3597 {
3598 return INVALID_HANDLE_VALUE;
3599 }
3600
3601 /* Try to open or create the registry key */
3602 TRACE("Opening class key %s\n", debugstr_w(FullBuffer));
3603#if 0 // I keep this for reference...
3605 FullBuffer,
3606 0,
3608 &hClassKey))
3609 {
3610 /* Use RegCreateKeyExW */
3611 }
3612#endif
3614 FullBuffer,
3615 0,
3616 NULL,
3619 NULL,
3620 &hClassKey,
3621 &Disposition))
3622 {
3623 ERR("RegCreateKeyExW(%s) failed\n", debugstr_w(FullBuffer));
3624 return INVALID_HANDLE_VALUE;
3625 }
3627 TRACE("The class key %s was successfully created\n", debugstr_w(FullBuffer));
3628 else
3629 TRACE("The class key %s was successfully opened\n", debugstr_w(FullBuffer));
3630
3631 TRACE( "setting value %s to %s\n", debugstr_w(REGSTR_VAL_CLASS), debugstr_w(Buffer) );
3634 0,
3635 REG_SZ,
3636 (LPBYTE)Buffer,
3637 RequiredSize * sizeof(WCHAR)))
3638 {
3641 FullBuffer);
3642 return INVALID_HANDLE_VALUE;
3643 }
3644
3645 return hClassKey;
3646}
HKEY hClassKey
Definition: umpnpmgr.c:45
Definition: bufpool.h:45
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:1096
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
#define lstrcpyW
Definition: compat.h:749
BOOL WINAPI SetupGetLineTextW(PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required)
Definition: parser.c:1763
#define REG_SZ
Definition: layer.c:22
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1060
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1087
#define REGSTR_VAL_CLASSGUID
Definition: regstr.h:422
#define REGSTR_PATH_CLASS_NT
Definition: regstr.h:479
#define REGSTR_VAL_CLASS
Definition: regstr.h:291
unsigned char * LPBYTE
Definition: typedefs.h:53
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4445
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469

Referenced by SetupDiInstallClassExW().

◆ SETUPAPI_GetCurrentHwProfile()

static DWORD SETUPAPI_GetCurrentHwProfile ( IN HDEVINFO  DeviceInfoSet)
static

Definition at line 5019 of file devinst.c.

5021{
5022 HKEY hKey = NULL;
5023 DWORD dwRegType, dwLength;
5024 DWORD hwProfile;
5025 LONG rc;
5026 DWORD ret = (DWORD)-1;
5027
5030 0, /* Options */
5032 &hKey);
5033 if (rc != ERROR_SUCCESS)
5034 {
5035 SetLastError(rc);
5036 goto cleanup;
5037 }
5038
5039 dwLength = sizeof(DWORD);
5042 NULL,
5043 &dwRegType,
5044 (LPBYTE)&hwProfile, &dwLength);
5045 if (rc != ERROR_SUCCESS)
5046 {
5047 SetLastError(rc);
5048 goto cleanup;
5049 }
5050 else if (dwRegType != REG_DWORD || dwLength != sizeof(DWORD))
5051 {
5053 goto cleanup;
5054 }
5055
5056 ret = hwProfile;
5057
5058cleanup:
5059 if (hKey != NULL)
5061
5062 return ret;
5063}
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
static DWORD DWORD * dwLength
Definition: fusion.c:86
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define DWORD
Definition: nt_native.h:44
#define REGSTR_VAL_CURRENTCONFIG
Definition: regstr.h:466
#define REGSTR_PATH_IDCONFIGDB
Definition: regstr.h:41
#define REG_DWORD
Definition: sdbapi.c:615

Referenced by SetupDiChangeState().

◆ SETUPDI_CreateDevKey()

HKEY SETUPDI_CreateDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)

Definition at line 5717 of file devinst.c.

5718{
5719 HKEY enumKey, key = INVALID_HANDLE_VALUE;
5720 LONG l;
5721
5723 if (!l)
5724 {
5725 l = RegCreateKeyExW(enumKey, devInfo->instanceId, 0, NULL, REG_OPTION_NON_VOLATILE, samDesired, NULL, &key, NULL);
5726 RegCloseKey(enumKey);
5727 }
5728 if (l)
5729 SetLastError(l);
5730 return key;
5731}
#define REGSTR_PATH_SYSTEMENUM
Definition: regstr.h:483
static PMEMKEY RootKey
Definition: registry.c:55
Definition: copy.c:22

Referenced by SetupDiChangeState(), and SetupDiCreateDevRegKeyW().

◆ SETUPDI_CreateDrvKey()

HKEY SETUPDI_CreateDrvKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
UUID ClassGuid,
REGSAM  samDesired 
)

Definition at line 5733 of file devinst.c.

5734{
5736 LPWSTR lpGuidString = NULL;
5737 LPWSTR DriverKey = NULL; /* {GUID}\Index */
5738 LPWSTR pDeviceInstance; /* Points into DriverKey, on the Index field */
5739 DWORD Index; /* Index used in the DriverKey name */
5740 DWORD dwSize;
5742 DWORD rc;
5743 HKEY hHWProfileKey = INVALID_HANDLE_VALUE;
5744 HKEY hEnumKey = NULL;
5746 HKEY hDeviceKey = INVALID_HANDLE_VALUE;
5747 HKEY hKey = NULL;
5748
5749 /* Open device key, to read Driver value */
5750 hDeviceKey = SETUPDI_OpenDevKey(RootKey, devInfo, KEY_QUERY_VALUE | KEY_SET_VALUE);
5751 if (hDeviceKey == INVALID_HANDLE_VALUE)
5752 goto cleanup;
5753
5755 if (rc != ERROR_SUCCESS)
5756 {
5757 SetLastError(rc);
5758 goto cleanup;
5759 }
5760
5761 rc = RegQueryValueExW(hDeviceKey, REGSTR_VAL_DRIVER, NULL, NULL, NULL, &dwSize);
5762 if (rc != ERROR_SUCCESS)
5763 {
5764 /* Create a new driver key */
5765
5766 if (UuidToStringW(ClassGuid, &lpGuidString) != RPC_S_OK)
5767 goto cleanup;
5768
5769 /* The driver key is in \System\CurrentControlSet\Control\Class\{GUID}\Index */
5770 DriverKey = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpGuidString) + 7) * sizeof(WCHAR) + sizeof(UNICODE_NULL));
5771 if (!DriverKey)
5772 {
5774 goto cleanup;
5775 }
5776
5777 DriverKey[0] = '{';
5778 strcpyW(&DriverKey[1], lpGuidString);
5779 pDeviceInstance = &DriverKey[strlenW(DriverKey)];
5780 *pDeviceInstance++ = '}';
5781 *pDeviceInstance++ = '\\';
5782
5783 /* Try all values for Index between 0 and 9999 */
5784 Index = 0;
5785 while (Index <= 9999)
5786 {
5787 sprintfW(pDeviceInstance, InstanceKeyFormat, Index);
5789 DriverKey,
5790 0,
5791 NULL,
5793#if _WIN32_WINNT >= 0x502
5795#else
5797#endif
5798 NULL,
5799 &hKey,
5800 &Disposition);
5801 if (rc != ERROR_SUCCESS)
5802 {
5803 SetLastError(rc);
5804 goto cleanup;
5805 }
5807 break;
5809 hKey = NULL;
5810 Index++;
5811 }
5812
5813 if (Index > 9999)
5814 {
5815 /* Unable to create more than 9999 devices within the same class */
5817 goto cleanup;
5818 }
5819
5820 /* Write the new Driver value */
5821 rc = RegSetValueExW(hDeviceKey, REGSTR_VAL_DRIVER, 0, REG_SZ, (const BYTE *)DriverKey, (strlenW(DriverKey) + 1) * sizeof(WCHAR));
5822 if (rc != ERROR_SUCCESS)
5823 {
5824 SetLastError(rc);
5825 goto cleanup;
5826 }
5827 }
5828 else
5829 {
5830 /* Open the existing driver key */
5831
5832 DriverKey = HeapAlloc(GetProcessHeap(), 0, dwSize);
5833 if (!DriverKey)
5834 {
5836 goto cleanup;
5837 }
5838
5839 rc = RegQueryValueExW(hDeviceKey, REGSTR_VAL_DRIVER, NULL, NULL, (LPBYTE)DriverKey, &dwSize);
5840 if (rc != ERROR_SUCCESS)
5841 {
5842 SetLastError(rc);
5843 goto cleanup;
5844 }
5845
5847 DriverKey,
5848 0,
5849 NULL,
5851#if _WIN32_WINNT >= 0x502
5853#else
5855#endif
5856 NULL,
5857 &hKey,
5858 &Disposition);
5859 if (rc != ERROR_SUCCESS)
5860 {
5861 SetLastError(rc);
5862 goto cleanup;
5863 }
5864 }
5865
5866 key = hKey;
5867
5868cleanup:
5869 if (lpGuidString)
5870 RpcStringFreeW(&lpGuidString);
5871 HeapFree(GetProcessHeap(), 0, DriverKey);
5872 if (hHWProfileKey != INVALID_HANDLE_VALUE)
5873 RegCloseKey(hHWProfileKey);
5874 if (hEnumKey != NULL)
5876 if (hClassKey != NULL)
5878 if (hDeviceKey != INVALID_HANDLE_VALUE)
5879 RegCloseKey(hDeviceKey);
5880 if (hKey != NULL && hKey != key)
5882
5883 TRACE("Returning 0x%p\n", hKey);
5884 return hKey;
5885}
#define _WIN32_WINNT
Definition: precomp.h:14
static HANDLE hEnumKey
Definition: devinst.c:20
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_WRITE
Definition: nt_native.h:1034
#define REGSTR_VAL_DRIVER
Definition: regstr.h:385
#define RPC_S_OK
Definition: rpcnterr.h:22
RPC_STATUS WINAPI UuidToStringW(UUID *Uuid, RPC_WSTR *StringUuid)
Definition: rpcrt4_main.c:573
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:181
_In_ WDFCOLLECTION _In_ ULONG Index
#define sprintfW
Definition: unicode.h:58
unsigned char BYTE
Definition: xxhash.c:193

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

◆ SETUPDI_DeleteDevKey()

static BOOL SETUPDI_DeleteDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo 
)
static

Definition at line 6064 of file devinst.c.

6065{
6066 FIXME("\n");
6067 return FALSE;
6068}

Referenced by SetupDiDeleteDevRegKey().

◆ SETUPDI_DeleteDrvKey()

static BOOL SETUPDI_DeleteDrvKey ( HKEY  RootKey,
struct DeviceInfo devInfo 
)
static

Definition at line 6070 of file devinst.c.

6071{
6072 FIXME("\n");
6073 return FALSE;
6074}

Referenced by SetupDiDeleteDevRegKey().

◆ SETUPDI_GuidToString()

static void SETUPDI_GuidToString ( const GUID guid,
LPWSTR  guidStr 
)
static

Definition at line 81 of file devinst.c.

82{
83 static const WCHAR fmt[] = {'{','%','0','8','X','-','%','0','4','X','-',
84 '%','0','4','X','-','%','0','2','X','%','0','2','X','-','%','0','2',
85 'X','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','%',
86 '0','2','X','}',0};
87
88 sprintfW(guidStr, fmt, guid->Data1, guid->Data2, guid->Data3,
89 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
90 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
91}
GUID guid
Definition: version.c:147
static WCHAR guidStr[]
Definition: asn.c:770
Definition: dsound.c:943

Referenced by SetupDiCreateDeviceInterfaceRegKeyW(), and SetupDiOpenClassRegKeyExW().

◆ SETUPDI_OpenDevKey()

HKEY SETUPDI_OpenDevKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)

Definition at line 5887 of file devinst.c.

5888{
5889 HKEY enumKey, key = INVALID_HANDLE_VALUE;
5890 LONG l;
5891
5893 if (!l)
5894 {
5895 l = RegOpenKeyExW(enumKey, devInfo->instanceId, 0, samDesired, &key);
5896 RegCloseKey(enumKey);
5897 }
5898 if (l)
5899 SetLastError(l);
5900 return key;
5901}

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

◆ SETUPDI_OpenDrvKey()

HKEY SETUPDI_OpenDrvKey ( HKEY  RootKey,
struct DeviceInfo devInfo,
REGSAM  samDesired 
)

Definition at line 5903 of file devinst.c.

5904{
5905 LPWSTR DriverKey = NULL;
5906 DWORD dwLength = 0;
5907 DWORD dwRegType;
5908 DWORD rc;
5909 HKEY hEnumKey = NULL;
5910 HKEY hKey = NULL;
5912
5915 goto cleanup;
5916 /* Read the 'Driver' key */
5918 if (rc != ERROR_SUCCESS)
5919 {
5920 SetLastError(rc);
5921 goto cleanup;
5922 }
5923 else if (dwRegType != REG_SZ)
5924 {
5926 goto cleanup;
5927 }
5928 DriverKey = HeapAlloc(GetProcessHeap(), 0, dwLength);
5929 if (!DriverKey)
5930 {
5932 goto cleanup;
5933 }
5934 rc = RegQueryValueExW(hKey, REGSTR_VAL_DRIVER, NULL, &dwRegType, (LPBYTE)DriverKey, &dwLength);
5935 if (rc != ERROR_SUCCESS)
5936 {
5937 SetLastError(rc);
5938 goto cleanup;
5939 }
5941 hKey = NULL;
5942 /* Need to open the driver key */
5943 rc = RegOpenKeyExW(
5944 RootKey,
5946 0, /* Options */
5948 &hEnumKey);
5949 if (rc != ERROR_SUCCESS)
5950 {
5951 SetLastError(rc);
5952 goto cleanup;
5953 }
5954 rc = RegOpenKeyExW(
5955 hEnumKey,
5956 DriverKey,
5957 0, /* Options */
5958 samDesired,
5959 &hKey);
5960 if (rc != ERROR_SUCCESS)
5961 {
5962 SetLastError(rc);
5963 goto cleanup;
5964 }
5965 key = hKey;
5966
5967cleanup:
5968 if (hEnumKey != NULL)
5970 if (hKey != NULL && hKey != key)
5972 if (DriverKey)
5973 HeapFree(GetProcessHeap(), 0, DriverKey);
5974 return key;
5975}

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

◆ SetupDiBuildClassInfoList()

BOOL WINAPI SetupDiBuildClassInfoList ( DWORD  Flags,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize 
)

Definition at line 645 of file devinst.c.

650{
651 TRACE("\n");
652 return SetupDiBuildClassInfoListExW(Flags, ClassGuidList,
654 NULL, NULL);
655}
BOOL WINAPI SetupDiBuildClassInfoListExW(DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:722
_In_ DWORD ClassGuidListSize
Definition: setupapi.h:1284
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by test_SetupDiBuildClassInfoList().

◆ SetupDiBuildClassInfoListExA()

BOOL WINAPI SetupDiBuildClassInfoListExA ( DWORD  Flags,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize,
LPCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 675 of file devinst.c.

682{
683 LPWSTR MachineNameW = NULL;
684 BOOL bResult;
685
686 TRACE("%s(0x%lx %p %lu %p %s %p)\n", __FUNCTION__, Flags, ClassGuidList,
688
689 if (MachineName)
690 {
692 if (MachineNameW == NULL) return FALSE;
693 }
694
695 bResult = SetupDiBuildClassInfoListExW(Flags, ClassGuidList,
697 MachineNameW, Reserved);
698
699 MyFree(MachineNameW);
700
701 return bResult;
702}
#define CP_ACP
Definition: compat.h:109
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
#define debugstr_a
Definition: kernel32.h:31
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1296
_Reserved_ PVOID Reserved
Definition: winddi.h:3974

◆ SetupDiBuildClassInfoListExW()

BOOL WINAPI SetupDiBuildClassInfoListExW ( DWORD  Flags,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize,
LPCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 722 of file devinst.c.

729{
730 GUID CurrentClassGuid;
732 DWORD dwIndex;
733 DWORD dwGuidListIndex = 0;
734 HMACHINE hMachine = NULL;
735 CONFIGRET cr;
736
737 TRACE("%s(0x%lx %p %lu %p %s %p)\n", __FUNCTION__, Flags, ClassGuidList,
739
740 if (!RequiredSize)
741 {
743 return FALSE;
744 }
745 else if (!ClassGuidList && ClassGuidListSize > 0)
746 {
748 return FALSE;
749 }
750
751 if (MachineName)
752 {
753 cr = CM_Connect_MachineW(MachineName, &hMachine);
754 if (cr != CR_SUCCESS)
755 {
757 return FALSE;
758 }
759 }
760
761 for (dwIndex = 0; ; dwIndex++)
762 {
763 cr = CM_Enumerate_Classes_Ex(dwIndex,
764 &CurrentClassGuid,
765 0,
766 hMachine);
767 if (cr == CR_SUCCESS)
768 {
769 TRACE("Guid: %s\n", debugstr_guid(&CurrentClassGuid));
770 if (CM_Open_Class_Key_ExW(&CurrentClassGuid,
771 NULL,
774 &hClassKey,
776 hMachine) != CR_SUCCESS)
777 {
779 if (hMachine)
780 CM_Disconnect_Machine(hMachine);
781 return FALSE;
782 }
783
786 NULL,
787 NULL,
788 NULL,
789 NULL))
790 {
791 TRACE("'NoUseClass' value found!\n");
793 continue;
794 }
795
796 if ((Flags & DIBCI_NOINSTALLCLASS) &&
799 NULL,
800 NULL,
801 NULL,
802 NULL)))
803 {
804 TRACE("'NoInstallClass' value found!\n");
806 continue;
807 }
808
809 if ((Flags & DIBCI_NODISPLAYCLASS) &&
812 NULL,
813 NULL,
814 NULL,
815 NULL)))
816 {
817 TRACE("'NoDisplayClass' value found!\n");
819 continue;
820 }
821
823
824 if (dwGuidListIndex < ClassGuidListSize)
825 {
826 ClassGuidList[dwGuidListIndex] = CurrentClassGuid;
827 }
828
829 dwGuidListIndex++;
830 }
831
832 if (cr != ERROR_SUCCESS)
833 break;
834 }
835
836 if (hMachine)
837 CM_Disconnect_Machine(hMachine);
838
839 if (RequiredSize != NULL)
840 *RequiredSize = dwGuidListIndex;
841
842 if (ClassGuidListSize < dwGuidListIndex)
843 {
845 return FALSE;
846 }
847
848 return TRUE;
849}
#define CM_OPEN_CLASS_KEY_INSTALLER
Definition: cfgmgr32.h:772
#define RegDisposition_OpenExisting
Definition: cfgmgr32.h:610
CONFIGRET WINAPI CM_Open_Class_Key_ExW(_In_opt_ LPGUID pClassGuid, _In_opt_ LPCWSTR pszClassName, _In_ REGSAM samDesired, _In_ REGDISPOSITION Disposition, _Out_ PHKEY phkClass, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:6454
CONFIGRET WINAPI CM_Connect_MachineW(_In_opt_ PCWSTR UNCServerName, _Out_ PHMACHINE phMachine)
Definition: cfgmgr.c:1270
CONFIGRET WINAPI CM_Enumerate_Classes_Ex(_In_ ULONG ulClassIndex, _Out_ LPGUID ClassGuid, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:2094
#define debugstr_guid
Definition: kernel32.h:35
#define REGSTR_VAL_NOINSTALLCLASS
Definition: regstr.h:239
#define REGSTR_VAL_NODISPLAYCLASS
Definition: regstr.h:240
#define REGSTR_VAL_NOUSECLASS
Definition: regstr.h:238
#define DIBCI_NODISPLAYCLASS
Definition: setupapi.h:111
#define DIBCI_NOINSTALLCLASS
Definition: setupapi.h:110

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

◆ SetupDiCallClassInstaller()

BOOL WINAPI SetupDiCallClassInstaller ( DI_FUNCTION  InstallFunction,
HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 4070 of file devinst.c.

4074{
4075 BOOL ret = FALSE;
4076
4077 TRACE("%s(%u %p %p)\n", __FUNCTION__, InstallFunction, DeviceInfoSet, DeviceInfoData);
4078
4079 if (!DeviceInfoSet)
4083 else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
4085 else if (((struct DeviceInfoSet *)DeviceInfoSet)->HKLM != HKEY_LOCAL_MACHINE)
4087 else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4089 else
4090 {
4091 SP_DEVINSTALL_PARAMS_W InstallParams;
4092#define CLASS_COINSTALLER 0x1
4093#define DEVICE_COINSTALLER 0x2
4094#define CLASS_INSTALLER 0x4
4095 UCHAR CanHandle = 0;
4097
4098 switch (InstallFunction)
4099 {
4102 break;
4105 break;
4106 case DIF_ALLOW_INSTALL:
4107 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4108 break;
4109 case DIF_DETECT:
4110 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4111 break;
4113 CanHandle = CLASS_INSTALLER;
4114 break;
4115 case DIF_INSTALLDEVICE:
4118 break;
4120 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4122 break;
4126 break;
4129 break;
4131 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4132 break;
4134 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4135 break;
4137 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4138 break;
4140 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4141 break;
4144 break;
4145 case DIF_PROPERTYCHANGE:
4148 break;
4150 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4152 break;
4153 case DIF_REGISTERDEVICE:
4154 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4156 break;
4157 case DIF_REMOVE:
4160 break;
4162 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4164 break;
4165 case DIF_SELECTDEVICE:
4166 CanHandle = CLASS_COINSTALLER | CLASS_INSTALLER;
4168 break;
4169 case DIF_TROUBLESHOOTER:
4171 break;
4172 case DIF_UNREMOVE:
4175 break;
4176 default:
4177 ERR("Install function %u not supported\n", InstallFunction);
4179 }
4180
4181 InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
4183 /* Don't process this call, as a parameter is invalid */
4184 CanHandle = 0;
4185
4186 if (CanHandle != 0)
4187 {
4188 LIST_ENTRY ClassCoInstallersListHead;
4189 LIST_ENTRY DeviceCoInstallersListHead;
4190 HMODULE ClassInstallerLibrary = NULL;
4191 CLASS_INSTALL_PROC ClassInstaller = NULL;
4193 PLIST_ENTRY ListEntry;
4194 HKEY hKey;
4195 DWORD dwRegType, dwLength;
4196 DWORD rc = NO_ERROR;
4197
4198 InitializeListHead(&ClassCoInstallersListHead);
4199 InitializeListHead(&DeviceCoInstallersListHead);
4200
4201 if (CanHandle & DEVICE_COINSTALLER)
4202 {
4205 {
4207 if (rc == ERROR_SUCCESS && dwRegType == REG_MULTI_SZ)
4208 {
4209 LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4210 if (KeyBuffer != NULL)
4211 {
4213 if (rc == ERROR_SUCCESS)
4214 {
4215 LPWSTR ptr;
4216 for (ptr = KeyBuffer; *ptr; ptr += strlenW(ptr) + 1)
4217 {
4218 /* Add coinstaller to DeviceCoInstallersListHead list */
4219 struct CoInstallerElement *coinstaller;
4220 TRACE("Got device coinstaller '%s'\n", debugstr_w(ptr));
4221 coinstaller = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CoInstallerElement));
4222 if (!coinstaller)
4223 continue;
4224 ZeroMemory(coinstaller, sizeof(struct CoInstallerElement));
4225 if (GetFunctionPointer(ptr, &coinstaller->Module, (PVOID*)&coinstaller->Function) == ERROR_SUCCESS)
4226 InsertTailList(&DeviceCoInstallersListHead, &coinstaller->ListEntry);
4227 else
4228 HeapFree(GetProcessHeap(), 0, coinstaller);
4229 }
4230 }
4231 HeapFree(GetProcessHeap(), 0, KeyBuffer);
4232 }
4233 }
4235 }
4236 }
4237 if (CanHandle & CLASS_COINSTALLER)
4238 {
4239 rc = RegOpenKeyExW(
4242 0, /* Options */
4244 &hKey);
4245 if (rc == ERROR_SUCCESS)
4246 {
4247 WCHAR szGuidString[40];
4248 if (pSetupStringFromGuid(&DeviceInfoData->ClassGuid, szGuidString, ARRAYSIZE(szGuidString)) == ERROR_SUCCESS)
4249 {
4250 rc = RegQueryValueExW(hKey, szGuidString, NULL, &dwRegType, NULL, &dwLength);
4251 if (rc == ERROR_SUCCESS && dwRegType == REG_MULTI_SZ)
4252 {
4253 LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4254 if (KeyBuffer != NULL)
4255 {
4256 rc = RegQueryValueExW(hKey, szGuidString, NULL, NULL, (LPBYTE)KeyBuffer, &dwLength);
4257 if (rc == ERROR_SUCCESS)
4258 {
4259 LPWSTR ptr;
4260 for (ptr = KeyBuffer; *ptr; ptr += strlenW(ptr) + 1)
4261 {
4262 /* Add coinstaller to ClassCoInstallersListHead list */
4263 struct CoInstallerElement *coinstaller;
4264 TRACE("Got class coinstaller '%s'\n", debugstr_w(ptr));
4265 coinstaller = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CoInstallerElement));
4266 if (!coinstaller)
4267 continue;
4268 ZeroMemory(coinstaller, sizeof(struct CoInstallerElement));
4269 if (GetFunctionPointer(ptr, &coinstaller->Module, (PVOID*)&coinstaller->Function) == ERROR_SUCCESS)
4270 InsertTailList(&ClassCoInstallersListHead, &coinstaller->ListEntry);
4271 else
4272 HeapFree(GetProcessHeap(), 0, coinstaller);
4273 }
4274 }
4275 HeapFree(GetProcessHeap(), 0, KeyBuffer);
4276 }
4277 }
4278 }
4280 }
4281 }
4282 if ((CanHandle & CLASS_INSTALLER) && !(InstallParams.FlagsEx & DI_FLAGSEX_CI_FAILED))
4283 {
4286 {
4288 if (rc == ERROR_SUCCESS && dwRegType == REG_SZ)
4289 {
4290 LPWSTR KeyBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength);
4291 if (KeyBuffer != NULL)
4292 {
4294 if (rc == ERROR_SUCCESS)
4295 {
4296 /* Get ClassInstaller function pointer */
4297 TRACE("Got class installer '%s'\n", debugstr_w(KeyBuffer));
4298 if (GetFunctionPointer(KeyBuffer, &ClassInstallerLibrary, (PVOID*)&ClassInstaller) != ERROR_SUCCESS)
4299 {
4300 InstallParams.FlagsEx |= DI_FLAGSEX_CI_FAILED;
4302 }
4303 }
4304 HeapFree(GetProcessHeap(), 0, KeyBuffer);
4305 }
4306 }
4308 }
4309 }
4310
4311 /* Call Class co-installers */
4312 Context.PostProcessing = FALSE;
4313 rc = NO_ERROR;
4314 ListEntry = ClassCoInstallersListHead.Flink;
4315 while (rc == NO_ERROR && ListEntry != &ClassCoInstallersListHead)
4316 {
4317 struct CoInstallerElement *coinstaller;
4319 rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4320 coinstaller->PrivateData = Context.PrivateData;
4322 {
4323 coinstaller->DoPostProcessing = TRUE;
4324 rc = NO_ERROR;
4325 }
4327 }
4328
4329 /* Call Device co-installers */
4330 ListEntry = DeviceCoInstallersListHead.Flink;
4331 while (rc == NO_ERROR && ListEntry != &DeviceCoInstallersListHead)
4332 {
4333 struct CoInstallerElement *coinstaller;
4335 rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4336 coinstaller->PrivateData = Context.PrivateData;
4338 {
4339 coinstaller->DoPostProcessing = TRUE;
4340 rc = NO_ERROR;
4341 }
4343 }
4344
4345 /* Call Class installer */
4346 if (ClassInstaller)
4347 {
4348 rc = (*ClassInstaller)(InstallFunction, DeviceInfoSet, DeviceInfoData);
4349 FreeFunctionPointer(ClassInstallerLibrary, ClassInstaller);
4350 }
4351 else
4353
4354 /* Call default handler */
4355 if (rc == ERROR_DI_DO_DEFAULT)
4356 {
4357 if (DefaultHandler && !(InstallParams.Flags & DI_NODI_DEFAULTACTION))
4358 {
4360 rc = NO_ERROR;
4361 else
4362 rc = GetLastError();
4363 }
4364 else
4365 rc = NO_ERROR;
4366 }
4367
4368 /* Call Class co-installers that required postprocessing */
4369 Context.PostProcessing = TRUE;
4370 ListEntry = ClassCoInstallersListHead.Flink;
4371 while (ListEntry != &ClassCoInstallersListHead)
4372 {
4373 struct CoInstallerElement *coinstaller;
4375 if (coinstaller->DoPostProcessing)
4376 {
4377 Context.InstallResult = rc;
4378 Context.PrivateData = coinstaller->PrivateData;
4379 rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4380 }
4381 FreeFunctionPointer(coinstaller->Module, coinstaller->Function);
4383 }
4384
4385 /* Call Device co-installers that required postprocessing */
4386 ListEntry = DeviceCoInstallersListHead.Flink;
4387 while (ListEntry != &DeviceCoInstallersListHead)
4388 {
4389 struct CoInstallerElement *coinstaller;
4391 if (coinstaller->DoPostProcessing)
4392 {
4393 Context.InstallResult = rc;
4394 Context.PrivateData = coinstaller->PrivateData;
4395 rc = (*coinstaller->Function)(InstallFunction, DeviceInfoSet, DeviceInfoData, &Context);
4396 }
4397 FreeFunctionPointer(coinstaller->Module, coinstaller->Function);
4399 }
4400
4401 /* Free allocated memory */
4402 while (!IsListEmpty(&ClassCoInstallersListHead))
4403 {
4404 ListEntry = RemoveHeadList(&ClassCoInstallersListHead);
4406 }
4407 while (!IsListEmpty(&DeviceCoInstallersListHead))
4408 {
4409 ListEntry = RemoveHeadList(&DeviceCoInstallersListHead);
4411 }
4412
4413 ret = (rc == NO_ERROR);
4414 }
4415 }
4416
4417 TRACE("Returning %d\n", ret);
4418 return ret;
4419}
#define NO_ERROR
Definition: dderror.h:5
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define CLASS_COINSTALLER
BOOL WINAPI SetupDiRegisterCoDeviceInstallers(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5257
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4604
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4497
BOOL(WINAPI * DEFAULT_CLASS_INSTALL_PROC)(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:49
BOOL WINAPI SetupDiSelectDevice(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: devinst.c:5243
BOOL WINAPI SetupDiChangeState(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5117
BOOL WINAPI SetupDiInstallDevice(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5411
HKEY SETUPDI_OpenDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5903
#define CLASS_INSTALLER
static BOOL WINAPI IntSetupDiRegisterDeviceInfo(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4060
DWORD(CALLBACK * CLASS_INSTALL_PROC)(IN DI_FUNCTION InstallFunction, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: devinst.c:44
HKEY WINAPI SetupDiOpenClassRegKey(const GUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:3664
#define DEVICE_COINSTALLER
BOOL WINAPI SetupDiInstallDriverFiles(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: driver.c:1947
BOOL WINAPI SetupDiSelectBestCompatDrv(IN HDEVINFO DeviceInfoSet, IN OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: driver.c:1911
BOOL WINAPI SetupDiInstallDeviceInterfaces(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: interface.c:386
DWORD FreeFunctionPointer(IN HMODULE ModulePointer, IN PVOID FunctionPointer)
Definition: misc.c:105
DWORD WINAPI pSetupStringFromGuid(LPGUID lpGUID, PWSTR pString, DWORD dwStringLen)
Definition: misc.c:1775
DWORD GetFunctionPointer(IN PWSTR InstallerName, OUT HMODULE *ModulePointer, OUT PVOID *FunctionPointer)
Definition: misc.c:44
BOOL WINAPI SetupDiUnremoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:96
BOOL WINAPI SetupDiRemoveDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: stubs.c:82
#define InsertTailList(ListHead, Entry)
static PVOID ptr
Definition: dispmode.c:27
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define REGSTR_VAL_INSTALLER_32
Definition: regstr.h:487
#define REGSTR_VAL_COINSTALLERS_32
Definition: regstr.h:484
#define REGSTR_PATH_CODEVICEINSTALLERS
Definition: regstr.h:480
#define ERROR_DI_POSTPROCESSING_REQUIRED
Definition: setupapi.h:337
#define DIF_SELECTDEVICE
Definition: setupapi.h:123
#define DIF_NEWDEVICEWIZARD_PRESELECT
Definition: setupapi.h:148
#define DIF_REGISTERDEVICE
Definition: setupapi.h:147
#define DIF_REMOVE
Definition: setupapi.h:127
#define DIF_INSTALLDEVICEFILES
Definition: setupapi.h:143
#define DIF_ADDREMOTEPROPERTYPAGE_ADVANCED
Definition: setupapi.h:162
#define DIF_DETECT
Definition: setupapi.h:137
#define DIF_NEWDEVICEWIZARD_SELECT
Definition: setupapi.h:149
#define DIF_REGISTER_COINSTALLERS
Definition: setupapi.h:156
#define DIF_INSTALLINTERFACES
Definition: setupapi.h:154
#define ERROR_DI_DO_DEFAULT
Definition: setupapi.h:313
#define DIF_NEWDEVICEWIZARD_PREANALYZE
Definition: setupapi.h:150
#define DIF_UNREMOVE
Definition: setupapi.h:144
#define DIF_INSTALLDEVICE
Definition: setupapi.h:124
#define DIF_ALLOW_INSTALL
Definition: setupapi.h:146
#define DIF_DESTROYPRIVATEDATA
Definition: setupapi.h:134
#define DIF_SELECTBESTCOMPATDRV
Definition: setupapi.h:145
#define DIF_POWERMESSAGEWAKE
Definition: setupapi.h:161
#define DIF_PROPERTYCHANGE
Definition: setupapi.h:140
#define DIF_ADDPROPERTYPAGE_ADVANCED
Definition: setupapi.h:157
#define DIF_NEWDEVICEWIZARD_POSTANALYZE
Definition: setupapi.h:151
#define DIF_TROUBLESHOOTER
Definition: setupapi.h:160
#define DIF_NEWDEVICEWIZARD_FINISHINSTALL
Definition: setupapi.h:152
LIST_ENTRY ListEntry
Definition: devinst.c:61
HMODULE Module
Definition: devinst.c:63
BOOL DoPostProcessing
Definition: devinst.c:65
COINSTALLER_PROC Function
Definition: devinst.c:64
PVOID PrivateData
Definition: devinst.c:66
unsigned char UCHAR
Definition: typedefs.h:53
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by CNetConnection::Disconnect(), DisplayDeviceAdvancedProperties(), CDeviceNode::EnableDevice(), EnableDevice(), EnumerateDrivers(), InstallCurrentDriver(), InstallSoftwareBusPnpEnumerator(), SETUP_CallInstaller(), StartDevice(), CDeviceNode::UninstallDevice(), UninstallDriver(), UpdateDevInfo(), UpdateDriverDetailsDlg(), and WritePortSettings().

◆ SetupDiChangeState()

BOOL WINAPI SetupDiChangeState ( IN HDEVINFO  DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 5117 of file devinst.c.

5120{
5121 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5122 struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5123 PSP_PROPCHANGE_PARAMS PropChange;
5125 LPCWSTR RegistryValueName;
5126 DWORD dwConfigFlags, dwLength, dwRegType;
5127 LONG rc;
5128 BOOL ret = FALSE;
5129
5131
5132 if (!DeviceInfoData)
5133 PropChange = ((struct DeviceInfoSet *)DeviceInfoSet)->ClassInstallParams.PropChangeParams;
5134 else
5135 PropChange = ((struct DeviceInfo *)DeviceInfoData->Reserved)->ClassInstallParams.PropChangeParams;
5136 if (!PropChange)
5137 {
5139 goto cleanup;
5140 }
5141
5142 if (PropChange->Scope == DICS_FLAG_GLOBAL)
5143 RegistryValueName = REGSTR_VAL_CONFIGFLAGS;
5144 else
5145 RegistryValueName = REGSTR_VAL_CSCONFIGFLAGS;
5146
5147 switch (PropChange->StateChange)
5148 {
5149 case DICS_ENABLE:
5150 case DICS_DISABLE:
5151 {
5152 if (PropChange->Scope == DICS_FLAG_GLOBAL)
5153 hRootKey = set->HKLM;
5154 else /* PropChange->Scope == DICS_FLAG_CONFIGSPECIFIC */
5155 {
5156 hRootKey = OpenHardwareProfileKey(set->HKLM, PropChange->HwProfile, KEY_CREATE_SUB_KEY);
5157 if (hRootKey == INVALID_HANDLE_VALUE)
5158 goto cleanup;
5159 }
5160
5161 /* Enable/disable device in registry */
5162 hKey = SETUPDI_OpenDrvKey(hRootKey, deviceInfo, KEY_QUERY_VALUE | KEY_SET_VALUE);
5164 hKey = SETUPDI_CreateDevKey(hRootKey, deviceInfo, KEY_QUERY_VALUE | KEY_SET_VALUE);
5166 break;
5167 dwLength = sizeof(DWORD);
5168 rc = RegQueryValueExW(
5169 hKey,
5170 RegistryValueName,
5171 NULL,
5172 &dwRegType,
5173 (LPBYTE)&dwConfigFlags, &dwLength);
5174 if (rc == ERROR_FILE_NOT_FOUND)
5175 dwConfigFlags = 0;
5176 else if (rc != ERROR_SUCCESS)
5177 {
5178 SetLastError(rc);
5179 goto cleanup;
5180 }
5181 else if (dwRegType != REG_DWORD || dwLength != sizeof(DWORD))
5182 {
5184 goto cleanup;
5185 }
5186 if (PropChange->StateChange == DICS_ENABLE)
5187 dwConfigFlags &= ~(PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED);
5188 else
5189 dwConfigFlags |= (PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED);
5190 rc = RegSetValueExW(
5191 hKey,
5192 RegistryValueName,
5193 0,
5194 REG_DWORD,
5195 (LPBYTE)&dwConfigFlags, sizeof(DWORD));
5196 if (rc != ERROR_SUCCESS)
5197 {
5198 SetLastError(rc);
5199 goto cleanup;
5200 }
5201
5202 /* Enable/disable device if needed */
5203 if (PropChange->Scope == DICS_FLAG_GLOBAL
5204 || PropChange->HwProfile == 0
5205 || PropChange->HwProfile == SETUPAPI_GetCurrentHwProfile(DeviceInfoSet))
5206 {
5207 if (PropChange->StateChange == DICS_ENABLE)
5209 else
5211 }
5212 else
5213 ret = TRUE;
5214 break;
5215 }
5216 case DICS_PROPCHANGE:
5217 {
5219 break;
5220 }
5221 default:
5222 {
5223 ERR("Unknown StateChange 0x%lx\n", PropChange->StateChange);
5225 }
5226 }
5227
5228cleanup:
5229 if (hRootKey != INVALID_HANDLE_VALUE && hRootKey != set->HKLM)
5230 RegCloseKey(hRootKey);
5231
5234
5235 TRACE("Returning %d\n", ret);
5236 return ret;
5237}
static HKEY OpenHardwareProfileKey(IN HKEY HKLM, IN DWORD HwProfile, IN DWORD samDesired)
Definition: devinst.c:4681
static BOOL ResetDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5066
static DWORD SETUPAPI_GetCurrentHwProfile(IN HDEVINFO DeviceInfoSet)
Definition: devinst.c:5019
HKEY SETUPDI_CreateDevKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5717
static BOOL StopDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:5090
#define CSCONFIGFLAG_DISABLED
Definition: regstr.h:401
#define REGSTR_VAL_CSCONFIGFLAGS
Definition: regstr.h:389
#define REGSTR_VAL_CONFIGFLAGS
Definition: regstr.h:388
#define CONFIGFLAG_DISABLED
Definition: regstr.h:390
#define DICS_DISABLE
Definition: setupapi.h:116
#define DICS_PROPCHANGE
Definition: setupapi.h:118
#define DICS_ENABLE
Definition: setupapi.h:114
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:115

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

◆ SetupDiClassGuidsFromNameA()

BOOL WINAPI SetupDiClassGuidsFromNameA ( LPCSTR  ClassName,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize 
)

Definition at line 854 of file devinst.c.

859{
860 return SetupDiClassGuidsFromNameExA(ClassName, ClassGuidList,
862 NULL, NULL);
863}
BOOL WINAPI SetupDiClassGuidsFromNameExA(LPCSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCSTR MachineName, PVOID Reserved)
Definition: devinst.c:882

Referenced by test_SetupDiClassGuidsFromNameA().

◆ SetupDiClassGuidsFromNameExA()

BOOL WINAPI SetupDiClassGuidsFromNameExA ( LPCSTR  ClassName,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize,
LPCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 882 of file devinst.c.

889{
890 LPWSTR ClassNameW = NULL;
891 LPWSTR MachineNameW = NULL;
892 BOOL bResult;
893
894 TRACE("%s(%s %p %lu %p %s %p)\n", __FUNCTION__, debugstr_a(ClassName), ClassGuidList,
896
897 if (!ClassName)
898 {
900 return FALSE;
901 }
902
903 ClassNameW = pSetupMultiByteToUnicode(ClassName, CP_ACP);
904 if (ClassNameW == NULL)
905 return FALSE;
906
907 if (MachineName)
908 {
910 if (MachineNameW == NULL)
911 {
912 MyFree(ClassNameW);
913 return FALSE;
914 }
915 }
916
917 bResult = SetupDiClassGuidsFromNameExW(ClassNameW, ClassGuidList,
919 MachineNameW, Reserved);
920
921 MyFree(MachineNameW);
922 MyFree(ClassNameW);
923
924 return bResult;
925}
BOOL WINAPI SetupDiClassGuidsFromNameExW(LPCWSTR ClassName, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:930

Referenced by SetupDiClassGuidsFromNameA().

◆ SetupDiClassGuidsFromNameExW()

BOOL WINAPI SetupDiClassGuidsFromNameExW ( LPCWSTR  ClassName,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize,
LPCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 930 of file devinst.c.

937{
938 WCHAR szKeyName[40];
940 HKEY hClassesKey;
943 DWORD dwIndex;
944 LONG lError;
945 DWORD dwGuidListIndex = 0;
946
947 TRACE("%s(%s %p %lu %p %s %p)\n", __FUNCTION__, debugstr_w(ClassName), ClassGuidList,
949
950 if (!ClassName || !RequiredSize)
951 {
953 return FALSE;
954 }
955 if (!ClassGuidList && ClassGuidListSize > 0)
956 {
958 return FALSE;
959 }
960 *RequiredSize = 0;
961
962 hClassesKey = SetupDiOpenClassRegKeyExW(NULL,
966 Reserved);
967 if (hClassesKey == INVALID_HANDLE_VALUE)
968 {
969 return FALSE;
970 }
971
972 for (dwIndex = 0; ; dwIndex++)
973 {
974 dwLength = 40;
975 lError = RegEnumKeyExW(hClassesKey,
976 dwIndex,
977 szKeyName,
978 &dwLength,
979 NULL,
980 NULL,
981 NULL,
982 NULL);
983 TRACE("RegEnumKeyExW() returns %d\n", lError);
984 if (lError == ERROR_SUCCESS || lError == ERROR_MORE_DATA)
985 {
986 TRACE("Key name: %p\n", szKeyName);
987
988 if (RegOpenKeyExW(hClassesKey,
989 szKeyName,
990 0,
992 &hClassKey))
993 {
994 RegCloseKey(hClassesKey);
995 return FALSE;
996 }
997
1001 NULL,
1002 NULL,
1004 &dwLength))
1005 {
1006 TRACE("Class name: %p\n", szClassName);
1007
1008 if (strcmpiW(szClassName, ClassName) == 0)
1009 {
1010 TRACE("Found matching class name\n");
1011
1012 TRACE("Guid: %p\n", szKeyName);
1013 if (dwGuidListIndex < ClassGuidListSize)
1014 {
1015 if (szKeyName[0] == '{' && szKeyName[37] == '}')
1016 {
1017 szKeyName[37] = 0;
1018 }
1019 TRACE("Guid: %p\n", &szKeyName[1]);
1020
1021 UuidFromStringW(&szKeyName[1],
1022 &ClassGuidList[dwGuidListIndex]);
1023 }
1024
1025 dwGuidListIndex++;
1026 }
1027 }
1028
1030 }
1031
1032 if (lError != ERROR_SUCCESS)
1033 break;
1034 }
1035
1036 RegCloseKey(hClassesKey);
1037
1038 if (RequiredSize != NULL)
1039 *RequiredSize = dwGuidListIndex;
1040
1041 if (ClassGuidListSize < dwGuidListIndex)
1042 {
1044 return FALSE;
1045 }
1046
1047 return TRUE;
1048}
#define MAX_CLASS_NAME_LEN
Definition: cfgmgr32.h:52
static const WCHAR szClassName[]
Definition: clipbrd.c:11
#define ERROR_MORE_DATA
Definition: dderror.h:13
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:2504
HKEY WINAPI SetupDiOpenClassRegKeyExW(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:3708
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1022
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:655
#define DIOCR_INSTALLER
Definition: setupapi.h:179

Referenced by SetupDiClassGuidsFromNameExA(), and SetupDiClassGuidsFromNameW().

◆ SetupDiClassGuidsFromNameW()

BOOL WINAPI SetupDiClassGuidsFromNameW ( LPCWSTR  ClassName,
LPGUID  ClassGuidList,
DWORD  ClassGuidListSize,
PDWORD  RequiredSize 
)

Definition at line 868 of file devinst.c.

873{
874 return SetupDiClassGuidsFromNameExW(ClassName, ClassGuidList,
876 NULL, NULL);
877}

◆ SetupDiClassNameFromGuidA()

BOOL WINAPI SetupDiClassNameFromGuidA ( const GUID ClassGuid,
PSTR  ClassName,
DWORD  ClassNameSize,
PDWORD  RequiredSize 
)

Definition at line 1053 of file devinst.c.

1058{
1059 return SetupDiClassNameFromGuidExA(ClassGuid, ClassName,
1060 ClassNameSize, RequiredSize,
1061 NULL, NULL);
1062}
BOOL WINAPI SetupDiClassNameFromGuidExA(const GUID *ClassGuid, PSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved)
Definition: devinst.c:1081

Referenced by test_SetupDiBuildClassInfoList(), and test_SetupDiClassNameFromGuidA().

◆ SetupDiClassNameFromGuidExA()

BOOL WINAPI SetupDiClassNameFromGuidExA ( const GUID ClassGuid,
PSTR  ClassName,
DWORD  ClassNameSize,
PDWORD  RequiredSize,
PCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 1081 of file devinst.c.

1088{
1089 WCHAR ClassNameW[MAX_CLASS_NAME_LEN];
1090 LPWSTR MachineNameW = NULL;
1091 BOOL ret;
1092
1093 if (MachineName)
1095 ret = SetupDiClassNameFromGuidExW(ClassGuid, ClassNameW, MAX_CLASS_NAME_LEN,
1096 RequiredSize, MachineNameW, Reserved);
1097 if (ret)
1098 {
1099 int len = WideCharToMultiByte(CP_ACP, 0, ClassNameW, -1, ClassName,
1100 ClassNameSize, NULL, NULL);
1101 if (len == 0 || len > ClassNameSize)
1102 {
1104 ret = FALSE;
1105 }
1106 }
1107 MyFree(MachineNameW);
1108 return ret;
1109}
#define WideCharToMultiByte
Definition: compat.h:111
BOOL WINAPI SetupDiClassNameFromGuidExW(const GUID *ClassGuid, PWSTR ClassName, DWORD ClassNameSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1114
GLenum GLsizei len
Definition: glext.h:6722

Referenced by SetupDiClassNameFromGuidA().

◆ SetupDiClassNameFromGuidExW()

BOOL WINAPI SetupDiClassNameFromGuidExW ( const GUID ClassGuid,
PWSTR  ClassName,
DWORD  ClassNameSize,
PDWORD  RequiredSize,
PCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 1114 of file devinst.c.

1121{
1122 HKEY hKey;
1124 DWORD dwRegType;
1125 LONG rc;
1126 PWSTR Buffer;
1127
1128 TRACE("%s(%s %p %lu %p %s %p)\n", __FUNCTION__, debugstr_guid(ClassGuid), ClassName,
1129 ClassNameSize, RequiredSize, debugstr_w(MachineName), Reserved);
1130
1131 /* Make sure there's a GUID */
1132 if (ClassGuid == NULL)
1133 {
1134 SetLastError(ERROR_INVALID_CLASS); /* On Vista: ERROR_INVALID_USER_BUFFER */
1135 return FALSE;
1136 }
1137
1138 /* Make sure there's a real buffer when there's a size */
1139 if ((ClassNameSize > 0) && (ClassName == NULL))
1140 {
1141 SetLastError(ERROR_INVALID_PARAMETER); /* On Vista: ERROR_INVALID_USER_BUFFER */
1142 return FALSE;
1143 }
1144
1145 /* Open the key for the GUID */
1147
1149 return FALSE;
1150
1151 /* Retrieve the class name data and close the key */
1152 rc = QueryRegistryValue(hKey, REGSTR_VAL_CLASS, (LPBYTE *) &Buffer, &dwRegType, &dwLength);
1154
1155 /* Make sure we got the data */
1156 if (rc != ERROR_SUCCESS)
1157 {
1158 SetLastError(rc);
1159 return FALSE;
1160 }
1161
1162 /* Make sure the data is a string */
1163 if (dwRegType != REG_SZ)
1164 {
1165 MyFree(Buffer);
1167 return FALSE;
1168 }
1169
1170 /* Determine the length of the class name */
1171 dwLength /= sizeof(WCHAR);
1172
1173 if ((dwLength == 0) || (Buffer[dwLength - 1] != UNICODE_NULL))
1174 /* Count the null-terminator */
1175 dwLength++;
1176
1177 /* Inform the caller about the class name */
1178 if ((ClassName != NULL) && (dwLength <= ClassNameSize))
1179 {
1180 memcpy(ClassName, Buffer, (dwLength - 1) * sizeof(WCHAR));
1181 ClassName[dwLength - 1] = UNICODE_NULL;
1182 }
1183
1184 /* Inform the caller about the required size */
1185 if (RequiredSize != NULL)
1187
1188 /* Clean up the buffer */
1189 MyFree(Buffer);
1190
1191 /* Make sure the buffer was large enough */
1192 if ((ClassName == NULL) || (dwLength > ClassNameSize))
1193 {
1195 return FALSE;
1196 }
1197
1198 return TRUE;
1199}
PVOID QueryRegistryValue(HANDLE RegHandle, PWCHAR ValueName, LPDWORD RegistryType, LPDWORD Length)
Definition: registry.c:67
#define ERROR_INVALID_CLASS
Definition: setupapi.h:305
uint16_t * PWSTR
Definition: typedefs.h:56

Referenced by SetupDiClassNameFromGuidExA(), and SetupDiClassNameFromGuidW().

◆ SetupDiClassNameFromGuidW()

BOOL WINAPI SetupDiClassNameFromGuidW ( const GUID ClassGuid,
PWSTR  ClassName,
DWORD  ClassNameSize,
PDWORD  RequiredSize 
)

Definition at line 1067 of file devinst.c.

1072{
1073 return SetupDiClassNameFromGuidExW(ClassGuid, ClassName,
1074 ClassNameSize, RequiredSize,
1075 NULL, NULL);
1076}

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

◆ SetupDiCreateDeviceInfoA()

BOOL WINAPI SetupDiCreateDeviceInfoA ( HDEVINFO  DeviceInfoSet,
PCSTR  DeviceName,
CONST GUID ClassGuid,
PCSTR  DeviceDescription,
HWND  hwndParent,
DWORD  CreationFlags,
PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 1528 of file devinst.c.

1536{
1537 BOOL ret;
1538 LPWSTR DeviceNameW = NULL;
1539 LPWSTR DeviceDescriptionW = NULL;
1540
1541 TRACE("\n");
1542
1543 if (DeviceName)
1544 {
1546 if (DeviceNameW == NULL) return FALSE;
1547 }
1549 {
1550 DeviceDescriptionW = pSetupMultiByteToUnicode(DeviceDescription, CP_ACP);
1551 if (DeviceDescriptionW == NULL)
1552 {
1553 MyFree(DeviceNameW);
1554 return FALSE;
1555 }
1556 }
1557
1558 ret = SetupDiCreateDeviceInfoW(DeviceInfoSet, DeviceNameW, ClassGuid, DeviceDescriptionW,
1559 hwndParent, CreationFlags, DeviceInfoData);
1560
1561 MyFree(DeviceNameW);
1562 MyFree(DeviceDescriptionW);
1563
1564 return ret;
1565}
static HWND hwndParent
Definition: cryptui.c:299
BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO DeviceInfoSet, PCWSTR DeviceName, CONST GUID *ClassGuid, PCWSTR DeviceDescription, HWND hwndParent, DWORD CreationFlags, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:1570
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:432

Referenced by test_device_iface(), test_device_iface_detail(), test_device_info(), test_device_interface_key(), test_device_key(), test_devnode(), test_get_device_instance_id(), test_register_device_iface(), test_register_device_info(), test_registry_property_a(), and test_registry_property_w().

◆ SetupDiCreateDeviceInfoList()

HDEVINFO WINAPI SetupDiCreateDeviceInfoList ( const GUID ClassGuid,
HWND  hwndParent 
)

Definition at line 1205 of file devinst.c.

1207{
1209}
HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid, HWND hwndParent, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:1259

Referenced by InstallCompositeBattery(), InstallSoftwareBusPnpEnumerator(), SetupDiInstallClassExW(), test_device_iface(), test_device_iface_detail(), test_device_info(), test_device_key(), test_get_device_instance_id(), and test_register_device_info().

◆ SetupDiCreateDeviceInfoListExA()

HDEVINFO WINAPI SetupDiCreateDeviceInfoListExA ( const GUID ClassGuid,
HWND  hwndParent,
PCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 1215 of file devinst.c.

1219{
1220 LPWSTR MachineNameW = NULL;
1221 HDEVINFO hDevInfo;
1222
1223 TRACE("%s(%s %p %s %p)\n", __FUNCTION__, debugstr_guid(ClassGuid), hwndParent,
1225
1226 if (MachineName)
1227 {
1229 if (MachineNameW == NULL)
1230 return INVALID_HANDLE_VALUE;
1231 }
1232
1233 hDevInfo = SetupDiCreateDeviceInfoListExW(ClassGuid, hwndParent,
1234 MachineNameW, Reserved);
1235
1236 MyFree(MachineNameW);
1237
1238 return hDevInfo;
1239}

◆ SetupDiCreateDeviceInfoListExW()

HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW ( const GUID ClassGuid,
HWND  hwndParent,
PCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 1259 of file devinst.c.

1263{
1264 struct DeviceInfoSet *list = NULL;
1266 DWORD rc;
1267 CONFIGRET cr;
1269
1270 TRACE("%s(%s %p %s %p)\n", __FUNCTION__, debugstr_guid(ClassGuid), hwndParent,
1272
1273 if (MachineName != NULL)
1274 {
1276 if (len >= SP_MAX_MACHINENAME_LENGTH - 4)
1277 {
1279 goto cleanup;
1280 }
1281 if(len > 0)
1282 size += (len + 3) * sizeof(WCHAR);
1283 else
1284 MachineName = NULL;
1285 }
1286
1287 if (Reserved != NULL)
1288 {
1290 return INVALID_HANDLE_VALUE;
1291 }
1292
1293 list = MyMalloc(size);
1294 if (!list)
1295 {
1297 return INVALID_HANDLE_VALUE;
1298 }
1300
1302 memcpy(&list->ClassGuid,
1304 sizeof(list->ClassGuid));
1305 list->InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
1306 list->InstallParams.Flags |= DI_CLASSINSTALLPARAMS;
1307 list->InstallParams.hwndParent = hwndParent;
1308 if (MachineName)
1309 {
1311 if (rc != ERROR_SUCCESS)
1312 {
1314 goto cleanup;
1315 }
1316
1317 list->szData[0] = list->szData[1] = '\\';
1318 strcpyW(list->szData + 2, MachineName);
1319 list->MachineName = list->szData;
1320 }
1321 else
1322 {
1323 list->HKLM = HKEY_LOCAL_MACHINE;
1324 list->MachineName = NULL;
1325 }
1326 cr = CM_Connect_MachineW(list->MachineName, &list->hMachine);
1327 if (cr != CR_SUCCESS)
1328 {
1330 goto cleanup;
1331 }
1332 InitializeListHead(&list->DriverListHead);
1333 InitializeListHead(&list->ListHead);
1334
1335 return (HDEVINFO)list;
1336
1337cleanup:
1339 {
1340 if (list)
1341 {
1342 if (list->HKLM != NULL && list->HKLM != HKEY_LOCAL_MACHINE)
1343 RegCloseKey(list->HKLM);
1344 MyFree(list);
1345 }
1346 }
1347 return ret;
1348}
LONG WINAPI RegConnectRegistryW(LPCWSTR lpMachineName, HKEY hKey, PHKEY phkResult)
Definition: reg.c:874
#define GUID_NULL
Definition: ks.h:106
#define SP_MAX_MACHINENAME_LENGTH
Definition: setupapi.h:29
#define ERROR_INVALID_MACHINENAME
Definition: setupapi.h:331
WCHAR szData[ANYSIZE_ARRAY]
ULONG_PTR SIZE_T
Definition: typedefs.h:80

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

◆ SetupDiCreateDeviceInfoW()

BOOL WINAPI SetupDiCreateDeviceInfoW ( HDEVINFO  DeviceInfoSet,
PCWSTR  DeviceName,
CONST GUID ClassGuid,
PCWSTR  DeviceDescription,
HWND  hwndParent,
DWORD  CreationFlags,
PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 1570 of file devinst.c.

1578{
1579 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
1580 struct DeviceInfo *deviceInfo = NULL;
1581 BOOL ret = FALSE;
1582 CONFIGRET cr;
1583 DEVINST RootDevInst;
1584 DEVINST DevInst;
1585 WCHAR GenInstanceId[MAX_DEVICE_ID_LEN];
1586 DWORD dwFlags;
1587
1588 TRACE("%s(%p %s %s %s %p %x %p)\n", __FUNCTION__, DeviceInfoSet, debugstr_w(DeviceName),
1591
1592 if (!DeviceName)
1593 {
1595 return FALSE;
1596 }
1598 {
1600 return FALSE;
1601 }
1602 if (!ClassGuid)
1603 {
1605 return FALSE;
1606 }
1607 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
1608 {
1610 return FALSE;
1611 }
1612 if (!IsEqualGUID(&set->ClassGuid, &GUID_NULL) &&
1613 !IsEqualGUID(ClassGuid, &set->ClassGuid))
1614 {
1616 return FALSE;
1617 }
1619 {
1620 TRACE("Unknown flags: 0x%08lx\n", CreationFlags & ~(DICD_GENERATE_ID | DICD_INHERIT_CLASSDRVS));
1622 return FALSE;
1623 }
1624
1625 /* Get the root device instance */
1626 cr = CM_Locate_DevInst_ExW(&RootDevInst,
1627 NULL,
1629 set->hMachine);
1630 if (cr != CR_SUCCESS)
1631 {
1633 return FALSE;
1634 }
1635
1639
1640 /* Create the new device instance */
1641 cr = CM_Create_DevInst_ExW(&DevInst,
1643 RootDevInst,
1644 dwFlags,
1645 set->hMachine);
1646 if (cr != CR_SUCCESS)
1647 {
1649 return FALSE;
1650 }
1651
1653 {
1654 /* Grab the actual instance ID that was created */
1655 cr = CM_Get_Device_ID_Ex(DevInst,
1656 GenInstanceId,
1658 0,
1659 set->hMachine);
1660 if (cr != CR_SUCCESS)
1661 {
1663 return FALSE;
1664 }
1665
1666 DeviceName = GenInstanceId;
1667 TRACE("Using generated instance ID: %s\n", debugstr_w(DeviceName));
1668 }
1669
1670 if (CreateDeviceInfo(set, DeviceName, ClassGuid, &deviceInfo))
1671 {
1672 InsertTailList(&set->ListHead, &deviceInfo->ListEntry);
1673
1674 if (!DeviceInfoData)
1675 ret = TRUE;
1676 else
1677 {
1678 if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
1679 {
1681 }
1682 else
1683 {
1685 DeviceInfoData->DevInst = deviceInfo->dnDevInst;
1686 DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
1687 ret = TRUE;
1688 }
1689 }
1690 }
1691
1692 if (ret == FALSE)
1693 {
1694 if (deviceInfo != NULL)
1695 {
1696 /* Remove deviceInfo from List */
1697 RemoveEntryList(&deviceInfo->ListEntry);
1698
1699 /* Destroy deviceInfo */
1700 DestroyDeviceInfo(deviceInfo);
1701 }
1702 }
1703
1704 TRACE("Returning %d\n", ret);
1705 return ret;
1706}
#define CM_CREATE_DEVINST_GENERATE_ID
Definition: cfgmgr32.h:629
#define CM_CREATE_DEVINST_PHANTOM
Definition: cfgmgr32.h:628
DWORD DEVINST
Definition: cfgmgr32.h:76
#define CM_Locate_DevInst_ExW
Definition: cfgmgr32.h:2395
#define CM_LOCATE_DEVINST_NORMAL
Definition: cfgmgr32.h:766
#define CM_Create_DevInst_ExW
Definition: cfgmgr32.h:1117
DEVINSTID_A DEVINSTID
Definition: cfgmgr32.h:87
#define CM_Get_Device_ID_Ex
Definition: cfgmgr32.h:1566
#define MAX_DEVICE_ID_LEN
Definition: devaction.c:40
BOOL CreateDeviceInfo(IN struct DeviceInfoSet *list, IN LPCWSTR InstancePath, IN LPCGUID pClassGuid, OUT struct DeviceInfo **pDeviceInfo)
Definition: devinst.c:528
#define ULONG_PTR
Definition: config.h:101
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define ERROR_INVALID_DEVINST_NAME
Definition: setupapi.h:304
#define ERROR_CLASS_MISMATCH
Definition: setupapi.h:300
#define DICD_GENERATE_ID
Definition: setupapi.h:112
#define DICD_INHERIT_CLASSDRVS
Definition: setupapi.h:113
#define ERROR_INVALID_DATA
Definition: winerror.h:238

Referenced by InstallCompositeBattery(), InstallSoftwareBusPnpEnumerator(), and SetupDiCreateDeviceInfoA().

◆ SetupDiCreateDeviceInterfaceA()

BOOL WINAPI SetupDiCreateDeviceInterfaceA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
const GUID InterfaceClassGuid,
PCSTR  ReferenceString,
DWORD  CreationFlags,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData 
)

Definition at line 2501 of file devinst.c.

2508{
2509 BOOL ret;
2510 LPWSTR ReferenceStringW = NULL;
2511
2512 TRACE("%s(%p %p %s %s %08x %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData,
2514 CreationFlags, DeviceInterfaceData);
2515
2516 if (ReferenceString)
2517 {
2518 ReferenceStringW = pSetupMultiByteToUnicode(ReferenceString, CP_ACP);
2519 if (ReferenceStringW == NULL) return FALSE;
2520 }
2521
2523 InterfaceClassGuid, ReferenceStringW, CreationFlags,
2524 DeviceInterfaceData);
2525
2526 MyFree(ReferenceStringW);
2527
2528 return ret;
2529}
BOOL WINAPI SetupDiCreateDeviceInterfaceW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const GUID *InterfaceClassGuid, PCWSTR ReferenceString, DWORD CreationFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2534
_Must_inspect_result_ _In_ WDFDEVICE _In_ CONST GUID _In_opt_ PCUNICODE_STRING ReferenceString
Definition: wdfdevice.h:3636
_In_ CONST GUID * InterfaceClassGuid
Definition: iofuncs.h:1136

Referenced by test_device_iface(), test_device_iface_detail(), test_device_interface_key(), and test_register_device_iface().

◆ SetupDiCreateDeviceInterfaceRegKeyA()

HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyA ( HDEVINFO  DeviceInfoSet,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData,
DWORD  Reserved,
REGSAM  samDesired,
HINF  InfHandle,
PCSTR  InfSectionName 
)

Definition at line 2579 of file devinst.c.

2586{
2587 HKEY key;
2588 PWSTR InfSectionNameW = NULL;
2589
2590 TRACE("%s(%p %p %d %08x %p %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInterfaceData, Reserved,
2591 samDesired, InfHandle, InfSectionName);
2592 if (InfHandle)
2593 {
2594 if (!InfSectionName)
2595 {
2597 return INVALID_HANDLE_VALUE;
2598 }
2599 InfSectionNameW = pSetupMultiByteToUnicode(InfSectionName, CP_ACP);
2600 if (!InfSectionNameW)
2601 return INVALID_HANDLE_VALUE;
2602 }
2604 DeviceInterfaceData, Reserved, samDesired, InfHandle,
2605 InfSectionNameW);
2606 MyFree(InfSectionNameW);
2607 return key;
2608}
HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, DWORD Reserved, REGSAM samDesired, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:2613

Referenced by test_device_interface_key().

◆ SetupDiCreateDeviceInterfaceRegKeyW()

HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyW ( HDEVINFO  DeviceInfoSet,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData,
DWORD  Reserved,
REGSAM  samDesired,
HINF  InfHandle,
PCWSTR  InfSectionName 
)

Definition at line 2613 of file devinst.c.

2620{
2621 HKEY hKey, hDevKey, hRefKey, hDevParamKey;
2623 DWORD Length, RefLength, Index;
2624 LONG rc;
2625 WCHAR bracedGuidString[39];
2626 struct DeviceInterface *DevItf;
2627 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
2628
2629 TRACE("%s(%p %p %d %08x %p %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInterfaceData, Reserved,
2630 samDesired, InfHandle, InfSectionName);
2631
2634 {
2636 return INVALID_HANDLE_VALUE;
2637 }
2638 if (!DeviceInterfaceData ||
2639 DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA) ||
2640 !DeviceInterfaceData->Reserved)
2641 {
2643 return INVALID_HANDLE_VALUE;
2644 }
2645 if (InfHandle && !InfSectionName)
2646 {
2648 return INVALID_HANDLE_VALUE;
2649 }
2650
2651 hKey = SetupDiOpenClassRegKeyExW(&DeviceInterfaceData->InterfaceClassGuid, samDesired, DIOCR_INTERFACE, NULL, NULL);
2653 {
2656 {
2658 return INVALID_HANDLE_VALUE;
2659 }
2660 SETUPDI_GuidToString(&DeviceInterfaceData->InterfaceClassGuid, bracedGuidString);
2661
2662 if (RegCreateKeyExW(hKey, bracedGuidString, 0, NULL, 0, samDesired, NULL, &hDevKey, NULL) != ERROR_SUCCESS)
2663 {
2665 return INVALID_HANDLE_VALUE;
2666 }
2668 hKey = hDevKey;
2669 }
2670
2671 DevItf = (struct DeviceInterface *)DeviceInterfaceData->Reserved;
2672
2673 Length = (wcslen(DevItf->SymbolicLink)+1) * sizeof(WCHAR);
2675 if (!SymbolicLink)
2676 {
2679 return INVALID_HANDLE_VALUE;
2680 }
2681
2683
2684 /* Enumerate all characters in symbolic link */
2685 Index = 0;
2686 while (SymbolicLink[Index])
2687 {
2688 /* Check for a start position of reference string */
2689 if (SymbolicLink[Index] == L'}' && SymbolicLink[Index + 1] == L'\\')
2690 {
2691 /* Found it */
2692 SymbolicLink[Index + 1] = L'#';
2693 break;
2694 }
2695 /* Replace all '\' backslashes by '#' pounds in symbolic link */
2696 if (SymbolicLink[Index] == L'\\')
2697 {
2698 SymbolicLink[Index] = L'#';
2699 }
2700 Index++;
2701 }
2702
2703 /* Create reference string */
2704 RefLength = Length - Index * sizeof(WCHAR);
2705 ReferenceString = HeapAlloc(GetProcessHeap(), 0, RefLength);
2706 if (!ReferenceString)
2707 {
2710 return INVALID_HANDLE_VALUE;
2711 }
2712
2714
2715 /* Null-terminate symbolic link at the beginning of the reference part,
2716 * as we don't need a ref part in key name. */
2718
2719 /* Open device instance key */
2720 rc = RegOpenKeyExW(hKey, SymbolicLink, 0, samDesired, &hDevKey);
2723 if (rc != ERROR_SUCCESS)
2724 {
2726 SetLastError(rc);
2727 return INVALID_HANDLE_VALUE;
2728 }
2729
2730 /* Open reference key */
2731 rc = RegOpenKeyExW(hDevKey, ReferenceString, 0, samDesired, &hRefKey);
2733 RegCloseKey(hDevKey);
2734 if (rc != ERROR_SUCCESS)
2735 {
2736 SetLastError(rc);
2737 return INVALID_HANDLE_VALUE;
2738 }
2739
2740 /* Create/open "Device Parameters" subkey */
2741 rc = RegCreateKeyExW(hRefKey, L"Device Parameters", 0, NULL, 0, samDesired, NULL, &hDevParamKey, NULL);
2742 RegCloseKey(hRefKey);
2743 if (rc == ERROR_SUCCESS)
2744 {
2745 if (InfHandle && InfSectionName)
2746 {
2747 if (!SetupInstallFromInfSectionW(NULL /*FIXME */,
2748 InfHandle,
2749 InfSectionName,
2752 SPINST_UNREGSVR | SPINST_PROFILEITEMS | SPINST_COPYINF,
2753 hDevParamKey,
2754 NULL,
2755 0,
2756 set->SelectedDevice->InstallParams.InstallMsgHandler,
2757 set->SelectedDevice->InstallParams.InstallMsgHandlerContext,
2759 NULL))
2760 {
2761 RegCloseKey(hDevParamKey);
2762 return INVALID_HANDLE_VALUE;
2763 }
2764 }
2765 }
2766
2767 SetLastError(rc);
2768 return hDevParamKey;
2769}
static void SETUPDI_GuidToString(const GUID *guid, LPWSTR guidStr)
Definition: devinst.c:81
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
Definition: install.c:1330
static const WCHAR SymbolicLink[]
Definition: interface.c:31
#define L(x)
Definition: resources.c:13
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
wcscpy
#define SPINST_BITREG
Definition: setupapi.h:596
#define SPINST_UNREGSVR
Definition: setupapi.h:598
#define SPINST_PROFILEITEMS
Definition: setupapi.h:599
#define SPINST_INI2REG
Definition: setupapi.h:594
#define SPINST_REGSVR
Definition: setupapi.h:597
#define DIOCR_INTERFACE
Definition: setupapi.h:180
#define SPINST_INIFILES
Definition: setupapi.h:592
#define SPINST_REGISTRY
Definition: setupapi.h:593
#define SPINST_FILES
Definition: setupapi.h:595
WCHAR SymbolicLink[ANYSIZE_ARRAY]

Referenced by InstallOneInterface(), InstallSoftwareDeviceInterfaceInf(), and SetupDiCreateDeviceInterfaceRegKeyA().

◆ SetupDiCreateDeviceInterfaceW()

BOOL WINAPI SetupDiCreateDeviceInterfaceW ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
const GUID InterfaceClassGuid,
PCWSTR  ReferenceString,
DWORD  CreationFlags,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData 
)

Definition at line 2534 of file devinst.c.

2541{
2542 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
2543 TRACE("%s(%p %p %s %s %08x %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData,
2545 CreationFlags, DeviceInterfaceData);
2546
2548 {
2550 return FALSE;
2551 }
2552 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
2553 {
2555 return FALSE;
2556 }
2559 {
2561 return FALSE;
2562 }
2563 if (!InterfaceClassGuid)
2564 {
2566 return FALSE;
2567 }
2568
2569 FIXME("%p %p %s %s %08x %p\n", DeviceInfoSet, DeviceInfoData,
2571 CreationFlags, DeviceInterfaceData);
2573 return FALSE;
2574}

Referenced by SetupDiCreateDeviceInterfaceA().

◆ SetupDiCreateDevRegKeyA()

HKEY WINAPI SetupDiCreateDevRegKeyA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Scope,
DWORD  HwProfile,
DWORD  KeyType,
HINF  InfHandle,
PCSTR  InfSectionName 
)

Definition at line 1353 of file devinst.c.

1361{
1362 PWSTR InfSectionNameW = NULL;
1363 HKEY key;
1364
1365 TRACE("%s(%p %p %d %d %d %p %s)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData, Scope,
1366 HwProfile, KeyType, InfHandle, debugstr_a(InfSectionName));
1367
1368 if (InfHandle)
1369 {
1370 if (!InfSectionName)
1371 {
1373 return INVALID_HANDLE_VALUE;
1374 }
1375 else
1376 {
1377 InfSectionNameW = pSetupMultiByteToUnicode(InfSectionName, CP_ACP);
1378 if (InfSectionNameW == NULL) return INVALID_HANDLE_VALUE;
1379 }
1380 }
1382 HwProfile, KeyType, InfHandle, InfSectionNameW);
1383 MyFree(InfSectionNameW);
1384 return key;
1385}
HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Scope, DWORD HwProfile, DWORD KeyType, HINF InfHandle, PCWSTR InfSectionName)
Definition: devinst.c:1396

◆ SetupDiCreateDevRegKeyW()

HKEY WINAPI SetupDiCreateDevRegKeyW ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Scope,
DWORD  HwProfile,
DWORD  KeyType,
HINF  InfHandle,
PCWSTR  InfSectionName 
)

Definition at line 1396 of file devinst.c.

1404{
1405 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
1406 struct DeviceInfo *deviceInfo;
1408 DWORD rc;
1409 HKEY hHWProfileKey = INVALID_HANDLE_VALUE;
1410 HKEY hKey = NULL;
1411 HKEY RootKey;
1412
1413 TRACE("%s(%p %p %lu %lu %lu %p %s)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData, Scope,
1414 HwProfile, KeyType, InfHandle, debugstr_w(InfSectionName));
1415
1417 {
1419 return INVALID_HANDLE_VALUE;
1420 }
1421 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
1422 {
1424 return INVALID_HANDLE_VALUE;
1425 }
1428 {
1430 return INVALID_HANDLE_VALUE;
1431 }
1432 if (Scope != DICS_FLAG_GLOBAL && Scope != DICS_FLAG_CONFIGSPECIFIC)
1433 {
1435 return INVALID_HANDLE_VALUE;
1436 }
1437 if (KeyType != DIREG_DEV && KeyType != DIREG_DRV)
1438 {
1440 return INVALID_HANDLE_VALUE;
1441 }
1442 if (InfHandle && !InfSectionName)
1443 {
1445 return INVALID_HANDLE_VALUE;
1446 }
1447 if (!InfHandle && InfSectionName)
1448 {
1450 return INVALID_HANDLE_VALUE;
1451 }
1452
1453 deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
1454
1455 if (Scope == DICS_FLAG_GLOBAL)
1456 RootKey = set->HKLM;
1457 else /* Scope == DICS_FLAG_CONFIGSPECIFIC */
1458 {
1459 hHWProfileKey = OpenHardwareProfileKey(set->HKLM, HwProfile, KEY_CREATE_SUB_KEY);
1460 if (hHWProfileKey == INVALID_HANDLE_VALUE)
1461 goto cleanup;
1462 RootKey = hHWProfileKey;
1463 }
1464
1465 if (KeyType == DIREG_DEV)
1466 {
1467#if _WIN32_WINNT >= 0x502
1469#else
1471#endif
1473 goto cleanup;
1474
1475 if (Scope == DICS_FLAG_GLOBAL)
1476 {
1477 HKEY hTempKey = hKey;
1478
1479 rc = RegCreateKeyExW(hTempKey,
1480 L"Device Parameters",
1481 0,
1482 NULL,
1484#if _WIN32_WINNT >= 0x502
1486#else
1488#endif
1489 NULL,
1490 &hKey,
1491 NULL);
1492 if (rc == ERROR_SUCCESS)
1493 RegCloseKey(hTempKey);
1494 }
1495 }
1496 else /* KeyType == DIREG_DRV */
1497 {
1498#if _WIN32_WINNT >= 0x502
1500#else
1502#endif
1504 goto cleanup;
1505 }
1506
1507 /* Do installation of the specified section */
1508 if (InfHandle)
1509 {
1510 FIXME("Need to install section %s in file %p\n",
1511 debugstr_w(InfSectionName), InfHandle);
1512 }
1513 key = hKey;
1514
1515cleanup:
1516 if (hHWProfileKey != INVALID_HANDLE_VALUE)
1517 RegCloseKey(hHWProfileKey);
1518 if (hKey != NULL && hKey != key)
1520
1521 TRACE("Returning 0x%p\n", key);
1522 return key;
1523}
HKEY SETUPDI_CreateDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, UUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:5733
#define DIREG_DEV
Definition: setupapi.h:184
#define DIREG_DRV
Definition: setupapi.h:185
#define DICS_FLAG_CONFIGSPECIFIC
Definition: setupapi.h:117

Referenced by GetPortType(), InstallDeviceData(), InstallNetDevice(), InstallParallelPort(), InstallSerialPort(), SetupDiCreateDevRegKeyA(), and test_device_key().

◆ SetupDiDeleteDeviceInfo()

BOOL WINAPI SetupDiDeleteDeviceInfo ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 4758 of file devinst.c.

4761{
4762 struct DeviceInfoSet *deviceInfoSet;
4763 struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData;
4764 BOOL ret = FALSE;
4765
4767
4768 if (!DeviceInfoSet)
4770 else if ((deviceInfoSet = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
4772 else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4774 else if (!IsDeviceInfoInDeviceInfoSet(deviceInfoSet, deviceInfo))
4776 else
4777 {
4778 RemoveEntryList(&deviceInfo->ListEntry);
4779 DestroyDeviceInfo(deviceInfo);
4780 ret = TRUE;
4781 }
4782
4783 return ret;
4784}
static BOOL IsDeviceInfoInDeviceInfoSet(struct DeviceInfoSet *deviceInfoSet, struct DeviceInfo *deviceInfo)
Definition: devinst.c:4736

Referenced by InstallCompositeBattery(), test_device_info(), and test_register_device_info().

◆ SetupDiDeleteDeviceInterfaceRegKey()

BOOL WINAPI SetupDiDeleteDeviceInterfaceRegKey ( HDEVINFO  DeviceInfoSet,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData,
DWORD  Reserved 
)

Definition at line 2774 of file devinst.c.

2778{
2779 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
2780 BOOL ret = FALSE;
2781
2782 TRACE("%s(%p %p %d)\n", __FUNCTION__, DeviceInfoSet, DeviceInterfaceData, Reserved);
2783
2786 {
2788 return FALSE;
2789 }
2790 if (!DeviceInterfaceData ||
2791 DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA) ||
2792 !DeviceInterfaceData->Reserved)
2793 {
2795 return FALSE;
2796 }
2797
2798 FIXME("%p %p %d\n", DeviceInfoSet, DeviceInterfaceData, Reserved);
2800 return ret;
2801}

Referenced by test_device_interface_key().

◆ SetupDiDeleteDevRegKey()

BOOL WINAPI SetupDiDeleteDevRegKey ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Scope,
DWORD  HwProfile,
DWORD  KeyType 
)

Definition at line 6079 of file devinst.c.

6085{
6086 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
6087 struct DeviceInfo *devInfo;
6088 BOOL ret = FALSE;
6089 HKEY RootKey;
6090
6091 TRACE("%s(%p %p %d %d %d)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData, Scope, HwProfile,
6092 KeyType);
6093
6095 {
6097 return FALSE;
6098 }
6099 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
6100 {
6102 return FALSE;
6103 }
6106 {
6108 return FALSE;
6109 }
6110 if (Scope != DICS_FLAG_GLOBAL && Scope != DICS_FLAG_CONFIGSPECIFIC)
6111 {
6113 return FALSE;
6114 }
6115 if (KeyType != DIREG_DEV && KeyType != DIREG_DRV && KeyType != DIREG_BOTH)
6116 {
6118 return FALSE;
6119 }
6120 devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
6121 if (devInfo->set != set)
6122 {
6124 return FALSE;
6125 }
6126 if (Scope != DICS_FLAG_GLOBAL)
6127 {
6128 RootKey = OpenHardwareProfileKey(set->HKLM, HwProfile, 0);
6130 return FALSE;
6131 }
6132 else
6133 RootKey = set->HKLM;
6134 switch (KeyType)
6135 {
6136 case DIREG_DEV:
6137 ret = SETUPDI_DeleteDevKey(RootKey, devInfo);
6138 break;
6139 case DIREG_DRV:
6140 ret = SETUPDI_DeleteDrvKey(RootKey, devInfo);
6141 break;
6142 case DIREG_BOTH:
6143 ret = SETUPDI_DeleteDevKey(RootKey, devInfo);
6144 if (ret)
6145 ret = SETUPDI_DeleteDrvKey(RootKey, devInfo);
6146 break;
6147 default:
6148 WARN("unknown KeyType %d\n", KeyType);
6149 }
6150 if (RootKey != set->HKLM)
6152 return ret;
6153}
#define WARN(fmt,...)
Definition: precomp.h:61
static BOOL SETUPDI_DeleteDrvKey(HKEY RootKey, struct DeviceInfo *devInfo)
Definition: devinst.c:6070
static BOOL SETUPDI_DeleteDevKey(HKEY RootKey, struct DeviceInfo *devInfo)
Definition: devinst.c:6064
#define DIREG_BOTH
Definition: setupapi.h:186

◆ SetupDiDestroyDeviceInfoList()

BOOL WINAPI SetupDiDestroyDeviceInfoList ( HDEVINFO  devinfo)

Definition at line 2939 of file devinst.c.

2940{
2941 BOOL ret = FALSE;
2942
2943 TRACE("%s(%p)\n", __FUNCTION__, devinfo);
2944 if (devinfo && devinfo != INVALID_HANDLE_VALUE)
2945 {
2946 struct DeviceInfoSet *list = (struct DeviceInfoSet *)devinfo;
2947
2948 if (list->magic == SETUP_DEVICE_INFO_SET_MAGIC)
2949 {
2951 }
2952 }
2953
2954 if (ret == FALSE)
2956
2957 return ret;
2958}
static BOOL DestroyDeviceInfoSet(struct DeviceInfoSet *list)
Definition: devinst.c:608

Referenced by BluetoothFindRadioClose(), check_device_path(), CDeviceNode::Cleanup(), cleanUp(), CloseDeviceList(), DeviceAdvancedPropertiesW(), DeviceProblemWizardW(), DevicePropertiesExW(), DevInstallW(), CNetConnection::Disconnect(), DisplayDeviceAdvancedProperties(), DisplayPageSetDeviceDetails(), CNetConnectionManager::EnumerateINetConnections(), EnumerateNetworkAdapter(), EnumHotpluggedDevices(), fill_pnpentity(), find_devices(), FreeDevicesList(), get_device(), getDeviceInfo(), getDeviceInterfaceDetail(), InitHardWareTypesPage(), InitProbeListPage(), InstallCompositeBattery(), InstallDevInstEx(), InstallSoftwareBusPnpEnumerator(), InstallSoftwareDeviceInterface(), InstallSoftwareDeviceInterfaceInf(), IsSoftwareBusPnpEnumeratorInstalled(), KsOpenDefaultDevice(), CKsProxy::Load(), PowerMeterInfo_UpdateBatteryStats(), ProcessExistingDevices(), CDeviceView::RefreshDeviceList(), run_for_each_device(), SetDeviceDetails(), SetupDiGetClassDevsExW(), SetupDiInstallClassExW(), test_create_device_list_ex(), test_D3DKMTOpenAdapterFromDeviceName_deviface(), test_device_iface(), test_device_iface_detail(), test_device_info(), test_device_interface_key(), test_device_key(), test_devnode(), test_get_device_instance_id(), test_gpu_device_properties_guid(), test_register_device_iface(), test_register_device_info(), test_registry_property_a(), test_registry_property_w(), test_SetupDiGetClassDevsA(), test_SetupDiGetClassDevsExW(), TestKs(), testSetupDiGetClassDevsA(), UpdateDevInfo(), UpdateDriverForPlugAndPlayDevicesW(), WdmAudInitUserModeMixer(), and WdmAudOpenSoundDeviceByLegacy().

◆ SetupDiEnumDeviceInfo()

BOOL WINAPI SetupDiEnumDeviceInfo ( HDEVINFO  devinfo,
DWORD  index,
PSP_DEVINFO_DATA  info 
)

Definition at line 1787 of file devinst.c.

1791{
1792 BOOL ret = FALSE;
1793
1794 TRACE("%s(%p %d %p)\n", __FUNCTION__, devinfo, index, info);
1795
1796 if(info==NULL)
1797 {
1799 return FALSE;
1800 }
1801 if (devinfo && devinfo != INVALID_HANDLE_VALUE)
1802 {
1803 struct DeviceInfoSet *list = (struct DeviceInfoSet *)devinfo;
1804 if (list->magic == SETUP_DEVICE_INFO_SET_MAGIC)
1805 {
1806 if (info->cbSize != sizeof(SP_DEVINFO_DATA))
1808 else
1809 {
1810 PLIST_ENTRY ItemList = list->ListHead.Flink;
1811 while (ItemList != &list->ListHead && index-- > 0)
1812 ItemList = ItemList->Flink;
1813 if (ItemList == &list->ListHead)
1815 else
1816 {
1817 struct DeviceInfo *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
1818 memcpy(&info->ClassGuid,
1819 &DevInfo->ClassGuid,
1820 sizeof(GUID));
1821 info->DevInst = DevInfo->dnDevInst;
1822 info->Reserved = (ULONG_PTR)DevInfo;
1823 ret = TRUE;
1824 }
1825 }
1826 }
1827 else
1829 }
1830 else
1832 return ret;
1833}
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
GLuint index
Definition: glext.h:6031

Referenced by BuildDevicesList(), check_device_info_(), DisplayPageSetDeviceDetails(), CNetConnectionManager::EnumerateINetConnections(), EnumerateNetworkAdapter(), EnumHotpluggedDevices(), fill_pnpentity(), FindNetworkAdapter(), getDeviceInfo(), InitProbeListPage(), CDeviceView::ListDevicesByType(), pCDevSettings_GetDeviceInstanceId(), CDeviceView::RefreshDeviceList(), SetDeviceDetails(), test_device_info(), test_register_device_info(), test_SetupDiGetClassDevsExW(), testSetupDiGetClassDevsA(), and UpdateDriverForPlugAndPlayDevicesW().

◆ SetupDiEnumDeviceInterfaces()

BOOL WINAPI SetupDiEnumDeviceInterfaces ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
CONST GUID InterfaceClassGuid,
DWORD  MemberIndex,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData 
)

Definition at line 2826 of file devinst.c.

2832{
2833 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
2834 BOOL ret = FALSE;
2835
2836 TRACE("%s(%p, %p, %s, %d, %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData,
2837 debugstr_guid(InterfaceClassGuid), MemberIndex, DeviceInterfaceData);
2838
2841 {
2843 return FALSE;
2844 }
2847 {
2849 return FALSE;
2850 }
2851 if (!DeviceInterfaceData ||
2852 DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA))
2853 {
2855 return FALSE;
2856 }
2857 if (DeviceInfoData)
2858 {
2859 struct DeviceInfo *devInfo =
2861 BOOL found = FALSE;
2862 PLIST_ENTRY InterfaceListEntry = devInfo->InterfaceListHead.Flink;
2863 while (InterfaceListEntry != &devInfo->InterfaceListHead && !found)
2864 {
2865 struct DeviceInterface *DevItf = CONTAINING_RECORD(InterfaceListEntry, struct DeviceInterface, ListEntry);
2867 {
2868 InterfaceListEntry = InterfaceListEntry->Flink;
2869 continue;
2870 }
2871 if (MemberIndex-- == 0)
2872 {
2873 /* return this item */
2874 memcpy(&DeviceInterfaceData->InterfaceClassGuid,
2875 &DevItf->InterfaceClassGuid,
2876 sizeof(GUID));
2877 DeviceInterfaceData->Flags = DevItf->Flags;
2878 DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf;
2879 found = TRUE;
2880 ret = TRUE;
2881 }
2882 InterfaceListEntry = InterfaceListEntry->Flink;
2883 }
2884 if (!found)
2886 }
2887 else
2888 {
2889 BOOL found = FALSE;
2890 PLIST_ENTRY ItemList = set->ListHead.Flink;
2891 while (ItemList != &set->ListHead && !found)
2892 {
2893 PLIST_ENTRY InterfaceListEntry;
2894 struct DeviceInfo *devInfo =
2895 CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
2896 InterfaceListEntry = devInfo->InterfaceListHead.Flink;
2897 while (InterfaceListEntry != &devInfo->InterfaceListHead && !found)
2898 {
2899 struct DeviceInterface *DevItf = CONTAINING_RECORD(InterfaceListEntry, struct DeviceInterface, ListEntry);
2901 {
2902 InterfaceListEntry = InterfaceListEntry->Flink;
2903 continue;
2904 }
2905 if (MemberIndex-- == 0)
2906 {
2907 /* return this item */
2908 memcpy(&DeviceInterfaceData->InterfaceClassGuid,
2909 &DevItf->InterfaceClassGuid,
2910 sizeof(GUID));
2911 DeviceInterfaceData->Flags = DevItf->Flags;
2912 DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf;
2913 found = TRUE;
2914 ret = TRUE;
2915 }
2916 InterfaceListEntry = InterfaceListEntry->Flink;
2917 }
2918 ItemList = ItemList->Flink;
2919
2920 }
2921 if (!found)
2923 }
2924 return ret;
2925}
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by BluetoothFindNextRadio(), check_device_iface_(), check_device_path(), Enum(), find_devices(), get_device(), getDeviceInterfaceDetail(), GetDeviceListInterfaces(), InstallSoftwareDeviceInterface(), InstallSoftwareDeviceInterfaceInf(), IsSoftwareBusPnpEnumeratorInstalled(), KsOpenDefaultDevice(), PowerMeterInfo_UpdateBatteryStats(), ProcessExistingDevices(), run_for_each_device(), test_D3DKMTOpenAdapterFromDeviceName_deviface(), test_device_iface(), test_gpu_device_properties_guid(), test_register_device_iface(), TestKs(), and WdmAudOpenSoundDeviceByLegacy().

◆ SetupDiGetActualSectionToInstallA()

BOOL WINAPI SetupDiGetActualSectionToInstallA ( HINF  InfHandle,
PCSTR  InfSectionName,
PSTR  InfSectionWithExt,
DWORD  InfSectionWithExtSize,
PDWORD  RequiredSize,
PSTR Extension 
)

Definition at line 1964 of file devinst.c.

1971{
1972 return SetupDiGetActualSectionToInstallExA(InfHandle, InfSectionName,
1973 NULL, InfSectionWithExt, InfSectionWithExtSize, RequiredSize,
1974 Extension, NULL);
1975}
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)
Definition: devinst.c:1997
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092

◆ SetupDiGetActualSectionToInstallExA()

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 
)

Definition at line 1997 of file devinst.c.

2006{
2007 LPWSTR InfSectionNameW = NULL;
2008 LPWSTR InfSectionWithExtW = NULL;
2009 PWSTR ExtensionW;
2010 BOOL bResult = FALSE;
2011
2012 TRACE("%s()\n", __FUNCTION__);
2013
2014 if (InfSectionName)
2015 {
2016 InfSectionNameW = pSetupMultiByteToUnicode(InfSectionName, CP_ACP);
2017 if (InfSectionNameW == NULL)
2018 goto cleanup;
2019 }
2020 if (InfSectionWithExt)
2021 {
2022 InfSectionWithExtW = MyMalloc(InfSectionWithExtSize * sizeof(WCHAR));
2023 if (InfSectionWithExtW == NULL)
2024 goto cleanup;
2025 }
2026
2028 InfHandle, InfSectionNameW, AlternatePlatformInfo,
2029 InfSectionWithExt ? InfSectionWithExtW : NULL,
2030 InfSectionWithExtSize,
2032 Extension ? &ExtensionW : NULL,
2033 Reserved);
2034
2035 if (bResult && InfSectionWithExt)
2036 {
2037 bResult = WideCharToMultiByte(CP_ACP, 0, InfSectionWithExtW, -1, InfSectionWithExt,
2038 InfSectionWithExtSize, NULL, NULL) != 0;
2039 }
2040 if (bResult && Extension)
2041 {
2042 if (ExtensionW == NULL)
2043 *Extension = NULL;
2044 else
2045 *Extension = &InfSectionWithExt[ExtensionW - InfSectionWithExtW];
2046 }
2047
2048cleanup:
2049 MyFree(InfSectionNameW);
2050 MyFree(InfSectionWithExtW);
2051
2052 return bResult;
2053}
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)
Definition: devinst.c:415

Referenced by SetupDiGetActualSectionToInstallA().

◆ SetupDiGetActualSectionToInstallExW()

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 
)

Definition at line 415 of file devinst.c.

424{
425 BOOL ret = FALSE;
426
427 TRACE("%s(%p %s %p %p %lu %p %p %p)\n", __FUNCTION__, InfHandle, debugstr_w(InfSectionName),
428 AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize,
430
431 if (!InfHandle || InfHandle == (HINF)INVALID_HANDLE_VALUE)
433 else if (!InfSectionName)
435 else if (AlternatePlatformInfo && AlternatePlatformInfo->cbSize != sizeof(SP_ALTPLATFORM_INFO))
437 else if (Reserved != NULL)
439 else
440 {
441 static SP_ALTPLATFORM_INFO CurrentPlatform = { 0, };
442 static BYTE CurrentProductType = 0;
443 static WORD CurrentSuiteMask = 0;
444 PSP_ALTPLATFORM_INFO pPlatformInfo = &CurrentPlatform;
445 struct GetSectionCallbackInfo CallbackInfo;
446 DWORD dwFullLength;
449
450 /* Fill platform info if needed */
451 if (AlternatePlatformInfo)
452 {
453 pPlatformInfo = AlternatePlatformInfo;
454 ProductType = 0;
455 SuiteMask = 0;
456 }
457 else
458 {
459 if (CurrentPlatform.cbSize != sizeof(SP_ALTPLATFORM_INFO))
460 {
461 /* That's the first time we go here. We need to fill in the structure */
462 SYSTEM_INFO SystemInfo;
463 GetSystemInfo(&SystemInfo);
464 CurrentPlatform.cbSize = sizeof(SP_ALTPLATFORM_INFO);
465 CurrentPlatform.Platform = OsVersionInfo.dwPlatformId;
466 CurrentPlatform.MajorVersion = OsVersionInfo.dwMajorVersion;
467 CurrentPlatform.MinorVersion = OsVersionInfo.dwMinorVersion;
468 CurrentPlatform.ProcessorArchitecture = SystemInfo.wProcessorArchitecture;
469 CurrentPlatform.Reserved = 0;
470 CurrentProductType = OsVersionInfo.wProductType;
471 CurrentSuiteMask = OsVersionInfo.wSuiteMask;
472 }
473 ProductType = CurrentProductType;
474 SuiteMask = CurrentSuiteMask;
475 }
476
477 CallbackInfo.PlatformInfo = pPlatformInfo;
478 CallbackInfo.ProductType = ProductType;
479 CallbackInfo.SuiteMask = SuiteMask;
480 CallbackInfo.PrefixLength = strlenW(InfSectionName);
481 CallbackInfo.BestScore1 = ULONG_MAX;
482 CallbackInfo.BestScore2 = ULONG_MAX;
483 CallbackInfo.BestScore3 = ULONG_MAX;
484 CallbackInfo.BestScore4 = ULONG_MAX;
485 CallbackInfo.BestScore5 = ULONG_MAX;
486 strcpyW(CallbackInfo.BestSection, InfSectionName);
487 TRACE("EnumerateSectionsStartingWith(InfSectionName = %S)\n", InfSectionName);
489 InfHandle,
490 InfSectionName,
492 &CallbackInfo))
493 {
495 goto done;
496 }
497 TRACE("CallbackInfo.BestSection = %S\n", CallbackInfo.BestSection);
498
499 dwFullLength = lstrlenW(CallbackInfo.BestSection);
500 if (RequiredSize != NULL)
501 *RequiredSize = dwFullLength + 1;
502
503 if (InfSectionWithExtSize > 0)
504 {
505 if (InfSectionWithExtSize < dwFullLength + 1)
506 {
508 goto done;
509 }
510 strcpyW(InfSectionWithExt, CallbackInfo.BestSection);
511 if (Extension)
512 {
513 DWORD dwLength = lstrlenW(InfSectionName);
514 *Extension = (dwLength == dwFullLength) ? NULL : &InfSectionWithExt[dwLength];
515 }
516 }
517
518 ret = TRUE;
519 }
520
521done:
522 TRACE("Returning %d\n", ret);
523 return ret;
524}
#define lstrlenW
Definition: compat.h:750
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
static BOOL GetSectionCallback(IN LPCWSTR SectionName, IN PVOID Context)
Definition: devinst.c:365
BOOL EnumerateSectionsStartingWith(IN HINF hInf, IN LPCWSTR pStr, IN FIND_CALLBACK Callback, IN PVOID Context)
Definition: parser.c:2411
unsigned short WORD
Definition: ntddk_ex.h:93
SP_ALTPLATFORM_INFO_V1 SP_ALTPLATFORM_INFO
Definition: setupapi.h:733
OSVERSIONINFOEXW OsVersionInfo
Definition: setupcab.c:33
ULONG dwMajorVersion
Definition: rtltypes.h:270
ULONG dwMinorVersion
Definition: rtltypes.h:271
ULONG dwPlatformId
Definition: rtltypes.h:273
UCHAR wProductType
Definition: rtltypes.h:278
USHORT wSuiteMask
Definition: rtltypes.h:277
WORD wProcessorArchitecture
Definition: winbase.h:894

Referenced by SetupDiGetActualSectionToInstallExA(), and SetupDiGetActualSectionToInstallW().

◆ SetupDiGetActualSectionToInstallW()

BOOL WINAPI SetupDiGetActualSectionToInstallW ( HINF  InfHandle,
PCWSTR  InfSectionName,
PWSTR  InfSectionWithExt,
DWORD  InfSectionWithExtSize,
PDWORD  RequiredSize,
PWSTR Extension 
)

◆ SetupDiGetClassDescriptionA()

BOOL WINAPI SetupDiGetClassDescriptionA ( const GUID ClassGuid,
PSTR  ClassDescription,
DWORD  ClassDescriptionSize,
PDWORD  RequiredSize 
)

Definition at line 2058 of file devinst.c.

2063{
2064 return SetupDiGetClassDescriptionExA(ClassGuid, ClassDescription,
2065 ClassDescriptionSize,
2067}
BOOL WINAPI SetupDiGetClassDescriptionExA(const GUID *ClassGuid, PSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize, PCSTR MachineName, PVOID Reserved)
Definition: devinst.c:2086

Referenced by test_SetupDiGetClassDescriptionA().

◆ SetupDiGetClassDescriptionExA()

BOOL WINAPI SetupDiGetClassDescriptionExA ( const GUID ClassGuid,
PSTR  ClassDescription,
DWORD  ClassDescriptionSize,
PDWORD  RequiredSize,
PCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 2086 of file devinst.c.

2093{
2094 PWCHAR ClassDescriptionW = NULL;
2095 LPWSTR MachineNameW = NULL;
2096 BOOL ret = FALSE;
2097
2098 TRACE("%s(%s %p %lu %p %s %p)\n", __FUNCTION__, debugstr_guid(ClassGuid), ClassDescription,
2099 ClassDescriptionSize, RequiredSize, debugstr_a(MachineName), Reserved);
2100
2101 if (ClassDescriptionSize > 0)
2102 {
2103 ClassDescriptionW = MyMalloc(ClassDescriptionSize * sizeof(WCHAR));
2104 if (!ClassDescriptionW)
2105 {
2107 goto cleanup;
2108 }
2109 }
2110
2111 if (MachineName)
2112 {
2114 if (!MachineNameW)
2115 {
2117 goto cleanup;
2118 }
2119 }
2120
2121 ret = SetupDiGetClassDescriptionExW(ClassGuid, ClassDescriptionW,
2122 ClassDescriptionSize * sizeof(WCHAR), RequiredSize, MachineNameW, Reserved);
2123 if (ret)
2124 {
2125 DWORD len = (DWORD)WideCharToMultiByte(CP_ACP, 0, ClassDescriptionW, -1, ClassDescription,
2126 ClassDescriptionSize, NULL, NULL);
2127 if (len == 0 || len > ClassDescriptionSize)
2128 {
2130 ret = FALSE;
2131 }
2132 }
2133
2134cleanup:
2135 MyFree(ClassDescriptionW);
2136 MyFree(MachineNameW);
2137 return ret;
2138}
BOOL WINAPI SetupDiGetClassDescriptionExW(const GUID *ClassGuid, PWSTR ClassDescription, DWORD ClassDescriptionSize, PDWORD RequiredSize, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:2143

Referenced by SetupDiGetClassDescriptionA().

◆ SetupDiGetClassDescriptionExW()

BOOL WINAPI SetupDiGetClassDescriptionExW ( const GUID ClassGuid,
PWSTR  ClassDescription,
DWORD  ClassDescriptionSize,
PDWORD  RequiredSize,
PCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 2143 of file devinst.c.

2150{
2151 HKEY hKey;
2153 DWORD dwRegType;
2154 LONG rc;
2155 PWSTR Buffer;
2156
2157 TRACE("%s(%s %p %lu %p %s %p)\n", __FUNCTION__, debugstr_guid(ClassGuid), ClassDescription,
2158 ClassDescriptionSize, RequiredSize, debugstr_w(MachineName), Reserved);
2159
2160 /* Make sure there's a GUID */
2161 if (!ClassGuid)
2162 {
2164 return FALSE;
2165 }
2166
2167 /* Make sure there's a real buffer when there's a size */
2168 if (!ClassDescription && ClassDescriptionSize > 0)
2169 {
2171 return FALSE;
2172 }
2173
2174 /* Open the key for the GUID */
2175 hKey = SetupDiOpenClassRegKeyExW(ClassGuid,
2179 Reserved);
2181 return FALSE;
2182
2183 /* Retrieve the class description data and close the key */
2184 rc = QueryRegistryValue(hKey, NULL, (LPBYTE *) &Buffer, &dwRegType, &dwLength);
2186
2187 /* Make sure we got the data */
2188 if (rc != ERROR_SUCCESS)
2189 {
2190 SetLastError(rc);
2191 return FALSE;
2192 }
2193
2194 /* Make sure the data is a string */
2195 if (dwRegType != REG_SZ)
2196 {
2197 MyFree(Buffer);
2199 return FALSE;
2200 }
2201
2202 /* Determine the length of the class description */
2203 dwLength /= sizeof(WCHAR);
2204
2205 /* Count the null-terminator if none is present */
2206 if ((dwLength == 0) || (Buffer[dwLength - 1] != UNICODE_NULL))
2207 dwLength++;
2208
2209 /* Inform the caller about the class description */
2210 if ((ClassDescription != NULL) && (dwLength <= ClassDescriptionSize))
2211 {
2212 memcpy(ClassDescription, Buffer, (dwLength - 1) * sizeof(WCHAR));
2213 ClassDescription[dwLength - 1] = UNICODE_NULL;
2214 }
2215
2216 /* Inform the caller about the required size */
2217 if (RequiredSize != NULL)
2219
2220 /* Clean up the buffer */
2221 MyFree(Buffer);
2222
2223 /* Make sure the buffer was large enough */
2224 if ((ClassDescription == NULL) || (dwLength > ClassDescriptionSize))
2225 {
2227 return FALSE;
2228 }
2229
2230 return TRUE;
2231}

Referenced by SetupDiGetClassDescriptionExA(), and SetupDiGetClassDescriptionW().

◆ SetupDiGetClassDescriptionW()

BOOL WINAPI SetupDiGetClassDescriptionW ( const GUID ClassGuid,
PWSTR  ClassDescription,
DWORD  ClassDescriptionSize,
PDWORD  RequiredSize 
)

Definition at line 2072 of file devinst.c.

2077{
2078 return SetupDiGetClassDescriptionExW(ClassGuid, ClassDescription,
2079 ClassDescriptionSize,
2081}

◆ SetupDiGetClassDevsA()

HDEVINFO WINAPI SetupDiGetClassDevsA ( CONST GUID class,
LPCSTR  enumstr,
HWND  parent,
DWORD  flags 
)

Definition at line 2236 of file devinst.c.

2241{
2242 return SetupDiGetClassDevsExA(class, enumstr, parent,
2243 flags, NULL, NULL, NULL);
2244}
HDEVINFO WINAPI SetupDiGetClassDevsExA(const GUID *class, PCSTR enumstr, HWND parent, DWORD flags, HDEVINFO deviceset, PCSTR machine, PVOID reserved)
Definition: devinst.c:2249
r parent
Definition: btrfs.c:3010
GLbitfield flags
Definition: glext.h:7161

Referenced by test_device_interface_key(), test_devnode(), test_register_device_iface(), test_register_device_info(), test_registry_property_a(), test_registry_property_w(), and testSetupDiGetClassDevsA().

◆ SetupDiGetClassDevsExA()

HDEVINFO WINAPI SetupDiGetClassDevsExA ( const GUID class,
PCSTR  enumstr,
HWND  parent,
DWORD  flags,
HDEVINFO  deviceset,
PCSTR  machine,
PVOID  reserved 
)

Definition at line 2249 of file devinst.c.

2257{
2258 HDEVINFO ret;
2259 LPWSTR enumstrW = NULL, machineW = NULL;
2260
2261 if (enumstr)
2262 {
2263 enumstrW = pSetupMultiByteToUnicode(enumstr, CP_ACP);
2264 if (!enumstrW)
2265 {
2267 goto end;
2268 }
2269 }
2270 if (machine)
2271 {
2273 if (!machineW)
2274 {
2275 MyFree(enumstrW);
2277 goto end;
2278 }
2279 }
2280 ret = SetupDiGetClassDevsExW(class, enumstrW, parent, flags, deviceset,
2282 MyFree(enumstrW);
2284
2285end:
2286 return ret;
2287}
HDEVINFO WINAPI SetupDiGetClassDevsExW(CONST GUID *class, PCWSTR enumstr, HWND parent, DWORD flags, HDEVINFO deviceset, PCWSTR machine, PVOID reserved)
Definition: devinst.c:2305
r reserved
Definition: btrfs.c:3006
GLuint GLuint end
Definition: gl.h:1545
static const WCHAR machineW[]
Definition: profile.c:105
static const char machine[]
Definition: profile.c:104

Referenced by SetupDiGetClassDevsA().

◆ SetupDiGetClassDevsExW()

HDEVINFO WINAPI SetupDiGetClassDevsExW ( CONST GUID class,
PCWSTR  enumstr,
HWND  parent,
DWORD  flags,
HDEVINFO  deviceset,
PCWSTR  machine,
PVOID  reserved 
)

Definition at line 2305 of file devinst.c.

2313{
2314 HDEVINFO hDeviceInfo = INVALID_HANDLE_VALUE;
2315 struct DeviceInfoSet *list;
2316 CONST GUID *pClassGuid;
2317 LONG rc;
2319
2320 TRACE("%s(%s %s %p 0x%08x %p %s %p)\n", __FUNCTION__, debugstr_guid(class),
2321 debugstr_w(enumstr), parent, flags, deviceset, debugstr_w(machine),
2322 reserved);
2323
2324 if (!(flags & DIGCF_ALLCLASSES) && !class)
2325 {
2327 return INVALID_HANDLE_VALUE;
2328 }
2329
2330 /* Create the deviceset if not set */
2331 if (deviceset)
2332 {
2333 list = (struct DeviceInfoSet *)deviceset;
2334 if (list->magic != SETUP_DEVICE_INFO_SET_MAGIC)
2335 {
2337 goto cleanup;
2338 }
2339 hDeviceInfo = deviceset;
2340 }
2341 else
2342 {
2343 hDeviceInfo = SetupDiCreateDeviceInfoListExW(
2345 NULL, machine, NULL);
2346 if (hDeviceInfo == INVALID_HANDLE_VALUE)
2347 goto cleanup;
2348 list = (struct DeviceInfoSet *)hDeviceInfo;
2349 }
2350
2351 if (flags & DIGCF_PROFILE)
2352 FIXME(": flag DIGCF_PROFILE ignored\n");
2353
2355 {
2356 if (!class)
2357 {
2359 goto cleanup;
2360 }
2361 rc = SETUP_CreateInterfaceList(list, machine, class, enumstr, flags & DIGCF_PRESENT);
2362 }
2363 else
2364 {
2365 /* Determine which class(es) should be included in the deviceset */
2366 if (flags & DIGCF_ALLCLASSES)
2367 {
2368 /* The caller wants all classes. Check if
2369 * the deviceset limits us to one class */
2370 if (IsEqualIID(&list->ClassGuid, &GUID_NULL))
2371 pClassGuid = NULL;
2372 else
2373 pClassGuid = &list->ClassGuid;
2374 }
2375 else if (class)
2376 {
2377 /* The caller wants one class. Check if it matches deviceset class */
2378 if (IsEqualIID(&list->ClassGuid, class)
2379 || IsEqualIID(&list->ClassGuid, &GUID_NULL))
2380 {
2381 pClassGuid = class;
2382 }
2383 else
2384 {
2386 goto cleanup;
2387 }
2388 }
2389 else if (!IsEqualIID(&list->ClassGuid, &GUID_NULL))
2390 {
2391 /* No class specified. Try to use the one of the deviceset */
2392 if (IsEqualIID(&list->ClassGuid, &GUID_NULL))
2393 pClassGuid = &list->ClassGuid;
2394 else
2395 {
2397 goto cleanup;
2398 }
2399 }
2400 else
2401 {
2403 goto cleanup;
2404 }
2405 rc = SETUP_CreateDevicesList(list, machine, pClassGuid, enumstr);
2406 }
2407 if (rc != ERROR_SUCCESS)
2408 {
2409 SetLastError(rc);
2410 goto cleanup;
2411 }
2412 set = hDeviceInfo;
2413
2414cleanup:
2415 if (!deviceset && hDeviceInfo != INVALID_HANDLE_VALUE && hDeviceInfo != set)
2416 SetupDiDestroyDeviceInfoList(hDeviceInfo);
2417 return set;
2418}
LONG SETUP_CreateDevicesList(IN OUT struct DeviceInfoSet *list, IN PCWSTR MachineName OPTIONAL, IN CONST GUID *Class OPTIONAL, IN PCWSTR Enumerator OPTIONAL)
Definition: devclass.c:121
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2939
LONG SETUP_CreateInterfaceList(struct DeviceInfoSet *list, PCWSTR MachineName, CONST GUID *InterfaceGuid, PCWSTR DeviceInstanceW, BOOL OnlyPresentInterfaces)
Definition: interface.c:68
#define CONST
Definition: pedump.c:81
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:177
#define DIGCF_ALLCLASSES
Definition: setupapi.h:175
#define DIGCF_PROFILE
Definition: setupapi.h:176
#define DIGCF_PRESENT
Definition: setupapi.h:174

Referenced by ProcessExistingDevices(), SetupDiGetClassDevsExA(), SetupDiGetClassDevsW(), and test_SetupDiGetClassDevsExW().

◆ SetupDiGetClassDevsW()

◆ SetupDiGetCustomDevicePropertyA()

BOOL WINAPI SetupDiGetCustomDevicePropertyA ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
IN PCSTR  CustomPropertyName,
IN DWORD  Flags,
OUT PDWORD PropertyRegDataType  OPTIONAL,
OUT PBYTE  PropertyBuffer,
IN DWORD  PropertyBufferSize,
OUT PDWORD RequiredSize  OPTIONAL 
)

Definition at line 6205 of file devinst.c.

6214{
6215 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
6216 struct DeviceInfo *deviceInfo;
6217 DWORD ConfigFlags = 0, PropertySize;
6218 CONFIGRET cr;
6219
6220 TRACE("%s(%p %p %s 0x%lx %p %p %lu %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData,
6222
6224 {
6226 return FALSE;
6227 }
6228 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
6229 {
6231 return FALSE;
6232 }
6235 {
6237 return FALSE;
6238 }
6240 {
6242 return FALSE;
6243 }
6244
6245 deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
6246 if (deviceInfo->set != set)
6247 {
6249 return FALSE;
6250 }
6251
6253 {
6254 ConfigFlags |= CM_CUSTOMDEVPROP_MERGE_MULTISZ;
6255 }
6256
6257 PropertySize = PropertyBufferSize;
6259 CustomPropertyName,
6262 &PropertySize,
6263 ConfigFlags,
6264 set->hMachine);
6265 if ((cr == CR_SUCCESS) || (cr == CR_BUFFER_SMALL))
6266 {
6267 if (RequiredSize)
6268 *RequiredSize = PropertySize;
6269 }
6270
6271 if (cr != CR_SUCCESS)
6272 {
6274 return FALSE;
6275 }
6276
6277 return TRUE;
6278}
#define CM_Get_DevInst_Custom_Property_ExA
Definition: cfgmgr32.h:1788
#define CM_CUSTOMDEVPROP_MERGE_MULTISZ
Definition: cfgmgr32.h:835
_In_ DWORD _Out_opt_ PDWORD PropertyRegDataType
Definition: setupapi.h:1554
#define DICUSTOMDEVPROP_MERGE_MULTISZ
Definition: setupapi.h:122

◆ SetupDiGetCustomDevicePropertyW()

BOOL WINAPI SetupDiGetCustomDevicePropertyW ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
IN PCWSTR  CustomPropertyName,
IN DWORD  Flags,
OUT PDWORD PropertyRegDataType  OPTIONAL,
OUT PBYTE  PropertyBuffer,
IN DWORD  PropertyBufferSize,
OUT PDWORD RequiredSize  OPTIONAL 
)

Definition at line 6285 of file devinst.c.

6294{
6295 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
6296 struct DeviceInfo *deviceInfo;
6297 DWORD ConfigFlags = 0, PropertySize;
6298 CONFIGRET cr;
6299
6300 TRACE("%s(%p %p %s 0x%lx %p %p %lu %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData,
6302
6304 {
6306 return FALSE;
6307 }
6308 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
6309 {
6311 return FALSE;
6312 }
6315 {
6317 return FALSE;
6318 }
6320 {
6322 return FALSE;
6323 }
6324
6325 deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
6326 if (deviceInfo->set != set)
6327 {
6329 return FALSE;
6330 }
6331
6333 {
6334 ConfigFlags |= CM_CUSTOMDEVPROP_MERGE_MULTISZ;
6335 }
6336
6337 PropertySize = PropertyBufferSize;
6339 CustomPropertyName,
6342 &PropertySize,
6343 ConfigFlags,
6344 set->hMachine);
6345 if ((cr == CR_SUCCESS) || (cr == CR_BUFFER_SMALL))
6346 {
6347 if (RequiredSize)
6348 *RequiredSize = PropertySize;
6349 }
6350
6351 if (cr != CR_SUCCESS)
6352 {
6354 return FALSE;
6355 }
6356
6357 return TRUE;
6358}
#define CM_Get_DevInst_Custom_Property_ExW
Definition: cfgmgr32.h:1787

◆ SetupDiGetDeviceInfoListClass()

BOOL WINAPI SetupDiGetDeviceInfoListClass ( IN HDEVINFO  DeviceInfoSet,
OUT LPGUID  ClassGuid 
)

Definition at line 4467 of file devinst.c.

4470{
4471 struct DeviceInfoSet *list;
4472 BOOL ret = FALSE;
4473
4474 TRACE("%s(%p %p)\n", __FUNCTION__, DeviceInfoSet, ClassGuid);
4475
4476 if (!DeviceInfoSet)
4480 else if (IsEqualIID(&list->ClassGuid, &GUID_NULL))
4482 else
4483 {
4484 *ClassGuid = list->ClassGuid;
4485
4486 ret = TRUE;
4487 }
4488
4489 TRACE("Returning %d\n", ret);
4490 return ret;
4491}
#define ERROR_NO_ASSOCIATED_CLASS
Definition: setupapi.h:299

◆ SetupDiGetDeviceInfoListDetailA()

BOOL WINAPI SetupDiGetDeviceInfoListDetailA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_LIST_DETAIL_DATA_A  DevInfoData 
)

Definition at line 2423 of file devinst.c.

2426{
2427 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
2428
2429 TRACE("%s(%p %p)\n", __FUNCTION__, DeviceInfoSet, DevInfoData);
2430
2432 {
2434 return FALSE;
2435 }
2436 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
2437 {
2439 return FALSE;
2440 }
2441 if (!DevInfoData ||
2442 DevInfoData->cbSize != sizeof(SP_DEVINFO_LIST_DETAIL_DATA_A))
2443 {
2445 return FALSE;
2446 }
2447 memcpy(&DevInfoData->ClassGuid, &set->ClassGuid, sizeof(GUID));
2448 DevInfoData->RemoteMachineHandle = set->hMachine;
2449 if (set->MachineName)
2450 {
2451 FIXME("Stub\n");
2453 return FALSE;
2454 }
2455 else
2456 DevInfoData->RemoteMachineName[0] = 0;
2457
2458 return TRUE;
2459}
CHAR RemoteMachineName[SP_MAX_MACHINENAME_LENGTH]
Definition: setupapi.h:870

◆ SetupDiGetDeviceInfoListDetailW()

BOOL WINAPI SetupDiGetDeviceInfoListDetailW ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_LIST_DETAIL_DATA_W  DevInfoData 
)

Definition at line 2464 of file devinst.c.

2467{
2468 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
2469
2470 TRACE("%s(%p %p)\n", __FUNCTION__, DeviceInfoSet, DevInfoData);
2471
2473 {
2475 return FALSE;
2476 }
2477 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
2478 {
2480 return FALSE;
2481 }
2482 if (!DevInfoData ||
2483 DevInfoData->cbSize != sizeof(SP_DEVINFO_LIST_DETAIL_DATA_W))
2484 {
2486 return FALSE;
2487 }
2488 memcpy(&DevInfoData->ClassGuid, &set->ClassGuid, sizeof(GUID));
2489 DevInfoData->RemoteMachineHandle = set->hMachine;
2490 if (set->MachineName)
2491 strcpyW(DevInfoData->RemoteMachineName, set->MachineName + 2);
2492 else
2493 DevInfoData->RemoteMachineName[0] = 0;
2494
2495 return TRUE;
2496}
WCHAR RemoteMachineName[SP_MAX_MACHINENAME_LENGTH]
Definition: setupapi.h:876

◆ SetupDiGetDeviceInstallParamsA()

BOOL WINAPI SetupDiGetDeviceInstallParamsA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
PSP_DEVINSTALL_PARAMS_A  DeviceInstallParams 
)

Definition at line 4424 of file devinst.c.

4428{
4429 SP_DEVINSTALL_PARAMS_W deviceInstallParamsW;
4430 BOOL ret = FALSE;
4431
4433
4436 else if (DeviceInstallParams->cbSize != sizeof(SP_DEVINSTALL_PARAMS_A))
4438 else
4439 {
4440 deviceInstallParamsW.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
4442
4443 if (ret)
4444 {
4445 /* Do W->A conversion */
4446 memcpy(
4448 &deviceInstallParamsW,
4450 if (WideCharToMultiByte(CP_ACP, 0, deviceInstallParamsW.DriverPath, -1,
4451 DeviceInstallParams->DriverPath, MAX_PATH, NULL, NULL) == 0)
4452 {
4453 DeviceInstallParams->DriverPath[0] = '\0';
4454 ret = FALSE;
4455 }
4456 }
4457 }
4458
4459 TRACE("Returning %d\n", ret);
4460 return ret;
4461}
WCHAR DriverPath[MAX_PATH]
Definition: setupapi.h:903

◆ SetupDiGetDeviceInstallParamsW()

BOOL WINAPI SetupDiGetDeviceInstallParamsW ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
OUT PSP_DEVINSTALL_PARAMS_W  DeviceInstallParams 
)

Definition at line 4497 of file devinst.c.

4501{
4502 struct DeviceInfoSet *list;
4503 BOOL ret = FALSE;
4504
4506
4507 if (!DeviceInfoSet)
4511 else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4513 else if (!DeviceInstallParams)
4515 else if (DeviceInstallParams->cbSize != sizeof(SP_DEVINSTALL_PARAMS_W))
4517 else
4518 {
4520
4521 if (DeviceInfoData)
4522 Source = &((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams;
4523 else
4524 Source = &list->InstallParams;
4525
4526 ret = TRUE;
4527
4528 _SEH2_TRY
4529 {
4531 }
4533 {
4535 ret = FALSE;
4536 }
4537 _SEH2_END;
4538 }
4539
4540 TRACE("Returning %d\n", ret);
4541 return ret;
4542}
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)

Referenced by BatteryClassInstall(), DisplayDeviceAdvancedProperties(), EnumerateDrivers(), CDeviceNode::GetFlags(), InstallNetDevice(), CDeviceNode::RemoveFlags(), SearchDriver(), CDeviceNode::SetFlags(), SetupDiBuildDriverInfoList(), SetupDiCallClassInstaller(), SetupDiDestroyDriverInfoList(), SetupDiGetDeviceInstallParamsA(), SetupDiGetDriverInstallParamsW(), SetupDiGetSelectedDriverW(), SetupDiInstallClassExW(), SetupDiInstallDevice(), SetupDiInstallDeviceInterfaces(), SetupDiInstallDriverFiles(), SetupDiRegisterCoDeviceInstallers(), SetupDiSetClassInstallParamsW(), SetupInstallFromInfSectionW(), UpdateDevInfo(), and WriteParameterArray().

◆ SetupDiGetDeviceInstanceIdA()

BOOL WINAPI SetupDiGetDeviceInstanceIdA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
PSTR  DeviceInstanceId,
DWORD  DeviceInstanceIdSize,
PDWORD  RequiredSize 
)

Definition at line 1838 of file devinst.c.

1844{
1845 BOOL ret = FALSE;
1846 DWORD size;
1847 PWSTR instanceId;
1848
1849 TRACE("%s(%p %p %p %d %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData, DeviceInstanceId,
1850 DeviceInstanceIdSize, RequiredSize);
1851
1852 if (!DeviceInstanceId && DeviceInstanceIdSize > 0)
1853 {
1855 return FALSE;
1856 }
1857
1860 NULL,
1861 0,
1862 &size);
1864 return FALSE;
1865 instanceId = MyMalloc(size * sizeof(WCHAR));
1866 if (instanceId)
1867 {
1870 instanceId,
1871 size,
1872 &size);
1873 if (ret)
1874 {
1875 int len = WideCharToMultiByte(CP_ACP, 0, instanceId, -1,
1876 DeviceInstanceId,
1877 DeviceInstanceIdSize, NULL, NULL);
1878
1879 if (!len)
1880 ret = FALSE;
1881 else
1882 {
1883 if (len > DeviceInstanceIdSize)
1884 {
1886 ret = FALSE;
1887 }
1888 if (RequiredSize)
1889 *RequiredSize = len;
1890 }
1891 }
1892 MyFree(instanceId);
1893 }
1894 else
1895 {
1896 if (RequiredSize)
1897 *RequiredSize = size;
1899 ret = FALSE;
1900 }
1901 return ret;
1902}
BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PWSTR DeviceInstanceId, DWORD DeviceInstanceIdSize, PDWORD RequiredSize)
Definition: devinst.c:1907

Referenced by check_device_info_(), test_device_info(), and test_get_device_instance_id().

◆ SetupDiGetDeviceInstanceIdW()

BOOL WINAPI SetupDiGetDeviceInstanceIdW ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
PWSTR  DeviceInstanceId,
DWORD  DeviceInstanceIdSize,
PDWORD  RequiredSize 
)

Definition at line 1907 of file devinst.c.

1913{
1914 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
1915 struct DeviceInfo *devInfo;
1916
1917 TRACE("%s(%p %p %p %d %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData, DeviceInstanceId,
1918 DeviceInstanceIdSize, RequiredSize);
1919
1921 {
1923 return FALSE;
1924 }
1925 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
1926 {
1928 return FALSE;
1929 }
1932 {
1934 return FALSE;
1935 }
1936 devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
1937 if (!DeviceInstanceId && DeviceInstanceIdSize > 0)
1938 {
1940 return FALSE;
1941 }
1942 if (DeviceInstanceId && DeviceInstanceIdSize == 0)
1943 {
1945 return FALSE;
1946 }
1947 TRACE("instance ID: %s\n", debugstr_w(devInfo->instanceId));
1948 if (DeviceInstanceIdSize < lstrlenW(devInfo->instanceId) + 1)
1949 {
1951 if (RequiredSize)
1952 *RequiredSize = lstrlenW(devInfo->instanceId) + 1;
1953 return FALSE;
1954 }
1955 lstrcpyW(DeviceInstanceId, devInfo->instanceId);
1956 if (RequiredSize)
1957 *RequiredSize = lstrlenW(devInfo->instanceId) + 1;
1958 return TRUE;
1959}

Referenced by fill_pnpentity(), GetBootResourceList(), InstallNetDevice(), SetupDiGetDeviceInstanceIdA(), and UpdateDriverForPlugAndPlayDevicesW().

◆ SetupDiGetDeviceInterfaceDetailA()

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 
)

Definition at line 2963 of file devinst.c.

2970{
2971 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
2972 PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailDataW = NULL;
2973 DWORD sizeW = 0, bytesNeeded;
2974 BOOL ret = FALSE;
2975
2976 TRACE("%s(%p, %p, %p, %d, %p, %p)\n", __FUNCTION__, DeviceInfoSet,
2977 DeviceInterfaceData, DeviceInterfaceDetailData,
2978 DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData);
2979
2982 {
2984 return FALSE;
2985 }
2986 if (!DeviceInterfaceData ||
2987 DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA) ||
2988 !DeviceInterfaceData->Reserved)
2989 {
2991 return FALSE;
2992 }
2993 if (DeviceInterfaceDetailData && (DeviceInterfaceDetailData->cbSize != sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A)))
2994 {
2996 return FALSE;
2997 }
2998
2999 if((DeviceInterfaceDetailDataSize != 0) &&
3000 (DeviceInterfaceDetailDataSize < (FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath) + sizeof(CHAR))))
3001 {
3003 return FALSE;
3004 }
3005
3006 if (!DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize)
3007 {
3009 return FALSE;
3010 }
3011
3012
3013 if (DeviceInterfaceDetailData != NULL)
3014 {
3016 + (DeviceInterfaceDetailDataSize - FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath)) * sizeof(WCHAR);
3017 DeviceInterfaceDetailDataW = (PSP_DEVICE_INTERFACE_DETAIL_DATA_W)MyMalloc(sizeW);
3018 if (!DeviceInterfaceDetailDataW)
3019 {
3021 }
3022 DeviceInterfaceDetailDataW->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
3023 }
3024 if (!DeviceInterfaceDetailData || (DeviceInterfaceDetailData && DeviceInterfaceDetailDataW))
3025 {
3028 DeviceInterfaceData,
3029 DeviceInterfaceDetailDataW,
3030 sizeW,
3031 &sizeW,
3035 if (RequiredSize)
3036 *RequiredSize = bytesNeeded;
3037 if (ret && DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize >= bytesNeeded)
3038 {
3040 CP_ACP, 0,
3041 DeviceInterfaceDetailDataW->DevicePath, -1,
3042 DeviceInterfaceDetailData->DevicePath, DeviceInterfaceDetailDataSize - FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath),
3043 NULL, NULL))
3044 {
3045 ret = FALSE;
3046 }
3047 }
3048 }
3049 MyFree(DeviceInterfaceDetailDataW);
3050
3051 return ret;
3052}
static const WCHAR sizeW[]
Definition: editor.c:79
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)
Definition: devinst.c:3057
_In_ PIOMMU_DEVICE_PATH DevicePath
Definition: haltypes.h:1823
char CHAR
Definition: pedump.c:57
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA_W
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W * PSP_DEVICE_INTERFACE_DETAIL_DATA_W
CHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:854
WCHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:858

Referenced by check_device_iface_(), test_device_iface(), and test_device_iface_detail().

◆ SetupDiGetDeviceInterfaceDetailW()

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 
)

Definition at line 3057 of file devinst.c.

3064{
3065 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
3066 BOOL ret = FALSE;
3067
3068 TRACE("%s(%p, %p, %p, %d, %p, %p)\n", __FUNCTION__, DeviceInfoSet,
3069 DeviceInterfaceData, DeviceInterfaceDetailData,
3070 DeviceInterfaceDetailDataSize, RequiredSize, DeviceInfoData);
3071
3074 {
3076 return FALSE;
3077 }
3078 if (!DeviceInterfaceData ||
3079 DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA) ||
3080 !DeviceInterfaceData->Reserved)
3081 {
3083 return FALSE;
3084 }
3085 if (DeviceInterfaceDetailData && DeviceInterfaceDetailData->cbSize != sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W))
3086 {
3088 return FALSE;
3089 }
3090 if (!DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize)
3091 {
3093 return FALSE;
3094 }
3096 {
3098 return FALSE;
3099 }
3100 if ((DeviceInterfaceDetailData != NULL)
3101 && (DeviceInterfaceDetailDataSize < (FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_W, DevicePath)) + sizeof(WCHAR)))
3102 {
3104 return FALSE;
3105 }
3106 else
3107 {
3108 struct DeviceInterface *deviceInterface = (struct DeviceInterface *)DeviceInterfaceData->Reserved;
3109 LPCWSTR devName = deviceInterface->SymbolicLink;
3110 DWORD sizeRequired = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) +
3111 (lstrlenW(devName) + 1) * sizeof(WCHAR);
3112
3113 if (sizeRequired > DeviceInterfaceDetailDataSize)
3114 {
3116 if (RequiredSize)
3117 *RequiredSize = sizeRequired;
3118 }
3119 else
3120 {
3121 strcpyW(DeviceInterfaceDetailData->DevicePath, devName);
3122 TRACE("DevicePath is %s\n", debugstr_w(DeviceInterfaceDetailData->DevicePath));
3123 if (DeviceInfoData)
3124 {
3126 &deviceInterface->DeviceInfo->ClassGuid,
3127 sizeof(GUID));
3128 DeviceInfoData->DevInst = deviceInterface->DeviceInfo->dnDevInst;
3129 DeviceInfoData->Reserved = (ULONG_PTR)deviceInterface->DeviceInfo;
3130 }
3131 ret = TRUE;
3132 }
3133 }
3134 return ret;
3135}
struct DeviceInfo * DeviceInfo

Referenced by BluetoothFindNextRadio(), check_device_path(), Enum(), find_devices(), get_device(), GetDeviceListInterfaces(), InstallSoftwareDeviceInterface(), IsSoftwareBusPnpEnumeratorInstalled(), KsOpenDefaultDevice(), ProcessExistingDevices(), run_for_each_device(), SetupDiGetDeviceInterfaceDetailA(), test_D3DKMTOpenAdapterFromDeviceName_deviface(), test_device_iface_detail(), test_gpu_device_properties_guid(), and WdmAudOpenSoundDeviceByLegacy().

◆ SetupDiGetDeviceRegistryPropertyA()

BOOL WINAPI SetupDiGetDeviceRegistryPropertyA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Property,
PDWORD  PropertyRegDataType,
PBYTE  PropertyBuffer,
DWORD  PropertyBufferSize,
PDWORD  RequiredSize 
)

Definition at line 3185 of file devinst.c.

3193{
3194 BOOL ret;
3195 BOOL bIsStringProperty;
3196 DWORD RegType;
3197 DWORD RequiredSizeA, RequiredSizeW;
3198 DWORD PropertyBufferSizeW = 0;
3199 PBYTE PropertyBufferW = NULL;
3200
3201 TRACE("%s(%p %p %d %p %p %d %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData,
3203 RequiredSize);
3204
3205 if (PropertyBufferSize != 0)
3206 {
3207 PropertyBufferSizeW = PropertyBufferSize * 2;
3208 PropertyBufferW = HeapAlloc(GetProcessHeap(), 0, PropertyBufferSizeW);
3209 if (!PropertyBufferW)
3210 {
3212 return FALSE;
3213 }
3214 }
3215
3218 Property,
3219 &RegType,
3220 PropertyBufferW,
3221 PropertyBufferSizeW,
3222 &RequiredSizeW);
3223
3225 {
3226 bIsStringProperty = (RegType == REG_SZ || RegType == REG_MULTI_SZ || RegType == REG_EXPAND_SZ);
3227
3228 if (bIsStringProperty)
3229 RequiredSizeA = RequiredSizeW / sizeof(WCHAR);
3230 else
3231 RequiredSizeA = RequiredSizeW;
3232 if (RequiredSize)
3233 *RequiredSize = RequiredSizeA;
3235 *PropertyRegDataType = RegType;
3236 }
3237
3238 if (!ret)
3239 {
3240 HeapFree(GetProcessHeap(), 0, PropertyBufferW);
3241 return ret;
3242 }
3243
3244 if (RequiredSizeA <= PropertyBufferSize)
3245 {
3246 if (bIsStringProperty && PropertyBufferSize > 0)
3247 {
3248 if (WideCharToMultiByte(CP_ACP, 0, (LPWSTR)PropertyBufferW, RequiredSizeW / sizeof(WCHAR), (LPSTR)PropertyBuffer, PropertyBufferSize, NULL, NULL) == 0)
3249 {
3250 /* Last error is already set by WideCharToMultiByte */
3251 ret = FALSE;
3252 }
3253 }
3254 else
3255 memcpy(PropertyBuffer, PropertyBufferW, RequiredSizeA);
3256 }
3257 else
3258 {
3260 ret = FALSE;
3261 }
3262
3263 HeapFree(GetProcessHeap(), 0, PropertyBufferW);
3264 return ret;
3265}
BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3270
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
BYTE * PBYTE
Definition: pedump.c:66
char * LPSTR
Definition: typedefs.h:51

Referenced by test_registry_property_a().

◆ SetupDiGetDeviceRegistryPropertyW()

BOOL WINAPI SetupDiGetDeviceRegistryPropertyW ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Property,
PDWORD  PropertyRegDataType,
PBYTE  PropertyBuffer,
DWORD  PropertyBufferSize,
PDWORD  RequiredSize 
)

Definition at line 3270 of file devinst.c.

3278{
3279 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
3280 struct DeviceInfo *devInfo;
3281 CONFIGRET cr;
3282 LONG lError = ERROR_SUCCESS;
3283 DWORD size;
3284
3285 TRACE("%s(%p %p %d %p %p %d %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData,
3287 RequiredSize);
3288
3290 {
3292 return FALSE;
3293 }
3294 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
3295 {
3297 return FALSE;
3298 }
3301 {
3303 return FALSE;
3304 }
3305
3307 {
3309 return FALSE;
3310 }
3311
3312 devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
3313
3314 if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0])
3316 {
3317 HKEY hKey;
3319 hKey = SETUPDI_OpenDevKey(set->HKLM, devInfo, KEY_QUERY_VALUE);
3321 return FALSE;
3325
3326 if (RequiredSize)
3327 *RequiredSize = size;
3328
3329 switch (lError)
3330 {
3331 case ERROR_SUCCESS:
3332 if (PropertyBuffer == NULL && size != 0)
3334 break;
3335 case ERROR_MORE_DATA:
3337 break;
3338 default:
3339 break;
3340 }
3341 }
3343 {
3344 size = (strlenW(devInfo->Data) + 1) * sizeof(WCHAR);
3345
3348 if (RequiredSize)
3349 *RequiredSize = size;
3350 if (PropertyBufferSize >= size)
3351 {
3352 strcpyW((LPWSTR)PropertyBuffer, devInfo->Data);
3353 }
3354 else
3356 }
3357 else
3358 {
3360
3365 &size,
3366 0,
3367 set->hMachine);
3368 if ((cr == CR_SUCCESS) || (cr == CR_BUFFER_SMALL))
3369 {
3370 if (RequiredSize)
3371 *RequiredSize = size;
3372 }
3373
3374 if (cr != CR_SUCCESS)
3375 {
3376 switch (cr)
3377 {
3378 case CR_INVALID_DEVINST:
3379 lError = ERROR_NO_SUCH_DEVINST;
3380 break;
3381
3384 break;
3385
3386 case CR_BUFFER_SMALL:
3388 break;
3389
3390 default :
3391 lError = ERROR_INVALID_DATA;
3392 break;
3393 }
3394 }
3395 }
3396
3397 SetLastError(lError);
3398 return (lError == ERROR_SUCCESS);
3399}
#define CR_INVALID_DEVINST
Definition: cfgmgr32.h:848
#define CM_DRP_DEVICEDESC
Definition: cfgmgr32.h:676
CONFIGRET WINAPI CM_Get_DevNode_Registry_Property_ExW(_In_ DEVINST dnDevInst, _In_ ULONG ulProperty, _Out_opt_ PULONG pulRegDataType, _Out_writes_bytes_opt_(*pulLength) PVOID Buffer, _Inout_ PULONG pulLength, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:3572
#define SPDRP_MAXIMUM_PROPERTY
Definition: setupapi.h:545
#define SPDRP_DEVICEDESC
Definition: setupapi.h:510
#define ERROR_INVALID_REG_PROPERTY
Definition: setupapi.h:308
#define ERROR_NO_SUCH_DEVINST
Definition: setupapi.h:310
#define SPDRP_PHYSICAL_DEVICE_OBJECT_NAME
Definition: setupapi.h:524

Referenced by CriticalDeviceCoInstaller(), DevInstallW(), DisplayPageSetDeviceDetails(), CNetConnectionManager::EnumerateINetConnections(), EnumerateNetworkAdapter(), FindNetworkAdapter(), GetHardwareAndCompatibleIDsLists(), InstallDevInstEx(), InstallParallelPort(), InstallSerialPort(), SetDeviceDetails(), SetupDiGetDeviceRegistryPropertyA(), SetupDiInstallDevice(), StorageCoInstaller(), test_registry_property_w(), and UpdateDriverForPlugAndPlayDevicesW().

◆ SetupDiGetSelectedDevice()

BOOL WINAPI SetupDiGetSelectedDevice ( IN HDEVINFO  DeviceInfoSet,
OUT PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 4949 of file devinst.c.

4952{
4953 struct DeviceInfoSet *list;
4954 BOOL ret = FALSE;
4955
4957
4958 if (!DeviceInfoSet)
4962 else if (list->SelectedDevice == NULL)
4964 else if (!DeviceInfoData)
4966 else if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4968 else
4969 {
4971 &list->SelectedDevice->ClassGuid,
4972 sizeof(GUID));
4973 DeviceInfoData->DevInst = list->SelectedDevice->dnDevInst;
4974 DeviceInfoData->Reserved = (ULONG_PTR)list->SelectedDevice;
4975 ret = TRUE;
4976 }
4977
4978 TRACE("Returning %d\n", ret);
4979 return ret;
4980}
#define ERROR_NO_DEVICE_SELECTED
Definition: setupapi.h:316

◆ SetupDiInstallClassA()

BOOL WINAPI SetupDiInstallClassA ( HWND  hwndParent,
PCSTR  InfFileName,
DWORD  Flags,
HSPFILEQ  FileQueue 
)

Definition at line 3516 of file devinst.c.

3521{
3522 return SetupDiInstallClassExA(hwndParent, InfFileName, Flags, FileQueue, NULL, NULL, NULL);
3523}
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)
Definition: devinst.c:3529

Referenced by test_install_class().

◆ SetupDiInstallClassExA()

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 
)

Definition at line 3529 of file devinst.c.

3537{
3538 PWSTR InfFileNameW = NULL;
3539 BOOL Result;
3540
3541 if (!InfFileName)
3542 {
3544 return FALSE;
3545 }
3546 else
3547 {
3548 InfFileNameW = pSetupMultiByteToUnicode(InfFileName, CP_ACP);
3549 if (InfFileNameW == NULL)
3550 {
3552 return FALSE;
3553 }
3554 }
3555
3558
3559 MyFree(InfFileNameW);
3560
3561 return Result;
3562}
BOOL WINAPI SetupDiInstallClassExW(IN HWND hwndParent OPTIONAL, IN PCWSTR InfFileName OPTIONAL, IN DWORD Flags, IN HSPFILEQ FileQueue OPTIONAL, IN CONST GUID *InterfaceClassGuid OPTIONAL, IN PVOID Reserved1, IN PVOID Reserved2)
Definition: devclass.c:708
@ Reserved2
Definition: sacdrv.h:1470
@ Reserved1
Definition: sacdrv.h:1464
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by SetupDiInstallClassA(), and test_SetupDiInstallClassExA().

◆ SetupDiInstallClassW()

BOOL WINAPI SetupDiInstallClassW ( HWND  hwndParent,
PCWSTR  InfFileName,
DWORD  Flags,
HSPFILEQ  FileQueue 
)

Definition at line 3651 of file devinst.c.

3656{
3657 return SetupDiInstallClassExW(hwndParent, InfFileName, Flags, FileQueue, NULL, NULL, NULL);
3658}

Referenced by InstallSysSetupInfDevices().

◆ SetupDiInstallDevice()

BOOL WINAPI SetupDiInstallDevice ( IN HDEVINFO  DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 5411 of file devinst.c.

5414{
5415 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5416 struct DeviceInfo *deviceInfo;
5418 struct DriverInfoElement *SelectedDriver;
5420 WCHAR SectionName[MAX_PATH];
5421 WCHAR Buffer[32];
5422 DWORD SectionNameLength = 0;
5423 BOOL Result = FALSE;
5424 ULONG DoAction;
5426 LPWSTR pSectionName = NULL;
5427 WCHAR ClassName[MAX_CLASS_NAME_LEN];
5429 LPWSTR lpGuidString = NULL, lpFullGuidString = NULL;
5430 BOOL RebootRequired = FALSE;
5432 BOOL NeedtoCopyFile;
5433 LARGE_INTEGER fullVersion;
5434 LONG rc;
5435 PVOID Context = NULL;
5436 BOOL ret = FALSE; /* Return value */
5437
5439
5440 if (!DeviceInfoSet)
5444 else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
5446 else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
5448 else
5449 Result = TRUE;
5450
5451 if (!Result)
5452 {
5453 /* One parameter is bad */
5454 goto cleanup;
5455 }
5456
5457 InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
5459 if (!Result)
5460 goto cleanup;
5461
5462 if (InstallParams.FlagsEx & DI_FLAGSEX_SETFAILEDINSTALL)
5463 {
5464 /* Set FAILEDINSTALL in ConfigFlags registry value */
5465 DWORD ConfigFlags, regType;
5470 &regType,
5471 (PBYTE)&ConfigFlags,
5472 sizeof(ConfigFlags),
5473 NULL);
5474 if (!Result || regType != REG_DWORD)
5475 {
5477 goto cleanup;
5478 }
5479 ConfigFlags |= CONFIGFLAG_FAILEDINSTALL;
5484 (PBYTE)&ConfigFlags,
5485 sizeof(ConfigFlags));
5486 if (!Result)
5487 {
5489 goto cleanup;
5490 }
5491
5492 ret = TRUE;
5493 goto cleanup;
5494 }
5495
5496 SelectedDriver = (struct DriverInfoElement *)InstallParams.ClassInstallReserved;
5497 if (SelectedDriver == NULL)
5498 {
5500 goto cleanup;
5501 }
5502
5503 FileTimeToSystemTime(&SelectedDriver->Info.DriverDate, &DriverDate);
5504
5506 SelectedDriver->InfFileDetails->hInf,
5507 SelectedDriver->Details.SectionName,
5508 SectionName, MAX_PATH, &SectionNameLength, NULL);
5509 if (!Result || SectionNameLength > MAX_PATH - strlenW(DotServices))
5510 goto cleanup;
5511 pSectionName = &SectionName[strlenW(SectionName)];
5512
5513 /* Get information from [Version] section */
5515 goto cleanup;
5516 /* Format ClassGuid to a string */
5517 if (UuidToStringW((UUID*)&ClassGuid, &lpGuidString) != RPC_S_OK)
5518 goto cleanup;
5519 RequiredSize = lstrlenW(lpGuidString);
5520 lpFullGuidString = HeapAlloc(GetProcessHeap(), 0, (RequiredSize + 3) * sizeof(WCHAR));
5521 if (!lpFullGuidString)
5522 {
5524 goto cleanup;
5525 }
5526 lpFullGuidString[0] = '{';
5527 memcpy(&lpFullGuidString[1], lpGuidString, RequiredSize * sizeof(WCHAR));
5528 lpFullGuidString[RequiredSize + 1] = '}';
5529 lpFullGuidString[RequiredSize + 2] = '\0';
5530
5531 /* Copy .inf file to Inf\ directory (if needed) */
5532 Result = InfIsFromOEMLocation(SelectedDriver->Details.InfFileName, &NeedtoCopyFile);
5533 if (!Result)
5534 goto cleanup;
5535 if (NeedtoCopyFile)
5536 {
5537 WCHAR NewFileName[MAX_PATH];
5538 struct InfFileDetails *newInfFileDetails;
5540 SelectedDriver->Details.InfFileName,
5541 NULL,
5542 SPOST_NONE,
5544 NewFileName, MAX_PATH,
5545 NULL,
5546 NULL);
5548 goto cleanup;
5549 /* Create a new struct InfFileDetails, and set it to
5550 * SelectedDriver->InfFileDetails, to release use of
5551 * current InfFile */
5552 newInfFileDetails = CreateInfFileDetails(NewFileName);
5553 if (!newInfFileDetails)
5554 goto cleanup;
5555 DereferenceInfFile(SelectedDriver->InfFileDetails);
5556 SelectedDriver->InfFileDetails = newInfFileDetails;
5557 strcpyW(SelectedDriver->Details.InfFileName, NewFileName);
5558 }
5559
5560 deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5561
5562 /* Open/Create driver key information */
5563#if _WIN32_WINNT >= 0x502
5564 hKey = SETUPDI_OpenDrvKey(set->HKLM, deviceInfo, KEY_READ | KEY_WRITE);
5565#else
5566 hKey = SETUPDI_OpenDrvKey(set->HKLM, deviceInfo, KEY_ALL_ACCESS);
5567#endif
5569#if _WIN32_WINNT >= 0x502
5571#else
5573#endif
5575 goto cleanup;
5576
5577 /* Install main section */
5578 DoAction = 0;
5580 DoAction |= SPINST_REGISTRY;
5582 {
5583 DoAction |= SPINST_FILES;
5585 if (!Context)
5586 goto cleanup;
5587 }
5588 *pSectionName = '\0';
5590 SelectedDriver->InfFileDetails->hInf, SectionName,
5591 DoAction, hKey, SelectedDriver->InfFileDetails->DirectoryName, SP_COPY_NEWER,
5594 if (!Result)
5595 goto cleanup;
5598
5599 /* Write information to driver key */
5600 *pSectionName = UNICODE_NULL;
5601 memcpy(&fullVersion, &SelectedDriver->Info.DriverVersion, sizeof(LARGE_INTEGER));
5602 TRACE("Write information to driver key\n");
5603 TRACE("DriverDate : '%u-%u-%u'\n", DriverDate.wMonth, DriverDate.wDay, DriverDate.wYear);
5604 TRACE("DriverDesc : '%s'\n", debugstr_w(SelectedDriver->Info.Description));
5605 TRACE("DriverVersion : '%ld.%ld.%lu.%ld'\n", fullVersion.HighPart >> 16, fullVersion.HighPart & 0xffff, fullVersion.LowPart >> 16, fullVersion.LowPart & 0xffff);
5606 TRACE("InfPath : '%s'\n", debugstr_w(SelectedDriver->InfFileDetails->FileName));
5607 TRACE("InfSection : '%s'\n", debugstr_w(SelectedDriver->Details.SectionName));
5608 TRACE("InfSectionExt : '%s'\n", debugstr_w(&SectionName[strlenW(SelectedDriver->Details.SectionName)]));
5609 TRACE("MatchingDeviceId: '%s'\n", debugstr_w(SelectedDriver->MatchingId));
5610 TRACE("ProviderName : '%s'\n", debugstr_w(SelectedDriver->Info.ProviderName));
5611 sprintfW(Buffer, DateFormat, DriverDate.wMonth, DriverDate.wDay, DriverDate.wYear);
5612 rc = RegSetValueExW(hKey, REGSTR_DRIVER_DATE, 0, REG_SZ, (const BYTE *)Buffer, (strlenW(Buffer) + 1) * sizeof(WCHAR));
5613 if (rc == ERROR_SUCCESS)
5614 rc = RegSetValueExW(hKey, REGSTR_DRIVER_DATE_DATA, 0, REG_BINARY, (const BYTE *)&SelectedDriver->Info.DriverDate, sizeof(FILETIME));
5615 if (rc == ERROR_SUCCESS)
5616 rc = RegSetValueExW(hKey, REGSTR_VAL_DRVDESC, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (strlenW(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR));
5617 if (rc == ERROR_SUCCESS)
5618 {
5619 sprintfW(Buffer, VersionFormat, fullVersion.HighPart >> 16, fullVersion.HighPart & 0xffff, fullVersion.LowPart >> 16, fullVersion.LowPart & 0xffff);
5620 rc = RegSetValueExW(hKey, REGSTR_DRIVER_VERSION, 0, REG_SZ, (const BYTE *)Buffer, (strlenW(Buffer) + 1) * sizeof(WCHAR));
5621 }
5622 if (rc == ERROR_SUCCESS)
5623 rc = RegSetValueExW(hKey, REGSTR_VAL_INFPATH, 0, REG_SZ, (const BYTE *)SelectedDriver->InfFileDetails->FileName, (strlenW(SelectedDriver->InfFileDetails->FileName) + 1) * sizeof(WCHAR));
5624 if (rc == ERROR_SUCCESS)
5625 rc = RegSetValueExW(hKey, REGSTR_VAL_INFSECTION, 0, REG_SZ, (const BYTE *)SelectedDriver->Details.SectionName, (strlenW(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR));
5626 if (rc == ERROR_SUCCESS)
5627 rc = RegSetValueExW(hKey, REGSTR_VAL_INFSECTIONEXT, 0, REG_SZ, (const BYTE *)&SectionName[strlenW(SelectedDriver->Details.SectionName)], (strlenW(SectionName) - strlenW(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR));
5628 if (rc == ERROR_SUCCESS)
5629 rc = RegSetValueExW(hKey, REGSTR_VAL_MATCHINGDEVID, 0, REG_SZ, (const BYTE *)SelectedDriver->MatchingId, (strlenW(SelectedDriver->MatchingId) + 1) * sizeof(WCHAR));
5630 if (rc == ERROR_SUCCESS)
5631 rc = RegSetValueExW(hKey, REGSTR_VAL_PROVIDER_NAME, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.ProviderName, (strlenW(SelectedDriver->Info.ProviderName) + 1) * sizeof(WCHAR));
5632 if (rc != ERROR_SUCCESS)
5633 {
5634 SetLastError(rc);
5635 goto cleanup;
5636 }
5639
5640 /* FIXME: Process .LogConfigOverride section */
5641
5642 /* Install .Services section */
5643 strcpyW(pSectionName, DotServices);
5645 SelectedDriver->InfFileDetails->hInf,
5646 SectionName,
5647 0,
5650 NULL,
5651 NULL);
5652 if (!Result)
5653 {
5655 goto cleanup;
5657 }
5659 RebootRequired = TRUE;
5660
5661 /* Open device registry key */
5664 goto cleanup;
5665
5666 /* Install .HW section */
5667 DoAction = 0;
5669 DoAction |= SPINST_REGISTRY;
5670 strcpyW(pSectionName, DotHW);
5672 SelectedDriver->InfFileDetails->hInf, SectionName,
5673 DoAction, hKey, NULL, 0,
5674 NULL, NULL,
5676 if (!Result)
5677 goto cleanup;
5678
5679 /* Write information to enum key */
5680 TRACE("Write information to enum key\n");
5681 TRACE("Class : '%s'\n", debugstr_w(ClassName));
5682 TRACE("ClassGUID : '%s'\n", debugstr_w(lpFullGuidString));
5683 TRACE("DeviceDesc : '%s'\n", debugstr_w(SelectedDriver->Info.Description));
5684 TRACE("Mfg : '%s'\n", debugstr_w(SelectedDriver->Info.MfgName));
5685 rc = RegSetValueExW(hKey, REGSTR_VAL_CLASS, 0, REG_SZ, (const BYTE *)ClassName, (strlenW(ClassName) + 1) * sizeof(WCHAR));
5686 if (rc == ERROR_SUCCESS)
5687 rc = RegSetValueExW(hKey, REGSTR_VAL_CLASSGUID, 0, REG_SZ, (const BYTE *)lpFullGuidString, (strlenW(lpFullGuidString) + 1) * sizeof(WCHAR));
5688 if (rc == ERROR_SUCCESS)
5689 rc = RegSetValueExW(hKey, REGSTR_VAL_DEVDESC, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (strlenW(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR));
5690 if (rc == ERROR_SUCCESS)
5691 rc = RegSetValueExW(hKey, REGSTR_VAL_MFG, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.MfgName, (strlenW(SelectedDriver->Info.MfgName) + 1) * sizeof(WCHAR));
5692 if (rc != ERROR_SUCCESS)
5693 {
5694 SetLastError(rc);
5695 goto cleanup;
5696 }
5697
5698 /* Start the device */
5699 if (!RebootRequired && !(InstallParams.Flags & (DI_NEEDRESTART | DI_NEEDREBOOT | DI_DONOTCALLCONFIGMG)))
5701 else
5702 ret = TRUE;
5703
5704cleanup:
5705 /* End of installation */
5708 if (lpGuidString)
5709 RpcStringFreeW(&lpGuidString);
5710 HeapFree(GetProcessHeap(), 0, lpFullGuidString);
5711 if (Context)
5713 TRACE("Returning %d\n", ret);
5714 return ret;
5715}
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:183
static BOOL InfIsFromOEMLocation(IN PCWSTR FullName, OUT LPBOOL IsOEMLocation)
Definition: devinst.c:5357
static const WCHAR DateFormat[]
Definition: devinst.c:28
static const WCHAR DotServices[]
Definition: devinst.c:31
static const WCHAR REGSTR_DRIVER_VERSION[]
Definition: devinst.c:39
BOOL WINAPI SetupDiGetActualSectionToInstallW(HINF InfHandle, PCWSTR InfSectionName, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PWSTR *Extension)
Definition: devinst.c:1980
static const WCHAR REGSTR_DRIVER_DATE[]
Definition: devinst.c:37
BOOL WINAPI SetupDiSetDeviceRegistryPropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize)
Definition: devinst.c:3498
static const WCHAR VersionFormat[]
Definition: devinst.c:35
static const WCHAR REGSTR_DRIVER_DATE_DATA[]
Definition: devinst.c:38
static const WCHAR DotHW[]
Definition: devinst.c:30
struct InfFileDetails * CreateInfFileDetails(IN LPCWSTR FullInfFileName)
Definition: driver.c:55
VOID DereferenceInfFile(struct InfFileDetails *infFile)
Definition: driver.c:45
BOOL WINAPI SetupCopyOEMInfW(IN PCWSTR SourceInfFileName, IN PCWSTR OEMSourceMediaLocation, IN DWORD OEMSourceMediaType, IN DWORD CopyStyle, OUT PWSTR DestinationInfFileName OPTIONAL, IN DWORD DestinationInfFileNameSize, OUT PDWORD RequiredSize OPTIONAL, OUT PWSTR *DestinationInfFileNameComponent OPTIONAL)
Definition: install.c:2375
BOOL WINAPI SetupInstallServicesFromInfSectionExW(_In_ HINF InfHandle, _In_ PCWSTR SectionName, _In_ DWORD Flags, _In_opt_ HDEVINFO DeviceInfoSet, _In_opt_ PSP_DEVINFO_DATA DeviceInfoData, _Reserved_ PVOID Reserved1, _Reserved_ PVOID Reserved2)
Definition: install.c:2118
BOOL WINAPI SetupDiGetINFClassW(IN PCWSTR InfName, OUT LPGUID ClassGuid, OUT PWSTR ClassName, IN DWORD ClassNameSize, OUT PDWORD RequiredSize OPTIONAL)
Definition: parser.c:2334
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:1729
void WINAPI SetupTermDefaultQueueCallback(PVOID context)
Definition: queue.c:1656
PVOID WINAPI SetupInitDefaultQueueCallback(HWND owner)
Definition: queue.c:1629
#define REG_BINARY
Definition: nt_native.h:1499
#define REGSTR_VAL_DRVDESC
Definition: regstr.h:428
#define REGSTR_VAL_INFPATH
Definition: regstr.h:439
#define REGSTR_VAL_DEVDESC
Definition: regstr.h:292
#define REGSTR_VAL_INFSECTIONEXT
Definition: regstr.h:441
#define CONFIGFLAG_FAILEDINSTALL
Definition: regstr.h:396
#define REGSTR_VAL_MATCHINGDEVID
Definition: regstr.h:442
#define REGSTR_VAL_INFSECTION
Definition: regstr.h:440
#define REGSTR_VAL_PROVIDER_NAME
Definition: regstr.h:540
#define REGSTR_VAL_MFG
Definition: regstr.h:306
#define SP_COPY_NOOVERWRITE
Definition: setupapi.h:483
#define SPOST_NONE
Definition: setupapi.h:612
#define DI_FLAGSEX_SETFAILEDINSTALL
Definition: setupapi.h:85
#define ERROR_SECTION_NOT_FOUND
Definition: setupapi.h:296
#define ERROR_NO_DRIVER_SELECTED
Definition: setupapi.h:302
#define SPDRP_CONFIGFLAGS
Definition: setupapi.h:520
#define SP_COPY_NEWER
Definition: setupapi.h:481
struct InfFileDetails * InfFileDetails
SP_DRVINFO_DETAIL_DATA_W Details
SP_DRVINFO_DATA_V2_W Info
ULARGE_INTEGER DriverDate
ULONG_PTR ClassInstallReserved
Definition: setupapi.h:901
WCHAR ProviderName[LINE_LEN]
Definition: setupapi.h:1021
WCHAR MfgName[LINE_LEN]
Definition: setupapi.h:1020
DWORDLONG DriverVersion
Definition: setupapi.h:1023
WCHAR Description[LINE_LEN]
Definition: setupapi.h:1019
WCHAR SectionName[LINE_LEN]
Definition: setupapi.h:1079
WCHAR InfFileName[MAX_PATH]
Definition: setupapi.h:1080
uint32_t ULONG
Definition: typedefs.h:59
ULONG LowPart
Definition: typedefs.h:106
#define ERROR_FILE_EXISTS
Definition: winerror.h:287
#define ERROR_SUCCESS_REBOOT_REQUIRED
Definition: winerror.h:1580

Referenced by DisplayClassInstaller(), InstallCompositeBattery(), InstallNetDevice(), InstallParallelPort(), InstallSerialPort(), and SetupDiCallClassInstaller().

◆ SetupDiOpenClassRegKey()

HKEY WINAPI SetupDiOpenClassRegKey ( const GUID ClassGuid,
REGSAM  samDesired 
)

Definition at line 3664 of file devinst.c.

3667{
3668 return SetupDiOpenClassRegKeyExW(ClassGuid, samDesired,
3670}

Referenced by DisplayClassProperties(), SETUP_GetClassIconInfo(), SetupDiCallClassInstaller(), START_TEST(), and test_open_class_key().

◆ SetupDiOpenClassRegKeyExA()

HKEY WINAPI SetupDiOpenClassRegKeyExA ( const GUID ClassGuid,
REGSAM  samDesired,
DWORD  Flags,
PCSTR  MachineName,
PVOID  Reserved 
)

Definition at line 3676 of file devinst.c.

3682{
3683 PWSTR MachineNameW = NULL;
3684 HKEY hKey;
3685
3686 TRACE("%s(%s 0x%lx 0x%lx %s %p)\n", __FUNCTION__, debugstr_guid(ClassGuid), samDesired,
3688
3689 if (MachineName)
3690 {
3692 if (MachineNameW == NULL)
3693 return INVALID_HANDLE_VALUE;
3694 }
3695
3696 hKey = SetupDiOpenClassRegKeyExW(ClassGuid, samDesired,
3697 Flags, MachineNameW, Reserved);
3698
3699 MyFree(MachineNameW);
3700
3701 return hKey;
3702}

Referenced by test_open_class_key(), and test_SetupDiOpenClassRegKeyExA().

◆ SetupDiOpenClassRegKeyExW()

HKEY WINAPI SetupDiOpenClassRegKeyExW ( const GUID ClassGuid,
REGSAM  samDesired,
DWORD  Flags,
PCWSTR  MachineName,
PVOID  Reserved 
)

Definition at line 3708 of file devinst.c.

3714{
3715 HKEY HKLM;
3716 HKEY hClassesKey;
3717 HKEY key;
3718 LPCWSTR lpKeyName;
3719 LONG l;
3720
3721 TRACE("%s(%s 0x%lx 0x%lx %s %p)\n", __FUNCTION__, debugstr_guid(ClassGuid), samDesired,
3723
3724 if (MachineName != NULL)
3725 {
3727 if (l != ERROR_SUCCESS)
3728 {
3729 SetLastError(l);
3730 return INVALID_HANDLE_VALUE;
3731 }
3732 }
3733 else
3735
3736 if (Flags == DIOCR_INSTALLER)
3737 {
3738 lpKeyName = REGSTR_PATH_CLASS_NT;
3739 }
3740 else if (Flags == DIOCR_INTERFACE)
3741 {
3742 lpKeyName = REGSTR_PATH_DEVICE_CLASSES;
3743 }
3744 else
3745 {
3746 ERR("Invalid Flags parameter!\n");
3749 return INVALID_HANDLE_VALUE;
3750 }
3751
3752 if (!ClassGuid)
3753 {
3754 if ((l = RegOpenKeyExW(HKLM,
3755 lpKeyName,
3756 0,
3757 samDesired,
3758 &hClassesKey)))
3759 {
3761 hClassesKey = INVALID_HANDLE_VALUE;
3762 }
3763 if (MachineName != NULL)
3765 key = hClassesKey;
3766 }
3767 else
3768 {
3769 WCHAR bracedGuidString[39];
3770
3771 SETUPDI_GuidToString(ClassGuid, bracedGuidString);
3772
3773 if (!(l = RegOpenKeyExW(HKLM,
3774 lpKeyName,
3775 0,
3776 samDesired,
3777 &hClassesKey)))
3778 {
3779 if (MachineName != NULL)
3781
3782 if ((l = RegOpenKeyExW(hClassesKey,
3783 bracedGuidString,
3784 0,
3785 samDesired,
3786 &key)))
3787 {
3788 SetLastError(l);
3790 }
3791 RegCloseKey(hClassesKey);
3792 }
3793 else
3794 {
3796 SetLastError(l);
3798 }
3799 }
3800
3801 return key;
3802}
#define REGSTR_PATH_DEVICE_CLASSES
Definition: regstr.h:481

Referenced by SETUP_CreateInterfaceList(), SetupDiClassGuidsFromNameExW(), SetupDiClassNameFromGuidExW(), SetupDiCreateDeviceInterfaceRegKeyW(), SetupDiGetClassDescriptionExW(), SetupDiGetClassDevPropertySheetsW(), SetupDiInstallClassExW(), SetupDiOpenClassRegKey(), SetupDiOpenClassRegKeyExA(), SetupDiOpenDeviceInterfaceRegKey(), SetupDiOpenDeviceInterfaceW(), and CClassNode::SetupNode().

◆ SetupDiOpenDeviceInfoA()

BOOL WINAPI SetupDiOpenDeviceInfoA ( IN HDEVINFO  DeviceInfoSet,
IN PCSTR  DeviceInstanceId,
IN HWND hwndParent  OPTIONAL,
IN DWORD  OpenFlags,
OUT PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL 
)

Definition at line 4791 of file devinst.c.

4797{
4798 LPWSTR DeviceInstanceIdW = NULL;
4799 BOOL bResult;
4800
4801 TRACE("%s(%p %s %p %lx %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInstanceId, hwndParent, OpenFlags, DeviceInfoData);
4802
4803 DeviceInstanceIdW = pSetupMultiByteToUnicode(DeviceInstanceId, CP_ACP);
4804 if (DeviceInstanceIdW == NULL)
4805 return FALSE;
4806
4808 DeviceInstanceIdW, hwndParent, OpenFlags, DeviceInfoData);
4809
4810 MyFree(DeviceInstanceIdW);
4811
4812 return bResult;
4813}
BOOL WINAPI SetupDiOpenDeviceInfoW(IN HDEVINFO DeviceInfoSet, IN PCWSTR DeviceInstanceId, IN HWND hwndParent OPTIONAL, IN DWORD OpenFlags, OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
Definition: devinst.c:4820

◆ SetupDiOpenDeviceInfoW()

BOOL WINAPI SetupDiOpenDeviceInfoW ( IN HDEVINFO  DeviceInfoSet,
IN PCWSTR  DeviceInstanceId,
IN HWND hwndParent  OPTIONAL,
IN DWORD  OpenFlags,
OUT PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL 
)

Definition at line 4820 of file devinst.c.

4826{
4827 struct DeviceInfoSet *list;
4829 DWORD rc, dwSize;
4830 BOOL ret = FALSE;
4831
4832 TRACE("%s(%p %s %p %lx %p)\n", __FUNCTION__,
4833 DeviceInfoSet, debugstr_w(DeviceInstanceId),
4834 hwndParent, OpenFlags, DeviceInfoData);
4835
4836 if (OpenFlags & DIOD_CANCEL_REMOVE)
4837 FIXME("DIOD_CANCEL_REMOVE flag not implemented\n");
4838
4839 if (!DeviceInfoSet)
4843 else if (!DeviceInstanceId)
4845 else if (OpenFlags & ~(DIOD_CANCEL_REMOVE | DIOD_INHERIT_CLASSDRVS))
4846 {
4847 TRACE("Unknown flags: 0x%08lx\n", OpenFlags & ~(DIOD_CANCEL_REMOVE | DIOD_INHERIT_CLASSDRVS));
4849 }
4850 else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4852 else
4853 {
4854 struct DeviceInfo *deviceInfo = NULL;
4855 /* Search if device already exists in DeviceInfoSet.
4856 * If yes, return the existing element
4857 * If no, create a new element using information in registry
4858 */
4859 PLIST_ENTRY ItemList = list->ListHead.Flink;
4860 while (ItemList != &list->ListHead)
4861 {
4862 deviceInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
4863 if (!wcscmp(deviceInfo->instanceId, DeviceInstanceId))
4864 break;
4865 deviceInfo = NULL;
4866 ItemList = ItemList->Flink;
4867 }
4868
4869 if (deviceInfo)
4870 {
4871 /* good one found */
4872 ret = TRUE;
4873 }
4874 else
4875 {
4877 WCHAR szClassGuid[MAX_GUID_STRING_LEN];
4878
4879 /* Open supposed registry key */
4880 rc = RegOpenKeyExW(
4881 list->HKLM,
4883 0, /* Options */
4885 &hEnumKey);
4886 if (rc != ERROR_SUCCESS)
4887 {
4888 SetLastError(rc);
4889 goto cleanup;
4890 }
4891 rc = RegOpenKeyExW(
4892 hEnumKey,
4893 DeviceInstanceId,
4894 0, /* Options */
4896 &hKey);
4898 if (rc != ERROR_SUCCESS)
4899 {
4900 if (rc == ERROR_FILE_NOT_FOUND)
4902 SetLastError(rc);
4903 goto cleanup;
4904 }
4905
4907 dwSize = MAX_GUID_STRING_LEN * sizeof(WCHAR);
4908
4911 NULL,
4912 NULL,
4913 (LPBYTE)szClassGuid,
4914 &dwSize) == ERROR_SUCCESS)
4915 {
4916 szClassGuid[MAX_GUID_STRING_LEN - 2] = UNICODE_NULL;
4917
4918 /* Convert a string to a ClassGuid */
4919 UuidFromStringW(&szClassGuid[1], &ClassGUID);
4920 }
4921
4922 if (!CreateDeviceInfo(list, DeviceInstanceId, &ClassGUID, &deviceInfo))
4923 goto cleanup;
4924
4925 InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
4926
4927 ret = TRUE;
4928 }
4929
4930 if (ret && deviceInfo && DeviceInfoData)
4931 {
4932 memcpy(&DeviceInfoData->ClassGuid, &deviceInfo->ClassGuid, sizeof(GUID));
4933 DeviceInfoData->DevInst = deviceInfo->dnDevInst;
4934 DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
4935 }
4936 }
4937
4938cleanup:
4939 if (hKey != NULL)
4941 return ret;
4942}
#define MAX_GUID_STRING_LEN
Definition: apphelp.c:29
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
static const WCHAR ClassGUID[]
Definition: devclass.c:30
#define DIOD_INHERIT_CLASSDRVS
Definition: setupapi.h:182
#define DIOD_CANCEL_REMOVE
Definition: setupapi.h:183

Referenced by DevInstallW(), InstallDevInstEx(), SetupDiOpenDeviceInfoA(), and CDeviceNode::SetupNode().

◆ SetupDiOpenDeviceInterfaceA()

BOOL WINAPI SetupDiOpenDeviceInterfaceA ( HDEVINFO  DeviceInfoSet,
PCSTR  DevicePath,
DWORD  OpenFlags,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData 
)

Definition at line 4022 of file devinst.c.

4027{
4028 LPWSTR DevicePathW = NULL;
4029 BOOL bResult;
4030
4031 TRACE("%s(%p %s %08lx %p)\n", __FUNCTION__, DeviceInfoSet, debugstr_a(DevicePath), OpenFlags, DeviceInterfaceData);
4032
4034 if (DevicePathW == NULL)
4035 return FALSE;
4036
4038 DevicePathW, OpenFlags, DeviceInterfaceData);
4039
4040 MyFree(DevicePathW);
4041
4042 return bResult;
4043}
BOOL WINAPI SetupDiOpenDeviceInterfaceW(HDEVINFO DeviceInfoSet, PCWSTR DevicePath, DWORD OpenFlags, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:3807

◆ SetupDiOpenDeviceInterfaceW()

BOOL WINAPI SetupDiOpenDeviceInterfaceW ( HDEVINFO  DeviceInfoSet,
PCWSTR  DevicePath,
DWORD  OpenFlags,
PSP_DEVICE_INTERFACE_DATA  DeviceInterfaceData 
)

Definition at line 3807 of file devinst.c.

3812{
3813 struct DeviceInfoSet * list;
3814 PCWSTR pEnd;
3815 DWORD dwLength, dwError, dwIndex, dwKeyName, dwSubIndex;
3816 CLSID ClassId;
3817 WCHAR Buffer[MAX_PATH + 1];
3818 WCHAR SymBuffer[MAX_PATH + 1];
3819 WCHAR InstancePath[MAX_PATH + 1];
3820 HKEY hKey, hDevKey, hSymKey;
3821 struct DeviceInfo * deviceInfo;
3822 struct DeviceInterface *deviceInterface;
3823 BOOL Ret;
3824 PLIST_ENTRY ItemList;
3825 PLIST_ENTRY InterfaceListEntry;
3826
3827 TRACE("%s(%p %s %08x %p)\n", __FUNCTION__,
3828 DeviceInfoSet, debugstr_w(DevicePath), OpenFlags, DeviceInterfaceData);
3829
3830
3831 if (DeviceInterfaceData && DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA))
3832 {
3834 return FALSE;
3835 }
3836
3838 {
3840 return FALSE;
3841 }
3842
3843 list = (struct DeviceInfoSet * )DeviceInfoSet;
3844
3846 if (dwLength < 39)
3847 {
3848 /* path must be at least a guid length + L'\0' */
3850 return FALSE;
3851 }
3852
3853 if (DevicePath[0] != L'\\' ||
3854 DevicePath[1] != L'\\' ||
3855 (DevicePath[2] != L'?' && DevicePath[2] != L'.') ||
3856 DevicePath[3] != L'\\')
3857 {
3858 /* invalid formatted path */
3860 return FALSE;
3861 }
3862
3863 /* check for reference strings */
3864 pEnd = wcschr(&DevicePath[4], L'\\');
3865 if (!pEnd)
3866 {
3867 /* no reference string */
3868 pEnd = DevicePath + dwLength;
3869 }
3870
3871 /* copy guid */
3872 wcscpy(Buffer, pEnd - 37);
3873 Buffer[36] = L'\0';
3874
3875 dwError = UuidFromStringW(Buffer, &ClassId);
3876 if (dwError != NOERROR)
3877 {
3878 /* invalid formatted path */
3880 return FALSE;
3881 }
3882
3883 hKey = SetupDiOpenClassRegKeyExW(&ClassId, KEY_READ, DIOCR_INTERFACE, list->MachineName, NULL);
3884
3886 {
3887 /* invalid device class */
3888 return FALSE;
3889 }
3890
3891 ItemList = list->ListHead.Flink;
3892 while (ItemList != &list->ListHead)
3893 {
3894 deviceInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
3895 InterfaceListEntry = deviceInfo->InterfaceListHead.Flink;
3896 while (InterfaceListEntry != &deviceInfo->InterfaceListHead)
3897 {
3898 deviceInterface = CONTAINING_RECORD(InterfaceListEntry, struct DeviceInterface, ListEntry);
3899 if (!IsEqualIID(&deviceInterface->InterfaceClassGuid, &ClassId))
3900 {
3901 InterfaceListEntry = InterfaceListEntry->Flink;
3902 continue;
3903 }
3904
3905 if (!wcsicmp(deviceInterface->SymbolicLink, DevicePath))
3906 {
3907 if (DeviceInterfaceData)
3908 {
3909 DeviceInterfaceData->Reserved = (ULONG_PTR)deviceInterface;
3910 DeviceInterfaceData->Flags = deviceInterface->Flags;
3911 CopyMemory(&DeviceInterfaceData->InterfaceClassGuid, &ClassId, sizeof(GUID));
3912 }
3913
3914 return TRUE;
3915 }
3916
3917 }
3918 }
3919
3920
3921 dwIndex = 0;
3922 do
3923 {
3924 Buffer[0] = 0;
3925 dwKeyName = sizeof(Buffer) / sizeof(WCHAR);
3926 dwError = RegEnumKeyExW(hKey, dwIndex, Buffer, &dwKeyName, NULL, NULL, NULL, NULL);
3927
3928 if (dwError != ERROR_SUCCESS)
3929 break;
3930
3931 if (RegOpenKeyExW(hKey, Buffer, 0, KEY_READ, &hDevKey) != ERROR_SUCCESS)
3932 break;
3933
3934 dwSubIndex = 0;
3935 InstancePath[0] = 0;
3936 dwKeyName = sizeof(InstancePath);
3937
3938 dwError = RegQueryValueExW(hDevKey, L"DeviceInstance", NULL, NULL, (LPBYTE)InstancePath, &dwKeyName);
3939
3940 while(TRUE)
3941 {
3942 Buffer[0] = 0;
3943 dwKeyName = sizeof(Buffer) / sizeof(WCHAR);
3944 dwError = RegEnumKeyExW(hDevKey, dwSubIndex, Buffer, &dwKeyName, NULL, NULL, NULL, NULL);
3945
3946 if (dwError != ERROR_SUCCESS)
3947 break;
3948
3949 dwError = RegOpenKeyExW(hDevKey, Buffer, 0, KEY_READ, &hSymKey);
3950 if (dwError != ERROR_SUCCESS)
3951 break;
3952
3953 /* query for symbolic link */
3954 dwKeyName = sizeof(SymBuffer);
3955 SymBuffer[0] = L'\0';
3956 dwError = RegQueryValueExW(hSymKey, L"SymbolicLink", NULL, NULL, (LPBYTE)SymBuffer, &dwKeyName);
3957
3958 if (dwError != ERROR_SUCCESS)
3959 {
3960 RegCloseKey(hSymKey);
3961 break;
3962 }
3963
3964 if (!wcsicmp(SymBuffer, DevicePath))
3965 {
3966 Ret = CreateDeviceInfo(list, InstancePath, &ClassId, &deviceInfo);
3967 RegCloseKey(hSymKey);
3968 RegCloseKey(hDevKey);
3970
3971 if (Ret)
3972 {
3973 deviceInterface = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInterface) + (wcslen(SymBuffer) + 1) * sizeof(WCHAR));
3974 if (deviceInterface)
3975 {
3976
3977 CopyMemory(&deviceInterface->InterfaceClassGuid, &ClassId, sizeof(GUID));
3978 deviceInterface->DeviceInfo = deviceInfo;
3979 deviceInterface->Flags = SPINT_ACTIVE; //FIXME
3980
3981 wcscpy(deviceInterface->SymbolicLink, SymBuffer);
3982
3983 InsertTailList(&deviceInfo->InterfaceListHead, &deviceInterface->ListEntry);
3984 InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
3985
3986
3987 if (DeviceInterfaceData)
3988 {
3989 DeviceInterfaceData->Reserved = (ULONG_PTR)deviceInterface;
3990 DeviceInterfaceData->Flags = deviceInterface->Flags;
3991 CopyMemory(&DeviceInterfaceData->InterfaceClassGuid, &ClassId, sizeof(GUID));
3992 }
3993 else
3994 {
3995 Ret = FALSE;
3997 }
3998 }
3999 }
4000 else
4001 {
4002 HeapFree(GetProcessHeap(), 0, deviceInfo);
4003 Ret = FALSE;
4004 }
4005 return Ret;
4006 }
4007 RegCloseKey(hSymKey);
4008 dwSubIndex++;
4009 }
4010
4011 RegCloseKey(hDevKey);
4012 dwIndex++;
4013 } while(TRUE);
4014
4016 return FALSE;
4017}
#define wcsicmp
Definition: compat.h:15
#define CopyMemory
Definition: minwinbase.h:29
#define SPINT_ACTIVE
Definition: setupapi.h:585
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define ERROR_BAD_PATHNAME
Definition: winerror.h:355
#define NOERROR
Definition: winerror.h:3448

Referenced by CKsProxy::Load(), and SetupDiOpenDeviceInterfaceA().

◆ SetupDiOpenDevRegKey()

HKEY WINAPI SetupDiOpenDevRegKey ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Scope,
DWORD  HwProfile,
DWORD  KeyType,
REGSAM  samDesired 
)

Definition at line 5980 of file devinst.c.

5987{
5989 struct DeviceInfo *devInfo;
5991 HKEY RootKey;
5992
5993 TRACE("%s(%p %p %d %d %d %x)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData,
5994 Scope, HwProfile, KeyType, samDesired);
5995
5997 {
5999 return INVALID_HANDLE_VALUE;
6000 }
6001 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
6002 {
6004 return INVALID_HANDLE_VALUE;
6005 }
6008 {
6010 return INVALID_HANDLE_VALUE;
6011 }
6012 if (Scope != DICS_FLAG_GLOBAL && Scope != DICS_FLAG_CONFIGSPECIFIC)
6013 {
6015 return INVALID_HANDLE_VALUE;
6016 }
6017 if (KeyType != DIREG_DEV && KeyType != DIREG_DRV)
6018 {
6020 return INVALID_HANDLE_VALUE;
6021 }
6022 devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
6023 if (devInfo->set != set)
6024 {
6026 return INVALID_HANDLE_VALUE;
6027 }
6028 if (Scope != DICS_FLAG_GLOBAL)
6029 {
6030 RootKey = OpenHardwareProfileKey(set->HKLM, HwProfile, 0);
6032 return INVALID_HANDLE_VALUE;
6033 }
6034 else
6035 RootKey = set->HKLM;
6036 switch (KeyType)
6037 {
6038 case DIREG_DEV:
6039 key = SETUPDI_OpenDevKey(RootKey, devInfo, samDesired);
6040 if (Scope == DICS_FLAG_GLOBAL)
6041 {
6042 LONG rc;
6043 HKEY hTempKey = key;
6044 rc = RegOpenKeyExW(hTempKey,
6045 L"Device Parameters",
6046 0,
6047 samDesired,
6048 &key);
6049 if (rc == ERROR_SUCCESS)
6050 RegCloseKey(hTempKey);
6051 }
6052 break;
6053 case DIREG_DRV:
6054 key = SETUPDI_OpenDrvKey(RootKey, devInfo, samDesired);
6055 break;
6056 default:
6057 WARN("unknown KeyType %d\n", KeyType);
6058 }
6059 if (RootKey != set->HKLM)
6061 return key;
6062}

Referenced by BuildParameterArray(), ChangePortNumber(), CriticalDeviceCoInstaller(), DisplayClassInstaller(), DisplayDeviceCoinstallers(), DisplayMatchingDeviceId(), FindCurrentDriver(), GetDeviceLocationString(), GetDriverDateString(), GetDriverProviderString(), GetDriverVersionString(), InstallNetDevice(), OpenDeviceKey(), PS2MousePropPageProvider(), ReadPortSettings(), RemovePort(), test_device_key(), WriteParameterArray(), and WritePortSettings().

◆ SetupDiRegisterCoDeviceInstallers()

BOOL WINAPI SetupDiRegisterCoDeviceInstallers ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 5257 of file devinst.c.

5260{
5261 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5262 struct DeviceInfo *deviceInfo;
5263 BOOL ret = FALSE; /* Return value */
5264
5266
5267 if (!DeviceInfoSet)
5271 else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
5273 else if (!DeviceInfoData)
5275 else if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
5277 else
5278 {
5280 struct DriverInfoElement *SelectedDriver;
5281 BOOL Result;
5282 DWORD DoAction;
5283 WCHAR SectionName[MAX_PATH];
5284 DWORD SectionNameLength = 0;
5286 PVOID Context = NULL;
5287
5288 InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
5290 if (!Result)
5291 goto cleanup;
5292
5293 SelectedDriver = (struct DriverInfoElement *)InstallParams.ClassInstallReserved;
5294 if (SelectedDriver == NULL)
5295 {
5297 goto cleanup;
5298 }
5299
5300 /* Get .CoInstallers section name */
5302 SelectedDriver->InfFileDetails->hInf,
5303 SelectedDriver->Details.SectionName,
5304 SectionName, MAX_PATH, &SectionNameLength, NULL);
5305 if (!Result || SectionNameLength > MAX_PATH - strlenW(DotCoInstallers) - 1)
5306 goto cleanup;
5307 lstrcatW(SectionName, DotCoInstallers);
5308
5309 deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5310
5311 /* Open/Create driver key information */
5312#if _WIN32_WINNT >= 0x502
5313 hKey = SETUPDI_OpenDrvKey(set->HKLM, deviceInfo, KEY_READ | KEY_WRITE);
5314#else
5315 hKey = SETUPDI_OpenDrvKey(set->HKLM, deviceInfo, KEY_ALL_ACCESS);
5316#endif
5318#if _WIN32_WINNT >= 0x502
5320#else
5322#endif
5324 goto cleanup;
5325
5326 /* Install .CoInstallers section */
5327 DoAction = SPINST_REGISTRY;
5329 {
5330 DoAction |= SPINST_FILES;
5332 if (!Context)
5333 goto cleanup;
5334 }
5336 SelectedDriver->InfFileDetails->hInf, SectionName,
5337 DoAction, hKey, SelectedDriver->InfFileDetails->DirectoryName, SP_COPY_NEWER,
5340 if (!Result)
5341 goto cleanup;
5342
5343 ret = TRUE;
5344
5345cleanup:
5346 if (Context)
5350 }
5351
5352 TRACE("Returning %d\n", ret);
5353 return ret;
5354}
static const WCHAR DotCoInstallers[]
Definition: devinst.c:29

Referenced by SetupDiCallClassInstaller().

◆ SetupDiRegisterDeviceInfo()

BOOL WINAPI SetupDiRegisterDeviceInfo ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Flags,
PSP_DETSIG_CMPPROC  CompareProc,
PVOID  CompareContext,
PSP_DEVINFO_DATA  DupDeviceInfoData 
)

Definition at line 1711 of file devinst.c.

1718{
1719 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
1720 WCHAR DevInstId[MAX_DEVICE_ID_LEN];
1721 DEVINST ParentDevInst;
1722 CONFIGRET cr;
1723 DWORD dwError = ERROR_SUCCESS;
1724
1725 TRACE("%s(%p %p %08x %p %p %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData, Flags,
1726 CompareProc, CompareContext, DupDeviceInfoData);
1727
1729 {
1731 return FALSE;
1732 }
1733 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
1734 {
1736 return FALSE;
1737 }
1740 {
1742 return FALSE;
1743 }
1744
1745 if (Flags & ~SPRDI_FIND_DUPS)
1746 {
1747 TRACE("Unknown flags: 0x%08lx\n", Flags & ~SPRDI_FIND_DUPS);
1749 return FALSE;
1750 }
1751
1752 if (Flags & SPRDI_FIND_DUPS)
1753 {
1754 FIXME("Unimplemented codepath!\n");
1755 }
1756
1758 DevInstId,
1760 0,
1761 set->hMachine);
1762
1763 CM_Get_Parent_Ex(&ParentDevInst,
1765 0,
1766 set->hMachine);
1767
1769 DevInstId,
1770 ParentDevInst,
1772 set->hMachine);
1773 if (cr != CR_SUCCESS &&
1775 {
1776 dwError = ERROR_NO_SUCH_DEVINST;
1777 }
1778
1779 SetLastError(dwError);
1780
1781 return (dwError == ERROR_SUCCESS);
1782}
#define CM_Create_DevInst_Ex
Definition: cfgmgr32.h:1128
#define CM_CREATE_DEVINST_DO_NOT_INSTALL
Definition: cfgmgr32.h:630
#define CM_CREATE_DEVINST_NORMAL
Definition: cfgmgr32.h:626
CONFIGRET WINAPI CM_Get_Parent_Ex(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:5480
#define SPRDI_FIND_DUPS
Definition: setupapi.h:626

Referenced by InstallCompositeBattery(), IntSetupDiRegisterDeviceInfo(), test_device_key(), test_register_device_iface(), and test_register_device_info().

◆ SetupDiRestartDevices()

BOOL WINAPI SetupDiRestartDevices ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 6160 of file devinst.c.

6163{
6164 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
6165 struct DeviceInfo *devInfo;
6166 CONFIGRET cr;
6167
6169
6171 {
6173 return FALSE;
6174 }
6175 if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
6176 {
6178 return FALSE;
6179 }
6180
6183 {
6185 return FALSE;
6186 }
6187
6188 devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
6189
6190 cr = CM_Enable_DevNode_Ex(devInfo->dnDevInst, 0, set->hMachine);
6191 if (cr != CR_SUCCESS)
6192 {
6194 return FALSE;
6195 }
6196
6197 return TRUE;
6198}

Referenced by InstallNetDevice().

◆ SetupDiSelectDevice()

BOOL WINAPI SetupDiSelectDevice ( IN HDEVINFO  DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL 
)

Definition at line 5243 of file devinst.c.

5246{
5247 FIXME("%p %p\n", DeviceInfoSet, DeviceInfoData);
5249 return FALSE;
5250}

Referenced by SetupDiCallClassInstaller().

◆ SetupDiSetClassInstallParamsA()

BOOL WINAPI SetupDiSetClassInstallParamsA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
PSP_CLASSINSTALL_HEADER  ClassInstallParams,
DWORD  ClassInstallParamsSize 
)

Definition at line 4048 of file devinst.c.

4053{
4054 FIXME("%p %p %x %u\n",DeviceInfoSet, DeviceInfoData,
4055 ClassInstallParams->InstallFunction, ClassInstallParamsSize);
4056 return FALSE;
4057}
_In_opt_ PSP_DEVINFO_DATA _In_ DWORD ClassInstallParamsSize
Definition: setupapi.h:1533

◆ SetupDiSetDeviceInstallParamsA()

BOOL WINAPI SetupDiSetDeviceInstallParamsA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
PSP_DEVINSTALL_PARAMS_A  DeviceInstallParams 
)

Definition at line 4644 of file devinst.c.

4648{
4649 SP_DEVINSTALL_PARAMS_W deviceInstallParamsW;
4650 int len = 0;
4651 BOOL ret = FALSE;
4652
4654
4657 else if (DeviceInstallParams->cbSize < sizeof(SP_DEVINSTALL_PARAMS_A))
4659 else
4660 {
4661 memcpy(&deviceInstallParamsW, DeviceInstallParams, FIELD_OFFSET(SP_DEVINSTALL_PARAMS_A, DriverPath));
4662 deviceInstallParamsW.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
4663 len = MultiByteToWideChar(CP_ACP, 0, DeviceInstallParams->DriverPath, -1, NULL, 0);
4664 if (!len)
4665 {
4666 ERR("DrivePath is NULL\n");
4667 ret = FALSE;
4668 }
4669 else
4670 {
4671 MultiByteToWideChar(CP_ACP, 0, DeviceInstallParams->DriverPath, -1, deviceInstallParamsW.DriverPath, len);
4673 }
4674 }
4675
4676 TRACE("Returning %d\n", ret);
4677 return ret;
4678}
#define MultiByteToWideChar
Definition: compat.h:110

◆ SetupDiSetDeviceInstallParamsW()

BOOL WINAPI SetupDiSetDeviceInstallParamsW ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
IN PSP_DEVINSTALL_PARAMS_W  DeviceInstallParams 
)

Definition at line 4604 of file devinst.c.

4608{
4609 struct DeviceInfoSet *list;
4610 BOOL ret = FALSE;
4611
4613
4614 if (!DeviceInfoSet)
4618 else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
4620 else if (!DeviceInstallParams)
4622 else if (DeviceInstallParams->cbSize != sizeof(SP_DEVINSTALL_PARAMS_W))
4625 {
4627
4628 if (DeviceInfoData)
4629 Destination = &((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams;
4630 else
4631 Destination = &list->InstallParams;
4633 ret = TRUE;
4634 }
4635
4636 TRACE("Returning %d\n", ret);
4637 return ret;
4638}
static BOOL CheckDeviceInstallParameters(IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4545
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3051

Referenced by DisplayDeviceAdvancedProperties(), EnumerateDrivers(), InstallNetDevice(), CDeviceNode::RemoveFlags(), SearchDriver(), CDeviceNode::SetFlags(), SetupDiBuildDriverInfoList(), SetupDiCallClassInstaller(), SetupDiDestroyDriverInfoList(), SetupDiInstallClassExW(), SetupDiInstallDevice(), SetupDiInstallDriverFiles(), SetupDiSetClassInstallParamsW(), SetupDiSetDeviceInstallParamsA(), and WriteParameterArray().

◆ SetupDiSetDeviceRegistryPropertyA()

BOOL WINAPI SetupDiSetDeviceRegistryPropertyA ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Property,
const BYTE PropertyBuffer,
DWORD  PropertyBufferSize 
)

Definition at line 3480 of file devinst.c.

3486{
3489 Property,
3492 TRUE);
3493}
BOOL WINAPI IntSetupDiSetDeviceRegistryPropertyAW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, const BYTE *PropertyBuffer, DWORD PropertyBufferSize, BOOL isAnsi)
Definition: devinst.c:3404

Referenced by test_registry_property_a().

◆ SetupDiSetDeviceRegistryPropertyW()

BOOL WINAPI SetupDiSetDeviceRegistryPropertyW ( HDEVINFO  DeviceInfoSet,
PSP_DEVINFO_DATA  DeviceInfoData,
DWORD  Property,
const BYTE PropertyBuffer,
DWORD  PropertyBufferSize 
)

◆ SetupDiSetSelectedDevice()

BOOL WINAPI SetupDiSetSelectedDevice ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)

Definition at line 4987 of file devinst.c.

4990{
4991 struct DeviceInfoSet *list;
4992 BOOL ret = FALSE;
4993
4995
4996 if (!DeviceInfoSet)
5000 else if (!DeviceInfoData)
5002 else if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
5004 else if (DeviceInfoData->Reserved == 0)
5006 else
5007 {
5008 list->SelectedDevice = (struct DeviceInfo *)DeviceInfoData->Reserved;
5009 ret = TRUE;
5010 }
5011
5012 TRACE("Returning %d\n", ret);
5013 return ret;
5014}

◆ StopDevice()

static BOOL StopDevice ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData 
)
static

Definition at line 5090 of file devinst.c.

5093{
5094#ifndef __WINESRC__
5095 struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
5096 struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
5097 CONFIGRET cr;
5098
5099 cr = CM_Disable_DevNode_Ex(deviceInfo->dnDevInst, 0, set->hMachine);
5100 if (cr != CR_SUCCESS)
5101 {
5103 return FALSE;
5104 }
5105
5106 return TRUE;
5107#else
5108 FIXME("Stub: StopDevice(%p %p)\n", DeviceInfoSet, DeviceInfoData);
5109 return TRUE;
5110#endif
5111}
CONFIGRET WINAPI CM_Disable_DevNode_Ex(_In_ DEVINST dnDevInst, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:1826

Referenced by SetupDiChangeState().

Variable Documentation

◆ BackSlash

const WCHAR BackSlash[] = {'\\',0}
static

Definition at line 27 of file devinst.c.

Referenced by InfIsFromOEMLocation(), and SETUP_CreateClassKey().

◆ DateFormat

const WCHAR DateFormat[] = {'%','u','-','%','u','-','%','u',0}
static

Definition at line 28 of file devinst.c.

Referenced by SetupDiInstallDevice().

◆ DotCoInstallers

const WCHAR DotCoInstallers[] = {'.','C','o','I','n','s','t','a','l','l','e','r','s',0}
static

Definition at line 29 of file devinst.c.

Referenced by SetupDiRegisterCoDeviceInstallers().

◆ DotHW

const WCHAR DotHW[] = {'.','H','W',0}
static

Definition at line 30 of file devinst.c.

Referenced by SetupDiInstallDevice().

◆ DotServices

const WCHAR DotServices[] = {'.','S','e','r','v','i','c','e','s',0}
static

Definition at line 31 of file devinst.c.

Referenced by SetupDiInstallDevice().

◆ InfDirectory

const WCHAR InfDirectory[] = {'i','n','f','\\',0}
static

Definition at line 32 of file devinst.c.

Referenced by InfIsFromOEMLocation().

◆ InstanceKeyFormat

const WCHAR InstanceKeyFormat[] = {'%','0','4','l','u',0}
static

Definition at line 33 of file devinst.c.

Referenced by OpenHardwareProfileKey(), and SETUPDI_CreateDrvKey().

◆ PropertyMap

struct PropertyMapEntry PropertyMap[]
static

◆ REGSTR_DRIVER_DATE

const WCHAR REGSTR_DRIVER_DATE[] = {'D','r','i','v','e','r','D','a','t','e',0}
static

Definition at line 37 of file devinst.c.

Referenced by SetupDiInstallDevice().

◆ REGSTR_DRIVER_DATE_DATA

const WCHAR REGSTR_DRIVER_DATE_DATA[] = {'D','r','i','v','e','r','D','a','t','e','D','a','t','a',0}
static

Definition at line 38 of file devinst.c.

Referenced by SetupDiInstallDevice().

◆ REGSTR_DRIVER_VERSION

const WCHAR REGSTR_DRIVER_VERSION[] = {'D','r','i','v','e','r','V','e','r','s','i','o','n',0}
static

Definition at line 39 of file devinst.c.

Referenced by SetupDiInstallDevice().

◆ REGSTR_SECURITY

const WCHAR REGSTR_SECURITY[] = {'S','e','c','u','r','i','t','y',0}
static

Definition at line 40 of file devinst.c.

◆ REGSTR_UI_NUMBER_DESC_FORMAT

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

Definition at line 41 of file devinst.c.

◆ Version

const WCHAR Version[] = {'V','e','r','s','i','o','n',0}
static

Definition at line 34 of file devinst.c.

◆ VersionFormat

const WCHAR VersionFormat[] = {'%','u','.','%','u','.','%','u','.','%','u',0}
static

Definition at line 35 of file devinst.c.

Referenced by SetupDiInstallDevice().