Files
BeneficialCode-WinArk/WinArk/KeyObjectType.cpp
T
2021-05-26 21:47:17 +08:00

19 lines
526 B
C++

#include "stdafx.h"
#include "KeyObjectType.h"
#include "NtDll.h"
KeyObjectType::KeyObjectType(int index, PCWSTR name) : ObjectType(index, name) {
}
CString KeyObjectType::GetDetails(HANDLE hKey) {
CString details;
BYTE buffer[1 << 12];
ULONG len;
if (NT_SUCCESS(::NtQueryKey(hKey, KeyBasicInformation, buffer, sizeof(buffer), &len))) {
auto info = (KEY_BASIC_INFORMATION*)buffer;
details.Format(L"Last Write: %s",
(PCWSTR)CTime(*(FILETIME*)&info->LastWriteTime.QuadPart).Format(L"%D %X"));
}
return details;
}