Alexandre Julliard : setupapi: Fix a structure size check for 64-bit.
Alexandre Julliard
julliard at winehq.org
Fri Aug 28 10:17:39 CDT 2009
Module: wine
Branch: master
Commit: aaf908ab323126f2dac09ddfdd053267591e5c9e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aaf908ab323126f2dac09ddfdd053267591e5c9e
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Aug 27 20:23:40 2009 +0200
setupapi: Fix a structure size check for 64-bit.
---
dlls/setupapi/devinst.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 8a18138..89e3cb6 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -2916,8 +2916,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
{
struct DeviceInfoSet *set = DeviceInfoSet;
struct InterfaceInfo *info;
- DWORD bytesNeeded = offsetof(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath)
- + 1;
+ DWORD bytesNeeded = FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath[1]);
BOOL ret = FALSE;
TRACE("(%p, %p, %p, %d, %p, %p)\n", DeviceInfoSet,
@@ -2937,8 +2936,8 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
- if (DeviceInterfaceDetailData && (DeviceInterfaceDetailData->cbSize !=
- offsetof(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath) + sizeof(char)))
+ if (DeviceInterfaceDetailData &&
+ DeviceInterfaceDetailData->cbSize != sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A))
{
SetLastError(ERROR_INVALID_USER_BUFFER);
return FALSE;
More information about the wine-cvs
mailing list