samedi 6 janvier 2018

Indentifying COM device using Windows APIs

I connect to Arduino Uno R3 via a WinAPI handle.

std::string name = "COM5";
this->handle = CreateFile(name.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

How can I safely distinguish Arduino so I am not communating with something different or at least get its name, preferably without third party libraries? After a research I found several APIs (QueryDosDevice and NtQueryObject), however I don't know how can I implement those in my code.

Aucun commentaire:

Enregistrer un commentaire