Reactos
at master 77 lines 2.4 kB view raw
1/* 2* PROJECT: ReactOS Device Manager 3* LICENSE: GPL - See COPYING in the top level directory 4* FILE: dll/win32/devmgr/devmgmt/ResourceNode.cpp 5* PURPOSE: Class object for 6* COPYRIGHT: Copyright 2025 Eric Kohl <ekohl@reactos.org> 7* 8*/ 9 10#include "precomp.h" 11#include "restypes.h" 12#include "devmgmt.h" 13#include "ResourceNode.h" 14 15 16CResourceNode::CResourceNode( 17 _In_ CDeviceNode *Node, 18 _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, 19 _In_ PSP_CLASSIMAGELIST_DATA ImageListData 20 ) : 21 CNode(ResourceNode, ImageListData) 22{ 23 WCHAR szDetail[200]; 24 WCHAR szDescription[100]; 25 ULONG ulLength; 26 27 m_DeviceId = Node->GetDeviceId(); 28 m_ClassImage = Node->GetClassImage(); 29 30 ulLength = sizeof(szDescription); 31 CM_Get_DevNode_Registry_PropertyW(Node->GetDeviceInst(), 32 CM_DRP_DEVICEDESC, 33 NULL, 34 szDescription, 35 &ulLength, 36 0); 37 38 if (Descriptor->Type == CmResourceTypeInterrupt) 39 { 40 wsprintf(szDetail, L"(%s) 0x%08x (%d) %s", 41 (Descriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED) ? L"ISA" : L"PCI", 42 Descriptor->u.Interrupt.Level, Descriptor->u.Interrupt.Vector, 43 szDescription); 44 StringCchCopyW(m_DisplayName, MAX_PATH, szDetail); 45 } 46 else if (Descriptor->Type == CmResourceTypePort) 47 { 48 wsprintf(szDetail, L"[%08lx - %08lx] %s", 49 Descriptor->u.Port.Start.LowPart, Descriptor->u.Port.Start.LowPart + Descriptor->u.Port.Length - 1, 50 szDescription); 51 StringCchCopyW(m_DisplayName, MAX_PATH, szDetail); 52 } 53 else if (Descriptor->Type == CmResourceTypeMemory) 54 { 55 wsprintf(szDetail, L"[%08I64x - %08I64x] %s", 56 Descriptor->u.Memory.Start.QuadPart, Descriptor->u.Memory.Start.QuadPart + Descriptor->u.Memory.Length - 1, 57 szDescription); 58 StringCchCopyW(m_DisplayName, MAX_PATH, szDetail); 59 } 60 else if (Descriptor->Type == CmResourceTypeDma) 61 { 62 wsprintf(szDetail, L"%08ld %s", Descriptor->u.Dma.Channel, szDescription); 63 StringCchCopyW(m_DisplayName, MAX_PATH, szDetail); 64 } 65} 66 67 68CResourceNode::~CResourceNode() 69{ 70} 71 72 73bool 74CResourceNode::SetupNode() 75{ 76 return true; 77}