Folks-

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...):

$DevInfoSet = SetupDiGetClassDevs(...); $DevInterfaceData = SetupDiEnumDeviceInterfaces($DevInfoSet); $DevDetails = SetupDiGetDeviceInterfaceDetail_($DevInfoSet, $DevInterf +aceData);
What you end up with in $DevDetails is described here (the thing we're trying to get is labeled DevicePath).

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:
Using the wmic.exe command, you can get the information as follows:

wmic nicconfig list /format:value
The GUID value is $SettingID, so the path would be:
//./$SettingID

In reply to Generating a windows Device Interface Path in perl? SOLVED! by cmv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.