@âPeter_Viscarola_(OSR)â said:
after that do I need to create call IoCreateSymbolicLink or not required
Not required.
IoRegisterDeviceInterface ⌠RPC_AUDIO_IOCTL
Is that actually a GUID? Thatâs a very strange name for a Device Interface GUID.
And WHERE do you want to access the device from? In user mode, you lookup the GUID using CM_Get_Device_Interface_List
None of the code that you posted makes much sense to me⌠I donât feel like Iâve got the full picture of what youâre trying to do, where, and howâŚ
Peter
DEFINE_GUIDSTRUCT(â4d36e96c-e325-11ce-bfc1-08002be10318â, RPC_IOCTL_AUDIO);
#define RPC_IOCTL_AUDIO DEFINE_GUIDNAMED(RPC_IOCTL_AUDIO)
in user application:
GUID guid = { 0x4d36e96c, 0xe325, 0x11ce, 0xbf, 0xc1, 0x8, 0x0, 0x2b, 0xe1, 0x3, 0x18 };
CONFIGRET cr;
// char* DevicePath = NULL;
PZZSTR DeviceInterfaceList = NULL;
ULONG DeviceInterfaceListLength = 0;
cr = CM_Get_Device_Interface_List_Size(
&DeviceInterfaceListLength,
&guid,
NULL,
CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES
);
if (cr != CR_SUCCESS) {
wprintf(L"fail to get interface list size\n");
return ;
}
// WCHAR DeviceInterfaceList[4096];
//DeviceInterfaceList = (PZZSTR)malloc(DeviceInterfaceListLength);
DeviceInterfaceList = (PZZSTR)HeapAlloc(
GetProcessHeap(),
HEAP_ZERO_MEMORY,
DeviceInterfaceListLength * sizeof(WCHAR));
if (DeviceInterfaceList == NULL) {
wprintf(L"allocate interface list buffer fail\n");
return ;
}
cr = CM_Get_Device_Interface_List(
&guid,
NULL,
DeviceInterfaceList,
DeviceInterfaceListLength,
CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
_tprintf(_T(â%s\nâ), (LPCSTR)DeviceInterfaceList);
HANDLE hDev = INVALID_HANDLE_VALUE;
hDev = CreateFile(
(LPCSTR)DeviceInterfaceList,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL
);
DeviceInterfaceList value is : ?\ROOT#MEDIA#0001#{4d36e96c-e325-11ce-bfc1-08002be10318}
but Createfile returns ERROR_FILE_NOT_FOUND//////need help on this