Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Win32 way to determine if a file is not accessible/private

Hello

In win32 c++; is there a way to determine if a folder/file is accessible? You know how if you try to access a certain folder in the C:/Windows directory & you will get a popup saying "This folder is not accessible".

Maybe there is a file attribute constant that signifies that the file is private? Maybe something like FILE_ATTRIBUTE_PRIVATE?

Code
WIN32_FIND_DATA dirData;

while (FindNextFile( dir, &dirData ) != 0 )
{
    // I made the following constant up
    if ( fileData.dwFileAttributes & FILE_ATTRIBUTE_PRIVATE )
    {
        // file is inaccessible
    }
}

Or is the only way to know by going:

Code
dir = FindFirstFileEx( (LPCTSTR)directory.c_str(), FindExInfoStandard, &dirData, FindExSearchNameMatch, NULL, 0 );
                        
if ( dir == ??? ) { the file is inaccessible }
Well, im not sure what you mean with private. But you are actually giving FindNextFile() a WIN32_FIND_DATA structure as output parameter. And as you can see here : http://msdn.microsoft.com/en-us/library/...s.85).aspx

There are some things that you can find out about the file by checking it after calling FindNextFile().
I don't think that there actually noticeable more to find out about a file, because even this function http://msdn.microsoft.com/en-us/library/...S.85).aspx would not tell you more than the WIN32_FIND_DATA-struct.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by VUEDUEJul 11, 2021 06:45 AM 4 211 Jul 11, 2021 06:45 AM
Last Post: VUEDUE
[C#] by notahackermanApr 26, 2020 11:32 PM 17 781 Apr 26, 2020 11:32 PM
Last Post: Shadow_Cloud
[C] by SIM-3991524Mar 11, 2020 02:03 PM 11 347 Mar 11, 2020 02:03 PM
Last Post: some1