diff --git a/reactos/dll/win32/devmgr/devmgmt/ClassNode.cpp b/reactos/dll/win32/devmgr/devmgmt/ClassNode.cpp index b2c1471bdb4..249925c05ae 100644 --- a/reactos/dll/win32/devmgr/devmgmt/ClassNode.cpp +++ b/reactos/dll/win32/devmgr/devmgmt/ClassNode.cpp @@ -120,7 +120,7 @@ CClassNode::ConvertResourceDescriptorToString( if (ptr) { // This must be an inf based descriptor, the desc is after the semi colon - wcscpy_s(ResourceDescriptor, ResourceDescriptorSize, ++ptr); + StringCbCopyW(ResourceDescriptor, ResourceDescriptorSize, ++ptr); dwError = ERROR_SUCCESS; } else @@ -154,7 +154,7 @@ CClassNode::ConvertResourceDescriptorToString( // Load the string from the dll if (LoadStringW(hModule, ResourceId, ResString, 256)) { - wcscpy_s(ResourceDescriptor, ResourceDescriptorSize, ResString); + StringCbCopyW(ResourceDescriptor, ResourceDescriptorSize, ResString); dwError = ERROR_SUCCESS; } else diff --git a/reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp b/reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp index 42e8090825e..b15ce5a49ba 100644 --- a/reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp +++ b/reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp @@ -274,7 +274,6 @@ CDeviceNode::EnableDevice( _Out_ bool &NeedsReboot ) { - bool Ret = false; bool Canceled = false; SetFlags(DI_NODI_DEFAULTACTION, 0); @@ -376,6 +375,8 @@ CDeviceNode::UninstallDevice() NULL, 0); + return true; + } /* PRIVATE METHODS ******************************************************/ @@ -424,9 +425,9 @@ CDeviceNode::SetFlags( { DevInstallParams.Flags |= Flags; DevInstallParams.FlagsEx |= FlagsEx; - return SetupDiSetDeviceInstallParamsW(m_hDevInfo, - &m_DevinfoData, - &DevInstallParams); + return (SetupDiSetDeviceInstallParamsW(m_hDevInfo, + &m_DevinfoData, + &DevInstallParams) != 0); } return false; } @@ -445,9 +446,9 @@ CDeviceNode::RemoveFlags( { DevInstallParams.Flags &= ~Flags; DevInstallParams.FlagsEx &= ~FlagsEx; - return SetupDiSetDeviceInstallParamsW(m_hDevInfo, - &m_DevinfoData, - &DevInstallParams); + return (SetupDiSetDeviceInstallParamsW(m_hDevInfo, + &m_DevinfoData, + &DevInstallParams) != 0); } return false; } diff --git a/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp b/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp index d314f96ae15..ba6cae94429 100644 --- a/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp +++ b/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp @@ -19,6 +19,7 @@ #define CLASS_DESC_LEN 256 #define ROOT_NAME_SIZE MAX_COMPUTERNAME_LENGTH + 1 +extern "C" { INT_PTR WINAPI DevicePropertiesExW( @@ -28,7 +29,7 @@ DevicePropertiesExW( IN DWORD dwFlags OPTIONAL, IN BOOL bShowDevMgr ); - +} typedef INT_PTR(WINAPI *pDevicePropertiesExW)(HWND,LPCWSTR,LPCWSTR,DWORD,BOOL); struct RefreshThreadData @@ -214,7 +215,7 @@ CDeviceView::Refresh( // Node gets deleted on refresh so we copy it to another block size_t Length = wcslen(DeviceId) + 1; ThreadData->DeviceId = new WCHAR[Length]; - wcscpy_s(ThreadData->DeviceId, Length, DeviceId); + StringCbCopyW(ThreadData->DeviceId, Length, DeviceId); } @@ -458,7 +459,6 @@ CDeviceView::ListDevicesByType() HTREEITEM hTreeItem = NULL; GUID ClassGuid; INT ClassIndex; - LPTSTR DeviceId = NULL; BOOL bClassSuccess, bSuccess; // Start by adding the root node to the tree @@ -475,7 +475,7 @@ CDeviceView::ListDevicesByType() bool bClassUnknown = false; bool AddedParent = false; INT DeviceIndex = 0; - BOOL MoreItems; + bool MoreItems = false; // Get the cached class node ClassNode = GetClassNode(&ClassGuid); @@ -500,11 +500,11 @@ CDeviceView::ListDevicesByType() DeviceIndex, &DeviceInfoData); if (bSuccess == FALSE && GetLastError() == ERROR_NO_MORE_ITEMS) - MoreItems = FALSE; + MoreItems = false; if (bSuccess) { - MoreItems = TRUE; + MoreItems = true; // The unknown class handle contains all devices on the system, // and we're just looking for the ones with a null GUID diff --git a/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp b/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp index ef55d10d193..6f43b4f5c69 100644 --- a/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp +++ b/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp @@ -208,7 +208,7 @@ CMainWindow::UpdateStatusBar( bool CMainWindow::RefreshView(ViewType Type) { - UINT CheckId; + UINT CheckId = 0; BOOL bSuccess; // Refreshed the cached view @@ -312,7 +312,7 @@ CMainWindow::CreateStatusBar() return bRet; } -void CMainWindow::UpdateToolbar(_In_ LPTV_ITEMW TvItem) +void CMainWindow::UpdateToolbar() { WORD State; @@ -466,14 +466,12 @@ CMainWindow::OnNotify(LPARAM lParam) { case TVN_SELCHANGED: { - LPNMTREEVIEW NmTreeView = (LPNMTREEVIEW)lParam; - UpdateToolbar(&NmTreeView->itemNew); + UpdateToolbar(); break; } case NM_DBLCLK: { - LPNMTREEVIEW NmTreeView = (LPNMTREEVIEW)lParam; m_DeviceView->DisplayPropertySheet(); break; } @@ -531,7 +529,7 @@ CMainWindow::OnContext(LPARAM lParam) LRESULT CMainWindow::OnCommand(WPARAM wParam, - LPARAM lParam) + LPARAM /*lParam*/) { LRESULT RetCode = 0; WORD Msg; @@ -792,9 +790,9 @@ HANDLE ProcessHeap = NULL; BOOL WINAPI -DeviceManager_ExecuteW(HWND hWndParent, +DeviceManager_ExecuteW(HWND /*hWndParent*/, HINSTANCE hInst, - LPCWSTR lpMachineName, + LPCWSTR /*lpMachineName*/, int nCmdShow) { CMainWindow MainWindow; diff --git a/reactos/dll/win32/devmgr/devmgmt/MainWindow.h b/reactos/dll/win32/devmgr/devmgmt/MainWindow.h index b4920c6313b..75027b96a8b 100644 --- a/reactos/dll/win32/devmgr/devmgmt/MainWindow.h +++ b/reactos/dll/win32/devmgr/devmgmt/MainWindow.h @@ -46,7 +46,6 @@ private: bool CreateStatusBar(); void UpdateToolbar( - _In_ LPTV_ITEMW TvItem ); bool StatusBarLoadString( diff --git a/reactos/dll/win32/devmgr/devmgmt/Node.cpp b/reactos/dll/win32/devmgr/devmgmt/Node.cpp index 5d1d5efa193..6e3b09911e5 100644 --- a/reactos/dll/win32/devmgr/devmgmt/Node.cpp +++ b/reactos/dll/win32/devmgr/devmgmt/Node.cpp @@ -2,7 +2,7 @@ * PROJECT: ReactOS Device Manager * LICENSE: GPL - See COPYING in the top level directory * FILE: dll/win32/devmgr/devmgr/node.cpp -* PURPOSE: Object for each device in the tree +* PURPOSE: Abstract base object for each node in the tree * COPYRIGHT: Copyright 2015 Ged Murphy * */ diff --git a/reactos/dll/win32/devmgr/devmgmt/Node.h b/reactos/dll/win32/devmgr/devmgmt/Node.h index bea3840018d..b200ba68d39 100644 --- a/reactos/dll/win32/devmgr/devmgmt/Node.h +++ b/reactos/dll/win32/devmgr/devmgmt/Node.h @@ -34,11 +34,6 @@ public: LPWSTR GetDisplayName() { return m_DisplayName; } INT GetClassImage() { return m_ClassImage; } LPWSTR GetDeviceId() { return m_DeviceId; } - bool HasProperties() { return (m_DeviceId != NULL); } - -private: - void Cleanup(); - }; diff --git a/reactos/dll/win32/devmgr/devmgmt/RootNode.cpp b/reactos/dll/win32/devmgr/devmgmt/RootNode.cpp index ba1fc80f528..05be76ddd8e 100644 --- a/reactos/dll/win32/devmgr/devmgmt/RootNode.cpp +++ b/reactos/dll/win32/devmgr/devmgmt/RootNode.cpp @@ -53,7 +53,7 @@ CRootNode::SetupNode() // The root name is the computer name DWORD Size = DISPLAY_NAME_LEN; if (GetComputerNameW(m_DisplayName, &Size)) - _wcslwr_s(m_DisplayName); + _wcslwr(m_DisplayName); return true; diff --git a/reactos/dll/win32/devmgr/devmgmt/stdafx.h b/reactos/dll/win32/devmgr/devmgmt/stdafx.h index e233e57063c..8802296384d 100644 --- a/reactos/dll/win32/devmgr/devmgmt/stdafx.h +++ b/reactos/dll/win32/devmgr/devmgmt/stdafx.h @@ -1,6 +1,6 @@ #pragma once -#ifndef __REACTOS___ +#ifndef __REACTOS__ #define WIN32_LEAN_AND_MEAN #include @@ -13,16 +13,20 @@ #include #include + #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #include #include #include #include +#include #else -#include +#include +#include +#include #include #include #include @@ -33,18 +37,17 @@ #include #include #include - -#include -#include +#include +#include #include #include #include #include +#include #include -#include -#include #include +#include #endif \ No newline at end of file