bool MemLabel::GetMemoryLabelFromVA(u32 p_va, s8* p_label) { // 範囲外 if (m_va > p_va || m_va + GetSize() <= p_va) { return false; } // p_vaから構造体のラベルを構成する u32 str_size = GetStructureSize(); u32 array_idx = (p_va - m_va) / str_size; u32 diff = (p_va - m_va) % str_size; int elem_idx = -1; int pos = 0; for (u32 i = 0; i < m_elem_ary.size(); i++) { if (diff < pos + m_elem_ary[i]->size) { elem_idx = i; diff -= pos; break; } else { pos += m_elem_ary[i]->size; } } sprintf(p_label, "@m "); char tmp[256]; // 配列なら要素番号を付加 if (m_count > 1) { sprintf(tmp, "&%s[%d]", m_text, array_idx); } else { sprintf(tmp, "%s", m_text); } strcat(p_label, tmp); // 複数メンバならメンバ名を付加 if (m_elem_ary.size() > 1) { sprintf(tmp, ".%s", m_elem_ary[elem_idx]->label); strcat(p_label, tmp); } // ラベルとの差額表示 if (diff > 0) { sprintf(tmp, "+%d", diff); strcat(p_label, tmp); } strcat(p_label, "@w"); return true; }
// // Gets statistics from the driver such as number of randomized DLLs, the // current subsystem status, and other such things. // DWORD DriverClient::GetStatistics( IN HANDLE Driver, OUT PWEHNTRUST_STATISTICS Statistics) { DWORD Returned; DWORD Result = ERROR_SUCCESS; if (!DeviceIoControl( Driver, IOCTL_WEHNTRUST_GET_STATISTICS, NULL, 0, Statistics, GetStructureSize(Statistics), &Returned, NULL)) Result = GetLastError(); return Result; }