I am using MSVC++ and the SetupAPI(.h) and trying to call SetupDiGetClassDevsEx targeting a remote PC, which is failing with the error, "This function is not supported on this system." Importantly to note, this call (when not providing a remote PC name) works successfully (targeting my own PC.)
My code snippet is as follows:
HDEVINFO hDevInfo;
hDevInfo = SetupDiGetClassDevsEx(
0,
0,
0,
DIGCF_ALLCLASSES | DIGCF_PRESENT,
0,
L"TestPC",
0
);
if (hDevInfo == INVALID_HANDLE_VALUE)
{
wchar_t buffer[255];
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer,
255,
NULL);
}
MSDN doesn't make any mention of this method being deprecated and/or unavailable, but I have found conflicting evidence of it being available in Windows 7, but not in 8/8.1, and then maybe/maybe not available in Windows 10.
I have tried the following:
- Confirming I am running with an account as a local administrator on TestPC.
- Various FQDN-variations of "TestPC", including "\TestPC", "\TestPC.domain", "TestPC.domain", the IP address, etc.
- On the target PC, I've ensured that it is Domain-Joined and visible to my own PC, as well as available via RDP. I've ensured that "Plug and Play" and "Remote Registry" Services are enabled and running, as well as enabled Remote Administration, disabled the UAC completely, and ensured that "Allow remote access to the Computer Interface" under "Configuration/Administrative Templates/System/Device Installation" of Group Policy is enabled.
- I have tried to access the same system using DevCon.exe (from the Windows SDK tools), using the "devcon.exe /m:\TestPC listclasses" syntax (and others), which merely returns, "devcon failed."
- I accessed TestPC remotely using Device-Tool, which works successfully, but is leveraging WMI, which is not the Win32 SetupAPI I'm trying to use.
Am I missing something else that is critical to leveraging this function? Or, has this possibly been deprecated and/or no longer works, and MSDN hasn't been updated to reflect the change(s)?