Search code examples
c++windowsfilevirtualstorage

How to create a virtual storage space in C++?


I'm using a third party SDK, and one of the method goes as following:

void ReadData(string filePath);

As you might have guessed, it requires a filename for the method.
I do not wish having to drop a (sensitive) file into the HDD, then use its filename as the parameter.

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

EDIT: Strictly for Windows OS only.


Solution

  • Just don't worry about it.

    You seem to have some misconception about who owns the computer and the data. The user does.

    If you're worried about other users getting access to the file, use the user's private documents or appdata directory, the ACL will prevent unprivileged users from getting to it.

    But if your business model relies on denying a user access to the data inside their own computer, you need to rethink that. There isn't any API to save a flawed business model.