Author: gedmurphy Date: Mon Oct 2 22:14:58 2006 New Revision: 24364
URL: http://svn.reactos.org/svn/reactos?rev=24364&view=rev Log: - Only call SetupDiGetClassDevs once for each class, this makes load time 3 times faster although I'm still not happy with it. We may have to enumerate the drivers in the background. - use UINT for 1 bit flags, reduce the width a little and check the menu.
Modified: trunk/reactos/base/applications/devmgmt/En.rc trunk/reactos/base/applications/devmgmt/enumdevices.c trunk/reactos/base/applications/devmgmt/mainwnd.c trunk/reactos/base/applications/devmgmt/precomp.h trunk/reactos/base/applications/devmgmt/resource.h
Modified: trunk/reactos/base/applications/devmgmt/En.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/E... ============================================================================== --- trunk/reactos/base/applications/devmgmt/En.rc (original) +++ trunk/reactos/base/applications/devmgmt/En.rc Mon Oct 2 22:14:58 2006 @@ -14,7 +14,7 @@ END POPUP "View" BEGIN - MENUITEM "Devices by type", IDC_STATIC + MENUITEM "Devices by type", IDC_DEVBYTYPE, CHECKED MENUITEM "Devices by connection", IDC_STATIC, GRAYED MENUITEM "Resources by type", IDC_STATIC, GRAYED MENUITEM "Resources by connection", IDC_STATIC, GRAYED
Modified: trunk/reactos/base/applications/devmgmt/enumdevices.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/e... ============================================================================== --- trunk/reactos/base/applications/devmgmt/enumdevices.c (original) +++ trunk/reactos/base/applications/devmgmt/enumdevices.c Mon Oct 2 22:14:58 2006 @@ -9,8 +9,9 @@
#include "precomp.h"
-SP_CLASSIMAGELIST_DATA ImageListData; - + +static SP_CLASSIMAGELIST_DATA ImageListData; +static HDEVINFO hDevInfo;
static HTREEITEM InsertIntoTreeView(HWND hTV, @@ -60,7 +61,10 @@ { /* all classes enumerated */ if(Ret == CR_NO_SUCH_VALUE) + { + hDevInfo = NULL; return -1; + }
if (Ret == CR_INVALID_DATA) ; /*FIXME: what should we do here? */ @@ -84,18 +88,23 @@ &ClassGuid, ClassImage)) { - /* set the blank icon */ + /* FIXME: can we do this? + * Set the blank icon: IDI_SETUPAPI_BLANK = 41 + * it'll be image 24 in the imagelist */ *ClassImage = 41; }
- /* FIXME: do we need this? + /* Get device info for all devices of a particular class */ hDevInfo = SetupDiGetClassDevs(&ClassGuid, 0, NULL, DIGCF_PRESENT); if (hDevInfo == INVALID_HANDLE_VALUE) + { + hDevInfo = NULL; return 0; - */ + } +
KeyClass = SetupDiOpenClassRegKeyEx(&ClassGuid, MAXIMUM_ALLOWED, @@ -120,9 +129,6 @@ return -3; }
- /* FIXME: see above? - SetupDiDestroyDeviceInfoList(hDevInfo); */ - *DevPresent = TRUE;
RegCloseKey(KeyClass); @@ -136,7 +142,6 @@ TCHAR* DeviceClassName, TCHAR* DeviceName) { - HDEVINFO hDevInfo; SP_DEVINFO_DATA DeviceInfoData; DWORD RequiredSize = 0; GUID *guids = NULL; @@ -172,13 +177,6 @@ } }
-//TimerInfo(_T("IN")); - /* get device info set for our device class */ - hDevInfo = SetupDiGetClassDevs(guids, - 0, - NULL, - DIGCF_PRESENT); -//TimerInfo(_T("OUT")); HeapFree(GetProcessHeap(), 0, guids); if(hDevInfo == INVALID_HANDLE_VALUE) { @@ -198,8 +196,7 @@
if (!bRet) { - //no such device: - SetupDiDestroyDeviceInfoList(hDevInfo); + /* no such device */ return -1; }
@@ -223,7 +220,6 @@ if (!bRet) { /* if the description fails, just give up! */ - SetupDiDestroyDeviceInfoList(hDevInfo); return -5; } } @@ -289,6 +285,13 @@
} while (Ret != -1);
+ /* kill InfoList initialized in EnumDeviceClasses */ + if (hDevInfo) + { + SetupDiDestroyDeviceInfoList(hDevInfo); + hDevInfo = NULL; + } + if (!TreeView_GetChild(Info->hTreeView, hDevItem)) {
Modified: trunk/reactos/base/applications/devmgmt/mainwnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/m... ============================================================================== --- trunk/reactos/base/applications/devmgmt/mainwnd.c (original) +++ trunk/reactos/base/applications/devmgmt/mainwnd.c Mon Oct 2 22:14:58 2006 @@ -546,7 +546,7 @@ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CW_USEDEFAULT, CW_USEDEFAULT, - 650, + 600, 450, NULL, NULL,
Modified: trunk/reactos/base/applications/devmgmt/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/p... ============================================================================== --- trunk/reactos/base/applications/devmgmt/precomp.h (original) +++ trunk/reactos/base/applications/devmgmt/precomp.h Mon Oct 2 22:14:58 2006 @@ -28,7 +28,7 @@ int nCmdShow;
/* status flags */ - BOOL InMenuLoop : 1; + UINT InMenuLoop : 1;
} MAIN_WND_INFO, *PMAIN_WND_INFO;
Modified: trunk/reactos/base/applications/devmgmt/resource.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/r... ============================================================================== --- trunk/reactos/base/applications/devmgmt/resource.h (original) +++ trunk/reactos/base/applications/devmgmt/resource.h Mon Oct 2 22:14:58 2006 @@ -19,6 +19,7 @@ /* menus */ #define IDR_MAINMENU 102 #define IDR_POPUP 103 +#define IDC_DEVBYTYPE 104
/* tooltips */ #define IDS_TOOLTIP_PROP 6000