From 038f69124f31707e04da5b68d65d46fec5b89796 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Wed, 19 Sep 2007 17:46:58 -0700 Subject: [PATCH] Implement SetupDiEnumDeviceInfo --- dlls/setupapi/devinst.c | 31 +++++++++++++++++++++++++++---- 1 files changed, 27 insertions(+), 4 deletions(-) diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 414aa18..d1e9642 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -769,15 +769,38 @@ BOOL WINAPI SetupDiEnumDeviceInfo( DWORD index, PSP_DEVINFO_DATA info) { - FIXME("%p %d %p\n", devinfo, index, info); + BOOL ret = FALSE; + + TRACE("%p %d %p\n", devinfo, index, info); if(info==NULL) return FALSE; if(info->cbSize < sizeof(*info)) return FALSE; - - SetLastError(ERROR_NO_MORE_ITEMS); - return FALSE; + if (devinfo && devinfo != (HDEVINFO)INVALID_HANDLE_VALUE) + { + struct DeviceInfoSet *list = (struct DeviceInfoSet *)devinfo; + if (list->magic == SETUP_DEVICE_INFO_SET_MAGIC) + { + if (index < list->cDevices) + { + if (info->cbSize == sizeof(SP_DEVINFO_DATA)) + { + memcpy(info, &list->devices[index], info->cbSize); + ret = TRUE; + } + else + SetLastError(ERROR_INVALID_USER_BUFFER); + } + else + SetLastError(ERROR_NO_MORE_ITEMS); + } + else + SetLastError(ERROR_INVALID_HANDLE); + } + else + SetLastError(ERROR_INVALID_HANDLE); + return ret; } /*********************************************************************** -- 1.4.1