I have made the required changes:
1. IoCreateDevice, IoRegisterDeviceInterface, and other related things have
been removed from the DriverEntry function.
2. In the AddDevice function (after the PcAddAdapterDevice function call) I
call IoRegisterDeviceInterface and IoSetDeviceInterfaceState, as follows:
// Where DeviceRef is "CUSTOM_DEV", DeviceName is "\\Devices\\CUSTOM_DEV".
ntStatus = IoSetDeviceInterfaceState(&DeviceName, TRUE);
After that, I got a symbolic link using CM_Get_Device_Interface_List:
Unfortunately, I couldn't open the file via the symbolic link mentioned
above (error description: "The system cannot find the file specified").
I'm sorry If I got something wrong from your previous explanations.
P.S. In this article, I found an example of adding the IO device as an
do you think about this? Is it the wrong way?
On Tue, Jun 16, 2020 at 10:57 AM Tim Roberts <timr@xxxxxxxxx> wrote:
On Jun 15, 2020, at 8:32 PM, Oleg Vorobiov <isnullxbh@xxxxxxxxx> wrote:
I usually register my own device interface in the audio driverAre you talking about the IoRegisterDeviceInterface function?
I thought that I could register an additional IO device and use it for
writing audio data to the driver. I was trying to register an IO device as
follows (after PcInitializeAdapterDriver call in the DriverEntry function):
1. IoCreateDevice(DriverObject, ...)
2. IoRegisterDeviceInterface(DeviceObject, &PID_MSVAD, ...)
4. IoCreateSymbolicLink(&DosDeviceName, $DeviceName)
but I got a failure in step 2.
It is not necessary to create another device. In fact, it will cause
problems. Remember, you need the device context from the original device
in order to get access to the data. (I assume you aren’t using globals.)
You really want the same device.
IoRegisterDeviceInterface only works with PnP devices. Your
IoCreateDevice call is creating a non-PnP device. That’s why it failed.
Also remember that IoRegisterDeviceInterface needs to be passed a PDO, not
an FDO, for reasons that aren’t clear to me. You get your PDO in AddDevice.
In summary, I'm not sure that I understand correctly how to write data
from a user-space application to the driver based on 'micarray’.
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.