Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. g++ -o testPorts.exe testPorts.cpp -lsetupapi -mwindows
  2.  
  3. #include (Left Carat)windows.h>
  4. #include (Left Carat)initguid.h>
  5. #include (Left Carat)devguid.h>
  6. #include (Left Carat)setupapi.h>
  7. #include (Left Carat)stdio.h>
  8.  
  9.  
  10. int main() {
  11. SP_DEVINFO_DATA devInfoData = {};
  12. devInfoData.cbSize = sizeof(devInfoData);
  13.  
  14. // Get port info tree:
  15. HDEVINFO hDeviceInfo = SetupDiGetClassDevs( &GUID_DEVCLASS_PORTS,
  16. 0,
  17. NULL,
  18. DIGCF_PRESENT
  19. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement