2015-07-04 21:12:06 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Device Manager
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2015-10-15 17:21:37 +00:00
|
|
|
* FILE: dll/win32/devmgr/devmgmt/RootNode.cpp
|
2015-07-04 21:12:06 +00:00
|
|
|
* PURPOSE: Root object for
|
|
|
|
* COPYRIGHT: Copyright 2015 Ged Murphy <gedmurphy@reactos.org>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-10-15 17:21:37 +00:00
|
|
|
#include "precomp.h"
|
2015-07-04 21:12:06 +00:00
|
|
|
#include "devmgmt.h"
|
|
|
|
#include "RootNode.h"
|
|
|
|
|
|
|
|
|
|
|
|
CRootNode::CRootNode(_In_ PSP_CLASSIMAGELIST_DATA ImageListData) :
|
|
|
|
CNode(RootNode, ImageListData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CRootNode::~CRootNode()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
CRootNode::SetupNode()
|
|
|
|
{
|
|
|
|
|
|
|
|
// Load the bitmap we'll be using as the root image
|
|
|
|
HBITMAP hRootImage;
|
2015-10-15 17:21:37 +00:00
|
|
|
hRootImage = LoadBitmapW(g_hThisInstance,
|
|
|
|
MAKEINTRESOURCEW(IDB_ROOT_IMAGE));
|
2017-02-19 19:40:04 +00:00
|
|
|
if (hRootImage == NULL)
|
|
|
|
return false;
|
2015-07-04 21:12:06 +00:00
|
|
|
|
|
|
|
// Add this bitmap to the device image list. This is a bit hacky, but it's safe
|
|
|
|
m_ClassImage = ImageList_Add(m_ImageListData->ImageList,
|
|
|
|
hRootImage,
|
|
|
|
NULL);
|
|
|
|
DeleteObject(hRootImage);
|
|
|
|
|
|
|
|
|
|
|
|
// Get the root instance
|
|
|
|
CONFIGRET cr;
|
|
|
|
cr = CM_Locate_DevNodeW(&m_DevInst,
|
|
|
|
NULL,
|
|
|
|
CM_LOCATE_DEVNODE_NORMAL);
|
|
|
|
if (cr != CR_SUCCESS)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The root name is the computer name
|
|
|
|
DWORD Size = DISPLAY_NAME_LEN;
|
2016-01-08 21:14:13 +00:00
|
|
|
GetComputerNameW(m_DisplayName, &Size);
|
2015-07-04 21:12:06 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|