tags:

views:

281

answers:

3

Anyone has any idea?? GetFileAttributes returns 32 (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE). The file is C:\WINDOWS\system32\drivers\etc\hosts.

Thanks a lot!

+1  A: 

http://msdn.microsoft.com/en-us/library/aa364944(VS.85).aspx

Take a look at this. Response 32 is only FILE_ATTRIBUTE_ARCHIVE. So your code is working fine.

Sahasranaman MS
A: 

Which of the following is your situation?

1) GetFileAttributes returns 33 (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE)

or

2) GetFileAttributes returns 32 (FILE_ATTRIBUTE_ARCHIVE)

If the hosts file does not have the read only attribute, and GetFileAttributes does not return INVALID_FILE_ATTRIBUTES then you can trust it's return value. So if the file actually doesn't have the read only attribute, then you have situation #2 above.

Brian R. Bondy
A: 

It returns 33 (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE). The hosts file ISN'T read only, but it is the return value.