/***********************************************************************
* SetupDiGetClassDevsExW (SETUPAPI.@)
*/
-LONG
-SETUP_CreateDevicesList(
- IN OUT struct DeviceInfoSet *list,
- IN PCWSTR MachineName OPTIONAL,
- IN CONST GUID *Class OPTIONAL,
- IN PCWSTR Enumerator OPTIONAL);
HDEVINFO WINAPI SetupDiGetClassDevsExW(
CONST GUID *class,
PCWSTR enumstr,
PWSTR InfFileNameW = NULL;
BOOL Result;
- if (InfFileName)
+ if (!InfFileName)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ else
{
InfFileNameW = MultiByteToUnicode(InfFileName, CP_ACP);
if (InfFileNameW == NULL)
else
{
ERR("Invalid Flags parameter!\n");
- SetLastError(ERROR_INVALID_PARAMETER);
+ SetLastError(ERROR_INVALID_FLAGS);
if (MachineName != NULL) RegCloseKey(HKLM);
return INVALID_HANDLE_VALUE;
}
return ret;
}
+BOOL WINAPI SetupDiSetDeviceInstallParamsA(
+ HDEVINFO DeviceInfoSet,
+ PSP_DEVINFO_DATA DeviceInfoData,
+ PSP_DEVINSTALL_PARAMS_A DeviceInstallParams)
+{
+ SP_DEVINSTALL_PARAMS_W deviceInstallParamsW;
+ int len = 0;
+ BOOL ret = FALSE;
+
+ TRACE("%p %p %p\n", DeviceInfoSet, DeviceInfoData, DeviceInstallParams);
+
+ if (DeviceInstallParams == NULL)
+ SetLastError(ERROR_INVALID_PARAMETER);
+ else if (DeviceInstallParams->cbSize < sizeof(SP_DEVINSTALL_PARAMS_A))
+ SetLastError(ERROR_INVALID_USER_BUFFER);
+ else
+ {
+ memcpy(&deviceInstallParamsW, DeviceInstallParams, FIELD_OFFSET(SP_DEVINSTALL_PARAMS_A, DriverPath));
+ deviceInstallParamsW.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
+ len = MultiByteToWideChar(CP_ACP, 0, DeviceInstallParams->DriverPath, -1, NULL, 0);
+ if (!len)
+ {
+ ERR("DrivePath is NULL\n");
+ ret = FALSE;
+ }
+ else
+ {
+ MultiByteToWideChar(CP_ACP, 0, DeviceInstallParams->DriverPath, -1, deviceInstallParamsW.DriverPath, len);
+ ret = SetupDiSetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &deviceInstallParamsW);
+ }
+ }
+
+ TRACE("Returning %d\n", ret);
+ return ret;
+}
+
static HKEY
OpenHardwareProfileKey(
IN HKEY HKLM,
if (hKey != NULL)
RegCloseKey(hKey);
- return hwProfile;
+ return ret;
}
static BOOL
IN PSP_DEVINFO_DATA DeviceInfoData)
{
#ifndef __WINESRC__
- PLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData;
+ struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
- NTSTATUS Status;
+ CONFIGRET cr;
- if (((struct DeviceInfoSet *)DeviceInfoSet)->HKLM != HKEY_LOCAL_MACHINE)
+ cr = CM_Enable_DevNode_Ex(deviceInfo->dnDevInst, 0, set->hMachine);
+ if (cr != CR_SUCCESS)
{
- /* At the moment, I only know how to start local devices */
- SetLastError(ERROR_INVALID_COMPUTERNAME);
+ SetLastError(GetErrorCodeFromCrCode(cr));
return FALSE;
}
- RtlInitUnicodeString(&ResetDeviceData.DeviceInstance, deviceInfo->instanceId);
- Status = NtPlugPlayControl(PlugPlayControlResetDevice, &ResetDeviceData, sizeof(PLUGPLAY_CONTROL_RESET_DEVICE_DATA));
- SetLastError(RtlNtStatusToDosError(Status));
- return NT_SUCCESS(Status);
+ return TRUE;
#else
FIXME("Stub: ResetDevice(%p %p)\n", DeviceInfoSet, DeviceInfoData);
return TRUE;
DWORD KeyType,
REGSAM samDesired)
{
- struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
+ struct DeviceInfoSet *set = DeviceInfoSet;
struct DeviceInfo *devInfo;
HKEY key = INVALID_HANDLE_VALUE;
HKEY RootKey;