mirror of
https://github.com/reactos/reactos.git
synced 2024-08-01 00:58:16 +00:00
[DEVICE_MANAGER]
- Test whether a driver is hidden or not by checking its status instead of the old hack of hiding certain classes which we deemed should be hidden. - Add support for hiding devices and problem overlays when showing by connection. - We now show and hide identical devices when run alongside the Win8 MS device manager in both by type and by connection. - Update the radio buttons when selecting the menu type. - Add a manifest and use Win7 arrows on the TreeView. svn path=/trunk/; revision=65502
This commit is contained in:
parent
267881ff71
commit
7a8c45344a
|
@ -35,16 +35,16 @@ typedef INT_PTR(WINAPI *pDevicePropertiesExW)(HWND,LPCWSTR,LPCWSTR,DWORD,BOOL);
|
||||||
/* PUBLIC METHODS *************************************/
|
/* PUBLIC METHODS *************************************/
|
||||||
|
|
||||||
CDeviceView::CDeviceView(
|
CDeviceView::CDeviceView(
|
||||||
HWND hMainWnd
|
HWND hMainWnd,
|
||||||
|
ListDevices List
|
||||||
) :
|
) :
|
||||||
m_Devices(NULL),
|
m_Devices(NULL),
|
||||||
m_hMainWnd(hMainWnd),
|
m_hMainWnd(hMainWnd),
|
||||||
m_hTreeView(NULL),
|
m_hTreeView(NULL),
|
||||||
m_hPropertyDialog(NULL),
|
m_hPropertyDialog(NULL),
|
||||||
m_hShortcutMenu(NULL),
|
m_hShortcutMenu(NULL),
|
||||||
m_ListDevices(DevicesByType),
|
m_ListDevices(List),
|
||||||
m_ShowHidden(FALSE),
|
m_ShowHidden(FALSE)
|
||||||
m_ShowUnknown(TRUE)
|
|
||||||
{
|
{
|
||||||
m_Devices = new CDevices();
|
m_Devices = new CDevices();
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,8 @@ CDeviceView::Initialize()
|
||||||
m_ImageList,
|
m_ImageList,
|
||||||
TVSIL_NORMAL);
|
TVSIL_NORMAL);
|
||||||
|
|
||||||
/* Display the devices */
|
/* Give the treeview arrows instead of +/- boxes (on Win7) */
|
||||||
Refresh();
|
SetWindowTheme(m_hTreeView, L"explorer", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!(m_hTreeView);
|
return !!(m_hTreeView);
|
||||||
|
@ -224,9 +224,6 @@ CDeviceView::ListDevicesByType()
|
||||||
INT ClassIndex;
|
INT ClassIndex;
|
||||||
INT ClassImage;
|
INT ClassImage;
|
||||||
LPTSTR DeviceId = NULL;
|
LPTSTR DeviceId = NULL;
|
||||||
|
|
||||||
BOOL IsUnknown = FALSE;
|
|
||||||
BOOL IsHidden = FALSE;
|
|
||||||
BOOL bSuccess;
|
BOOL bSuccess;
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,12 +252,8 @@ CDeviceView::ListDevicesByType()
|
||||||
CLASS_NAME_LEN,
|
CLASS_NAME_LEN,
|
||||||
ClassDescription,
|
ClassDescription,
|
||||||
CLASS_DESC_LEN,
|
CLASS_DESC_LEN,
|
||||||
&ClassImage,
|
&ClassImage);
|
||||||
&IsUnknown,
|
if (bSuccess)
|
||||||
&IsHidden);
|
|
||||||
if (bSuccess &&
|
|
||||||
(IsUnknown == FALSE || (IsUnknown && m_ShowUnknown)) &&
|
|
||||||
(IsHidden == FALSE || (IsHidden && m_ShowHidden)))
|
|
||||||
{
|
{
|
||||||
BOOL bDevSuccess, AddedParent;
|
BOOL bDevSuccess, AddedParent;
|
||||||
HANDLE Handle = NULL;
|
HANDLE Handle = NULL;
|
||||||
|
@ -268,7 +261,8 @@ CDeviceView::ListDevicesByType()
|
||||||
INT DeviceIndex = 0;
|
INT DeviceIndex = 0;
|
||||||
BOOL MoreItems = FALSE;
|
BOOL MoreItems = FALSE;
|
||||||
BOOL DeviceHasProblem = FALSE;
|
BOOL DeviceHasProblem = FALSE;
|
||||||
ULONG DeviceStatus, ProblemNumber;
|
ULONG DeviceStatus = 0;
|
||||||
|
ULONG ProblemNumber = 0;
|
||||||
ULONG OverlayImage = 0;
|
ULONG OverlayImage = 0;
|
||||||
|
|
||||||
AddedParent = FALSE;
|
AddedParent = FALSE;
|
||||||
|
@ -282,9 +276,35 @@ CDeviceView::ListDevicesByType()
|
||||||
&MoreItems,
|
&MoreItems,
|
||||||
DeviceName,
|
DeviceName,
|
||||||
DEVICE_NAME_LEN,
|
DEVICE_NAME_LEN,
|
||||||
&DeviceId);
|
&DeviceId,
|
||||||
|
&DeviceStatus,
|
||||||
|
&ProblemNumber);
|
||||||
if (bDevSuccess)
|
if (bDevSuccess)
|
||||||
{
|
{
|
||||||
|
/* Check if this is a hidden device */
|
||||||
|
if (DeviceStatus & DN_NO_SHOW_IN_DM)
|
||||||
|
{
|
||||||
|
if (m_ShowHidden == FALSE)
|
||||||
|
{
|
||||||
|
DeviceIndex++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the device has a problem */
|
||||||
|
if (DeviceStatus & DN_HAS_PROBLEM)
|
||||||
|
{
|
||||||
|
DeviceHasProblem = TRUE;
|
||||||
|
OverlayImage = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The disabled overlay takes precidence over the problem overlay */
|
||||||
|
if (ProblemNumber == CM_PROB_HARDWARE_DISABLED)
|
||||||
|
{
|
||||||
|
OverlayImage = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* We have a device, we're gonna need to add the parent first */
|
/* We have a device, we're gonna need to add the parent first */
|
||||||
if (AddedParent == FALSE)
|
if (AddedParent == FALSE)
|
||||||
{
|
{
|
||||||
|
@ -299,26 +319,6 @@ CDeviceView::ListDevicesByType()
|
||||||
AddedParent = TRUE;
|
AddedParent = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the status of the device */
|
|
||||||
if (m_Devices->GetDeviceStatus(DeviceId,
|
|
||||||
&DeviceStatus,
|
|
||||||
&ProblemNumber))
|
|
||||||
{
|
|
||||||
/* Check if the device has a problem */
|
|
||||||
if (DeviceStatus & DN_HAS_PROBLEM)
|
|
||||||
{
|
|
||||||
DeviceHasProblem = TRUE;
|
|
||||||
OverlayImage = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The disabled overlay takes precidence over the problem overlay */
|
|
||||||
if (ProblemNumber == CM_PROB_DISABLED ||
|
|
||||||
ProblemNumber == CM_PROB_HARDWARE_DISABLED)
|
|
||||||
{
|
|
||||||
OverlayImage = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add the device under the class item */
|
/* Add the device under the class item */
|
||||||
(VOID)InsertIntoTreeView(hDevItem,
|
(VOID)InsertIntoTreeView(hDevItem,
|
||||||
DeviceName,
|
DeviceName,
|
||||||
|
@ -414,6 +414,9 @@ CDeviceView::RecurseChildDevices(
|
||||||
INT ClassImage;
|
INT ClassImage;
|
||||||
BOOL IsUnknown = FALSE;
|
BOOL IsUnknown = FALSE;
|
||||||
BOOL IsHidden = FALSE;
|
BOOL IsHidden = FALSE;
|
||||||
|
ULONG DeviceStatus = 0;
|
||||||
|
ULONG ProblemNumber = 0;
|
||||||
|
UINT OverlayImage = 0;
|
||||||
BOOL bSuccess;
|
BOOL bSuccess;
|
||||||
|
|
||||||
/* Check if the parent has any child devices */
|
/* Check if the parent has any child devices */
|
||||||
|
@ -426,20 +429,38 @@ CDeviceView::RecurseChildDevices(
|
||||||
DEVICE_NAME_LEN,
|
DEVICE_NAME_LEN,
|
||||||
&DeviceId,
|
&DeviceId,
|
||||||
&ClassImage,
|
&ClassImage,
|
||||||
&IsUnknown,
|
&DeviceStatus,
|
||||||
&IsHidden);
|
&ProblemNumber);
|
||||||
if (bSuccess)
|
if (bSuccess)
|
||||||
{
|
{
|
||||||
/* Add this device to the tree under its parent */
|
/* Check if this is a hidden device */
|
||||||
hDevItem = InsertIntoTreeView(hParentTreeItem,
|
if ((m_ShowHidden == TRUE) || (!(DeviceStatus & DN_NO_SHOW_IN_DM)))
|
||||||
DeviceName,
|
|
||||||
(LPARAM)DeviceId,
|
|
||||||
ClassImage,
|
|
||||||
0);
|
|
||||||
if (hDevItem)
|
|
||||||
{
|
{
|
||||||
/* Check if this child has any children itself */
|
/* Check if the device has a problem */
|
||||||
RecurseChildDevices(Device, hDevItem);
|
if (DeviceStatus & DN_HAS_PROBLEM)
|
||||||
|
{
|
||||||
|
OverlayImage = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The disabled overlay takes precidence over the problem overlay */
|
||||||
|
if (ProblemNumber == CM_PROB_HARDWARE_DISABLED)
|
||||||
|
{
|
||||||
|
OverlayImage = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add this device to the tree under its parent */
|
||||||
|
hDevItem = InsertIntoTreeView(hParentTreeItem,
|
||||||
|
DeviceName,
|
||||||
|
(LPARAM)DeviceId,
|
||||||
|
ClassImage,
|
||||||
|
0);
|
||||||
|
|
||||||
|
|
||||||
|
if (hDevItem)
|
||||||
|
{
|
||||||
|
/* Check if this child has any children itself */
|
||||||
|
RecurseChildDevices(Device, hDevItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,10 +477,30 @@ CDeviceView::RecurseChildDevices(
|
||||||
DEVICE_NAME_LEN,
|
DEVICE_NAME_LEN,
|
||||||
&DeviceId,
|
&DeviceId,
|
||||||
&ClassImage,
|
&ClassImage,
|
||||||
&IsUnknown,
|
&DeviceStatus,
|
||||||
&IsHidden);
|
&ProblemNumber);
|
||||||
if (bSuccess)
|
if (bSuccess)
|
||||||
{
|
{
|
||||||
|
/* Check if this is a hidden device */
|
||||||
|
if (DeviceStatus & DN_NO_SHOW_IN_DM)
|
||||||
|
{
|
||||||
|
if (m_ShowHidden == FALSE)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the device has a problem */
|
||||||
|
if (DeviceStatus & DN_HAS_PROBLEM)
|
||||||
|
{
|
||||||
|
OverlayImage = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The disabled overlay takes precidence over the problem overlay */
|
||||||
|
if (ProblemNumber == CM_PROB_HARDWARE_DISABLED)
|
||||||
|
{
|
||||||
|
OverlayImage = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Add this device to the tree under its parent */
|
/* Add this device to the tree under its parent */
|
||||||
hDevItem = InsertIntoTreeView(hParentTreeItem,
|
hDevItem = InsertIntoTreeView(hParentTreeItem,
|
||||||
DeviceName,
|
DeviceName,
|
||||||
|
@ -530,6 +571,7 @@ CDeviceView::RecurseDeviceView(
|
||||||
tvItem.hItem = hItem;
|
tvItem.hItem = hItem;
|
||||||
tvItem.mask = TVIF_PARAM;
|
tvItem.mask = TVIF_PARAM;
|
||||||
|
|
||||||
|
/* Get the item data */
|
||||||
if (TreeView_GetItem(m_hTreeView, &tvItem) &&
|
if (TreeView_GetItem(m_hTreeView, &tvItem) &&
|
||||||
tvItem.lParam != NULL)
|
tvItem.lParam != NULL)
|
||||||
{
|
{
|
||||||
|
@ -546,9 +588,11 @@ CDeviceView::RecurseDeviceView(
|
||||||
hItem = TreeView_GetNextSibling(m_hTreeView, hItem);
|
hItem = TreeView_GetNextSibling(m_hTreeView, hItem);
|
||||||
if (hItem == NULL) break;
|
if (hItem == NULL) break;
|
||||||
|
|
||||||
|
/* The lParam contains the device id */
|
||||||
tvItem.hItem = hItem;
|
tvItem.hItem = hItem;
|
||||||
tvItem.mask = TVIF_PARAM;
|
tvItem.mask = TVIF_PARAM;
|
||||||
|
|
||||||
|
/* Get the item data and free the device id */
|
||||||
if (TreeView_GetItem(m_hTreeView, &tvItem))
|
if (TreeView_GetItem(m_hTreeView, &tvItem))
|
||||||
{
|
{
|
||||||
if (tvItem.lParam != NULL)
|
if (tvItem.lParam != NULL)
|
||||||
|
|
|
@ -19,15 +19,16 @@ class CDeviceView : public CDevices
|
||||||
ListDevices m_ListDevices;
|
ListDevices m_ListDevices;
|
||||||
|
|
||||||
HIMAGELIST m_ImageList;
|
HIMAGELIST m_ImageList;
|
||||||
//HDEVINFO m_hDevInfo;
|
|
||||||
|
|
||||||
HTREEITEM m_hTreeRoot;
|
HTREEITEM m_hTreeRoot;
|
||||||
|
|
||||||
BOOL m_ShowHidden;
|
BOOL m_ShowHidden;
|
||||||
BOOL m_ShowUnknown;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDeviceView(HWND hMainWnd);
|
CDeviceView(
|
||||||
|
HWND hMainWnd,
|
||||||
|
ListDevices List
|
||||||
|
);
|
||||||
|
|
||||||
~CDeviceView(void);
|
~CDeviceView(void);
|
||||||
|
|
||||||
BOOL Initialize();
|
BOOL Initialize();
|
||||||
|
@ -54,11 +55,6 @@ public:
|
||||||
m_ShowHidden = ShowHidden;
|
m_ShowHidden = ShowHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ShowUnknownDevices(BOOL ShowUnknown)
|
|
||||||
{
|
|
||||||
m_ShowUnknown = ShowUnknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static unsigned int __stdcall ListDevicesThread(
|
static unsigned int __stdcall ListDevicesThread(
|
||||||
void *Param
|
void *Param
|
||||||
|
|
|
@ -138,14 +138,15 @@ CDevices::GetDevice(
|
||||||
_In_ DWORD DeviceNameSize,
|
_In_ DWORD DeviceNameSize,
|
||||||
_Outptr_ LPWSTR *DeviceId,
|
_Outptr_ LPWSTR *DeviceId,
|
||||||
_Out_ PINT ClassImage,
|
_Out_ PINT ClassImage,
|
||||||
_Out_ LPBOOL IsUnknown,
|
_Out_ PULONG Status,
|
||||||
_Out_ LPBOOL IsHidden
|
_Out_ PULONG ProblemNumber
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WCHAR ClassGuidString[MAX_GUID_STRING_LEN];
|
WCHAR ClassGuidString[MAX_GUID_STRING_LEN];
|
||||||
GUID ClassGuid;
|
GUID ClassGuid;
|
||||||
ULONG ulLength;
|
ULONG ulLength;
|
||||||
CONFIGRET cr;
|
CONFIGRET cr;
|
||||||
|
BOOL bSuccess;
|
||||||
|
|
||||||
*DeviceId = NULL;
|
*DeviceId = NULL;
|
||||||
|
|
||||||
|
@ -153,11 +154,13 @@ CDevices::GetDevice(
|
||||||
cr = CM_Get_Device_ID_Size(&ulLength, Device, 0);
|
cr = CM_Get_Device_ID_Size(&ulLength, Device, 0);
|
||||||
if (cr == CR_SUCCESS)
|
if (cr == CR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
/* We alloc heap here because this will be stored in the lParam of the TV */
|
||||||
*DeviceId = (LPWSTR)HeapAlloc(GetProcessHeap(),
|
*DeviceId = (LPWSTR)HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
(ulLength + 1) * sizeof(WCHAR));
|
(ulLength + 1) * sizeof(WCHAR));
|
||||||
if (*DeviceId)
|
if (*DeviceId)
|
||||||
{
|
{
|
||||||
|
/* Now get the actual device id */
|
||||||
cr = CM_Get_Device_IDW(Device,
|
cr = CM_Get_Device_IDW(Device,
|
||||||
*DeviceId,
|
*DeviceId,
|
||||||
ulLength + 1,
|
ulLength + 1,
|
||||||
|
@ -175,6 +178,15 @@ CDevices::GetDevice(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
/* Get the current status of the device */
|
||||||
|
bSuccess = GetDeviceStatus(*DeviceId, Status, ProblemNumber);
|
||||||
|
if (bSuccess == FALSE)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, *DeviceId);
|
||||||
|
*DeviceId = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the class guid for this device */
|
/* Get the class guid for this device */
|
||||||
ulLength = MAX_GUID_STRING_LEN * sizeof(WCHAR);
|
ulLength = MAX_GUID_STRING_LEN * sizeof(WCHAR);
|
||||||
cr = CM_Get_DevNode_Registry_PropertyW(Device,
|
cr = CM_Get_DevNode_Registry_PropertyW(Device,
|
||||||
|
@ -187,21 +199,14 @@ CDevices::GetDevice(
|
||||||
{
|
{
|
||||||
/* Convert the string to a proper guid */
|
/* Convert the string to a proper guid */
|
||||||
CLSIDFromString(ClassGuidString, &ClassGuid);
|
CLSIDFromString(ClassGuidString, &ClassGuid);
|
||||||
|
|
||||||
/* Check if this is a hidden device */
|
|
||||||
if ((IsEqualGUID(ClassGuid, GUID_DEVCLASS_LEGACYDRIVER) ||
|
|
||||||
IsEqualGUID(ClassGuid, GUID_DEVCLASS_VOLUME)))
|
|
||||||
{
|
|
||||||
*IsHidden = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* It's a device with no driver */
|
/* It's a device with no driver */
|
||||||
ClassGuid = GUID_DEVCLASS_UNKNOWN;
|
ClassGuid = GUID_DEVCLASS_UNKNOWN;
|
||||||
*IsUnknown = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get the image for the class this device is in */
|
/* Get the image for the class this device is in */
|
||||||
SetupDiGetClassImageIndex(&m_ImageListData,
|
SetupDiGetClassImageIndex(&m_ImageListData,
|
||||||
&ClassGuid,
|
&ClassGuid,
|
||||||
|
@ -245,9 +250,7 @@ CDevices::EnumClasses(
|
||||||
_In_ DWORD ClassNameSize,
|
_In_ DWORD ClassNameSize,
|
||||||
_Out_writes_(ClassDescSize) LPWSTR ClassDesc,
|
_Out_writes_(ClassDescSize) LPWSTR ClassDesc,
|
||||||
_In_ DWORD ClassDescSize,
|
_In_ DWORD ClassDescSize,
|
||||||
_Out_ PINT ClassImage,
|
_Out_ PINT ClassImage
|
||||||
_Out_ LPBOOL IsUnknown,
|
|
||||||
_Out_ LPBOOL IsHidden
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DWORD RequiredSize, Type, Size;
|
DWORD RequiredSize, Type, Size;
|
||||||
|
@ -258,8 +261,6 @@ CDevices::EnumClasses(
|
||||||
ClassName[0] = UNICODE_NULL;
|
ClassName[0] = UNICODE_NULL;
|
||||||
ClassDesc[0] = UNICODE_NULL;
|
ClassDesc[0] = UNICODE_NULL;
|
||||||
*ClassImage = -1;
|
*ClassImage = -1;
|
||||||
*IsUnknown = FALSE;
|
|
||||||
*IsHidden = FALSE;
|
|
||||||
|
|
||||||
/* Get the next class in the list */
|
/* Get the next class in the list */
|
||||||
cr = CM_Enumerate_Classes(ClassIndex,
|
cr = CM_Enumerate_Classes(ClassIndex,
|
||||||
|
@ -332,16 +333,6 @@ CDevices::EnumClasses(
|
||||||
ClassGuid,
|
ClassGuid,
|
||||||
ClassImage);
|
ClassImage);
|
||||||
|
|
||||||
/* Check if this is an unknown device */
|
|
||||||
*IsUnknown = IsEqualGUID(*ClassGuid, GUID_DEVCLASS_UNKNOWN);
|
|
||||||
|
|
||||||
/* Check if this is one of the classes we hide by default */
|
|
||||||
if (IsEqualGUID(*ClassGuid, GUID_DEVCLASS_LEGACYDRIVER) ||
|
|
||||||
IsEqualGUID(*ClassGuid, GUID_DEVCLASS_VOLUME))
|
|
||||||
{
|
|
||||||
*IsHidden = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +344,9 @@ CDevices::EnumDevicesForClass(
|
||||||
_Out_ LPBOOL MoreItems,
|
_Out_ LPBOOL MoreItems,
|
||||||
_Out_ LPTSTR DeviceName,
|
_Out_ LPTSTR DeviceName,
|
||||||
_In_ DWORD DeviceNameSize,
|
_In_ DWORD DeviceNameSize,
|
||||||
_Outptr_ LPTSTR *DeviceId
|
_Outptr_ LPTSTR *DeviceId,
|
||||||
|
_Out_ PULONG Status,
|
||||||
|
_Out_ PULONG ProblemNumber
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SP_DEVINFO_DATA DeviceInfoData;
|
SP_DEVINFO_DATA DeviceInfoData;
|
||||||
|
@ -454,7 +447,6 @@ CDevices::EnumDevicesForClass(
|
||||||
NULL);
|
NULL);
|
||||||
if (bSuccess == FALSE) goto Quit;
|
if (bSuccess == FALSE) goto Quit;
|
||||||
|
|
||||||
|
|
||||||
/* Skip the root device */
|
/* Skip the root device */
|
||||||
if (*DeviceId != NULL &&
|
if (*DeviceId != NULL &&
|
||||||
wcscmp(*DeviceId, L"HTREE\\ROOT\\0") == 0)
|
wcscmp(*DeviceId, L"HTREE\\ROOT\\0") == 0)
|
||||||
|
@ -463,6 +455,12 @@ CDevices::EnumDevicesForClass(
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Get the current status of the device */
|
||||||
|
bSuccess = GetDeviceStatus(*DeviceId, Status, ProblemNumber);
|
||||||
|
if (bSuccess == FALSE) goto Quit;
|
||||||
|
|
||||||
|
|
||||||
/* Get the device's friendly name */
|
/* Get the device's friendly name */
|
||||||
bSuccess = SetupDiGetDeviceRegistryPropertyW(hDevInfo,
|
bSuccess = SetupDiGetDeviceRegistryPropertyW(hDevInfo,
|
||||||
&DeviceInfoData,
|
&DeviceInfoData,
|
||||||
|
@ -552,7 +550,6 @@ Cleanup:
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
CDevices::ConvertResourceDescriptorToString(
|
CDevices::ConvertResourceDescriptorToString(
|
||||||
_Inout_z_ LPWSTR ResourceDescriptor,
|
_Inout_z_ LPWSTR ResourceDescriptor,
|
||||||
|
|
|
@ -44,8 +44,8 @@ public:
|
||||||
_In_ DWORD DeviceNameSize,
|
_In_ DWORD DeviceNameSize,
|
||||||
_Outptr_ LPTSTR *DeviceId,
|
_Outptr_ LPTSTR *DeviceId,
|
||||||
_Out_ PINT ClassImage,
|
_Out_ PINT ClassImage,
|
||||||
_Out_ LPBOOL IsUnknown,
|
_Out_ PULONG Status,
|
||||||
_Out_ LPBOOL IsHidden
|
_Out_ PULONG ProblemNumber
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOL EnumClasses(
|
BOOL EnumClasses(
|
||||||
|
@ -55,9 +55,7 @@ public:
|
||||||
_In_ DWORD ClassNameSize,
|
_In_ DWORD ClassNameSize,
|
||||||
_Out_writes_(ClassDescSize) LPWSTR ClassDesc,
|
_Out_writes_(ClassDescSize) LPWSTR ClassDesc,
|
||||||
_In_ DWORD ClassDescSize,
|
_In_ DWORD ClassDescSize,
|
||||||
_Out_ PINT ClassImage,
|
_Out_ PINT ClassImage
|
||||||
_Out_ LPBOOL IsUnknown,
|
|
||||||
_Out_ LPBOOL IsHidden
|
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOL EnumDevicesForClass(
|
BOOL EnumDevicesForClass(
|
||||||
|
@ -67,7 +65,9 @@ public:
|
||||||
_Out_ LPBOOL MoreItems,
|
_Out_ LPBOOL MoreItems,
|
||||||
_Out_writes_(DeviceNameSize) LPTSTR DeviceName,
|
_Out_writes_(DeviceNameSize) LPTSTR DeviceName,
|
||||||
_In_ DWORD DeviceNameSize,
|
_In_ DWORD DeviceNameSize,
|
||||||
_Outptr_ LPTSTR *DeviceId
|
_Outptr_ LPTSTR *DeviceId,
|
||||||
|
_Out_ PULONG Status,
|
||||||
|
_Out_ PULONG ProblemNumber
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOL GetDeviceStatus(
|
BOOL GetDeviceStatus(
|
||||||
|
@ -87,7 +87,6 @@ private:
|
||||||
BOOL CreateRootDevice(
|
BOOL CreateRootDevice(
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
DWORD ConvertResourceDescriptorToString(
|
DWORD ConvertResourceDescriptorToString(
|
||||||
_Inout_z_ LPWSTR ResourceDescriptor,
|
_Inout_z_ LPWSTR ResourceDescriptor,
|
||||||
_In_ DWORD ResourceDescriptorSize
|
_In_ DWORD ResourceDescriptorSize
|
||||||
|
|
|
@ -105,10 +105,6 @@ CMainWindow::Initialize(LPCTSTR lpCaption,
|
||||||
NULL,
|
NULL,
|
||||||
g_hInstance,
|
g_hInstance,
|
||||||
this);
|
this);
|
||||||
if (m_hMainWnd)
|
|
||||||
{
|
|
||||||
m_hMenu = GetMenu(m_hMainWnd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return creation result */
|
/* Return creation result */
|
||||||
|
@ -171,6 +167,38 @@ CMainWindow::MainWndMenuHint(WORD CmdId,
|
||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
CMainWindow::UpdateDevicesDisplay(ListDevices List)
|
||||||
|
{
|
||||||
|
UINT CheckId;
|
||||||
|
BOOL bSuccess;
|
||||||
|
|
||||||
|
/* Set the new type*/
|
||||||
|
m_DeviceView->SetDeviceListType(List);
|
||||||
|
|
||||||
|
/* Get the menu item id */
|
||||||
|
switch (List)
|
||||||
|
{
|
||||||
|
case DevicesByType: CheckId = IDC_DEVBYTYPE; break;
|
||||||
|
case DevicesByConnection: CheckId = IDC_DEVBYCONN; break;
|
||||||
|
case ResourcesByType: CheckId = IDC_RESBYTYPE; break;
|
||||||
|
case ResourcesByConnection: CheckId = IDC_RESBYCONN; break;
|
||||||
|
default: ATLASSERT(FALSE); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the new check item */
|
||||||
|
bSuccess = CheckMenuRadioItem(m_hMenu,
|
||||||
|
IDC_DEVBYTYPE,
|
||||||
|
IDC_RESBYCONN,
|
||||||
|
CheckId,
|
||||||
|
MF_BYCOMMAND);
|
||||||
|
|
||||||
|
/* Refresh the view */
|
||||||
|
m_DeviceView->Refresh();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CMainWindow::CreateToolBar()
|
CMainWindow::CreateToolBar()
|
||||||
{
|
{
|
||||||
|
@ -329,15 +357,20 @@ CMainWindow::OnCreate(HWND hwnd)
|
||||||
/* Store the window handle */
|
/* Store the window handle */
|
||||||
m_hMainWnd = hwnd;
|
m_hMainWnd = hwnd;
|
||||||
|
|
||||||
|
/* Get the menu handle */
|
||||||
|
m_hMenu = GetMenu(m_hMainWnd);
|
||||||
|
|
||||||
/* Create the toolbar */
|
/* Create the toolbar */
|
||||||
if (CreateToolBar() && CreateStatusBar())
|
if (CreateToolBar() && CreateStatusBar())
|
||||||
{
|
{
|
||||||
/* Create the device view object */
|
/* Create the device view object */
|
||||||
m_DeviceView = new CDeviceView(m_hMainWnd);
|
m_DeviceView = new CDeviceView(m_hMainWnd, DevicesByType);
|
||||||
|
|
||||||
/* Initialize it */
|
/* Initialize it */
|
||||||
if (m_DeviceView->Initialize())
|
if (m_DeviceView->Initialize())
|
||||||
{
|
{
|
||||||
|
UpdateDevicesDisplay(DevicesByType);
|
||||||
|
|
||||||
/* Display the window according to the user request */
|
/* Display the window according to the user request */
|
||||||
ShowWindow(hwnd, m_CmdShow);
|
ShowWindow(hwnd, m_CmdShow);
|
||||||
|
|
||||||
|
@ -450,27 +483,15 @@ CMainWindow::OnCommand(WPARAM wParam,
|
||||||
|
|
||||||
case IDC_DEVBYTYPE:
|
case IDC_DEVBYTYPE:
|
||||||
{
|
{
|
||||||
m_DeviceView->SetDeviceListType(DevicesByType);
|
UpdateDevicesDisplay(DevicesByType);
|
||||||
CheckMenuRadioItem(m_hMenu,
|
break;
|
||||||
IDC_DEVBYTYPE,
|
|
||||||
IDC_RESBYCONN,
|
|
||||||
IDC_DEVBYTYPE,
|
|
||||||
MF_BYCOMMAND);
|
|
||||||
m_DeviceView->Refresh();
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case IDC_DEVBYCONN:
|
case IDC_DEVBYCONN:
|
||||||
{
|
{
|
||||||
m_DeviceView->SetDeviceListType(DevicesByConnection);
|
UpdateDevicesDisplay(DevicesByConnection);
|
||||||
CheckMenuRadioItem(m_hMenu,
|
break;
|
||||||
IDC_DEVBYTYPE,
|
|
||||||
IDC_RESBYCONN,
|
|
||||||
IDC_DEVBYCONN,
|
|
||||||
MF_BYCOMMAND);
|
|
||||||
m_DeviceView->Refresh();
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case IDC_SHOWHIDDEN:
|
case IDC_SHOWHIDDEN:
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,8 +18,21 @@ class CMainWindow
|
||||||
HMENU m_hMenu;
|
HMENU m_hMenu;
|
||||||
int m_CmdShow;
|
int m_CmdShow;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CMainWindow(void);
|
||||||
|
~CMainWindow(void);
|
||||||
|
|
||||||
|
BOOL Initialize(LPCTSTR lpCaption, int nCmdShow);
|
||||||
|
INT Run();
|
||||||
|
VOID Uninitialize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK MainWndProc(
|
||||||
|
HWND hwnd,
|
||||||
|
UINT msg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam
|
||||||
|
);
|
||||||
|
|
||||||
LRESULT OnCreate(HWND hwnd);
|
LRESULT OnCreate(HWND hwnd);
|
||||||
LRESULT OnDestroy();
|
LRESULT OnDestroy();
|
||||||
|
@ -30,19 +43,23 @@ private:
|
||||||
|
|
||||||
BOOL CreateToolBar();
|
BOOL CreateToolBar();
|
||||||
BOOL CreateStatusBar();
|
BOOL CreateStatusBar();
|
||||||
BOOL StatusBarLoadString(HWND hStatusBar, INT PartId, HINSTANCE hInstance, UINT uID);
|
|
||||||
BOOL MainWndMenuHint(WORD CmdId,
|
|
||||||
const MENU_HINT *HintArray,
|
|
||||||
DWORD HintsCount,
|
|
||||||
UINT DefHintId);
|
|
||||||
|
|
||||||
public:
|
BOOL StatusBarLoadString(
|
||||||
CMainWindow(void);
|
HWND hStatusBar,
|
||||||
~CMainWindow(void);
|
INT PartId,
|
||||||
|
HINSTANCE hInstance,
|
||||||
|
UINT uID
|
||||||
|
);
|
||||||
|
|
||||||
BOOL Initialize(LPCTSTR lpCaption, int nCmdShow);
|
BOOL MainWndMenuHint(
|
||||||
INT Run();
|
WORD CmdId,
|
||||||
VOID Uninitialize();
|
const MENU_HINT *HintArray,
|
||||||
|
DWORD HintsCount,
|
||||||
|
UINT DefHintId
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOL UpdateDevicesDisplay(
|
||||||
|
ListDevices List
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly
|
||||||
|
xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||||
|
manifestVersion="1.0">
|
||||||
|
<assemblyIdentity
|
||||||
|
name="ReactOS.Apps.devmgmt"
|
||||||
|
processorArchitecture="*"
|
||||||
|
version="1.0.0.0"
|
||||||
|
type="win32"/>
|
||||||
|
<description>ReactOS Device Manager</description>
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
</assembly>
|
||||||
|
|
Binary file not shown.
|
@ -5,11 +5,6 @@ VisualStudioVersion = 12.0.30501.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devmgmt_new", "devmgmt_new.vcxproj", "{47B3358F-E7C3-4D02-9310-68813B9292E0}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devmgmt_new", "devmgmt_new.vcxproj", "{47B3358F-E7C3-4D02-9310-68813B9292E0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9ED8D860-F1E9-4F32-8EE7-D8BAEC9BF319}"
|
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
Performance1.psess = Performance1.psess
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
|
|
|
@ -41,9 +41,11 @@
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<GenerateManifest>false</GenerateManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<GenerateManifest>false</GenerateManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
@ -56,7 +58,7 @@
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>comctl32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>UxTheme.lib;comctl32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>LANGUAGE_EN_US;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>LANGUAGE_EN_US;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
@ -77,7 +79,7 @@
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>comctl32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>UxTheme.lib;comctl32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <setupapi.h>
|
#include <setupapi.h>
|
||||||
#include <cfgmgr32.h>
|
#include <cfgmgr32.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
#include <Uxtheme.h>
|
||||||
#include <Cfgmgr32.h>
|
#include <Cfgmgr32.h>
|
||||||
#include <devguid.h>
|
#include <devguid.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue