setupapi: Assign to structs instead of using memcpy.
This commit is contained in:
parent
038169b6a7
commit
bd0fec2511
|
@ -352,13 +352,11 @@ static BOOL SETUPDI_AddInterfaceInstance(PSP_DEVINFO_DATA DeviceInfoData,
|
||||||
iface->cInstances++;
|
iface->cInstances++;
|
||||||
instance->cbSize =
|
instance->cbSize =
|
||||||
sizeof(SP_DEVICE_INTERFACE_DATA);
|
sizeof(SP_DEVICE_INTERFACE_DATA);
|
||||||
memcpy(&instance->InterfaceClassGuid,
|
instance->InterfaceClassGuid = *InterfaceClassGuid;
|
||||||
InterfaceClassGuid, sizeof(GUID));
|
|
||||||
instance->Flags = SPINT_ACTIVE; /* FIXME */
|
instance->Flags = SPINT_ACTIVE; /* FIXME */
|
||||||
instance->Reserved = (ULONG_PTR)ifaceInfo;
|
instance->Reserved = (ULONG_PTR)ifaceInfo;
|
||||||
if (newInterface)
|
if (newInterface)
|
||||||
memcpy(&iface->guid, InterfaceClassGuid,
|
iface->guid = *InterfaceClassGuid;
|
||||||
sizeof(GUID));
|
|
||||||
key = SetupDiCreateDeviceInterfaceRegKeyW(devInfo->set,
|
key = SetupDiCreateDeviceInterfaceRegKeyW(devInfo->set,
|
||||||
instance, 0, KEY_WRITE, NULL, NULL);
|
instance, 0, KEY_WRITE, NULL, NULL);
|
||||||
if (key != INVALID_HANDLE_VALUE)
|
if (key != INVALID_HANDLE_VALUE)
|
||||||
|
@ -555,7 +553,7 @@ static BOOL SETUPDI_AddDeviceToSet(struct DeviceInfoSet *set,
|
||||||
SP_DEVINFO_DATA *DeviceInfoData = &set->devices[set->cDevices++];
|
SP_DEVINFO_DATA *DeviceInfoData = &set->devices[set->cDevices++];
|
||||||
|
|
||||||
DeviceInfoData->cbSize = sizeof(SP_DEVINFO_DATA);
|
DeviceInfoData->cbSize = sizeof(SP_DEVINFO_DATA);
|
||||||
memcpy(&DeviceInfoData->ClassGuid, guid, sizeof(GUID));
|
DeviceInfoData->ClassGuid = *guid;
|
||||||
DeviceInfoData->DevInst = devInfo->devId;
|
DeviceInfoData->DevInst = devInfo->devId;
|
||||||
DeviceInfoData->Reserved = (ULONG_PTR)devInfo;
|
DeviceInfoData->Reserved = (ULONG_PTR)devInfo;
|
||||||
SETUPDI_GuidToString(guid, classGuidStr);
|
SETUPDI_GuidToString(guid, classGuidStr);
|
||||||
|
@ -1498,7 +1496,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
memcpy(DeviceInfoData, dev, sizeof(SP_DEVINFO_DATA));
|
*DeviceInfoData = *dev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2383,7 +2381,7 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailA(
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
memcpy(&DevInfoData->ClassGuid, &set->ClassGuid, sizeof(GUID));
|
DevInfoData->ClassGuid = set->ClassGuid;
|
||||||
DevInfoData->RemoteMachineHandle = NULL;
|
DevInfoData->RemoteMachineHandle = NULL;
|
||||||
DevInfoData->RemoteMachineName[0] = '\0';
|
DevInfoData->RemoteMachineName[0] = '\0';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2416,7 +2414,7 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailW(
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
memcpy(&DevInfoData->ClassGuid, &set->ClassGuid, sizeof(GUID));
|
DevInfoData->ClassGuid = set->ClassGuid;
|
||||||
DevInfoData->RemoteMachineHandle = NULL;
|
DevInfoData->RemoteMachineHandle = NULL;
|
||||||
DevInfoData->RemoteMachineName[0] = '\0';
|
DevInfoData->RemoteMachineName[0] = '\0';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2513,7 +2511,7 @@ BOOL WINAPI SetupDiCreateDeviceInterfaceW(
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
memcpy(DeviceInterfaceData, iface, sizeof(*iface));
|
*DeviceInterfaceData = *iface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2770,8 +2768,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
|
||||||
if ((ret = SETUPDI_FindInterface(devInfo, InterfaceClassGuid, &iface)))
|
if ((ret = SETUPDI_FindInterface(devInfo, InterfaceClassGuid, &iface)))
|
||||||
{
|
{
|
||||||
if (MemberIndex < iface->cInstances)
|
if (MemberIndex < iface->cInstances)
|
||||||
memcpy(DeviceInterfaceData, &iface->instances[MemberIndex],
|
*DeviceInterfaceData = iface->instances[MemberIndex];
|
||||||
sizeof(SP_DEVICE_INTERFACE_DATA));
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NO_MORE_ITEMS);
|
SetLastError(ERROR_NO_MORE_ITEMS);
|
||||||
|
@ -2801,9 +2798,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
|
||||||
{
|
{
|
||||||
DWORD instanceIndex = MemberIndex - cEnumerated;
|
DWORD instanceIndex = MemberIndex - cEnumerated;
|
||||||
|
|
||||||
memcpy(DeviceInterfaceData,
|
*DeviceInterfaceData = iface->instances[instanceIndex];
|
||||||
&iface->instances[instanceIndex],
|
|
||||||
sizeof(SP_DEVICE_INTERFACE_DATA));
|
|
||||||
cEnumerated += instanceIndex + 1;
|
cEnumerated += instanceIndex + 1;
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
@ -2916,7 +2911,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
|
||||||
else
|
else
|
||||||
DeviceInterfaceDetailData->DevicePath[0] = '\0';
|
DeviceInterfaceDetailData->DevicePath[0] = '\0';
|
||||||
if (DeviceInfoData && DeviceInfoData->cbSize == sizeof(SP_DEVINFO_DATA))
|
if (DeviceInfoData && DeviceInfoData->cbSize == sizeof(SP_DEVINFO_DATA))
|
||||||
memcpy(DeviceInfoData, info->device, sizeof(SP_DEVINFO_DATA));
|
*DeviceInfoData = *info->device;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2984,7 +2979,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
||||||
else
|
else
|
||||||
DeviceInterfaceDetailData->DevicePath[0] = '\0';
|
DeviceInterfaceDetailData->DevicePath[0] = '\0';
|
||||||
if (DeviceInfoData && DeviceInfoData->cbSize == sizeof(SP_DEVINFO_DATA))
|
if (DeviceInfoData && DeviceInfoData->cbSize == sizeof(SP_DEVINFO_DATA))
|
||||||
memcpy(DeviceInfoData, info->device, sizeof(SP_DEVINFO_DATA));
|
*DeviceInfoData = *info->device;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -511,7 +511,7 @@ BOOL WINAPI FileExists(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFileFindData)
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
|
|
||||||
if (lpFileFindData)
|
if (lpFileFindData)
|
||||||
memcpy(lpFileFindData, &FindData, sizeof(WIN32_FIND_DATAW));
|
*lpFileFindData = FindData;
|
||||||
|
|
||||||
SetErrorMode(uErrorMode);
|
SetErrorMode(uErrorMode);
|
||||||
|
|
||||||
|
|
|
@ -476,7 +476,7 @@ RETERR16 WINAPI CtlSetLdd16(LPLOGDISKDESC pldd)
|
||||||
HeapFree(heap, 0, pCurrLDD->pszDiskName);
|
HeapFree(heap, 0, pCurrLDD->pszDiskName);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pCurrLDD, pldd, sizeof(LOGDISKDESC_S));
|
*pCurrLDD = *pldd;
|
||||||
|
|
||||||
if (pldd->pszPath)
|
if (pldd->pszPath)
|
||||||
{
|
{
|
||||||
|
|
|
@ -250,10 +250,10 @@ static RETERR16 VCP_VirtnodeCreate(const VCPFILESPEC *vfsSrc, const VCPFILESPEC
|
||||||
lpvn->cbSize = sizeof(VIRTNODE);
|
lpvn->cbSize = sizeof(VIRTNODE);
|
||||||
|
|
||||||
if (vfsSrc)
|
if (vfsSrc)
|
||||||
memcpy(&lpvn->vfsSrc, vfsSrc, sizeof(VCPFILESPEC));
|
lpvn->vfsSrc = *vfsSrc;
|
||||||
|
|
||||||
if (vfsDst)
|
if (vfsDst)
|
||||||
memcpy(&lpvn->vfsDst, vfsDst, sizeof(VCPFILESPEC));
|
lpvn->vfsDst = *vfsDst;
|
||||||
|
|
||||||
lpvn->fl = fl;
|
lpvn->fl = fl;
|
||||||
lpvn->lParam = lParam;
|
lpvn->lParam = lParam;
|
||||||
|
|
Loading…
Reference in New Issue