From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

restricting file access

I am using LabView 7.1 and want to restrict the access to files that I am using in my LabView program. I would like to only allow LabView to read and write to the files. Is it possible to do this?
0 Kudos
Message 1 of 6
(2,875 Views)
Hello.

It is possible to restrict access to files, however, the degree to which you can do that depends on the operating system you are using. If you are using Windows, you can only restrict the write access, but not the read access (make a file read-only). To do that, you need to use the "Access Rights" function found in the palette: Functions > File I/O > Advanced File Functions. To make a file read-only, write a binary 100000000 to the "new permissions" input of that function, and to remove the read-only setting, write a binary 110000000.

However, by reading your message it seems like you also want to restrict read access, not only write access. If you are using UNIX, you can use the same function described in the above paragraph. If you are using Windows, then it is a bit more tricky. You could base your security on the file access features of Windows 2000 or XP Professional.

Another option is to store the data in a LabVIEW binary file that only LabVIEW can understand and read. Attached are images of how to create and read LabVIEW binary data files, by using the low-level file functions and connecting the data structure of the data you want to save into the datalog input of the open file function.

Hope this helps.

Alejandro
0 Kudos
Message 2 of 6
(2,855 Views)
AlejandroZ wrote:

> It is possible to restrict access to files, however, the degree to which you
> can do that depends on the operating system you are using. If you are using
> Windows, you can only restrict the write access, but not the read access
> (make a file read-only). To do that, you need to use the "Access Rights"
> function found in the palette: Functions > File I/O > Advanced File Functions.
> To make a file read-only, write a binary 100000000 to the "new permissions"
> input of that function, and to remove the read-only setting, write a binary
> 110000000.<br><br>However, by reading your message it seems like you also
> want to restrict read access, not only write access. If you are using UNIX,
> you can use the same function described in the above paragraph. If you are
> using Windows, then it is a bit more tricky. You could base your security
> on the file access features of Windows 2000 or XP Professional.
> Another option is to store the data in a LabVIEW binary file that only
> LabVIEW can understand and read. Attached are images of how to create and
> read LabVIEW binary data files, by using the low-level file functions and
> connecting the data structure of the data you want to save into the
datalog b
> input of the open file function.<br><br>Hope this helps.

You can however control total access for other applications as long as
you open a file. The deny mode input allows you to define that you want
Windows to prevent anyone else to access that file either for write or
total access as long as the file is open.

For the rest the Windows security model is quite different to anything
else. LabVIEW does not give you access to more than the write
protection. And unless you use NTFS there really isn't anything more
than that available under Windows.

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 6
(2,839 Views)


@mhester wrote:
I am using LabView 7.1 and want to restrict the access to files that I am using in my LabView program. I would like to only allow LabView to read and write to the files. Is it possible to do this?


I am using Windows. I read and write to the file from LabView, but I don't want it to be opened and edited outside of my program. Can I make the file so that only LabView can open it?
0 Kudos
Message 4 of 6
(2,822 Views)
The third paragraph of my first response describes how to create a datalog file with LabVIEW, a method which involves connecting the data stucture to the file new and file open functions. That way, the file in which the data is stored, can only be opened by LabVIEW, and as a matter of fact, only by a VI that "knows" what data type to expect. In other words, to be able to read the contents of the file, you NEED a VI in which the file open function has the exact data structure connected to it.

The method is also depicted in the image attached. You should be able to use that.

Hope this helps. Good luck.

Alejandro
0 Kudos
Message 5 of 6
(2,806 Views)
Can I make the file so that only LabView can open it?


If you use datalog files, Only LabVIEW can make sense of it. Strictly speaking, other programs can open it, but they won't be able to use the data inside (without a major PITA).

This makes it somewhat tamper-resistant. It has other advantages as well.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 6
(2,792 Views)