SHARE
TWEET

Untitled

a guest Jun 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. std::size_t bufferSize = 5000;
  2.     char* target_path_buffer = new char[bufferSize];
  3.  
  4.     DWORD rc = 0;
  5.     std::string com_prefix("COM");
  6.  
  7.     for(int i=0; i < 255; i++) {
  8.       std::string ComName = com_prefix + std::to_string(i);
  9.       rc = QueryDosDevice(ComName.c_str(),
  10.                           (LPSTR) target_path_buffer,
  11.                           (DWORD) bufferSize);
  12.       if(rc != 0) {
  13.         log->info("Com port found at {} with name {}", ComName, target_path_buffer);
  14.       }
  15.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top