On a windows machine I need to be able to generate a Device Interface Path (DIP - my acronym) for a device that exists on a machine.
Node Re^3: WindowsRegistry{ServiceName} V.S. wmic{ServiceName} describes how you can get the DIP (labeled ServiceName), when the device appears in the registry (many thanks to all the monks who showed this to me). This node also shows you how to see all the devices (including the ones with no entry in the registry) using the "wmic nic list brief" command (thanks to goibhniu for this one).
How can you get a DIP for a devices not appearing in the registry?
Here's how to do this with the Windows Driver calls SetupDiGetClassDevs, SetupDiEnumDeviceInterfaces, and SetupDiGetDeviceInterfaceDetail (please excuse my license with syntax here...):
What you end up with in $DevDetails is described here (the thing we're trying to get is labeled DevicePath).$DevInfoSet = SetupDiGetClassDevs(...); $DevInterfaceData = SetupDiEnumDeviceInterfaces($DevInfoSet); $DevDetails = SetupDiGetDeviceInterfaceDetail_($DevInfoSet, $DevInterf +aceData);
Two questions:
1.) Is there a way to do this in perl?
2.) Is there a different/better way to do this in perl?
Thanks for letting me stand on the shoulders of giants!
-Craig
UPDATE: In reply to Generating a windows Device Interface Path in perl? SOLVED!
by cmv
Using the wmic.exe command, you can get the information as follows:
The GUID value is $SettingID, so the path would be:
For:
Use:
& & < < > > [ [ ] ]