How to create virtual space in C ++?

I use a third-party SDK, and one of the methods has the following form:

void ReadData(string filePath); 

As you might have guessed, this method requires a file name.
I do not want to want to dump the (sensitive) file to the hard drive, and then use its name as a parameter.

I was wondering if there is a way to create an isolated storage space from the user, so I can leave any files that I want to go there without worrying about people finding it?

EDIT: Strictly for Windows OS.

+4
source share
2 answers

Just donโ€™t worry about it.

You seem to have a misconception about who owns the computer and data. User does.

If you are worried that other users are accessing the file, use the user's personal documents or the appdata directory, the ACL will prevent unprivileged users from accessing it.

But if your business model relies on denying a user access to data inside their computer, you need to rethink this. An API for saving an erroneous business model does not exist.

+2
source

since the API you are calling requests a file name instead of a file, we must assume that you really need a file, not a file-like object.

A more specific method name would be "ReadDataFromFile". Take a look, is there another method that accepts the data itself, and not the file name?

You are trying to transfer trust from the owner of the file to / and only to the program that makes the call that you are talking about in your question. So, if all this fails, take a look at the ACL files to restrict access to sensitive data, for example: https://superuser.com/questions/246280/what-are-windows-acls or http://msdn.microsoft. com / en-us / library / aa374872% 28v = vs.85% 29.aspx You still have to put the sensitive file on the disk (worry about deleting it later), but access will be limited.

0
source

Source: https://habr.com/ru/post/1395887/


All Articles