[DEVMGR]
[reactos.git] / reactos / dll / win32 / devmgr / devmgmt / RootNode.cpp
1 /*
2 * PROJECT: ReactOS Device Manager
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/win32/devmgr/devmgmt/RootNode.cpp
5 * PURPOSE: Root object for
6 * COPYRIGHT: Copyright 2015 Ged Murphy <gedmurphy@reactos.org>
7 *
8 */
9
10 #include "precomp.h"
11 #include "devmgmt.h"
12 #include "RootNode.h"
13
14
15 CRootNode::CRootNode(_In_ PSP_CLASSIMAGELIST_DATA ImageListData) :
16 CNode(RootNode, ImageListData)
17 {
18 }
19
20
21 CRootNode::~CRootNode()
22 {
23 }
24
25
26 bool
27 CRootNode::SetupNode()
28 {
29
30 // Load the bitmap we'll be using as the root image
31 HBITMAP hRootImage;
32 hRootImage = LoadBitmapW(g_hThisInstance,
33 MAKEINTRESOURCEW(IDB_ROOT_IMAGE));
34 if (hRootImage == NULL)
35 return false;
36
37 // Add this bitmap to the device image list. This is a bit hacky, but it's safe
38 m_ClassImage = ImageList_Add(m_ImageListData->ImageList,
39 hRootImage,
40 NULL);
41 DeleteObject(hRootImage);
42
43
44 // Get the root instance
45 CONFIGRET cr;
46 cr = CM_Locate_DevNodeW(&m_DevInst,
47 NULL,
48 CM_LOCATE_DEVNODE_NORMAL);
49 if (cr != CR_SUCCESS)
50 {
51 return false;
52 }
53
54 // The root name is the computer name
55 DWORD Size = DISPLAY_NAME_LEN;
56 GetComputerNameW(m_DisplayName, &Size);
57
58 return true;
59 }