From efba8a16006bc18a1600d22da23e12e05970aa8e Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 11 Mar 2021 18:05:54 +0000 Subject: [PATCH] Set win32 attributes using a for loop instead of repeating code. --- setter/src/win32/attr.c | 1595 ++------------------------------------- setter/src/win32/attr.h | 371 ++++++++- 2 files changed, 423 insertions(+), 1543 deletions(-) diff --git a/setter/src/win32/attr.c b/setter/src/win32/attr.c index ac4a57e..3af4708 100644 --- a/setter/src/win32/attr.c +++ b/setter/src/win32/attr.c @@ -65,6 +65,7 @@ void FileAttributes(const char* path) DWORD defaultCompression = COMPRESSION_FORMAT_DEFAULT; void* func; HMODULE advapi32; + int i; lpRootPathName = malloc(dwMaxNameSize); @@ -108,806 +109,35 @@ void FileAttributes(const char* path) printf("Creating attributes files.\n"); - h = CreateFileA("NONE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else + for(i = 0; i < KNOWN_WIN32_ATTRS; i++) { - ret = WriteFile(h, (LPCVOID)noAttributeText, strlen(noAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); + h = CreateFileA(win32_attrs[i].filename, dwFilePermissions, 0, NULL, CREATE_ALWAYS, win32_attrs[i].attr, NULL); + rc = 0; + wRc = 0; + cRc = 0; - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); + else + { + ret = WriteFile(h, + (LPCVOID)win32_attrs[i].description, + strlen(win32_attrs[i].description), + &dwNumberOfBytesWritten, + NULL); + if(!ret) wRc = GetLastError(); + + ret = CloseHandle(h); + + if(!ret) cRc = GetLastError(); + } + + printf("\t%s: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", + win32_attrs[i].description, + win32_attrs[i].filename, + rc, + wRc, + cRc); } - printf("\tFile with no attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "NONE", rc, wRc, cRc); - - h = CreateFileA("ARCHIVE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with archived attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "ARCHIVE", rc, wRc, cRc); - - h = CreateFileA("HIDDEN", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with hidden attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "HIDDEN", rc, wRc, cRc); - - h = CreateFileA("OFFLINE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_OFFLINE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "OFFLINE", rc, wRc, cRc); - - h = CreateFileA("READONLY", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_READONLY, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf( - "\tFile with read-only attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "READONLY", rc, wRc, cRc); - - h = CreateFileA("SYSTEM", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with system attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "SYSTEM", rc, wRc, cRc); - - h = CreateFileA("TEMPORAR", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tTemporary file: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "TEMPORAR", rc, wRc, cRc); - - h = CreateFileA( - "HA", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with hidden and archived attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "HA", - rc, - wRc, - cRc); - - h = CreateFileA( - "OA", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_ARCHIVE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with archived attribute is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "OA", - rc, - wRc, - cRc); - - h = CreateFileA( - "RA", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with read-only and archived attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "RA", - rc, - wRc, - cRc); - - h = CreateFileA( - "SA", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with system and archived attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "SA", - rc, - wRc, - cRc); - - h = CreateFileA( - "TA", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tTemporary file with archived attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "TA", - rc, - wRc, - cRc); - - h = CreateFileA( - "OH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_HIDDEN, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with hidden attribute that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "OH", - rc, - wRc, - cRc); - - h = CreateFileA( - "RH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with system and read-only attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "RH", - rc, - wRc, - cRc); - - h = CreateFileA( - "SH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with system and hidden attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "SH", - rc, - wRc, - cRc); - - h = CreateFileA( - "TH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_HIDDEN, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf( - "\tTemporary file with hidden attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "TH", rc, wRc, cRc); - - h = CreateFileA( - "RO", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_OFFLINE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with read-only attribute that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "RO", - rc, - wRc, - cRc); - - h = CreateFileA( - "SO", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_OFFLINE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with system attribute that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "SO", - rc, - wRc, - cRc); - - h = CreateFileA( - "TO", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_OFFLINE, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tTemporary file that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "TO", - rc, - wRc, - cRc); - - h = CreateFileA( - "SR", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with system and read-only attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "SR", - rc, - wRc, - cRc); - - h = CreateFileA( - "TR", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_READONLY, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tTemporary file with read-only attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "TR", - rc, - wRc, - cRc); - - h = CreateFileA( - "ST", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY, NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf( - "\tTemporary file with system attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "ST", rc, wRc, cRc); - - h = CreateFileA("OAH", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf( - "\tFile with archive and hidden attributes that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc " - "= %d\n", - "OAH", - rc, - wRc, - cRc); - - h = CreateFileA("RAH", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with read-only, hidden and archive attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "RAH", - rc, - wRc, - cRc); - - h = CreateFileA("SAH", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with system, archive and hidden attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "SAH", - rc, - wRc, - cRc); - - h = CreateFileA("TAH", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tTemporary file with archive and hidden attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "TAH", - rc, - wRc, - cRc); - - h = CreateFileA("RAO", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf( - "\tFile with read-only and archive attributes that is available offline: name = \"%s\", rc = %lu, wRc = %lu, " - "cRc = %lu\n", - "RAO", - rc, - wRc, - cRc); - - h = CreateFileA("SAO", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf( - "\tFile with system and archive attributes that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc " - "= %d\n", - "SAO", - rc, - wRc, - cRc); - - h = CreateFileA("TAO", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf( - "\tTemporary file with archive attribute that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = " - "%d\n", - "TAO", - rc, - wRc, - cRc); - - h = CreateFileA("OAR", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf( - "\tFile with read-only and archive attributes that is available offline: name = \"%s\", rc = %lu, wRc = %lu, " - "cRc = %lu\n", - "OAR", - rc, - wRc, - cRc); - - h = CreateFileA("TAR", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tTemporary file with archive and read-only attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "TAR", - rc, - wRc, - cRc); - - h = CreateFileA("TAS", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_SYSTEM, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tTemporary file with archive and system attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", - "TAS", - rc, - wRc, - cRc); - - h = CreateFileA("AHORST", - dwFilePermissions, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | - FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY, - NULL); - rc = 0; - wRc = 0; - cRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)systemAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - } - printf("\tFile with all attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu\n", "AHORST", rc, wRc, cRc); if(WinGetVersionExA) { @@ -958,749 +188,44 @@ void FileAttributes(const char* path) WinNtEncryptFileA = func; - h = CreateFileA("ENCRYPT", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else + for(i = 0; i < KNOWN_WIN32_ATTRS; i++) { - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); + h = CreateFileA( + encrypted_win32_attrs[i].filename, dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + rc = 0; + wRc = 0; + cRc = 0; + aRc = 0; + eRc = 0; - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); + if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); + else + { + ret = WriteFile(h, + (LPCVOID)encrypted_win32_attrs[i].description, + strlen(encrypted_win32_attrs[i].description), + &dwNumberOfBytesWritten, + NULL); + if(!ret) wRc = GetLastError(); - ret = WinNtEncryptFileA("ENCRYPT"); - if(!ret) eRc = GetLastError(); + ret = CloseHandle(h); + if(!ret) cRc = GetLastError(); - ret = SetFileAttributesA("ENCRYPT", FILE_ATTRIBUTE_NORMAL); - if(!ret) aRc = GetLastError(); + ret = WinNtEncryptFileA(encrypted_win32_attrs[i].filename); + if(!ret) eRc = GetLastError(); + + ret = SetFileAttributesA(encrypted_win32_attrs[i].filename, encrypted_win32_attrs[i].attr); + if(!ret) aRc = GetLastError(); + } + printf("\t%s: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = %lu\n", + encrypted_win32_attrs[i].description, + encrypted_win32_attrs[i].filename, + rc, + wRc, + cRc, + aRc, + eRc); } - printf("\tEncrypted file: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = %lu\n", - "ENCRYPT", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("EA", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("EA"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("EA", FILE_ATTRIBUTE_ARCHIVE); - if(!ret) aRc = GetLastError(); - } - printf("\tEncrypted file with archived attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = " - "%lu\n", - "EA", - rc, - wRc, - cRc, - aRc, - eRc); - h = CreateFileA("HE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("HE"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("HE", FILE_ATTRIBUTE_HIDDEN); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted file with hidden attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = %lu\n", - "HE", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("OE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("OE"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("OE", FILE_ATTRIBUTE_OFFLINE); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted file is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = %lu\n", - "OE", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("RE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("RE"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("RE", FILE_ATTRIBUTE_READONLY); - if(!ret) aRc = GetLastError(); - } - printf("\tEncrypted file with read-only attribute: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = " - "%lu\n", - "RE", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("TE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("TE"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("TE", FILE_ATTRIBUTE_TEMPORARY); - if(!ret) aRc = GetLastError(); - } - printf("\tEncrypted temporary file: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = %lu, eRc = %lu\n", - "TE", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("HAE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("HAE"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("HAE", FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_ARCHIVE); - if(!ret) aRc = GetLastError(); - } - printf("\tEncrypted file with hidden and archive attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = " - "%lu, " - "eRc = %lu\n", - "HAE", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("OAE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("OAE"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("OAE", FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_ARCHIVE); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted file with archive attribute that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = " - "%d, aRc = %lu, eRc = %lu\n", - "OAE", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("RAE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("RAE"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("RAE", FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted file with archive and read-only attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = " - "%d, eRc = %lu\n", - "RAE", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("TAE", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("TAE"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("TAE", FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted file with archive attribute that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = " - "%d, aRc = %lu, eRc = %lu\n", - "TAE", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("EAO", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)encryptedAttributeText, strlen(systemAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("EAO"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("EAO", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted file with archive attribute that is available offline: name = \"%s\", rc = %lu, wRc = %lu, cRc = " - "%d, aRc = %lu, eRc = %lu\n", - "EAO", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("EAR", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("EAR"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("EAR", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted file with archive and read-only attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, aRc = " - "%d, eRc = %lu\n", - "EAR", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("OAEH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("OAEH"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("OAEH", FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted file with archive and hidden attributes that is available offline: name = \"%s\", rc = %lu, wRc " - "= %d, cRc = %lu, aRc = %lu, eRc = %lu\n", - "OAEH", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("RAEH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("RAEH"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("RAEH", FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN); - if(!ret) aRc = GetLastError(); - } - printf("\tEncrypted file with read-only, archive and hidden attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = " - "%d, aRc = %lu, eRc = %lu\n", - "RAEH", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("TAEH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("TAEH"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("TAEH", FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted temporary file with hidden and archive attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, " - "aRc = %lu, eRc = %lu\n", - "TAEH", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("RAEO", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("RAEO"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("RAEO", FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE); - if(!ret) aRc = GetLastError(); - } - printf("\tEncrypted file with read-only and archive attributes that is available offline: name = \"%s\", rc = %lu, " - "wRc = %lu, cRc = %lu, aRc = %lu, eRc = %lu\n", - "RAEO", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("TAEO", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("TAEO"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("TAEO", FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted temporary file with archive attribute that is available offline: name = \"%s\", rc = %lu, wRc = " - "%d, cRc = %lu, aRc = %lu, eRc = %lu\n", - "TAEO", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("TAER", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("TAER"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA("TAER", FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted temporary file with archive and read-only attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = " - "%d, aRc = %lu, eRc = %lu\n", - "TAER", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("RAEH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = - WriteFile(h, (LPCVOID)readonlyAttributeText, strlen(readonlyAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("RAEH"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA( - "RAEH", FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE); - if(!ret) aRc = GetLastError(); - } - printf("\tEncrypted file with read-only, archive and hidden attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = " - "%d, aRc = %lu, eRc = %lu\n", - "RAEH", - rc, - wRc, - cRc, - aRc, - eRc); - - h = CreateFileA("TAEH", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - rc = 0; - wRc = 0; - cRc = 0; - aRc = 0; - eRc = 0; - if(h == INVALID_HANDLE_VALUE) rc = GetLastError(); - else - { - ret = WriteFile( - h, (LPCVOID)temporaryAttributeText, strlen(temporaryAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = - WriteFile(h, (LPCVOID)archivedAttributeText, strlen(archivedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile( - h, (LPCVOID)encryptedAttributeText, strlen(encryptedAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)hiddenAttributeText, strlen(hiddenAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - ret = WriteFile(h, (LPCVOID)offlineAttributeText, strlen(offlineAttributeText), &dwNumberOfBytesWritten, NULL); - if(!ret) wRc = GetLastError(); - - ret = CloseHandle(h); - if(!ret) cRc = GetLastError(); - - ret = WinNtEncryptFileA("TAEH"); - if(!ret) eRc = GetLastError(); - - ret = SetFileAttributesA( - "TAEH", FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE); - if(!ret) aRc = GetLastError(); - } - printf( - "\tEncrypted temporary file with archive and hidden attributes: name = \"%s\", rc = %lu, wRc = %lu, cRc = %lu, " - "aRc = %lu, eRc = %lu\n", - "TAEH", - rc, - wRc, - cRc, - aRc, - eRc); FreeLibrary(advapi32); } diff --git a/setter/src/win32/attr.h b/setter/src/win32/attr.h index 6c182a9..7fb62d1 100644 --- a/setter/src/win32/attr.h +++ b/setter/src/win32/attr.h @@ -5,16 +5,371 @@ #ifndef SETTER_SRC_WIN32_ATTR_H_ #define SETTER_SRC_WIN32_ATTR_H_ -const char* archivedAttributeText = "This file has the archived attribute set.\n"; -const char* encryptedAttributeText = "This file is encrypted.\n"; -const char* hiddenAttributeText = "This file has the hidden attribute set.\n"; -const char* noAttributeText = "This file has no attribute set.\n"; -const char* offlineAttributeText = "This file is available offline.\n"; -const char* readonlyAttributeText = "This file has the read-only attribute set.\n"; -const char* systemAttributeText = "This file has the system attribute set.\n"; -const char* temporaryAttributeText = "This file is temporary.\n"; +#include + const char* compressedAttributeText = "This file is compressed.\n"; +typedef struct +{ + char filename[9]; + char description[128]; + DWORD attr; +} win32_attr_tests_t; + +#define KNOWN_WIN32_ATTRS 64 + +static const win32_attr_tests_t win32_attrs[KNOWN_WIN32_ATTRS] = { + {"________", "File with no attributes", FILE_ATTRIBUTE_NORMAL}, + {"_______T", "Temporary file", FILE_ATTRIBUTE_TEMPORARY}, + {"______S_", "File with system attribute", FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_SYSTEM}, + {"______ST", + "Temporary file with system attribute", + FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"_____R__", "File with read-only attribute", FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_READONLY}, + {"_____R_T", + "Temporary file with read-only attribute", + FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"_____RS_", + "File with system and read-only attributes", + FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"_____RST", + "Temporary file with system and read-only attributes", + FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"____O___", "File is available offline", FILE_ATTRIBUTE_OFFLINE}, + {"____O__T", "Temporary file that is available offline", FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_TEMPORARY}, + {"____O_S_", + "File with system attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM}, + {"____O_ST", + "Temporary file with system attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"____OR__", + "File with read-only attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY}, + {"____OR_T", + "Temporary file with read-only attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"____ORS_", + "File with system and read-only attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"____ORST", + "Temporary file with system and read-only attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"___H____", "File with hidden attribute", FILE_ATTRIBUTE_HIDDEN}, + {"___H___T", "Temporary file with hidden attribute", FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_TEMPORARY}, + {"___H__S_", "File with system and hidden attributes", FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM}, + {"___H__ST", + "Temporary file with system and hidden attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"___H_R__", "File with system and read-only attributes", FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY}, + {"___H_R_T", + "Temporary file with system and read-only attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"___H_RS_", + "File with hidden, system and read-only attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"___H_RST", + "Temporary file with hidden, system and read-only attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"___HO___", + "File with hidden attribute that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE}, + {"___HO__T", + "Temporary file with hidden attribute that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_TEMPORARY}, + {"___HO_S_", + "File with hidden and system attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM}, + {"___HO_ST", + "Temporary file with hidden and system attribute that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"___HOR__", + "File with hidden and read-only attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY}, + {"___HOR_T", + "Temporary file with hidden and read-only attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"___HORS_", + "File with hidden, read-only and system attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"___HORST", + "Temporary file with hidden, read-only and system attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_TEMPORARY}, + {"__A_____", "File with archived attribute", FILE_ATTRIBUTE_ARCHIVE}, + {"__A____T", "Temporary file with archived attribute", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_TEMPORARY}, + {"__A___S_", "File with system and archived attributes", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_SYSTEM}, + {"__A___ST", + "Temporary file with archived and system attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"__A__R__", "File with read-only and archived attributes", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY}, + {"__A__R_T", + "Temporary file with archive and read-only attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"__A__RS_", + "File with read-only and archived attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"__A__RST", + "Temporary file with read-only and archived attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"__A_O___", "File with archived attribute is available offline", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE}, + {"__A_O__T", + "Temporary file with archive attribute that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_TEMPORARY}, + {"__A_O_S_", + "File with system and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM}, + {"__A_O_ST", + "Temporary file with system and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"__A_OR__", + "File with read-only and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY}, + {"__A_OR_T", + "Temporary file with read-only and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"__A_ORS_", + "File with system, read-only and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"__A_ORST", + "Temporary file with system, read-only and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_TEMPORARY}, + {"__AH____", "File with hidden and archived attributes", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN}, + {"__AH___T", + "Temporary file with archive and hidden attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_TEMPORARY}, + {"__AH__S_", + "File with system, archive and hidden attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM}, + {"__AH__ST", + "Temporary file with system, archive and hidden attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"__AH_R__", + "File with read-only, hidden and archive attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY}, + {"__AH_R_T", + "Temporary file with read-only, hidden and archive attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"__AH_RS_", + "File with system, read-only, hidden and archive attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"__AH_RST", + "Temporary file with read-only, hidden and archive attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_TEMPORARY}, + {"__AHO___", + "File with hidden and archived attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE}, + {"__AHO__T", + "Temporary file with archive and hidden attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_TEMPORARY}, + {"__AHO_S_", + "File with system, archive and hidden attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM}, + {"__AHO_ST", + "Temporary file with system, archive and hidden attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_TEMPORARY}, + {"__AHOR__", + "File with read-only, hidden and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY}, + {"__AHOR_T", + "Temporary file with read-only, hidden and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | + FILE_ATTRIBUTE_TEMPORARY}, + {"__AHORS_", + "File with system, read-only, hidden and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | + FILE_ATTRIBUTE_SYSTEM}, + {"__AHORST", + "File with all attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | + FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, +}; + +static const win32_attr_tests_t encrypted_win32_attrs[KNOWN_WIN32_ATTRS] = { + {"E_______", "Encrypted file with no attributes", FILE_ATTRIBUTE_NORMAL}, + {"E______T", "Encrypted temporary file file", FILE_ATTRIBUTE_TEMPORARY}, + {"E_____S_", "Encrypted file with system attribute", FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_SYSTEM}, + {"E_____ST", + "Encrypted temporary file file with system attribute", + FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E____R__", "Encrypted file with read-only attribute", FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_READONLY}, + {"E____R_T", + "Encrypted temporary file file with read-only attribute", + FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"E____RS_", + "Encrypted file with system and read-only attributes", + FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"E____RST", + "Encrypted temporary file file with system and read-only attributes", + FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E___O___", "Encrypted file is available offline", FILE_ATTRIBUTE_OFFLINE}, + {"E___O__T", + "Encrypted temporary file file that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_TEMPORARY}, + {"E___O_S_", + "Encrypted file with system attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM}, + {"E___O_ST", + "Encrypted temporary file file with system attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E___OR__", + "Encrypted file with read-only attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY}, + {"E___OR_T", + "Encrypted temporary file file with read-only attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"E___ORS_", + "Encrypted file with system and read-only attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"E___ORST", + "Encrypted temporary file file with system and read-only attribute that is available offline", + FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E__H____", "Encrypted file with hidden attribute", FILE_ATTRIBUTE_HIDDEN}, + {"E__H___T", + "Encrypted temporary file file with hidden attribute", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_TEMPORARY}, + {"E__H__S_", "Encrypted file with system and hidden attributes", FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM}, + {"E__H__ST", + "Encrypted temporary file file with system and hidden attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E__H_R__", + "Encrypted file with system and read-only attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY}, + {"E__H_R_T", + "Encrypted temporary file file with system and read-only attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"E__H_RS_", + "Encrypted file with hidden, system and read-only attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"E__H_RST", + "Encrypted temporary file file with hidden, system and read-only attributes", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E__HO___", + "Encrypted file with hidden attribute that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE}, + {"E__HO__T", + "Encrypted temporary file file with hidden attribute that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_TEMPORARY}, + {"E__HO_S_", + "Encrypted file with hidden and system attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM}, + {"E__HO_ST", + "Encrypted temporary file file with hidden and system attribute that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E__HOR__", + "Encrypted file with hidden and read-only attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY}, + {"E__HOR_T", + "Encrypted temporary file file with hidden and read-only attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"E__HORS_", + "Encrypted file with hidden, read-only and system attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"E__HORST", + "Encrypted temporary file file with hidden, read-only and system attributes that is available offline", + FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_TEMPORARY}, + {"E_A_____", "Encrypted file with archived attribute", FILE_ATTRIBUTE_ARCHIVE}, + {"E_A____T", + "Encrypted temporary file file with archived attribute", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_TEMPORARY}, + {"E_A___S_", "Encrypted file with system and archived attributes", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_SYSTEM}, + {"E_A___ST", + "Encrypted temporary file file with archived and system attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E_A__R__", + "Encrypted file with read-only and archived attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY}, + {"E_A__R_T", + "Encrypted temporary file file with archive and read-only attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"E_A__RS_", + "Encrypted file with read-only and archived attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"E_A__RST", + "Encrypted temporary file file with read-only and archived attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E_A_O___", + "Encrypted file with archived attribute is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE}, + {"E_A_O__T", + "Encrypted temporary file file with archive attribute that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_TEMPORARY}, + {"E_A_O_S_", + "Encrypted file with system and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM}, + {"E_A_O_ST", + "Encrypted temporary file file with system and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E_A_OR__", + "Encrypted file with read-only and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY}, + {"E_A_OR_T", + "Encrypted temporary file file with read-only and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"E_A_ORS_", + "Encrypted file with system, read-only and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"E_A_ORST", + "Encrypted temporary file file with system, read-only and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_TEMPORARY}, + {"E_AH____", "Encrypted file with hidden and archived attributes", FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN}, + {"E_AH___T", + "Encrypted temporary file file with archive and hidden attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_TEMPORARY}, + {"E_AH__S_", + "Encrypted file with system, archive and hidden attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM}, + {"E_AH__ST", + "Encrypted temporary file file with system, archive and hidden attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, + {"E_AH_R__", + "Encrypted file with read-only, hidden and archive attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY}, + {"E_AH_R_T", + "Encrypted temporary file file with read-only, hidden and archive attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_TEMPORARY}, + {"E_AH_RS_", + "Encrypted file with system, read-only, hidden and archive attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM}, + {"E_AH_RST", + "Encrypted temporary file file with read-only, hidden and archive attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_TEMPORARY}, + {"E_AHO___", + "Encrypted file with hidden and archived attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE}, + {"E_AHO__T", + "Encrypted temporary file file with archive and hidden attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_TEMPORARY}, + {"E_AHO_S_", + "Encrypted file with system, archive and hidden attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM}, + {"E_AHO_ST", + "Encrypted temporary file file with system, archive and hidden attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_TEMPORARY}, + {"E_AHOR__", + "Encrypted file with read-only, hidden and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY}, + {"E_AHOR_T", + "Encrypted temporary file file with read-only, hidden and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | + FILE_ATTRIBUTE_TEMPORARY}, + {"E_AHORS_", + "Encrypted file with system, read-only, hidden and archive attributes that is available offline", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | + FILE_ATTRIBUTE_SYSTEM}, + {"E_AHORST", + "Encrypted file with all attributes", + FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_READONLY | + FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_TEMPORARY}, +}; + BOOL(WINAPI* WinNtEncryptFileA)(LPCSTR); #endif // SETTER_SRC_WIN32_ATTR_H_