MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / ParseTableEntry

Method ParseTableEntry

WinArk/ProcessHandleTable.cpp:106–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106int CProcessHandleTable::ParseTableEntry(CString& s, char& mask, int& select, std::shared_ptr<WinSys::HandleInfo>& info, int column) {
107 switch (column) {
108 case 0: // type
109 s = m_ObjMgr.GetType(info->ObjectTypeIndex)->TypeName.c_str();
110 break;
111 case 1: // address
112 s.Format(L"0x%p", info->Object);
113 break;
114 case 2: // name
115 if (info->HandleAttributes & 0x8000)
116 s = info->Name.c_str();
117 else {
118 s = m_ObjMgr.GetObjectName(UlongToHandle(info->HandleValue), info->ProcessId, info->ObjectTypeIndex).c_str();
119 info->Name = s;
120 info->HandleAttributes |= 0x8000;
121 }
122 break;
123 case 3: // handle
124 s.Format(L"%d (0x%X)", info->HandleValue, info->HandleValue);
125 break;
126 case 4: // process name
127 s = m_ProcMgr.GetProcessNameById(info->ProcessId).c_str();
128 break;
129 case 5: // PID
130 s.Format(L"%d (0x%X)", info->ProcessId, info->ProcessId);
131 break;
132 case 6: // attributes
133 s.Format(L"%s (%d)", (PCWSTR)HandleAttributesToString(info->HandleAttributes),info->HandleAttributes & 0x7fff);
134 break;
135
136 case 7: // access mask
137 s.Format(L"0x%08X", info->GrantedAccess);
138 break;
139
140 case 8: // decoded access mask
141 s = AccessMaskDecoder::DecodeAccessMask(m_ObjMgr.GetType(info->ObjectTypeIndex)->TypeName.c_str(), info->GrantedAccess);
142 break;
143
144 case 9: // details
145 if (::GetTickCount64() > m_TargetUpdateTime || m_DetailsCache.find(info.get()) == m_DetailsCache.end()) {
146 auto h = m_ObjMgr.DupHandle(ULongToHandle(info->HandleValue), info->ProcessId, info->ObjectTypeIndex);
147 if (h) {
148 auto type = ObjectTypeFactory::CreateObjectType(info->ObjectTypeIndex, ObjectManager::GetType(info->ObjectTypeIndex)->TypeName.c_str());
149 s = type ? type->GetDetails(h) : CString();
150 m_DetailsCache[info.get()] = s;
151 ::CloseHandle(h);
152 }
153 m_TargetUpdateTime = ::GetTickCount64() + 5000;
154 }
155 else {
156 s = m_DetailsCache[info.get()];
157 }
158 break;
159 }
160 return s.GetLength();
161}
162
163

Callers

nothing calls this directly

Calls 7

GetProcessNameByIdMethod · 0.80
GetTypeMethod · 0.45
GetObjectNameMethod · 0.45
endMethod · 0.45
DupHandleMethod · 0.45
GetDetailsMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected