@@ -6150,3 +6150,83 @@ SetupDiRestartDevices(
61506150
61516151 return TRUE;
61526152}
6153+
6154+ /***********************************************************************
6155+ * SetupDiGetCustomDevicePropertyW (SETUPAPI.@)
6156+ */
6157+ BOOL
6158+ WINAPI
6159+ SetupDiGetCustomDevicePropertyW (
6160+ IN HDEVINFO DeviceInfoSet ,
6161+ IN PSP_DEVINFO_DATA DeviceInfoData ,
6162+ IN PCWSTR CustomPropertyName ,
6163+ IN DWORD Flags ,
6164+ OUT PDWORD PropertyRegDataType OPTIONAL ,
6165+ OUT PBYTE PropertyBuffer ,
6166+ IN DWORD PropertyBufferSize ,
6167+ OUT PDWORD RequiredSize OPTIONAL )
6168+ {
6169+ struct DeviceInfoSet * set = (struct DeviceInfoSet * )DeviceInfoSet ;
6170+ struct DeviceInfo * deviceInfo ;
6171+ DWORD ConfigFlags = 0 , PropertySize ;
6172+ CONFIGRET cr ;
6173+
6174+ TRACE ("%s(%p %p %s 0x%lx %p %p %lu %p)\n" , __FUNCTION__ , DeviceInfoSet , DeviceInfoData ,
6175+ debugstr_w (CustomPropertyName ), Flags , PropertyRegDataType , PropertyBuffer , PropertyBufferSize , RequiredSize );
6176+
6177+ if (!DeviceInfoSet || DeviceInfoSet == INVALID_HANDLE_VALUE )
6178+ {
6179+ SetLastError (ERROR_INVALID_HANDLE );
6180+ return FALSE;
6181+ }
6182+ if (set -> magic != SETUP_DEVICE_INFO_SET_MAGIC )
6183+ {
6184+ SetLastError (ERROR_INVALID_HANDLE );
6185+ return FALSE;
6186+ }
6187+ if (!DeviceInfoData || DeviceInfoData -> cbSize != sizeof (SP_DEVINFO_DATA )
6188+ || !DeviceInfoData -> Reserved )
6189+ {
6190+ SetLastError (ERROR_INVALID_PARAMETER );
6191+ return FALSE;
6192+ }
6193+ if (Flags & ~DICUSTOMDEVPROP_MERGE_MULTISZ )
6194+ {
6195+ SetLastError (ERROR_INVALID_FLAGS );
6196+ return FALSE;
6197+ }
6198+
6199+ deviceInfo = (struct DeviceInfo * )DeviceInfoData -> Reserved ;
6200+ if (deviceInfo -> set != set )
6201+ {
6202+ SetLastError (ERROR_INVALID_PARAMETER );
6203+ return FALSE;
6204+ }
6205+
6206+ if (Flags & DICUSTOMDEVPROP_MERGE_MULTISZ )
6207+ {
6208+ ConfigFlags |= CM_CUSTOMDEVPROP_MERGE_MULTISZ ;
6209+ }
6210+
6211+ PropertySize = PropertyBufferSize ;
6212+ cr = CM_Get_DevInst_Custom_Property_ExW (deviceInfo -> dnDevInst ,
6213+ CustomPropertyName ,
6214+ PropertyRegDataType ,
6215+ PropertyBuffer ,
6216+ & PropertySize ,
6217+ ConfigFlags ,
6218+ set -> hMachine );
6219+ if ((cr == CR_SUCCESS ) || (cr == CR_BUFFER_SMALL ))
6220+ {
6221+ if (RequiredSize )
6222+ * RequiredSize = PropertySize ;
6223+ }
6224+
6225+ if (cr != CR_SUCCESS )
6226+ {
6227+ SetLastError (GetErrorCodeFromCrCode (cr ));
6228+ return FALSE;
6229+ }
6230+
6231+ return TRUE;
6232+ }
0 commit comments