Created
April 27, 2024 08:38
-
-
Save clod81/ec277831a68c5ad242fa801fa74e556c to your computer and use it in GitHub Desktop.
Windows C program to find the addresses of kernel drivers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <psapi.h> | |
#include <stdio.h> | |
void main() { | |
LPVOID DriverBases[1024]; | |
CHAR DriverName[100]; | |
DWORD Needed; | |
ULONG i, DriverCount; | |
if (!EnumDeviceDrivers(DriverBases, sizeof(DriverBases), &Needed) || (Needed >= sizeof(DriverBases))) { | |
printf("nope\n"); | |
return; | |
} | |
DriverCount = Needed / sizeof(DriverBases[0]); | |
printf("driver count %i\n", DriverCount); | |
for (i = 0; i < DriverCount; i++) { | |
if (!GetDeviceDriverBaseNameA(DriverBases[i], DriverName, sizeof(DriverName))) { | |
continue; | |
} | |
printf("driver name %s - %p\n", DriverName, DriverBases[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment