@Tim_Roberts said:
Is it complaining aboutPZZSTR
, or aboutPZZWSTR
? If it is complaining about PZZSTR, then you have somehow mixed up your APIs, because it means you have the ANSICM_Get_Device_Interface_List
and the UnicodeCreateFile
. If it is complaining about PZZWSTR, then I will allow you to insert a cast to eliminate that warning. Just make sure the wprintf prints something readable.That GUID I have added in INF file.
Why? It doesn’t need to be there. And it’s STILL not your GUID.
It was complaining about PZZSTR that too inside CM_Get_Device_Interface_List ,
then I changed the variable DeviceInterfaceList type from PWSTR to LPTSTR
GUID guid = { 0x01ee4b4f, 0x6fb0, 0x4763, 0xa8, 0x43, 0x41, 0x55, 0x91, 0xf1, 0xf0, 0x1 };
CONFIGRET cr;
LPTSTR 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 ;
}
DeviceInterfaceList = (LPTSTR)HeapAlloc(//(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);
if (cr != CR_SUCCESS) {
wprintf(L"fail to get interface list\n");
return ;
}
printf("%s\n", DeviceInterfaceList);
HANDLE hDev = INVALID_HANDLE_VALUE;
hDev = CreateFile(
DeviceInterfaceList,//DeviceInterfaceList,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL
);
got DeviceInterfaceList as \?\ROOT#UNNAMED_DEVICE#0001#{01ee4b4f-6fb0-4763-a843-415591f1f001}
Is it fine , need your approval