views:

16

answers:

2

Hi, My app, which is run on arbitrary computer on Widows XP/Vista/7 on arbitrary account (f.e. user with limited privileges) needs to open a file that is wrapped within another file. It can open this embedded file only by file name so the app needs to unwrap the file, store it as another file and then open it.

What can I do to be sure that I have enough privileges to create a file and read/write it? Is there any special place I can store my files in such situation in Windows. Can I use memory mapped files? - can they be read by standard IO operations like OpenFile/ReadFile ?

Thanks

+1  A: 

You should always be able to create files in %TEMP%.

SLaks
Does the temporary folder always exists?
bartek
It could not exist, but in this case other software which is using Windows API to create temporary files would also have problems.
Jaka
+1  A: 

A user should also be able to write in the %USERPROFILE% dir. That one should always exist by design.

But this is obviously different directory for each user.

edit: Windows API includes GetTempPath function. It looks in these variables %TMP%, %TEMP%, %USERPROFILE% If it can not find anything there it returns the windows directory.

Jaka