mirror of
https://github.com/reactos/reactos.git
synced 2024-08-12 06:06:27 +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
|
END
|
||||||
POPUP "View"
|
POPUP "View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "Devices by type", IDC_STATIC
|
MENUITEM "Devices by type", IDC_DEVBYTYPE, CHECKED
|
||||||
MENUITEM "Devices by connection", IDC_STATIC, GRAYED
|
MENUITEM "Devices by connection", IDC_STATIC, GRAYED
|
||||||
MENUITEM "Resources by type", IDC_STATIC, GRAYED
|
MENUITEM "Resources by type", IDC_STATIC, GRAYED
|
||||||
MENUITEM "Resources by connection", IDC_STATIC, GRAYED
|
MENUITEM "Resources by connection", IDC_STATIC, GRAYED
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
SP_CLASSIMAGELIST_DATA ImageListData;
|
|
||||||
|
|
||||||
|
static SP_CLASSIMAGELIST_DATA ImageListData;
|
||||||
|
static HDEVINFO hDevInfo;
|
||||||
|
|
||||||
static HTREEITEM
|
static HTREEITEM
|
||||||
InsertIntoTreeView(HWND hTV,
|
InsertIntoTreeView(HWND hTV,
|
||||||
|
@ -60,7 +61,10 @@ EnumDeviceClasses(INT ClassIndex,
|
||||||
{
|
{
|
||||||
/* all classes enumerated */
|
/* all classes enumerated */
|
||||||
if(Ret == CR_NO_SUCH_VALUE)
|
if(Ret == CR_NO_SUCH_VALUE)
|
||||||
|
{
|
||||||
|
hDevInfo = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Ret == CR_INVALID_DATA)
|
if (Ret == CR_INVALID_DATA)
|
||||||
; /*FIXME: what should we do here? */
|
; /*FIXME: what should we do here? */
|
||||||
|
@ -84,18 +88,23 @@ EnumDeviceClasses(INT ClassIndex,
|
||||||
&ClassGuid,
|
&ClassGuid,
|
||||||
ClassImage))
|
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;
|
*ClassImage = 41;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: do we need this?
|
/* Get device info for all devices of a particular class */
|
||||||
hDevInfo = SetupDiGetClassDevs(&ClassGuid,
|
hDevInfo = SetupDiGetClassDevs(&ClassGuid,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
DIGCF_PRESENT);
|
DIGCF_PRESENT);
|
||||||
if (hDevInfo == INVALID_HANDLE_VALUE)
|
if (hDevInfo == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
hDevInfo = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
|
||||||
KeyClass = SetupDiOpenClassRegKeyEx(&ClassGuid,
|
KeyClass = SetupDiOpenClassRegKeyEx(&ClassGuid,
|
||||||
MAXIMUM_ALLOWED,
|
MAXIMUM_ALLOWED,
|
||||||
|
@ -120,9 +129,6 @@ EnumDeviceClasses(INT ClassIndex,
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: see above?
|
|
||||||
SetupDiDestroyDeviceInfoList(hDevInfo); */
|
|
||||||
|
|
||||||
*DevPresent = TRUE;
|
*DevPresent = TRUE;
|
||||||
|
|
||||||
RegCloseKey(KeyClass);
|
RegCloseKey(KeyClass);
|
||||||
|
@ -136,7 +142,6 @@ EnumDevices(INT index,
|
||||||
TCHAR* DeviceClassName,
|
TCHAR* DeviceClassName,
|
||||||
TCHAR* DeviceName)
|
TCHAR* DeviceName)
|
||||||
{
|
{
|
||||||
HDEVINFO hDevInfo;
|
|
||||||
SP_DEVINFO_DATA DeviceInfoData;
|
SP_DEVINFO_DATA DeviceInfoData;
|
||||||
DWORD RequiredSize = 0;
|
DWORD RequiredSize = 0;
|
||||||
GUID *guids = NULL;
|
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);
|
HeapFree(GetProcessHeap(), 0, guids);
|
||||||
if(hDevInfo == INVALID_HANDLE_VALUE)
|
if(hDevInfo == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -198,8 +196,7 @@ EnumDevices(INT index,
|
||||||
|
|
||||||
if (!bRet)
|
if (!bRet)
|
||||||
{
|
{
|
||||||
//no such device:
|
/* no such device */
|
||||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +220,6 @@ EnumDevices(INT index,
|
||||||
if (!bRet)
|
if (!bRet)
|
||||||
{
|
{
|
||||||
/* if the description fails, just give up! */
|
/* if the description fails, just give up! */
|
||||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,6 +285,13 @@ ListDevicesByType(PMAIN_WND_INFO Info,
|
||||||
|
|
||||||
} while (Ret != -1);
|
} while (Ret != -1);
|
||||||
|
|
||||||
|
/* kill InfoList initialized in EnumDeviceClasses */
|
||||||
|
if (hDevInfo)
|
||||||
|
{
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
hDevInfo = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!TreeView_GetChild(Info->hTreeView,
|
if (!TreeView_GetChild(Info->hTreeView,
|
||||||
hDevItem))
|
hDevItem))
|
||||||
{
|
{
|
||||||
|
|
|
@ -546,7 +546,7 @@ CreateMainWindow(LPCTSTR lpCaption,
|
||||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
650,
|
600,
|
||||||
450,
|
450,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -28,7 +28,7 @@ typedef struct _MAIN_WND_INFO
|
||||||
int nCmdShow;
|
int nCmdShow;
|
||||||
|
|
||||||
/* status flags */
|
/* status flags */
|
||||||
BOOL InMenuLoop : 1;
|
UINT InMenuLoop : 1;
|
||||||
|
|
||||||
} MAIN_WND_INFO, *PMAIN_WND_INFO;
|
} MAIN_WND_INFO, *PMAIN_WND_INFO;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
/* menus */
|
/* menus */
|
||||||
#define IDR_MAINMENU 102
|
#define IDR_MAINMENU 102
|
||||||
#define IDR_POPUP 103
|
#define IDR_POPUP 103
|
||||||
|
#define IDC_DEVBYTYPE 104
|
||||||
|
|
||||||
/* tooltips */
|
/* tooltips */
|
||||||
#define IDS_TOOLTIP_PROP 6000
|
#define IDS_TOOLTIP_PROP 6000
|
||||||
|
|
Loading…
Reference in a new issue