Rename SETUP_DEV_INFO_SET_MAGIC to SETUP_DEVICE_INFO_SET_MAGIC

Rename struct DeviceInfoElement to struct DeviceInfo
Add a link to DeviceInfoSet in each DeviceInfo structure (not used yet)

svn path=/trunk/; revision=30324
This commit is contained in:
Hervé Poussineau 2007-11-10 14:04:55 +00:00
parent ce4c1b6f78
commit c39ceb22e6
6 changed files with 93 additions and 89 deletions

View file

@ -941,7 +941,7 @@ SETUP_CreateDevicesListFromEnumerator(
WCHAR KeyBuffer[MAX_PATH];
WCHAR InstancePath[MAX_PATH];
LPWSTR pEndOfInstancePath; /* Pointer into InstancePath buffer */
struct DeviceInfoElement *deviceInfo;
struct DeviceInfo *deviceInfo;
DWORD i = 0, j;
DWORD dwLength, dwRegType;
DWORD rc;
@ -1026,7 +1026,7 @@ SETUP_CreateDevicesListFromEnumerator(
}
/* Add the entry to the list */
if (!CreateDeviceInfoElement(list, InstancePath, &KeyGuid, &deviceInfo))
if (!CreateDeviceInfo(list, InstancePath, &KeyGuid, &deviceInfo))
{
rc = GetLastError();
goto cleanup;
@ -1164,7 +1164,7 @@ SetupDiGetClassDevsExW(
if (DeviceInfoSet)
{
list = (struct DeviceInfoSet *)DeviceInfoSet;
if (list->magic != SETUP_DEV_INFO_SET_MAGIC)
if (list->magic != SETUP_DEVICE_INFO_SET_MAGIC)
{
SetLastError(ERROR_INVALID_HANDLE);
goto cleanup;
@ -2137,7 +2137,7 @@ SETUP_PropertyChangeHandler(
else
{
PSP_PROPCHANGE_PARAMS *CurrentPropChangeParams;
struct DeviceInfoElement *deviceInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
CurrentPropChangeParams = &deviceInfo->ClassInstallParams.PropChangeParams;
if (*CurrentPropChangeParams)
@ -2188,7 +2188,7 @@ SETUP_PropertyAddPropertyAdvancedHandler(
}
else
{
struct DeviceInfoElement *deviceInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
CurrentAddPropertyPageData = &deviceInfo->ClassInstallParams.AddPropertyPageData;
}
if (*CurrentAddPropertyPageData)
@ -2233,7 +2233,7 @@ SetupDiSetClassInstallParamsW(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -2372,9 +2372,9 @@ SetupDiGetClassDevPropertySheetsW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!PropertySheetHeader)
SetLastError(ERROR_INVALID_PARAMETER);

View file

@ -198,7 +198,7 @@ SetupDiCreateDeviceInfoListExW(
}
ZeroMemory(list, FIELD_OFFSET(struct DeviceInfoSet, szData));
list->magic = SETUP_DEV_INFO_SET_MAGIC;
list->magic = SETUP_DEVICE_INFO_SET_MAGIC;
memcpy(
&list->ClassGuid,
ClassGuid ? ClassGuid : &GUID_NULL,
@ -266,7 +266,7 @@ SetupDiEnumDeviceInfo(
{
struct DeviceInfoSet *list = (struct DeviceInfoSet *)DeviceInfoSet;
if (list->magic != SETUP_DEV_INFO_SET_MAGIC)
if (list->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -279,7 +279,7 @@ SetupDiEnumDeviceInfo(
SetLastError(ERROR_NO_MORE_ITEMS);
else
{
struct DeviceInfoElement *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfoElement, ListEntry);
struct DeviceInfo *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
memcpy(&DeviceInfoData->ClassGuid,
&DevInfo->ClassGuid,
sizeof(GUID));
@ -798,19 +798,19 @@ done:
BOOL
CreateDeviceInfoElement(
CreateDeviceInfo(
IN struct DeviceInfoSet *list,
IN LPCWSTR InstancePath,
IN LPCGUID pClassGuid,
OUT struct DeviceInfoElement **pDeviceInfo)
OUT struct DeviceInfo **pDeviceInfo)
{
DWORD size;
CONFIGRET cr;
struct DeviceInfoElement *deviceInfo;
struct DeviceInfo *deviceInfo;
*pDeviceInfo = NULL;
size = FIELD_OFFSET(struct DeviceInfoElement, Data) + (strlenW(InstancePath) + 1) * sizeof(WCHAR);
size = FIELD_OFFSET(struct DeviceInfo, Data) + (strlenW(InstancePath) + 1) * sizeof(WCHAR);
deviceInfo = HeapAlloc(GetProcessHeap(), 0, size);
if (!deviceInfo)
{
@ -826,6 +826,7 @@ CreateDeviceInfoElement(
return FALSE;
}
deviceInfo->set = list;
deviceInfo->InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
strcpyW(deviceInfo->Data, InstancePath);
deviceInfo->DeviceName = deviceInfo->Data;
@ -850,7 +851,7 @@ DestroyClassInstallParams(struct ClassInstallParams* installParams)
}
static BOOL
DestroyDeviceInfoElement(struct DeviceInfoElement* deviceInfo)
DestroyDeviceInfo(struct DeviceInfo *deviceInfo)
{
PLIST_ENTRY ListEntry;
struct DriverInfoElement *driverInfo;
@ -878,13 +879,13 @@ static BOOL
DestroyDeviceInfoSet(struct DeviceInfoSet* list)
{
PLIST_ENTRY ListEntry;
struct DeviceInfoElement *deviceInfo;
struct DeviceInfo *deviceInfo;
while (!IsListEmpty(&list->ListHead))
{
ListEntry = RemoveHeadList(&list->ListHead);
deviceInfo = CONTAINING_RECORD(ListEntry, struct DeviceInfoElement, ListEntry);
if (!DestroyDeviceInfoElement(deviceInfo))
deviceInfo = CONTAINING_RECORD(ListEntry, struct DeviceInfo, ListEntry);
if (!DestroyDeviceInfo(deviceInfo))
return FALSE;
}
if (list->HKLM != HKEY_LOCAL_MACHINE)
@ -908,7 +909,7 @@ SetupDiDestroyDeviceInfoList(
{
struct DeviceInfoSet *list = (struct DeviceInfoSet *)DeviceInfoSet;
if (list->magic == SETUP_DEV_INFO_SET_MAGIC)
if (list->magic == SETUP_DEVICE_INFO_SET_MAGIC)
ret = DestroyDeviceInfoSet(list);
else
SetLastError(ERROR_INVALID_HANDLE);
@ -1030,7 +1031,7 @@ SetupDiGetDeviceRegistryPropertyW(
if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoData)
SetLastError(ERROR_INVALID_PARAMETER);
@ -1041,7 +1042,7 @@ SetupDiGetDeviceRegistryPropertyW(
else
{
struct DeviceInfoSet *list = (struct DeviceInfoSet *)DeviceInfoSet;
struct DeviceInfoElement *DevInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *DevInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
switch (Property)
{
@ -1242,7 +1243,7 @@ SetupDiSetDeviceRegistryPropertyW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoData)
SetLastError(ERROR_INVALID_HANDLE);
@ -1383,7 +1384,7 @@ SetupDiCallClassInstaller(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->HKLM != HKEY_LOCAL_MACHINE)
SetLastError(ERROR_INVALID_HANDLE);
@ -1737,7 +1738,7 @@ SetupDiGetDeviceInfoListClass(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (IsEqualIID(&list->ClassGuid, &GUID_NULL))
SetLastError(ERROR_NO_ASSOCIATED_CLASS);
@ -1767,7 +1768,7 @@ SetupDiGetDeviceInfoListDetailW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoListDetailData)
SetLastError(ERROR_INVALID_PARAMETER);
@ -1851,7 +1852,7 @@ SetupDiGetDeviceInstallParamsW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -1864,7 +1865,7 @@ SetupDiGetDeviceInstallParamsW(
PSP_DEVINSTALL_PARAMS_W Source;
if (DeviceInfoData)
Source = &((struct DeviceInfoElement *)DeviceInfoData->Reserved)->InstallParams;
Source = &((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams;
else
Source = &list->InstallParams;
memcpy(DeviceInstallParams, Source, Source->cbSize);
@ -1947,7 +1948,7 @@ SetupDiSetDeviceInstallParamsW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -1960,7 +1961,7 @@ SetupDiSetDeviceInstallParamsW(
PSP_DEVINSTALL_PARAMS_W Destination;
if (DeviceInfoData)
Destination = &((struct DeviceInfoElement *)DeviceInfoData->Reserved)->InstallParams;
Destination = &((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams;
else
Destination = &list->InstallParams;
memcpy(Destination, DeviceInstallParams, DeviceInstallParams->cbSize);
@ -2036,7 +2037,7 @@ SetupDiGetDeviceInstanceIdW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoData)
SetLastError(ERROR_INVALID_PARAMETER);
@ -2048,7 +2049,7 @@ SetupDiGetDeviceInstanceIdW(
SetLastError(ERROR_INVALID_PARAMETER);
else
{
struct DeviceInfoElement *DevInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *DevInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
DWORD required;
required = (strlenW(DevInfo->DeviceName) + 1) * sizeof(WCHAR);
@ -2183,7 +2184,7 @@ SetupDiCreateDevRegKeyW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoData)
SetLastError(ERROR_INVALID_PARAMETER);
@ -2223,7 +2224,7 @@ SetupDiCreateDevRegKeyW(
if (KeyType == DIREG_DEV)
{
struct DeviceInfoElement *deviceInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
rc = RegCreateKeyExW(
RootKey,
@ -2384,7 +2385,7 @@ SetupDiOpenDevRegKey(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoData)
SetLastError(ERROR_INVALID_PARAMETER);
@ -2396,7 +2397,7 @@ SetupDiOpenDevRegKey(
SetLastError(ERROR_INVALID_PARAMETER);
else
{
struct DeviceInfoElement *deviceInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
LPWSTR DriverKey = NULL;
DWORD dwLength = 0;
DWORD dwRegType;
@ -2577,7 +2578,7 @@ SetupDiCreateDeviceInfoW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!ClassGuid)
SetLastError(ERROR_INVALID_PARAMETER);
@ -2620,9 +2621,9 @@ SetupDiCreateDeviceInfoW(
}
else if (GetLastError() == ERROR_FILE_NOT_FOUND)
{
struct DeviceInfoElement *deviceInfo;
struct DeviceInfo *deviceInfo;
if (CreateDeviceInfoElement(list, DeviceName, ClassGuid, &deviceInfo))
if (CreateDeviceInfo(list, DeviceName, ClassGuid, &deviceInfo))
{
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
@ -2722,7 +2723,7 @@ SetupDiOpenDeviceInfoW(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInstanceId)
SetLastError(ERROR_INVALID_PARAMETER);
@ -2735,7 +2736,7 @@ SetupDiOpenDeviceInfoW(
SetLastError(ERROR_INVALID_USER_BUFFER);
else
{
struct DeviceInfoElement *deviceInfo = NULL;
struct DeviceInfo *deviceInfo = NULL;
/* Search if device already exists in DeviceInfoSet.
* If yes, return the existing element
* If no, create a new element using information in registry
@ -2803,7 +2804,7 @@ SetupDiOpenDeviceInfoW(
UuidFromStringW(&szClassGuid[1], &ClassGUID);
}
if (!CreateDeviceInfoElement(list, DeviceInstanceId, &ClassGUID, &deviceInfo))
if (!CreateDeviceInfo(list, DeviceInstanceId, &ClassGUID, &deviceInfo))
goto cleanup;
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
@ -2841,7 +2842,7 @@ SetupDiGetSelectedDevice(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (list->SelectedDevice == NULL)
SetLastError(ERROR_NO_DEVICE_SELECTED);
@ -2879,7 +2880,7 @@ SetupDiSetSelectedDevice(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoData)
SetLastError(ERROR_INVALID_PARAMETER);
@ -2889,7 +2890,7 @@ SetupDiSetSelectedDevice(
SetLastError(ERROR_INVALID_USER_BUFFER);
else
{
list->SelectedDevice = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
list->SelectedDevice = (struct DeviceInfo *)DeviceInfoData->Reserved;
ret = TRUE;
}
@ -2955,7 +2956,7 @@ ResetDevice(
{
#ifndef __WINESRC__
PLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData;
struct DeviceInfoElement *deviceInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
NTSTATUS Status;
if (((struct DeviceInfoSet *)DeviceInfoSet)->HKLM != HKEY_LOCAL_MACHINE)
@ -3003,7 +3004,7 @@ SetupDiChangeState(
if (!DeviceInfoData)
PropChange = ((struct DeviceInfoSet *)DeviceInfoSet)->ClassInstallParams.PropChangeParams;
else
PropChange = ((struct DeviceInfoElement *)DeviceInfoData->Reserved)->ClassInstallParams.PropChangeParams;
PropChange = ((struct DeviceInfo *)DeviceInfoData->Reserved)->ClassInstallParams.PropChangeParams;
if (!PropChange)
{
SetLastError(ERROR_INVALID_PARAMETER);
@ -3125,7 +3126,7 @@ SetupDiRegisterCoDeviceInstallers(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoData)
SetLastError(ERROR_INVALID_PARAMETER);
@ -3290,7 +3291,7 @@ SetupDiInstallDevice(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);

View file

@ -737,7 +737,7 @@ SetupDiBuildDriverInfoList(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (list->HKLM != HKEY_LOCAL_MACHINE)
SetLastError(ERROR_INVALID_HANDLE);
@ -759,7 +759,7 @@ SetupDiBuildDriverInfoList(
if (DeviceInfoData)
{
struct DeviceInfoElement *devInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
if (!(devInfo->CreationFlags & DICD_INHERIT_CLASSDRVS))
pDriverListHead = &devInfo->DriverListHead;
}
@ -789,7 +789,7 @@ SetupDiBuildDriverInfoList(
WCHAR InfFileName[MAX_PATH];
WCHAR InfFileSection[MAX_PATH];
ULONG RequiredSize;
struct DeviceInfoElement *devInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
struct DeviceInfo *devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
struct InfFileDetails *infFileDetails = NULL;
FILETIME DriverDate;
LONG rc;
@ -1217,7 +1217,7 @@ SetupDiDestroyDriverInfoList(
if (!DeviceInfoSet)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DriverType != SPDIT_CLASSDRIVER && DriverType != SPDIT_COMPATDRIVER)
SetLastError(ERROR_INVALID_PARAMETER);
@ -1255,12 +1255,12 @@ SetupDiDestroyDriverInfoList(
else
{
SP_DEVINSTALL_PARAMS_W InstallParamsSet;
struct DeviceInfoElement *deviceInfo;
struct DeviceInfo *deviceInfo;
InstallParamsSet.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
if (!SetupDiGetDeviceInstallParamsW(DeviceInfoSet, NULL, &InstallParamsSet))
goto done;
deviceInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
while (!IsListEmpty(&deviceInfo->DriverListHead))
{
ListEntry = RemoveHeadList(&deviceInfo->DriverListHead);
@ -1369,7 +1369,7 @@ SetupDiEnumDriverInfoW(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DriverType != SPDIT_CLASSDRIVER && DriverType != SPDIT_COMPATDRIVER)
SetLastError(ERROR_INVALID_PARAMETER);
@ -1379,10 +1379,10 @@ SetupDiEnumDriverInfoW(
SetLastError(ERROR_INVALID_USER_BUFFER);
else
{
struct DeviceInfoElement *devInfo = NULL;
struct DeviceInfo *devInfo = NULL;
PLIST_ENTRY ItemList;
if (DeviceInfoData)
devInfo = (struct DeviceInfoElement *)DeviceInfoData->Reserved;
devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
if (!devInfo || (devInfo->CreationFlags & DICD_INHERIT_CLASSDRVS))
{
ListHead = &((struct DeviceInfoSet *)DeviceInfoSet)->DriverListHead;
@ -1489,7 +1489,7 @@ SetupDiGetSelectedDriverW(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -1600,7 +1600,7 @@ SetupDiSetSelectedDriverW(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -1613,8 +1613,8 @@ SetupDiSetSelectedDriverW(
if (DeviceInfoData)
{
pDriverInfo = (struct DriverInfoElement **)&((struct DeviceInfoElement *)DeviceInfoData->Reserved)->InstallParams.Reserved;
ListHead = &((struct DeviceInfoElement *)DeviceInfoData->Reserved)->DriverListHead;
pDriverInfo = (struct DriverInfoElement **)&((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams.Reserved;
ListHead = &((struct DeviceInfo *)DeviceInfoData->Reserved)->DriverListHead;
}
else
{
@ -1893,7 +1893,7 @@ SetupDiGetDriverInfoDetailW(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -2016,7 +2016,7 @@ SetupDiGetDriverInstallParamsW(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -2102,11 +2102,11 @@ SetupDiInstallDriverFiles(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
else if (DeviceInfoData && ((struct DeviceInfoElement *)DeviceInfoData->Reserved)->InstallParams.Reserved == 0)
else if (DeviceInfoData && ((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams.Reserved == 0)
SetLastError(ERROR_NO_DRIVER_SELECTED);
else if (!DeviceInfoData && ((struct DeviceInfoSet *)DeviceInfoSet)->InstallParams.Reserved == 0)
SetLastError(ERROR_NO_DRIVER_SELECTED);

View file

@ -1878,7 +1878,7 @@ BOOL WINAPI SetupInstallServicesFromInfSectionExW( HINF hinf, PCWSTR sectionname
}
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoSet && (list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (DeviceInfoSet && (list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);

View file

@ -34,7 +34,7 @@ static const WCHAR SymbolicLink[] = {'S','y','m','b','o','l','i','c','L','i','n
static BOOL
CreateDeviceInterface(
IN struct DeviceInfoElement* deviceInfo,
IN struct DeviceInfo* deviceInfo,
IN LPCWSTR SymbolicLink,
IN LPCGUID pInterfaceGuid,
OUT struct DeviceInterface **pDeviceInterface)
@ -89,7 +89,7 @@ SETUP_CreateInterfaceList(
DWORD dwRegType;
DWORD LinkedValue;
GUID ClassGuid;
struct DeviceInfoElement *deviceInfo;
struct DeviceInfo *deviceInfo;
hInterfaceKey = INVALID_HANDLE_VALUE;
hDeviceInstanceKey = NULL;
@ -223,7 +223,7 @@ SETUP_CreateInterfaceList(
/* We have found a device */
/* Step 1. Create a device info element */
if (!CreateDeviceInfoElement(list, InstancePath, &ClassGuid, &deviceInfo))
if (!CreateDeviceInfo(list, InstancePath, &ClassGuid, &deviceInfo))
{
rc = GetLastError();
goto cleanup;
@ -314,15 +314,15 @@ SetupDiEnumDeviceInterfaces(
{
struct DeviceInfoSet *list = (struct DeviceInfoSet *)DeviceInfoSet;
if (list->magic == SETUP_DEV_INFO_SET_MAGIC)
if (list->magic == SETUP_DEVICE_INFO_SET_MAGIC)
{
PLIST_ENTRY ItemList = list->ListHead.Flink;
BOOL Found = FALSE;
while (ItemList != &list->ListHead && !Found)
{
PLIST_ENTRY InterfaceListEntry;
struct DeviceInfoElement *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfoElement, ListEntry);
if (DeviceInfoData && (struct DeviceInfoElement *)DeviceInfoData->Reserved != DevInfo)
struct DeviceInfo *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
if (DeviceInfoData && (struct DeviceInfo *)DeviceInfoData->Reserved != DevInfo)
{
/* We are not searching for this element */
ItemList = ItemList->Flink;
@ -386,7 +386,7 @@ SetupDiGetDeviceInterfaceDetailW(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA))
SetLastError(ERROR_INVALID_USER_BUFFER);
@ -579,7 +579,7 @@ SetupDiInstallDeviceInterfaces(
SetLastError(ERROR_INVALID_PARAMETER);
else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
SetLastError(ERROR_INVALID_HANDLE);
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEV_INFO_SET_MAGIC)
else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (!DeviceInfoData)
SetLastError(ERROR_INVALID_PARAMETER);

View file

@ -50,15 +50,15 @@
#undef __WINESRC__
#endif
#define SETUP_DEV_INFO_SET_MAGIC 0xd00ff057
#define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff057
#define SETUP_CLASS_IMAGE_LIST_MAGIC 0xd00ff058
struct DeviceInterface /* Element of DeviceInfoElement.InterfaceListHead */
struct DeviceInterface /* Element of DeviceInfo.InterfaceListHead */
{
LIST_ENTRY ListEntry;
/* Link to is parent device */
struct DeviceInfoElement* DeviceInfo;
struct DeviceInfo *DeviceInfo;
GUID InterfaceClassGuid;
@ -68,8 +68,8 @@ struct DeviceInterface /* Element of DeviceInfoElement.InterfaceListHead */
*/
DWORD Flags;
/* Contains the symbolic link of this interface, for example
* \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
/* Contains the symbolic link of this interface, for example
* \\?\ACPI#PNP0501#4&2658d0a0&0#{GUID} */
WCHAR SymbolicLink[ANYSIZE_ARRAY];
};
@ -90,11 +90,11 @@ struct InfFileDetails
* Points into szData at then end of the structure */
PCWSTR FileName;
/* Variable size array (contains data for DirectoryName and FileName) */
/* Variable size array (contains data for DirectoryName and FileName) */
WCHAR szData[ANYSIZE_ARRAY];
};
struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfoElement.DriverListHead */
struct DriverInfoElement /* Element of DeviceInfoSet.DriverListHead and DeviceInfo.DriverListHead */
{
LIST_ENTRY ListEntry;
@ -113,12 +113,15 @@ struct ClassInstallParams
PSP_ADDPROPERTYPAGE_DATA AddPropertyPageData;
};
struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */
struct DeviceInfo /* Element of DeviceInfoSet.ListHead */
{
LIST_ENTRY ListEntry;
/* Used when dealing with CM_* functions */
DEVINST dnDevInst;
/* Link to parent DeviceInfoSet */
struct DeviceInfoSet *set;
/* Reserved Field of SP_DEVINSTALL_PARAMS_W structure
* points to a struct DriverInfoElement */
SP_DEVINSTALL_PARAMS_W InstallParams;
@ -164,13 +167,13 @@ struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */
/* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
struct ClassInstallParams ClassInstallParams;
/* Variable size array (contains data for DeviceName, UniqueId, DeviceDescription) */
/* Variable size array (contains data for DeviceName, UniqueId, DeviceDescription) */
WCHAR Data[ANYSIZE_ARRAY];
};
struct DeviceInfoSet /* HDEVINFO */
{
DWORD magic; /* SETUP_DEV_INFO_SET_MAGIC */
DWORD magic; /* SETUP_DEVICE_INFO_SET_MAGIC */
/* If != GUID_NULL, only devices of this class can be in the device info set */
GUID ClassGuid;
/* Local or distant HKEY_LOCAL_MACHINE registry key */
@ -185,9 +188,9 @@ struct DeviceInfoSet /* HDEVINFO */
* searched/detected, this list is empty) */
LIST_ENTRY DriverListHead;
/* List of struct DeviceInfoElement */
/* List of struct DeviceInfo */
LIST_ENTRY ListHead;
struct DeviceInfoElement *SelectedDevice;
struct DeviceInfo *SelectedDevice;
/* Used by SetupDiGetClassInstallParamsW/SetupDiSetClassInstallParamsW */
struct ClassInstallParams ClassInstallParams;
@ -266,11 +269,11 @@ extern OSVERSIONINFOW OsVersionInfo;
/* devinst.c */
BOOL
CreateDeviceInfoElement(
CreateDeviceInfo(
IN struct DeviceInfoSet *list,
IN LPCWSTR InstancePath,
IN LPCGUID pClassGuid,
OUT struct DeviceInfoElement **pDeviceInfo);
OUT struct DeviceInfo **pDeviceInfo);
/* driver.c */