#include <ntddk.h>
void DriverUnload(PDRIVER_OBJECT pDriverObject)
{
DbgPrint("Driver unloading\n");
}
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
int val;
DriverObject->DriverUnload = DriverUnload;
__asm {
mov ax, 0x8000;
or al, 0;
shl eax, 16;
mov ax, 0;
shl ax, 11;
mov al, 0;
or ah, al;
mov al, 0;
cli;
mov dx, 0x0CF8;
out dx, eax;
mov dx, 0x0CFC;
in eax, dx;
sti;
mov val, eax;
}
/*
READ VENDOR AND DEVICE ID
mov ax, 8000h ; set top bit
or al, 0 ; bus 0
shl eax, 16
mov ax, 0 ; device 0
shl ax, 11 ; slide device # up to bits 15:11
mov al, 0 ; function 0
or ah, al ; add function into bits 10:8
mov al, 0 ; read registers 0, 1 (vendor ID)
cli
mov dx, 0cf8h ; PCI index
out dx, eax ; send the request
mov dx, 0cfc ; PCI data
in eax, dx
sti
EAX = device ID (upper 16 bits)
AX = vendor ID
*/
DbgPrint("Hello, World\n");
DbgPrint("%x\n", val);
return STATUS_SUCCESS;
}