| 193 | } |
| 194 | |
| 195 | HRESULT BuildFileAttributeString(const TCHAR *lpszFileName, TCHAR *szOutput, size_t cchMax) |
| 196 | { |
| 197 | /* FindFirstFile is used instead of GetFileAttributes() or |
| 198 | GetFileAttributesEx() because of its behaviour |
| 199 | in relation to system files that normally |
| 200 | won't have their attributes given (such as the |
| 201 | pagefile, which neither of the two functions |
| 202 | above can retrieve the attributes of). */ |
| 203 | WIN32_FIND_DATA wfd; |
| 204 | wil::unique_hfind findFile(FindFirstFile(lpszFileName, &wfd)); |
| 205 | HRESULT hr = E_FAIL; |
| 206 | |
| 207 | if(findFile) |
| 208 | { |
| 209 | hr = BuildFileAttributeString(wfd.dwFileAttributes, szOutput, cchMax); |
| 210 | } |
| 211 | |
| 212 | return hr; |
| 213 | } |
| 214 | |
| 215 | HRESULT BuildFileAttributeString(DWORD dwFileAttributes, TCHAR *szOutput, size_t cchMax) |
| 216 | { |