Skip to content

Commit

Permalink
Driver: fix CPU model detection in MSR validation
Browse files Browse the repository at this point in the history
Previously, the functions defined in msr.c used a different copy of the machine_type
variable than those in driver.c, resulting in always incorrectly assuming an Intel CPU
even when an AMD CPU was successfully detected. By switching to an extern reference to
the static variable used by the driver, the CPU mode is again detected successfully.

Co-authored-by: Victorien Molle <[email protected]>
Signed-off-by: Chris Waldon <[email protected]>
  • Loading branch information
whereswaldon and Vic063 committed Feb 28, 2024
1 parent bc12fec commit a472cf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ScaphandreDrv/Driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#pragma alloc_text (INIT, DriverEntry)
#endif

e_machine_type machine_type;

NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath)
{
Expand Down
2 changes: 1 addition & 1 deletion ScaphandreDrv/msr.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef enum {
}e_machine_type;


static e_machine_type machine_type;
extern e_machine_type machine_type;
static unsigned long max_processors;

int validate_msr_lookup(unsigned __int64 msrRegister);
Expand Down

0 comments on commit a472cf3

Please sign in to comment.