-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhwid.c
More file actions
38 lines (31 loc) · 1013 Bytes
/
Copy pathhwid.c
File metadata and controls
38 lines (31 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* hwid.c — Hardware ID collection orchestrator.
*
* All collector implementations live in utils/hwid/*.c.
* This file only dispatches CMD_HWID_COLLECT.
*/
#include <ntifs.h>
#include <ntddk.h>
#include "edr_shared.h"
#include "core.h"
#include "utils/hwid/hwid_internal.h"
NTSTATUS HwidHandleCommand(_Inout_ PRING_MESSAGE Msg)
{
if (sizeof(HWID_RESULT) > RING_DATA_SIZE)
return STATUS_BUFFER_TOO_SMALL;
PHWID_RESULT result = (PHWID_RESULT)Msg->Data;
RtlZeroMemory(result, sizeof(HWID_RESULT));
HwidCollectSmbios(result);
HwidCollectCpu(result);
HwidCollectVolume(result);
HwidCollectDisk(result);
HwidCollectMac(result);
HwidCheckFilterStack(result);
HV_DETECTION_RESULT hvResult;
HwidDetectHypervisor(&hvResult);
if (hvResult.CpuidBit31 || hvResult.TimingDetected)
result->Flags |= HWID_FLAG_HV_DETECTED;
HwidComputeHmac(result, CommGetSessionKey(), 32);
Msg->DataLength = sizeof(HWID_RESULT);
return STATUS_SUCCESS;
}