// Get the device image list
m_ImageListData.cbSize = sizeof(SP_CLASSIMAGELIST_DATA);
BOOL bSuccess = SetupDiGetClassImageList(&m_ImageListData);
- if (bSuccess == FALSE) return false;
+ if (bSuccess == FALSE)
+ return false;
// Create the main treeview
m_hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE,
_In_ LPNMHDR NmHdr
)
{
- HTREEITEM hItem = TreeView_GetNextItem(NmHdr->hwndFrom, 0, TVGN_DROPHILITE);
- if (hItem)
+ TVHITTESTINFO hitInfo;
+ HTREEITEM hItem;
+
+ GetCursorPos(&hitInfo.pt);
+ ScreenToClient(m_hTreeView, &hitInfo.pt);
+
+ hItem = TreeView_HitTest(m_hTreeView, &hitInfo);
+ if (hItem != NULL && (hitInfo.flags & (TVHT_ONITEM | TVHT_ONITEMICON)))
{
- TreeView_SelectItem(NmHdr->hwndFrom, hItem);
+ TreeView_SelectItem(m_hTreeView, hItem);
}
return 0;
_In_ bool UpdateView
)
{
- // Enum devices on a seperate thread to keep the gui responsive
+ // Enum devices on a separate thread to keep the gui responsive
m_ViewType = Type;
ThreadData->ScanForChanges = ScanForChanges;
ThreadData->UpdateView = UpdateView;
-
HANDLE hThread;
hThread = (HANDLE)_beginthreadex(NULL,
0,
cr = CM_Enumerate_Classes(ClassIndex,
ClassGuid,
0);
- if (cr != CR_SUCCESS) return false;
+ if (cr != CR_SUCCESS)
+ return false;
// Check if this is the unknown class
if (IsEqualGUID(*ClassGuid, GUID_DEVCLASS_UNKNOWN))
break;
}
-
This->SelectNode(LastSelectedNode);
delete ThreadData;
{
// Check if the parent device has anything at the same level
bSuccess = GetSiblingDevice(Device, &Device);
- if (bSuccess == FALSE) break;
+ if (bSuccess == FALSE)
+ break;
DeviceNode = dynamic_cast<CDeviceNode *>(GetDeviceNode(Device));
if (DeviceNode == nullptr)
}
// If there was a problem, expand the ancestors
- if (HasProblem) return false;
+ if (HasProblem)
+ return false;
return true;
}
)
{
CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
- if (Node == nullptr) return false;
+ if (Node == nullptr)
+ return false;
if (Enable == false)
{
if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_DISABLE))
{
if (MessageBoxW(m_hMainWnd,
- str,
- Node->GetDisplayName(),
- MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
+ str,
+ Node->GetDisplayName(),
+ MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
{
return false;
}
)
{
CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
- if (Node == nullptr) return false;
+ if (Node == nullptr)
+ return false;
DWORD dwReboot;
if (InstallDevInst(m_hMainWnd, Node->GetDeviceId(), TRUE, &dwReboot))
)
{
CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
- if (Node == nullptr) return false;
+ if (Node == nullptr)
+ return false;
CAtlStringW str;
if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_UNINSTALL))
{
if (MessageBoxW(m_hMainWnd,
- str,
- Node->GetDisplayName(),
- MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
+ str,
+ Node->GetDisplayName(),
+ MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
{
return false;
}
HMODULE hModule;
hModule = LoadLibraryW(L"hdwwiz.cpl");
- if (hModule == NULL) return false;
+ if (hModule == NULL)
+ return false;
pAddHardwareWizard = (PADDHARDWAREWIZARD)GetProcAddress(hModule,
"AddHardwareWizard");
tvi.iImage = Node->GetClassImage();
tvi.iSelectedImage = Node->GetClassImage();
- // try to cast it to a device node. This will only suceed if it's the correct type
+ // try to cast it to a device node. This will only succeed if it's the correct type
CDeviceNode *DeviceNode = dynamic_cast<CDeviceNode *>(Node);
if (DeviceNode && DeviceNode->GetOverlayImage())
{
_In_ bool MainMenu
)
{
- // Create a seperator structure
- MENUITEMINFOW MenuSeperator = { 0 };
- MenuSeperator.cbSize = sizeof(MENUITEMINFOW);
- MenuSeperator.fType = MFT_SEPARATOR;
+ // Create a separator structure
+ MENUITEMINFOW MenuSeparator = { 0 };
+ MenuSeparator.cbSize = sizeof(MENUITEMINFOW);
+ MenuSeparator.fType = MFT_SEPARATOR;
// Setup the
MENUITEMINFOW MenuItemInfo = { 0 };
i++;
}
- InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeperator);
+ InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeparator);
i++;
}
if (Node->HasProperties())
{
- InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeperator);
+ InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeparator);
i++;
String.LoadStringW(g_hThisInstance, IDS_MENU_PROPERTIES);
// Check if this node has any children
hItem = TreeView_GetChild(m_hTreeView, hParentItem);
- if (hItem == NULL) return NULL;
+ if (hItem == NULL)
+ return NULL;
// The lParam contains the node pointer data
tvItem.hItem = hItem;
// This node may have its own children
FoundItem = RecurseFindDevice(hItem, Node);
- if (FoundItem) return FoundItem;
+ if (FoundItem)
+ return FoundItem;
// Loop all the siblings
for (;;)
{
// Get the next item at this level
hItem = TreeView_GetNextSibling(m_hTreeView, hItem);
- if (hItem == NULL) break;
+ if (hItem == NULL)
+ break;
// The lParam contains the node pointer data
tvItem.hItem = hItem;
// This node may have its own children
FoundItem = RecurseFindDevice(hItem, Node);
- if (FoundItem) return FoundItem;
+ if (FoundItem)
+ return FoundItem;
}
return hItem;
// Check if there are any items in the tree
hRoot = TreeView_GetRoot(m_hTreeView);
- if (hRoot == NULL) return;
+ if (hRoot == NULL)
+ return;
// If we don't want to set select a node, just select root
if (Node == nullptr || Node->GetNodeType() == RootNode)
CClassNode *Node = nullptr;
Pos = m_ClassNodeList.GetHeadPosition();
- if (Pos == NULL) return nullptr;
+ if (Pos == NULL)
+ return nullptr;
do
{
CDeviceNode *Node = nullptr;
Pos = m_DeviceNodeList.GetHeadPosition();
- if (Pos == NULL) return nullptr;
+ if (Pos == NULL)
+ return nullptr;
do
{
ClassIndex++;
} while (Success);
-
// Get all the devices on the local machine
hDevInfo = SetupDiGetClassDevsW(NULL,
0,
{
// Get the devinst for this device
Success = SetupDiEnumDeviceInfo(hDevInfo, i, &DeviceInfoData);
- if (Success == FALSE) break;
+ if (Success == FALSE)
+ break;
// create a new device node and add it to the list
DeviceNode = new CDeviceNode(DeviceInfoData.DevInst, &m_ImageListData);
+ /* FIXME: Start of Hack for CORE-5643 */
+ if (!DeviceNode->IsInstalled())
+ continue;
+ /* FIXME: End of Hack for CORE-5643 */
+
if (DeviceNode->SetupNode())
{
m_DeviceNodeList.AddTail(DeviceNode);
{
ATLASSERT(FALSE);
}
-
}
SetupDiDestroyDeviceInfoList(hDevInfo);