ReactOS  0.4.15-dev-2714-g4864c87
devclass.c File Reference
#include "setupapi_private.h"
#include <wingdi.h>
#include <shellapi.h>
#include <strsafe.h>
Include dependency graph for devclass.c:

Go to the source code of this file.

Classes

struct  _INSTALL_PARAMS_DATA
 
struct  ClassDevPropertySheetsData
 

Macros

#define ADD_PARAM_HANDLER(Function, UpdateHandler, ParamsType, ParamsField)   { Function, UpdateHandler, sizeof(ParamsType), FIELD_OFFSET(struct ClassInstallParams, ParamsField) },
 
#define UNKNOWN_ICON_INDEX   18
 

Typedefs

typedef BOOL(WINAPIPROPERTY_PAGE_PROVIDER) (IN PSP_PROPSHEETPAGE_REQUEST PropPageRequest, IN LPFNADDPROPSHEETPAGE fAddFunc, IN LPARAM lParam)
 
typedef BOOL(* UPDATE_CLASS_PARAM_HANDLER) (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_CLASSINSTALL_HEADER ClassInstallParams OPTIONAL, IN DWORD ClassInstallParamsSize)
 
typedef struct _INSTALL_PARAMS_DATA INSTALL_PARAMS_DATA
 

Functions

static BOOL SETUP_PropertyChangeHandler (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_CLASSINSTALL_HEADER ClassInstallParams OPTIONAL, IN DWORD ClassInstallParamsSize)
 
static BOOL SETUP_PropertyAddPropertyAdvancedHandler (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_CLASSINSTALL_HEADER ClassInstallParams OPTIONAL, IN DWORD ClassInstallParamsSize)
 
BOOL WINAPI SetupDiDestroyClassImageList (IN PSP_CLASSIMAGELIST_DATA ClassImageListData)
 
LONG SETUP_CreateDevicesList (IN OUT struct DeviceInfoSet *list, IN PCWSTR MachineName OPTIONAL, IN CONST GUID *Class OPTIONAL, IN PCWSTR Enumerator OPTIONAL)
 
static BOOL SETUP_GetIconIndex (IN HKEY hClassKey, OUT PINT ImageIndex)
 
BOOL WINAPI SetupDiGetClassImageIndex (IN PSP_CLASSIMAGELIST_DATA ClassImageListData, IN CONST GUID *ClassGuid, OUT PINT ImageIndex)
 
BOOL WINAPI SetupDiGetClassImageList (OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
 
BOOL WINAPI SetupDiGetClassImageListExA (OUT PSP_CLASSIMAGELIST_DATA ClassImageListData, IN PCSTR MachineName OPTIONAL, IN PVOID Reserved)
 
static BOOL WINAPI SETUP_GetClassIconInfo (IN CONST GUID *ClassGuid, OUT PINT OutIndex, OUT LPWSTR *OutDllName)
 
BOOL WINAPI SetupDiGetClassImageListExW (OUT PSP_CLASSIMAGELIST_DATA ClassImageListData, IN PCWSTR MachineName OPTIONAL, IN PVOID Reserved)
 
BOOL WINAPI SetupDiGetClassInstallParamsA (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_CLASSINSTALL_HEADER ClassInstallParams OPTIONAL, IN DWORD ClassInstallParamsSize, OUT PDWORD RequiredSize OPTIONAL)
 
BOOL WINAPI SetupDiGetClassInstallParamsW (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_CLASSINSTALL_HEADER ClassInstallParams OPTIONAL, IN DWORD ClassInstallParamsSize, OUT PDWORD RequiredSize OPTIONAL)
 
BOOL WINAPI SetupDiLoadClassIcon (IN CONST GUID *ClassGuid, OUT HICON *LargeIcon OPTIONAL, OUT PINT MiniIconIndex OPTIONAL)
 
HKEY SETUP_CreateClassKey (HINF hInf)
 
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)
 
BOOL WINAPI SetupDiSetClassInstallParamsW (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_CLASSINSTALL_HEADER ClassInstallParams OPTIONAL, IN DWORD ClassInstallParamsSize)
 
BOOL WINAPI SetupDiGetClassDevPropertySheetsA (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN LPPROPSHEETHEADERA PropertySheetHeader, IN DWORD PropertySheetHeaderPageListSize, OUT PDWORD RequiredSize OPTIONAL, IN DWORD PropertySheetType)
 
static BOOL WINAPI SETUP_GetClassDevPropertySheetsCallback (IN HPROPSHEETPAGE hPropSheetPage, IN OUT LPARAM lParam)
 
static DWORD SETUP_GetValueString (IN HKEY hKey, IN LPWSTR lpValueName, OUT LPWSTR *lpString)
 
static BOOL SETUP_CallInstaller (IN DI_FUNCTION InstallFunction, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_ADDPROPERTYPAGE_DATA PageData)
 
BOOL WINAPI SetupDiGetClassDevPropertySheetsW (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN OUT LPPROPSHEETHEADERW PropertySheetHeader, IN DWORD PropertySheetHeaderPageListSize, OUT PDWORD RequiredSize OPTIONAL, IN DWORD PropertySheetType)
 

Variables

static const WCHAR BackSlash [] = {'\\',0}
 
static const WCHAR ClassGUID [] = {'C','l','a','s','s','G','U','I','D',0}
 
static const WCHAR ClassInstall32 [] = {'C','l','a','s','s','I','n','s','t','a','l','l','3','2',0}
 
static const WCHAR DotServices [] = {'.','S','e','r','v','i','c','e','s',0}
 
static const WCHAR InterfaceInstall32 [] = {'I','n','t','e','r','f','a','c','e','I','n','s','t','a','l','l','3','2',0}
 
static const WCHAR SetupapiDll [] = {'s','e','t','u','p','a','p','i','.','d','l','l',0}
 
static const INSTALL_PARAMS_DATA InstallParamsData []
 

Macro Definition Documentation

◆ ADD_PARAM_HANDLER

#define ADD_PARAM_HANDLER (   Function,
  UpdateHandler,
  ParamsType,
  ParamsField 
)    { Function, UpdateHandler, sizeof(ParamsType), FIELD_OFFSET(struct ClassInstallParams, ParamsField) },

Definition at line 70 of file devclass.c.

◆ UNKNOWN_ICON_INDEX

#define UNKNOWN_ICON_INDEX   18

Definition at line 79 of file devclass.c.

Typedef Documentation

◆ INSTALL_PARAMS_DATA

◆ PROPERTY_PAGE_PROVIDER

typedef BOOL(WINAPI* PROPERTY_PAGE_PROVIDER) (IN PSP_PROPSHEETPAGE_REQUEST PropPageRequest, IN LPFNADDPROPSHEETPAGE fAddFunc, IN LPARAM lParam)

Definition at line 37 of file devclass.c.

◆ UPDATE_CLASS_PARAM_HANDLER

Function Documentation

◆ SETUP_CallInstaller()

static BOOL SETUP_CallInstaller ( IN DI_FUNCTION  InstallFunction,
IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
IN PSP_ADDPROPERTYPAGE_DATA  PageData 
)
static

Definition at line 1150 of file devclass.c.

1155 {
1156  PSP_CLASSINSTALL_HEADER pClassInstallParams = NULL;
1157  DWORD dwSize = 0;
1158  DWORD dwError;
1159  BOOL ret = TRUE;
1160 
1161  /* Get the size of the old class install parameters */
1164  NULL,
1165  0,
1166  &dwSize))
1167  {
1168  dwError = GetLastError();
1169  if (dwError != ERROR_INSUFFICIENT_BUFFER)
1170  {
1171  ERR("SetupDiGetClassInstallParams failed (Error %lu)\n", dwError);
1172  return FALSE;
1173  }
1174  }
1175 
1176  /* Allocate a buffer for the old class install parameters */
1177  pClassInstallParams = HeapAlloc(GetProcessHeap(), 0, dwSize);
1178  if (pClassInstallParams == NULL)
1179  {
1180  ERR("Failed to allocate the parameters buffer!\n");
1181  return FALSE;
1182  }
1183 
1184  /* Save the old class install parameters */
1187  pClassInstallParams,
1188  dwSize,
1189  &dwSize))
1190  {
1191  ERR("SetupDiGetClassInstallParams failed (Error %lu)\n", GetLastError());
1192  ret = FALSE;
1193  goto done;
1194  }
1195 
1196  /* Set the new class install parameters */
1199  &PageData->ClassInstallHeader,
1200  sizeof(SP_ADDPROPERTYPAGE_DATA)))
1201  {
1202  ERR("SetupDiSetClassInstallParams failed (Error %lu)\n", dwError);
1203  ret = FALSE;
1204  goto done;
1205  }
1206 
1207  /* Call the installer */
1208  ret = SetupDiCallClassInstaller(InstallFunction,
1209  DeviceInfoSet,
1210  DeviceInfoData);
1211  if (ret == FALSE)
1212  {
1213  ERR("SetupDiCallClassInstaller failed\n");
1214  goto done;
1215  }
1216 
1217  /* Read the new class installer parameters */
1220  &PageData->ClassInstallHeader,
1221  sizeof(SP_ADDPROPERTYPAGE_DATA),
1222  NULL))
1223  {
1224  ERR("SetupDiGetClassInstallParams failed (Error %lu)\n", GetLastError());
1225  ret = FALSE;
1226  goto done;
1227  }
1228 
1229 done:
1230  /* Restore and free the old class install parameters */
1231  if (pClassInstallParams != NULL)
1232  {
1235  pClassInstallParams,
1236  dwSize);
1237 
1238  HeapFree(GetProcessHeap(), 0, pClassInstallParams);
1239  }
1240 
1241  return ret;
1242 }
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION InstallFunction, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:4020
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define SetupDiGetClassInstallParams
Definition: setupapi.h:2591
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define SetupDiSetClassInstallParams
Definition: setupapi.h:2612
#define HeapFree(x, y, z)
Definition: compat.h:594
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by SetupDiGetClassDevPropertySheetsW().

◆ SETUP_CreateClassKey()

HKEY SETUP_CreateClassKey ( HINF  hInf)

Definition at line 3514 of file devinst.c.

3515 {
3516  WCHAR FullBuffer[MAX_PATH];
3519  HKEY hClassKey;
3521 
3522  /* Obtain the Class GUID for this class */
3523  if (!SetupGetLineTextW(NULL,
3524  hInf,
3525  Version,
3527  Buffer,
3528  sizeof(Buffer) / sizeof(WCHAR),
3529  &RequiredSize))
3530  {
3531  return INVALID_HANDLE_VALUE;
3532  }
3533 
3534  /* Build the corresponding registry key name */
3535  lstrcpyW(FullBuffer, REGSTR_PATH_CLASS_NT);
3536  lstrcatW(FullBuffer, BackSlash);
3537  lstrcatW(FullBuffer, Buffer);
3538 
3539  /* Obtain the Class name for this class */
3540  if (!SetupGetLineTextW(NULL,
3541  hInf,
3542  Version,
3544  Buffer,
3545  sizeof(Buffer) / sizeof(WCHAR),
3546  &RequiredSize))
3547  {
3548  return INVALID_HANDLE_VALUE;
3549  }
3550 
3551  /* Try to open or create the registry key */
3552  TRACE("Opening class key %s\n", debugstr_w(FullBuffer));
3553 #if 0 // I keep this for reference...
3555  FullBuffer,
3556  0,
3557  KEY_SET_VALUE,
3558  &hClassKey))
3559  {
3560  /* Use RegCreateKeyExW */
3561  }
3562 #endif
3564  FullBuffer,
3565  0,
3566  NULL,
3568  KEY_SET_VALUE,
3569  NULL,
3570  &hClassKey,
3571  &Disposition))
3572  {
3573  ERR("RegCreateKeyExW(%s) failed\n", debugstr_w(FullBuffer));
3574  return INVALID_HANDLE_VALUE;
3575  }
3577  TRACE("The class key %s was successfully created\n", debugstr_w(FullBuffer));
3578  else
3579  TRACE("The class key %s was successfully opened\n", debugstr_w(FullBuffer));
3580 
3581  TRACE( "setting value %s to %s\n", debugstr_w(REGSTR_VAL_CLASS), debugstr_w(Buffer) );
3584  0,
3585  REG_SZ,
3586  (LPBYTE)Buffer,
3587  RequiredSize * sizeof(WCHAR)))
3588  {
3591  FullBuffer);
3592  return INVALID_HANDLE_VALUE;
3593  }
3594 
3595  return hClassKey;
3596 }
#define REGSTR_VAL_CLASS
Definition: regstr.h:291
#define KEY_SET_VALUE
Definition: nt_native.h:1017
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define debugstr_w
Definition: kernel32.h:32
HKEY hClassKey
Definition: umpnpmgr.c:45
Definition: bufpool.h:45
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REGSTR_VAL_CLASSGUID
Definition: regstr.h:422
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
#define ERR(fmt,...)
Definition: debug.h:110
#define lstrcpyW
Definition: compat.h:608
#define NULL
Definition: types.h:112
static const WCHAR BackSlash[]
Definition: devinst.c:27
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REGSTR_PATH_CLASS_NT
Definition: regstr.h:479
BOOL WINAPI SetupGetLineTextW(PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required)
Definition: parser.c:1756
#define REG_SZ
Definition: layer.c:22

Referenced by SetupDiInstallClassExW().

◆ SETUP_CreateDevicesList()

LONG SETUP_CreateDevicesList ( IN OUT struct DeviceInfoSet list,
IN PCWSTR MachineName  OPTIONAL,
IN CONST GUID *Class  OPTIONAL,
IN PCWSTR Enumerator  OPTIONAL 
)

Definition at line 121 of file devclass.c.

126 {
127  PWCHAR Buffer = NULL;
128  DWORD BufferLength = 4096;
129  PCWSTR InstancePath;
130  struct DeviceInfo *deviceInfo;
131  WCHAR ClassGuidBuffer[MAX_GUID_STRING_LEN];
132  DWORD ClassGuidBufferSize;
133  GUID ClassGuid;
135  CONFIGRET cr;
136 
138  if (!Buffer)
140 
141  do
142  {
143  cr = CM_Get_Device_ID_List_ExW(Enumerator,
144  Buffer,
145  BufferLength / sizeof(WCHAR),
147  list->hMachine);
148  if (cr == CR_BUFFER_SMALL)
149  {
150  if (Buffer)
152  BufferLength *= 2;
154  if (!Buffer)
156  }
157  else if (cr != CR_SUCCESS)
158  {
159  TRACE("CM_Get_Device_ID_List_ExW() failed with status 0x%x\n", cr);
160  if (Buffer)
162  return GetErrorCodeFromCrCode(cr);
163  }
164  }
165  while (cr != CR_SUCCESS);
166 
167  for (InstancePath = Buffer; *InstancePath != UNICODE_NULL; InstancePath += wcslen(InstancePath) + 1)
168  {
169  /* Check that device really exists */
170  TRACE("Checking %S\n", InstancePath);
172  (DEVINSTID_W)InstancePath,
174  list->hMachine);
175  if (cr != CR_SUCCESS)
176  {
177  ERR("CM_Locate_DevNode_ExW('%S') failed with status 0x%x\n", InstancePath, cr);
178  continue;
179  }
180 
181  /* Retrieve GUID of this device */
182  ClassGuidBufferSize = sizeof(ClassGuidBuffer);
185  NULL,
186  ClassGuidBuffer,
187  &ClassGuidBufferSize,
188  0,
189  list->hMachine);
190  if (cr == CR_SUCCESS)
191  {
192  ClassGuidBuffer[MAX_GUID_STRING_LEN - 2] = '\0'; /* Replace the } by a NULL character */
193  if (UuidFromStringW(&ClassGuidBuffer[1], &ClassGuid) != RPC_S_OK)
194  {
195  /* Bad GUID, skip the entry */
196  ERR("Invalid ClassGUID '%S' for device %S\n", ClassGuidBuffer, InstancePath);
197  continue;
198  }
199  }
200  else
201  {
202  TRACE("Using default class GUID_NULL for device %S\n", InstancePath);
203  memcpy(&ClassGuid, &GUID_NULL, sizeof(GUID));
204  }
205 
206  if (Class && !IsEqualIID(&ClassGuid, Class))
207  {
208  TRACE("Skipping %S due to wrong class GUID\n", InstancePath);
209  continue;
210  }
211 
212  /* Good! Create a device info element */
213  if (!CreateDeviceInfo(list, InstancePath, &ClassGuid, &deviceInfo))
214  {
215  ERR("Failed to create info for %S\n", InstancePath);
217  return GetLastError();
218  }
219 
220  TRACE("Adding device %s to list\n", debugstr_w(InstancePath));
221  InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
222  }
223 
225  return ERROR_SUCCESS;
226 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
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:3475
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CM_GETIDLIST_FILTER_NONE
Definition: cfgmgr32.h:654
DWORD GetErrorCodeFromCrCode(const IN CONFIGRET cr)
Definition: devinst.c:94
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
uint16_t * PWCHAR
Definition: typedefs.h:56
#define InsertTailList(ListHead, Entry)
_Null_terminated_ WCHAR * DEVINSTID_W
Definition: cfgmgr32.h:80
BOOL CreateDeviceInfo(IN struct DeviceInfoSet *list, IN LPCWSTR InstancePath, IN LPCGUID pClassGuid, OUT struct DeviceInfo **pDeviceInfo)
Definition: devinst.c:528
#define UNICODE_NULL
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:612
#define debugstr_w
Definition: kernel32.h:32
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define CM_DRP_CLASSGUID
Definition: cfgmgr32.h:684
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_GUID_STRING_LEN
Definition: apphelp.c:29
#define CR_BUFFER_SMALL
Definition: cfgmgr32.h:872
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CM_Locate_DevNode_Ex
Definition: cfgmgr32.h:2405
DEVINST dnDevInst
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GUID_NULL
Definition: ks.h:106
Definition: _list.h:228
#define ERR(fmt,...)
Definition: debug.h:110
CONFIGRET WINAPI CM_Get_Device_ID_List_ExW(_In_ PCWSTR pszFilter, _Out_writes_(BufferLen) PWCHAR Buffer, _In_ ULONG BufferLen, _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine)
Definition: cfgmgr.c:3884
DWORD DEVINST
Definition: cfgmgr32.h:76
#define NULL
Definition: types.h:112
#define CM_GETIDLIST_FILTER_ENUMERATOR
Definition: cfgmgr32.h:655
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LIST_ENTRY ListEntry
#define CM_LOCATE_DEVNODE_NORMAL
Definition: cfgmgr32.h:760
#define HeapFree(x, y, z)
Definition: compat.h:594
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by SetupDiGetClassDevsExW().

◆ SETUP_GetClassDevPropertySheetsCallback()

static BOOL WINAPI SETUP_GetClassDevPropertySheetsCallback ( IN HPROPSHEETPAGE  hPropSheetPage,
IN OUT LPARAM  lParam 
)
static

Definition at line 1092 of file devclass.c.

1095 {
1096  struct ClassDevPropertySheetsData *PropPageData;
1097 
1098  PropPageData = (struct ClassDevPropertySheetsData *)lParam;
1099 
1100  PropPageData->NumberOfPages++;
1101 
1102  if (PropPageData->PropertySheetHeader->nPages < PropPageData->PropertySheetHeaderPageListSize)
1103  {
1104  PropPageData->PropertySheetHeader->phpage[PropPageData->PropertySheetHeader->nPages] = hPropSheetPage;
1105  PropPageData->PropertySheetHeader->nPages++;
1106  return TRUE;
1107  }
1108 
1109  return PropPageData->DontCancel;
1110 }
#define TRUE
Definition: types.h:120
LPPROPSHEETHEADERW PropertySheetHeader
Definition: devclass.c:1085
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
LPARAM lParam
Definition: combotst.c:139

Referenced by SetupDiGetClassDevPropertySheetsW().

◆ SETUP_GetClassIconInfo()

static BOOL WINAPI SETUP_GetClassIconInfo ( IN CONST GUID ClassGuid,
OUT PINT  OutIndex,
OUT LPWSTR OutDllName 
)
static

Definition at line 355 of file devclass.c.

356 {
357  LPWSTR Buffer = NULL;
358  INT iconIndex = -UNKNOWN_ICON_INDEX;
360  BOOL ret = FALSE;
361 
362  if (ClassGuid)
363  {
365  if (hKey != INVALID_HANDLE_VALUE)
366  {
367  SETUP_GetIconIndex(hKey, &iconIndex);
368  }
369  }
370 
371  if (iconIndex > 0)
372  {
373  /* Look up icon in dll specified by Installer32 or EnumPropPages32 key */
374  PWCHAR Comma;
375  LONG rc;
376  DWORD dwRegType, dwLength;
378  if (rc == ERROR_SUCCESS && dwRegType == REG_SZ)
379  {
380  Buffer = MyMalloc(dwLength + sizeof(WCHAR));
381  if (Buffer == NULL)
382  {
384  goto cleanup;
385  }
387  if (rc != ERROR_SUCCESS)
388  {
389  SetLastError(rc);
390  goto cleanup;
391  }
392  /* make sure the returned buffer is NULL-terminated */
393  Buffer[dwLength / sizeof(WCHAR)] = 0;
394  }
395  else if
397  && dwRegType == REG_SZ)
398  {
399  Buffer = MyMalloc(dwLength + sizeof(WCHAR));
400  if (Buffer == NULL)
401  {
403  goto cleanup;
404  }
406  if (rc != ERROR_SUCCESS)
407  {
408  SetLastError(rc);
409  goto cleanup;
410  }
411  /* make sure the returned buffer is NULL-terminated */
412  Buffer[dwLength / sizeof(WCHAR)] = 0;
413  }
414  else
415  {
416  /* Unable to find where to load the icon */
418  goto cleanup;
419  }
420  Comma = strchrW(Buffer, ',');
421  if (!Comma)
422  {
424  goto cleanup;
425  }
426  *Comma = '\0';
427  *OutDllName = Buffer;
428  }
429  else
430  {
431  /* Look up icon in setupapi.dll */
432  iconIndex = -iconIndex;
433  *OutDllName = NULL;
434  }
435 
436  *OutIndex = iconIndex;
437  ret = TRUE;
438 
439  TRACE("Icon index %d, dll name %s\n", iconIndex, debugstr_w(*OutDllName ? *OutDllName : SetupapiDll));
440 
441 cleanup:
442 
443  if (hKey != INVALID_HANDLE_VALUE)
444  RegCloseKey(hKey);
445 
446  if (Buffer && !ret)
447  MyFree(Buffer);
448 
449  return ret;
450 }
#define ERROR_SUCCESS
Definition: deptool.c:10
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
uint16_t * PWCHAR
Definition: typedefs.h:56
static BOOL SETUP_GetIconIndex(IN HKEY hClassKey, OUT PINT ImageIndex)
Definition: devclass.c:229
int32_t INT
Definition: typedefs.h:58
#define REGSTR_VAL_ENUMPROPPAGES_32
Definition: regstr.h:490
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define REGSTR_VAL_INSTALLER_32
Definition: regstr.h:487
Definition: bufpool.h:45
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
static const WCHAR SetupapiDll[]
Definition: devclass.c:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
int ret
#define UNKNOWN_ICON_INDEX
Definition: devclass.c:79
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define NULL
Definition: types.h:112
char * cleanup(char *str)
Definition: wpickclick.c:99
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
HKEY WINAPI SetupDiOpenClassRegKey(const GUID *ClassGuid, REGSAM samDesired)
Definition: devinst.c:3614
#define REG_SZ
Definition: layer.c:22

Referenced by SetupDiGetClassImageListExW(), and SetupDiLoadClassIcon().

◆ SETUP_GetIconIndex()

static BOOL SETUP_GetIconIndex ( IN HKEY  hClassKey,
OUT PINT  ImageIndex 
)
static

Definition at line 229 of file devclass.c.

232 {
233  LPWSTR Buffer = NULL;
234  DWORD dwRegType, dwLength;
235  LONG rc;
236  BOOL ret = FALSE;
237 
238  /* Read icon registry key */
240  if (rc != ERROR_SUCCESS)
241  {
242  SetLastError(rc);
243  goto cleanup;
244  } else if (dwRegType != REG_SZ)
245  {
247  goto cleanup;
248  }
249  Buffer = MyMalloc(dwLength + sizeof(WCHAR));
250  if (!Buffer)
251  {
253  goto cleanup;
254  }
256  if (rc != ERROR_SUCCESS)
257  {
258  SetLastError(rc);
259  goto cleanup;
260  }
261  /* make sure the returned buffer is NULL-terminated */
262  Buffer[dwLength / sizeof(WCHAR)] = 0;
263 
264  /* Transform icon value to a INT */
265  *ImageIndex = atoiW(Buffer);
266  ret = TRUE;
267 
268 cleanup:
269  MyFree(Buffer);
270  return ret;
271 }
#define REGSTR_VAL_INSICON
Definition: regstr.h:488
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
HKEY hClassKey
Definition: umpnpmgr.c:45
Definition: bufpool.h:45
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
int ret
#define NULL
Definition: types.h:112
#define ERROR_INVALID_INDEX
Definition: winerror.h:894
char * cleanup(char *str)
Definition: wpickclick.c:99
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
WCHAR * LPWSTR
Definition: xmlstorage.h:184
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315
#define REG_SZ
Definition: layer.c:22

Referenced by SETUP_GetClassIconInfo().

◆ SETUP_GetValueString()

static DWORD SETUP_GetValueString ( IN HKEY  hKey,
IN LPWSTR  lpValueName,
OUT LPWSTR lpString 
)
static

Definition at line 1113 of file devclass.c.

1117 {
1118  LPWSTR lpBuffer;
1119  DWORD dwLength = 0;
1120  DWORD dwRegType;
1121  DWORD rc;
1122 
1123  *lpString = NULL;
1124 
1125  RegQueryValueExW(hKey, lpValueName, NULL, &dwRegType, NULL, &dwLength);
1126 
1127  if (dwLength == 0 || dwRegType != REG_SZ)
1128  return ERROR_FILE_NOT_FOUND;
1129 
1130  lpBuffer = HeapAlloc(GetProcessHeap(), 0, dwLength + sizeof(WCHAR));
1131  if (lpBuffer == NULL)
1132  return ERROR_NOT_ENOUGH_MEMORY;
1133 
1134  rc = RegQueryValueExW(hKey, lpValueName, NULL, NULL, (LPBYTE)lpBuffer, &dwLength);
1135  if (rc != ERROR_SUCCESS)
1136  {
1138  return rc;
1139  }
1140 
1141  lpBuffer[dwLength / sizeof(WCHAR)] = UNICODE_NULL;
1142 
1143  *lpString = lpBuffer;
1144 
1145  return ERROR_SUCCESS;
1146 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * LPBYTE
Definition: typedefs.h:53
#define UNICODE_NULL
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define REG_SZ
Definition: layer.c:22

Referenced by SetupDiGetClassDevPropertySheetsW().

◆ SETUP_PropertyAddPropertyAdvancedHandler()

static BOOL SETUP_PropertyAddPropertyAdvancedHandler ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
IN PSP_CLASSINSTALL_HEADER ClassInstallParams  OPTIONAL,
IN DWORD  ClassInstallParamsSize 
)
static

Definition at line 918 of file devclass.c.

923 {
925  BOOL ret = FALSE;
926 
929  else if (AddPropertyPageData && AddPropertyPageData->Flags != 0)
931  else if (AddPropertyPageData && AddPropertyPageData->NumDynamicPages >= MAX_INSTALLWIZARD_DYNAPAGES)
933  else
934  {
935  PSP_ADDPROPERTYPAGE_DATA *CurrentAddPropertyPageData;
936  if (!DeviceInfoData)
937  {
938  struct DeviceInfoSet *list = (struct DeviceInfoSet *)DeviceInfoSet;
939  CurrentAddPropertyPageData = &list->ClassInstallParams.AddPropertyPageData;
940  }
941  else
942  {
943  struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
944  CurrentAddPropertyPageData = &deviceInfo->ClassInstallParams.AddPropertyPageData;
945  }
946  if (*CurrentAddPropertyPageData)
947  {
948  MyFree(*CurrentAddPropertyPageData);
949  *CurrentAddPropertyPageData = NULL;
950  }
951  if (AddPropertyPageData)
952  {
953  *CurrentAddPropertyPageData = MyMalloc(ClassInstallParamsSize);
954  if (!*CurrentAddPropertyPageData)
955  {
957  goto done;
958  }
959  memcpy(*CurrentAddPropertyPageData, AddPropertyPageData, ClassInstallParamsSize);
960  }
961  ret = TRUE;
962  }
963 
964 done:
965  return ret;
966 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
#define MAX_INSTALLWIZARD_DYNAPAGES
Definition: setupapi.h:454
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG_PTR Reserved
Definition: setupapi.h:833
_In_opt_ PSP_DEVINFO_DATA _In_ DWORD ClassInstallParamsSize
Definition: setupapi.h:1525
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
#define SetLastError(x)
Definition: compat.h:611
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: _list.h:228
#define NULL
Definition: types.h:112
SP_NEWDEVICEWIZARD_DATA * PSP_ADDPROPERTYPAGE_DATA
Definition: setupapi.h:977
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
struct ClassInstallParams ClassInstallParams
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583

◆ SETUP_PropertyChangeHandler()

static BOOL SETUP_PropertyChangeHandler ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
IN PSP_CLASSINSTALL_HEADER ClassInstallParams  OPTIONAL,
IN DWORD  ClassInstallParamsSize 
)
static

Definition at line 865 of file devclass.c.

870 {
872  BOOL ret = FALSE;
873 
874  if (!DeviceInfoData)
876  else if (ClassInstallParamsSize != sizeof(SP_PROPCHANGE_PARAMS))
878  else if (PropChangeParams && PropChangeParams->StateChange != DICS_ENABLE
879  && PropChangeParams->StateChange != DICS_DISABLE && PropChangeParams->StateChange != DICS_PROPCHANGE
880  && PropChangeParams->StateChange != DICS_START && PropChangeParams->StateChange != DICS_STOP)
882  else if (PropChangeParams && PropChangeParams->Scope != DICS_FLAG_GLOBAL
883  && PropChangeParams->Scope != DICS_FLAG_CONFIGSPECIFIC)
885  else if (PropChangeParams
886  && (PropChangeParams->StateChange == DICS_START || PropChangeParams->StateChange == DICS_STOP)
887  && PropChangeParams->Scope != DICS_FLAG_CONFIGSPECIFIC)
889  else
890  {
891  PSP_PROPCHANGE_PARAMS *CurrentPropChangeParams;
892  struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
893  CurrentPropChangeParams = &deviceInfo->ClassInstallParams.PropChangeParams;
894 
895  if (*CurrentPropChangeParams)
896  {
897  MyFree(*CurrentPropChangeParams);
898  *CurrentPropChangeParams = NULL;
899  }
900  if (PropChangeParams)
901  {
902  *CurrentPropChangeParams = MyMalloc(ClassInstallParamsSize);
903  if (!*CurrentPropChangeParams)
904  {
906  goto done;
907  }
908  memcpy(*CurrentPropChangeParams, PropChangeParams, ClassInstallParamsSize);
909  }
910  ret = TRUE;
911  }
912 
913 done:
914  return ret;
915 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define DICS_ENABLE
Definition: setupapi.h:112
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DICS_DISABLE
Definition: setupapi.h:114
#define DICS_STOP
Definition: setupapi.h:119
#define DICS_START
Definition: setupapi.h:117
ULONG_PTR Reserved
Definition: setupapi.h:833
#define DICS_FLAG_CONFIGSPECIFIC
Definition: setupapi.h:115
_In_opt_ PSP_DEVINFO_DATA _In_ DWORD ClassInstallParamsSize
Definition: setupapi.h:1525
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
#define SetLastError(x)
Definition: compat.h:611
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _SP_PROPCHANGE_PARAMS * PSP_PROPCHANGE_PARAMS
#define DICS_FLAG_GLOBAL
Definition: setupapi.h:113
#define DICS_PROPCHANGE
Definition: setupapi.h:116
#define NULL
Definition: types.h:112
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
struct ClassInstallParams ClassInstallParams
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583

◆ SetupDiDestroyClassImageList()

BOOL WINAPI SetupDiDestroyClassImageList ( IN PSP_CLASSIMAGELIST_DATA  ClassImageListData)

Definition at line 85 of file devclass.c.

87 {
88  struct ClassImageList *list;
89  BOOL ret = FALSE;
90 
91  TRACE("%p\n", ClassImageListData);
92 
93  if (!ClassImageListData)
95  else if (ClassImageListData->cbSize != sizeof(SP_CLASSIMAGELIST_DATA))
97  else if ((list = (struct ClassImageList *)ClassImageListData->Reserved) == NULL)
99  else if (list->magic != SETUP_CLASS_IMAGE_LIST_MAGIC)
101  else
102  {
103  /* If Reserved wasn't NULL, then this is valid too */
104  if (ClassImageListData->ImageList)
105  {
106  ImageList_Destroy(ClassImageListData->ImageList);
107  ClassImageListData->ImageList = NULL;
108  }
109 
110  MyFree(list);
111  ClassImageListData->Reserved = 0;
112 
113  ret = TRUE;
114  }
115 
116  TRACE("Returning %d\n", ret);
117  return ret;
118 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
#define SETUP_CLASS_IMAGE_LIST_MAGIC
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:611
int ret
Definition: _list.h:228
#define list
Definition: rosglue.h:35
#define NULL
Definition: types.h:112
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128

Referenced by HardwareDlgProc(), SafeRemovalDlgProc(), SetupDiGetClassImageListExW(), and CDeviceView::Uninitialize().

◆ SetupDiGetClassDevPropertySheetsA()

BOOL WINAPI SetupDiGetClassDevPropertySheetsA ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
IN LPPROPSHEETHEADERA  PropertySheetHeader,
IN DWORD  PropertySheetHeaderPageListSize,
OUT PDWORD RequiredSize  OPTIONAL,
IN DWORD  PropertySheetType 
)

Definition at line 1049 of file devclass.c.

1056 {
1057  PROPSHEETHEADERW psh;
1058  BOOL ret = FALSE;
1059 
1060  TRACE("%p %p %p 0%lx %p 0x%lx\n", DeviceInfoSet, DeviceInfoData,
1061  PropertySheetHeader, PropertySheetHeaderPageListSize,
1062  RequiredSize, PropertySheetType);
1063 
1064  if(PropertySheetHeader)
1065  {
1066  psh.dwFlags = PropertySheetHeader->dwFlags;
1067  psh.phpage = PropertySheetHeader->phpage;
1068  psh.nPages = PropertySheetHeader->nPages;
1069  }
1070 
1071  ret = SetupDiGetClassDevPropertySheetsW(DeviceInfoSet, DeviceInfoData, PropertySheetHeader ? &psh : NULL,
1072  PropertySheetHeaderPageListSize, RequiredSize,
1073  PropertySheetType);
1074  if (ret)
1075  {
1076  PropertySheetHeader->nPages = psh.nPages;
1077  }
1078 
1079  TRACE("Returning %d\n", ret);
1080  return ret;
1081 }
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
DWORD dwFlags
Definition: prsht.h:294
int ret
BOOL WINAPI SetupDiGetClassDevPropertySheetsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN OUT LPPROPSHEETHEADERW PropertySheetHeader, IN DWORD PropertySheetHeaderPageListSize, OUT PDWORD RequiredSize OPTIONAL, IN DWORD PropertySheetType)
Definition: devclass.c:1248
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431

◆ SetupDiGetClassDevPropertySheetsW()

BOOL WINAPI SetupDiGetClassDevPropertySheetsW ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
IN OUT LPPROPSHEETHEADERW  PropertySheetHeader,
IN DWORD  PropertySheetHeaderPageListSize,
OUT PDWORD RequiredSize  OPTIONAL,
IN DWORD  PropertySheetType 
)

Definition at line 1248 of file devclass.c.

1255 {
1256  struct DeviceInfoSet *devInfoSet = NULL;
1257  struct DeviceInfo *devInfo = NULL;
1258  BOOL ret = FALSE;
1259 
1260  TRACE("%p %p %p 0%lx %p 0x%lx\n", DeviceInfoSet, DeviceInfoData,
1261  PropertySheetHeader, PropertySheetHeaderPageListSize,
1262  RequiredSize, PropertySheetType);
1263 
1264  if (!DeviceInfoSet)
1268  else if ((devInfoSet = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
1270  else if (!PropertySheetHeader)
1272  else if (PropertySheetHeader->dwFlags & PSH_PROPSHEETPAGE)
1274  else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
1276  else if (!DeviceInfoData && IsEqualIID(&devInfoSet->ClassGuid, &GUID_NULL))
1278  else if (PropertySheetType != DIGCDP_FLAG_ADVANCED
1279  && PropertySheetType != DIGCDP_FLAG_BASIC
1280  && PropertySheetType != DIGCDP_FLAG_REMOTE_ADVANCED
1281  && PropertySheetType != DIGCDP_FLAG_REMOTE_BASIC)
1283  else
1284  {
1287  LPWSTR PropPageProvider = NULL;
1288  HMODULE hModule = NULL;
1289  PROPERTY_PAGE_PROVIDER pPropPageProvider = NULL;
1290  struct ClassDevPropertySheetsData PropPageData;
1291  SP_ADDPROPERTYPAGE_DATA InstallerPropPageData;
1292  DWORD InitialNumberOfPages, i;
1293  DWORD rc;
1294 
1295  if (DeviceInfoData)
1296  devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
1297 
1298  /* Get the class property page provider */
1299  if (devInfoSet->hmodClassPropPageProvider == NULL)
1300  {
1301  hKey = SetupDiOpenClassRegKeyExW(devInfo ? &devInfo->ClassGuid : &devInfoSet->ClassGuid, KEY_QUERY_VALUE,
1302  DIOCR_INSTALLER, NULL/*devInfoSet->MachineName + 2*/, NULL);
1303  if (hKey != INVALID_HANDLE_VALUE)
1304  {
1305  rc = SETUP_GetValueString(hKey, REGSTR_VAL_ENUMPROPPAGES_32, &PropPageProvider);
1306  if (rc == ERROR_SUCCESS)
1307  {
1308  rc = GetFunctionPointer(PropPageProvider, &hModule, (PVOID*)&pPropPageProvider);
1309  if (rc != ERROR_SUCCESS)
1310  {
1312  goto cleanup;
1313  }
1314 
1315  devInfoSet->hmodClassPropPageProvider = hModule;
1316  devInfoSet->pClassPropPageProvider = pPropPageProvider;
1317 
1318  HeapFree(GetProcessHeap(), 0, PropPageProvider);
1319  PropPageProvider = NULL;
1320  }
1321 
1322  RegCloseKey(hKey);
1324  }
1325  }
1326 
1327  /* Get the device property page provider */
1328  if (devInfo != NULL && devInfo->hmodDevicePropPageProvider == NULL)
1329  {
1330  hKey = SETUPDI_OpenDrvKey(devInfoSet->HKLM, devInfo, KEY_QUERY_VALUE);
1331  if (hKey != INVALID_HANDLE_VALUE)
1332  {
1333  rc = SETUP_GetValueString(hKey, REGSTR_VAL_ENUMPROPPAGES_32, &PropPageProvider);
1334  if (rc == ERROR_SUCCESS)
1335  {
1336  rc = GetFunctionPointer(PropPageProvider, &hModule, (PVOID*)&pPropPageProvider);
1337  if (rc != ERROR_SUCCESS)
1338  {
1340  goto cleanup;
1341  }
1342 
1344  devInfo->pDevicePropPageProvider = pPropPageProvider;
1345 
1346  HeapFree(GetProcessHeap(), 0, PropPageProvider);
1347  PropPageProvider = NULL;
1348  }
1349 
1350  RegCloseKey(hKey);
1352  }
1353  }
1354 
1355  InitialNumberOfPages = PropertySheetHeader->nPages;
1356 
1357  Request.cbSize = sizeof(SP_PROPSHEETPAGE_REQUEST);
1358  Request.PageRequested = SPPSR_ENUM_ADV_DEVICE_PROPERTIES;
1359  Request.DeviceInfoSet = DeviceInfoSet;
1360  Request.DeviceInfoData = DeviceInfoData;
1361 
1362  PropPageData.PropertySheetHeader = PropertySheetHeader;
1363  PropPageData.PropertySheetHeaderPageListSize = PropertySheetHeaderPageListSize;
1364  PropPageData.NumberOfPages = 0;
1365  PropPageData.DontCancel = (RequiredSize != NULL) ? TRUE : FALSE;
1366 
1367  /* Call the class property page provider */
1368  if (devInfoSet->pClassPropPageProvider != NULL)
1370 
1371  /* Call the device property page provider */
1372  if (devInfo != NULL && devInfo->pDevicePropPageProvider != NULL)
1374 
1375  /* Call the class installer and add the returned pages */
1376  ZeroMemory(&InstallerPropPageData, sizeof(SP_ADDPROPERTYPAGE_DATA));
1377  InstallerPropPageData.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
1378  InstallerPropPageData.ClassInstallHeader.InstallFunction = DIF_ADDPROPERTYPAGE_ADVANCED;
1379  InstallerPropPageData.hwndWizardDlg = PropertySheetHeader->hwndParent;
1380 
1382  DeviceInfoSet,
1384  &InstallerPropPageData))
1385  {
1386  for (i = 0; i < InstallerPropPageData.NumDynamicPages; i++)
1387  {
1388  if (PropPageData.PropertySheetHeader->nPages < PropertySheetHeaderPageListSize)
1389  {
1390  PropPageData.PropertySheetHeader->phpage[PropPageData.PropertySheetHeader->nPages] =
1391  InstallerPropPageData.DynamicPages[i];
1392  PropPageData.PropertySheetHeader->nPages++;
1393  }
1394  }
1395 
1396  PropPageData.NumberOfPages += InstallerPropPageData.NumDynamicPages;
1397  }
1398 
1399  if (RequiredSize)
1400  *RequiredSize = PropPageData.NumberOfPages;
1401 
1402  if (InitialNumberOfPages + PropPageData.NumberOfPages <= PropertySheetHeaderPageListSize)
1403  {
1404  ret = TRUE;
1405  }
1406  else
1407  {
1409  }
1410 
1411 cleanup:
1412  if (hKey != INVALID_HANDLE_VALUE)
1413  RegCloseKey(hKey);
1414 
1415  if (PropPageProvider != NULL)
1416  HeapFree(GetProcessHeap(), 0, PropPageProvider);
1417  }
1418 
1419  TRACE("Returning %d\n", ret);
1420  return ret;
1421 }
static BOOL WINAPI SETUP_GetClassDevPropertySheetsCallback(IN HPROPSHEETPAGE hPropSheetPage, IN OUT LPARAM lParam)
Definition: devclass.c:1092
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
u32_t magic(void)
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define ZeroMemory
Definition: winbase.h:1664
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
HMODULE hmodClassPropPageProvider
#define ERROR_INVALID_PROPPAGE_PROVIDER
Definition: setupapi.h:327
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define SETUP_DEVICE_INFO_SET_MAGIC
#define DIGCDP_FLAG_ADVANCED
Definition: setupapi.h:165
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
#define REGSTR_VAL_ENUMPROPPAGES_32
Definition: regstr.h:490
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID pClassPropPageProvider
#define DIOCR_INSTALLER
Definition: setupapi.h:176
#define DIF_ADDPROPERTYPAGE_ADVANCED
Definition: setupapi.h:154
LONG_PTR LPARAM
Definition: windef.h:208
PVOID pDevicePropPageProvider
HMODULE hmodDevicePropPageProvider
ULONG_PTR Reserved
Definition: setupapi.h:833
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
DWORD GetFunctionPointer(IN PWSTR InstallerName, OUT HMODULE *ModulePointer, OUT PVOID *FunctionPointer)
Definition: misc.c:44
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
int ret
#define GUID_NULL
Definition: ks.h:106
HKEY SETUPDI_OpenDrvKey(HKEY RootKey, struct DeviceInfo *devInfo, REGSAM samDesired)
Definition: devinst.c:5853
#define SPPSR_ENUM_ADV_DEVICE_PROPERTIES
Definition: setupapi.h:610
struct _SP_PROPSHEETPAGE_REQUEST SP_PROPSHEETPAGE_REQUEST
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
FxAutoRegKey hKey
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define NULL
Definition: types.h:112
struct _SP_CLASSINSTALL_HEADER SP_CLASSINSTALL_HEADER
static DWORD SETUP_GetValueString(IN HKEY hKey, IN LPWSTR lpValueName, OUT LPWSTR *lpString)
Definition: devclass.c:1113
char * cleanup(char *str)
Definition: wpickclick.c:99
HKEY WINAPI SetupDiOpenClassRegKeyExW(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:3658
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431
BOOL(WINAPI * PROPERTY_PAGE_PROVIDER)(IN PSP_PROPSHEETPAGE_REQUEST PropPageRequest, IN LPFNADDPROPSHEETPAGE fAddFunc, IN LPARAM lParam)
Definition: devclass.c:37
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define DIGCDP_FLAG_BASIC
Definition: setupapi.h:164
#define HeapFree(x, y, z)
Definition: compat.h:594
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static BOOL SETUP_CallInstaller(IN DI_FUNCTION InstallFunction, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_ADDPROPERTYPAGE_DATA PageData)
Definition: devclass.c:1150
HMODULE hModule
Definition: animate.c:44
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by SetupDiGetClassDevPropertySheetsA().

◆ SetupDiGetClassImageIndex()

BOOL WINAPI SetupDiGetClassImageIndex ( IN PSP_CLASSIMAGELIST_DATA  ClassImageListData,
IN CONST GUID ClassGuid,
OUT PINT  ImageIndex 
)

Definition at line 277 of file devclass.c.

281 {
282  struct ClassImageList *list;
283  BOOL ret = FALSE;
284 
285  TRACE("%p %s %p\n", ClassImageListData, debugstr_guid(ClassGuid), ImageIndex);
286 
287  if (!ClassImageListData || !ClassGuid || !ImageIndex)
289  else if (ClassImageListData->cbSize != sizeof(SP_CLASSIMAGELIST_DATA))
291  else if ((list = (struct ClassImageList *)ClassImageListData->Reserved) == NULL)
293  else if (list->magic != SETUP_CLASS_IMAGE_LIST_MAGIC)
295  else
296  {
297  DWORD i;
298 
299  for (i = 0; i < list->NumberOfGuids; i++)
300  {
301  if (IsEqualIID(ClassGuid, &list->Guids[i]))
302  break;
303  }
304 
305  if (i == list->NumberOfGuids || list->IconIndexes[i] < 0)
307  else
308  {
309  *ImageIndex = list->IconIndexes[i];
310  ret = TRUE;
311  }
312  }
313 
314  TRACE("Returning %d\n", ret);
315  return ret;
316 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
#define SETUP_CLASS_IMAGE_LIST_MAGIC
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
int ret
Definition: _list.h:228
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 list
Definition: rosglue.h:35
#define NULL
Definition: types.h:112
static const char * debugstr_guid(const GUID *guid)
Definition: devclass.c:42
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by BuildDevicesList(), EnumDeviceClasses(), InitProbeListPage(), InsertDeviceTreeItem(), CClassNode::SetupNode(), and CDeviceNode::SetupNode().

◆ SetupDiGetClassImageList()

BOOL WINAPI SetupDiGetClassImageList ( OUT PSP_CLASSIMAGELIST_DATA  ClassImageListData)

Definition at line 322 of file devclass.c.

324 {
325  return SetupDiGetClassImageListExW(ClassImageListData, NULL, NULL);
326 }
BOOL WINAPI SetupDiGetClassImageListExW(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData, IN PCWSTR MachineName OPTIONAL, IN PVOID Reserved)
Definition: devclass.c:457
#define NULL
Definition: types.h:112

Referenced by DisplayImageList(), HardwareDlgProc(), CDeviceView::Initialize(), InitProbeListPage(), and SafeRemovalDlgProc().

◆ SetupDiGetClassImageListExA()

BOOL WINAPI SetupDiGetClassImageListExA ( OUT PSP_CLASSIMAGELIST_DATA  ClassImageListData,
IN PCSTR MachineName  OPTIONAL,
IN PVOID  Reserved 
)

Definition at line 332 of file devclass.c.

336 {
337  PWSTR MachineNameW = NULL;
338  BOOL ret;
339 
340  if (MachineName)
341  {
343  if (MachineNameW == NULL)
344  return FALSE;
345  }
346 
347  ret = SetupDiGetClassImageListExW(ClassImageListData, MachineNameW, Reserved);
348 
349  MyFree(MachineNameW);
350 
351  return ret;
352 }
uint16_t * PWSTR
Definition: typedefs.h:56
#define CP_ACP
Definition: compat.h:109
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
#define FALSE
Definition: types.h:117
LPWSTR WINAPI pSetupMultiByteToUnicode(LPCSTR lpMultiByteStr, UINT uCodePage)
Definition: misc.c:281
unsigned int BOOL
Definition: ntddk_ex.h:94
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
BOOL WINAPI SetupDiGetClassImageListExW(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData, IN PCWSTR MachineName OPTIONAL, IN PVOID Reserved)
Definition: devclass.c:457
int ret
#define NULL
Definition: types.h:112
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128

◆ SetupDiGetClassImageListExW()

BOOL WINAPI SetupDiGetClassImageListExW ( OUT PSP_CLASSIMAGELIST_DATA  ClassImageListData,
IN PCWSTR MachineName  OPTIONAL,
IN PVOID  Reserved 
)

Definition at line 457 of file devclass.c.

461 {
462  BOOL ret = FALSE;
463 
464  TRACE("%p %p %p\n", ClassImageListData, debugstr_w(MachineName), Reserved);
465 
466  if (!ClassImageListData)
468  else if (ClassImageListData->cbSize != sizeof(SP_CLASSIMAGELIST_DATA))
470  else if (Reserved)
472  else
473  {
474  struct ClassImageList *list = NULL;
475  HDC hDC;
477  DWORD ilMask, bkColor;
478  HICON hIcon;
479  DWORD size;
480  INT i, bpp;
481  UINT idx;
482 
483  /* Get list of all class GUIDs in given computer */
485  0,
486  NULL,
487  0,
488  &RequiredSize,
489  MachineName,
490  NULL);
492  goto cleanup;
493 
494  size = sizeof(struct ClassImageList)
495  + (sizeof(GUID) + sizeof(INT)) * RequiredSize;
497  if (!list)
498  {
500  goto cleanup;
501  }
503  list->NumberOfGuids = RequiredSize;
504  list->Guids = (GUID*)(list + 1);
505  list->IconIndexes = (INT*)((ULONG_PTR)(list + 1) + sizeof(GUID) * RequiredSize);
506 
508  0,
509  list->Guids,
510  list->NumberOfGuids,
511  &RequiredSize,
512  MachineName,
513  NULL);
514  if (!ret)
515  goto cleanup;
516  else if (RequiredSize != list->NumberOfGuids)
517  {
518  /* Hm. Class list changed since last call. Ignore
519  * this case as it should be very rare */
521  ret = FALSE;
522  goto cleanup;
523  }
524 
525  /* Prepare a HIMAGELIST */
527 
528  hDC = GetDC(NULL);
529  if (!hDC)
530  goto cleanup;
531 
533  ReleaseDC(NULL, hDC);
534 
535  if (bpp <= 4)
536  ilMask = ILC_COLOR4;
537  else if (bpp <= 8)
538  ilMask = ILC_COLOR8;
539  else if (bpp <= 16)
540  ilMask = ILC_COLOR16;
541  else if (bpp <= 24)
542  ilMask = ILC_COLOR24;
543  else if (bpp <= 32)
544  ilMask = ILC_COLOR32;
545  else
546  ilMask = ILC_COLOR;
547 
548  ilMask |= ILC_MASK;
549 
550  ClassImageListData->ImageList = ImageList_Create(16, 16, ilMask, 100, 10);
551  if (!ClassImageListData->ImageList)
552  goto cleanup;
553 
554  ClassImageListData->Reserved = (ULONG_PTR)list;
555 
556  /* For some reason, Windows sets the list background to COLOR_WINDOW */
557  bkColor = GetSysColor(COLOR_WINDOW);
558  ImageList_SetBkColor(ClassImageListData->ImageList, bkColor);
559 
560  /* Now, we "simply" need to load icons associated with all class guids,
561  * and put their index in the image list in the IconIndexes array */
562  for (i = 0; i < list->NumberOfGuids; i++)
563  {
564  INT miniIconIndex;
565  LPWSTR DllName = NULL;
566 
567  if (SETUP_GetClassIconInfo(&list->Guids[i], &miniIconIndex, &DllName))
568  {
569  if (DllName && ExtractIconExW(DllName, -miniIconIndex, NULL, &hIcon, 1) == 1)
570  {
571  list->IconIndexes[i] = ImageList_AddIcon(ClassImageListData->ImageList, hIcon);
572  }
573  else if(!DllName)
574  {
575  hIcon = LoadImage(hInstance, MAKEINTRESOURCE(miniIconIndex), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
576  list->IconIndexes[i] = ImageList_AddIcon(ClassImageListData->ImageList, hIcon);
577  }
578 
579  if(hIcon)
581  else
582  list->IconIndexes[i] = -1;
583 
584  if(DllName)
585  MyFree(DllName);
586  }
587  else
588  {
589  list->IconIndexes[i] = -1; /* Special value to indicate that the icon is unavailable */
590  }
591  }
592 
593  /* Finally, add the overlay icons to the image list */
594  for (i = 0; i <= 2; i++)
595  {
597  if (hIcon)
598  {
599  idx = ImageList_AddIcon(ClassImageListData->ImageList, hIcon);
600  if (idx != -1)
601  ImageList_SetOverlayImage(ClassImageListData->ImageList, idx, i + 1);
603  }
604  }
605 
606  ret = TRUE;
607 
608 cleanup:
609  if (!ret)
610  {
611  if (ClassImageListData->Reserved)
612  SetupDiDestroyClassImageList(ClassImageListData);
613  else if (list)
614  MyFree(list);
615  }
616  }
617 
618  TRACE("Returning %d\n", ret);
619  return ret;
620 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ILC_COLOR16
Definition: commctrl.h:356
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define BITSPIXEL
Definition: wingdi.h:719
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk)
Definition: imagelist.c:2889
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define SETUP_CLASS_IMAGE_LIST_MAGIC
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
static BOOL WINAPI SETUP_GetClassIconInfo(IN CONST GUID *ClassGuid, OUT PINT OutIndex, OUT LPWSTR *OutDllName)
Definition: devclass.c:355
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
#define COLOR_WINDOW
Definition: winuser.h:908
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetSysColor(_In_ int)
#define ILC_COLOR4
Definition: commctrl.h:354
#define ILC_COLOR32
Definition: commctrl.h:358
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
HINSTANCE hInstance
Definition: charmap.c:20
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:872
#define debugstr_w
Definition: kernel32.h:32
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ILC_COLOR
Definition: commctrl.h:352
unsigned int idx
Definition: utils.c:41
BOOL WINAPI SetupDiDestroyClassImageList(IN PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:85
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ILC_COLOR24
Definition: commctrl.h:357
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
int ret
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define ILC_MASK
Definition: commctrl.h:351
Definition: _list.h:228
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, INT iImage, INT iOverlay)
Definition: imagelist.c:3180
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
HICON hIcon
Definition: msconfig.c:44
BOOL WINAPI SetupDiBuildClassInfoListExW(DWORD Flags, LPGUID ClassGuidList, DWORD ClassGuidListSize, PDWORD RequiredSize, LPCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:722
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define ILC_COLOR8
Definition: commctrl.h:355
#define ULONG_PTR
Definition: config.h:101
char * cleanup(char *str)
Definition: wpickclick.c:99
DWORD bpp
Definition: surface.c:185
#define LoadImage
Definition: winuser.h:5790
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by SetupDiGetClassImageList(), and SetupDiGetClassImageListExA().

◆ SetupDiGetClassInstallParamsA()

BOOL WINAPI SetupDiGetClassInstallParamsA ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
OUT PSP_CLASSINSTALL_HEADER ClassInstallParams  OPTIONAL,
IN DWORD  ClassInstallParamsSize,
OUT PDWORD RequiredSize  OPTIONAL 
)

Definition at line 626 of file devclass.c.

632 {
633  FIXME("SetupDiGetClassInstallParamsA(%p %p %p %lu %p) Stub\n",
635  return FALSE;
636 }
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
_In_opt_ PSP_DEVINFO_DATA _In_ DWORD ClassInstallParamsSize
Definition: setupapi.h:1525
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431

◆ SetupDiGetClassInstallParamsW()

BOOL WINAPI SetupDiGetClassInstallParamsW ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
OUT PSP_CLASSINSTALL_HEADER ClassInstallParams  OPTIONAL,
IN DWORD  ClassInstallParamsSize,
OUT PDWORD RequiredSize  OPTIONAL 
)

Definition at line 642 of file devclass.c.

648 {
649  FIXME("SetupDiGetClassInstallParamsW(%p %p %p %lu %p) Stub\n",
651  return FALSE;
652 }
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
_In_opt_ PSP_DEVINFO_DATA _In_ DWORD ClassInstallParamsSize
Definition: setupapi.h:1525
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431

◆ SetupDiInstallClassExW()

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 at line 708 of file devclass.c.

716 {
717  BOOL ret = FALSE;
718 
719  TRACE("%p %s 0x%lx %p %s %p %p\n", hwndParent, debugstr_w(InfFileName), Flags,
721 
722  if (!InfFileName)
723  {
724  FIXME("Case not implemented: InfFileName NULL\n");
726  }
728  {
729  TRACE("Unknown flags: 0x%08lx\n", Flags & ~(DI_NOVCP | DI_NOBROWSE | DI_FORCECOPY | DI_QUIETINSTALL));
731  }
732  else if ((Flags & DI_NOVCP) && FileQueue == NULL)
734  else if (Reserved1 != NULL)
736  else if (Reserved2 != NULL)
738  else
739  {
740  HDEVINFO hDeviceInfo = INVALID_HANDLE_VALUE;
741  SP_DEVINSTALL_PARAMS_W InstallParams;
742  WCHAR SectionName[MAX_PATH];
743  HINF hInf = INVALID_HANDLE_VALUE;
744  HKEY hRootKey = INVALID_HANDLE_VALUE;
746 
747  hDeviceInfo = SetupDiCreateDeviceInfoList(NULL, NULL);
748  if (hDeviceInfo == INVALID_HANDLE_VALUE)
749  goto cleanup;
750 
751  InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
752  if (!SetupDiGetDeviceInstallParamsW(hDeviceInfo, NULL, &InstallParams))
753  goto cleanup;
754 
755  InstallParams.Flags &= ~(DI_NOVCP | DI_NOBROWSE | DI_QUIETINSTALL);
756  InstallParams.Flags |= Flags & (DI_NOVCP | DI_NOBROWSE | DI_QUIETINSTALL);
757  if (Flags & DI_NOVCP)
758  InstallParams.FileQueue = FileQueue;
759  if (!SetupDiSetDeviceInstallParamsW(hDeviceInfo, NULL, &InstallParams))
760  goto cleanup;
761 
762  /* Open the .inf file */
763  hInf = SetupOpenInfFileW(
764  InfFileName,
765  NULL,
767  NULL);
768  if (hInf == INVALID_HANDLE_VALUE)
769  goto cleanup;
770 
771  /* Try to append a layout file */
773 
774  if (InterfaceClassGuid)
775  {
776  /* Retrieve the actual section name */
778  hInf,
780  SectionName,
781  MAX_PATH,
782  NULL,
783  NULL);
784  if (!ret)
785  goto cleanup;
786 
787  /* Open registry key related to this interface */
788  /* FIXME: What happens if the key doesn't exist? */
790  if (hRootKey == INVALID_HANDLE_VALUE)
791  goto cleanup;
792 
793  /* SetupDiCreateDeviceInterface??? */
794  FIXME("Installing an interface is not implemented\n");
796  }
797  else
798  {
799  /* Create or open the class registry key 'HKLM\CurrentControlSet\Class\{GUID}' */
800  hRootKey = SETUP_CreateClassKey(hInf);
801  if (hRootKey == INVALID_HANDLE_VALUE)
802  goto cleanup;
803 
804  /* Retrieve the actual section name */
806  hInf,
808  SectionName,
810  NULL,
811  NULL);
812  if (!ret)
813  goto cleanup;
814 
816  if (!callback_context)
817  goto cleanup;
818 
820  hwndParent,
821  hInf,
822  SectionName,
824  hRootKey,
825  NULL, /* FIXME: SourceRootPath */
826  !(Flags & DI_NOVCP) && (Flags & DI_FORCECOPY) ? SP_COPY_FORCE_IN_USE : 0, /* CopyFlags */
829  hDeviceInfo,
830  NULL);
831  if (!ret)
832  goto cleanup;
833 
834  /* OPTIONAL: Install .Services section */
835  lstrcatW(SectionName, DotServices);
837  hInf,
838  SectionName,
839  0,
840  hDeviceInfo,
841  NULL,
842  NULL,
843  NULL);
844  ret = TRUE;
845  }
846 
847 cleanup:
848  if (hDeviceInfo != INVALID_HANDLE_VALUE)
849  SetupDiDestroyDeviceInfoList(hDeviceInfo);
850  if (hInf != INVALID_HANDLE_VALUE)
851  SetupCloseInfFile(hInf);
852  if (hRootKey != INVALID_HANDLE_VALUE)
853  RegCloseKey(hRootKey);
855  }
856 
857  TRACE("Returning %d\n", ret);
858  return ret;
859 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL WINAPI SetupDiGetActualSectionToInstallW(HINF InfHandle, PCWSTR InfSectionName, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PWSTR *Extension)
Definition: devinst.c:1976
#define SPINST_INIFILES
Definition: setupapi.h:584
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define INF_STYLE_WIN4
Definition: infsupp.h:41
#define DI_NOBROWSE
Definition: setupapi.h:55
BOOL WINAPI SetupInstallServicesFromInfSectionExW(HINF hinf, PCWSTR sectionname, DWORD flags, HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, PVOID reserved1, PVOID reserved2)
Definition: install.c:2078
static const WCHAR ClassInstall32[]
Definition: devclass.c:31
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4554
#define SPINST_BITREG
Definition: setupapi.h:588
#define TRUE
Definition: types.h:120
static const WCHAR DotServices[]
Definition: devclass.c:32
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
HDEVINFO WINAPI SetupDiCreateDeviceInfoList(const GUID *ClassGuid, HWND hwndParent)
Definition: devinst.c:1205
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4447
#define DI_NOVCP
Definition: setupapi.h:49
#define SPINST_REGISTRY
Definition: setupapi.h:585
static HWND hwndParent
Definition: cryptui.c:300
#define SPINST_FILES
Definition: setupapi.h:587
Definition: bcd.h:202
#define TRACE(s)
Definition: solgame.cpp:4
#define DI_FORCECOPY
Definition: setupapi.h:70
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2889
#define MAX_PATH
Definition: compat.h:34
SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS
Definition: setupapi.h:1150
HKEY SETUP_CreateClassKey(HINF hInf)
Definition: devinst.c:3514
#define SetLastError(x)
Definition: compat.h:611
#define DI_QUIETINSTALL
Definition: setupapi.h:68
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:1327
int ret
UINT WINAPI SetupDefaultQueueCallbackW(PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2)
Definition: queue.c:1777
void WINAPI SetupTermDefaultQueueCallback(PVOID context)
Definition: queue.c:1704
#define DIOCR_INTERFACE
Definition: setupapi.h:177
BOOL WINAPI SetupOpenAppendInfFileW(PCWSTR name, HINF parent_hinf, UINT *error)
Definition: parser.c:1346
#define SP_COPY_FORCE_IN_USE
Definition: setupapi.h:481
static const WCHAR InterfaceInstall32[]
Definition: devclass.c:33
PVOID WINAPI SetupInitDefaultQueueCallback(HWND owner)
Definition: queue.c:1677
_In_ CONST GUID * InterfaceClassGuid
Definition: iofuncs.h:1136
#define NULL
Definition: types.h:112
Definition: bcd.h:201
static const char * debugstr_guid(const GUID *guid)
Definition: devclass.c:42
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
char * cleanup(char *str)
Definition: wpickclick.c:99
HKEY WINAPI SetupDiOpenClassRegKeyExW(const GUID *ClassGuid, REGSAM samDesired, DWORD Flags, PCWSTR MachineName, PVOID Reserved)
Definition: devinst.c:3658
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define SPINST_INI2REG
Definition: setupapi.h:586
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

Referenced by SetupDiInstallClassExA(), and SetupDiInstallClassW().

◆ SetupDiLoadClassIcon()

BOOL WINAPI SetupDiLoadClassIcon ( IN CONST GUID ClassGuid,
OUT HICON *LargeIcon  OPTIONAL,
OUT PINT MiniIconIndex  OPTIONAL 
)

Definition at line 658 of file devclass.c.

662 {
663  INT iconIndex = 0;
664  LPWSTR DllName = NULL;
665  BOOL ret = FALSE;
666  HICON hIcon = NULL;
667 
668  if (LargeIcon)
669  {
670  if(!SETUP_GetClassIconInfo(ClassGuid, &iconIndex, &DllName))
671  goto cleanup;
672 
673  if (!DllName || ExtractIconExW(DllName, -iconIndex, &hIcon, NULL, 1) != 1 || hIcon == NULL)
674  {
675  /* load the default unknown device icon if ExtractIcon failed */
676  if(DllName)
677  iconIndex = UNKNOWN_ICON_INDEX;
678 
680 
681  if(!hIcon)
682  goto cleanup;
683  }
684 
685  *LargeIcon = hIcon;
686  }
687 
688  if (MiniIconIndex)
689  *MiniIconIndex = iconIndex;
690 
691  ret = TRUE;
692 
693 cleanup:
694 
695  if(DllName)
696  MyFree(DllName);
697 
698  TRACE("Returning %d\n", ret);
699  return ret;
700 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
#define TRUE
Definition: types.h:120
static BOOL WINAPI SETUP_GetClassIconInfo(IN CONST GUID *ClassGuid, OUT PINT OutIndex, OUT LPWSTR *OutDllName)
Definition: devclass.c:355
int32_t INT
Definition: typedefs.h:58
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:872
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define UNKNOWN_ICON_INDEX
Definition: devclass.c:79
HICON hIcon
Definition: msconfig.c:44
#define NULL
Definition: types.h:112
char * cleanup(char *str)
Definition: wpickclick.c:99
#define LoadImage
Definition: winuser.h:5790
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128

Referenced by UpdateDevInfo().

◆ SetupDiSetClassInstallParamsW()

BOOL WINAPI SetupDiSetClassInstallParamsW ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData  OPTIONAL,
IN PSP_CLASSINSTALL_HEADER ClassInstallParams  OPTIONAL,
IN DWORD  ClassInstallParamsSize 
)

Definition at line 972 of file devclass.c.

977 {
978  struct DeviceInfoSet *list;
979  BOOL ret = FALSE;
980 
981  TRACE("%p %p %p %lu\n", DeviceInfoSet, DeviceInfoData,
983 
984  if (!DeviceInfoSet)
990  else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
992  else if (ClassInstallParams && ClassInstallParams->cbSize != sizeof(SP_CLASSINSTALL_HEADER))
996  else if (!ClassInstallParams && ClassInstallParamsSize != 0)
998  else
999  {
1001  BOOL Result;
1002 
1005  if (!Result)
1006  goto done;
1007 
1008  if (ClassInstallParams)
1009  {
1010  DWORD i;
1011  /* Check parameters in ClassInstallParams */
1012  for (i = 0; i < sizeof(InstallParamsData) / sizeof(InstallParamsData[0]); i++)
1013  {
1014  if (InstallParamsData[i].Function == ClassInstallParams->InstallFunction)
1015  {
1017  DeviceInfoSet,
1021  if (ret)
1022  {
1025  }
1026  goto done;
1027  }
1028  }
1029  ERR("InstallFunction %u has no associated update handler\n", ClassInstallParams->InstallFunction);
1031  goto done;
1032  }
1033  else
1034  {
1037  }
1038  }
1039 
1040 done:
1041  TRACE("Returning %d\n", ret);
1042  return ret;
1043 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1154
BOOL WINAPI SetupDiSetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, IN PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4554
UPDATE_CLASS_PARAM_HANDLER UpdateHandler
Definition: devclass.c:65
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
u32_t magic(void)
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
SP_DEVINSTALL_PARAMS_W InstallParams
#define SETUP_DEVICE_INFO_SET_MAGIC
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI SetupDiGetDeviceInstallParamsW(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL, OUT PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
Definition: devinst.c:4447
_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:426
#define TRACE(s)
Definition: solgame.cpp:4
_In_opt_ PSP_DEVINFO_DATA _In_ DWORD ClassInstallParamsSize
Definition: setupapi.h:1525
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
#define DI_CLASSINSTALLPARAMS
Definition: setupapi.h:66
int ret
Definition: _list.h:228
#define ERR(fmt,...)
Definition: debug.h:110
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 list
Definition: rosglue.h:35
struct _SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS_W
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
static const INSTALL_PARAMS_DATA InstallParamsData[]
Definition: devclass.c:73

Referenced by DisplayDeviceAdvancedProperties(), CDeviceNode::EnableDevice(), CDeviceNode::UninstallDevice(), and UninstallDriver().

Variable Documentation

◆ BackSlash

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

Definition at line 29 of file devclass.c.

Referenced by CheckForDeviceDesc(), NpTranslateAlias(), and RunTestCases().

◆ ClassGUID

const WCHAR ClassGUID[] = {'C','l','a','s','s','G','U','I','D',0}
static

◆ ClassInstall32

const WCHAR ClassInstall32[] = {'C','l','a','s','s','I','n','s','t','a','l','l','3','2',0}
static

Definition at line 31 of file devclass.c.

Referenced by SetupDiInstallClassExW().

◆ DotServices

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

Definition at line 32 of file devclass.c.

Referenced by SetupDiInstallClassExW().

◆ InstallParamsData

const INSTALL_PARAMS_DATA InstallParamsData[]
static
Initial value:
= {
}

Definition at line 73 of file devclass.c.

Referenced by SetupDiSetClassInstallParamsW().

◆ InterfaceInstall32

const WCHAR InterfaceInstall32[] = {'I','n','t','e','r','f','a','c','e','I','n','s','t','a','l','l','3','2',0}
static

Definition at line 33 of file devclass.c.

Referenced by SetupDiInstallClassExW().

◆ SetupapiDll

const WCHAR SetupapiDll[] = {'s','e','t','u','p','a','p','i','.','d','l','l',0}
static

Definition at line 34 of file devclass.c.

Referenced by SETUP_GetClassIconInfo().