Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::size_t bufferSize = 5000;
- char* target_path_buffer = new char[bufferSize];
- DWORD rc = 0;
- std::string com_prefix("COM");
- for(int i=0; i < 255; i++) {
- std::string ComName = com_prefix + std::to_string(i);
- rc = QueryDosDevice(ComName.c_str(),
- (LPSTR) target_path_buffer,
- (DWORD) bufferSize);
- if(rc != 0) {
- log->info("Com port found at {} with name {}", ComName, target_path_buffer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement