Working with the registry on Qt

Using Qt 5.6.1 C++ In general, I need to change the existing value of the parameter, before checking it. But first I decided to just try creating a parameter with a value. After a long study of classes, Qt wrote this code:

QSettings checkinst("HKEY_LOCAL_MACHINE\\SOFTWARE\\MYPROGRAMM", QSettings::NativeFormat);
checkinst.setValue("JustUpdated", 20);

The program compiles without errors. The path written in the first line exists, there is no such parameter there before the program starts. Then I run the program, and the code is executed. However, this parameter is not specified in the registry. appears. Why? What am I doing wrong?

Upd. I read the parameter and brought it to the screen, the value that I set was displayed, but I do not observe it in the registry. It looks like something is wrong with the address, I can't figure out what...

Upd2. I thought of doing a search in the registry of the parameter that I create. He was found! But in a completely incomprehensible way:

HKEY_CLASSES_ROOT\VirtualStore\Machine\Software\Wow6432Node\Myprogram

What is this path, where did it come from? I pointed it out another way.

 2
Author: Сергей Малышев, 2020-08-27

1 answers

Https://990x.top/virtualstore-chto-eto-za-papka-i-mozhno-li-ee-udalit.html

Here's a pretty fun description of where this path comes from. However, if the program is run as an administrator, the path will be the one specified in the code. So that there is no difference, it is better to immediately specify the path to this section in the code.

Upd. Extract from the site.

Some programs want to store their data in folders such as Program Files, Windows.. They may also want to enter data in the system registry keys. Windows frankly does not like this and it begins to use virtualization technology (this seems to mean UAC, but I may be wrong).

How does it work? See, the program wants to write data to this folder, for example:

C:\Windows

But windows will quietly redirect the write request here:

C:\Users\user_name\AppData\Local\VirtualStore\Windows

Do you understand? The prog will think that everything is a bundle and it writes the data is in the Windows folder, although this is how the BE is, but the Windows folder itself is located in the VirtualStore folder..

The same applies to the registry, if the program, for example, wants to write data here:

HKLM\Software

Then Windows will quietly redirect all this business here:

HKLM\Software\Classes\VirtualStore

 1
Author: Сергей Малышев, 2020-08-31 11:13:47