- last few fixes to the device manager code to get it building with rosbe (msvc)
- Next steps are to merge it with the existing devmgr code (mostly done in my WC) and get it running via mmc.exe & devmgmt.msc

svn path=/trunk/; revision=68367
This commit is contained in:
Ged Murphy 2015-07-07 11:05:25 +00:00
parent ae313a0aee
commit e60f09bacc
9 changed files with 34 additions and 38 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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;

View file

@ -46,7 +46,6 @@ private:
bool CreateStatusBar();
void UpdateToolbar(
_In_ LPTV_ITEMW TvItem
);
bool StatusBarLoadString(

View file

@ -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 <gedmurphy@reactos.org>
*
*/

View file

@ -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();
};

View file

@ -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;

View file

@ -1,6 +1,6 @@
#pragma once
#ifndef __REACTOS___
#ifndef __REACTOS__
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@ -13,16 +13,20 @@
#include <devguid.h>
#include <process.h>
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include <tchar.h>
#include <atlbase.h>
#include <atlstr.h>
#include <atlcoll.h>
#include <strsafe.h>
#else
#include <tchar.h>
#include <string.h>
#include <wchar.h>
#include <tchar.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
@ -33,18 +37,17 @@
#include <shlwapi.h>
#include <strsafe.h>
#include <process.h>
#include <string.h>
#include <wchar.h>
#include <WindowsX.h>
#include <strsafe.h>
#include <setupapi.h>
#include <commctrl.h>
#include <cfgmgr32.h>
#include <Uxtheme.h>
#include <devguid.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atlstr.h>
#include <atlcoll.h>
#endif