lundi 8 octobre 2018

How to tell if a path is a file or a directory without elevated privileges

I have an process without elevated privileges, and because of that, I cannot get the File attribute of certains files/directories

const auto attr = GetFileAttributesW(path);

or

auto *pwfd = new WIN32_FIND_DATAW;
const auto handle = FindFirstFileW(path, pwfd);

In both cases it makes sense that I cannot access the file attributes, (because I do not have elevated privileges)

But all I need to know is if the path is a file or directory.

Is there a way of knowing if a valid path is a file or a directory without elevated privileges?

Edit It is not a duplicate of How can I tell if a given path is a directory or a file? (C/C++), (for example), I already know how to get file attributes.

I am asking about knowing if the path is a file/directory without elevated privileges.

Aucun commentaire:

Enregistrer un commentaire