LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Embedded UIR-File: Permission denied when starting application

I've build a CVI application (W2K devel workstation, LabWindows/CVI 7.0) with option 'embed project .UIR-files in executeable' enabled.

If I try to start the application as a normal (non-administrator) user on my NT/4.0 lab workstation (LabWindows 7.0 RTE), I get a 'Error in call to LoadPanel, UIR File Name: TestSomething.uir, Error -95, File access permission denied'.

If I start the app with administrator-privileges, everything works fine.

I've tracked down the error using a file-monitor. The app tries to extract the embedded UIR to a temporary file called 'c:\uir$$1.tmp'. A normal user does not have write-permission in 'c:\'. Therefore I consider this a bug in Labwindows/CVI.
0 Kudos
Message 1 of 7
(4,229 Views)
You are correct that CVI tries to create a temporary file during LoadPanel when the embed uir files is enabled. It tries to create this file in the directory specified in the current user's environment variables "TEMP" or "TMP". Either you don't have those environment variables set and it defaults to "c:\" or your temp environment variables are explicitly set to "c:\".

Make sure that the current user has those environment variables set to a directory in which he can create files, and it should work.

- jared
Message 2 of 7
(4,229 Views)
Thank you very much for your quick answer. I've tried to change the environment variables (Open DOS-Box, "set TEMP=c:\TEMP\", "set TMP=c:\TEMP\", "TestSomething.exe") but I still get the same error. What is the recommended way to set a working TMP-path on NT4.0? Is it possible to encode a custom TMP-path into the compiled CVI-executeable? The latter would not require the user to make any preperations.


As far as I know the commonly used directory for temporary files is %WINDIR%/Tmp. CVI RTE probably should use this in case of an unset TMP variable (?).

0 Kudos
Message 3 of 7
(4,229 Views)
It looks like you are setting the environment variables correctly. In the DOS-box you can check the values of the environment variables by just typing "set" and return, and it will list all of them. Keep in mind that any changes made in a DOS-box only apply to that session of the DOS-box. Any other DOS-box instances will get its environment variables from the system (go to the Advanced tab on the System Properties dialog, and click Environment Variables to set the system variables for a particular user). However, there is a bug in the embeded uir feature that when you call LoadPanel, it tries to create the temporary file in the directory above the one specified in the TMP environment variable. In other words, if your TMP environment variable is "c:\temp
" it will try to create the temporary file in "c:\". This should be fixed in the next version, but for now you can set the TMP environment variable to be a child directory of a directory to which you can write (ie. "c:\temp\dummyFolder").

As for your question about whether it is possible to encode a custom TMP path into the executable... the answer should be yes. We added a new function, _putenv(), to CVI 7.0 that allows you to set environment variables for the current process. So if you called _putenv("TMP=c:\temp"), it sets the TMP environment variable to "c:\temp", and then you could call LoadPanel which should then use "c:\temp" to create the temporary file (notwithstanding the above bug). However, I noticed that the CVI run-time engine caches the value of the TMP environment value at startup, so it doesn't use your new value. We are also looking into fixing this in the next version.

- jared
0 Kudos
Message 4 of 7
(4,230 Views)

I'm seeing this problem with CVI7.0. What version of CVI fixed this? Can we upgrade just the run-time engine to fix it?

JR

0 Kudos
Message 5 of 7
(3,855 Views)
This was fixed in version 8.0. Yes, upgrading just the run-time engine should fix it.
 
- jared
0 Kudos
Message 6 of 7
(3,840 Views)

I am running Windows 7 with CVI 2012 and I am seeing the same problem "File access permission denied"  when trying to load a panel from an embedded UIR.

Both my TEMP and TMP are set to <user>\AppData\local\Temp.

 

Apparently Windows 7 unfixed it? 

 

0 Kudos
Message 7 of 7
(2,944 Views)