****** ROS-specific code sync too

[WINESYNC] setupapi: Assign to structs instead of using memcpy.

wine commit id bd0fec2511cc33fe1bbbc311d5c48f83a909a7fc by Andrew Talbot <andrew.talbot@talbotville.com>

SYNC NOTE: Applied to ReactOS-specific code.

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
This commit is contained in:
winesync 2024-01-03 15:51:56 +01:00 committed by Hermès Bélusca-Maïto
parent 0429175fdb
commit 62584a77c0
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
7 changed files with 23 additions and 35 deletions

View file

@ -201,7 +201,7 @@ SETUP_CreateDevicesList(
else
{
TRACE("Using default class GUID_NULL for device %S\n", InstancePath);
memcpy(&ClassGuid, &GUID_NULL, sizeof(GUID));
ClassGuid = GUID_NULL;
}
if (Class && !IsEqualIID(&ClassGuid, Class))

View file

@ -559,7 +559,7 @@ CreateDeviceInfo(
deviceInfo->instanceId = deviceInfo->Data;
deviceInfo->UniqueId = strrchrW(deviceInfo->Data, '\\');
deviceInfo->DeviceDescription = NULL;
memcpy(&deviceInfo->ClassGuid, pClassGuid, sizeof(GUID));
deviceInfo->ClassGuid = *pClassGuid;
deviceInfo->CreationFlags = 0;
InitializeListHead(&deviceInfo->DriverListHead);
InitializeListHead(&deviceInfo->InterfaceListHead);
@ -1299,9 +1299,7 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
ZeroMemory(list, FIELD_OFFSET(struct DeviceInfoSet, szData));
list->magic = SETUP_DEVICE_INFO_SET_MAGIC;
memcpy(&list->ClassGuid,
ClassGuid ? ClassGuid : &GUID_NULL,
sizeof(list->ClassGuid));
list->ClassGuid = (ClassGuid ? *ClassGuid : GUID_NULL);
list->InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
list->InstallParams.Flags |= DI_CLASSINSTALLPARAMS;
list->InstallParams.hwndParent = hwndParent;
@ -1681,7 +1679,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
}
else
{
memcpy(&DeviceInfoData->ClassGuid, ClassGuid, sizeof(GUID));
DeviceInfoData->ClassGuid = *ClassGuid;
DeviceInfoData->DevInst = deviceInfo->dnDevInst;
DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
ret = TRUE;
@ -1815,9 +1813,7 @@ BOOL WINAPI SetupDiEnumDeviceInfo(
else
{
struct DeviceInfo *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
memcpy(&info->ClassGuid,
&DevInfo->ClassGuid,
sizeof(GUID));
info->ClassGuid = DevInfo->ClassGuid;
info->DevInst = DevInfo->dnDevInst;
info->Reserved = (ULONG_PTR)DevInfo;
ret = TRUE;
@ -2444,7 +2440,7 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailA(
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
memcpy(&DevInfoData->ClassGuid, &set->ClassGuid, sizeof(GUID));
DevInfoData->ClassGuid = set->ClassGuid;
DevInfoData->RemoteMachineHandle = set->hMachine;
if (set->MachineName)
{
@ -2485,7 +2481,7 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailW(
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
memcpy(&DevInfoData->ClassGuid, &set->ClassGuid, sizeof(GUID));
DevInfoData->ClassGuid = set->ClassGuid;
DevInfoData->RemoteMachineHandle = set->hMachine;
if (set->MachineName)
strcpyW(DevInfoData->RemoteMachineName, set->MachineName + 2);
@ -2825,9 +2821,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
if (MemberIndex-- == 0)
{
/* return this item */
memcpy(&DeviceInterfaceData->InterfaceClassGuid,
&DevItf->InterfaceClassGuid,
sizeof(GUID));
DeviceInterfaceData->InterfaceClassGuid = DevItf->InterfaceClassGuid;
DeviceInterfaceData->Flags = DevItf->Flags;
DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf;
found = TRUE;
@ -2859,9 +2853,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
if (MemberIndex-- == 0)
{
/* return this item */
memcpy(&DeviceInterfaceData->InterfaceClassGuid,
&DevItf->InterfaceClassGuid,
sizeof(GUID));
DeviceInterfaceData->InterfaceClassGuid = DevItf->InterfaceClassGuid;
DeviceInterfaceData->Flags = DevItf->Flags;
DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf;
found = TRUE;
@ -3076,9 +3068,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
TRACE("DevicePath is %s\n", debugstr_w(DeviceInterfaceDetailData->DevicePath));
if (DeviceInfoData)
{
memcpy(&DeviceInfoData->ClassGuid,
&deviceInterface->DeviceInfo->ClassGuid,
sizeof(GUID));
DeviceInfoData->ClassGuid = deviceInterface->DeviceInfo->ClassGuid;
DeviceInfoData->DevInst = deviceInterface->DeviceInfo->dnDevInst;
DeviceInfoData->Reserved = (ULONG_PTR)deviceInterface->DeviceInfo;
}
@ -4883,7 +4873,7 @@ SetupDiOpenDeviceInfoW(
if (ret && deviceInfo && DeviceInfoData)
{
memcpy(&DeviceInfoData->ClassGuid, &deviceInfo->ClassGuid, sizeof(GUID));
DeviceInfoData->ClassGuid = deviceInfo->ClassGuid;
DeviceInfoData->DevInst = deviceInfo->dnDevInst;
DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
}
@ -4921,9 +4911,7 @@ SetupDiGetSelectedDevice(
SetLastError(ERROR_INVALID_USER_BUFFER);
else
{
memcpy(&DeviceInfoData->ClassGuid,
&list->SelectedDevice->ClassGuid,
sizeof(GUID));
DeviceInfoData->ClassGuid = list->SelectedDevice->ClassGuid;
DeviceInfoData->DevInst = list->SelectedDevice->dnDevInst;
DeviceInfoData->Reserved = (ULONG_PTR)list->SelectedDevice;
ret = TRUE;
@ -5552,7 +5540,7 @@ SetupDiInstallDevice(
/* Write information to driver key */
*pSectionName = UNICODE_NULL;
memcpy(&fullVersion, &SelectedDriver->Info.DriverVersion, sizeof(LARGE_INTEGER));
fullVersion.QuadPart = SelectedDriver->Info.DriverVersion;
TRACE("Write information to driver key\n");
TRACE("DriverDate : '%u-%u-%u'\n", DriverDate.wMonth, DriverDate.wDay, DriverDate.wYear);
TRACE("DriverDesc : '%s'\n", debugstr_w(SelectedDriver->Info.Description));

View file

@ -179,7 +179,7 @@ AddKnownDriverToList(
driverInfo->Params.Rank = Rank;
memcpy(&driverInfo->DriverDate, &DriverDate, sizeof(FILETIME));
memcpy(&driverInfo->ClassGuid, ClassGuid, sizeof(GUID));
driverInfo->ClassGuid = *ClassGuid;
driverInfo->Info.DriverType = DriverType;
driverInfo->Info.Reserved = (ULONG_PTR)driverInfo;
lstrcpynW(driverInfo->Info.Description, driverInfo->Details.DrvDescription, LINE_LEN - 1);
@ -444,9 +444,9 @@ GetVersionInformationFromInfFile(
Build = atoiW(pBuild);
}
Major = atoiW(pVersion);
fullVersion.u.HighPart = Major << 16 | Minor;
fullVersion.u.LowPart = Revision << 16 | Build;
memcpy(DriverVersion, &fullVersion, sizeof(LARGE_INTEGER));
fullVersion.HighPart = Major << 16 | Minor;
fullVersion.LowPart = Revision << 16 | Build;
DriverVersion = fullVersion.QuadPart;
}
ret = TRUE;
@ -1661,7 +1661,7 @@ SetupDiSetSelectedDriverW(
TRACE("Choosing driver whose rank is 0x%lx\n",
(*pDriverInfo)->Params.Rank);
if (DeviceInfoData)
memcpy(&DeviceInfoData->ClassGuid, &(*pDriverInfo)->ClassGuid, sizeof(GUID));
DeviceInfoData->ClassGuid = (*pDriverInfo)->ClassGuid;
}
}
}

View file

@ -51,7 +51,7 @@ CreateDeviceInterface(
deviceInterface->DeviceInfo = deviceInfo;
strcpyW(deviceInterface->SymbolicLink, SymbolicLink);
deviceInterface->Flags = 0; /* Flags will be updated later */
memcpy(&deviceInterface->InterfaceClassGuid, pInterfaceGuid, sizeof(GUID));
deviceInterface->InterfaceClassGuid = *pInterfaceGuid;
*pDeviceInterface = deviceInterface;
return TRUE;
@ -363,7 +363,7 @@ InstallOneInterface(
return FALSE;
}
memcpy(&DeviceInterfaceData.InterfaceClassGuid, &DevItf->InterfaceClassGuid, sizeof(GUID));
DeviceInterfaceData.InterfaceClassGuid = DevItf->InterfaceClassGuid;
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
DeviceInterfaceData.Flags = DevItf->Flags;
DeviceInterfaceData.Reserved = (ULONG_PTR)DevItf;

View file

@ -526,7 +526,7 @@ BOOL WINAPI FileExists(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFileFindData)
FindClose(hFind);
if (lpFileFindData)
memcpy(lpFileFindData, &FindData, sizeof(WIN32_FIND_DATAW));
*lpFileFindData = FindData;
SetErrorMode(uErrorMode);

View file

@ -1210,7 +1210,7 @@ PARSER_GetInfClassW(
SetLastError(ERROR_INSUFFICIENT_BUFFER);
goto cleanup;
}
memcpy(ClassGuid, &GUID_NULL, sizeof(GUID));
*ClassGuid = GUID_NULL;
*ClassName = UNICODE_NULL;
}
}

View file

@ -5,4 +5,4 @@ files:
dlls/setupapi/misc.c: dll/win32/setupapi/misc.c
dlls/setupapi/stubs.c: dll/win32/setupapi/stubs.c
tags:
wine: ba8642639aa8f682c0b6441b6636d2322c204206
wine: bd0fec2511cc33fe1bbbc311d5c48f83a909a7fc