Jump to content

Conditional UAC elevation


mwebster

Recommended Posts

I'm wondering if anyone here has done this before. I have an application that (sometimes) needs to modify a general Windows registry key. In Windows 7, I've figured out how to get the application to request "elevated" access mode by modifying the .manifest file. However, there should be a way to get the UAC prompt to come up only if and when I need to modify the registry key (99% of the time after the application is first run, it will not need to be touched). I've found some example code on the Microsoft site, but it's all C++/C#. Has anyone done this before in Labview?

Regards,

Mike

Link to comment

I'm not sure what parts of the registry you need to modify, but I believe that since Windows 7 the user level of the registry doesn't require admin access. So if your application is writing and reading values for it's own self then you can try to use this section of the registry and not need high level access.

Also I'm not sure your environment but under some circumstances the easiest solution is to just lower the UAC level down, so that it won't prompt when an application tries to modify that level of the registry.

It should also be noted that you can ready any part of the registry without increased user access if you perform an Read-Only on the open VI.

Link to comment

It's only a workaround, but why not lift the portion of your software that needs registry access into another EXE? When you need to modify the registry, call that EXE, you get the just-in-time UAC prompt and everyone goes home happy, but most importantly: it's easy.

You should link to the example code. Most API calls can be implemented in LV, if you have the patience and know-how.

Link to comment

I'll have to go hunting for the example code again. The EXE call is actually a really good idea, thanks for that. I like easy, more and more every day ... :)

And the registry piece I need to access is in HKLM\SYSTEM, definitely not user accessible. It's basically a USB COM port that, for the device it interfaces to, needs to have the latency timer set to 1ms instead of the default 16. I would just set it manually once, but if you unplug and replug it into a different USB port it gets a new COM port address and a new registry entry that contains the default value once again.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.