Jump to content

Reading from ProgramFiles


Recommended Posts

I know writing to ProgramFiles is not allowed in VISTA onwards, but was allowed in 2000/XP (only with admin installation, default user account - which is probably most cases)

However, does anyone do any "read only" stuff in ProgramFiles?

The 2009 Config API by default does not write to disk on Close anymore and the Read Text (but not Read Binary) when set with the Read Only permission works in ProgramFiles.

Alot more application are "portable" these days - being able to run off USB etc.. or moved around in location.

Does anyone utilize this for read-at-startup-only type configs?

Or is it considered a big nono?

Cheers

JG

Link to comment
However, does anyone do any "read only" stuff in ProgramFiles?

Sure, that's totally fine. When you think about it, your exe is there and you read it. I'm looking into doing more stuff in the registry actually - I figure if it's local data that the application needs access to (and needs to be able to edit it) then it should be in the regisrty, whereas if the user needs access to it then it needs to be in their folders. Nothing that I've done a lot of research into as yet, so maybe someone else could comment? I figure I can create a reuse compnent that is essentially a drop-in replacement for the ini file read/writes...

Link to comment

Sure, that's totally fine. When you think about it, your exe is there and you read it. I'm looking into doing more stuff in the registry actually - I figure if it's local data that the application needs access to (and needs to be able to edit it) then it should be in the regisrty, whereas if the user needs access to it then it needs to be in their folders. Nothing that I've done a lot of research into as yet, so maybe someone else could comment? I figure I can create a reuse compnent that is essentially a drop-in replacement for the ini file read/writes...

Great point!

I thought I read somewhere that with VISTA and 7 there was a push to move stuff out of the registry? I.e. amped up security there too for write access.

Is anyone else fond of the registry - and how does this translate across platforms? (have only programmed Windows OS).

Link to comment

Great point!

I thought I read somewhere that with VISTA and 7 there was a push to move stuff out of the registry? I.e. amped up security there too for write access.

Is anyone else fond of the registry - and how does this translate across platforms? (have only programmed Windows OS).

The Windows Registry has more permissions controls in Vista+ but if you put your settings where Microsoft would like you to, then all should be fine. In particular, if you keep your application settings in HKEY_CURRENT_USER\Software\<Company Name>\<Application Name>... you should have no problem.

One of my personal pipe-dreams with the registry access is to create something that could work similar to the (Un)Flatten class to XML VIs, whereby it could take a LabVIEW object and create an appropriate hierarchial bunch of keys/values in the registry automatically (and ideally, cope with version changes - probably leveraging the XML VIs to let LV deal with the mutation).

Edited by Shaun Hayward
Link to comment

You scared me for a moment, but this isn't actually true.

Ok, sorry for the scare :P

To clarify what I meant:

LV2009

The Close VI, by default, will not write to the config file if it has not changed.

E.g. Therefore you can perform a read and it will work in ProgramFiles using the defaults.

post-10325-12598771362_thumb.png

LV8.6

The Close VI, by default, writes the configuration file each time.

E.g. Therefore you can perform a read and it will not work in ProgramFiles using the defaults.

post-10325-125987730611_thumb.png

It just a default, but I thought the change was interesting to point out. as I got a different behaviour when the same code in different LabVIEW versions.

The Open VI has 8.6 on it, but Close VI is upgraded to the new one.

Therefore I was just wondering if this change to the API was done as a request from users, or to facilitate e.g. ProgramFiles read-only by NI (conforming to VISTA/7 standards or something etc..)?

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
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.