LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create registry key

Solved!
Go to solution

Hi,

I'm trying to build a simple runtime application for "creating/writing" the following key (value) into the w10 registry:

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\EdgeUI]
"AllowEdgeSwipe"=dword:00000000

Here is what I got so far, but it does not work Smiley Frustrated
(Not sure if i should use DWORD or just STRING)

Capture.JPG

 

________________________________________________
"Science is about knowing, while engineering is about doing"
0 Kudos
Message 1 of 10
(7,383 Views)

If you want to write a DWORD value you should right click on the VI and from the menu go to "Select Type" and in there select "Write Registry Value Simple U32".

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 10
(7,377 Views)

I have now changed it to "Write Registry Value Simple U32", but still no key is created...

I think the problem is the "subkey" or the "security access mask". Smiley Frustrated

 

________________________________________________
"Science is about knowing, while engineering is about doing"
0 Kudos
Message 3 of 10
(7,362 Views)
Solution
Accepted by topic author S.Stock

It would help if you mentioned what error you get in the error cluster when executing the Write Registry function. Previously the VI you were using should have returned an error -601, indicating that it did not support the datatype you wanted to write.

Now it likely returns an error code that you have no access right to change/create that value in the key but we do not know (and I really don't remember which parts of the registry may or may not be write protected for normal users), but HKLM is generally only read access for non administrative users as it concerns the actual machine configuration and an attacker could easily gain high level access by changing values in this branch of the registry.

 

You most likely have to start LabVIEW as administrator in order to be able to write this registry value.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 4 of 10
(7,346 Views)

@rolfk wrote:

 

 

You most likely have to start LabVIEW as administrator in order to be able to write this registry value.


In conjunction with this you may may not need to turn the UAC all the way down.

0 Kudos
Message 5 of 10
(7,301 Views)

Solved the problem by running the application as admin (Properties->Compatibility->"Run this program as an administrator).
So the setup(wiring) was correct Smiley Happy .

I also notised that when writing a new key(value) that is going to be placed inside a folder that does not exist by default, such as the "EdgeUI", the RegEdit must be restarted/re-open to be able to see the new folder that has been added. 

 

 

 

 

 

________________________________________________
"Science is about knowing, while engineering is about doing"
0 Kudos
Message 6 of 10
(7,286 Views)

@S.Stock wrote:

 

I also notised that when writing a new key(value) that is going to be placed inside a folder that does not exist by default, such as the "EdgeUI", the RegEdit must be restarted/re-open to be able to see the new folder that has been added. 


Pressing F5 (Refresh) works too.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 7 of 10
(7,278 Views)

Then you should mark Rolf's message as the solution and not your own as he was the one who provided the answer.

0 Kudos
Message 8 of 10
(7,267 Views)

Since I ran into the same problem right now, I also tried the proposed solution. Nasty thing! Why? Because when you are working in a company network where your access to specific folders is managed by your user name, LabView won't have access anymore to those folders when run as admin, because that's a different user name.

 

So this is actually not the best solution. What I most likely have to do is to give the EXE full permission to access the Windows folder where the registry files are stored. Also not a good solution, but might at least work.

0 Kudos
Message 9 of 10
(5,393 Views)

Hi MaSta,

 

when you want to store data with the requirement to access that data from each user account of the computer then the generic Windows rule is to not use account-specific folder/registry items.

 

There are folders named like "public…" or the HKLM subtree instead of the HKCU subtree in the registry!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 10
(5,387 Views)