code :
#include <ntifs.h>
#include <intrin.h>
#define MSR_VM_CR 0xC0010114 // MSR pour le contrôle de SVM (AMD-V)
#define MSR_VM_HSAVE_PA 0xC0010117 // MSR pour l'adresse de sauvegarde SVM
// Fonction pour vérifier si AMD-V (SVM) est activé
BOOLEAN IsSvmEnabled()
{
// Lire le registre MSR_VM_CR
ULONG64 msr = __readmsr(MSR_VM_CR);
// Vérifie si le bit 4 (SVM_DISABLE) est désactivé
if (!(msr & (1 << 4)))
{
KdPrint(("AMD-V (SVM) is enabled.\n"));
return TRUE;
}
else
{
KdPrint(("Error: AMD-V (SVM) is disabled in the BIOS.\n"));
return FALSE;
}
}
// Fonction pour générer un ID aléatoire pour le CPU
ULONG64 GenerateRandomProcessorId()
{
LARGE_INTEGER seed;
KeQuerySystemTime(&seed);
return seed.QuadPart ^ __rdtsc();
}
// Fonction principale du driver
extern "C" NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
UNREFERENCED_PARAMETER(RegistryPath);
KdPrint(("*** DRIVER LOADED: AMD-V Spoofer Initialized ***\n"));
// Vérification de SVM (AMD-V) via CPUID
int cpuInfo[4] = { 0 };
__cpuid(cpuInfo, 0x80000001); // Leaf 0x80000001 contient les infos sur AMD-V
if (!(cpuInfo[2] & (1 << 2))) // Bit 2 d'ECX pour SVM
{
KdPrint(("Error: AMD-V (SVM) is not supported on this CPU.\n"));
return STATUS_NOT_SUPPORTED;
}
// Vérifie si AMD-V est activé
if (!IsSvmEnabled())
{
KdPrint(("Error: AMD-V (SVM) is supported but not enabled in BIOS.\n"));
return STATUS_UNSUCCESSFUL;
}
// Simulation du spoofing en générant un ID aléatoire
ULONG64 spoofedProcessorId = GenerateRandomProcessorId();
KdPrint(("Spoofed ProcessorId: 0x%llX\n", spoofedProcessorId));
// TODO : Étendre pour implémenter le spoof complet ici
// Définir la fonction de déchargement du driver
DriverObject->DriverUnload = [](PDRIVER_OBJECT DriverObject) {
UNREFERENCED_PARAMETER(DriverObject);
KdPrint(("*** DRIVER UNLOADED: AMD-V Spoofer Stopped ***\n"));
};
return STATUS_SUCCESS;
}
Hi, why is nothing displayed in the kernel logs?