ZeroMemory(&m_DevinfoData, sizeof(SP_DEVINFO_DATA));
}
+CDeviceNode::CDeviceNode(
+ _In_ const CDeviceNode &Node
+ ) :
+ CNode(Node)
+{
+ m_DevInst = Node.m_DevInst;
+ m_hDevInfo = Node.m_hDevInfo;
+ m_Status = Node.m_Status;
+ m_ProblemNumber = Node.m_ProblemNumber;
+ m_OverlayImage = Node.m_OverlayImage;
+ CopyMemory(&m_DevinfoData, &Node.m_DevinfoData, sizeof(SP_DEVINFO_DATA));
+
+ size_t size = wcslen(Node.m_DeviceId) + 1;
+ m_DeviceId = new WCHAR[size];
+ StringCbCopyW(m_DeviceId, size * sizeof(WCHAR), Node.m_DeviceId);
+
+}
+
CDeviceNode::~CDeviceNode()
{
Cleanup();
m_DeviceId,
ulLength + 1,
0);
- if (cr != CR_SUCCESS)
+ if (cr != CR_SUCCESS || wcscmp(m_DeviceId, L"HTREE\\ROOT\\0") == 0)
{
delete[] m_DeviceId;
m_DeviceId = NULL;
}
- // Set the overlay if the device has a problem
+ // Check if the device has a problem
if (HasProblem())
{
- m_OverlayImage = 1;
+ if (IsDisabled())
+ {
+ m_OverlayImage = OverlayDisabled;
+ }
+ else
+ {
+ m_OverlayImage = OverlayProblem;
+ }
}
- // The disabled overlay takes precidence over the problem overlay
- if (IsDisabled())
- {
- m_OverlayImage = 2;
- }
+
// Get the class guid for this device
NULL);
if (cr == CR_SUCCESS)
{
- return ((m_Status & DN_NO_SHOW_IN_DM) != 0);
+ if (m_Status & DN_NO_SHOW_IN_DM)
+ return true;
}
+ if (IsEqualGUID(*GetClassGuid(), GUID_DEVCLASS_LEGACYDRIVER) ||
+ IsEqualGUID(*GetClassGuid(), GUID_DEVCLASS_VOLUME))
+ return true;
+
return false;
}
NULL);
if (cr == CR_SUCCESS)
{
- return ((m_ProblemNumber & (CM_PROB_DISABLED | CM_PROB_HARDWARE_DISABLED)) != 0);
+ return ((m_ProblemNumber == CM_PROB_DISABLED) || (m_ProblemNumber == CM_PROB_HARDWARE_DISABLED));
}
return false;
for (int i = 0; i < 2; i++)
{
// Check globally first, then check config specific
- pcp.Scope = (i == 0) ? DICS_FLAG_GLOBAL : DICS_FLAG_CONFIGSPECIFIC;
+ pcp.Scope = (i == 0) ? DICS_FLAG_CONFIGGENERAL : DICS_FLAG_CONFIGSPECIFIC;
if (SetupDiSetClassInstallParamsW(m_hDevInfo,
&m_DevinfoData,
SetupDiChangeState(m_hDevInfo, &m_DevinfoData);
}
+
if (Enable)
{
// config specific enabling first, then global enabling.