| 35 | } |
| 36 | |
| 37 | CString RegHelpers::GetObjectName(HANDLE hObeject, DWORD pid) { |
| 38 | auto h = SecurityHelper::DupHandle(hObeject, pid, KEY_QUERY_VALUE); |
| 39 | if (h) { |
| 40 | BYTE buffer[2048]; |
| 41 | auto status = NtQueryObject(h, |
| 42 | static_cast<OBJECT_INFORMATION_CLASS>(ObjectNameInformation), |
| 43 | buffer, sizeof(buffer), nullptr); |
| 44 | ::CloseHandle(h); |
| 45 | if (STATUS_SUCCESS == status) { |
| 46 | auto str = reinterpret_cast<UNICODE_STRING*>(buffer); |
| 47 | return CString(str->Buffer, str->Length / sizeof(WCHAR)); |
| 48 | } |
| 49 | } |
| 50 | return L""; |
| 51 | } |
| 52 | |
| 53 | |
| 54 | CString RegHelpers::GetErrorText(DWORD error) { |
no outgoing calls
no test coverage detected