Microsoft Windows CE 3.0  

SetFileAttributes

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function sets the attributes of a file. A remote application interface (RAPI) version of this function exists, and it is called CeSetFileAttributes.

BOOL
SetFileAttributes(
LPCTSTR
lpFileName
,
DWORD
dwFileAttributes
);

Parameters

lpFileName
[in] Pointer to a string that specifies the name of the file whose attributes are to be set.

There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the SetFileAttributesfunction parses paths.

dwFileAttributes
[in] Specifies the file attributes to set for the file. This parameter can be a combination of the following values. However, all other values override FILE_ATTRIBUTE_NORMAL.
Value Description
FILE_ATTRIBUTE_ARCHIVE The file is an archive file. Applications use this attribute to mark files for backup or removal.
FILE_ATTRIBUTE_HIDDEN The file is hidden. It is not included in an ordinary directory listing.
FILE_ATTRIBUTE_NORMAL The file has no other attributes set. This attribute is valid only if used alone.
FILE_ATTRIBUTE_READONLY The file is read-only. Applications can read the file but cannot write to it or delete it.
FILE_ATTRIBUTE_SYSTEM The file is part of the operating system or is used exclusively by it.
FILE_ATTRIBUTE_TEMPORARY The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The SetFileAttributesfunction does not work on the ROM file system. Inherently, this call is dependent on the file system support provided by a file system driver.

An application cannot change the attributes of a directory in the RAM file system.

The following table describes how to set the attributes in the RAM file system that cannot be set using SetFileAttributes.

Attribute How to Set
FILE_ATTRIBUTE_DIRECTORY Files cannot be converted into directories. To create a directory, use the CreateDirectoryfunction.

Not all file systems support all attributes.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h   Coredll.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CeSetFileAttributes, CreateDirectory, GetFileAttributes, GetLastError