/*
* PROJECT: ReactOS Device Manager
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll/win32/devmgr/devmgr/DeviceView.cpp
+ * FILE: dll/win32/devmgr/devmgmt/DeviceView.cpp
* PURPOSE: Implements the tree view which contains the devices
* COPYRIGHT: Copyright 2015 Ged Murphy <gedmurphy@reactos.org>
*/
-#include "stdafx.h"
+#include "precomp.h"
#include "devmgmt.h"
#include "DeviceView.h"
m_hPropertyDialog(NULL),
m_hMenu(NULL),
m_ViewType(DevicesByType),
- m_ShowHidden(FALSE),
+ m_ShowHidden(false),
m_RootNode(NULL)
{
ZeroMemory(&m_ImageListData, sizeof(SP_CLASSIMAGELIST_DATA));
0, 0, 0, 0,
m_hMainWnd,
(HMENU)IDC_TREEVIEW,
- g_hInstance,
+ g_hThisInstance,
NULL);
if (m_hTreeView)
{
m_ViewType = Type;
RefreshThreadData *ThreadData;
- ThreadData = new RefreshThreadData();
+ ThreadData = new RefreshThreadData;
ThreadData->This = this;
ThreadData->ScanForChanges = ScanForChanges;
ThreadData->UpdateView = UpdateView;
HANDLE hThread;
hThread = (HANDLE)_beginthreadex(NULL,
0,
- &RefreshThread,
+ RefreshThread,
ThreadData,
0,
NULL);
-
if (hThread) CloseHandle(hThread);
}
// Get the cached class node
ClassNode = GetClassNode(&ClassGuid);
- if (ClassNode == NULL)
+ if (ClassNode == nullptr)
{
ATLASSERT(FALSE);
ClassIndex++;
// Get the cached device node
DeviceNode = GetDeviceNode(DeviceInfoData.DevInst);
- if (DeviceNode == NULL)
+ if (DeviceNode == nullptr)
{
ATLASSERT(bClassUnknown == true);
DeviceIndex++;
if (Enable == false)
{
CAtlStringW str;
- if (str.LoadStringW(g_hInstance, IDS_CONFIRM_DISABLE))
+ if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_DISABLE))
{
if (MessageBoxW(m_hMainWnd,
str,
if (DeviceNode->CanUpdate())
{
- String.LoadStringW(g_hInstance, IDS_MENU_UPDATE);
+ String.LoadStringW(g_hThisInstance, IDS_MENU_UPDATE);
MenuItemInfo.wID = IDC_UPDATE_DRV;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
if (DeviceNode->IsDisabled())
{
- String.LoadStringW(g_hInstance, IDS_MENU_ENABLE);
+ String.LoadStringW(g_hThisInstance, IDS_MENU_ENABLE);
MenuItemInfo.wID = IDC_ENABLE_DRV;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
if (DeviceNode->CanDisable() && !DeviceNode->IsDisabled())
{
- String.LoadStringW(g_hInstance, IDS_MENU_DISABLE);
+ String.LoadStringW(g_hThisInstance, IDS_MENU_DISABLE);
MenuItemInfo.wID = IDC_DISABLE_DRV;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
if (DeviceNode->CanUninstall())
{
- String.LoadStringW(g_hInstance, IDS_MENU_UNINSTALL);
+ String.LoadStringW(g_hThisInstance, IDS_MENU_UNINSTALL);
MenuItemInfo.wID = IDC_UNINSTALL_DRV;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
}
// All nodes have the scan option
- String.LoadStringW(g_hInstance, IDS_MENU_SCAN);
+ String.LoadStringW(g_hThisInstance, IDS_MENU_SCAN);
MenuItemInfo.wID = IDC_SCAN_HARDWARE;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
if ((Node->GetNodeType() == RootNode) || (MainMenu == true))
{
- String.LoadStringW(g_hInstance, IDS_MENU_ADD);
+ String.LoadStringW(g_hThisInstance, IDS_MENU_ADD);
MenuItemInfo.wID = IDC_ADD_HARDWARE;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeperator);
i++;
- String.LoadStringW(g_hInstance, IDS_MENU_PROPERTIES);
+ String.LoadStringW(g_hThisInstance, IDS_MENU_PROPERTIES);
MenuItemInfo.wID = IDC_PROPERTIES;
MenuItemInfo.dwTypeData = String.GetBuffer();
InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
CClassNode *Node;
Pos = m_ClassNodeList.GetHeadPosition();
+ if (Pos == NULL) return nullptr;
do
{
Node = m_ClassNodeList.GetNext(Pos);
if (IsEqualGUID(*Node->GetClassGuid(), *ClassGuid))
{
- //ATLASSERT(Node->GetType() == NodeClass);
+ ATLASSERT(Node->GetNodeType() == ClassNode);
break;
}
CDeviceNode *Node;
Pos = m_DeviceNodeList.GetHeadPosition();
+ if (Pos == NULL) return nullptr;
do
{
Node = m_DeviceNodeList.GetNext(Pos);
if (Node->GetDeviceInst() == Device)
{
- //ATLASSERT(Node->GetType() == NodeDevice);
+ ATLASSERT(Node->GetNodeType() == DeviceNode);
break;
}
if (m_RootNode) delete m_RootNode;
m_RootNode = new CRootNode(&m_ImageListData);
m_RootNode->SetupNode();
+
// Loop through all the classes
do
{
{
m_DeviceNodeList.AddTail(DeviceNode);
}
+ else
+ {
+ ATLASSERT(FALSE);
+ }
+
}
SetupDiDestroyDeviceInfoList(hDevInfo);