QtSettings not accessing HKEY_LOCAL_MACHINE - c++

I do not understand what I'm doing wrong here. It appears that my Qt Application will not retrieve the value from the HKEY_LOCAL_MACHINE
QSettings sys_app_settings(QSettings::NativeFormat, QSettings::SystemScope, "JokerMartini", "Hyv");
qDebug() << "SYS" << sys_app_settings.value("config", "").toString();
You can even see in the image below that i have the information available but it will not retrieve it for whatever reason. It just returns the default value of "" Any suggestions?
Build Information:
Windows 64bit
Desktop Qt 5.10.1 MinGW 32Bit
Running application on windows 10 64 bit

Related

osx: external program (qprocess) crash if parent run with open, but works fine if parent run directly

I faced the strange situation on MacOS 10.13 and can't find what is the root of it.
I have 32-bit Qt application packed in a bundle. Because of MacOS limitation for one of the operations I need to start small 64-bit console binary that does a trick. This console binary placed in Contents/MacOS and I start it using QProcess.
Everything works fine if I run the main application from IDE. Also, everything fine if I open a terminal, cd to Contents/MacOS and run the main application directly.
But once I use "open myApp.app" or start it via UI, then QProcess exitCode() returns 255, which seems to mean crash.
Code for starting subprocess:
QProcess p;
p.start("./papply", QStringList() << osid << filepath);
p.waitForFinished(5000);
qDebug() << p.readAllStandardOutput();
qDebug() << p.readAllStandardError();
qDebug() << p.state();
if(p.state()==QProcess::Running)
{
qDebug() << "peapply freezed - kill";
p.kill();
return false;
}
qDebug() << "Apply" << osid << filepath << "=" << p.exitCode();
return p.exitCode()==0;
Any help will be very appreciated.
I have 32-bit Qt application packed in a bundle.
Firstly, just in-case you missed this, Apple have stated that the next version of the OS (10.14) will not support 32-bit applications, so you'll need to change this if you want to run this application on future versions of macOS.
If you use the debugger, or run a binary from a bundle's Contents/MacOS folder, it executes directly. In contrast, if you double-click on a binary, or use the open keyword from the terminal, a request is sent to Launch Services, to open the application on your behalf.
Launch Services (LS) maintains an association to an application's Bundle Identifier, which is located in the application bundle's Info.plist file.
When a request to open an application with LS occurs, LS is presented with the Bundle Identifier, from the application's plist and LS will execute the application that has been registered, with that identifier.
In the plist, we also have the key CFBundleExecutable, which is defined as the "(Recommended) Name of the bundle's executable file". This is the name of the binary that will likely be executed, residing in the Contents/MacOS folder.
Note, since LS launches the application associated with the given identifier, if there is a copy of the same application on your machine, with the same version number and identifier, it may not be necessarily executing the application you double-clicked, to run.
Therefore, the reason for the crash is most likely due to a different application being launched by LS and not the one you think is being executed. Ensure you have no other copies of the application residing on the machine.
If a crash report is generated, you should be able to see the path to the application, at the start of the images section, where it includes paths to dynamic libraries and frameworks.
While #TheDarkKnight provided great information that is not exactly an answer.
For people who will face the same situation:
In macOS bundle application has working directory related to bundle, but not to the execution file itself as it happens in Windows.
So in my case next code works:
QString path = qApp->applicationDirPath();
if(!path.endsWith("/"))
path += "/";
QProcess p;
p.start(path + "papply", QStringList() << osid << filepath);

How do I set my application version for Windows in Qt?

When my application crashes, the Windows Event Viewer always reports my application version as "0.0.0.0".
I can't figure how to set the application version in a way that the Windows Event Viewer recognizes. Changing it with QApplication::setApplicationVersion() doesn't seem to do it.
Obviously there are better ways to debug a program than the Windows Crash Log, but in lieu of all of that, how would I go about setting this value so that Windows recognizes it? My IDE is Qt Creator.
You can set the VERSION qmake variable in your pro file:
VERSION = 1.0.0.0
On Windows, triggers auto-generation of an .rc file if the RC_FILE and
RES_FILE variables are not set. The generated .rc file will have the
FILEVERSION and PRODUCTVERSION entries filled with major, minor, patch
level, and build number.
Use the QCoreApplication class.
QCoreApplication::setApplicationVersion("1.0");
If you develop a widget app or qml, maybe you want to show your version in WindowTitle full solution would be:
In .pro file add:
VERSION = 1.2.3
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
and in QWdiget or QMainWindow
setWindowTitle("Qt " +qtVersion + " Version"+ APP_VERSION);
or in QML
ApplicationWindow {
title: "Qt " +qtVersion + " Version"+ APP_VERSION
...

Selenium Command line server for the IEDriverServer has stopped working App Crash error

I have a Selenium Python automated regression test script running on our 64bit Server on IE11, Windows Server 2008. Everytime when the test gets about half way through an error dialog appears and the test stops. The error is:
Command line server for the IEDriverServer has stopped working
The full trace is:
Problem signature:
Problem Event Name: APPCRASH
Application Name: IEDriverServer.exe
Application Version: 2.53.0.0
Application Timestamp: 56e9abe3
Fault Module Name: IEDriverServer.exe
Fault Module Version: 2.53.0.0
Fault Module Timestamp: 56e9abe3
Exception Code: 40000015
Exception Offset: 000000000001877a
OS Version: 6.1.7601.2.1.0.272.7
Locale ID: 2057
Additional Information 1: 9d60
Additional Information 2: 9d60a3c1cb1d5911598c0ff40a26278a
Additional Information 3: 1ee9
Additional Information 4: 1ee9da2f8e2415daed3ffe0e1066b74e
Anyone know why the IEDriverServer is crashing?
On our 32bit server the tests runs ok all the way to the end. Over 230 test cases. But on our 64bit server the App Crash error appears half way through.
I have set the registry DWORD value:
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.
IEDriverServer.exe is also in my Path
And also i notice in Task Manager iexplore.exe it's memory usage is 2.95GB
Is this normal? The memory seems really high.
Does Selenium need over 2.95GB of memory to run the tests in IE11?
Thanks, Riaz
If you are using 32bit IEDriverServer.exe for 64Bit OS then you switch over to 64 Bit IEDriverServer.exe because there could be reason of mismatch 32bit to 64 bit combination behind crashing of IE driver, and now if using 64 bit IEdriverserver.exe and you are having slow typing issue then to overcome this issue for 64bit exe over IE 11 browser Follow these steps:-
Internet Options -> Security -> Check "Enable Protected Mode" for all zone
Go to Advanced -> Security -> Check "Enable Enhanced Protected Mode"
this works for me. Cheers!

Qt5 app crashes when run from outside Qt

I have a strange issue that appeared only recently.
When I acces an external binary from inside my Qt app, the app crashes with the error:
Exception Type: EXC_CRASH (SIGABRT)
But when I run it from the "build and run" inside Qt Creator, everything runs fine when I acces the point in my application where I hit an exetrnal binary.
This is the function I hit when the app crashes from outside Qt creator
QString Api::getVideoFrame(QString filename, QString position)
{
const QString ffmpeg = QDir::currentPath()+"/ffmpeg"; //mac version
QProcess process;
QStringList args;
args << "-ss" << position
<< "-i" << filename
<< "-f" << "image2"
<< "-vframes" << "1"
//<< "-vcodec" << "bmp"
<< "pipe:1";
process.start(ffmpeg, args);
process.waitForFinished();
return QString(process.readAllStandardOutput().toBase64());
}
It also crashes when accessing other external binaries, not only ffmpeg in this case.
I have the feeling it has something to do with the QDir::currentPath() because when I mess up the path, It also crashes from inside Qt Creator.
obviously I added the corresponding binaries next to the executable file in the Contents/MacOS/ folder
I don't really know how to debug this.. any clue how to solve this?
I actually found out why this happens and it is quite interresting to note that
QDir::currentPath()
has to be used with care on mac osX.
When an app is executed from within Qt Creator it returns :
/Volumes/LSPRO/Build/LSPRO.app/Contents/MacOS
including the path to te binary inside the .app package
But when you run it as a standalone app, it returns
/Volumes/LSPRO/Build
At least on my configuration...
I don't really know how to debug this.. any clue how to solve this?
Yes, I have some clue.
You could try using QCoreApplication::applicationDirPath() for this scenario to get this working properly on MAC as also asserted by a user in the comment.
Here you can find the filesystem engine source code though if you wanna further track the issue down with your suspect as a bug. In short, there is not much Mac specific code in there rather than Unix.
Also, in the future you may wanna consider QtMultimedia rather than dealing with QProcess and external execution.

Issue with QCA (Qt C++ Encryption Library) run on windows 7

I am using Qt 4.8.1, MinGW compiler and Qt Creator, all on windows 7. I want to add an encryption/ decryption library to my project. After searching the web for couple days I found QCA. Fortunately I found a pre-built version using the same C++ compiler I am using, and a pre-built version of the needed plugins.
I followed the instructions to add the QCA library to my project. I used a code like this to encrypt using AES:
QCA::Initializer init = QCA::Initializer();
//Here where the execution stops
QCA::SymmetricKey key = QCA::SymmetricKey(16);
QCA::InitializationVector iv = QCA::InitializationVector(16);
QCA::Cipher cipher = QCA::Cipher(QString("aes128"), QCA::Cipher::CBC,
QCA::Cipher::DefaultPadding, QCA::Encode,
key, iv);
if (!QCA::isSupported("aes128-cbc-pkcs7"))
{
qDebug() << "AES128 is not supported";
return;
}
The code compiles just fine but when I run the application stops with unknown reason.
I really got tired from this bug, if anybody can help it will be very very very appreciated.
For future programmers that might get stuck on this
QCA loads the plugins at runtime, so even if it compiles fine, if the plugin is not in a searchable folder, it won't load.
You can check if that's the problem by calling qDebug() << QCA::supportedFeatures();. If the plugins are not being loaded, you'll get something like:
("random", "md5", "sha1", "keystorelist")
You should be able to see the folders QCA is looking up by calling:
qDebug("%s", QCA::pluginDiagnosticText().toUtf8().constData());
Apparently, plugins must be placed in a subdirectory called crypto in the libs root directory.
You can check for all the paths where Qt looks for libraries using:
qDebug() << QCoreApplication::instance()->libraryPaths();
This documentation might have some useful information: http://doc.qt.io/qt-4.8/qpluginloader.html