nik12
June 26th, 2008, 11:36 AM
Messing with the kbfiltr example in the DDK
I need communicate with the driver, using CreateFile (and WriteFile)
here's some of the code (NOT ALL!!)
in DriverEntry
DriverObject->DriverExtension->AddDevice = KbFilter_AddDevice;
in KbFilter_AddDevice
status = IoCreateDevice(Driver,
sizeof(DEVICE_EXTENSION),
&usDriverName, // it's "\\Device\\KbFilter"
FILE_DEVICE_KEYBOARD,
FILE_DEVICE_SECURE_OPEN,
FALSE,
&device
);
IoCreateSymbolicLink(&usDosDeviceName, &usDriverName); // "\\DosDevices\\KbFilter" and "\\Device\\KbFilter"
Then in another c++ project
hFile = CreateFile("\\\\.\\KbFilter",
GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL);
hFile is -1 (an invalid handle)
GetLastError() returns 3 (path not found)
obviously the wrong part is "\\\\.\\KbFilter", and I found out that the actual filename is something like "\\\\.\\ACPI#PNP0303#4&5289e18&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}" (and I can't still access it, error 5, access denied)
I'm not into driver programming.
Is there something I'm missing, about the behaviour of filter drivers for example, or something i should include in the .inf file?
I need communicate with the driver, using CreateFile (and WriteFile)
here's some of the code (NOT ALL!!)
in DriverEntry
DriverObject->DriverExtension->AddDevice = KbFilter_AddDevice;
in KbFilter_AddDevice
status = IoCreateDevice(Driver,
sizeof(DEVICE_EXTENSION),
&usDriverName, // it's "\\Device\\KbFilter"
FILE_DEVICE_KEYBOARD,
FILE_DEVICE_SECURE_OPEN,
FALSE,
&device
);
IoCreateSymbolicLink(&usDosDeviceName, &usDriverName); // "\\DosDevices\\KbFilter" and "\\Device\\KbFilter"
Then in another c++ project
hFile = CreateFile("\\\\.\\KbFilter",
GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, 0, NULL);
hFile is -1 (an invalid handle)
GetLastError() returns 3 (path not found)
obviously the wrong part is "\\\\.\\KbFilter", and I found out that the actual filename is something like "\\\\.\\ACPI#PNP0303#4&5289e18&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}" (and I can't still access it, error 5, access denied)
I'm not into driver programming.
Is there something I'm missing, about the behaviour of filter drivers for example, or something i should include in the .inf file?