Minor code cleanup

svn path=/trunk/; revision=68376
This commit is contained in:
Ged Murphy 2015-07-07 20:33:54 +00:00
parent 8c5fdce1fa
commit 9370c5b6ea
8 changed files with 25 additions and 317 deletions

View file

@ -204,7 +204,7 @@ CDeviceView::Refresh(
m_ViewType = Type; m_ViewType = Type;
RefreshThreadData *ThreadData; RefreshThreadData *ThreadData;
ThreadData = new RefreshThreadData(); ThreadData = new RefreshThreadData;
ThreadData->This = this; ThreadData->This = this;
ThreadData->ScanForChanges = ScanForChanges; ThreadData->ScanForChanges = ScanForChanges;
ThreadData->UpdateView = UpdateView; ThreadData->UpdateView = UpdateView;
@ -222,11 +222,10 @@ CDeviceView::Refresh(
HANDLE hThread; HANDLE hThread;
hThread = (HANDLE)_beginthreadex(NULL, hThread = (HANDLE)_beginthreadex(NULL,
0, 0,
&RefreshThread, RefreshThread,
ThreadData, ThreadData,
0, 0,
NULL); NULL);
if (hThread) CloseHandle(hThread); if (hThread) CloseHandle(hThread);
} }
@ -479,7 +478,7 @@ CDeviceView::ListDevicesByType()
// Get the cached class node // Get the cached class node
ClassNode = GetClassNode(&ClassGuid); ClassNode = GetClassNode(&ClassGuid);
if (ClassNode == NULL) if (ClassNode == nullptr)
{ {
ATLASSERT(FALSE); ATLASSERT(FALSE);
ClassIndex++; ClassIndex++;
@ -520,7 +519,7 @@ CDeviceView::ListDevicesByType()
// Get the cached device node // Get the cached device node
DeviceNode = GetDeviceNode(DeviceInfoData.DevInst); DeviceNode = GetDeviceNode(DeviceInfoData.DevInst);
if (DeviceNode == NULL) if (DeviceNode == nullptr)
{ {
ATLASSERT(bClassUnknown == true); ATLASSERT(bClassUnknown == true);
DeviceIndex++; DeviceIndex++;
@ -1021,13 +1020,14 @@ CDeviceView::GetClassNode(
CClassNode *Node; CClassNode *Node;
Pos = m_ClassNodeList.GetHeadPosition(); Pos = m_ClassNodeList.GetHeadPosition();
if (Pos == NULL) return nullptr;
do do
{ {
Node = m_ClassNodeList.GetNext(Pos); Node = m_ClassNodeList.GetNext(Pos);
if (IsEqualGUID(*Node->GetClassGuid(), *ClassGuid)) if (IsEqualGUID(*Node->GetClassGuid(), *ClassGuid))
{ {
//ATLASSERT(Node->GetType() == NodeClass); ATLASSERT(Node->GetNodeType() == ClassNode);
break; break;
} }
@ -1047,13 +1047,14 @@ CDeviceView::GetDeviceNode(
CDeviceNode *Node; CDeviceNode *Node;
Pos = m_DeviceNodeList.GetHeadPosition(); Pos = m_DeviceNodeList.GetHeadPosition();
if (Pos == NULL) return nullptr;
do do
{ {
Node = m_DeviceNodeList.GetNext(Pos); Node = m_DeviceNodeList.GetNext(Pos);
if (Node->GetDeviceInst() == Device) if (Node->GetDeviceInst() == Device)
{ {
//ATLASSERT(Node->GetType() == NodeDevice); ATLASSERT(Node->GetNodeType() == DeviceNode);
break; break;
} }
@ -1112,6 +1113,7 @@ CDeviceView::RefreshDeviceList()
if (m_RootNode) delete m_RootNode; if (m_RootNode) delete m_RootNode;
m_RootNode = new CRootNode(&m_ImageListData); m_RootNode = new CRootNode(&m_ImageListData);
m_RootNode->SetupNode(); m_RootNode->SetupNode();
// Loop through all the classes // Loop through all the classes
do do
{ {
@ -1155,6 +1157,11 @@ CDeviceView::RefreshDeviceList()
{ {
m_DeviceNodeList.AddTail(DeviceNode); m_DeviceNodeList.AddTail(DeviceNode);
} }
else
{
ATLASSERT(FALSE);
}
} }
SetupDiDestroyDeviceInfoList(hDevInfo); SetupDiDestroyDeviceInfoList(hDevInfo);

View file

@ -788,6 +788,7 @@ HandleDefaultMessage:
HINSTANCE g_hInstance = NULL; HINSTANCE g_hInstance = NULL;
HANDLE ProcessHeap = NULL; HANDLE ProcessHeap = NULL;
BOOL BOOL
WINAPI WINAPI
DeviceManager_ExecuteW(HWND /*hWndParent*/, DeviceManager_ExecuteW(HWND /*hWndParent*/,
@ -809,6 +810,9 @@ DeviceManager_ExecuteW(HWND /*hWndParent*/,
icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES; icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES;
InitCommonControlsEx(&icex); InitCommonControlsEx(&icex);
//__debugbreak();
g_hInstance = GetModuleHandle(L"devmgr.dll");
// Load the application name // Load the application name
if (szAppName.LoadStringW(g_hInstance, IDS_APPNAME)) if (szAppName.LoadStringW(g_hInstance, IDS_APPNAME))
{ {

View file

@ -1,84 +0,0 @@
#define IDC_STATIC -1
#define IDS_APPNAME 10
#define IDI_MAIN_ICON 20
#define IDB_ROOT_IMAGE 21
#define IDB_TOOLBAR 22
/* windows */
#define IDC_TREEVIEW 50
#define IDC_TOOLBAR 51
#define IDC_STATUSBAR 52
#define IDR_MAINMENU 53
#define IDR_POPUP 54
/* Actions */
#define IDC_PROPERTIES 100
#define IDC_SCAN_HARDWARE 101
#define IDC_ENABLE_DRV 102
#define IDC_DISABLE_DRV 103
#define IDC_UPDATE_DRV 104
#define IDC_UNINSTALL_DRV 105
#define IDC_ADD_HARDWARE 106
/* Menu items */
#define IDC_ACTIONMENU 150
#define IDC_ABOUT 151
#define IDC_EXIT 152
/* view menu */
#define IDC_DEVBYTYPE 200
#define IDC_DEVBYCONN 201
#define IDC_RESBYTYPE 202
#define IDC_RESBYCONN 203
#define IDC_SHOWHIDDEN 204
/* tooltips */
#define IDS_TOOLTIP_PROPERTIES 300
#define IDS_TOOLTIP_SCAN 301
#define IDS_TOOLTIP_ENABLE 302
#define IDS_TOOLTIP_DISABLE 303
#define IDS_TOOLTIP_UPDATE 304
#define IDS_TOOLTIP_UNINSTALL 305
/* General strings */
#define IDS_CONFIRM_DISABLE 400
/* Menu strings */
#define IDS_MENU_UPDATE 500
#define IDS_MENU_ENABLE 501
#define IDS_MENU_DISABLE 502
#define IDS_MENU_UNINSTALL 503
#define IDS_MENU_SCAN 504
#define IDS_MENU_ADD 505
#define IDS_MENU_PROPERTIES 506
/* menu hints */
#define IDS_HINT_BLANK 1000
#define IDS_HINT_PROPERTIES 1001
#define IDS_HINT_SCAN 1002
#define IDS_HINT_ENABLE 1003
#define IDS_HINT_DISABLE 1004
#define IDS_HINT_UPDATE 1005
#define IDS_HINT_UNINSTALL 1006
#define IDS_HINT_ADD 1007
#define IDS_HINT_ABOUT 20008
#define IDS_HINT_EXIT 20009
#define IDS_HINT_DEV_BY_TYPE 20020
#define IDS_HINT_DEV_BY_CONN 20021
#define IDS_HINT_RES_BY_TYPE 20022
#define IDS_HINT_RES_BY_CONN 20023
#define IDS_HINT_SHOW_HIDDEN 20024
/* system menu hints */
#define IDS_HINT_SYS_RESTORE 21001
#define IDS_HINT_SYS_MOVE 21002
#define IDS_HINT_SYS_SIZE 21003
#define IDS_HINT_SYS_MINIMIZE 21004
#define IDS_HINT_SYS_MAXIMIZE 21005
#define IDS_HINT_SYS_CLOSE 21006

View file

@ -2,7 +2,7 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#pragma once #pragma once
#include "resource.h" #include "..\resource.h"
extern HINSTANCE g_hInstance; extern HINSTANCE g_hInstance;
extern HANDLE ProcessHeap; extern HANDLE ProcessHeap;

View file

@ -1,78 +0,0 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDR_MAINMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", IDC_EXIT
END
MENUITEM "Action" IDC_ACTIONMENU
POPUP "View"
BEGIN
MENUITEM "Devices by type", IDC_DEVBYTYPE
MENUITEM "Devices by connection", IDC_DEVBYCONN
MENUITEM "Resources by type", IDC_RESBYTYPE, GRAYED
MENUITEM "Resources by connection", IDC_RESBYCONN, GRAYED
MENUITEM SEPARATOR
MENUITEM "Show hidden devices", IDC_SHOWHIDDEN
END
POPUP "Help"
BEGIN
MENUITEM "About", IDC_ABOUT
END
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_CONFIRM_DISABLE "Disabling this device will cause it to stop functioning.\r\nDo you really want to disable it?"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_MENU_UPDATE "Update driver software..."
IDS_MENU_ENABLE "Enable"
IDS_MENU_DISABLE "Disable"
IDS_MENU_UNINSTALL "Uninstall"
IDS_MENU_SCAN "Scan for hardware changes"
IDS_MENU_ADD "Add hardware"
IDS_MENU_PROPERTIES "Properties"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_TOOLTIP_PROPERTIES "Properties"
IDS_TOOLTIP_SCAN "Scan for hardware changes"
IDS_TOOLTIP_ENABLE "Enable"
IDS_TOOLTIP_DISABLE "Disable"
IDS_TOOLTIP_UPDATE "Update Driver Software"
IDS_TOOLTIP_UNINSTALL "Uninstall"
END
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN
IDS_APPNAME "ReactOS Device Manager"
IDS_HINT_BLANK " "
IDS_HINT_PROPERTIES " Open property dialog for the current selection."
IDS_HINT_SCAN " Scan for changed or new plug and play devices."
IDS_HINT_ENABLE " Enables the selected device."
IDS_HINT_DISABLE " Disables the selected device."
IDS_HINT_UPDATE " Launches the Update Driver Software wizard for the selected device."
IDS_HINT_UNINSTALL " Uninstalls the driver for the selected device."
IDS_HINT_ADD " Adds a legacy (non-Plug and Play) device to the computer."
IDS_HINT_ABOUT " About ReactOS Device Manager."
IDS_HINT_EXIT " Exits the program."
IDS_HINT_DEV_BY_TYPE " Displays devices by hardware type."
IDS_HINT_DEV_BY_CONN " Displays devices by connection."
IDS_HINT_RES_BY_TYPE " Displays resources by type."
IDS_HINT_RES_BY_CONN " Displays resources by connection type."
IDS_HINT_SHOW_HIDDEN " Displays legacy devices and devices that are no longer installed."
IDS_HINT_SYS_RESTORE " Restores this window to normal size."
IDS_HINT_SYS_MOVE " Moves this window."
IDS_HINT_SYS_SIZE " Resizes this window."
IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon."
IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen."
IDS_HINT_SYS_CLOSE " Closes this window."
END

View file

@ -1,80 +0,0 @@
#include <windows.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDI_MAIN_ICON ICON "res/computer.ico"
IDB_ROOT_IMAGE BITMAP "res/root.bmp"
/* main toolbar icons */
IDB_TOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp"
// UTF-8
#pragma code_page(65001)
#ifdef LANGUAGE_BG_BG
#include "lang/bg-BG.rc"
#endif
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
#ifdef LANGUAGE_EL_GR
#include "lang/el-GR.rc"
#endif
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif
#ifdef LANGUAGE_ES_ES
#include "lang/es-ES.rc"
#endif
#ifdef LANGUAGE_FR_FR
#include "lang/fr-FR.rc"
#endif
#ifdef LANGUAGE_HE_IL
#include "lang/he-IL.rc"
#endif
#ifdef LANGUAGE_ID_ID
#include "lang/id-ID.rc"
#endif
#ifdef LANGUAGE_IT_IT
#include "lang/it-IT.rc"
#endif
#ifdef LANGUAGE_JA_JP
#include "lang/ja-JP.rc"
#endif
#ifdef LANGUAGE_KO_KR
#include "lang/ko-KR.rc"
#endif
#ifdef LANGUAGE_NB_NO
#include "lang/no-NO.rc"
#endif
#ifdef LANGUAGE_PL_PL
#include "lang/pl-PL.rc"
#endif
#ifdef LANGUAGE_PT_BR
#include "lang/pt-BR.rc"
#endif
#ifdef LANGUAGE_RO_RO
#include "lang/ro-RO.rc"
#endif
#ifdef LANGUAGE_RU_RU
#include "lang/ru-RU.rc"
#endif
#ifdef LANGUAGE_SK_SK
#include "lang/sk-SK.rc"
#endif
#ifdef LANGUAGE_SV_SE
#include "lang/sv-SE.rc"
#endif
#ifdef LANGUAGE_TH_TH
#include "lang/th-TH.rc"
#endif
#ifdef LANGUAGE_TR_TR
#include "lang/tr-TR.rc"
#endif
#ifdef LANGUAGE_UK_UA
#include "lang/uk-UA.rc"
#endif
#ifdef LANGUAGE_ZH_CN
#include "lang/zh-CN.rc"
#endif

View file

@ -4,13 +4,15 @@
#include "resource.h" #include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define REACTOS_VERSION_DLL #define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Device Manager" #define REACTOS_STR_FILE_DESCRIPTION "ReactOS Device Manager"
#define REACTOS_STR_INTERNAL_NAME "devmgr" #define REACTOS_STR_INTERNAL_NAME "devmgr"
#define REACTOS_STR_ORIGINAL_FILENAME "devmgr.dll" #define REACTOS_STR_ORIGINAL_FILENAME "devmgr.dll"
#include <reactos/version.rc> #include <reactos/version.rc>
#include <reactos/manifest_dll.rc>
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDI_MAIN_ICON ICON "resources/computer.ico" IDI_MAIN_ICON ICON "resources/computer.ico"
IDB_ROOT_IMAGE BITMAP "resources/root.bmp" IDB_ROOT_IMAGE BITMAP "resources/root.bmp"
@ -18,70 +20,7 @@ IDB_ROOT_IMAGE BITMAP "resources/root.bmp"
/* main toolbar icons */ /* main toolbar icons */
IDB_TOOLBAR BITMAP DISCARDABLE "resources/toolbar.bmp" IDB_TOOLBAR BITMAP DISCARDABLE "resources/toolbar.bmp"
#include <reactos/manifest_dll.rc>
#define LANGUAGE_EN_US
/* UTF-8 */ /* UTF-8 */
#pragma code_page(65001) #pragma code_page(65001)
#ifdef LANGUAGE_BG_BG #include "lang/en-US.rc"
#include "lang/bg-BG.rc"
#endif
#ifdef LANGUAGE_CS_CZ
#include "lang/cs-CZ.rc"
#endif
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
#ifdef LANGUAGE_EL_GR
#include "lang/el-GR.rc"
#endif
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif
#ifdef LANGUAGE_ES_ES
#include "lang/es-ES.rc"
#endif
#ifdef LANGUAGE_HE_IL
#include "lang/he-IL.rc"
#endif
#ifdef LANGUAGE_FR_FR
#include "lang/fr-FR.rc"
#endif
#ifdef LANGUAGE_HU_HU
#include "lang/hu-HU.rc"
#endif
#ifdef LANGUAGE_ID_ID
#include "lang/id-ID.rc"
#endif
#ifdef LANGUAGE_IT_IT
#include "lang/it-IT.rc"
#endif
#ifdef LANGUAGE_NB_NO
#include "lang/no-NO.rc"
#endif
#ifdef LANGUAGE_PL_PL
#include "lang/pl-PL.rc"
#endif
#ifdef LANGUAGE_PT_BR
#include "lang/pt-BR.rc"
#endif
#ifdef LANGUAGE_RO_RO
#include "lang/ro-RO.rc"
#endif
#ifdef LANGUAGE_RU_RU
#include "lang/ru-RU.rc"
#endif
#ifdef LANGUAGE_SK_SK
#include "lang/sk-SK.rc"
#endif
#ifdef LANGUAGE_SQ_AL
#include "lang/sq-AL.rc"
#endif
#ifdef LANGUAGE_TR_TR
#include "lang/tr-TR.rc"
#endif
#ifdef LANGUAGE_UK_UA
#include "lang/uk-UA.rc"
#endif

View file

@ -266,6 +266,7 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_APPNAME "ReactOS Device Manager"
IDS_CONFIRM_DISABLE "Disabling this device will cause it to stop functioning.\r\nDo you really want to disable it?" IDS_CONFIRM_DISABLE "Disabling this device will cause it to stop functioning.\r\nDo you really want to disable it?"
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
@ -292,7 +293,6 @@ END
/* Hints */ /* Hints */
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_APPNAME "ReactOS Device Manager"
IDS_HINT_BLANK " " IDS_HINT_BLANK " "
IDS_HINT_PROPERTIES " Open property dialog for the current selection." IDS_HINT_PROPERTIES " Open property dialog for the current selection."
IDS_HINT_SCAN " Scan for changed or new plug and play devices." IDS_HINT_SCAN " Scan for changed or new plug and play devices."