GetWriteableFolderPath() yields a path through a short-cut

Add-in Express™ Support Service
That's what is more important than anything else

GetWriteableFolderPath() yields a path through a short-cut
The path returned by the protected mode API includes a short-cut -- it is not a true/absolute path. 
Ira Whitman




Posts: 54
Joined: 2010-01-21
I'm using the following to get a writable path.

var pAPI = new AddinExpress.IE.ADXIEProtectedModeAPI();
_tempFolder = pAPI.GetWriteableFolderPath();

In my Windows 8 development system and on several test systems, this yields a path similar to:
C:\Users\<name>\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low
and this works out this fine. We create a temporary file there and launch another EXE with Process.Start passing this path on the command-line. All is good.

However, we've found several customer systems in which the path returned from pAPI.GetWriteableFolderPath() looks like this:
C:\Users\<name>\Local Settings\Temporary Internet Files\PAGE.XML
where "Local Settings" is not truly a folder within C:\Users\<name>, but rather is a short-cut to another folder, C:\Users\<name>\AppData\Local\Microsoft\Windows\.

My BHO resolves the path through the short-cut and writes the temporary file to C:\Users\<name>\AppData\Local\Microsoft\Windows\Temporary Internet Files\PAGE.XML. But it passes "C:\Users\<name>\Local Settings\Temporary Internet Files\PAGE.XML" to the EXE, and it fails to follow the short-cut, reporting that the path/file cannot be found.

I suspect that this short-cut is the result of some new security patch, but in any case, I'm at a loss to derive a path that is reliably writable by my BHO and is also accessible by another EXE.

Thank you in advance.
Posted 18 Oct, 2013 08:50:32 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Ira,

Please try to use .NET classes to get the writable location:

string tempFolder = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
tempFolder = Path.Combine(tempFolder, "Low");
if (!Directory.Exists(tempFolder))
Directory.CreateDirectory(tempFolder);
Posted 21 Oct, 2013 08:23:29 Top
Ira Whitman




Posts: 54
Joined: 2010-01-21
Our application was updated to resolve another issue, and this problem mysteriously went away. (Also, I was misinformed prior to my original post: it was not "several customer systems", which had this problem, but only one single system.)

I don't have that "warm and fuzzy" feeling about this truly being resolved because I don't know how it got better. For now, I'll leave the code as it stands, but if the issue emerges again, I'll try the .NET approach you've suggested.
Posted 30 Oct, 2013 08:19:37 Top