yun93us / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

On Windows7, QextSerialEnumerator::getPorts() occur debug break. #158

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Which version of QextSerialPort are you using?
qextserialport-1.2rc

What steps will reproduce the problem?
1. QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
2. run debugger
3. debug breaked on qextserialenumerator_win.cpp line 148. ( getRegKeyValue() )

What is the expected output? What do you see instead?
I want to run normaly, do not want debug break.
OR inform  to qextserailport library user.

What version of the product are you using? On what operating system?
Windows7

Please provide any additional information below.

On Windows7 SetupDiOpenDevRegKey() return INVALID_HANDLE_VALUE,  this API need 
administrator privilage. As a result,  RegCloseKey() fail, on getRegKeyValue().
( RegCloseKey() is fault line.  )

Original issue reported on code.google.com by sungjoo....@gmail.com on 23 Jan 2013 at 8:00

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Same problem, debbuger breaks when trying to get the registry key with invalid 
key.

I temporarily fixed with this code in  getDeviceDetailsWin() function:

    HKEY devKey = ::SetupDiOpenDevRegKey(devInfo, devData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_QUERY_VALUE);
    if (devKey == INVALID_HANDLE_VALUE) {
        return false;
    }

Original comment by ivanme...@gmail.com on 30 Apr 2013 at 6:27