I looked what happens under debugger and it does find the key. First call to RegQueryValueEx returns ERROR_SUCCESS but data size returened ( 2) is unexpected. So problem is somewhere in getting value.
AFAIK this key is set by the system and user should not be able to change it. Alex On Tue, Oct 1, 2013 at 6:26 PM, Tony Rietwyk <t...@rightsoft.com.au> wrote: > Hi Alex, **** > > ** ** > > It certainly looks like it should be found. It reminds of a security > issue where similar looking unicode characters in folder names were used to > scam people. Can you hex dump the characters of each entry in your loop? > Maybe you have a virus that has done something similar? Or maybe there is > an embedded NULL character? **** > > ** ** > > Hope that helps, **** > > ** ** > > Tony**** > > ** ** > > ** ** > > ** ** > > *Sent:* Tuesday, 1 October 2013 12:02 PM > > Just want to add that key is found,**** > > > qDebug() << "child keys = " << reg.childKeys();**** > > result in**** > > > child keys = ("Common Administrative Tools", "Common AppData", "Common > Desktop", "Common Documents", "Common Programs", "Common Start Menu", > "Common Startup", "Common Templates", "CommonMusic", "CommonPictures", > "CommonVideo", "OEM Links", "Personal") > > but value returned is empty string - different from visible in regedit *** > * > > Alex**** > > ** ** > > On Mon, Sep 30, 2013 at 6:24 PM, Alex Malyushytskyy <alexmal...@gmail.com> > wrote:**** > > I found a problem with QSettings when trying to read from registry. > I am using Qt 4.7.3 so I would appreciate if anybody can check with Qt 5 > at least. **** > > Problem:**** > > QSettings fails to return specific key value (Common AppData) when read > other keys at the same level just fine.**** > > Key exists and verified with regedit.**** > > Test case is below:**** > > > #include <QApplication> > #include <QSettings> > #include <QDebug> > > void ddd2(); > > int main(int argc, char *argv[]) > {**** > > // execute test and return**** > > QApplication a(argc, argv);**** > > ddd2();**** > > ** ** > > return 0;**** > > } > > void ddd2() > { > QSettings > reg("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell > Folders", > QSettings::NativeFormat); > QString key; > QString val; > > key = QString("Common AppData"); > val = QString ( reg.value(key).toString()); > qDebug() << "key: " << key << " value: " << val; > > key = QString("Common Desktop"); > val = QString ( reg.value(key).toString()); > qDebug() << "key: " << key << " value: " << val; > > key = QString("Common Documents"); > val = QString ( reg.value(key).toString()); > qDebug() << "key: " << key << " value: " << val; > }**** > > Output:**** > > > key: "Common AppData" value: "" > key: "Common Desktop" value: "C:\Users\Public\Desktop" > key: "Common Documents" value: "C:\Users\Public\Documents" **** > > Expected > * WinXP: "c:\Documents and Settings\All Users\Application Data" > * WinV/7/8: "c:\ProgramData" > > **** > > Regards,**** > > Alex**** > > ** ** > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest