mirror of
https://github.com/reactos/reactos.git
synced 2024-07-13 16:15:05 +00:00
- 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. svn path=/trunk/; revision=24364
This commit is contained in:
parent
04c5f92621
commit
4cfbdb6f63
|
@ -14,7 +14,7 @@ BEGIN
|
|||
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
|
||||
|
|
|
@ -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 @@ EnumDeviceClasses(INT ClassIndex,
|
|||
{
|
||||
/* 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 @@ EnumDeviceClasses(INT ClassIndex,
|
|||
&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 @@ EnumDeviceClasses(INT ClassIndex,
|
|||
return -3;
|
||||
}
|
||||
|
||||
/* FIXME: see above?
|
||||
SetupDiDestroyDeviceInfoList(hDevInfo); */
|
||||
|
||||
*DevPresent = TRUE;
|
||||
|
||||
RegCloseKey(KeyClass);
|
||||
|
@ -136,7 +142,6 @@ EnumDevices(INT index,
|
|||
TCHAR* DeviceClassName,
|
||||
TCHAR* DeviceName)
|
||||
{
|
||||
HDEVINFO hDevInfo;
|
||||
SP_DEVINFO_DATA DeviceInfoData;
|
||||
DWORD RequiredSize = 0;
|
||||
GUID *guids = NULL;
|
||||
|
@ -172,13 +177,6 @@ EnumDevices(INT index,
|
|||
}
|
||||
}
|
||||
|
||||
//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 @@ EnumDevices(INT index,
|
|||
|
||||
if (!bRet)
|
||||
{
|
||||
//no such device:
|
||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||
/* no such device */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -223,7 +220,6 @@ EnumDevices(INT index,
|
|||
if (!bRet)
|
||||
{
|
||||
/* if the description fails, just give up! */
|
||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
|
@ -289,6 +285,13 @@ ListDevicesByType(PMAIN_WND_INFO Info,
|
|||
|
||||
} while (Ret != -1);
|
||||
|
||||
/* kill InfoList initialized in EnumDeviceClasses */
|
||||
if (hDevInfo)
|
||||
{
|
||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||
hDevInfo = NULL;
|
||||
}
|
||||
|
||||
if (!TreeView_GetChild(Info->hTreeView,
|
||||
hDevItem))
|
||||
{
|
||||
|
|
|
@ -546,7 +546,7 @@ CreateMainWindow(LPCTSTR lpCaption,
|
|||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
650,
|
||||
600,
|
||||
450,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef struct _MAIN_WND_INFO
|
|||
int nCmdShow;
|
||||
|
||||
/* status flags */
|
||||
BOOL InMenuLoop : 1;
|
||||
UINT InMenuLoop : 1;
|
||||
|
||||
} MAIN_WND_INFO, *PMAIN_WND_INFO;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
/* menus */
|
||||
#define IDR_MAINMENU 102
|
||||
#define IDR_POPUP 103
|
||||
#define IDC_DEVBYTYPE 104
|
||||
|
||||
/* tooltips */
|
||||
#define IDS_TOOLTIP_PROP 6000
|
||||
|
|
Loading…
Reference in a new issue